Product Sort
for osCommerce Online Merchant v2.2
Product Sort Contribution
I needed the capability of sorting by product similar to the way in which categories are sorted. I read through many posts of how people use different techniques to accomplish product sort (i.e. putting a number such as 1., 2., 3. etc in front of the Product Name); however, none quite met what I was looking to accomplish. So, I put together this contribution with the following features:
- product sort entry on the product entry page in admin
- product and category sort order displayed on each of the category pages in admin (next to the red and green status indicators)
- ability to set the column sort order on the admin/configuration/product_listing page
- ability to set the column to being visible or not on the admin/configuration/product_listing page
- ability to use product sort order as the default catalog display whether or not the column is actually made visible
- maintain the native column sort capability in the catalog (click on column heading to get ascending/descending sort), though I did remove the "+" and "-" indicators
<<<<< I built this contribution on the snapshot dated September 14th, 2002. >>>>>>>>>
Legend: 
Download

Report
Grab 'Product Sort v1.6 (incl. Infobroker Admin Tool)' provided by skylla for a complete package but use this 'readme Product Sort v1.4.txt' instead. This readme file includes cczernia's default sorting fix.
I had a problem with product sort that products with no sort value assigned to them would be sorted randomely instead of alphabetically as it would before.
Created a small change to "readme Product Sort v1.4.txt" that allows product sort to first sort by product sort and then sort alphabetically.
Code change is below or you can download the revised readme file.
-------------------------------------------------
file: catalog/index.php
5. Approximately line 191-195,
>>> FIND THIS:
if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by pd.products_name";
>>> REPLACE THE LAST 2 LINES OF THE ABOVE:
$HTTP_GET_VARS['sort'] = $i+1 . 'a';
$listing_sql .= " order by pd.products_name";
>>> WITH THESE 2 LINES:
$HTTP_GET_VARS['sort'] = 'products_sort_order';
$listing_sql .= " order by p.products_sort_order asc, pd.products_name";
Product Sort v1.6 (incl. Infobroker Admin Tool) ***********************************
This version of Product Sort is a combination of version 1.4 and the version 1.5 (by Infobroker) with all neccesary changes applied to the osC MS2.2 131105 files in question to facilitate:
i easy install by dropping the catalog folder over non-modified catalog content
ii easy file comparison with already modified catalog content using comparison software.
However, manual install instructions are provided in v1.4&5 read_me files included. Whether you choose for a manual or a 'drop-over' install always run the product_sort.sql provided for the REQUIRED update to your database.
Rules of this game:
1) Please read both version read_me files provided in this Zip file. Here, you will find more information re. tweaking of this excellent contribution, e.g. changes to allprods.php file of the All Products Contribution and the optional clickable arrows for sort order within columns.
2) BACKUP BOTH DATABASE AND CATALOG FILES BEFORE YOU START
3) See point 2 above
Skylla
There is an important omission in instuctions regarding the necessary changes to database. Without the below changes to the database there is an error in admin --> Catalog --> Sort Order.
------Database-------
Insert a new field into TABLE_PRODUCTS, using this SQL command:
ALTER TABLE PRODUCTS ADD `products_sort_order` INT(3);
Insert a new entry into TABLE_CONFIGURATION, using this SQL command:
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (263, 'Display Product Sort Order', 'PRODUCT_SORT_ORDER', '0', 'Do you want to display the Product Sort Order column?', 8, 9, '2003-01-23 20:48:06', '2003-01-22 23:23:50', NULL, NULL);
Replace line 64 in products_sorter.php:
// while (list($key, $value) = each($sort_order_update)) {
while (list($key, $value) = each($HTTP_POST_VARS['sort_order_update'])) {
Thanks xtronics for the reference
Fix a small bug
Replace admin/products_sorter.php
Product Sort 1.4b plus Stand-alone Admin tool for an optimal function
I found a missing space causing an SQL error when sorting products by products_sort_order desc
I upload the full package with the fix...
This is the forum for this: http://forums.oscommerce.com/index.php?showtopic=32460
It took a long time to find the forum so - I thought I would post it. I uploaded the file I downloaded.
9. Approximately at lineS 839-843,***
number 9. is not correct on the other file.. for some reason the sort order wont show.. so heres a fix.
This pasckage contains all the corrections below and also corrects the problem if you want to use the images.
I also modified the sql file, because "TABLE products" was in capital letter and it didn't function with my database.
Correcting typos that resulted in error message when copy/duplicate products.
This file also include my previous instructions.
Sorry folks, one more modification needed to account for the missing column outside the product list.
This file also includes the previous instructions.
Minor correction to make the Product Sort contribution for use with osCommerce 2.2 MS2 work as displayed in sample image "catprod_sort.jpg".
TWO TYPOS IN PRODUCT SORT 1.3
>>TYPO 1
There is a missing "s" in the field name p.products_sort_order in the original document by Jim Keebaugh.
>>TYPO 2
advanced_search_results.php is called advanced_search.php in my version.
This is an upgrade of the Product Sort contribution for use with osCommerce 2.2 MS2.
I have added an option to replace the "+" and "-" characters in the product table headings with images. Support for sorting the All Products list in the Allprods contribution has also been added.
For support please post in the Contributions section of the Forum.
Error in file catalog/default.php mod #4 corrected in this version.
Mark
Found a minor bug: Product sort did not work past page 1 on categories with products spanning multiple pages.
Fix for this is listed in the txt file as mod #7 to file: catalog/default.php.
I also included screen shots in this zip.
Mark
Product Sort Contribution
I needed the capability of sorting by product similar to the way in which categories are sorted. I read through many posts of how people use different techniques to accomplish product sort (i.e. putting a number such as 1., 2., 3. etc in front of the Product Name); however, none quite met what I was looking to accomplish. So, I put together this contribution with the following features:
- product sort entry on the product entry page in admin
- product and category sort order displayed on each of the category pages in admin (next to the red and green status indicators)
- ability to set the column sort order on the admin/configuration/product_listing page
- ability to set the column to being visible or not on the admin/configuration/product_listing page
- ability to use product sort order as the default catalog display whether or not the column is actually made visible
- maintain the native column sort capability in the catalog (click on column heading to get ascending/descending sort), though I did remove the "+" and "-" indicators
<<<<< I built this contribution on the fully loaded snapshot from Phesis dated September 14th, 2002. >>>>>>>>>