Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Posts
    31
    Plugin Contributions
    0

    Default Product Listing is missing listing display order dropdown

    I would like to be able to sort product listing by model, new to old, price etc.
    This works fine with Specials, New and Featured listings but not with Category Listing.

    Is there a way to have this display order function work for Category Listings?

    I believe that Category Listing uses the template tpl_index_product_list.php and it does NOT use tpl_modules_listing_display_order.php, whereas tpl_products_new_default.php
    does.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product Listing is missing listing display order dropdown

    Did you turn the Model and Price on?

    If so, you can click the titles over the columns to sort them ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jan 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: Product Listing is missing listing display order dropdown

    Thanks,
    I forgot to mention that I am using columnar display (as I am in New, Specials, etc.)

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product Listing is missing listing display order dropdown

    Sorry I don't have that Add On installed anywhere, at this time ... so perhaps someone who does can give you a hand on this one ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2010
    Posts
    129
    Plugin Contributions
    0

    Default Re: Product Listing is missing listing display order dropdown

    Quote Originally Posted by ideasco View Post
    I would like to be able to sort product listing by model, new to old, price etc.
    This works fine with Specials, New and Featured listings but not with Category Listing.

    Is there a way to have this display order function work for Category Listings?

    I believe that Category Listing uses the template tpl_index_product_list.php and it does NOT use tpl_modules_listing_display_order.php, whereas tpl_products_new_default.php
    does.
    Hi zenners! Im back here to ask for your help....

    As the earlier post mentioned includes/modules/product_listing.php
    doesnt include a reference to the display order function in tpl_modules_listing_display_order.php

    I tried inserting in product_listing.php

    PHP Code:
    require($template->get_template_dir('/tpl_modules_listing_display_order.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_listing_display_order.php'); 
    I did manage to display the sort dropdown box on the top of my product page
    as you can see on my page:
    http://www.majesticsilver.co.uk/stor...index&cPath=93

    problem is when I do the actual filtering by selecting an option from the dropdown It just takes me back to the homepage without displaying any results!

    but in my new products page the same filter works fine.

    Is there something else to insert in the product_listing.php code that I neglected to do? Im almost there please help me to get this working - THANKS

  6. #6
    Join Date
    Sep 2010
    Posts
    129
    Plugin Contributions
    0

    Default Re: Product Listing is missing listing display order dropdown

    FOUND!! easy solution with this add on:

    http://www.zen-cart.com/index.php?ma...oducts_id=1559

    P.S. Dont forget to turn on the alpha sorter option in admin

  7. #7
    Join Date
    Sep 2010
    Posts
    129
    Plugin Contributions
    0

    Default Re: Product Listing is missing listing display order dropdown

    Well I'm back to square 1.

    I upgraded with Yellow's single template format for all product listings and now again I am facing the same problem.

    Even this filter add-on is bouncing me back to the home page.

    Luckily ive narrowed down the problem.

    If I do a sort by price the filter submits this URL:

    majesticsilver.co.uk/store/index.php?main_page=index&cPath=Array&sort=20a&alpha_filter_id=2
    Which like I said takes me to the homepage

    but I manually amended the URL as follows:

    majesticsilver.co.uk/store/index.php?main_page=index&cPath=92_93&sort=20a&alpha_filter_id=3
    and it does the filtering PERFECTLY!!!

    So it seems instead of referring to this Array it needs to refer to the Cpath of the current category!

    I include here my default_filter.php which should be the same as the one I got from the product filter add on.

    If anyone can help sort this out, as I think this is a simple coding matter I would appreciate it

    PHP Code:
    <?php
    /**
     * default_filter.php  for index filters
     *
     * index filter for the default product type
     * show the products of a specified manufacturer
     *
     * @package productTypes
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @todo Need to add/fine-tune ability to override or insert entry-points on a per-product-type basis
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: default_filter.php 6912 2007-09-02 02:23:45Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
      if (isset(
    $_GET['alpha_filter_id']) && (int)$_GET['alpha_filter_id'] > 0) {


        
    //$alpha_sort = " and pd.products_name LIKE '" . chr((int)$_GET['alpha_filter_id']) . "%' ";
        
    $filterid = (int)$_GET['alpha_filter_id'];
        switch(
    $filterid)
        {
                case 
    1:
                    
    $alpha_sort " order by pd.products_viewed";
                    break;
                case 
    2:
                    
    $alpha_sort " order by p.products_price";
                    break;
                case 
    3:
                    
    $alpha_sort " order by p.products_price DESC";
                    break;
                case 
    4:
                    
    $alpha_sort " order by pd.products_name";
                    break;
                case 
    5:
                    
    $alpha_sort " order by m.manufacturers_name";
                    break;
                case 
    6:
                    
    $alpha_sort " order by p.products_date_added DESC";
                    break;
                case 
    7:
                    
    $alpha_sort " order by p.products_date_added";
                    break;
                    
                    
                
            
        }
      } else {
        
    $alpha_sort '';
      }
      if (!isset(
    $select_column_list)) $select_column_list "";
       
    // show the products of a specified manufacturer
      
    if (isset($_GET['manufacturers_id']) && $_GET['manufacturers_id'] != '' ) {
        if (isset(
    $_GET['filter_id']) && zen_not_null($_GET['filter_id'])) {
    // We are asked to show only a specific category
          
    $listing_sql "select " $select_column_list " p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, m.manufacturers_name,  p.products_price, p.products_tax_class_id, pd.products_description, if(s.status = 1, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
           from " 
    TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id , " .
           
    TABLE_PRODUCTS_DESCRIPTION " pd, " .
           
    TABLE_MANUFACTURERS " m, " .
           
    TABLE_PRODUCTS_TO_CATEGORIES " p2c
           where p.products_status = 1
             and p.manufacturers_id = m.manufacturers_id
             and m.manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'
             and p.products_id = p2c.products_id
             and pd.products_id = p2c.products_id
             and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
             and p2c.categories_id = '" 
    . (int)$_GET['filter_id'] . "'" .
             
    $alpha_sort;
        } else {
    // We show them all
          
    $listing_sql "select " $select_column_list " p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
          from " 
    TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id, " .
          
    TABLE_PRODUCTS_DESCRIPTION " pd, " .
          
    TABLE_MANUFACTURERS " m
          where p.products_status = 1
            and pd.products_id = p.products_id
            and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
            and p.manufacturers_id = m.manufacturers_id
            and m.manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'" .
            
    $alpha_sort;
        }
      } else {
    // show the products in a given category
        
    if (isset($_GET['filter_id']) && zen_not_null($_GET['filter_id'])) {
    // We are asked to show only specific category
          
    $listing_sql "select " $select_column_list " p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
          from " 
    TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id, " .
          
    TABLE_PRODUCTS_DESCRIPTION " pd, " .
          
    TABLE_MANUFACTURERS " m, " .
          
    TABLE_PRODUCTS_TO_CATEGORIES " p2c
          where p.products_status = 1
            and p.manufacturers_id = m.manufacturers_id
            and m.manufacturers_id = '" 
    . (int)$_GET['filter_id'] . "'
            and p.products_id = p2c.products_id
            and pd.products_id = p2c.products_id
            and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
            and p2c.categories_id = '" 
    . (int)$current_category_id "'" .
            
    $alpha_sort;
        } else {
    // We show them all
          
    $listing_sql "select " $select_column_list " p.products_id, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
           from " 
    TABLE_PRODUCTS_DESCRIPTION " pd, " .
           
    TABLE_PRODUCTS " p left join " TABLE_MANUFACTURERS " m on p.manufacturers_id = m.manufacturers_id, " .
           
    TABLE_PRODUCTS_TO_CATEGORIES " p2c left join " TABLE_SPECIALS " s on p2c.products_id = s.products_id
           where p.products_status = 1
             and p.products_id = p2c.products_id
             and pd.products_id = p2c.products_id
             and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
             and p2c.categories_id = '" 
    . (int)$current_category_id "'" .
             
    $alpha_sort;
        }
      }

    // set the default sort order setting from the Admin when not defined by customer
      
    if (!isset($_GET['sort']) and PRODUCT_LISTING_DEFAULT_SORT_ORDER != '') {
        
    $_GET['sort'] = PRODUCT_LISTING_DEFAULT_SORT_ORDER;
      }

      if (isset(
    $column_list)) {
        if ((!isset(
    $_GET['sort'])) || (isset($_GET['sort']) && !ereg('[1-8][ad]'$_GET['sort'])) || (substr($_GET['sort'], 01) > sizeof($column_list)) ) {
          for (
    $i=0$n=sizeof($column_list); $i<$n$i++) {
            if (isset(
    $column_list[$i]) && $column_list[$i] == 'PRODUCT_LIST_NAME') {
              
    $_GET['sort'] = $i+'a';
              
    //$listing_sql .= " order by p.products_sort_order, pd.products_name";
              
    break;
            } else {
    // sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
    // for reverse, descending order use:
    //       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
              //$listing_sql .= " order by p.products_sort_order, pd.products_name";
              
    break;
            }
          }
    // if set to nothing use products_sort_order and PRODUCTS_LIST_NAME is off
          
    if (PRODUCT_LISTING_DEFAULT_SORT_ORDER == '') {
            
    $_GET['sort'] = '20a';
          }
        } else {
          
    $sort_col substr($_GET['sort'], 1);
          
    $sort_order substr($_GET['sort'], 1);
          
    $listing_sql .= ' order by ';
          switch (
    $column_list[$sort_col-1]) {
            case 
    'PRODUCT_LIST_MODEL':
              
    //$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              
    break;
            case 
    'PRODUCT_LIST_NAME':
              
    //$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
              
    break;
            case 
    'PRODUCT_LIST_MANUFACTURER':
              
    //$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              
    break;
            case 
    'PRODUCT_LIST_QUANTITY':
              
    //$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              
    break;
            case 
    'PRODUCT_LIST_IMAGE':
              
    //$listing_sql .= "pd.products_name";
              
    break;
            case 
    'PRODUCT_LIST_WEIGHT':
              
    //$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              
    break;
            case 
    'PRODUCT_LIST_PRICE':
    //          $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              //$listing_sql .= "p.products_price_sorter " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              
    break;
          }
        }
      }
    // optional Product List Filter
      
    if (PRODUCT_LIST_FILTER 0) {
        if (isset(
    $_GET['manufacturers_id']) && $_GET['manufacturers_id'] != '') {
          
    $filterlist_sql "select distinct c.categories_id as id, cd.categories_name as name
          from " 
    TABLE_PRODUCTS " p, " .
          
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
          
    TABLE_CATEGORIES " c, " .
          
    TABLE_CATEGORIES_DESCRIPTION " cd
          where p.products_status = 1
            and p.products_id = p2c.products_id
            and p2c.categories_id = c.categories_id
            and p2c.categories_id = cd.categories_id
            and cd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
            and p.manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'
          order by cd.categories_name"
    ;
        } else {
          
    $filterlist_sql"select distinct m.manufacturers_id as id, m.manufacturers_name as name
          from " 
    TABLE_PRODUCTS " p, " .
          
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
          
    TABLE_MANUFACTURERS " m
          where p.products_status = 1
            and p.manufacturers_id = m.manufacturers_id
            and p.products_id = p2c.products_id
            and p2c.categories_id = '" 
    . (int)$current_category_id "'
          order by m.manufacturers_name"
    ;
        }
        
    $do_filter_list false;
        
    $filterlist $db->Execute($filterlist_sql);
        if (
    $filterlist->RecordCount() > 1) {
            
    $do_filter_list true;
          if (isset(
    $_GET['manufacturers_id'])) {
            
    $getoption_set =  true;
            
    $get_option_variable 'manufacturers_id';
            
    $options = array(array('id' => '''text' => TEXT_ALL_CATEGORIES));
          } else {
            
    $options = array(array('id' => '''text' => TEXT_ALL_MANUFACTURERS));
          }
          while (!
    $filterlist->EOF) {
            
    $options[] = array('id' => $filterlist->fields['id'], 'text' => $filterlist->fields['name']);
            
    $filterlist->MoveNext();
          }
        }
      }

    // Get the right image for the top-right
      
    $image DIR_WS_TEMPLATE_IMAGES 'table_background_list.gif';
      if (isset(
    $_GET['manufacturers_id'])) {
        
    $sql "select manufacturers_image
                  from   " 
    TABLE_MANUFACTURERS "
                  where      manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'";

        
    $image_name $db->Execute($sql);
        
    $image $image_name->fields['manufacturers_image'];

      } elseif (
    $current_category_id) {

        
    $sql "select categories_image from " TABLE_CATEGORIES "
                where  categories_id = '" 
    . (int)$current_category_id "'";

        
    $image_name $db->Execute($sql);
        
    $image $image_name->fields['categories_image'];
      }
    ?>
    Silver Jewellery

    RESPECT to the Zen Cart Team, I'm PERFECTLY Zenned!

 

 

Similar Threads

  1. Product Listing display order issue
    By Craig Hairston in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 25 Nov 2011, 12:59 AM
  2. Product listing display order
    By Ramses65 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 Dec 2010, 05:15 PM
  3. Product sort order dropdown menu on product listing page
    By dealbyethan.com in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Dec 2007, 09:06 PM

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