Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Manufacturer dropdown menu in header

Manufacturer dropdown menu in header

Views: 2,829

Results 1 to 9 of 9
2 Aug 2010, 4:36 PM
#1
janislyn avatar

janislyn

New Zenner

Join Date:
Mar 2010
Posts:
7
Plugin Contributions:
0

Manufacturer dropdown menu in header

Hello,

I have sideboxes disabled in my template, but I'd still like to have the manufacturer dropdown menu handy for customers. I'd like to place it in the header as this site does (but underneath the search box rather than beside it):

http://jimmybeanswool.com

I know very little code. Is there a straightforward way of doing this? I found relevant code for the manufacturer dropdown menu in two places (one for the sidebox and the other for the advanced search page), but I'm lacking the know-how to get the right formulation in the right place. Any help would be greatly appreciated. I'm using Zen Cart 1.38. Thanks!

includes/templates/template_default/sideboxes/tpl_manufacturers_select.php:

Line #14 : $content .= zen_draw_pull_down_menu('manufacturers_id', $manufacturer_sidebox_array, (isset($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''), 'onchange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 90%; margin: auto;"') . zen_hide_session_id();

**
includes/templates/....../templates/tpl_advanced_search_default.php:**

Line #36 : <?php echo zen_draw_pull_down_menu('manufacturers_id', zen_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS))), $sData['manufacturers_id']); ?>

2 Aug 2010, 10:17 PM
#2
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,795
Plugin Contributions:
22

Re: Manufacturer dropdown menu in header

It's not as simple as expected, but it can be done in a few steps. You'll need to edit a few php files, but it shouldn't be a problem.

  1. Edit your includes/modules/sideboxes/manufacturers.php
    Around line 63, find this ```
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
and replace with this ```
require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
  1. Edit your includes/templates/YOUR_TEMPLATE/common/tpl_header.php
    Find where the search code ends and add this:
<div id="manufacturersHeader"><?php require(DIR_WS_MODULES . 'sideboxes/manufacturers.php'); ?></div>
  1. OPTIONAL: edit your stylesheet.css and add this:
#manufacturersHeader {
float: right;
margin:5px;
} 

Of course, you can add/remove any other css values here as you like.

  1. Go to Admin->Configuration->MaximumValues. Aprox. 7th row is Manufacturers List - Scroll Box Size/Style - set it to 0

  2. Additionally, go to Admin->Tools->Layout Boxes and switch manufacturers sidebox off.

Have fun and let us now if it works!

2 Aug 2010, 11:24 PM
#3
janislyn avatar

janislyn

New Zenner

Join Date:
Mar 2010
Posts:
7
Plugin Contributions:
0

Re: Manufacturer dropdown menu in header

Wow! Thank you so much! I got it up there in the header underneath the search bar. :clap:

Minor formatting glitch however... I had "My Account" and "Shopping Cart" links right below the search bar which, instead of getting pushed down, got pushed to the left of the new manufacturer dropdown. I'm sure there's an easy fix to this (hoping) that would have those links go on the row underneath the dropdown menu, but I'm not sure how to fix it. Any clue?

In any event, thank you so much for giving me such clear and precise instructions on getting the dropdown menu in the header. I never would've figured it out on my own.

2 Aug 2010, 11:54 PM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,795
Plugin Contributions:
22

Re: Manufacturer dropdown menu in header

This is probably becuse of your css. Your manufacturers box has a float:left statement. try adding clear:both; in the stylesheet.css for #manufacturersHeader part. Or, a much more brutal way of doing this would be to add a <br /> right after the manufacturer code and before that links code in your tpl_header.php... :smile:

3 Aug 2010, 12:18 AM
#5
janislyn avatar

janislyn

New Zenner

Join Date:
Mar 2010
Posts:
7
Plugin Contributions:
0

Re: Manufacturer dropdown menu in header

You're an absolute gem! I got it to work using a few <br/> in the header file. Thanks again.

10 Oct 2010, 5:09 AM
#6
scott_c avatar

scott_c

Zen Follower

Join Date:
Dec 2009
Posts:
236
Plugin Contributions:
0

Re: Manufacturer dropdown menu in header

Hi, thanks for posting this workaround, its very helpful :)

Can I ask, how would you include the sidebox title?

For example: Manufacturers: [dropdown]

The reason I ask, is that ive used the same workaround to put the currencies dropdown in the header too - but currencies is programmed to dissapear when a user is completing checkout.

I want the currencies title to be next to its dropdown so that it 'disappears' when it should. Obviously, this wont happen if i hardwire the title next to the dropdown.

Thanks!

26 Nov 2014, 3:38 AM
#8
mikeel100 avatar

mikeel100

Zen Follower

Join Date:
Sep 2012
Location:
West Jefferson, NC
Posts:
391
Plugin Contributions:
0

Re: Manufacturer dropdown menu in header

I am trying to get the manufacturer select to work on the tpl_product_list.php page next to the alph sorter.

I plugged your code into the files just as mentioned above but it does not work.

How do you make it work in 1.5.3?

27 Nov 2014, 7:08 AM
#9
mikeel100 avatar

mikeel100

Zen Follower

Join Date:
Sep 2012
Location:
West Jefferson, NC
Posts:
391
Plugin Contributions:
0

Re: Manufacturer dropdown menu in header

This change will move the manufacturers dropdown select from the sidebox area into the manufacturers_id pages next to the alpha sorter and categories sorter.

To see an example visit: http://jestcountrystuff.com/index.php?main_page=index&manufacturers_id=1

It has been tested on ZenCart Version 1.5.3 with only the UPS module installed

Both Column Left Status and Column Right Status are globally turned off in Admin / Configuration / Layout Settings.

All Admin / Tools / Layout Boxes Controller options are turned off except for the search_header.php.

If you know of an easier way to accoplish this, let me know. Use at your own risk...it works fine for my situation but there is no guarantee it will work for yours :-).

I STRONGLY SUGGEST YOU DO THIS ON A TEST SHOP BEFORE USING ON A LIVE STORE.

Files affected:

includes/templates/YOUR TEMPLATE/templates/tpl_index_product_list.php

Find this:

 . '<label class="inputLabel">' .TEXT_SHOW . '</label>'

and comment it out like so to hide the text "Filter By" on manufacturers page:

  if ($do_filter_list || ($check_for_alpha->RecordCount() > 0 && PRODUCT_LIST_ALPHA_SORTER == 'true')) {
  $form = zen_draw_form('filter', zen_href_link(FILENAME_DEFAULT), 'get')/* . '<label class="inputLabel">' .TEXT_SHOW . '</label>'*/;

Find this:

  // draw alpha sorter
  require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING_ALPHA_SORTER));

and paste this right below it:

  // draw manufacturers select
  $myCurrentPage =  $_SERVER['REQUEST_URI'];
  if (strpos($myCurrentPage, 'manufacturers_id') !== false) {
       require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING_MANUFACTURERS_SELECT));
       echo zen_draw_form('manufacturers_form', zen_href_link(FILENAME_DEFAULT, '', $request_type, false), 'get');
       echo zen_draw_hidden_field('main_page', FILENAME_DEFAULT);
       echo zen_draw_pull_down_menu('manufacturers_id', $manufacturer_sidebox_array, (isset($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''), 'onchange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: auto; margin: auto;"') . zen_hide_session_id();
  }

includes/modules/sideboxes/YOUR TEMPLATE/manufacturers.php

Comment this code out...sidebox will be turned off so there is no need for it. Besides, it breaks the purpose of this code if you leave it turned on. If you want to keep your sidebox manufacturer select working, you will have to figure out the coding :-( .

    //require($template->get_template_dir('tpl_manufacturers_select.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_manufacturers_select.php');
    //$title = '<label>' . BOX_HEADING_MANUFACTURERS . '</label>';
    //$title_link = false;
    //require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

includes/filenames.php THIS IS A CORE FILE SO MAKE SURE YOU NOTE YOUR CHANGES FOR YOUR NEXT UPGRADE!

Add this and change YOUR TEMPLATE to whatever your custom template is named

define('FILENAME_PRODUCT_LISTING_MANUFACTURERS_SELECT', 'sideboxes/YOUR TEMPLATE/manufacturers.php'); //MIKE ADDED

includes/english/YOUR TEMPLATE/english.php

Add this definition:

define('PULL_DOWN_ALL_MANUFACTURERS','All Manufacturers'); //MIKE 

includes/languages/english/YOUR TEMPLATE/index.php

Add or change this definition:

define('TEXT_ALL_MANUFACTURERS', 'Category Manufacturers'); //was All Manufacturers

includes/languages/english/YOUR TEMPLATE/header.php

Add these definitions:

  define('HEADER_TITLE_CATALOG_BREADCRUMB', 'Categories'); // MIKE ADDED
  define('MFG_HEADER_TITLE_CATALOG', 'Manufacturers'); // MIKE ADDED

includes/init_includes/init_add_crumbs.php CORE FILE MAKE NOTES FOR NEXT UPGRADE

Comment out this:

/*MIKE - $breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT));*/

Add this just above the line you just commented out:

//MIKE

$myCurrentPage =  $_SERVER['REQUEST_URI'];
if (strpos($myCurrentPage, 'manufacturers_id') !== false) {
	$breadcrumb->add(MFG_HEADER_TITLE_CATALOG);
} else {
	$breadcrumb->add(HEADER_TITLE_CATALOG_BREADCRUMB, zen_href_link(FILENAME_DEFAULT));
}	

These changes will also automatically change the top level bread crumb to read as "Categories" or "Manufacturers" where appropriate.

I hope this is useful to someone else.

Happy selling!