Jump to content

[SOLVED] Limit Number of Products Shown On New Products Page?


artofadornment

Recommended Posts

Hi all,

I'm using PS 1.5.3.1 and I'm wondering if there is a way that I can limit the number of products that are displayed when the "New Products" page loads (not the block, the actual page). I'd like to set the limit to 12, could someone help with what code I need? I am assuming that I need to change new-products.tpl but I have no idea what to put there.

 

Thank you in advance!

~ Elaine

 

 

Edited to clarify: I don't mean that I want to show 12 products per page, I mean that I want to have a maximum of 12 products displayed in total (so that there is only one New Products page and there are only 12 products showing on it).

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

In block you can set limit insite configuration module

Per page you must edit file controllers/front/NewProductsControllers.php, line 60.

Edit this code:

'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay),

on

'products' => Product::getNewProducts($this->context->language->id, (int)($this->p) - 1, 12, false, $this->orderBy, $this->orderWay),

Link to comment
Share on other sites

Thank you, but that's not quite what I'm looking for (I may not be wording this correctly). I already have the FO set to display 12 products on any given page by default. But for the "new products" page only, I only want to show only the 12 most recently added products (not page after page of new products - just one page with 12 products on it, no pagination). So regardless how many new products there actually are in the entire catalogue, only the 12 newest products would be displayed on the "new products" page, period.

 

The reason for this that I have just imported all of my products from osCommerce, so right now, technically speaking, *all* 250 products are brand new. I want to set my "Number of days for which the product is considered 'new'" to be a high number (e.g. 60 days) so that in the future there will always be at least a few items on that page (I add 1-2 new items every week). However I don't want all 250 products sitting there for the next two months, misleading people into thinking that I have 21 pages of brand new products. So I need just one page, no pagination, with 12 new products on it.

Link to comment
Share on other sites

hey

 

you have to edit both controller and template file:

 

controller ( controllers / front / newproductscontroller.php )

change the 'products' => Product::getNewProduct() function to:

 

'products' => Product::getNewProducts($this->context->language->id, 0, 12, false, $this->orderBy, $this->orderWay)

 

then in themes / YOUR_THEME / new-products.tpl remove the:

{include file="./pagination.tpl"}

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
  • 3 years 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...