Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2010
    Posts
    7
    Plugin Contributions
    0

    Default 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']); ?>
    Last edited by janislyn; 2 Aug 2010 at 05:39 PM. Reason: Edited to provide file location

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default 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
    Code:
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    and replace with this
    Code:
    require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
    2. Edit your includes/templates/YOUR_TEMPLATE/common/tpl_header.php
    Find where the search code ends and add this:
    Code:
    <div id="manufacturersHeader"><?php require(DIR_WS_MODULES . 'sideboxes/manufacturers.php'); ?></div>
    3. OPTIONAL: edit your stylesheet.css and add this:
    Code:
    #manufacturersHeader {
    float: right;
    margin:5px;
    }
    Of course, you can add/remove any other css values here as you like.

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

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

    Have fun and let us now if it works!

  3. #3
    Join Date
    Mar 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: Manufacturer dropdown menu in header

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

    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.

  4. #4
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default 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...

  5. #5
    Join Date
    Mar 2010
    Posts
    7
    Plugin Contributions
    0

    Default 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.

  6. #6
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default 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!
    Donation made. Enjoy those donuts! :-)

  7. #7
    Join Date
    Dec 2009
    Posts
    234
    Plugin Contributions
    0

    Default Re: Manufacturer dropdown menu in header

    In case anyone is looking, the solution to hide text when the currencies dropdown menu disappears is in post #4 here;

    http://www.zen-cart.com/forum/showth...ght=currencies
    Last edited by Scott_C; 9 Feb 2011 at 05:39 AM.
    Donation made. Enjoy those donuts! :-)

  8. #8
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    387
    Plugin Contributions
    0

    Default 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?
    Last edited by mikeel100; 26 Nov 2014 at 04:40 AM.

  9. #9
    Join Date
    Sep 2012
    Location
    West Jefferson, NC
    Posts
    387
    Plugin Contributions
    0

    Default 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.ph...facturers_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:

    PHP Code:
     '<label class="inputLabel">' .TEXT_SHOW '</label>' 
    and comment it out like so to hide the text "Filter By" on manufacturers page:

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

    PHP Code:
      // draw alpha sorter
      
    require(DIR_WS_MODULES zen_get_module_directory(FILENAME_PRODUCT_LISTING_ALPHA_SORTER)); 
    and paste this right below it:

    PHP Code:
      // 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_typefalse), '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 :-( .

    PHP Code:
        //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

    PHP Code:
    define('FILENAME_PRODUCT_LISTING_MANUFACTURERS_SELECT''sideboxes/YOUR TEMPLATE/manufacturers.php'); //MIKE ADDED 
    includes/english/YOUR TEMPLATE/english.php

    Add this definition:

    PHP Code:
    define('PULL_DOWN_ALL_MANUFACTURERS','All Manufacturers'); //MIKE 
    includes/languages/english/YOUR TEMPLATE/index.php

    Add or change this definition:

    PHP Code:
    define('TEXT_ALL_MANUFACTURERS''Category Manufacturers'); //was All Manufacturers 
    includes/languages/english/YOUR TEMPLATE/header.php

    Add these definitions:

    PHP Code:
      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:

    PHP Code:
    /*MIKE - $breadcrumb->add(HEADER_TITLE_CATALOG, zen_href_link(FILENAME_DEFAULT));*/ 
    Add this just above the line you just commented out:

    PHP Code:
    //MIKE

    $myCurrentPage =  $_SERVER['REQUEST_URI'];
    if (
    strpos($myCurrentPage'manufacturers_id') !== false) {
        
    $breadcrumb->add(MFG_HEADER_TITLE_CATALOG);
    } else {
        
    $breadcrumb->add(HEADER_TITLE_CATALOG_BREADCRUMBzen_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!

 

 

Similar Threads

  1. dropdown menu in header box catagories
    By slater555 in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 11 Mar 2011, 01:16 AM
  2. Category/Manufacturer Dropdown Menu
    By ADavies in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Jan 2011, 06:10 AM
  3. Header Dropdown Menu (CSS) Without the Dropdown???
    By hcd888 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 27 May 2009, 01:20 AM
  4. Currency dropdown menu in header
    By james739 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 2
    Last Post: 4 Aug 2007, 01:10 AM
  5. Add CSS dropdown menu to header
    By DivaVocals in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 19 Feb 2007, 05:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR