View Single Post
  #3  
Old 06-02-2014, 11:27 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: quick question

You are almost correct.

Your code will create new \XLite\Module\XC\CustomSkin\View\PoweredBy class that extends the default \XLite\View\PoweredBy widget, but it won't make it appear instead of the default one.

So, you should make one step further.

Change the class declaration as follows:

PHP Code:
namespace XLite\Module\XC\CustomSkin\View;

class 
PoweredBy extends \XLite\View\PoweredBy implements \XLite\Base\IDecorator
{
    protected function 
getCompanyYear()
    {
        return 
'2000';
    }


By using the "implements \XLite\Base\IDecorator" directive you say that you want to not just extend the base class, but also replace it with your custom one. So, technically X-Cart will think that it displays the \XLite\View\PoweredBy widget, but now it will include your custom code instead of the default one.

You can read more about this directive here:
http://kb.x-cart.com/display/XDD/Decorator+pattern
__________________
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

Last edited by qualiteam : 06-02-2014 at 11:29 PM.
Reply With Quote