Jump to content


  • Content count

  • Joined

  • Last visited

  1. 007inda

    sort products by stock status

    hi there, just searched through the contribs and only found something that i used a while ago to help sort them by price by default. I couldnt find anything extra that could elaborate and customise sort orders etc. I am fairly confident im mucking about in the correct area of code, I managed to make some slight adjustments and have tried changing the sql query with no joy. Just quite not the way I want this to sort the products. The reason I wish to achive this is some of my categories have upto 2-300 products in them and it is off putting seeing a load of Out of stock items on the first category page as they are sorted by price the clearance, end of life stuff comes up first. so the actual regualar stock may not appear till 2nd, 3rd page in that cat. If that makes sense. Just purley for better presentation of stock really.
  2. 007inda

    sort products by stock status

    cheers for replying. i think this is the section of code that needs adjusting: if (isset($HTTP_GET_VARS['instock'])) { $listing_sql .= " and p.products_quantity > 0"; } 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 . 'a'; $listing_sql .= " order by final_price"; break; } } Ive made a few changes but with no joy. This currently shows all products sorted by price and thats it. I want all in stock sort by price lowest to highest then the out of stock sorted by price low to high. Is anyone kind enough to spend two min looking at the above and seeing where i am going wrong. Regards.
  3. hi, can anyone point me in the right direction. I have many products on our site, at present when browsing through categories on our OSC site it shows the products sorted by price. i have added a contrib to filter and show "instock" items only. but i want by default on page load to sort by price the instock then show by price the out of stock if that makes sense. I presume it will be as simple as a few lines of code on the index.php perhaps, not a coder so not too sure. Regards.