Magento(新手查询):如何显示产品规格属性?
Magento (newbie query): how can I display product specification attributes?
我想提取 "Product Information" 下 "Specification" 中的品牌和其他属性(目录 -> 管理产品 - 然后是 select 产品)。
我可以通过以下方式获取产品名称:
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
我需要类似的东西来在前端显示规范属性。
我该怎么做?
谢谢
这对我有用:
$_product = $this->getProduct();
$guarantee = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_product->getId(), 'spec_guarantee', 1); // 1 is the store id
echo $guarantee;
// outputs:
// 2 Years Manufacturers Guarantee
在 magento 1.9 中,我使用以下代码显示自定义属性。
<?php $_product->getData('takealotlink'); ?>
但是,要确保它显示在 front-end 中,您还必须从管理属性中设置正确的 属性。
要在 Front-end 属性中设置的 属性 是 "Used in product listing"。见下方箭头。
我想提取 "Product Information" 下 "Specification" 中的品牌和其他属性(目录 -> 管理产品 - 然后是 select 产品)。
我可以通过以下方式获取产品名称:
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
我需要类似的东西来在前端显示规范属性。
我该怎么做?
谢谢
这对我有用:
$_product = $this->getProduct();
$guarantee = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_product->getId(), 'spec_guarantee', 1); // 1 is the store id
echo $guarantee;
// outputs:
// 2 Years Manufacturers Guarantee
在 magento 1.9 中,我使用以下代码显示自定义属性。
<?php $_product->getData('takealotlink'); ?>
但是,要确保它显示在 front-end 中,您还必须从管理属性中设置正确的 属性。
要在 Front-end 属性中设置的 属性 是 "Used in product listing"。见下方箭头。