Jump to content

[Solved] Check if a Product is considered as new


moy2010

Recommended Posts

Hi, Prestashop community. I'm trying to check if a product is considered as new by using the getNewPrоduсts method, but so far I've not been able to do so :P

 

I've doing this by seeing some other examples and I'm pretty sure that's why it's not working. So far this is what I've gotten:

 

$values[$idProduct] = (Product::getNewProducts($idProduct) > 0) ? 1 : 0;

 

Am I missing something about how this method works?

 

I'm not a coder, so any light you could shed on this would me much appreciated :).

 

Thanks in advance.

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

Hi

 

You need to see the class before use it

getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null)

Is not product_id in there these get you a list of products news is not a checker for a new porduct

 

 

Because Presta use the date of the product to considere it new you need is get the product and check for the creation date

  • Like 1
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...