Jump to content

Question about pagination.


AFemaleProdigy

Recommended Posts

I have created a custom product list via categories in 1.4.7.3. I am using a conditional statement to limit the items that display to those with less than 5 items in stock. The problem I am having is that even though the conditional statement is working, pagination appears to still be counting all items, not just the ones with less than 5 stock. So I end up with only one or two items per page and multiple pages. Anyone know how I can make the pagination count the products correctly? You can see what I mean here...

 

http://rotmgvault.co...47&noredirect=1

Edited by AFemaleProdigy (see edit history)
Link to comment
Share on other sites

I found this in the controller and am guessing that I need to make an edited version to include the "stock less than" part. Any ideas how to do that?

 

if(!$hookExecuted) // The hook was not executed, standard working
 {
  self::$smarty->assign('categoryNameComplement', '');
  $this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
  $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
  $this->cat_products = $this->category->getProducts((int)(self::$cookie->id_lang), (int)($this->p), (int)($this->n), $this->orderBy, $this->orderWay);
 }
 else // Hook executed, use the override
  $this->pagination((int)$this->nbProducts); // Pagination must be call after "getProducts"
 self::$smarty->assign('nb_products', (int)$this->nbProducts);
}

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi,

 

where are you get the new collection (with condition "stock less than")? You also need to modificate

  $this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true); 

so that it returns number of products in new collection (with condition "stock less than")

 

Regards

 

I don't quite understand your instructions. Can you explain a little more? Sorry and thanks.

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

where are you get the new collection (with condition "stock less than")? You also need to modificate

  $this->nbProducts = $this->category->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true); 

so that it returns number of products in new collection (with condition "stock less than")

 

Regards

 

I don't know how to make this work. Can you or someone please help me? I see the code you are talking about, but am not sure what to change.

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