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

Create Custom css file in 5.0.12

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-20-2014, 11:49 AM
 
taponitrof taponitrof is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 105
 

Default Create Custom css file in 5.0.12

I want to create a custom css file that I can use to override template default css rules and I don't want to use the Template Tweaker.

I am following these instructions, but they don't work; my css file link is not added to the head. Yes, I did rebuild the cache.
http://kb.x-cart.com/display/XDD/Adding+new+CSS+file

I created a module in /classes/XLite/Module/Wolf/CustomCss/View/AView.php

I also created the module dir in the skin:

/skins/default/en/modules/Wolf/CustomCss/last.css

Below is the code in AView.php:

Code:
<?php namespace XLite\Module\Wolf\CustomCss\View; abstract class AView extends \XLite\View\AView implements \XLite\Base\IDecorator { protected function getThemeFiles() { $list = parent::getThemeFiles(); $list[static::RESOURCE_CSS][] = 'modules/Wolf/CustomCss/last.css'; return $list; } }

Any idea why it does work?

Environment Info:

Core version: 5.0.12
Installation directory: /home/wolfstyl/wolfstylestore
PHP: 5.3.28 details >>
MySQL server: 5.5.33-31.1 (InnoDB engine support enabled)
Web server: Apache
Operating system: Linux
XML parser: found
GDLib: found (0)
Translation driver: Database
Curl version: 7.19.7

Thanks
__________________
X-Cart Version 4.1.10, 4.1.11, 4.2, 4.3, 4.4.5
Linux
Reply With Quote
  #2  
Old 03-20-2014, 01:12 PM
 
mworsnop mworsnop is offline
 

Senior Member
  
Join Date: Mar 2014
Posts: 140
 

Default Re: Create Custom css file in 5.0.12

Did you click on ENABLE in the module

EXTENSIONS -> INSTALLED MODULES
__________________
Mark Worsnop

vers 5.3.3
Reply With Quote
  #3  
Old 03-20-2014, 01:16 PM
 
taponitrof taponitrof is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 105
 

Default Re: Create Custom css file in 5.0.12

According to the instructions, you don't create the main.php file, only the module file. However, I did create a main.php file and the module shows up in admin / modules, but it is impossible to enable it. Even after compile, it is not checked as enabled.
__________________
X-Cart Version 4.1.10, 4.1.11, 4.2, 4.3, 4.4.5
Linux
Reply With Quote
  #4  
Old 03-20-2014, 01:35 PM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Create Custom css file in 5.0.12

Can you post what you put in for your Main.php (should be located physically in classes/XLite/Module/Wolf/CustomCss)? My best guess is that there is an error in the namespace in that php, it should be
PHP Code:
namespace XLite\Module\Wolf\CustomCss

Hope this helps,

-Mark
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote
  #5  
Old 03-20-2014, 01:38 PM
 
taponitrof taponitrof is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 105
 

Default Re: Create Custom css file in 5.0.12

Here is main.php

Code:
<?php // vim: set ts=4 sw=4 sts=4 et: namespace XLite\Module\Wolf\CustomCss; /** * Module description * * @package XLite */ abstract class Main extends \XLite\Module\AModule { /** * Author name * * @return string */ public static function getAuthorName() { return 'WND'; } /** * Module name * * @return string */ public static function getModuleName() { return 'CustomCss'; } /** * Get module major version * * @return string */ public static function getMajorVersion() { return '5.0'; } /** * Module version * * @return string */ public static function getMinorVersion() { return 0; } /** * Module description * * @return string */ public static function getDescription() { return 'Custom css for template using last.css'; } }
__________________
X-Cart Version 4.1.10, 4.1.11, 4.2, 4.3, 4.4.5
Linux
Reply With Quote
  #6  
Old 03-20-2014, 01:50 PM
 
mworsnop mworsnop is offline
 

Senior Member
  
Join Date: Mar 2014
Posts: 140
 

Default Re: Create Custom css file in 5.0.12

Search for this:

XCFix-MobileCSS-v5_0_0

I followed Tonys example on this and it worked great for me. This is for mobile but I moved it around slightly and it works.
__________________
Mark Worsnop

vers 5.3.3
Reply With Quote
  #7  
Old 03-20-2014, 01:56 PM
 
Mark N Mark N is offline
 

Senior Member
  
Join Date: Sep 2011
Posts: 121
 

Default Re: Create Custom css file in 5.0.12

From what I can tell, it *should work*. That said, you can try this for your AView.php:

PHP Code:
<?php

namespace XLite\Module\Wolf\CustomCss\View;

/**
 * Abstract widget
 */
abstract class AView extends \XLite\View\AView implements \XLite\Base\IDecorator
{
    
/**
     * Register CSS files
     *
     * @return array
     */
    
public function getCSSFiles()
    {
        
$list parent::getCSSFiles();

        
$list[] = 'modules/Wolf/CustomCss/last.css';
        
        return 
$list;
    }

}

That's what I do for my own custom CSS...
__________________
X-Cart Gold Plus 4.6.5
Mods - WebsiteCM Dynamic Product Tabs, Smack Digital CDSEO Pro, AlteredCart Smart Search, AlteredCart One Page Checkout, Cart Works Power Filter, Firetank Software Feed Manager
Reply With Quote
  #8  
Old 03-20-2014, 03:30 PM
 
taponitrof taponitrof is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 105
 

Default Re: Create Custom css file in 5.0.12

Hi Mark,

Thanks for the file. I tried that but it still doesn't work. Also strange, even though the Theme tweaker enabled, that doesn't work either.
__________________
X-Cart Version 4.1.10, 4.1.11, 4.2, 4.3, 4.4.5
Linux
Reply With Quote
  #9  
Old 03-20-2014, 11:14 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Create Custom css file in 5.0.12

Quote:
Originally Posted by taponitrof
According to the instructions, you don't create the main.php file, only the module file. However, I did create a main.php file and the module shows up in admin / modules, but it is impossible to enable it. Even after compile, it is not checked as enabled.


Main.php is the "descriptor" file that tells X-Cart 5 about the module and explains how X-Cart 5 can use it. Every X-Cart 5 module require this file: http://kb.x-cart.com/display/XDD/How+to+create+a+module

What do you mean by saying that it is impossible to enable your module? Is the checkbox disabled? Usually for a new module you are to rebuild the cache twice: the first time to get the new module show up in the list, and the second time after ticking the Enable checkbox next to the module and submitting the form to the server.

Quote:
Originally Posted by taponitrof
Also strange, even though the Theme tweaker enabled, that doesn't work either.

It may be your browser cache. Does CTRL+F5 (or CTRL+R) help? You may also try to clear the browser cache from the browser menu.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #10  
Old 03-21-2014, 05:01 AM
 
taponitrof taponitrof is offline
 

Senior Member
  
Join Date: Dec 2007
Posts: 105
 

Default Re: Create Custom css file in 5.0.12

What I mean by "impossible to enable it" is this: I can see the module, I click the checkbox to enable it, I click save, the compiler runs, but the module is still unchecked; eg, not enable. I have done this dozens of times, but the module is never enabled. There are no error messages.

Thanks
__________________
X-Cart Version 4.1.10, 4.1.11, 4.2, 4.3, 4.4.5
Linux
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 12:59 PM.

   

 
X-Cart forums © 2001-2020