Jump to content

[SOLVED] Allow BUY NOW and ADD TO CART button in product page


Recommended Posts

Does anyone know how to allow 2 buttons in product page and let customer choose:

1. Add to cart --> the product is sent to cart (currently this is ready in the module)

2. Buy now --> page redirect to cart summary to ask customer pay now

 

Example of the look :
image.jpg

 

My website now:

http://eviewtrading.com/denmall/denmall/female-fashion/26-american-polca-dress.html

Prestashop version: 1.5.6.1 

Edited by Lance Chan (see edit history)
Link to comment
Share on other sites

You can remove the "rel" part off the buy now button link, so that it doesn't trigger javascript, and also remove  the ajax_add_to_cart_button class ;)

 

edit: nope, I just noticed you used a submit. You added a submit inside an anchor, this is wrong :D Remove the submit inside and see what happens

Link to comment
Share on other sites

and what about paypal express checkout button?

 

Thanks Vekia for your concern, How if I have few payment gateway in future (COD, bank wire)? Is Paypal express checkout usable too? I need to use paypal for Malaysia currency, I think only Paypal Europe Module compatible, Paypal USA, Canada is not compatible with the local API.

Edited by Lance Chan (see edit history)
Link to comment
Share on other sites

You can remove the "rel" part off the buy now button link, so that it doesn't trigger javascript, and also remove  the ajax_add_to_cart_button class ;)

 

edit: nope, I just noticed you used a submit. You added a submit inside an anchor, this is wrong :D Remove the submit inside and see what happens

 

Hi, Nemo1, you mean which submit button, which section? Can you please give me an example?

My code:

 

<!-- Lance added buy now -->			
			<p id="add_to_cart" {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
				<span></span>
				<input type="submit" name="Submit" value="{l s='  Buy now  '}" class="exclusive" />	
			</p>
			<br>			
			<br>
		
<!-- Lance added buy now END-->							
			
			
			
			<p id="add_to_cart" {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
				<span></span>
				<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
			</p>
			{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
Link to comment
Share on other sites

Actually this is how it looks:

<a href="http://eviewtrading.com/denmall/denmall/3__american-polca-dress" title="more..."> <span></span> <input type="submit" name="Submit" value="  Buy now  " class="exclusive"></a>

You have a submit inside the a. You can use the code from product-list.tpl instead, so that you redirect to the cart page only, like this:

<a class="button ajax_add_to_cart_button exclusive" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product->id|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Buy Now'}"><span></span>{l s='Buy Now'}</a>

If it still gets targeted, remove the class "ajax_add_to_cart_button"

Link to comment
Share on other sites

Actually this is how it looks:

<a href="http://eviewtrading.com/denmall/denmall/3__american-polca-dress" title="more..."> <span></span> <input type="submit" name="Submit" value="  Buy now  " class="exclusive"></a>

You have a submit inside the a. You can use the code from product-list.tpl instead, so that you redirect to the cart page only, like this:

<a class="button ajax_add_to_cart_button exclusive" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product->id|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Buy Now'}"><span></span>{l s='Buy Now'}</a>

If it still gets targeted, remove the class "ajax_add_to_cart_button"

Hi. Nemo1. I did follow your guidance: http://eviewtrading.com/denmall/denmall/female-fashion/26-american-polca-dress.html

However, the button allows me to add product to cart, but do not proceed page to cart summary. Any guides that after add product to cart and also direct page to cart summary so that customer can do payment?

Edited by Lance Chan (see edit history)
Link to comment
Share on other sites

It should redirect you now. In the back office there should be an option not to send the user back to the page where it added the product to cart, I can't remember the exact name, it's something like "redirect user" ;) set it to no

 

 

Thank you, after enable "cart summary" in "redirect after adding product to cart", I can do it!

 

image.jpg

Edited by Lance Chan (see edit history)
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
×
×
  • Create New...