View Single Post
  #2  
Old 11-23-2016, 11:53 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Crisp White Skin in 5.3.* - Custom Modifications?

Well, this is possible, but is a bit tricky when you don't know how to do it

Quote:
Originally Posted by Triple A Racing
In a nutshell: What's the best way to customise Crisp White Skin AND many other standard XC settings, but....only using one Custom Module?

Our best guesses so far are:

1) Create a new Custom Module. Turn off the XC Custom Skin Module and only then enable the new Custom Module.

OR:

2) Copy the original crisp white skin module, customise the the module itself (including its identity via Main.php) and then use that.

3) Only use a combination of Theme Tweaker, Custom Skin, Custom CSS / JS. Easiest to apply, but feels messy and longwinded with all those actions...


It will be "4" (see below)

Quote:
Originally Posted by Triple A Racing
Sorry, I forgot to say... The Custom Module illustrated below, has \XLite\Module\AModule and not \Xlite\Module\AModuleSkin within Main.php which is the opposite way round to the 100% functioning live Custom Module. This is because we have assumed that it's impossible to operate two skins (templates) at the same time and therefore it could only ever be Module not AModuleSkin.

Yes, you're right. You can't have two theme modules operating at the same time. So, your custom module should extend \XLite\Module\AModule and not \Xlite\Module\AModuleSkin.

However, instead of registering your template directories from getSkins() method in your module, the module should hack into the Main class of Crisp White theme.

I.e. you should have the standard "Main.php" file without getSkins() method, and another file as follows:

PHP Code:
<?php
// classes/XLite/Module/MyCustom/MyModule/CrispWhiteMain.php

namespace XLite\Module\MyCustom\MyModule;

abstract class 
CrispWhiteMain extends \XLite\Module\XC\CrispWhiteSkin\Main implements \XLite\Base\IDecorator
{
    public static function 
getSkins()
    {
        
$skins parent::getSkins();
        
        
$customCustomerDirectory 'my_custom_theme' LC_DS 'customer';
        if (isset(
$skins[\XLite::CUSTOMER_INTERFACE])) {
            
// The original theme registers its own directory for the "customer interface",
            // so we should combine ours with that one
            
$directories = (array) $skins[\XLite::CUSTOMER_INTERFACE];
            
$directories[] = $customCustomerDirectory;
            
$skins[\XLite::CUSTOMER_INTERFACE] = $directories;
        } else {
            
// The original theme has no directory for the "customer interface",
            // so we just add our directory to the list
            
$skins[\XLite::CUSTOMER_INTERFACE] = $customCustomerDirectory;
        }

        return 
$skins;
    }
}

I haven't tested the above code, but I think it should work.
__________________
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