Showing posts with label Add buy now button on product page magento. Show all posts
Showing posts with label Add buy now button on product page magento. Show all posts

Monday 11 January 2016

How to add buynow button on product page in magento


How to add buynow button on product page in magento

Kindly open app/design/frontend/package/theme/template/catalog/product/view.phtml

Add below line into <form> Tag

<input type="hidden" name="buy_now" id="buy_now" value="" />

Put below button at anywhere where you want

<button type="button" onclick="jQuery('#buy_now').val('buy_now');productAddToCartForm.submit(this)" class="btn btn-block btn-express-buynow"><i class="cart-icon-white m-r-sm v-middle"></i>Buy Now</button>

Now open app/code/core/Mage/Checkout/controllers/CartController.php

Change the code as below instructions

Put below line in _goBack() function at very first

$buy_now = $this->getRequest()->getParam('buy_now');

FInd the line in _goBack() function $this->getResponse()->setRedirect($backUrl); and replace this line as below code

    if (!empty($buy_now)) {
        $this->_redirect('onepagecheckout'); // If you are using onepagecheckout or use this $this->_redirect('checkout/onepage/')
    }else{
        $this->getResponse()->setRedirect($backUrl);
    }

That's it. Enjoy Chandresh rana's Coding...