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

How to add CSS for custom module.

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-02-2019, 05:25 AM
 
rahuljat rahuljat is offline
 

Newbie
  
Join Date: Sep 2019
Posts: 8
 

Default How to add CSS for custom module.

Hello,

I have created custom module in XCart5. I have also added module setting code for adding HTML. So Is there any way to include css and js withing module directory. I have tried this reference way: https://devs.x-cart.com/design_changes/adding_css_and_js_files.html
But my custom module stopped working after adding this reference code.

So can you please suggest how can I add CSS for particular module within module files.

Thanks,
__________________
X-Cart version 5.3.6.3
Reply With Quote
  #2  
Old 10-02-2019, 09:36 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: How to add CSS for custom module.

I have recently used the method you refer to and it works (on X-cart version is 5.4.0.5, but the documentation is for older versions, so it should also work for 5.3.6.3) , so probably you have spelling problem or something.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 10-03-2019, 05:18 AM
 
rahuljat rahuljat is offline
 

Newbie
  
Join Date: Sep 2019
Posts: 8
 

Default Re: How to add CSS for custom module.

Hi,

Thanks for your reply.

Actually now, my css and js are included on website but css is not applied on DOM element(like div).

Can you please suggest on what I am doing wrong.

Thanks,
__________________
X-Cart version 5.3.6.3
Reply With Quote
  #4  
Old 10-03-2019, 11:00 PM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: How to add CSS for custom module.

Is it the CSS rules that aren't applied, or JS not making necessary changes on dom elements so that the css apply?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #5  
Old 10-03-2019, 11:06 PM
 
rahuljat rahuljat is offline
 

Newbie
  
Join Date: Sep 2019
Posts: 8
 

Default Re: How to add CSS for custom module.

Hi,

Actually CSS rules are aren't applied on DOM Element. JS is working fine.

I have debug the code and got that if I use list=body than CSS is included but not applied and if I use list=layout.main than it start working.

I didn't understand why this happens.

Can you please suggest why my CSS not applied with list=body.

Thanks,
__________________
X-Cart version 5.3.6.3
Reply With Quote
  #6  
Old 10-04-2019, 12:12 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: How to add CSS for custom module.

Presumably it is because there are rules from XC or other modules that apply to list=layout.main and they have priorities as layout.main is more specific than body.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #7  
Old 10-04-2019, 12:16 AM
 
rahuljat rahuljat is offline
 

Newbie
  
Join Date: Sep 2019
Posts: 8
 

Default Re: How to add CSS for custom module.

Ok thanks, means we are not able to apply css if we use list=body.

There is no way to apply css on element if we use list=body in module.
__________________
X-Cart version 5.3.6.3
Reply With Quote
  #8  
Old 10-04-2019, 04:43 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: How to add CSS for custom module.

From /skins/customer/body.twig
Code:
# Please note that any custom list child of 'body' will NOT have its CSS/JS resources loaded because the resources block is being 'body' child itself. Use 'layout.main' or 'layout.footer' instead.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (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 11:56 AM.

   

 
X-Cart forums © 2001-2020