タイトルのように、現在のストア ビューではなく、特定のストア ビューの属性オプション値を取得するにはどうすればよいですか?
私が実装しようとしているのは次のようなものです:
public function getAttributeOptionValue($attributeCode, $attributeOptionLabel, $storeView)
attributeOptionLabel は、現在の属性オプション ラベルです。
タイトルのように、現在のストア ビューではなく、特定のストア ビューの属性オプション値を取得するにはどうすればよいですか?
私が実装しようとしているのは次のようなものです:
public function getAttributeOptionValue($attributeCode, $attributeOptionLabel, $storeView)
attributeOptionLabel は、現在の属性オプション ラベルです。
単純!参照Mage_Eav_Model_Entity_Attribute::getStoreLabel()
[リンク]:
<?php
include 'app/Mage.php';
Mage::app('default');
//Generic access
$eavConfig = Mage::getSingleton('eav/config');
/* @var $eavConfig Mage_Eav_Model_Config */
$eavAttribute = $eavConfig->getAttribute(
Mage_Catalog_Model_Product::ENTITY, // 'catalog_product'; see db.eav_entity_type
'description' // attribute code
);
/* @var $eavAttribute Mage_Eav_Model_Entity_Attribute */
Zend_Debug::dump(
$eavAttribute->getStoreLabel('admin')
);
//For a given EAV entity-based model, the resource requires only the attribute
$product = Mage::getModel('catalog/product')->load(2);
/* @var $product Mage_Catalog_Model_Product */
$productAttribute = $product->getResource()->getAttribute('description');
/* @var $productAttribute Mage_Eav_Model_Entity_Attribute */
Zend_Debug::dump(
$productAttribute->getStoreLabel('admin')
);
//It's also possible to get all labels:
Zend_Debug::dump(
$productAttribute->getStoreLabels()
);