0

I am trying to remove the shipping method from magento onepage checkout page by a new module refering to the second solution on this link [Remove Shipping steps in Onepage Checkout

but its not working.... please help me how can i adapt onepage.phtml ?

0

1) To remove the step first of all create layout/local.xml file in you current design theme with the following content:

<checkout_onepage_index>
    <reference name="checkout.progress">
        <action method="unsetChild"><alias>shippingmethod.progress</alias></action>
    </reference>
    <reference name="checkout.onepage">
        <action method="unsetChild"><alias>shipping_method</alias></action>
    </reference>
</checkout_onepage_index>

This will hide the shipping method step on checkout.

2) But also you have to modify checkout controller to load next step (payment method) instead of shipping method step when pressing "next" button on address step. Do do that you can observe event "controller_action_postdispatch_checkout" and use something like this in th observer:

public function skipShippingStep($observer)
{
    $action = $observer->getControllerAction();
    $body = $action->getResponse()->getBody();

    if (!strpos($body, '"goto_section":"shipping_method"')) {
        return $this;
    }

    $method = 'flatrate_flatrate';

    $action->getRequest()->setPost('shipping_method', $method);

    $result = Mage::helper('core')->jsonDecode($body);
    if (isset($result['duplicateBillingInfo']) && $result['duplicateBillingInfo'] == 'true') {
        $action->getRequest()->setPost('duplicateBillingInfo', 1);
    }

    $action->getRequest()->setActionName('saveShippingMethod')->setDispatched(false);

    // Fix layout cache issue
    $handlerName = 'checkout_onepage_paymentmethod';
    $cacheId = 'LAYOUT_'.Mage::app()->getStore()->getId().md5($handlerName);
    Mage::app()->getLayout()->getUpdate()->setCacheId($cacheId);

    return $this;
}

The parts of code were taken from our Skip Checkout Steps extension.

Hope that this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.