In the shoppin cart; "checkout/cart.phtml" page, I want to add a column that contains a custom attribute. Working with a multilingual Website, I have to show the translated label of each Store.
I have tried this code:
$attributeLabel = Mage::getResourceModel('eav/entity_attribute_collection'开发者_运维技巧)
->setCodeFilter('length')
->getFirstItem()
->getFrontend_label();
echo "<pre>"; var_dump($attributeLabel); echo "</pre>";
but this shows the attribute admin label.
How can I get the translated labels for earch store ?
Thanks.
you will need to get the resource. Simply pull it from the product (or from the resource model). Then get the Attribute Object and instead of getting the frontend label you will need to get the store label.
$_product->getResource()->getAttribute('attributecode')->getStoreLabel();
alternatively
Mage::getModel('catalog/resource_product')->getAttribute($_attribute)->getStoreLabel();
also IMPORTANT: your attribute needs to have a Value Configured for that Language. (this is what got me here ;) )
getFrontendLabel()
or getData('frontend_label')
. You're confusing syntaxes.
精彩评论