0

こんにちは、ベストセラーモジュールに表示される製品の数を簡単に設定するために何時間も試みてきました。運が悪い!

この特定の問題について検索しましたが、ウェブ上で答えが見つかりませんでした。

このサイト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">&nbsp;</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; ?>

ありがとうございました

4

1 に答える 1

0

を追加することで、コレクションのサイズをたとえば 40 に制限できます$this->getItemCollection()->getSelect()->limit(40)

于 2012-12-31T12:46:31.123 に答える