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

Load different style sheets for main categories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 05-15-2012, 07:46 AM
 
kdw kdw is offline
 

Member
  
Join Date: Oct 2011
Posts: 17
 

Default Re: Load different style sheets for main categories

This seeems to work -
{if strpos($smarty.server.REQUEST_URI, "SWCHS") !== false}
<p>SWCHS image/CSS</p>
{else}
default image/css
{/if}

Needs proper testing but seems like a possible simple solution.

Where and in what template is this needed to load override CSS?

many thanks for your help. Much appreciated.
__________________
tech990
Reply With Quote
  #12  
Old 05-15-2012, 07:53 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Load different style sheets for main categories

No sweat, glad to help.

Look in:
/common_files/customer/service_css.tpl - or your custom skin directory instead of common_files.

Look a how it calls in the altskin near the bottom:
PHP Code:
{if $AltSkinDir}
  {
load_defer file="css/altskin.css" type="css"
If you call another style sheet after this, with the same classes defined, then the styles from main.css and altskin.css should be overwritten. I say "should be" because I have never tried it.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
kdw (05-15-2012)
  #13  
Old 05-15-2012, 08:03 AM
 
kdw kdw is offline
 

Member
  
Join Date: Oct 2011
Posts: 17
 

Default Re: Load different style sheets for main categories

Thanks.
My simple solution is fine until you get to product page. The category name is then not present in the URL.
Plan B?
Keith
__________________
tech990
Reply With Quote
  #14  
Old 05-15-2012, 08:10 AM
 
kdw kdw is offline
 

Member
  
Join Date: Oct 2011
Posts: 17
 

Default Re: Load different style sheets for main categories

I have just realised I can manually add the correct category name to the Clean URL.
It might just solve my problems. No doubt your coded solution would be more elegant?
Can you see any real problem with my approach here?
Thanks
Reply With Quote
  #15  
Old 05-15-2012, 09:26 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Load different style sheets for main categories

I tell you what, I think the category name not being present represents an SEO problem. But that's just my opinion. I don't see a problem, if the solution works, than it works.

Coding the solution in PHP would be more elegant and consistent, without worrying about changing url's around. Another solution to this issue that just occurred to me, is to put a select box on category and product pages, "theme" and then just set the proper themes based on the contents of that box. You could even do it with extra fields....maybe.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #16  
Old 05-15-2012, 09:54 AM
 
tartaglia tartaglia is offline
 

X-Adept
  
Join Date: May 2006
Location: Dallas, TX
Posts: 575
 

Default Re: Load different style sheets for main categories

Not to get "dreamy" here, but it is a shame this is sooo hard in XC. I have had a LC store running for 6 yrs and this functionality, to define different layouts for the subcategory, product list, and product details and to decide whether a particular subcat would inherit from above in the hierarchy, etc. has been built in as far back as I can remember.

I feel you pain in wanting this functionality back as I move towards XC 4.5.0
__________________
David Coggan
Carolyn Nussbaum Music Company
X-Cart v4.5.4 Gold +
LiteCommerce v2.2.41 (previous 6 years)
Reply With Quote
  #17  
Old 05-23-2012, 01:35 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Load different style sheets for main categories

Quote:
Originally Posted by tech@vrve.co
What if i had a comma separated list of cat IDs.
If $catid IN '22,23,25,35" .........
You can do this in Smarty:
PHP Code:
{assign var=myCats value=","|explode:"22,23,25,35"}
{if 
in_array($catid$myCats)} 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following 2 users thank cherie for this useful post:
am2003 (05-23-2012), kdw (05-23-2012)
  #18  
Old 05-23-2012, 11:59 PM
 
kdw kdw is offline
 

Member
  
Join Date: Oct 2011
Posts: 17
 

Default Re: Load different style sheets for main categories

Thanks cherie.
I will have 6 main categories, 2 main sub cats in those and 20 or so categories in each of the 2 sub cats so quite a few to add to array.
Also if client added a category it would need adding to code. Is there a way of testing for the main category only so that all sub and sub sub cats inherit the style and logo?
__________________
tech990
Reply With Quote
  #19  
Old 05-24-2012, 07:56 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Load different style sheets for main categories

I use this on product or category pages to get the top category id of the current location:

PHP Code:
{assign var=topId value="="|explode:$location.1.1}
{
assign var=topId value=$topId|@end
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following 2 users thank cherie for this useful post:
am2003 (05-24-2012), totaltec (05-24-2012)
  #20  
Old 05-24-2012, 08:08 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Load different style sheets for main categories

Elegant and simple solution Cherie! Thanks
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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:20 PM.

   

 
X-Cart forums © 2001-2020