0

如何过滤 magento 的相关产品块以仅在库存产品中显示?

    <?php foreach($this->getItems() as $_item): ?>
        <li class="item">
            <?php if(!$_item->isComposite() && $_item->isSaleable()): ?>
                <?php if (!$_item->getRequiredOptions()): ?>
                    <input type="checkbox" class="checkbox related-checkbox" id="related-checkbox<?php echo $_item->getId() ?>" name="related_products[]" value="<?php echo $_item->getId() ?>" />
                <?php endif; ?>
            <?php endif; ?>
            <div class="product">
                <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
                <div class="product-details">
                    <p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
                    <?php echo $this->getPriceHtml($_item, true, '-related') ?>
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                        <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
                    <?php endif; ?>
                </div>
            </div>
        </li>
    <?php endforeach ?>

我已将当前的 magentos realted.phtml 迭代上传到 github:

https://gist.github.com/anonymous/6126772

4

1 回答 1

1

<li>进去<?php if ($_item->isSaleable()): ?> . . . <?php endif; ?>

于 2013-07-31T23:04:34.340 回答