Get product URL using Prestashop API

Fabien Papet picture Fabien Papet · Mar 25, 2014 · Viewed 26.2k times · Source

I have two stores using Prestashop. I would like to import a products URLs list from the first to the second.

I can access to the product list by using http://example.com/api/products
I can also access to the product information by using

http://example.com/api/products/{ProductID}

By this way I can access to all products data but I can't find product URL.

Is there a way to retrieve a product URL from Prestashop ?

Answer

yenshirak picture yenshirak · Mar 25, 2014

You can generate the product URL from the product ID:

$productUrl = 'http://mydomain.com/index.php?controller=product&id_product=' . $productId;

If Friendly URL is turned on then the URL will be rewritten.