Jump to content

[Solved] Random Products - productcategories


Recommended Posts

Hi all,

 

I was about to ask the question as to how to make the products 'In the same category' box randomised. Managed to find a solution which may help someone in the future:

 

In productcategory.php change:

 

$categoryProducts = $category->getProducts((int)($cookie->id_lang), 1, 100);

 

to be

$categoryProducts = $category->getProducts(intval($params['cookie']->id_lang), 1, 100);
if ($categoryProducts) {
shuffle($categoryProducts);
array_splice($categoryProducts, ($nb ? $nb : 10));
}

 

Hope this helps

 

Cheers,

 

Lee

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 2 months later...
  • 1 month later...
  • 4 months later...
  • 2 weeks later...
  • 3 months later...
  • 4 months later...
  • 3 weeks later...
  • 1 year later...
  • 5 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...