X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Alter product.tpl for one product (https://forum.x-cart.com/showthread.php?t=33055)

abeight 08-06-2007 06:33 AM

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!

carpeperdiem 08-06-2007 06:46 AM

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.

abeight 08-06-2007 07:04 AM

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. :)

carpeperdiem 08-06-2007 07:10 AM

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)

abeight 08-20-2007 02:57 PM

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!


All times are GMT -8. The time now is 09:47 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.