Jump to content

2 Different Product Pages with separate CSS


Recommended Posts

Hi,

Please can someone explain to me how I would go about having 2 different product.tpl files and 2 separate product.css files.

 

I only have a hand full of products that need to use a the alternative product page layout so I do not mind having to hard code anything.

 

I have seen a couple of suggestions in the past but either cannot get them to work on my PS 1.5.3 or they are not quite what I need.

 

Please help.

Thanks

Link to comment
Share on other sites

well it is impossible by default, you can use some if conditions to create new product.tpl body, where you can define new class="" or id=""

 

for example:

 

{if $product->id==PRODUCT_ID_FOR_WHICH_YOU_WANT_NEW_THEME}
new product.tpl body
{else}
current product.tpl body
{/if}

 

in new body use:

 

<div id="NEW_primary_block" class="clearfix" style="margin-top:0px;">

 

instead the

 

<div id="primary_block" class="clearfix" style="margin-top:0px;">

 

 

and in product.css you can create new css styles for new template

Link to comment
Share on other sites

Thanks Vekia.

You may need to explain to me where to place these sections of code and what to create step by step. Sorry...

Let me know what files to edit / create etc and exactly what to copy and paste if you could. Thank you very much in advance!!!!

Link to comment
Share on other sites

remove all themes/your_theme/product.tpl contents, (copy to clipboard ctrl+c)

 

 

now you've got clean product.tpl file, paste there the code i pasted below:

 

{if $product->id==PRODUCT_ID_FOR_WHICH_YOU_WANT_NEW_THEME}
new product.tpl body
{else}
old product.tpl body
{/if}

 

 

PRODUCT_ID_FOR_WHICH_YOU_WANT_NEW_THEM - this is number - id of your product for which you want to create new page

new product.tpl body - this is the code of new page (just paste old code and change class, id names for html elements

old product.tpl body - paste there old contets that you deleted

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Can anyone tell me how I would make this code work with multiple product ID's.

 

At the moment it is

{if $product->id==1}

 

I tried

{if $product->id==1,2,3}

but that doesn't work.

 

use this:

 

{if $product->id==1 || $product->id==2 || $product->id==3}

 

 

 

|| means "OR"

 

hey, if your modification will be ready - please let me know - i want to see this :-)

Link to comment
Share on other sites

  • 1 month later...

Hey, I want this, but then sorted by Category. So if a product is in category 93 it should take the other code.

 

		{if ($category->id == 93)}
					<!-- quantity wanted nieuwe-->
<div id="quantity_wanted_p" class="product-qty"><input readonly="readonly" id="quantity_wanted" class="input-text qty" type="text" maxlength="12" size="2" value="1" name="qty"></input><input class="qty-increase" type="button" onclick="var qty_el = document.getElementById('quantity_wanted'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;"></input><input class="qty-decrease" type="button" onclick="var qty_el = document.getElementById('quantity_wanted'); var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;"></input></div>
		{else}
<p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
<label>{l s='Quantity:'}</label>
<input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|floatval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="5" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
</p>
		{/if}

 

 

This would supposed to work, but if a product is in a sub-category or a second category the it doesent work. So in the list of category 93, it works but if I look at the product in any other category it doesent work.

 

Thanks in advance.

 

 

EDIT:

I've found a solution! Every product only saves one single category and that is the default category, so you'd have to sort by default category by using this:

{if ($product->id_category_default == 93)}

Edited by Bolinga (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...