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

Best way to add additional css file to custom theme

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-31-2014, 09:22 AM
 
spdesign spdesign is offline
 

Advanced Member
  
Join Date: Mar 2010
Posts: 31
 

Default Best way to add additional css file to custom theme

Looking for the most efficient way to add a css file to a custom theme and have it load LAST in X-Cart 5.x

I realize I could hard code a link to it into a .tpl file, but there's probably a better way to handle it to take advantage of aggregating/minifying that X-Cart 5 does.
Reply With Quote
  #2  
Old 10-31-2014, 10:14 AM
 
spdesign spdesign is offline
 

Advanced Member
  
Join Date: Mar 2010
Posts: 31
 

Default Re: Best way to add additional css file to custom theme

For 5.1.7:

Figured it out. Follow instructions in KB here: http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes

except with the following changes if your custom theme is a module.

In your module directory (classes/XLite/YourName/YourThemeName/View/) create AView.php with the following code

Code:
<?php namespace XLite\Module\YourName\YourThemeName\View; class AView extends \XLite\View\AView implements \XLite\Base\IDecorator { public function getCSSFiles() { $list = parent::getCSSFiles(); $list[] = 'css/yourcssfile.css'; return $list; } }

And then make sure yourcssfile.css is in /skins/YourThemeName/default/en/css/

Probably pretty basic and unnecessary, but just in case others are less experienced with XCart 5 like me and need it really spelled out.
__________________
===========
x-cart gold/classic
4.6.4
Reply With Quote

The following user thanks spdesign for this useful post:
qualiteam (11-04-2014)
  #3  
Old 10-31-2014, 10:28 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,852
 

Default Re: Best way to add additional css file to custom theme

This is how you do it but keep in mind this will not make the file to load last. So you should use classes names as unique as possible.

If "YourName" from above is "spdesign" and you have another module with "YourName" being "thespdesign" loading another css file their css file will load after yours.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
qualiteam (11-04-2014), spdesign (10-31-2014)
  #4  
Old 10-31-2014, 10:32 AM
 
spdesign spdesign is offline
 

Advanced Member
  
Join Date: Mar 2010
Posts: 31
 

Default Re: Best way to add additional css file to custom theme

Thank you for that clarification. That will be helpful in future.
__________________
===========
x-cart gold/classic
4.6.4
Reply With Quote
  #5  
Old 11-03-2014, 04:12 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Best way to add additional css file to custom theme

I would not rely on module's name in order to be last. If you want to be after certain CSS file, then use sorting option or depend on the module:
http://kb.x-cart.com/display/XDD/Making+one+module+depend+on+another
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


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 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 06:26 PM.

   

 
X-Cart forums © 2001-2020