codeetcetera
codeetcetera

Reputation: 3203

How do I get the default checkout url for a magento store?

I'm trying to send a user to checkout programmatically in Magento. I can send them to $this->_redirect('checkout/onepage'); but if they have some sort of third party checkout extension I won't be using the proper one. Is there a way to get the default checkout url for the site and redirect there?

Upvotes: 4

Views: 24936

Answers (2)

MirzaShakir
MirzaShakir

Reputation: 399

you can try with

$checkout_link = Mage::helper('checkout/url')->getCheckoutUrl();

this return checkout link in all conditions

  • while using any extensions such as OnePagecheckout or OneStepcheckout
  • if on extension were used it simply returns the basic checkout url

Upvotes: 20

Tim Bezhashvyly
Tim Bezhashvyly

Reputation: 9100

By default checkout link is returned by getCheckoutUrl() function of Mage_Checkout_Block_Onepage_Link class. If is quite simple:

public function getCheckoutUrl()
{
    return $this->getUrl('checkout/onepage', array('_secure'=>true));
}

3rd party extensions will most likely override this class (i checked OneStepCheckout 1.4 and it works like this).

Upvotes: 4

Related Questions