我创建了捆绑产品,它显示了产品的名称+价格,但是我希望显示简单产品的尺寸而不是名称和价格。如何让Magento在简单产品上显示尺寸属性?提前致谢。
答案 0 :(得分:0)
第1步: - 在主题中找到以下文件。
app \ design \ frontend {{your theme}} \ default \ template \ bundle \ catalog \ product \ view \ type \ bundle \ option / select.phtml
步骤2: -
请在上面的文件中找到以下代码
<?php foreach ($_selections as $_selection): ?>
<?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>
<?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
<?php endif; ?>
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?></option>
<?php endforeach; ?>
替换为此代码
<?php foreach ($_selections as $_selection): ?>
**<?php $productLoad=Mage::getModel('catalog/product')->load($_selection->getId()); ?>**
<?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>
<?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
<?php endif; ?>
<option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $productLoad->getAttributeText('size'); ?></option>
<?php endforeach; ?>