我正在尝试跳过magento 1.9.1上的One Page checkout上的送货方法步骤。我已经让模块运行并跳过/隐藏步骤,因为这不需要。我已在购物车页面上启用了方法选择。
我的问题是我的结帐有4个步骤:
我遇到的问题是,在客户输入其结算信息并点击使用结算地址进行发货后,他将转到第3步。但是,进度图标不会更改为已跳过的步骤2的已完成状态。例如,如果他决定他想在第一步运送到不同的地址并转到步骤2,那么这会将状态更改为活动状态,然后在移至步骤3时完成。
我无法解决如何解决这个问题。请帮助您的专业知识。模块文件详细信息如下。我知道这是由于这个模块,因为当我添加它时,进度不会改变。但是,当没有激活时,我的步骤正常。希望你们能帮忙。感谢
config.xml中
<?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 Folder
的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>
答案 0 :(得分:0)
我查看了代码,一切似乎工作正常,看起来很好。因此,为了获得改变状态的进展,我使用了jquery。所以如果有人在同一个问题上。您可以使用以下代码。刚添加到您的页脚。
<script>
jQuery(document).ready(function(){
jQuery('#billing-buttons-container button').click(function(){
if(!jQuery('#billing:use_for_shipping_no').is(':checked')) {
jQuery('#top-opc-shipping').addClass('allow');
}
});
});
</script>