Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with Sort Order


aviscat

Recommended Posts

I have 35 products entered in this category. The normal way that it is sorted is by name. If I leave it by name all the products show on both pages. I changed it to sort by products_id and it works for the first page but when I click to go to the second page the sort order reverts to sorting alphabetically and doesn't show the items I entered by ID #. The client wants the items to show up in the same order as the pricing sheet which is the order I entered them in. So the first 20 items are correct but the last 15 are not. I will be entering another 20 or so items as soon as he gets them to me.

 

http://lightsply.com/store/catalog/index.php?cPath=24

 

I did a search on sorting and found what I thought was the solution.

 

In index.php line 162 I changed products_name to products_id. 

 

    if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[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_id";   (line 162)
          break;

 

How can I get it to show the correct sort order for all pages?

Link to comment
Share on other sites

so you don't want any sorting at all, and always by products_id ?

 

then I would just comment out that whole section in index.php and also sorting functionality in includes/modules/product_listing.php

 

and add $listing_sql line at the end before you call the product listing module

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

so you don't want any sorting at all, and always by products_id ?

 

then I would just comment out that whole section in index.php and also sorting functionality in includes/modules/product_listing.php

 

and add $listing_sql line at the end before you call the product listing module

 

I am a bit new to this. Is there any way to get all pages to continue listing by ID when going to the next page?

 

Can you tell me which lines in index.php need to be commented out? Where is the call to product listing module? What is the $listing_sql line I need to add there?

 

Edit: I commented out the sorting in index.php and got the results I wanted.

 

Is this the call to product_listing.php?     include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);

Link to comment
Share on other sites

see, yes you can do it, it  is not that hard :)

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

Archived

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

×
×
  • Create New...