0

My Magento 1.6.2.0 installation currently sorts related products in ascending order by sort order (thanks to this Q/A). The answer detailed there works beautifully, however I prefer my products with a sort order value of NULL be listed last or completely excluded. I've played with addAttributeToSelect() but I have been unsuccessful.

4

1 回答 1

0

这可能不是最好的解决方案,但我在我的 related.phtml 文件中添加了一条 if 语句。

    <?php foreach($this->getItems() as $_item): ?>
        // add the if statement immediately after the foreach loop
        <?php if ( !is_null($_item->getPosition()) ): ?>
        . . . .
        <?php endif; ?>
    <?php endforeach; ?>
于 2012-06-23T20:10:57.363 回答