In this post I am going to explain how to get product manufacturer details by product id in PrestaShop 1.7.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | // 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)) { // Get product manufacturer id $id_manufacturer = $product->id_manufacturer; // Check if manufacturer set for this product if (isset($id_manufacturer)) { $manufacturer = new Manufacturer($id_manufacturer, $id_lang); // Validate manufacturer object if (Validate::isLoadedObject($manufacturer)) { $manufacturer_name = $manufacturer->name; // Print product manufacturer id echo $id_manufacturer; // Print product manufacturer name echo $manufacturer_name; // Print manufacturer Object echo "<pre>"; print_r($manufacturer); 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