我正在尝试跳过 magento 1.9.1 上的 One Page checkout 上的运输方式步骤。我已经让模块运行并跳过/隐藏该步骤,因为这不是必需的。我已经在购物车页面上启用了方法选择。
我的问题是我的结帐有 4 个步骤:
- 计费信息
- 运输信息
- 付款信息
- 订单审核
我遇到的问题是,在客户输入他的帐单信息并单击使用帐单地址进行运输后,他将继续进行第 3 步。但是,对于他已跳过的第 2 步,进度图标不会更改为已完成状态。例如,如果他在第一步决定要运送到不同的地址并移至第 2 步,则这会将状态更改为活动状态,然后在移至第 3 步时完成。
我不知道如何解决这个问题。请帮助您的专业知识。模块文件详细信息如下。我知道这是由于这个模块,因为当我添加它时,进度不会改变。但是,当不活动时,我的步骤工作正常。希望大家能帮忙。谢谢
配置文件
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<JMAWD_Checkout>
<version>0.0.2</version>
</JMAWD_Checkout>
</modules>
<global>
<models>
<checkout>
<rewrite>
<type_onepage>JMAWD_Checkout_Model_Type_Onepage</type_onepage>
</rewrite>
</checkout>
</models>
<blocks>
<checkout>
<rewrite>
<onepage_shipping_method>JMAWD_Checkout_Block_Onepage_Shipping_Method</onepage_shipping_method>
</rewrite>
</checkout>
</blocks>
</global>
<frontend>
<routers>
<checkout>
<args>
<modules>
<checkoutjmawd before="Mage_Checkout">JMAWD_Checkout</checkoutjmawd>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
OnepageController.php
class JMAWD_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
public function saveShippingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$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'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
$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'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
else {
$result['goto_section'] = 'shipping';
}
} $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
}
/Model/Type 文件夹中的 Onepage.php
<?php
class JMAWD_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
{
protected function validateOrder()
{
$helper = Mage::helper('checkout');
if ($this->getQuote()->getIsMultiShipping()) {
Mage::throwException($helper->__('Invalid checkout type.'));
}
$addressValidation = $this->getQuote()->getBillingAddress()->validate();
if ($addressValidation !== true) {
Mage::throwException($helper->__('Please check billing address information.'));
}
if (!($this->getQuote()->getPayment()->getMethod())) {
Mage::throwException($helper->__('Please select valid payment method.'));
}
}
}
/Block/Onepage/Shipping 文件夹中的 Method.php
<?php
class JMAWD_Checkout_Block_Onepage_Shipping_Method extends Mage_Checkout_Block_Onepage_Shipping_Method
{
public function isShow()
{
return false;
}
}
最后是模块 xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<JMAWD_Checkout>
<active>true</active>
<codePool>local</codePool>
</JMAWD_Checkout>
</modules>
</config>