minghoo Posted August 23, 2005 Posted August 23, 2005 hi guys, how can i change the code in index.php to show new items first in product listing page? 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; } } i know how to sort order by product model number or price, but how can i sort product by date, which means new added items show first on product listing page. Thanks sean My contributions: EZ new fields easy way add Qty box in your product_info.php
minghoo Posted August 23, 2005 Author Posted August 23, 2005 and aslo i tried to sort by model number: 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"; break; } } but this is not desc order, so i change this code to 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_MODEL') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by p.products_model desc"; break; } } Somehow this is only to work on the first page, but not 2 or 3 pages. Anyone any idea how to do it? Thanks sean My contributions: EZ new fields easy way add Qty box in your product_info.php
minghoo Posted August 23, 2005 Author Posted August 23, 2005 finally, got how to do it. My contributions: EZ new fields easy way add Qty box in your product_info.php
Recommended Posts
Archived
This topic is now archived and is closed to further replies.