Oba-san
- Join Date:
- Sep 2003
- Location:
- Ohio
- Posts:
- 62,757
- Plugin Contributions:
- 1
Sort by price with column display....
Let me see if I can't rig up something for you on this ... I have a plan ... :cool:
NOTE: might be tonight or tomorrow ...
Views: 46,932
Oba-san
Let me see if I can't rig up something for you on this ... I have a plan ... :cool:
NOTE: might be tonight or tomorrow ...
New Zenner
do you need me to PM you any credentials?
Oba-san
Nope ... gonna write something for this to manage the updates in a different manner ...
Working on it ... how hard can it be ... :lamo:
Oba-san
Try this add on ... yes it is pretty ugly but might work ...
The idea is enter the products_id to start with and how many to run ...
So if you have 100000 products, it will show you your first products_id ...
Try the first products_id and you can go with the default of 5000 or try for higher to see how many you can do at once ...
It will then tell you when done and the last products_id it did ...
So now start with that last products_id it did and do 5000 or however many you want to try next ...
Repeat until done ...
Kind of like doing the update in chunks ...
Let me know if this works for you and maybe I will clean it up some more later ...
New Zenner
:clap::clap::clap::clap::clap::
:thumbsup:
Oba-san
I take it you figured out how to use it, eh? :cool:
What quantity did you use on how many to processes or did you just go with the default?
New Zenner
did 5000 at a time, worked like a charm.
Oba-san
Did you at any point run the Update Master Categories ID and if so, did it run from start to finish without a glitch?
New Zenner
I believe I did so, and I believe I did it before using your mod. That was never an issue, only the price sorter was timing out
Oba-san
Thanks for the update ... just wanted to be sure that the Rest on the Master Categories ID did not have an issue with that many records ...
New Zenner
I have to ell you, even after all this time I STILL come back to this thread & grab this code when I build a new site ! PRICELESS !!!!
Thank you again ! :clap:
<?php /** * Module Template * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: tpl_modules_additional_listing_display_order.php 3369 2006-04-03 23:09:13Z drbyte $ */ ?> <?php // NOTE: to remove a sort order option add an HTML comment around the option to be removed ?> <div id="sorter"> <label for="disp-order-sorter"><?php echo TEXT_INFO_SORT_BY; ?></label> <?php echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get'); echo zen_draw_hidden_field('main_page', $_GET['main_page']); echo zen_draw_hidden_field('cPath', $cPath); // draw cPath if known if (!$getoption_set) echo zen_draw_hidden_field('cPath', $cPath); echo zen_hide_session_id(); ?> <select name="sort" onchange="this.form.submit();" id="disp-order-sorter"> <?php if ($_GET['sort'] != PRODUCT_LISTING_DEFAULT_SORT_ORDER) { ?> <option value="<?php echo PRODUCT_LISTING_DEFAULT_SORT_ORDER; ?>" <?php echo ($_GET['sort'] == PRODUCT_LISTING_DEFAULT_SORT_ORDER ? 'selected="selected"' : ''); ?>><?php echo PULL_DOWN_ALL_RESET; ?></option> <?php } // reset to store default ?> <option value="1a" <?php echo ($_GET['sort'] == '1a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME; ?></option> <option value="1d" <?php echo ($_GET['sort'] == '1d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME_DESC; ?></option> <option value="3a" <?php echo ($_GET['sort'] == '3a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE; ?></option> <option value="3d" <?php echo ($_GET['sort'] == '3d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE_DESC; ?></option> </select></form></div> ``` > > Then in the file tpl_index_product_list.php in the same folder, edit to add this line: > ```php require($template->get_template_dir('/tpl_modules_additional_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_listing_display_order.php'); ``` > You can add it wherever you want to dispkay the sorter, for me I added it right above this line: > ```php require($template->get_template_dir('tpl_modules_product_listing.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_product_listing.php'); ``` > > > > Good luckyellow1912:
To have a drop down box sorter:
In includes/templates/YOUR_CURRENT_TEMPLATE
Add a file called tpl_modules_additional_listing_display_order.php (actually you can call it however you want) with this content
Totally Zenned
I am trying to implement this.
made plate file.
Added the line...
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?> <?php } ?>
- display the Special Products Center Box
*/
?>
require($template->get_template_dir('/tpl_modules_additional_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_listing_display_order.php');
What happnens is I see the drop down options. Sort Low to High etc.. But the page does not show any products. Can someone suggest a fix?
New Zenner
Beautiful!!!! Just what I was looking for. :bigups: Works just like a bought one.
New Zenner
Thanks!
New Zenner
I just tried adding Yellow's mod and don't see anything. Where am I supposed to see the options box?
Before this, I could click on "All Products" and see a dropdown with sort options. I'd like to just use that on other pages but can't figure out what code to copy and where to paste it for other pages. Sorry. Cornfused.
New Zenner
Fisherman:
I just tried adding Yellow's mod and don't see anything. Where am I supposed to see the options box?
Before this, I could click on "All Products" and see a dropdown with sort options. I'd like to just use that on other pages but can't figure out what code to copy and where to paste it for other pages. Sorry. Cornfused.
Cornfused no longer! Yellow's edit from page 3 is working. Thanks!
New Zenner
One more thing. Is there a list somewhere of all of the sort codes? 1 2 3 4 5 a d etc... I'd like to sort by best selling products first. Can I do that?
Totally Zenned
there's a mod to change the alphasorter to a multiple sorter:
http://www.zen-cart.com/showthread.php?205606-Product-Listing-Sorter-Drop-Down
New Zenner
Not sure if this will help anyone if they see it, didn't read thru post so don't know where it went but I slightly reworked some of the code from earlier to put in a dropdown that filters results from the item and manufacturers box already in place, and I took out the alpha sorter... This isn't my code, I only reworked it a little and changed placement of the box to provide those less able than me a nice dropbox with a few more choices
This is what I have in my tpl_module_additional_listing display order, copy it and make a file named just that and paste it in;
<?php /** * Module Template * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @original version $Id: tpl_modules_additional_listing_display_order.php 3369 2006-04-03 23:09:13Z drbyte $ reworked by vacuumwarlock 2014 */ ?> <?php // NOTE: to remove a sort order option add an HTML comment around the option to be removed ?> <?php echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get'); echo zen_draw_hidden_field('main_page', $_GET['main_page']); // draw cPath if known if (!$getoption_set) echo zen_draw_hidden_field('cPath', $cPath); echo zen_hide_session_id(); ?><select name="sort" onchange="this.form.submit();" id="disp-order-sorter">
<?php if ($_GET['sort'] != PRODUCT_LISTING_DEFAULT_SORT_ORDER) { ?>
<option value="<?php echo PRODUCT_LISTING_DEFAULT_SORT_ORDER; ?>" <?php echo ($_GET['sort'] == PRODUCT_LISTING_DEFAULT_SORT_ORDER ? 'selected="selected"' : ''); ?>><?php echo PULL_DOWN_ALL_RESET; ?></option>
<?php } // reset to store default ?>
<option value="4a" <?php echo ($_GET['sort'] == '4a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_BRAND; ?></option>
<option value="4d" <?php echo ($_GET['sort'] == '4d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_BRAND_DESC; ?></option>
<option value="5a" <?php echo ($_GET['sort'] == '5a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_MODEL; ?></option>
<option value="5d" <?php echo ($_GET['sort'] == '5d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_MODEL_DESC; ?></option>
<option value="2a" <?php echo ($_GET['sort'] == '2a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME; ?></option>
<option value="2d" <?php echo ($_GET['sort'] == '2d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME_DESC; ?></option>
<option value="3a" <?php echo ($_GET['sort'] == '3a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE; ?></option>
<option value="3d" <?php echo ($_GET['sort'] == '3d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE_DESC; ?></option>
</select></form>
Then I took this code as listed ealier:
require($template->get_template_dir('/tpl_modules_additional_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_listing_display_order.php');
so copy it, and place it just below this code in tpl_index_product_list.php in the templates folder (if you don't have one in includes/templates/Your_Template/templates, get it from default_template and paste it in that folder then edit that file):
// 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()"');
}
which is also just above the alpha sorter. If you want to use the alpha sorter, be aware this code may create issues with the alpha sorter where I placed it. First quick check it was acting funny, so I eliminated it, you may have to do your own testing. I personally pasted it right over the alpha sorter require, if I ever need it back I will put it back in. This also filters nicely on manufacturers listings.
the last thing you need to do is create 3 separate defines in you includes/languages/english.php in the group that holds the other sort list names. You can name them whatever you want, I named mine these:
define('TEXT_INFO_SORT_BY_PRODUCTS_MODEL_DESC', 'Model# - Desc');
define('TEXT_INFO_SORT_BY_PRODUCTS_BRAND', 'Brand - A-Z');
define('TEXT_INFO_SORT_BY_PRODUCTS_BRAND_DESC', 'Brand - Z-A');
Those will return the names for the Model descending sort and the manufacturers sorts... ok think that's it...
Hope it helps somebody out, that's all I'm trying to do...
Like I said I am not a coder, I am a vacuum repair man...
New Zenner
THIS IS AN UPDATE TO MY PREVIOUS POST!
OK I updated this so it will show a separate listing when either a manufacturers_id or filter_id is present.
I will list separate and new instructions, so let's get at it:
You will keep the tpl_modules_additional_listing_display_order.php file you made earlier and create a new one called tpl_manufacturers_listing_display_order.php in the same folder with the following code inside:
<?php /** * Module Template * * @package templateSystem * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @original version $Id: tpl_modules_additional_listing_display_order.php 3369 2006-04-03 23:09:13Z drbyte $ reworked by vacuumwarlock 2014 */ ?> <?php // NOTE: to remove a sort order option add an HTML comment around the option to be removed ?> <?php echo zen_draw_form('sorter_form', zen_href_link($_GET['main_page']), 'get'); echo zen_draw_hidden_field('main_page', $_GET['main_page']); // draw cPath if known if (!$getoption_set) echo zen_draw_hidden_field('cPath', $cPath); echo zen_hide_session_id(); ?><select name="sort" onchange="this.form.submit();" id="disp-order-sorter">
<?php if ($_GET['sort'] != PRODUCT_LISTING_DEFAULT_SORT_ORDER) { ?>
<option value="<?php echo PRODUCT_LISTING_DEFAULT_SORT_ORDER; ?>" <?php echo ($_GET['sort'] == PRODUCT_LISTING_DEFAULT_SORT_ORDER ? 'selected="selected"' : ''); ?>><?php echo PULL_DOWN_ALL_RESET; ?></option>
<?php } // reset to store default ?>
<option value="">----------</option>
<option value="5a" <?php echo ($_GET['sort'] == '5a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_MODEL; ?></option>
<option value="5d" <?php echo ($_GET['sort'] == '5d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_MODEL_DESC; ?></option>
<option value="2a" <?php echo ($_GET['sort'] == '2a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME; ?></option>
<option value="2d" <?php echo ($_GET['sort'] == '2d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_NAME_DESC; ?></option>
<option value="3a" <?php echo ($_GET['sort'] == '3a' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE; ?></option>
<option value="3d" <?php echo ($_GET['sort'] == '3d' ? 'selected="selected"' : ''); ?>><?php echo TEXT_INFO_SORT_BY_PRODUCTS_PRICE_DESC; ?></option>
</select></form>
then IN PLACE OF THE CODE FROM MY PREVIOUS POST, in the same spot as my earlier post specified, copy and paste the following code:
if (isset($_GET['manufacturers_id']) or ($_GET['filter_id'])) {
require($template->get_template_dir('/tpl_modules_manufacturers_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_manufacturers_listing_display_order.php');
} else {
require($template->get_template_dir('/tpl_modules_additional_listing_display_order.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_listing_display_order.php');
}
Having the manufacturers sort while manufacturers were present was kinda pointless and because the manufacturers filter on general products only returned a filter_id, I did it this way, may mess with alpha sorter, but does anyone even use that? if anyone knows how to better specify that a manufacturer is present, please let me know.
As always, hopes this helps someone and if someone could tell me how to put the php code in those fancy little brackets, tell me... lol
Like I said I am not a coder, I am a vacuum repair man...
Tell staff why this post should be reviewed.