Jump to content

Different product templates.


Guest bigblock

Recommended Posts

Guest bigblock

I need to use different product templates based on which category the product is in.

How would I go about doing that? I don't see any info about this.

-sean

Link to comment
Share on other sites

Guest bigblock

Depends on which version of CC you're using.

I'm using v5 ~ I would up adding some stuff to catalogue.class.php:

// Customize template by category id

$catid = $product['cat_id'];

if($catid == 2){

	$usetemplate = 'content.product.retail.php';

}else if($catid == 3){

	$usetemplate = 'content.product.bulk.php';

}else{

	$usetemplate = 'content.product.case.php';

}

				

			

$content = $GLOBALS['smarty']->fetch('templates/' . $usetemplate );			

//$content = $GLOBALS['smarty']->fetch('templates/content.product.custom.php');

-sean

Link to comment
Share on other sites

Guest bigblock

Modifying the classes is never a good idea. Besides, you can do this using SMARTY. {$PRODUCT.cat_id} holds the product's category ID. You can then use this with the technique outlined here:

Thanks Homar;

I got around this by replacing the content of the content.product.php with this:

{if $PRODUCT.cat_id == 2}

    {include scope=parent file="skins/$SKIN_FOLDER/templates/content.product.retail.php"}

{else}

    {include scope=parent file="skins/$SKIN_FOLDER/templates/content.product.bulk.php"}

{/if}

works just fine.

-sean

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...