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)
-   -   Load different style sheets for main categories (https://forum.x-cart.com/showthread.php?t=63616)

kdw 03-25-2014 04:35 AM

Re: Load different style sheets for main categories
 
Hi again
I have
{if $topId eq 52}
{load_defer file="css/shoes.css" type="css"}
{/if}
in service_css.tpl
and
{elseif $topId eq 52}
<img src="{$AltImagesDir}/schools/school_shoes.png" alt="" />
in head.tpl


Works fine.
This changes the styles in the product pages too which is what is needed.
Now I need to do the same for a sub category?
Have different styles and main logo for different sub cats.

I can use if $catid and styles change when I go to that category page BUT when I then click on a product the style reverts to the main category style.
Can anyone advise what to use so that the sub cat style is maintained as long as it is when using if $topid ie. through cat pages, product listing pages and product details page.

Assuming this is possible of course!


Thanks

cherie 03-25-2014 09:08 AM

Re: Load different style sheets for main categories
 
Not clear on what you are looking for. Are you no longer wanting to check the top categoryid (topId) or are you ending up on a product page that does not have the correct topId?

If the subcategories and products are under the same topId then they should maintain the style if you are keying off topId.

kdw 03-25-2014 09:17 AM

Re: Load different style sheets for main categories
 
Thanks for getting back on this.
At the moment I have different logo and style sheet working based on $topid.
Works fine and the chosen image and stylesheet stays in place through category and product pages.
However I would like to be able to have a different image and style sheet based on the sub category, overriding the top level once in the sub category and it's product pages.
Is there a $subcatid or something I can use like I am using $topid?

Here is the site
http://www.graypalmer.co.uk/store/

EG. Default styles show when entering shop.
Clicking a main category changes img and stylesheet and this persists through sub cats to product details etc.
On some sub cats however I now want to also override the main img and styles.
Hope that clarifies?
Many thanks.
Keith

cherie 04-01-2014 04:53 PM

Re: Load different style sheets for main categories
 
Wouldn't post 17 do the trick?

If you are looking for $catid you could see if $current_category or $product.categoryid will do the trick. Check the Smarty variables for the page you are on to see if something looks like it might work.

totaltec 04-02-2014 05:18 PM

Re: Load different style sheets for main categories
 
@tech990

Dude, have you been working on this for 2 years? :-)


All times are GMT -8. The time now is 03:28 AM.

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