| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Custom Root Category Template | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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. |
|||||||
#2
|
|||||||
|
|||||||
![]() 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 |
|||||||
#3
|
|||||||
|
|||||||
![]() 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 |
|||||||
#4
|
|||||||
|
|||||||
![]() |
|||||||
#5
|
|||||||
|
|||||||
![]() 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:
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 |
|||||||
#6
|
|||||||
|
|||||||
![]() 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 |
|||||||
#7
|
|||||||
|
|||||||
![]() 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:
Upon further review, maybe change the last elseif line to just else? Code:
?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4 |
|||||||
#8
|
|||||||
|
|||||||
![]() 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. |
|||||||
#9
|
|||||||
|
|||||||
![]() 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 |
|||||||
|
|||
X-Cart forums © 2001-2020
|