| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Calling additional category as well as main category | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Calling additional category as well as main category
I am trying to setup a simple feature where I will be adding a category called "Whats New" and any item added to this category would then display a small "New" icon. It's basicall all working but I can't seem to call up the "additonal category" which would be the "Whats New" category with the {if} statement to determine when the image should be displayed. It only seems to call up the main category. Does anyone know how to call up ANY category the product is in on the products.tpl file? The addiotnal category ID in this case is 384 and it doesn't work.. if I use the main category id it does.. thanks.
{if $product.categoryid eq '384'} place image here (/if}
__________________
eHub - Web Design & Hosting X-Cart 4.2 / 4.3 / 4.4.X |
|||||||
#2
|
|||||||
|
|||||||
Re: Calling additional category as well as main category
Bump!..
Does anyone know? It would seem rather simple for anyone who has done any work with the categories before? thx
__________________
eHub - Web Design & Hosting X-Cart 4.2 / 4.3 / 4.4.X |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Calling additional category as well as main category
I know it's been a while, but since this is the thread that showed up while I was searching for this, I will post my solution here.
I'm sure that someone more experienced has a more elegant solution, but here is what I did in 4.6.4 [edited to add] On /product.php, around line 89 [end edit] after PHP Code:
PHP Code:
Then, on the product page (/common_files/customer/main/product.tpl around line 50) i put this Code:
|
|||||||||
#4
|
|||||||||
|
|||||||||
Re: Calling additional category as well as main category
I haven't tested this but should point you in the right direction for a bit more elegant solution.
Open include/func/func.product.php FIND: Code:
AFTER ADD: Code:
Open include/search.php FIND: Code:
AFTER ADD: Code:
Then in your templates on your product listings or your product details page you can use: Code:
|
|||||||||
#5
|
|||||||||
|
|||||||||
Re: Calling additional category as well as main category
Thank you.
The only problem that i see, right off the bat, is that this would need to be adjusted for each specific category that I want to flag for. Unless I'm reading it wrong |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Calling additional category as well as main category
I used category 384 as that was the category the first poster used.
You could change: Code:
To: Code:
And update X, Y and Z with your categoryids if you have more. If you wanted to have a dynamic admin where you could toggle categories off and on as new, I would create a new `is_new` category field in the database (you'd have to update the category add/modify pages as well) and then do a LEFT JOIN on the categories table like so. Code:
Then you could toggle categories off and on in the database. Or another way, if your new category names were the only ones that started with the word "New" you could do something like: Code:
Jon |
|||||||||
|
|||
X-Cart forums © 2001-2020
|