Tuesday, 14 April 2015

Magento – How to skip shopping cart page ?

app/code/local/Namespace/Cart/etc/config.xml

1. create event …

<checkout_cart_add_product_complete>
    <observers>
        <namespace_cartbypass_observer>
            <type>singleton</type>
            <class>Namespace_Cart_Model_Observer</class>
            <method>afterAddToCart</method>
        </namespace_cartbypass_observer>
    </observers>
</checkout_cart_add_product_complete>

/app/code/local/Namespace/Cart/Model/Observer.php

2. create observer..

class Namespace_Cart_Model_Observer extends Varien_Object
{
public function afterAddToCart(Varien_Event_Observer $observer) {
$response = $observer->getResponse();

$response->setRedirect(Mage::getUrl(‘checkout/onepage’));
Mage::getSingleton(‘checkout/session’)->setNoCartRedirect(true);
}

}

No comments:

Post a Comment