![]() |
Adding (Mfr.) Sort Fields 4.0.x
It seems its fairly easy to add any sort field you like with X-Cart 4.0.x.
Here's how I added manufacturerid to the sort by options. 1) Edit include/search.php find: Code:
$sort_fields = array( Replace with: Code:
$sort_fields = array( Now in the same file locate: Code:
case "orderby": After this line of code add: Code:
case "mfrid": That's it! Pretty simple and quick, and it works on most all available fields in xcart_products table as well as others if need be. :wink: |
nice and simple mod. thanx boomer.
|
Strange think in my x-cart is, that its sorting correctly only in product search but the choices of ordering are available in list of products in categories and manufacturers, and here its not working correctly, becouse when I am in specified category and click on manufacturer or date sorting, its searching in whole products and order all products, not only which are in the specified category. Anybody know how to solve this ?
Ahh, I found what was wrong.. I have form action address in search order template search.php, instead of nothink:) |
Nice one..thanks B00MER
|
Thanks for the mod.
Does anyone know how to change this to sort by votes? I tried the obvious, but it didnt seem to work at all. |
Great mod...any ideas on how to make a drop down to display only the selected manufacturer?
|
Is there a way to make an additional 'extra field' (or fields) sortable? For instance, we use our own SKU, and would like to add a ManufacturerSKU, and be able to sort by that also. Would this be tough to do?
|
I checked my code and it looks different:
$sort_fields = array( "productcode" => func_get_langvar_by_name("lbl_sku"), "title" => func_get_langvar_by_name("lbl_product"), "price" => func_get_langvar_by_name("lbl_price"), "orderby" => func_get_langvar_by_name("lbl_default") ); if($current_area == 'A' || $current_area == 'P') $sort_fields["quantity"] = func_get_langvar_by_name("lbl_quantity"); if (empty($search_data)) And then: { case "productcode": $sort_string = "$sql_tbl[products].productcode $direction"; break; case "title": $sort_string = "$sql_tbl[products].product $direction"; break; case "orderby": $sort_string = "$sql_tbl[products_categories].orderby $direction"; break; case "quantity": $sort_string = "$sql_tbl[products].avail $direction"; break; I tried and gave me an error message on line 1. Does anyone know what to do in this situation? By the way it has been done Б─≤speedup optimizationБ─≥ on my XCart, several months ago. Thanks 8O |
All times are GMT -8. The time now is 01:08 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.