Forums / General Questions / Sorter Box from 'all products' implemented in general product listings

Sorter Box from 'all products' implemented in general product listings

Locked

Started by npoult on 13 Apr 2010, 3:56 PM · Views: 657

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
13 Apr 2010, 3:56 PM
#1
npoult avatar

npoult

New Zenner

Join Date:
Apr 2010
Posts:
1
Plugin Contributions:
0

Sorter Box from 'all products' implemented in general product listings

Hi,

I'm currently developing my first zen-cart site, so bear with me. :smile:

I want to have a 'sort by:' drop down on my general product listings pages, in place of any filters. When a sorting option is selected the page would be resubmitted with the products now sorted by the chosen display order.

The placement of the drop down was easy enough,

the if statement was added to tpl_modules_listing_display_order.php, which allows the existing sorter to resend back to the product listing page :

echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get');
if( isset($_GET['cPath'])){
echo zen_draw_hidden_field('main_page', $_GET['main_page']);
echo zen_draw_hidden_field('cPath', $_GET['cPath']);
}else{

echo zen_draw_hidden_field('main_page', $_GET['main_page']);
}

and a require to the sorter was added to tpl_index_product_list.php:


// draw alpha sorter
require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING_ALPHA_SORTER));
?>

</form> <?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');

I then followed it though until I got to the way that 'all products' et al constructs a sql query in its header_php.php using $order_by to sort the products by the display order found in the sorter (tpl_modules_listing_display_order.php), whereas normal product listings use $categories_products_query as far as ai can tell. I kind of lost the thread there.

I feel like I'm close, but my inexperience with zencart is making it slow going. does anyone have any ideas as to how I could get this working?

I have the column layout addon, as well as the single page template installed, but that shouldnt directly impact what I'm trying to do.

Thanks, (and sorry for the essay :D)

Nathan