Magento如何使用属性标签上的翻译?

问题描述:

我使用Magento,我需要帮助在前端使用属性标签的翻译! 我用这对我marketplace.phtml加载属性标签Magento如何使用属性标签上的翻译?

<?php 
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'etat_verres'); 
$allOptions = $attribute->getSource()->getAllOptions(true, true); 
foreach ($allOptions as $instance) { if($instance['label']) { 

echo $instance['value'] // to show the value 
echo $instance["label"] // to show the label 

} } 

?> 

的问题是,Magento的使用管理值,而不是法国的值或英语值。

在此先感谢!

此致,

约翰

使用$this->__是核心Magento的帮手其中还包含转换功能,现在假设你的模块扩展了核心Magento的助手,这将工作。现在您可以使用主题translate.csv文件来翻译您的文本。

<?php 
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'etat_verres'); 
$allOptions = $attribute->getSource()->getAllOptions(true, true); 

foreach($allOptions as $instance) 
{ 
    if ($instance['label']) 
    { 
     echo $this->__($instance['value']) // to show the value 
     echo $this->__($instance["label"]) // to show the label 
    } 
} 

还要记住,翻译了“标签”不应该是必要的,因为你可以在目录 - 使用Magento管理店视图转换>管理属性选择属性和管理每个店铺视图属性,但是,我我不完全确定上下文。虽然我提供的应该可以工作,但有了上下文会提供更好的解决方案。

+0

非常感谢你^^ –