megamiska Merchant من Slovenia عضو منذ أكتوبر 2023 megamiska 24 فبراير 2024 19:50 Hi,is there any code / setting how can I show products, which are on stock first and products out of stock bellow?Thanks
tim Founder من Sweden عضو منذ مايو 2013 tim 25 فبراير 2024 01:50 Hi. You would want to change the order clause for the $products_query in func_catalog.inc.php.order by if(p.quantity > 0, 0, 1) asc, ...
megamiska Merchant من Slovenia عضو منذ أكتوبر 2023 megamiska 25 فبراير 2024 10:34 Thanks Tim for reply!I found this in func_catalog.inc.php, but where to add this code?$products_query = database::query($query); return $products_query; }
tim Founder من Sweden عضو منذ مايو 2013 tim 25 فبراير 2024 12:35 https://github.com/litecart/litecart/blob/2.5.5/public_html/includes/functions/func_catalog.inc.php#L64Line 64-93 are the order by options.Try replacing this line: $sql_outer_sort = [];With this: $sql_outer_sort = ['if(p.quantity > 0, 0, 1) asc'];That way this order goes before anything else following.
megamiska Merchant من Slovenia عضو منذ أكتوبر 2023 megamiska 25 فبراير 2024 13:45 Perect, it works! Thanks Tim!
dodo Moderator من Lithuania عضو منذ مارس 2016 dodo 27 فبراير 2024 12:17 @megamiska don't forget to use vMod for core file modifications. Otherwise it will be replaced on the first update.
megamiska Merchant من Slovenia عضو منذ أكتوبر 2023 megamiska 27 فبراير 2024 15:49 @dodo thanks for tip, done :)