Peasant Peeb
Peasant Peeb

Reputation: 61

magento add item and redirect to one page checkout in url

I have seen answers that are close to what I am looking for. I want to add a product to the cart and also redirect to one page checkout in one single link tag from an email.

So far i have:

http://www.example.com/checkout/cart/add/product/20759/qty/1/

This successfully adds item to the cart, but does not re-direct to one page checkout. Is there any easy solution to add something to the url?

Ideally something like this?

http://www.example.com/checkout/cart/add/product/20759/qty/1/"one-page-checkout-link"

Thanks everyone!

Upvotes: 3

Views: 2060

Answers (3)

Karthigesh K
Karthigesh K

Reputation: 31

Please use the form_key for latest versions of magento.

For eg., http://www.example.com/checkout/cart/add/product/20759/qty/1/form_key/Nf9kXuUu89DLTeT7/?return_url=http://www.example.com/checkout/onepage/

Now the product will be add to cart in magento.

Note: Note the form_key in url

You can get the form key by using the below code:

Mage::getSingleton('core/session')->getFormKey(); 

Upvotes: 1

Peasant Peeb
Peasant Peeb

Reputation: 61

Thanks David! You pointed me in the right direction. here is what did the trick:

http://www.example.com/checkout/cart/add/product/20759/qty/1/?return_url=http://www.example.com/checkout/onepage/

If I had a higher rep I would vote you up.....

Thanks again.

Upvotes: 3

dmanners
dmanners

Reputation: 2072

If you add the parameter 'return_url' then this will work:

?return_url=http://magento.localhost/checkout/onepage/

It will need to be url encoded and also will be checked with the function _isUrlInternal as you cannot redirect to external urls.

Upvotes: 5

Related Questions