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)
-   -   Custom Root Category Template (https://forum.x-cart.com/showthread.php?t=26754)

sandersdesign 11-20-2006 11:03 AM

Custom Root Category Template
 
Hi, we would like to show a custom template for a root level category page, seen at http://www.digi-quick.co.uk/home/818/Memory_Cards.

I've purchased the Custom Category and Product "http://www.websitecm.com" mods but as it fails to control Root level categories I've been researching on how we could use a {elseif} tag in the "home_main.tpl" template.

I'm currently unsure how this "elseif" should look, currently i've tryed:
------------------
{elseif $main eq "Memory_Cards"}
{include file="customer/main/Memory_Cards.tpl"}

-------------------------

which fails to work. Any help welcome, many thanks.

carpeperdiem 11-20-2006 11:19 AM

Re: Custom Root Category Template
 
Well.... ready to have some fun?

When you say "root categories" I take it you are talking about your primary or "home" page, yes?

Your home page is basically, welcome.tpl ---

what if you were to make a new file, call it, "homepage.tpl" and call it from welcome.tpl ? :-)

{include file="customer/main/homepage.tpl"}

IF -- and only if, you are using a SEO mod, such as CDSEO, where your product or category pages are called by a unique URL, then you can get away with this... and simply link to your product directly from the homepage.tpl

Am I understanding what you're trying to do?

sandersdesign 11-20-2006 11:31 AM

Re: Custom Root Category Template
 
thanks for the message, I'm not thinking of the Home Page, I referring to a Main Category Page which holder sub-categories. In this case it's a Memory Card category with sub-cates for different types of digital memory card types, i.e. Compact Flash, Memory Sticks ect

Thanks

sandersdesign 11-20-2006 11:32 AM

Re: Custom Root Category Template
 
http://www.digi-quick.co.uk/home.php?cat=818, http://www.digi-quick.co.uk/home/818/Memory_Cards

carpeperdiem 11-20-2006 11:44 AM

Re: Custom Root Category Template
 
Oh -- the subcat page.

Yes, an elseif should work...

no guarantees this is the right code, but it should get you close...

in home_main.tpl

Code:

{elseif $main eq "catalog"}
{if $category.categoryid == XYZ}
{include file="customer/main/new-subcategories-page.tpl" cat=$cat}
{elseif $main eq "catalog"}
{include file="customer/main/subcategories.tpl" cat=$cat}
{/if}


I am not certain if $category.categoryid is legit -- I know that $product.categoryid is legit and I use it (Jon has not ported the template mod to 4.1 yet, so i had to hard code it)

Basically, hard-code a clone of subcategories.tpl to look how you want it (only for one category) and let the elseif find it...

Does this help? I hope so...

sandersdesign 11-21-2006 03:10 AM

Re: Custom Root Category Template
 
i can't seem to get the following to work,

{elseif $main eq "catalog"}
{if $category.categoryid == 818}
{include file="customer/main/subcategories_Mcards.tpl" cat=$cat}
{elseif $main eq "catalog"}
{include file="customer/main/subcategories.tpl" cat=$cat}
{/if}

Am i missing anything, thanks

carpeperdiem 11-21-2006 03:34 AM

Re: Custom Root Category Template
 
As I said, I am not certain the variable is "$category.categoryid" -- if you can determine the variable for the categoryid, you're there.

This one may have to go to x-cart support -- fortunately you don't need them to do the work, you are just asking a question, "what's the var?"

FYI, here's the code that I am using for my PRODUCT pages --- since WebsiteCM's templates mod doesn't work for 4.1 yet, I had to hard code the product pages... this works:

Code:

{elseif $main eq "product"}
{if $product.categoryid == 1}
{include file="customer/main/product_1.tpl" product=$product}
{elseif $product.categoryid == 2}
{include file="customer/main/product_2.tpl" product=$product}
{else}
{include file="customer/main/product.tpl" product=$product}
{/if}


Upon further review, maybe change the last elseif line to just else?

Code:

{elseif $main eq "catalog"}
{if $category.categoryid == 818}
{include file="customer/main/subcategories_Mcards.tpl" cat=$cat}
{else}
{include file="customer/main/subcategories.tpl" cat=$cat}
{/if}


?

sandersdesign 11-21-2006 11:24 AM

Re: Custom Root Category Template
 
X-cart dev gave me the following seems to work,

{elseif $main eq "catalog"}
{if $cat == 818}
{include file="customer/main/subcategories_Mcards.tpl" cat=$cat}
{else}
{include file="customer/main/subcategories.tpl" cat=$cat}
{/if}

thanks for the help carpeperdiem.

toltion 05-06-2008 09:16 AM

Re: Custom Root Category Template
 
Is there a way to do this without hard-coding the category ID in home_main.tpl? Something similar to the way WebsiteCM does custom subcategories where you have a field displaying which template to use showing in the admin>Modify Category module.

The reason I ask is we occasionally change layouts on root categories just to keep the site looking fresh. We also have several different layouts for different root-level categories. It would be nice to have several templates pre-written and be able to select which one to use without editing code (so a non-technical person can select the layout).

Thanks,

Tony


All times are GMT -8. The time now is 02:19 AM.

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