arthurganem Posted July 17, 2012 Share Posted July 17, 2012 The default sort by in prestashop is by product id (the one that is named "--") I would like to change it to completly random products, after trying to do this for the whole day, im going nowhere close, so i need some help please. I was able to achieve something similar on home featured, by replacing the following code $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); with $products = $category->getProducts(intval($params['cookie']->id_lang), 1, 100); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } Im guessing i can do same to product sorty by and change the default, '--' to random. Also this is a bit random but i need to customize similar products, when you are viewing a product. it only shows 4 products and i would like to change that, and randomize it more. I just cant find which file even i have to edit. Thanks in advance, Link to comment Share on other sites More sharing options...
arthurganem Posted July 19, 2012 Author Share Posted July 19, 2012 bump Link to comment Share on other sites More sharing options...
arthurganem Posted July 20, 2012 Author Share Posted July 20, 2012 Ok I found out how to make other products in the same category more random than it was (it was constantly 4 same things at some point) what i did was i added the following line to productcategory.php // Get infos $categoryProducts = $category->getProducts((int)($cookie->id_lang), 1, 1000); $sizeOfCategoryProducts = (int)sizeof($categoryProducts); $middlePosition = 0; /* new code*/ shuffle($categoryProducts); //This randomizes products. Only problem is it displays only 4 products out of the category, and i really need it to be 6. I'm assuming the change would be in productcategory.php or in productcategory.tpl I just cant find exactly where, and i just started learning php. Any one have a clue? Link to comment Share on other sites More sharing options...
hernanlr Posted September 12, 2012 Share Posted September 12, 2012 Hi, My client wants to have the "other products in the same category" sorted by ascending price. Do you have an idea on how to make that? Also, do you know how to make the TAB Accessories the default TAB? Thanks and regards, Hernán Link to comment Share on other sites More sharing options...
Recommended Posts