Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

To Sort by "Date added" in index.php


artandsports

Recommended Posts

Hello,

 

Is it possible to take this code in index.php:

 

 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_PRICE') {
$HTTP_GET_VARS['sort'] = $i+1 . 'd';
$listing_sql .= " order by final_price desc";
break;

 

with "date added" ? So the last one will be every time on the top

 

I tried that , but it doesn't work

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] == 'PRODUCTS_DATE') {
        $HTTP_GET_VARS['sort'] = $i+1 . 'a';
        $listing_sql .= " order by p.products_date_added , pd.products_name";

 

Thank you for your help

Link to comment
Share on other sites

think you can just use this iso the whole for construction

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
        $HTTP_GET_VARS['sort'] = sizeof($column_list) +1 . 'd';
        $listing_sql .= " order by p.products_date_added desc , pd.products_name";

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...