Pregunta

He creado una nueva opción como pickup @ office en la sección de facturación de una página en lugar de las otras dos opciones Ship to this address Ship to different address. Si el cliente selecciona esto pickup @ office Opción puede usar cualquier dirección para la dirección de facturación. Pero la dirección de envío se establecerá progaméticamente. He hecho hasta este paso. Lo que quiero hacer a continuación es moverse directamente al shipping methods Sección omitiendo shipping address. Porque esto es una mejor manera, excepto anular OnePageController.php.

Cualquier sugerencia será apreciada. Gracias de antemano.

¿Fue útil?

Solución

Finalmente, esta fue la única solución que pude encontrar. Necesito anular el controlador 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 controlers 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));
        }
}
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top