Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

4.2 need different product template for just 1 category

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-21-2009, 09:24 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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?
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #2  
Old 01-21-2009, 09:40 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default 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.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #3  
Old 01-21-2009, 09:41 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default 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
__________________
xcart 5.1.2
Reply With Quote
  #4  
Old 01-21-2009, 09:58 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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:
{* $Id: product.tpl,v 1.180 2008/12/05 12:54:17 joy Exp $ vim: set ts=2 sw=2 sts=2 et: *} <script type="text/javascript" src="{$SkinDir}/customer/popup_open.js"></script> <script type="text/javascript" src="{$SkinDir}/main/popup_image.js"></script> {if $cat eq 1} {if $active_modules.Special_Offers}

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?
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #5  
Old 01-21-2009, 10:01 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: 4.2 need different product template for just 1 category

its fine.
__________________
xcart 5.1.2
Reply With Quote
  #6  
Old 01-21-2009, 10:05 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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?
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #7  
Old 01-21-2009, 10:11 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: 4.2 need different product template for just 1 category

will have to check that one out.
__________________
xcart 5.1.2
Reply With Quote
  #8  
Old 01-21-2009, 10:21 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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...
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #9  
Old 01-22-2009, 05:08 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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?
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #10  
Old 01-22-2009, 05:15 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default 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...
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:02 AM.

   

 
X-Cart forums © 2001-2020