| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Disable 'Add to cart' for $0 products | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Wonder how to disable 'add to cart' button for products without a price, for example, the 'add to cart' button remains visible but does nothing onclick when the product is out of stock.
cheers
__________________
Version 4.2.1 |
|||||||
#2
|
|||||||
|
|||||||
![]() Products without a price? Try something like this:
{if $product.price ne 0}{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"} {else} {if $product.price eq 0}{$lng.lbl_your_label_that_you_want_displayed}
__________________
______________ version 4.1.9 Gold |
|||||||
#3
|
|||||||||
|
|||||||||
![]() How about...
{if $product.taxed_price ne 0} {include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"} {/if}
__________________
xcart 5.1.2 |
|||||||||
#4
|
|||||||
|
|||||||
![]() thanks for both replies,
I copied the code into /customer/main/product.tpl PHP Code:
to PHP Code:
This method works well only when there is no product variants. New question now is what template(s) should I edit for those hav variants? cheers
__________________
Version 4.2.1 |
|||||||
#5
|
|||||||
|
|||||||
![]() Currently I set the quantity to 0 for those products without a price to disable add to cart.
However, if the first variant on the list is set to be out of stock, then the rest of variants will appear to be out of stock too even they are stocked. Vice versa, if the first variant is set to be stocked, then the rest of products will still be able to add to cart even they are out of stock.
__________________
Version 4.2.1 |
|||||||
#6
|
|||||||||
|
|||||||||
![]() try this
{if $product.taxed_price ne 0 || $variant_price_no_empty}
__________________
xcart 5.1.2 |
|||||||||
#7
|
|||||||
|
|||||||
![]() Hi Ashley, thank you for your previous replies, even I replaced the code, the 'add to cart' button still work for variants with no price.
__________________
Version 4.2.1 |
|||||||
|
|||
X-Cart forums © 2001-2020
|