2017-03-14 16 views
0

私はMagento 2を使用しています。バックエンドで製品を追加しようとすると、「構成」タブに構成が作成され、3つの属性があります。私は、フロントエンドモジュール上でそれらを取得できますかMagento 2でフロントエンドの属性リストを取得するには

enter image description here

私は、彼らがeav_attributeテーブルに格納されている見るが、私はそれは条件付きの列 enter image description here

感謝そんなに持っていないので、SQLはそれを行うことができる知りません!

答えて

-1

以下のコードを使用して、モジュールフロントエンドの属性を取得できます。

$attribute = $objectManager->create('\Magento\Eav\Model\Config')->getAttribute('catalog_product', 'color'); 
$colorAttributeId= $attribute->getAttributeId(); 

foreach ($attribute->getSource()->getAllOptions(true) as $option) { 
    $colors[$option['value']] = strtolower($option['label']); 
} 

print_r($colors); 
+0

ありがとうございますが、動作しません。 –

関連する問題