Configurable-Produkte: get configurable product associated to simple product
Montag, 07. Februar 2011 14:06
PHP: (Auswählen)
//get parent (configurable) ids
if ($_product->getTypeId() <> "configurable") {
$parentId = $_product->loadParentProductIds()->getData('parent_product_ids');
if(isset($parentId[0])){
$parent = Mage::getModel('catalog/product')->load($parentId[0]);
}
}
ab Magento Version 1.4.2 folgenden Code benutzen, da loadParentProductIds() depreciated ist:
PHP: (Auswählen)
//get parent (configurable) ids
if ($_product->getTypeId() <> "configurable") {
$parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getId());
if(isset($parentId[0])){
$parentProduct = Mage::getModel('catalog/product')->load($parentId[0]);
}
}
Zuletzt editiert:Montag, 07. Februar 2011 15:11