Показаны сообщения с ярлыком Attribute. Показать все сообщения
Показаны сообщения с ярлыком Attribute. Показать все сообщения
вторник, 18 февраля 2014 г.
среда, 11 сентября 2013 г.
Magento Get all attribute group from attribute set
<?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 >';
}
}
?>
вторник, 20 августа 2013 г.
воскресенье, 7 июля 2013 г.
Get all attribute from attribute group in Magento
<?php
function printGroupAttributes($groupId) {
$attributesCollection = Mage::getResourceModel('catalog/product_attribute_collection');
$attributesCollection->setAttributeGroupFilter($groupId);
foreach ($attributesCollection as $attribute) {
echo "<tr><td>".$attribute->getFrontendLabel()." </td><td> ".$attribute->getAttributeCode()."</td></tr>";
}
}
$attributeGroupId = 25; // Fill with yours
printGroupAttributes($attributeGroupId);
?>
Get all Attribute Group of Magento
$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
->load();
foreach ($attributeSetCollection as $id=>$attributeGroup) {
echo 'set-id: '; echo $attributeGroup->getAttributeSetId().'< br >';
echo 'group-name: '; echo $attributeGroup->getAttributeGroupName().'< br >';
echo 'group-id: '; echo $attributeGroup->getAttributeGroupId().'< br >';
}
Подписаться на:
Сообщения (Atom)
