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

CSS / skin swap in 4.3

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-21-2010, 08:48 PM
 
inteliboy1 inteliboy1 is offline
 

Member
  
Join Date: Jun 2010
Posts: 27
 

Default CSS / skin swap in 4.3

I need to have an option in the admin to select what CSS file the skin should use - ie, main.css, main_blue.css, main_red.css. Basically just changing some link & highlight colours for the entire site depending on the seasons.

I've noticed there is a Skin Swap mod though this is perhaps too cumbersome for my needs, and doesn't seem to support 4.3.

Any advice how to approach this?
__________________
X-Cart Pro
4.4
Reply With Quote
  #2  
Old 06-21-2010, 11:08 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: CSS / skin swap in 4.3

well, you could just make 3 different style sheets, then change which style sheet is called, when you want to.

or you could make different skins altogether and upload them. Name them skin1_summer, skin1_christmas... etc.

Then when you are ready name skin1 skin1_OG and name skin1_christmas skin1... then run cleanup.php.
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 06-22-2010, 12:48 AM
 
inteliboy1 inteliboy1 is offline
 

Member
  
Join Date: Jun 2010
Posts: 27
 

Default Re: CSS / skin swap in 4.3

True, it'd be easy for me to change the filename of the css, or edit the TPL file, but this for the owner/client to manage. Didn't realise X-Cart didn't have a simple way for a user to swap themes until this week, and now too far into the project.

Logically I can see how it could be done, though just don't have the php/smarty skills to do so:

An extra "Select Main CSS file" drop down field in the admin-> option saved in the DB -> if/else statements in tpl to load the correct CSS file.
__________________
X-Cart Pro
4.4
Reply With Quote
  #4  
Old 06-22-2010, 07:29 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: CSS / skin swap in 4.3

Run the following SQL patch:

Code:
INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`) VALUES ('css_theme', 'CSS Theme', 'Default', 'Appearance', '0', 'selector', 'Default', 'Default:default\nBlue:Blue\nRed:Red\n');

Open skin1/customer/service_css.tpl

FIND:

Code:
<link rel="stylesheet" type="text/css" href="{$SkinDir}/{#CSSFilePrefix#}.css" />

CHANGE TO:

Code:
<link rel="stylesheet" type="text/css" href="{$SkinDir}/{#CSSFilePrefix#}{if $config.Appearance.css_theme ne 'default'}_{$config.Appearance.css_theme}{/if}.css" />

Then name your css files:

main.css
main_blue.css
main_red.css
Reply With Quote
  #5  
Old 07-05-2010, 09:56 PM
 
inteliboy1 inteliboy1 is offline
 

Member
  
Join Date: Jun 2010
Posts: 27
 

Default Re: CSS / skin swap in 4.3

Jon - thank you so much for this!

This worked absolutely perfectly - also a really great tip for other x-cart designers/developers out there.
__________________
X-Cart Pro
4.4
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 02:37 PM.

   

 
X-Cart forums © 2001-2020