0

構成可能な製品を作成するために使用できるとチェックされたすべての属性をリストしたいと思います。(「構成可能な製品を作成する」を選択した直後のチェックボックス リストなど。

私は試した :

$attributes = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getConfigurableId());`

ただし、コレクションは取得されません。

4

2 に答える 2

1

私はこれを試しましたが、うまくいきます:

$product = Mage::getSingleton("catalog/product");
$attributes = $product->getTypeInstance(true)->getSetAttributes($product);
foreach ($attributes as $attribute) {
  if (($attribute->getIsConfigurable()) && ($attribute->getIsVisible()) && ($attribute->usesSource()) && ($attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL)){
    ... do some things ...
  }
}

これらの属性を一覧表示する最良の方法ではない可能性があります。

于 2013-03-05T14:49:39.417 に答える
0

これを試して:

$collection = Mage::getResourceModel('catalog/product_type_configurable_attribute_collection');

または、構成可能な属性を特定の製品に割り当てたい場合は、次のようにします。

$collection = Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')
    ->setProductFilter($product)
;
于 2013-02-27T09:14:52.777 に答える