<?php
$product_id = Mage::registry('current_product')->getId();
$product= Mage::getModel('catalog/product')->load($product_id);//object(Mage_Catalog_Model_Product)
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
$attr_id = $attributeSetModel->getAttributeSetId();
echo "Set name: '".$attributeSetName."'"." set id: ".$attr_id;
echo "< br >________________________________________________< br >";
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_group_collection') ->load();
foreach ($attributeSetCollection as $id=>$attributeGroup){
if ($attr_id == $attributeGroup->getAttributeSetId())
{
echo 'set-id: '.$attributeGroup->getAttributeSetId().' group-id: '.$attributeGroup->getAttributeGroupId().' group-name: '.$attributeGroup->getAttributeGroupName().'< br >';
}
}
?>
более наглядный результат:
<?php
$product_id = Mage::registry('current_product')->getId();
$product= Mage::getModel('catalog/product')->load($product_id);
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
$attr_id = $attributeSetModel->getAttributeSetId();
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_group_collection') ->load();
foreach ($attributeSetCollection as $id=>$attributeGroup)
{if ($attr_id == $attributeGroup->getAttributeSetId())
{ echo 'Set name: '.$attributeSetName.'|set-id: '.$attributeGroup->getAttributeSetId().'|group-id: '.$attributeGroup->getAttributeGroupId().'|group-name: '.$attributeGroup->getAttributeGroupName().'< br >';
}
}
?>
Комментариев нет:
Отправить комментарий