数千の製品を扱う Magento ストアがあり、それらのサブセットの「page_layout」属性が「更新なし」以外に設定されています。レイアウトはcatalog.xml内で1列に設定されていますが、表示されるレイアウトは「page_layout」属性の値に対応しています。
すべての製品のこの属性を一度にプログラムで変更したいと考えています。これまでのところ、次のような製品でこの属性の値を得ることができました。
$attributes = $product->getAttributes();
foreach ($attributes as $attribute) {
$attributeCode = $attribute->getAttributeCode();
$code = 'page_layout';
if ($attributeCode == $code)
{
$label = $attribute->getStoreLabel($product);
$value = $attribute->getFrontend()->getValue($product);
echo $attributeCode . '-' . $label . '-' . $value;
}
}
正しい属性を絞り込んだので、それを設定したいと思います。これまでのところあまり運がありませんが、これに関する経験はありますか?ありがとう!