我想在前端表中显示产品尺寸,但我不确定如何将后端的产品尺寸回显到表格中。下面是我的编码,我尝试添加大小列并写入 echo $this->getSizeHtml($_item, true) 以显示大小值,但无法工作。
<table class="table table-bordered responsive-table" id="super-product-table">
<col />
<col />
<col width="1" />
<thead>
<tr>
<th><?php echo $this->__('Product Name') ?></th>
<th><?php echo $this->__('Size') ?></th>
<?php if ($this->getCanShowProductPrice($_product)): ?>
<th><?php echo $this->__('Price') ?></th>
<?php endif; ?>
<?php if ($_product->isSaleable()): ?>
<th><?php echo $this->__('Qty') ?></th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php if ($_hasAssociatedProducts): ?>
<?php foreach ($_associatedProducts as $_item): ?>
<?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
<tr>
<td><?php echo $this->escapeHtml($_item->getName()) ?></td>
<td><?php echo $this->getSizeHtml($_item, true) ?></td>
<?php if ($this->getCanShowProductPrice($_product)): ?>
<td>
<?php if ($this->getCanShowProductPrice($_item)): ?>
<?php echo $this->getPriceHtml($_item, true) ?>
<?php echo $this->getTierPriceHtml($_item) ?>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($_product->isSaleable()): ?>
<td>
<?php if ($_item->isSaleable()) : ?>
<div class="quantity-wrapper clearfix">
<?php $random = rand(5, 1500); ?>
<div class="quantity-decrease btn-qty" onclick="qtyDown(<?php echo $random; ?>)"><i class="meigee-arrow-left"></i></div>
<input type="text" id="qty_<?php echo $random; ?>" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')); ?>" class="form-control qty" />
<div class="quantity-increase btn-qty" onclick="qtyUp(<?php echo $random; ?>)"><i class="meigee-arrow-right"></i></div>
</div>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="<?php if ($_product->isSaleable()): ?>4<?php else : ?>3<?php endif; ?>"><?php echo $this->__('No options of this product are available.') ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
实际上,我想要如下图所示的结果表:
希望有人能指导我如何显示大小值问题。谢谢。