Magento - 获取属性集组名

时间:2014-09-08 08:50:18

标签: magento

抱歉,我的第一个问题出错了。

我想在比较产品页面(并排比较产品的页面)中获取属性集名称

我想获取属于集合属性的组名称。你知道如何维护属性集(属性集>组>属性)这样我就可以按组名显示比较页面产品属性。我怎样才能获得组名?

我不确定怎么做,有人能指出正确的代码或正确的方向吗?

此页面使用的模板是默认位置: 模板\目录\产品\比较\ list.phtml

1 个答案:

答案 0 :(得分:1)

要在比较产品页面中提取属性集名称,您可以在template\catalog\product\compare\list.phtml

中尝试以下代码

在这行代码之后

<?php foreach($this->getItems() as $_item): ?>

粘贴此代码以打印属性集名称

// Get attribute set model.
$model = Mage::getModel('eav/entity_attribute_set');

// Get attribute set id.
$attributeSetId = $_item->getAttributeSetId();
$attributeSet = $model->load($attributeSetId);

// This is attribute set name.
$attributeSetName = $attributeSet->getAttributeSetName();

echo $attributeSetName;

上面的代码将打印您的属性集名称,并根据您的HTML要求,您可以更改代码。

相关问题