keijom Posted January 15, 2013 Posted January 15, 2013 Hello. How do I edit search results? I want the cheapest first. At the moment it come the product name.
multimixer Posted January 15, 2013 Posted January 15, 2013 In file catalog/advanced_search_result.php at about line 278 you have following: $order_str = " order by pd.products_name"; This short the query results by product name, if no other order option is felected You can change this to order by final_price My community profile | Template system for osCommerce - New: Responsive | Feedback channel
keijom Posted January 15, 2013 Author Posted January 15, 2013 In file catalog/advanced_search_result.php at about line 278 you have following: $order_str = " order by pd.products_name"; This short the query results by product name, if no other order option is felected You can change this to order by final_price // EOF Separate Pricing Per Customer if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $where_str .= " group by p.products_id, tr.tax_priority"; } 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'; $order_str = " order by pd.products_name"; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $order_str = " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $order_str = " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $order_str = " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $order_str = " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $order_str = " order by pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $order_str = " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $order_str = " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } $listing_sql = $select_str . $from_str . $where_str . $order_str; require(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> I tryed change that. Not working. But if I change "m.manufacturers_name" --> works fine. But "final_price" not working, I don`t know why? This is result "final_price :lol: Metzeler Sportec M3 180/55 ZR 17 TL (73W) 114.08eur Buy Now Metzeler Z8 Interact O 180/55 ZR 17 (73W) TL 133.02eur Buy Now Metzeler Roadtec Z6 180/55 ZR 17 (73W) TL 117.80eur Buy Now Metzeler Sportec M5 interact 180/55 ZR 17 (73W) TL 145.08eur Buy Now Michelin Pilot Power 2CT 180/55 ZR 17 (73W) TL Rear 122.76eur Buy Now Michelin Pilot Road 180/55 ZR 17 (73W) TL Rear 101.68eur Buy Now
multimixer Posted January 15, 2013 Posted January 15, 2013 I can't see that you changed anything in what you posted My community profile | Template system for osCommerce - New: Responsive | Feedback channel
keijom Posted January 15, 2013 Author Posted January 15, 2013 $order_str = " order by pd.products_name"; = $order_str = " order by final_price"; that I change. Not chage that post, just exsample.
multimixer Posted January 15, 2013 Posted January 15, 2013 Find $order_str = " order by pd.products_name"; Replace with $order_str = " order by final_price"; My community profile | Template system for osCommerce - New: Responsive | Feedback channel
keijom Posted January 15, 2013 Author Posted January 15, 2013 Find $order_str = " order by pd.products_name"; Replace with $order_str = " order by final_price"; That is not working. But exsample "m.manufacturers_name" that working...
multimixer Posted January 15, 2013 Posted January 15, 2013 Well, it work for me. Are you sure you upload the file etc? Edit: For trial you can try $order_str = " order by p.products_price"; My community profile | Template system for osCommerce - New: Responsive | Feedback channel
keijom Posted January 15, 2013 Author Posted January 15, 2013 Thanks multimixer! Now it works! I put that $order_str = " order by p.products_price";
multimixer Posted January 15, 2013 Posted January 15, 2013 @@keijom That is not very correct, because it does not take care of any special price. The "final_price" is created "by the system", if special price exist, then it's this, else the regular price My community profile | Template system for osCommerce - New: Responsive | Feedback channel
keijom Posted January 15, 2013 Author Posted January 15, 2013 We do not have spesial prices. All the products are cheap :lol:
keijom Posted August 29, 2013 Author Posted August 29, 2013 Hey! Only the first page works (the price is right). When I go to page two, then the results will be the product name. What should I do?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.