tocalasam Posted November 22, 2013 Share Posted November 22, 2013 Hi guys I´d like to list at the end of product-list.tpl all the products with stock = 0. Any ideas about how proceeed? Best regards Fran Link to comment Share on other sites More sharing options...
vekia Posted November 24, 2013 Share Posted November 24, 2013 I´d like to list at the end of product-list.tpl all the products with stock = 0. all products without stock on page where you are, or all products without stock for whole shop? you can create two foreach loop, one with {if $product.quantity>=1} second with {if $product.quantity==0} Link to comment Share on other sites More sharing options...
tocalasam Posted November 24, 2013 Author Share Posted November 24, 2013 Hi Vekia I ´d like just liting at the end of every single category I´m now using your product-list format Your help will be really appreciated Best Fran Link to comment Share on other sites More sharing options...
vekia Posted November 25, 2013 Share Posted November 25, 2013 try with code that i suggested, create two foreach loops with if conditions above, one with {if $product.quantity>=1} second with {if $product.quantity==0} Link to comment Share on other sites More sharing options...
PascalVG Posted November 26, 2013 Share Posted November 26, 2013 Hi Fran, you could change the function to get the shown Products a little: edit classes/Category.php (Make backup first, just in case...) Find the function: public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) What we can do is 'hijack' the order by position: public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null) { if (!$context) $context = Context::getContext(); if ($check_access && !$this->checkAccess($context->customer->id)) return false; $front = true; if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) $front = false; if ($p < 1) $p = 1; /* replace original code if (empty($order_by)) with code below */ if (empty($order_by) or ($order_by == 'position')) { // $order_by = 'position'; comment out or delete this line $order_by = 'quantity'; // changed to order by quantity, descending order $order_way = 'DESC'; } else /* Fix for all modules which are now using lowercase values for 'orderBy' parameter */ $order_by = strtolower($order_by); ... What happens is, when normally the products are ordered by position in the back office list, we now change this into a list of descending quantity-s Hope this helps, pascal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now