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

[solved] Show brands in menu dropdown

 
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-06-2016, 09:26 AM
 
benlind benlind is offline
 

Member
  
Join Date: Feb 2016
Posts: 24
 

Default [solved] Show brands in menu dropdown

I have installed the "Show By Brand" module. I would like to list all of the site's brands in a dropdown menu in the navigation of every page. I added this code to the nav:

HTML Code:
<widget class="XLite\Module\QSL\ShopByBrand\View\BrandsBlock" limit="10000" />

That displays the brands correctly on the home page, but nowhere else. I know that the "BrandsBlock" widget is only meant to be used on the home page, which is probably why it is only showing up on the homepage. But I don't know how else to get all of the brands in a list on every page.

Please help!
__________________
X-Cart version 5.2
  #2  
Old 05-09-2016, 09:52 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Show brands in menu dropdown

Check the module for getAllowedTargets() method. Decorate the module to expand the allowed targets.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.

The following user thanks totaltec for this useful post:
qualiteam (06-28-2016)
  #3  
Old 06-25-2016, 04:34 PM
 
benlind benlind is offline
 

Member
  
Join Date: Feb 2016
Posts: 24
 

Default Re: Show brands in menu dropdown

I tried to decorate that method, but I can't figure out how to allow all targets. Is there a keyword to allow everything? If not, is there some list of all possible targets that I can use?
__________________
X-Cart version 5.2
  #4  
Old 06-26-2016, 11:17 PM
  xplorer's Avatar 
xplorer xplorer is offline
 

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

Default Re: Show brands in menu dropdown

Returning an empty array in getAllowedTargets() will make the widget visible on all pages. I.e. you should do something like this:
PHP Code:
namespace XLite\Module\YOUR_DEV_ID\YOUR_MODULE_ID\View;

/**
 * @LC_Dependencies ("QSL\ShopByBrand")
 */
class BrandsBlock extends \XLite\Module\QSL\ShopByBrand\View\BrandsBlock implements \XLite\Base\IDecorator
{
    public static function 
getAllowedTargets()
    {
        return array();
    }


The @LC_Dependencies ("QSL\ShopByBrand") statement is here to make your code apply over the code added by Shop By Brand module (otherwise XC5 may run the original module's method after yours and this will ignore your modification).

Last edited by xplorer : 06-26-2016 at 11:23 PM.

The following user thanks xplorer for this useful post:
benlind (06-28-2016)
  #5  
Old 06-28-2016, 01:07 PM
 
benlind benlind is offline
 

Member
  
Join Date: Feb 2016
Posts: 24
 

Default Re: Show brands in menu dropdown

xplorer, that worked perfectly. Thank you!
__________________
X-Cart version 5.2

The following user thanks benlind for this useful post:
qualiteam (06-28-2016)
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



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 12:58 PM.

   

 
X-Cart forums © 2001-2020