minghoo Posted August 23, 2005 Posted August 23, 2005 Hi guys, i just figured out how to sort product by model number. i searched this forum a whole afternoon, didn't get what i want. index.php find code: 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"; break; } } you need to change three places; 1. change $i+1 to $i-1, 2. change 'PRODUCT_LIST_NAME' to 'PRODUCT_LIST_MODEL', 3. change order by pd.products_name to order by p.products_model so the whole code should be: 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_MODEL') { $HTTP_GET_VARS['sort'] = $i-1 . 'a'; $listing_sql .= " order by p.products_model desc"; break; } } if you only change 2 and 3 place, it won't work on 2 or 3 pages. If anyone has problem, please just post. My contributions: EZ new fields easy way add Qty box in your product_info.php
Irin Posted August 26, 2005 Posted August 26, 2005 Hi guys, i just figured out how to sort product by model number. i searched this forum a whole afternoon, didn't get what i want. index.php find code: ? ?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"; ? ? ? ? ?break; ? ? ? ?} ? ? ?} you need to change three places; 1. change $i+1 to $i-1, 2. change 'PRODUCT_LIST_NAME' to 'PRODUCT_LIST_MODEL', 3. change order by pd.products_name to order by p.products_model so the whole code should be: 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_MODEL') { ? ? ? ? ?$HTTP_GET_VARS['sort'] = $i-1 . 'a'; ? ? ? ? ?$listing_sql .= " order by p.products_model desc"; ? ? ? ? ?break; ? ? ? ?} ? ? ?} if you only change 2 and 3 place, it won't work on 2 or 3 pages. If anyone has problem, please just post. <{POST_SNAPBACK}> Hello minghoo, I did exactly as you say, changed code in all 3 places, but I still get my products listed by products_name on index.php. Did I miss anything? Thanks, Irina.
Danbob Posted September 5, 2005 Posted September 5, 2005 The code as shown in the body of the message is correct, the code in the "code" box is incorrrect -- change #3 to p.products_model, NOT p.products_model desc DAN Hello minghoo, I did exactly as you say, changed code in all 3 places, but I still get my products listed by products_name on index.php. Did I miss anything? Thanks, Irina.
Irin Posted September 5, 2005 Posted September 5, 2005 The code as shown in the body of the message is correct, the code in the "code" box is incorrrect -- change #3 to p.products_model, NOT p.products_model desc DAN Hello minghoo, I did exactly as you say, changed code in all 3 places, but I still get my products listed by products_name on index.php. Did I miss anything? Thanks, Irina. <{POST_SNAPBACK}> Unfortunately it doesn't work with neither p.products_model nor p.products_model desc. I tried both of them but nothing changed. Any other ideas? Thanks.
H2B2 Posted July 29, 2006 Posted July 29, 2006 Any other ideas? You could take a look a this contribution: Default Search options in categories and Advanced Search. It requires 2 minor changes in index.php and advanced_search_result.php
sporkalicious Posted May 9, 2008 Posted May 9, 2008 am having trouble with this modification not properly organizing products on pages of products other than page 1
Guest Posted June 25, 2008 Posted June 25, 2008 am having trouble with this modification not properly organizing products on pages of products other than page 1 I am also having the same problem, I order my products list by model number. On the first page it seems fine, but when I click next, all my products are jumbled in a reverse order, it is causing 5 of my products to never show up. Is there a way to list all products on the same page without clickng next??
Recommended Posts
Archived
This topic is now archived and is closed to further replies.