Jump to content

Get product information by its id


simpshoper

Recommended Posts

Hi,

 

I wanted to implement top rated products feature in my custom rating module. I get the correct product IDs from my module database, then I create product instance from it, but still I don't know how to get product name, image, etc.

 

I tried the following:

 

foreach($topProductIDs as $topProductID)
{
$topProduct = new Product($topProductID);

$name		 = $topProduct->getProductName();
$link		 = $topProduct->getLink();
$link_rewrite = $topProduct->link_rewrite;

...
}

 

but I got a lot of errors, including:

 

Missing argument 1 for ProductCore::getProductName()

 

and that link_rewrite is an array.

 

I am using Prestashop 1.5.3.1 if that matters.

 

What am I doing wrong? Maybe there is a better way to get product information from its ID?

 

Thanks in advance

Edited by simpshoper (see edit history)
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...