Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    Posts
    5
    Plugin Contributions
    0

    Default Sort By from All Products on Normal Product Listings

    I want to use the same "Sort By" functionality (product name, price, date added, etc) that's found on the All Products page (index.php?main_page=products_all) on the index listing or product listing (whatever it's called when you click on a category to view it's products). Currently it has the "Filter Results by" and the A-Z list and I want to replace that one. I'm not quite sure how to do this.

    I'm looking at this code in includes/templates/my_own_template/templates/tpl_index_product_list.php:

    Code:
    <?php
      // draw cPath if known
      if (!$getoption_set) {
        echo zen_draw_hidden_field('cPath', $cPath);
      } else {
        // draw manufacturers_id
        echo zen_draw_hidden_field($get_option_variable, $_GET[$get_option_variable]);
      }
    
      // draw typefilter
      if (isset($_GET['typefilter']) && $_GET['typefilter'] != '') echo zen_draw_hidden_field('typefilter', $_GET['typefilter']);
    
      // draw manufacturers_id if not already done earlier
      if ($get_option_variable != 'manufacturers_id' && isset($_GET['manufacturers_id']) && $_GET['manufacturers_id'] > 0) {
        echo zen_draw_hidden_field('manufacturers_id', $_GET['manufacturers_id']);
      }
    
      // draw sort
      echo zen_draw_hidden_field('sort', $_GET['sort']);
    
      // draw filter_id (ie: category/mfg depending on $options)
      if ($do_filter_list) {
        echo zen_draw_pull_down_menu('filter_id', $options, (isset($_GET['filter_id']) ? $_GET['filter_id'] : ''), 'onchange="this.form.submit()"');
      }
    
      // draw alpha sorter
      require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING_ALPHA_SORTER));
    ?>
    I tried pasting the below line from tpl_products_all_default.php into the first page and it creates the form but the functionality isn't working:

    Code:
    <?php
    require($template->get_template_dir('/tpl_modules_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_listing_display_order.php'); ?>
    Where do I go from here?

    Thanks!

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Sort By from All Products on Normal Product Listings

    Adding the front end form will only get you so far. You then need to pick up the results and extend the database query that pulls the data.

    That's a non-trivial change. The place to start would be the index filters folder.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Jan 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Sort By from All Products on Normal Product Listings

    Hmm. I was just looking at a default install of Zen Cart which has the table header rows with options for sorting so it seems instead of trying to figure out how to query the right results i can just fake it by adding my own menu with the appropriate links for doing what I need. I.E. adding "&sort=3a" on to the end of the page sorts by ascending price. Hopefully this will provide me with what I need.

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Sort By from All Products on Normal Product Listings

    I don't believe so. That would only work if the index page already had code to recognize the sort parameter. I may be wrong, but I don't believe that it has, and that you would have to add it into the index filters - which is not a trivial change.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 

Similar Threads

  1. Hide upcoming products from all and category listings
    By jmsnyder23 in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 8 Mar 2012, 02:44 PM
  2. Replies: 0
    Last Post: 13 Apr 2010, 04:56 PM
  3. how to sort products listings with price
    By pavka in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 23 Apr 2008, 08:11 PM
  4. How to sort All Products Listings?
    By nrg77 in forum Setting Up Categories, Products, Attributes
    Replies: 10
    Last Post: 29 Feb 2008, 08:14 PM
  5. Remove Document type from All Products listings
    By ddk632 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 23 Jun 2006, 08:35 AM

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