![]() |
if no. of subcategories greater than X, do this
Hi,
What I'm trying to do is create an edit that tells x-cart to show 'content A' if there's less than 3 subcategories within a category and 'content B' if there are more than 3... i realise it's an if statement of some-sort but can't seem to get the syntac right to make x-cart understand what I need it to do. Any ideas greatly appreciated |
Re: if no. of subcategories greater than X, do this
Where is the content to be displayed?
|
Re: if no. of subcategories greater than X, do this
it's to be used on subcategories.tpl
|
Re: if no. of subcategories greater than X, do this
{if $categories and $subcategories <= 3}
content {else} content {/if} will that work? |
Re: if no. of subcategories greater than X, do this
Off hand without looking at the code, I believe it would be:
Code:
{if $subcategories|@count gt 3} |
Re: if no. of subcategories greater than X, do this
Thanks Ashley but that didn't do it - Jon's version did though. Thank you both.
|
Re: if no. of subcategories greater than X, do this
Can someone explain the difference please? thx :)
|
Re: if no. of subcategories greater than X, do this
Quote:
@count counts the items in the array first, whereas the other method is a bit of a mismatch as the array has named values. I'm rubbish at explaining things ;D |
Re: if no. of subcategories greater than X, do this
A better understanding would be to print {$subcategories} and it will give you an array, NaN. Whereas, @count gives a number from counting the array to compare with.
|
Re: if no. of subcategories greater than X, do this
What does the | do?
|
All times are GMT -8. The time now is 07:12 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.