我创建了一个新选项 pickup @ office 在一页计费部分中,而不是其他两个选项 Ship to this address Ship to different address. 。如果客户选择此 pickup @ office 选项他可以使用任何地址用于帐单地址。但是运输地址将进行前进。我已经完成了这一步骤。我要接下来要做的是直接移动到 shipping methods 截面通过跳过 shipping address. 。为此,除了覆盖onepagecontroller.php之外,还有一种更好的方法。

任何建议将不胜感激。先谢谢了。

有帮助吗?

解决方案

最后,这是我唯一能够找到的解决方案。需要覆盖控制器 Mage_Checkout_OnepageController

config.xml

<config>
 . . . . . .
    <global>
            <rewrite>
                <test_cart> <!--This can be any unique id -->
                    <from><![CDATA[#^/checkout/onepage/#]]></from>  <!-- the URL which u want to override-->
                    <to>/mymodule/onepage/</to>  <!-- destination url -->
                </test_cart>
            </rewrite>
             . . . . . 
    </global>
    . . . . . . 
</config>

app code local mynamespace myModule controllers onepagecontroller.php

<?php

require_once 'Mage/Checkout/controllers/OnepageController.php';

class Mynamespace_Mymodule_OnepageController extends Mage_Checkout_OnepageController
{
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';
                } else {
                    $result['goto_section'] = 'shipping_method'; // set the checkout step which you want to move
                }
            }

            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
}
}
许可以下: CC-BY-SA归因
scroll top