Question

J'ai créé une nouvelle option comme pickup @ office dans la section de facturation OnePage au lieu de l'autre deux options Ship to this address Ship to different address. Si le client choisit cette option pickup @ office il peut utiliser une adresse pour l'adresse de facturation. Mais l'adresse d'expédition sera mis progametically. Je l'ai fait jusqu'à cette étape. Ce que je veux faire ensuite est de passer directement à la section shipping methods en sautant shipping address. Pour cela est-il une meilleure façon, sauf impérieuses OnepageController.php.

Toutes les suggestions seront appréciées. Merci d'avance.

Était-ce utile?

La solution

Enfin, ce fut la seule solution que je pouvais trouver. Nécessité de remplacer le dispositif de commande 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 \ \ MonModule contrôleurs \ 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));
        }
}
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top