嗨,我已经尝试了几个小时来简单地设置畅销模块中显示的产品数量。没运气!
我已经搜索并没有在网上找到这个特定问题的答案。
这个网站http://www.jimcode.org/2011/04/magento-setting-columns-limiting-products-shown-grid/接近但我就是不明白。
这是“我的”代码:
<?php if($this->getItemCollection() && $this->getItemCollection()->getSize()): ?>
<div class="block">
<div class="block-title">
<strong><span><?php echo $this->__('Top Sellers In This Category') ?></span></strong>
</div>
<div class="block-content">
<?php $this->setColumnCount(1); // uncomment this line if you want to have another number of columns ?>
<?php $this->resetItemsIterator() ?>
<?php for($_i=0;$_i<$this->getRowCount();$_i++): ?>
<tr>
<?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
<?php if($_link=$this->getIterableItem()): ?>
<div class="img" style="float:left;width:212px">
<a href="<?php echo $_link->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(193); ?>" width="193" height="" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" /></a>
</div>
<div class="text" style="float:left;width:212px;margin-top:-60px"><img style="width:45px;height:64px;position:relative;z-index:15;right:0px;bottom:260px" src="<?php echo $this->getSkinUrl('images/ribbon.png'); ?>" />
<div class="title"><a href="<?php echo $_link->getProductUrl() ?>"><?php echo $this->htmlEscape($_link->getName()) ?></a></div>
No: <?php echo $this->htmlEscape($_link->getSku()) ?>
<div class="price"></div>
<a href="<?php echo $this->getAddToCartUrl($_link) ?>" class="arr">Add to Cart</a>
</div>
<?php else: ?>
<td class="empty-product"> </td>
<?php endif; ?>
<?php endfor; ?>
</tr>
<?php
/* <?php if($_i+2<=$this->getRowCount()): ?>
<tr>
<td class="spacer" colspan="6"><div class="separatorsmall"></div></td>
</tr>
<?php endif; ?>
*/
?> <?php endfor; ?>
</div>
</div>
<?php endif; ?>
谢谢