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

Alter product.tpl for one product

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-06-2007, 06:33 AM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Alter product.tpl for one product

Is there an IF statement that I can use to change the look and feel of the product.tpl file for one particular product? V 4.1.8

TIA!
__________________
~ Andrea Beight
Reply With Quote
  #2  
Old 08-06-2007, 06:46 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Alter product.tpl for one product

At least 2 ways to do this:

1. Buy WebsiteCM's "multiple product page templates" mod (I did)

2. CLONE your product.tpl -- for example, if you have 2 "unique" products -- call them 01_product.tpl and 02_product.tpl

then, in /skin1/customer/home_main.tpl

FIND:
Code:
{elseif $main eq "product"} {include file="customer/main/product.tpl" product=$product}
REPLACE WITH:
Code:
{elseif $main eq "product"} {if $product.categoryid == 1} {include file="customer/main/01_product.tpl" product=$product} {elseif $product.categoryid == 2} {include file="customer/main/02_product.tpl" product=$product} {else} {include file="customer/main/product.tpl" product=$product} {/if}
You may want to adjust the {if $product.categoryid == 1} to something else, if you have more than one product in a category.

If you have more than a few unique product layouts, Jon's mod can be an invaluable time saver. I am happy I am using the mod.

He also has a mod for unique categories. Works great.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 08-06-2007, 07:04 AM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: Alter product.tpl for one product

Thank you for your suggestions. I will give the second one a shot first. I only need to change the layout for one product, but I can see how Jon's mod would be very helpful if you wanted several different product layouts.
__________________
~ Andrea Beight
Reply With Quote
  #4  
Old 08-06-2007, 07:10 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Alter product.tpl for one product

$product.categoryid

may need to be

$product.productid

not sure on this -- you can fish it out in webamster mode with your smarty template engine set to debug

in file, smarty.php

find:
$smarty->debug_tpl = "file:debug_templates.tpl";
change to:
#$smarty->debug_tpl = "file:debug_templates.tpl";
$smarty->debug_tpl = "file:debug.tpl";

(then turn on webmaster mode)
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 08-20-2007, 02:57 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default Re: Alter product.tpl for one product

I finally got around to using this and wanted to let you know that your code worked like a charm! Thank you so much!
__________________
~ Andrea Beight
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 06:03 AM.

   

 
X-Cart forums © 2001-2020