magento1.9参考:[8]属性集调用
1、如果你使用的版本是1.8默认是调用的。我这里是安装了1.9 easytabs的原因。所以修改的时候是在easytabs的description.phtml
2、后台增加你要为产品添加的属性集。如下图参考编辑的属性
3、然后<?php echo$_product->getAttributeText('backstyleds')?>即可调用下拉dropdown属性产品。
如果你的产品是multiple select的话使用上面方法会显示array(数组)
如下方法可以解决multiple多选问题
<?php
$attributes = $_product->getAttributes();
$occasionsds = $attributes['occasionsds']->getFrontend()->getValue($_product);
echo $occasionsds;
?>
其中backstyleds和occasionsds就是如下图对于的属性
4、如果你想让以前添加的产品不显示改属性。可加一个判断。
<?php if ($product_id = $this->getProduct()->getId() > 1470 ) {?>
<h4>TEST:</h4>
<dl class="testdf">
<dt>Back Style</dt><dd><?php echo$_product->getAttributeText('backstyleds')?> </dd>
<dt>Season</dt><dd><?php
$attributes = $_product->getAttributes();
$themeColor = $attributes['season']->getFrontend()->getValue($_product);
echo $themeColor;
?> </dd>
</dl>
<?php }?>
这个是判断如果当前产品的ID如果大于1470才显示此内容。
5、由于在描述中要获得产品的属性。所以要添加一下内容才能获得产品所有属性
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>