Results 1 to 10 of 809

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Sorting Manufacturers on Dynamic Filter Sidebox

    This is kinda neat as it is a little annoying (to me at least) that manufacturers do not have sort orders and there fore can not be listed as per a sort order by default.

    so if you're like me, here is a neat little fix that allows you to either sort ALL your manufactures of simply just bring a few to the top of the list (without having to rename them.)

    lets assume that you have manufactures id's 1-5
    1. Ford
    2. Vauxhall
    3. Audi
    4. Seat
    5. Honda

    when displayed they will show in this order:
    3. Audi
    1. Ford
    5. Honda
    4. Seat
    2. Vauxhall

    but what if you wanted to have Honda at the top followed by Ford and then everything else..

    here's how...

    backup includes/templates/YOUR_TEMPLATE/templates/tpl_dynamic_filter.php

    open up includes/templates/YOUR_TEMPLATE/templates/tpl_dynamic_filter.php

    find this:
    PHP Code:
    $manufacturers $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" implode(','$filteredManufacturers) . "), 'Y', 'N') as flag" .
                     
    " FROM " TABLE_MANUFACTURERS 
                     
    " WHERE manufacturers_id IN (" implode(','$unfilteredManufacturers) . ")" .
                    
    " ORDER BY manufacturers_name"); 
    and replace with this:
    PHP Code:
        $manufacturers $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" implode(','$filteredManufacturers) . "), 'Y', 'N') as flag" .
                     
    " FROM " TABLE_MANUFACTURERS 
                     
    " WHERE manufacturers_id IN (" implode(','$unfilteredManufacturers) . ")" .
                    
    " ORDER BY FIELD(manufacturers_id,1,5) DESC"); 
    so notice how we are replacing the standard ORDER BY manufacturers_name and now replacing it with
    ORDER BY FIELD(manufacturers_id,1,5) DESC

    by doing this we are able to specify the field we wish to sort by, in this case manufacturers_id and then we specify the order starting with the one you want at the very top furthest away.

    so in this format:

    ORDER BY FIELD({FEILD ID},{forth...},{third},{second},{first}) DESC

    so now the order would be:

    5. Honda
    1. Ford
    followed by the rest..

    Hope someone finds this of use!
    Phil Rogers
    A problem shared is a problem solved.

  2. #2
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    It works, then it fails to function after clicking to test for filters. I get the white page.

    I am getting the following error message:
    [22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
    /home/content/******/html/****/cart/includes/functions/functions_general.php:626) in
    /home/content/******/html/****/cart/includes/functions/password_funcs.php on line 86
    Any idea where it's coming from?
    Using Zen Cart 1.5.1

  3. #3
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    Quote Originally Posted by Kevin205 View Post
    I am getting the following error message:
    [22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
    /home/content/******/html/****/cart/includes/functions/functions_general.php:626) in
    /home/content/******/html/****/cart/includes/functions/password_funcs.php on line 86
    Any idea where it's coming from?
    Ya. It's coming from the fact that those 2 files were updated in v1.5.1 but you've replaced one of them with an older version, presumably because your addon was made for something older than v1.5.1.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    Files were copied from the folder called "Installation for Zen Cart version 1.5.0" of mod "Dynamic Filter v1.0"

    Is this mod not compatible with 1.5.1?
    Using Zen Cart 1.5.1

  5. #5
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    Quote Originally Posted by Kevin205 View Post
    Files were copied from the folder called "Installation for Zen Cart version 1.5.0" of mod "Dynamic Filter v1.0"

    Is this mod not compatible with 1.5.1?
    Based on your posts, evidently not.
    To make it compatible will require doing some re-merging and updating of files to work correctly with the new version.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    OK. I will merge the following with my previous files.

    includes/functions/functions_general.php
    includes/functions/password_funcs.php

    and will let you know.

    Apparently no one else has issues with Zen 1.5.1 and "Dynamic Filter v1.0"!
    Using Zen Cart 1.5.1

  7. #7
    Join Date
    Dec 2012
    Posts
    607
    Plugin Contributions
    0

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    It's interesting, I just replaced the "includes/functions/functions_general.php" from the mod with my backed up file and it started working again.

    And I know there are differences between the two.
    Using Zen Cart 1.5.1

  8. #8
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Sorting Manufacturers on Dynamic Filter Sidebox

    Quote Originally Posted by Kevin205 View Post
    It works, then it fails to function after clicking to test for filters. I get the white page.

    I am getting the following error message:
    [22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
    /home/content/******/html/****/cart/includes/functions/functions_general.php:626) in
    /home/content/******/html/****/cart/includes/functions/password_funcs.php on line 86
    Any idea where it's coming from?
    You replied to my sorting manufactures post. Is this what you are having issues with? I only ask because I intended to post this as a new thread but it somehow ended up being part of this thread. Apologies if not and for any confusion.

    If it is regarding sorting manufacturers please post your code and ill take a look. I'm not site why that would cause any issues in those files you mentioned.
    Phil Rogers
    A problem shared is a problem solved.

 

 

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 22
    Last Post: 26 Jan 2026, 06:47 AM
  2. Empty Dynamic Filter
    By LadyoftheCave in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 6 Jun 2016, 12:47 PM
  3. v150 Dynamic filter
    By Dinoleix in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 13 Aug 2013, 10:23 AM
  4. v150 Dynamic filter - All pages
    By Okkwebmedia in forum Addon Sideboxes
    Replies: 0
    Last Post: 8 Jul 2013, 08:52 AM
  5. v138a Dynamic Filter
    By SoftCorpse in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 18 Jun 2012, 01:32 PM

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