Kami Solutions Posted March 3, 2014 Share Posted March 3, 2014 Hi prestashop forum, I was looking in the forum about related products carousel that appears in the bottom of each product to sort by newest first. It shows olders first, but i think newest first is better. I haven't see a thread like this, so i decided to open a new one . Can anybody help me? I guess a random order is good too. Best regards, Centrobolsos Link to comment Share on other sites More sharing options...
NemoPS Posted March 3, 2014 Share Posted March 3, 2014 Hi, Do you mean the 'products of the same category' module? Link to comment Share on other sites More sharing options...
Kami Solutions Posted March 3, 2014 Author Share Posted March 3, 2014 Hi, Do you mean the 'products of the same category' module? Hi, I think so, i'll attach an image. At the bottom of the image, "Other products in the same category" Link to comment Share on other sites More sharing options...
NemoPS Posted March 3, 2014 Share Posted March 3, 2014 Try editing this line of productscategory.php $categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */ according to the function specifications: 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) Use order by date_add, and order way as you prefer Link to comment Share on other sites More sharing options...
Kami Solutions Posted March 3, 2014 Author Share Posted March 3, 2014 Try editing this line of productscategory.php $categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */ according to the function specifications: 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) Use order by date_add, and order way as you prefer I'm sorry, but where i have to put the function? just under this line? $categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */ Or where i want in productscategory.php? Thanks, Centrobolsos Link to comment Share on other sites More sharing options...
NemoPS Posted March 3, 2014 Share Posted March 3, 2014 No, modify that $categoryProducts = $category->getProducts($this->context->language->id, 1, 100, 'date_add', 'desc'); /* 100 products max. */ Link to comment Share on other sites More sharing options...
Kami Solutions Posted March 3, 2014 Author Share Posted March 3, 2014 No, modify that $categoryProducts = $category->getProducts($this->context->language->id, 1, 100, 'date_add', 'desc'); /* 100 products max. */ That's strange, it breaks my website :S Link to comment Share on other sites More sharing options...
vekia Posted March 3, 2014 Share Posted March 3, 2014 it's probably because there is not enough RAM memory to run this HUGE query turn on error reporting (as nemo has described in his signature) and you will see detailed information about what and where doesnt work (i bet on memory) Link to comment Share on other sites More sharing options...
NemoPS Posted March 4, 2014 Share Posted March 4, 2014 Can you show us how you implemented that? maybe you have a small typo (or maybe I did it thought I can't spot it atm) Link to comment Share on other sites More sharing options...
Kami Solutions Posted March 4, 2014 Author Share Posted March 4, 2014 Can you show us how you implemented that? maybe you have a small typo (or maybe I did it thought I can't spot it atm) Basically i put the code between these lines : if (!Validate::isLoadedObject($category) OR !$category->active) return; // Get infos //Here is where i change the line $categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */ //End modification $sizeOfCategoryProducts = (int)sizeof($categoryProducts); $middlePosition = 0; And replace the line for : 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) copy & paste Link to comment Share on other sites More sharing options...
NemoPS Posted March 5, 2014 Share Posted March 5, 2014 Try enabling error reporting as suggested in my signature, and see what you get instead of the blank page Link to comment Share on other sites More sharing options...
Recommended Posts