小智 11
要在产品页面上显示属性的内容,您需要在view.phtml文件中添加以下代码.
$_product->getResource()->getAttribute('brand_info')->getFrontend()->getValue($_product);
Run Code Online (Sandbox Code Playgroud)
确保该属性标记为"在前端使用",然后在模板名称中写下以下要查看属性的位置:
<?php print $_product->getBrandInfo(); ?>
Run Code Online (Sandbox Code Playgroud)
小智 5
将以下代码添加到您的catalog/product/view.phtml或catalog/product/list.html模板文件中:
echo $_product->getAttributeText('your_attribute_code');
Run Code Online (Sandbox Code Playgroud)
只需更改your_attribute_code属性代码就可以了.
| 归档时间: |
|
| 查看次数: |
27037 次 |
| 最近记录: |