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

Drop Down List in Manufacturers menu
 
Reply
   X-Cart forums > X-Cart 4 > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-26-2012, 12:00 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Drop Down List in Manufacturers menu

Over years a lot of you requested having Manufacturers listed in a drop down list in Customer area. This customization will allow you to keep default XC behavior, but having the drop down list too.

All you need is configuring as you want Manufacturers menu in Modules -> Manufacturers with a few clicks. This one is a very easy customization.

Steps you have to do:

1) Edit [XC_Dir]/skin/common_files/modules/Manufacturers/menu_manufacturers.tpl

2) Create 2 new configuration settings for using them in Manufacturers module settings

3) Create 2 new language Labels

STEP 1 - File menu_manufacturers.tpl

original (default XC Gold+ 4.5.4)

PHP Code:
{*
$Idmenu_manufacturers.tpl,v 1.1.2.2 2010/12/09 14:00:53 aim Exp $
vimset ts=2 sw=2 sts=2 et:
*}
{if 
$manufacturers_menu ne ''}

  {
capture name=menu}
    <
ul>

      {foreach 
from=$manufacturers_menu item=m}
         <
li><a href="manufacturers.php?manufacturerid={$m.manufacturerid}">{$m.manufacturer|amp}</a></li>
      {/foreach}

      {if 
$show_other_manufacturers}
        <
li><a href="manufacturers.php">{$lng.lbl_other_manufacturers}</a></li>
      {/if}

    </
ul>
  {/
capture}
  {include 
file="customer/menu_dialog.tpl" title=$lng.lbl_manufacturers content=$smarty.capture.menu additional_class="menu-manufacturers"}

{/if} 

modified

PHP Code:
{*
$Idmenu_manufacturers.tpl,v 1.1.2.2 2010/12/09 14:00:53 aim Exp $
vimset ts=2 sw=2 sts=2 et:
*}
{if 
$manufacturers_menu ne ''}

  {
capture name=menu}
  
      {if  
$config.Manufacturers.manufacturers_menu_drop_down eq 'Y'}
      <
ul>

          <
select name='manufacturers' onchange="javascript:if (this.value) self.location=this.value;">
          <
option value="">{$lng.lbl_manufacturers_drop_down}</option>
                          
          {foreach 
from=$manufacturers item=m}
              <
li>
              {if 
$m.manufacturerid neq 0}
              <
option value="manufacturers.php?manufacturerid={$m.manufacturerid}">{$m.manufacturer|amp}</option>
              </
li>
              {/if}
          {/foreach}
      
      </
select>
            
            {if 
$config.Manufacturers.manufacturers_menu_view_all eq 'Y'}
        <
li><a href="manufacturers.php">{$lng.lbl_manufacturers_view_all}</a></li>
      {/if}

    </
ul>  
        
        {else}
        
            <
ul>
    
        {foreach 
from=$manufacturers_menu item=m}
          <
li><a href="manufacturers.php?manufacturerid={$m.manufacturerid}">{$m.manufacturer|amp}</a></li>
        {/foreach}

      {if 
$show_other_manufacturers}
        <
li><a href="manufacturers.php">{$lng.lbl_other_manufacturers}</a></li>
      {/if}

        </
ul>
    {/if}
  {/
capture}
  {include 
file="customer/menu_dialog.tpl" title=$lng.lbl_manufacturers content=$smarty.capture.menu additional_class="menu-manufacturers"}

{/if} 

STEP 2 - Create 2 new configuration settings for using them in Manufacturers module settings

- manufacturers_menu_drop_down - by default it is checked. It will group all Manufacturers in a drop down list. If you uncheck it you will see the default XC behavior, using Manufacturers list limit value.

- manufacturers_menu_view_all - by default it is checked. It will show "View All" link at the bottom of drop down list. If you uncheck it you won't see this link.

Here are SQL statements for creating these 2 new options.

Code:
insert into `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) values('manufacturers_menu_drop_down','Group all manufacturers in a drop down list','Y','Manufacturers','5','checkbox','N','',''); insert into `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) values('manufacturers_menu_view_all','Include \"View All\" option when drop down list is used','Y','Manufacturers','6','checkbox','N','','');

STEP 3 - Create 2 new language Labels

- lbl_manufacturers_drop_down - this is for first option in drop down list set to "Please select".

- lbl_manufacturers_view_all - this label is for "View All" text.

Here are SQL statements for creating these 2 new options.

Code:
insert into `xcart_languages` (`code`, `name`, `value`, `topic`) values('en','lbl_manufacturers_drop_down','Please select','Labels'); insert into `xcart_languages` (`code`, `name`, `value`, `topic`) values('en','lbl_manufacturers_view_all','View All','Labels');

Once you do these small changes cleanup your website cache (in my case it worked without cleaning up). If you visit again you should find the new results (see the attachments).

Do not forget to backup the data before starting modification. And create a few Manufacturers in Back End (XC is not coming with any Manufacturers created).

>> If you like this customization please click [Thanks] button for this post. Having lots of [Thanks] hope Qualiteam will take in consideration inserting this customization into future versions
Attached Thumbnails
Click image for larger version

Name:	manufacturers_settings.jpg
Views:	32
Size:	58.2 KB
ID:	3315  Click image for larger version

Name:	manufacturers_default.jpg
Views:	25
Size:	41.8 KB
ID:	3316  Click image for larger version

Name:	manufacturers_view_all-1.jpg
Views:	37
Size:	39.2 KB
ID:	3317  Click image for larger version

Name:	manufacturers_view_all-2.jpg
Views:	26
Size:	39.6 KB
ID:	3318  
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote

The following 4 users thank ADDISON for this useful post:
anandat (12-26-2012), kevfromwiganinlancashire (12-30-2012), tartaglia (12-26-2012), vasilis (12-27-2012)
  #2  
Old 12-26-2012, 01:44 PM
 
tartaglia tartaglia is offline
 

X-Adept
  
Join Date: May 2006
Location: Dallas, TX
Posts: 575
 

Default Re: Drop Down List in Manufacturers menu

Addison,

This is an awesome modification. I have not tried it yet but it make sooo much sense. Thank you Thank you for sharing.

One question...I only have manufacturers some of my more important products but it still is a list of about 30 manufacturers. How does having these in a dropdown on the left side compare to the default static links when it comes to SEO. One of the main reasons I created the manufacturers pages was for SEO purposes (and to help customers), but I struggle with only showing a reasonable number of them (about 10) on the left hand side using the default display. Especially since the same 10 are always displayed, so crawlers only see those 10.

I wondered (briefly) if there was an easy way to make the 10 displayed random from the list of 30+ as a potential SEO solution.

But if the crawlers can find the links in the dropdown that you've provided here just as easy, then I think you have the BEST solution.

Thanks again, great post!
__________________
David Coggan
Carolyn Nussbaum Music Company
X-Cart v4.5.4 Gold +
LiteCommerce v2.2.41 (previous 6 years)
Reply With Quote

The following user thanks tartaglia for this useful post:
ADDISON (02-24-2013)
  #3  
Old 12-28-2012, 01:54 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: Drop Down List in Manufacturers menu

If you want to edit the texts I added in Manufacturers module settings using Webmaster Mode you have to insert in your DB the following data:

Code:
INSERT INTO `xcart_languages` VALUES ('en', 'opt_manufacturers_menu_drop_down', 'Group all manufacturers in a drop down list', 'Manufacturers'); INSERT INTO `xcart_languages` VALUES ('en', 'opt_manufacturers_menu_view_all', 'Include \"View All\" option when drop down list is used', 'Manufacturers');
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote

The following user thanks ADDISON for this useful post:
tartaglia (12-28-2012)
Reply
   X-Cart forums > X-Cart 4 > Changing design


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 not 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:49 AM.

   

 
X-Cart forums © 2001-2020