![]() |
4.2 need different product template for just 1 category
Hello,
This is a hard one to search for again because so many things changed with 4.2... So I have 1 specific category that needs a different product.tpl because we are including videos and some images and stuff in the product description and will require vastly a different layout. What is the best way to go about this change? I realize I will use a smarty if, else statement in the product.tpl I think ... but I have no idea how to form the statement properly or where to put it... do I then just copy everything into both the if and the else and then slowly just change the if section until it does what I need? |
Re: 4.2 need different product template for just 1 category
If 4.2 is the same as the 4.1 branch, in product.tpl, the variable $cat contains the categoryid of the current product, so you could do if-than statements based on the $cat variable.
You can test by temporarily putting this code in product.tpl and see if it gives you the data: Code:
<br />category: {$cat}<br /> If it works, you can use if/than/else statements based on the $cat variable to make the page. If you need differences for other category pages, you can try the solution posted here. |
Re: 4.2 need different product template for just 1 category
*****make a back up first*****
{if $cat eq 249} your new layout here {else} all other layouts here {/if} cahnge cat number with your cat number of course |
Re: 4.2 need different product template for just 1 category
Here are the first 10 lines of my product.tpl ... did I put this in the right spot? And this will be for category 1, I made it first and left it empty knowing I would have to fight this battle after I got the easy ones done....
Code:
{* EDIT: It worked! I set a margin vastly different in the first half of the code to test it, and it worked perfect ... did I put it in the right spot though? Or should it be before those javascript lines? |
Re: 4.2 need different product template for just 1 category
its fine.
|
Re: 4.2 need different product template for just 1 category
Thanks Ashley... can you recommend what to change in my product.tpl just for this category to get it to display thumnails of the "detailed images" under the main image so that a user can click them and it switches the image?
|
Re: 4.2 need different product template for just 1 category
will have to check that one out.
|
Re: 4.2 need different product template for just 1 category
Well technically the title of this thread was about the category and you guys solved that, so I will make a new thread about my other question with some examples...
|
Re: 4.2 need different product template for just 1 category
Related question...
What is the smarty if statement for checking to see if there is a stock of 0 on an item? Is it {if $product.appearance.empty_stock} ??? Or is that just saying if you have your store set to show out of stock items? If so, what is the right one? |
Re: 4.2 need different product template for just 1 category
{if $product.appearance.is_auction} right? Seems to work on my product.tpl page but I can't find the $lng.lbl_quanitity on my products_t.tpl page?? I need to remove that label if the stock is 0 from the category page...
|
Re: 4.2 need different product template for just 1 category
Maybe it was the first one, I don't know...
|
Re: 4.2 need different product template for just 1 category
I got everything I needed figured out again. Maybe I should just make 1 thread and stay in it and talk myself through things. I'm sorry I am probably annoying all of you! :)
|
Re: 4.2 need different product template for just 1 category
New question for this... Have some new products I need to change the product.tpl for again, and they are all in new categories that are in a new root level category, can I run the if statement for the root category or will I have to do it like "if in category 80 or 81 or 82" or something like that?
|
Re: 4.2 need different product template for just 1 category
moving to 4.2 section
|
All times are GMT -8. The time now is 04:03 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.