0

属性セットから属性名のリストを取得したい。属性IDを取得する方法は知っていますが、名前のリストを取得する方法がわかりません。これはこれまでの私のコードです。

<?php
    $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
    $attributeSetName   = 'Brands'; 
    $attributeSetId     = Mage::getModel('eav/entity_attribute_set')
                        ->getCollection()
                        ->setEntityTypeFilter($entityTypeId)
                        ->addFieldToFilter('attribute_set_name', $attributeSetName)
                        ->getFirstItem()
                        ->getAttributeSetId();
    $attributes = Mage::getModel('catalog/product_attribute_api')->items($attributeSetId);
    foreach($attributes as $_attribute){
        var_dump($_attribute);
    }
?>
4

1 に答える 1

1

自分でテストを行ったところ、今はテストを行ったようですが、

     foreach($attributes as $_attribute){

        $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
            ->setCodeFilter($_attribute['code'])
            ->getFirstItem()->getFrontendLabel();

              echo "<pre>";
              echo $attributeInfo;
       }
于 2012-10-04T10:19:53.750 に答える