質問

新しいオプションを作成しました pickup @ office 他の2つのオプションの代わりに1ページの請求セクションで Ship to this address Ship to different address. 。顧客がこれを選択した場合 pickup @ office オプションは、請求先住所に任意の住所を使用できます。ただし、配送先住所は実施的に設定されます。私はこのステップを終えました。私が次にやりたいのは、直接に移動することです shipping methods スキップしてセクション shipping address. 。これは、OnePageController.phpをオーバーライドすることを除いて、より良い方法があります。

どんな提案にも感謝します。 Advancedに感謝します。

役に立ちましたか?

解決

最後に、これが私が見つけることができた唯一の解決策でした。コントローラーをオーバーライドする必要があります 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帰属
所属していません magento.stackexchange
scroll top