Jump to content

Recommended Posts

Bonjour,

 

Voilà ce que j'ai pour la version 1.4.6.2 :

 

Dans le controller "controllers/CategoryController.php" on remarque que par défaut, les produit sont chargés dans la fonction productListAssign, plus particulièrement à la ligne suivante (167 chez moi ):

 

$this->cat_products = $this->category->getProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this->orderBy, $this->orderWay);

 

Et si on regarde en détail ce que fait cette fonction :

 

/**
  * Return current category products
  *
  * @param integer $id_lang Language ID
  * @param integer $p Page number
  * @param integer $n Number of products per page
  * @param boolean $getTotal return the number of results instead of the results themself
  * @param boolean $active return only active products
  * @param boolean $random active a random filter for returned products
  * @param int $randomNumberProducts number of products to return if random is activated
  * @param boolean $checkAccess set to false to return all products (even if customer hasn't access)
  * @return mixed Products or number of products
  */
public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true)
{
... le code de la fonction
}

 

ON remarque donc qu'il y a deux paramètres qui nous intéressent plus particulièrement ,

les paramètres :

 

* @param boolean $random active a random filter for returned products
* @param int $randomNumberProducts number of products to return if random is activated

 

en les utilisant correctement, on obtiens ce que tu souhaites avoir :

 

$this->cat_products = $this->category->getProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this->orderBy, $this->orderWay, false, true, true, 3);

Link to comment
Share on other sites

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