In this post I am going to explain how Get Product Url by Product Id in PrestaShop 1.7.
// Your Product id
$id_product = 10;
// Language id
$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
// Load Product object
$product = new Product($id_product, false, $id_lang);
// Validate Product object
if (Validate::isLoadedObject($product)) {
// Initialize the Link Object
$link = new Link();
// Get Product URL
$url = $link->getProductLink($product);
echo $url;
}
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!



Leave a Reply