Jump to content

Different templates for each category of products


andy60131

Recommended Posts

I belive its possible. You might be able to just change the header and css by some smart {if} statements, but i'll leave it to you to explain exactly what you are trying to achieve first.

 

As a idea, try it out by making a template for each category that you have, remembering to use the category name as the template name

 

If your links are hardcoded on the site, you could just link directly to that category http://www.yourdom.com/whmcs/cart.php?gid=9&systemplate=categoryname

 

Where you have menus, that still possible.

 

if you take the category code from say your cart menu (this is 3.7.0 code)

 

{else}

<a href="{$smarty.server.PHP_SELF}?gid={$productgroup.gid}">{$productgroup.name}</a> |

{/if}

{/foreach}

 

and chnage it to

 

{else}

<a href="{$smarty.server.PHP_SELF}?gid={$productgroup.gid}&systemtemplate={$productgroup.name}">{$productgroup.name}</a> |

{/if}

{/foreach}

 

then when some-one changes product category from the cart, they'll get the template for that category.

 

could be a bit of a pain managing that many templates though.

Edited by Zorro67
Link to comment
Share on other sites

I was following another thread, and thought I wouldn't just take Sparky's word for it.

 

Guess what, may does work; it is possible to change your template from within the cart, because it is still grabbing the header, footer & css inside the cart.

 

It would therefore be possible to use a different image (for instance) in eac template, to suit the product group.

 

With another smart template hack, you could have your checkout or other buttons then default back to your default template

 

So feel free to try out my hack above & see what happens

Link to comment
Share on other sites

Hey no ones perfect

 

In your header.tpl you could use this

{if $smarty.server.PHP_SELF == '/cart.php'}

PUT YOUR CART HEADER PAGE STUFF HERE

{else}

PUT YOUR NORMAL HEADER STUFF HERE

{/if}

You could do the same for the footer.tpl to display a different footer

Link to comment
Share on other sites

  • 6 months later...

Not like me to troll, but I was working on something else and it twigged my thought on this thread.

 

instead of changing the the template, why not use if stetements to change the css. therefore, you could have multiple css files, with different key elements (but mostly the same) which load depending upon the existing variables (eg GID) that are called.

 

thats the tricky bit however.

 

Maybe I'll give it a try, and post some pics.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated