Question

I am working in magento.

I want to implement one step checkout for particular type of order. Other than that I want to keep the magento's default one page checkout flow as it is.

Is that possible ? I have tried to Google but unfortunately doesn't get any success.

Thanks, Milan

Was it helpful?

Solution

Look at config.xml in onestepcheckout extension, you'll see next event:

<controller_action_predispatch_checkout_onepage_index>
  <observers>
    <magenthemes_onestepcheckout_observer>
      <type>singleton</type>
      <class>onestepcheckout/observer</class>
      <method>initController</method>
    </magenthemes_onestepcheckout_observer>
  </observers>
</controller_action_predispatch_checkout_onepage_index>

So, you need to change function initController() in app/code/local/Magenthemes/Onestepcheckout/Model/Observer.php . Here is it:

public function initController($observer) {
    if (Mage::helper('onestepcheckout')->isActive()) {
         $observer->getControllerAction()->_redirect('onestepcheckout');
    }
}

This function simply check if extension is enabled and redirect from checkout/onepage to onestepcheckot. You can use something like this:

public function initController($observer) {
    $event = $observer->getEvent();
    $order = $event->getOrder();
    $use_onestep = true;// do some checks here using $order and set result (true|false)
    if (Mage::helper('onestepcheckout')->isActive() && $use_onestep) {
        $observer->getControllerAction()->_redirect('onestepcheckout');
    }
}

In result, by default process will go to checkout/onepage and redirect to onestep checkout when needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top