fbas Posted June 7, 2011 Share Posted June 7, 2011 Great idea But does anybody know how to change the code so that it sorts by model number. example 1 2 4 7 12 14 18 ect. Dave Yes, I was just looking for this very thing when I came across this thread, since Model number is my primary concern. Because this therad wasn't what I was looking for, I hacked the file myself: in catalog/index.php, lines 160-164: if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; } to this: if ($column_list[$i] == 'PRODUCT_LIST_MODEL') { //change here $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_model, pd.products_name"; //change here break; } Link to comment Share on other sites More sharing options...
buddhapi Posted June 22, 2011 Share Posted June 22, 2011 I put this in place for myself because it was driving me crazy trying to get the product options displayed in the order I wanted. All the sorting contributions I came across were difficult to implement or changed a lot of code. All I wanted was something that showed my options in order of price. Or at the very least showed them in the order I entered them. It's a simple fix that takes less than a minute. What it does... First - sorts by price Second - if price is same (or 0), it sorts based on the order that the option was entered. File to change ... /catalog/product_info.php Replace this line $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); With this line $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id"); Hope someone else will find this useful. I'd like to have my attributes only appear in the order in which I enter them, I think this code will worked if tweaked a bit, currently I have sizes, some of which add to the base price and some of which subtract from the base price. any help or tweaks would be greatly appreciated! and thanx in advance. Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted July 2, 2011 Share Posted July 2, 2011 Has anyone had this problem? - when this mod is applied the search returns nothing. Am I the only one with this issue? If not, can anyone post a MOD that fixes the search results issue. Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted July 2, 2011 Share Posted July 2, 2011 Has anyone had this problem? - when this mod is applied the search returns nothing ISSUE SOLVED Link to comment Share on other sites More sharing options...
adriantudorache Posted July 28, 2011 Share Posted July 28, 2011 Thanks! That was very helpfull! :thumbsup: I am only in the begining with my site Link to comment Share on other sites More sharing options...
Supertex Posted August 2, 2011 Share Posted August 2, 2011 I've got some subcats where the "name" field has numeric values in it, and the default sort is as follows: 1 10 100 11 2 3 4 5 6 7 8 9 Is there a way around this? It should place 10 after 9 without having to enter 9 as "09". That has the potential to be confusing for customers. Seems like it would be a fairly common question, but I've not seen anything on it yet. Perhaps I'm not searching the correct verbage. I'd really appreciate someone steering me in the right direction. osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Acknowledeged74 Posted August 21, 2011 Share Posted August 21, 2011 Yes, I am still looking for a way sort option values by name. This should be simple. Can a better-coder-than-me tell me if I can modify product_info.php to do this? I need to control what appears first in the list of product options. I tried installing McGrath's Sorter/Copier but I think maaaaaybe it isn't fully functional with the latest version of the cart. While I didn't receive any errors, and the copy function worked fine, the sorting feature did nothing. I uninstalled it. Back to square 1. Amy Hi its great that people are providing these sorts of things, thanks. I have tried this but get an error, when I have tried to add a new attribute to a product, any ideas whats happened ? Error below. 1136 - Column count doesn't match value count at row 1 insert into products_attributes values (null, '31', '4', '33', '0', '+') [TEP STOP] ----------- Thanks in advance, I've attached an image of my Product Options page, I've set the 'value price' at 0 Conrad Link to comment Share on other sites More sharing options...
Fyod Posted September 8, 2011 Share Posted September 8, 2011 Works with Ajax Attributes Manager. Mine went crazy and started sorting opposite. THANKS!! Link to comment Share on other sites More sharing options...
OSC-Sevilla Posted September 11, 2011 Share Posted September 11, 2011 Hi its great that people are providing these sorts of things, thanks. I have tried this but get an error, when I have tried to add a new attribute to a product, any ideas whats happened ? Error below. 1136 - Column count doesn't match value count at row 1 insert into products_attributes values (null, '31', '4', '33', '0', '+') [TEP STOP] ----------- Thanks in advance, I've attached an image of my Product Options page, I've set the 'value price' at 0 Conrad YES - I had the same issue http://www.oscommerce.com/forums/topic/379509-product-attribute-insert-error/page__fromsearch__1 http://www.oscommerce.com/forums/topic/379509-product-attribute-insert-error/page__fromsearch__1 Link to comment Share on other sites More sharing options...
Camelhmpz Posted October 30, 2011 Share Posted October 30, 2011 Perfect, just what I needed! Still a great solution after all this time. Kudos! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.