【发布时间】:2014-02-26 10:02:21
【问题描述】:
我正在处理的 Magento 网站上的产品页面有问题。
我在静态块中使用以下代码在标题部分显示产品:
{{block type="catalog/product_list" category_id="4" template="catalog/product/custom_list.phtml"}}
问题是,除“产品”页面外,该块在所有页面上都显示良好。我在这里遗漏了什么吗?
希望你们能帮助我。
custom_list.phtml:
<?php
$_productCollection = $this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="cat-product-list">
<ul class="products-grid">
<?php foreach ($_productCollection as $_product): ?>
<li class="item">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(90,60)->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(TRUE); ?>" width="90" height="60" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
</li>
<?php endforeach ?>
</ul>
</div>
<?php endif; ?>
【问题讨论】:
-
“我在这里遗漏了什么吗?” ——也许吧,但没有我们那么多。您如何将此添加到产品页面?
-
像这样:getLayout()->createBlock('cms/block')->setBlockId('catProducts')->toHtml(); ?> 在标题区域中。
-
那是静态块没有显示吗?还是它正在显示,而您的
catalog/product_list没有显示在块内。 -
目录/产品列表未显示在块内。它在除产品视图页面之外的所有其他页面上都显示良好。
标签: magento magento-1.8