Post by aqibboy2 » Sun Jun 03, 2012 8:14 am

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.
Last edited by aqibboy2 on Wed Jun 06, 2012 11:58 am, edited 1 time in total.

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by inactiveaccount9912 » Sun Jun 03, 2012 8:46 am

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.

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by aqibboy2 » Sun Jun 03, 2012 11:20 am

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...

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by inactiveaccount9912 » Sun Jun 03, 2012 6:05 pm

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.

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by aqibboy2 » Mon Jun 04, 2012 2:09 am

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

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by aqibboy2 » Mon Jun 04, 2012 11:09 pm

No Reply :( Please Help me...

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by inactiveaccount9912 » Tue Jun 05, 2012 1:03 am

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

Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am

Post by aqibboy2 » Wed Jun 06, 2012 11:57 am

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...

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am
Who is online

Users browsing this forum: paulfeakins and 13 guests