3

I have developed one Website on magento-1.9 version. Everything is working fine. Now, i need to add Buy now button additionally beside to the add to cart button at Single product page.

0

Create a new module with a new ControllerAction just like CartController::addAction() and write a redirect to checkout onepage.

Make a request to that function with the button "Buy Now".

0

I will give you 2 solutions:

Either

1: you create an observer checkout_cart_add_product_complete event to redirect to checkout whene you add a product instead a cart.

or

2: you rewrite app/code/core/Mage/Checkout/controllers/CartController.phpin your local codepool and rewrite the function protected function _goBack() and change at the end $this->_redirect('checkout/cart'); to $this->_redirect('checkout/onepage');

  • Can you tell me more clearly please > in your local codepool means ? – Teja Bhagavan Kollepara May 12 '17 at 10:44
  • app/code/local<-this is a local code pool, So to change the native behavior of magento, you must rewrite the file to not change directly in the core, it is forbidden. you can find many tutorials to know how to rewrite a cartController – PЯINCƏ May 13 '17 at 0:14
  • You mean, i need to create this CartController.php file in my local at the same path and need to edit that url right? – Teja Bhagavan Kollepara Nov 12 '17 at 13:52
  • No, you rewrite it in your local but just not the same path, refere you to this exemple magento.stackexchange.com/questions/92172/… – PЯINCƏ Nov 13 '17 at 8:49

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.