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

Adding CSS and JS... unanswered questions

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 02-02-2015, 12:37 PM
 
mmcclellan mmcclellan is offline
 

Newbie
  
Join Date: Mar 2014
Posts: 9
 

Default Adding CSS and JS... unanswered questions

Hi, I have a few questions regarding this article from the KB: http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files

So, if I'm using the included Custom Skin module, would I add the AView file in the appropriate directory within modules/XC/CustomSkin?

Do my internal CSS and JS files need to be in my custom skin directory? Or in the default module directory? Or both?

And finally, am I better off writing my own module for the custom skin if I need to include CSS and JS files? (Rather than trying to force additional CSS and JS through the XCart Custom Skin module?)

I've been experimenting with this all morning and have had no success so far.
__________________
X-Cart Version: 5.2.17
Modules: Varies by site
Reply With Quote
  #2  
Old 02-02-2015, 12:44 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default Re: Adding CSS and JS... unanswered questions

You are probably better off writing your own module. That way you know for sure future upgrades of cart will not overwrite your files
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 3 users thank cflsystems for this useful post:
mmcclellan (02-04-2015), tony_sologubov (02-03-2015), totaltec (02-02-2015)
  #3  
Old 02-02-2015, 07:23 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Adding CSS and JS... unanswered questions

Quote:
Originally Posted by mmcclellan
Do my internal CSS and JS files need to be in my custom skin directory? Or in the default module directory? Or both?
Great question. As you already know, you have two places where you can place your files when working with a skin module. First is the skin directory you have created (1)skins/yourskin/en/ and second your module's skin directory (2)default/en/modules/YourDevId/YourModuleName/

As a rule, you place templates that you intend to overwrite in your skin directory (1). Templates that are new to the file structure, you place in your module's skin directory(2). So if the template already exists, override it in your custom skin directory(1). If it is a new template (.css, .js, or .tpl) that you want to assign to a list, place it in your modules skin directory (2).
__________________
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 3 users thank totaltec for this useful post:
mmcclellan (02-04-2015), qualiteam (02-04-2015), tony_sologubov (02-03-2015)
  #4  
Old 06-28-2015, 09:40 AM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

X-Adept
  
Join Date: Sep 2004
Location: London, England
Posts: 750
 

Default Re: Adding CSS and JS... unanswered questions

How is the best way to add custom css to the Admin area?

Quote:
<?php

namespace XLite\Module\Module\ModuleName\View;


abstract class AView extends \XLite\View\AView implements \XLite\Base\IDecorator

{


protected function getThemeFiles()

{

$list = parent::getThemeFiles();

// Custom css
$list[static::RESOURCE_CSS][] = 'modules/Module/ModuleName/style.css';



return $list;

}



}


I have found this on X-cart Knowledgebase;

Quote:
namespace XLite\Module\<Developer ID>\<Module ID>\View;
abstract class AView extends \XLite\View\AView implements \XLite\Base\IDecorator
{
protected function getThemeFiles($adminZone = null)
{
$list = parent::getThemeFiles($adminZone);

// example of internal JS file
$list[static::RESOURCE_JS][] = 'modules/<Developer ID>/<Module ID>/script.js';

// example of external JS file
$list[static::RESOURCE_JS][] = 'http://example.com/path/to/script.js';

// example of internal CSS file
$list[static::RESOURCE_CSS][] = 'modules/<Developer ID>/<Module ID>/style.css';
return $list;
}
}

Does it require separate module or can it be done in one module?
__________________
Richard


Ultimate 5.4 testing
Reply With Quote
  #5  
Old 06-28-2015, 09:46 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Adding CSS and JS... unanswered questions

Should be able to be done in one module.
__________________
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
  #6  
Old 06-28-2015, 09:50 AM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

X-Adept
  
Join Date: Sep 2004
Location: London, England
Posts: 750
 

Default Re: Adding CSS and JS... unanswered questions

Can you please help to complete how is combining both of these, I tried but it didn't work
__________________
Richard


Ultimate 5.4 testing
Reply With Quote
  #7  
Old 06-29-2015, 06:20 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

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

Default Re: Adding CSS and JS... unanswered questions

Hello Richard,

Could you please explain what problem you are facing? Does any of the methods above work for you? Or just nothing works?

Thank you.

Tony
__________________
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 > Dev Questions (X-Cart 5)



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

   

 
X-Cart forums © 2001-2020