题
在Magento上使用分组产品(例如家具套件)时,默认情况下,关于其简单产品的信息很少。
这 演示站点示例 似乎不允许用户探索类似物的尺寸或其他属性的任何细节。它显示的只是名称和价格。
分组产品页面上是否有任何模板方法可用来显示有关其组件简单产品的更多详细数据?诸如简短描述,缩略图,URL到简单产品视图(如果有效)等诸如诸如等等。
解决方案
在 catalog/product/view/type/grouped.phtml
你可以找到一张桌子 #super-product-table
其中包含您提到的关联产品的基本信息。要添加一个简短的描述(例如),您应该在桌子的正文中添加类似的内容,换句话说 foreach ($_associatedProducts as $_item)
环形:
<?php echo $this->htmlEscape($_item->getShortDescription()) ?>
其他提示
假设 catalog/product/view.phtml
您可以做这样的事情:
if($_product->isGrouped()) {
$_associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
foreach($_associatedProducts as $_associatedProduct) {
if($_description = $_associatedProduct->getShortDescription()) {
echo $this->helper('catalog/output')->productAttribute($_associatedProduct, $_description, 'short_description');
}
}
}