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

quick question (changing year in the Powered By widget)

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 06-02-2014, 07:08 AM
 
Gabone Gabone is offline
 

Advanced Member
  
Join Date: May 2014
Location: Bucharest
Posts: 37
 

Default quick question (changing year in the Powered By widget)

hy,i use custom skin to create an custom design.
Now,if i wanna change the content of protected function getCompanyYear() from \XLite\View\PoweredBy.php all i need to do is to copy \XLite\View\PoweredBy.php to XLite\Module\XC\CustomSkin\View and fill with this ?
PHP Code:
namespace XLite\Module\XC\CustomSkin\View;

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

__________________
xcart 5
Reply With Quote
  #2  
Old 06-02-2014, 07:09 AM
 
Gabone Gabone is offline
 

Advanced Member
  
Join Date: May 2014
Location: Bucharest
Posts: 37
 

Default Re: quick question

and of course rebuild cache
__________________
xcart 5
Reply With Quote
  #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

The following user thanks qualiteam for this useful post:
Gabone (06-03-2014)
  #4  
Old 06-03-2014, 01:14 AM
 
Gabone Gabone is offline
 

Advanced Member
  
Join Date: May 2014
Location: Bucharest
Posts: 37
 

Default Re: quick question

thanks
__________________
xcart 5
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 03:30 AM.

   

 
X-Cart forums © 2001-2020