Page 1 of 1
Need BUY IT NOW Button With every Product[Solved]
Posted: Sun Jun 03, 2012 8:14 am
by aqibboy2
Hi Open Cart Members,
I hope you are all good,i'm really enjoying this open cart script but the problem i'm facing i want to add "Buy it now" Button With every Product.
I want Both button,"Add TO Cart" and "Buy it Now" The Buy it Now Function Should work like in that way it redirect you to view shopping cart page and the product already list there,Like in one click i need two function.
i try this below code
Code: Select all
<div class="cart"><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" href="index.php?route=checkout/cart" ><span><?php echo $button_cart; ?></span></a></div>
Most of the time it works, but on occasion the shopping cart will be empty.
This is from the error log when the button does not work correctly.
Re: Need BUY IT NOW Button With every Product
Posted: Sun Jun 03, 2012 8:46 am
by inactiveaccount9912
Here is a small tutorial on how to make the add to cart redirect to cart/checkout :
http://forum.opencart.com/viewtopic.php ... =0#p180983
But in common.js, instead of modifying the add to cart function, first duplicate it to add to cart 2 and then apply the modification.
Then , when you add the buy now button, basicaly copy the add to cart , change the function's name at onclick to addtocart2 and of course change its name.
Re: Need BUY IT NOW Button With every Product
Posted: Sun Jun 03, 2012 11:20 am
by aqibboy2
florinsith wrote:Here is a small tutorial on how to make the add to cart redirect to cart/checkout :
http://forum.opencart.com/viewtopic.php ... =0#p180983
But in common.js, instead of modifying the add to cart function, first duplicate it to add to cart 2 and then apply the modification.
Then , when you add the buy now button, basicaly copy the add to cart , change the function's name at onclick to addtocart2 and of course change its name.
Your Suggestion Work very well a huge thanks from my side.The only problem i come to know when i change the item quantity and then click on "buy it now" it wont count quantity and i'm wondering if we add more attribute like size color it also wont count those thing...
Re: Need BUY IT NOW Button With every Product
Posted: Sun Jun 03, 2012 6:05 pm
by inactiveaccount9912
I guess, you are having this problem on the product page. The product page has dufferent code for the add to cart button, in product.tpl , near the end find the js for button-cart, duplicate it to button-cart2 and aply the modification. And then again clone the add to cart button from product .tpl , change its name and its id to button-cart2.
Re: Need BUY IT NOW Button With every Product
Posted: Mon Jun 04, 2012 2:09 am
by aqibboy2
florinsith wrote:I guess, you are having this problem on the product page. The product page has dufferent code for the add to cart button, in product.tpl , near the end find the js for button-cart, duplicate it to button-cart2 and aply the modification. And then again clone the add to cart button from product .tpl , change its name and its id to button-cart2.
Again huge Thanks,This one work like a fire but again a little problem,when i increase the item quantity let say 3 and i click on buy it now button it will redirect to me view cart but on there it will show 4 quantity instead of 3 quantity,Means it automatically plus one value.
Also if customer chose item size let say large one with some extra money this buy it now button wont work

it behave like ad to cart
Example:
http://decentstore.com/index.php?route= ... duct_id=46
For simple product buy it now button work fine,but still it will count quantity in wrong way.
http://decentstore.com/Iphone-4s
Re: Need BUY IT NOW Button With every Product
Posted: Mon Jun 04, 2012 11:09 pm
by aqibboy2
No Reply

Please Help me...
Re: Need BUY IT NOW Button With every Product
Posted: Tue Jun 05, 2012 1:03 am
by inactiveaccount9912
Remove the onclick of the buy now button on product page. Its enough to have the id button-cart2, it doesnt need the onclick. Right now, its added once trought the code from product.tpl and once trough the code from common.js
Re: Need BUY IT NOW Button With every Product
Posted: Wed Jun 06, 2012 11:57 am
by aqibboy2
florinsith wrote:Remove the onclick of the buy now button on product page. Its enough to have the id button-cart2, it doesnt need the onclick. Right now, its added once trought the code from product.tpl and once trough the code from common.js
Thank you Very Much a Huge Thanks From My side,Problem Has Been Resolved every thing working Like Fire i really appreciate your help.God Bless You...