Forums / Basic Configuration / Sort By from All Products on Normal Product Listings

Sort By from All Products on Normal Product Listings

Locked

Views: 1,173

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
29 Jan 2009, 7:27 PM
#1
acmeinteractive avatar

acmeinteractive

New Zenner

Join Date:
Jan 2009
Posts:
5
Plugin Contributions:
0

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:

<?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:

<?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!

29 Jan 2009, 9:52 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

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)

29 Jan 2009, 10:30 PM
#3
acmeinteractive avatar

acmeinteractive

New Zenner

Join Date:
Jan 2009
Posts:
5
Plugin Contributions:
0

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.

29 Jan 2009, 10:34 PM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

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)