In this post I am going to explain how to get product details by id in PrestaShop 1.7.
// Your product id
$id_product = 10;
// Language id
$lang_id = (int) Configuration::get('PS_LANG_DEFAULT');
// Load product object
$product = new Product($id_product, false, $lang_id);
// Validate product object
if (Validate::isLoadedObject($product)) {
// Get product name
echo $product->name;
// Get product description
echo $product->description;
// Get product short description
echo $product->description_short;
// Print Product Object
echo "<pre>";
print_r($product);
echo "</pre>";
}
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