Originally Posted by
CaroleAs
Whether I can test it or not, I am not even sure what I would be looking for, in order to get it to display, but that still does not address the initial question of sorting products inside categories the same way they can be sorted when ALL items are displayed.
Seems like you would probably be looking for html validation issues or reason why the jquery is not executing to re-display the page (remove the class="no-fouc"). But that said, yes we have all strayed from the original question.
There is additional code provided in includes/templates/YOUR_TEMPLATE/templates/tpl_products_all_default.php that first offers the ability to sort product (which is not provided in the template file for showing product within a category, more on that in a second).
Once the code is added to the appropriate template file (another require/include statement), then the response needs to be processed such that the page actually reflects the chosen option.
The listing of product in a category is effectively through the index page and there are some basic conditions to be met for a category to show that it has product when considering a default store.
So I'm going to approach this discussion from the "loading" of the page perspective rather than a backwards design thought.
From the main page, one selects a category. If that category only has product then as identified in includes/modules/pages/index/main_template_vars.php, the $tpl_page_body is set to tpl_index_product_list.php which towards the end of the file is loaded.
Now, in that file is an alpha "sorter" that you are seeing, and it seems to basically allow you to select a list of names that start with the letter that is chosen. It doesn't seem to do much else. You want to be able to modify the sequence of product. So you would want to add the processing and display of the sort box to which you referred on the products_all page.
Code needed would be:
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'); ?>
Which would provide the dropdown box with the options that you are wanting to see. The results of changing those options would be populated through the setting of $_GET['disp_order'] and a page reload. So now you need to "capture" the disp_order in the "load sequence".
Well, when looking at the index page, the filters in includes/index_filters are processed and in this case, basically the default_filter.php file. There are several sections within the file depending on the status of the page request: ie. manufacturers_id involved, a given category (or all of them), etc... In the default default_index.php file, there is already an $alpha_sort variable which applies an additional request to basically filter the names down to those that begin with a value, but it does not sort the list. Two options, could append the resulting $order_by that is identified in the includes/modules/YOUR_TEMPLATE/listing_display_order.php file (as included into the default_index.php file before use of the $order_by variable) or add an additional variable to each query where this is to be possible so that the sorting will be applied to the value of $listing_sql...
Seems like that all together should get you what you want. I believe others have posted in the forum about it where specific code has been provided.
But you are correct, the default install does not have that option presented initially and it requires some additional modification to obtain it.
Bookmarks