Forums / Setting Up Categories, Products, Attributes / Need to add sort drop down to sub category product listings....

Need to add sort drop down to sub category product listings....

Views: 704

Results 1 to 2 of 2
31 Jul 2015, 5:51 PM
#1
tomlcuneo avatar

tomlcuneo

New Zenner

Join Date:
Jan 2013
Posts:
2
Plugin Contributions:
0

Need to add sort drop down to sub category product listings....

I have tried to search for this and only find incomplete threads or no answers at all.

Would like to add the sort from this page: http://thewholesomehearth.authsafe.com/index.php?main_page=products_new&disp_order=3

to these pages also....http://thewholesomehearth.authsafe.com/index.php?main_page=index&cPath=31_102

I can add the code to the page that makes it appear but when i select the sort order it just redirects me to the home page....

Any help on this is greatly and sincerely appreciated.

Thanks in advance
Tom

31 Jul 2015, 6:54 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Need to add sort drop down to sub category product listings....

tomlcuneo:

I have tried to search for this and only find incomplete threads or no answers at all.

Would like to add the sort from this page: http://thewholesomehearth.authsafe.com/index.php?main_page=products_new&disp_order=3

to these pages also....http://thewholesomehearth.authsafe.com/index.php?main_page=index&cPath=31_102

I can add the code to the page that makes it appear but when i select the sort order it just redirects me to the home page....

Any help on this is greatly and sincerely appreciated.

Thanks in advance
Tom

Couple of options come to mind, one is to duplicate the files "affected" and reference them, or to modify the way the existing function(s) work. Yes, the categories are referenced by a main_page = index; therefore, selecting the filter returns back to index (homepage), the thing here is though there are parameters associated that need to be addressed...

Not entirely sure the "safest" route, but, the following code in includes/templates/YOUR_TEMPLATE/templates/tpl_modules_listing_display_order.php could be modified from:

 echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get');
 echo zen_draw_hidden_field('main_page', $_GET['main_page']);

to:

 echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page'][B], $parameters[/B]), 'get');
 echo zen_draw_hidden_field('main_page', $_GET['main_page']);

Alternatively, could use a check to see the value of main_page and get the appropriate information from that condition and or additional checks of values set on the get environment instead of always passing the $parameters. The next thing would be to go back and copy/duplicate includes/templates/YOUR_TEMPLATE/templates/tpl_modules_listing_display_order.php and includes/templates/YOUR_TEMPLATE/templates/tpl_product_listing_standard.php giving each a name that relates to your categories filtering, modify the call in the product_listing_standard file, then in the includes/modules/pages/index/main_template_vars.php (or subsequent individual file) reference the newly generated version of the product_listing_standard file... This way, only the index would use the new file, but still may need to be limited to the case(s) desired.

All of the above is untested and unfortunately only from ideas/concepts and code review..

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...