1.修改app\code\core\Mage\Checkout\Block \Onepage.php 我们需要做的是修改默认的step,就是修改getStep function
public function getSteps()
{
$steps = array();
if (!$this->isCustomerLoggedIn()) {
$steps['login'] = $this->getCheckout()->getStepData('login');
}
//$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
$stepCodes = array('billing', 'payment', 'review');
foreach ($stepCodes as $step) {
$steps[$step] = $this->getCheckout()->getStepData($step);
}
return $steps;
}
2.修改
app\code\core\Mage\Checkout\controllers\ OnepageController.php 删除shipping的html输出并且控制saveBillingAction() 处理后的跳转
protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
// 'shipping-method' => '_getShippingMethodsHtml',
'review' => '_getReviewHtml',
);
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
//$postData = $this->getRequest()->getPost('billing', array());
//$data = $this->_filterPostData($postData);
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
/*elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
'html' => $this->_getShippingMethodsHtml()
);
$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
}*/
//End of Comment by Amit Bera
else {
//$result['goto_section'] = 'shipping';
$result['goto_section'] = 'payment';
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
3.最后需要修改的是验证,如果不修改的话,会产品脚本验证的错误: app\code\core\Mage\Sales\Model\Service\ Quote.php
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
// if ($addressValidation !== true) {
// Mage::throwException(
//$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
//);
//}
// $method= $address->getShippingMethod();
//$rate = $address->getShippingRateByCode($method);
//if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
//Mage::throwException($helper->__('Please specify a shipping method.'));
//}
}
That's it...Happy Coding~