Domanda

ho creato una nuova opzione come pickup @ office nella sezione fatturazione onepage invece delle altre due opzioni Ship to this address Ship to different address. Se cliente sceglie questa opzione pickup @ office può usare qualsiasi indirizzo per l'indirizzo di fatturazione. Ma l'indirizzo di trasporto sarà impostato progametically. Ho fatto fino a questo punto. Quello che voglio fare adesso è quello di passare direttamente alla sezione shipping methods saltando shipping address. Per questo c'è un modo migliore, tranne l'override OnepageController.php.

Qualche suggerimento sarà apprezzato. Grazie in anticipo.

È stato utile?

Soluzione

Infine, questa era l'unica soluzione sono stato in grado di trovare. Necessità di sostituire il controller 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 \ controller \ 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));
        }
}
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top