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

ShopByBrand module change

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-06-2015, 06:36 AM
 
skit skit is offline
 

Advanced Member
  
Join Date: Feb 2015
Posts: 40
 

Default ShopByBrand module change

I have installed the ShopByBrand module and everything is working. But, i wanted to change the breadcrums to say "Manufactures" not "Brands."

I found the file that is controlling that to be classes>XLite>Module>QSL>ShopByBrand>View>Location >Node>Brands.php

I have created a file under my custom module XLite\Module\<mymodule>\<mymoduledesign>\View

And entered the follwoing code

Code:
namespace XLite\Module\<mymodule>\<mymoduledesign>\View; /** * Home node */ //class Brands extends \XLite\Module\QSL\ShopByBrand\View\Location\Node implements \XLite\Base\IDecorator class Brands extends \XLite\Module\QSL\ShopByBrand\View\Location\Node implements \XLite\Base\IDecorator { /** * Define widget parameters * * @return void */ protected function defineWidgetParams() { parent::defineWidgetParams(); $this->widgetParams[self::PARAM_NAME]->setValue('Manufacturers'); $this->widgetParams[self::PARAM_LINK]->setValue($this->buildURL('brands')); } }

I can't get it to change on my custom module code. What should i be looking at?

Thanks in advance.
__________________
V5.2.13
Reply With Quote
  #2  
Old 04-09-2015, 06:04 AM
  xplorer's Avatar 
xplorer xplorer is offline
 

X-Cart team
  
Join Date: Jul 2004
Posts: 925
 

Default Re: ShopByBrand module change

Hello!

An easier way to replace "Brand" with "Manufacturer" might be the following one: go to the "Store setup -> Translations" section in the back-end, search for all multilingual labels having "brand" word in them, and replace the word with "manufacturer".

Don't forget to create a backup copy of the site before editing the labels (as you may want to revert the change later).

As for the custom module - I see the following possible problems:

1. Does the namespace match the directory structure? I'm asking because your namespace ends with "View", whilst the original one is "View\Location\Node". So, it may be that you put your Brand.php file inside the View/Location/Node directory, but left the namespace pointing to the View directory.

2. There is no need in updating the "PARAM_LINK" parameter (unless you change the value), because it happens when you call "parent::defineWidgetParams();"

3. The module will trigger a fatal error if you disable Shop By Brands in your store. To fix this you should tell X-Cart 5 that you alter the class only if Shop By Brands module is enabled:
Code:
... /** * Home node * * @LC_Dependencies ("QSL\ShopByBrand") */ class Brands extends \XLite\Module\QSL\ShopByBrand\View\Location\Node implements \XLite\Base\IDecorator { ...

Also, without the @LC_Dependencies tag X-Cart 5 may put your code before the code added by Shop By Brands module, so that Shop By Brands overwrites yours "Manufactures" word with its "Brands" word.

Does this help?
Reply With Quote

The following user thanks xplorer for this useful post:
tony_sologubov (04-09-2015)
  #3  
Old 05-15-2015, 06:44 AM
 
skit skit is offline
 

Advanced Member
  
Join Date: Feb 2015
Posts: 40
 

Default Re: ShopByBrand module change

Well, i tried to get Brands to Manufacturers in the "Store setup -> Translations" section but it didn't update the Brands in the breadcrumbs.
__________________
V5.2.13
Reply With Quote
  #4  
Old 05-15-2015, 06:47 AM
 
skit skit is offline
 

Advanced Member
  
Join Date: Feb 2015
Posts: 40
 

Default Re: ShopByBrand module change

I appreciate your help.

here is the updated code.

Code:
namespace XLite\Module\MyModule\MyFolder\View\Location\Node; /** * Home node * * @LC_Dependencies ("QSL\ShopByBrand") */ class Brands extends \XLite\Module\QSL\ShopByBrand\View\Location\Node implements \XLite\Base\IDecorator { /** * Define widget parameters * * @return void */ protected function defineWidgetParams() { parent::defineWidgetParams(); $this->widgetParams[self::PARAM_NAME]->setValue('Manufacturers'); } }
__________________
V5.2.13
Reply With Quote
  #5  
Old 05-18-2015, 05:15 AM
 
skit skit is offline
 

Advanced Member
  
Join Date: Feb 2015
Posts: 40
 

Default Re: ShopByBrand module change

Found the issue. The path to the class was wrong.
__________________
V5.2.13
Reply With Quote

The following user thanks skit for this useful post:
xplorer (05-18-2015)
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 06:01 PM.

   

 
X-Cart forums © 2001-2020