| ||||||||||
| Shopping cart software Solutions for online shops and malls | ||||||||||
|
|
||||||||||
| X-Cart Home |
if no. of subcategories greater than X, do this | ||||
![]() |
|
|||
|
|
Thread Tools | Search this Thread |
|
#1
|
|||||||
|
|||||||
|
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
__________________
Best regards, Donavichi. - - - Website Copywriting || Web Design || FAQs || Home & Garden Blog |
|||||||
|
#2
|
|||||||||
|
|||||||||
|
Where is the content to be displayed?
__________________
xcart 5.1.2 |
|||||||||
|
#3
|
|||||||
|
|||||||
|
it's to be used on subcategories.tpl
__________________
Best regards, Donavichi. - - - Website Copywriting || Web Design || FAQs || Home & Garden Blog |
|||||||
|
#4
|
|||||||||
|
|||||||||
|
{if $categories and $subcategories <= 3}
content {else} content {/if} will that work?
__________________
xcart 5.1.2 |
|||||||||
|
#5
|
|||||||||
|
|||||||||
|
Off hand without looking at the code, I believe it would be:
Code:
|
|||||||||
|
#6
|
|||||||
|
|||||||
|
Thanks Ashley but that didn't do it - Jon's version did though. Thank you both.
__________________
Best regards, Donavichi. - - - Website Copywriting || Web Design || FAQs || Home & Garden Blog |
|||||||
|
#7
|
|||||||||
|
|||||||||
|
Can someone explain the difference please? thx
__________________
xcart 5.1.2 |
|||||||||
|
#8
|
|||||||||
|
|||||||||
|
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
__________________
Doms kube v4.1.9 |
|||||||||
|
#9
|
|||||||||
|
|||||||||
|
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.
__________________
Doms kube v4.1.9 |
|||||||||
|
#10
|
|||||||||
|
|||||||||
|
What does the | do?
__________________
xcart 5.1.2 |
|||||||||
|
|
|||
|
X-Cart forums © 2001-2020
|
|||