This PHP example is simply get the manufacturer name and manufacturer id from a specified product ID in Magento.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php require_once ('D:/_$projects/23. MIREI/23.1 mirei.vn/Magento/app/Mage.php'); Mage::init(); $productId = 908; // this is Magento Product ID $product = \Mage::getModel('catalog/product')->load((int) $productId); $manufacturer_id = (int) $product->getData('manufacturer'); $manufacturer_name = $product->getAttributeText('manufacturer'); echo "manufacturer id: " . $manufacturer_id . "<br>"; echo "manufacturer name: " . $manufacturer_name . "<br>"; ?> |