| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Replace add to cart button with out of stock | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Replace add to cart button with out of stock
I want to replace my add to cart button with an out of stock button when my quantity is equal to 0 for that product. I am trying the following code below in my product.tpl file, but all that happens is no add to cart button appears at all even when quantity is not equal to 0.
Can you guys tell me the proper if else statement to use. Code:
|
|||||||
#2
|
|||||||
|
|||||||
You've got a nested if statement. You need to put your {else} after a {/if} to have it execute in-line with the first if statement.
Example: Code:
|
|||||||
#3
|
|||||||
|
|||||||
Quote:
Ok thank you, could you show me how to rearrange my code. I see the example, but still can't figure out my exact code I posted. |
|||||||
#4
|
|||||||
|
|||||||
Try this...
Code:
|
|||||||
#5
|
|||||||
|
|||||||
Quote:
I get this error if I try that. Fatal error: Smarty error: [in customer/main/product.tpl line 11]: syntax error: mismatched tag {/if}. (Smarty_Compiler.class.php, line 2221) in /home/hiphop/public_html/Smarty-2.6.3/Smarty.class.php on line 1082 |
|||||||
#6
|
|||||||
|
|||||||
All your {if} and {/if} tags need to be matched up. Try removing the last {/if}. Since you didn't post a complete set of working code it is hard to tell what is wrong.
Post your whole code if that doesn't fix it. |
|||||||
#7
|
|||||||
|
|||||||
Quote:
Ya, that still didn't work. Here is my original code pasted. I put spaces between where I think the page should be edited for this. Code:
|
|||||||
#8
|
|||||||
|
|||||||
It's very difficult to read code without the whitespace! Anyway, I think I figured out this much:
Code:
|
|||||||
#9
|
|||||||
|
|||||||
Quote:
Thanks for your help, although that doesn't seem to do it. It simply changes nothing. The add to cart still works and no out of stock image when I set the quantity to 0. |
|||||||
#10
|
|||||||
|
|||||||
Seems like your unlimited products could be on (disable inventory tracking)
Put {$config.General.unlimited_products} in your code and see what it returns. |
|||||||
|
|||
X-Cart forums © 2001-2020
|