remove step2 billing information
有点部分与ttp://www.excellencemagentoblog.com/magento-onestep-checkout-remove-payment-method-step相同
checkout
block onepage.php
public function getSteps()
{
$steps = array();
if (!$this->isCustomerLoggedIn()) {
$steps['login'] = $this->getCheckout()->getStepData('login');
}
$stepCodes = array( 'shipping', 'shipping_method', 'payment', 'review');
foreach ($stepCodes as $step) {
$steps[$step] = $this->getCheckout()->getStepData($step);
}
return $steps;
}
public function getActiveStep()
{
return $this->isCustomerLoggedIn() ? 'shipping' : 'login';
}
controllers onepage.php
public function saveShippingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$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);
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
/**
* FIXME: 修改了邮寄费输出格式SaveShipping
*/
'html' => preg_replace("/(>cn)|(>us)/i",'>',$this->_getShippingMethodsHtml())
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
opcheckout.js
this.steps = ['login', 'shipping', 'shipping_method', 'payment', 'review'];
由于使用的是prototype必须保证模板里面billing和shipping相同,也是把shipping模板中缺少的部分,从billing模板复制过来,放在对应的位置。
有点部分与ttp://www.excellencemagentoblog.com/magento-onestep-checkout-remove-payment-method-step相同
checkout
block onepage.php
public function getSteps()
{
$steps = array();
if (!$this->isCustomerLoggedIn()) {
$steps['login'] = $this->getCheckout()->getStepData('login');
}
$stepCodes = array( 'shipping', 'shipping_method', 'payment', 'review');
foreach ($stepCodes as $step) {
$steps[$step] = $this->getCheckout()->getStepData($step);
}
return $steps;
}
public function getActiveStep()
{
return $this->isCustomerLoggedIn() ? 'shipping' : 'login';
}
controllers onepage.php
public function saveShippingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$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);
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
/**
* FIXME: 修改了邮寄费输出格式SaveShipping
*/
'html' => preg_replace("/(>cn)|(>us)/i",'>',$this->_getShippingMethodsHtml())
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
opcheckout.js
this.steps = ['login', 'shipping', 'shipping_method', 'payment', 'review'];
由于使用的是prototype必须保证模板里面billing和shipping相同,也是把shipping模板中缺少的部分,从billing模板复制过来,放在对应的位置。