Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Custom Root Category Template

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-20-2006, 11:03 AM
 
sandersdesign sandersdesign is offline
 

Member
  
Join Date: Oct 2005
Posts: 26
 

Default 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.
__________________
www.sandersdesign.net
X-Cart Gold v4.0.16, Unix
Reply With Quote
  #2  
Old 11-20-2006, 11:19 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 11-20-2006, 11:31 AM
 
sandersdesign sandersdesign is offline
 

Member
  
Join Date: Oct 2005
Posts: 26
 

Default 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
__________________
www.sandersdesign.net
X-Cart Gold v4.0.16, Unix
Reply With Quote
  #4  
Old 11-20-2006, 11:32 AM
 
sandersdesign sandersdesign is offline
 

Member
  
Join Date: Oct 2005
Posts: 26
 

Default 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
__________________
www.sandersdesign.net
X-Cart Gold v4.0.16, Unix
Reply With Quote
  #5  
Old 11-20-2006, 11:44 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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...
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #6  
Old 11-21-2006, 03:10 AM
 
sandersdesign sandersdesign is offline
 

Member
  
Join Date: Oct 2005
Posts: 26
 

Default 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
__________________
www.sandersdesign.net
X-Cart Gold v4.0.16, Unix
Reply With Quote
  #7  
Old 11-21-2006, 03:34 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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}

?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #8  
Old 11-21-2006, 11:24 AM
 
sandersdesign sandersdesign is offline
 

Member
  
Join Date: Oct 2005
Posts: 26
 

Default 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.
__________________
www.sandersdesign.net
X-Cart Gold v4.0.16, Unix
Reply With Quote
  #9  
Old 05-06-2008, 09:16 AM
 
toltion toltion is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 39
 

Default 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
__________________
X-Cart Gold 4.1.9
Gift Registry/Special Offers
Advanced mini-cart
XC-SEO
Mulltiple Category/Product Templates
Also bought/recently viewed
Feedback reviewer/viewer bundle
Marketing Manager Pro bundle
many more mods
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:57 AM.

   

 
X-Cart forums © 2001-2020