I am new to magento, using Magento 1.9. with custom theme. I succesfully created buy now button on addtocart.phtml
by the following codes:
<button type="button" title="Buy Now" class="button btn-cart" onclick="setcheckoutLocation('<?php echo $this->getAddToCartUrl($_product) ?>')">
<span><span>Buy Now</span></span>
</button>
<?php echo $this->getChildHtml('', true, true) ?>
But am confused in where to paste below javascripts on my view.phtml
? can any one say exactly next to which function or step number, I should paste these scripts?
<script>
jQuery.ajax({
type: "GET",
url: location,
success: function (data) {
window.location.href = "http://www.your-site.com/checkout/onepage/";
}
});
</script>
I planned to have 2 buttons,without disturbing eachothers:When someone clicks:
- Buynow button which should redirect to
checkout/onepage
- Add to cart button should do its default
checkout/cart
Thanks in advance. Any suggestions are very welcome! :)