moy2010 Posted September 12, 2015 Share Posted September 12, 2015 (edited) 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 . 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 September 12, 2015 by moy2010 (see edit history) Link to comment Share on other sites More sharing options...
jgamio Posted September 12, 2015 Share Posted September 12, 2015 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 1 Link to comment Share on other sites More sharing options...
moy2010 Posted September 12, 2015 Author Share Posted September 12, 2015 Thanks a lot to NemoPS for giving me the answer . $product->isNew(); did the trick! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now