Jump to content

Other related products carousel


Recommended Posts

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 :mellow: .

 

Can anybody help me? I guess a random order is good too.

 

Best regards, Centrobolsos

Link to comment
Share on other sites

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

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

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

Can you show us how you implemented that? maybe you have a small typo (or maybe I did it :D 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 :D

Link to comment
Share on other sites

×
×
  • Create New...