X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Create Custom css file in 5.0.12 (https://forum.x-cart.com/showthread.php?t=68899)

taponitrof 03-20-2014 11:49 AM

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

mworsnop 03-20-2014 01:12 PM

Re: Create Custom css file in 5.0.12
 
Did you click on ENABLE in the module

EXTENSIONS -> INSTALLED MODULES

taponitrof 03-20-2014 01:16 PM

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.

Mark N 03-20-2014 01:35 PM

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

taponitrof 03-20-2014 01:38 PM

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';
    }
}


mworsnop 03-20-2014 01:50 PM

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 N 03-20-2014 01:56 PM

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...

taponitrof 03-20-2014 03:30 PM

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.

qualiteam 03-20-2014 11:14 PM

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.

taponitrof 03-21-2014 05:01 AM

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


All times are GMT -8. The time now is 09:13 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.