Magento中如何为Group Product添加图片
Magento中,Group Product可以上传图片,但是他下面list的产品没有图片,那如何为这些list添加图片呢,其实很简单的:
找到grouped.phtml,路径
web_root/app/design/frontend/base/default/template/catalog/product/view/typeReplace
<thead>
<tr>
<th><?php echo $this->__('Product Name') ?></th>
<th class="a-right"><?php echo $this->__('Price') ?></th>
<?php if ($_product->isSaleable()): ?>
<th class="a-center"><?php echo $this->__('Qty') ?></th>
<?php endif; ?>
</tr>
</thead>
<thead>
<tr>
<th><?php echo $this->__('Image') ?></th>
<th><?php echo $this->__('Product Name') ?></th>
<th class="a-right"><?php echo $this->__('Price') ?></th>
<?php if ($_product->isSaleable()): ?>
<th class="a-center"><?php echo $this->__('Qty') ?></th>
<?php endif; ?>
</tr>
</thead>
and then, replace
<tr>
<td><?php echo $this->htmlEscape($_item->getName()) ?></td>
<td class="a-right">
<?php echo $this->getPriceHtml($_item, true) ?>
<?php echo $this->getTierPriceHtml($_item) ?>
</td>
<?php if ($_product->isSaleable()): ?>
<td class="a-center">
<?php if ($_item->isSaleable()) : ?>
<input type="text" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<tr>
<td><?php echo '<img src="'.$this->helper('catalog/image')->init($_item, 'thumbnail')->resize(40, 40).'" width="40">'; ?></td>
<td><?php echo $this->htmlEscape($_item->getName()) ?></td>
<td class="a-right">
<?php echo $this->getPriceHtml($_item, true) ?>
<?php echo $this->getTierPriceHtml($_item) ?>
</td>
<?php if ($_product->isSaleable()): ?>
<td class="a-center">
<?php if ($_item->isSaleable()) : ?>
<input type="text" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
Done!
阅读其他美文