magento1.9参考:[8]属性集调用

2025-04-08 08:22:12

1、如果你使用的版本是1.8默认是调用的。我这里是安装了1.9 easytabs的原因。所以修改的时候是在easytabs的description.phtml

magento1.9参考:[8]属性集调用

2、后台增加你要为产品添加的属性集。如下图参考编辑的属性

magento1.9参考:[8]属性集调用
magento1.9参考:[8]属性集调用
magento1.9参考:[8]属性集调用

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就是如下图对于的属性

magento1.9参考:[8]属性集调用

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')?>&nbsp;</dd><dt>Season</dt><dd><?php $attributes = $_product->getAttributes(); $themeColor = $attributes['season']->getFrontend()->getValue($_product); echo $themeColor; ?> &nbsp;</dd></dl><?php }?>这个是判断如果当前产品的ID如果大于1470才显示此内容。

5、由于在描述中要获得产品的属性。所以要添加一下内容才能获得产品所有属性<?php $_helper = $this->helper('catalog/output'); ?><?php $_product = $this->getProduct(); ?>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢