2013-08-20 60 views
0

使用Magmi上传CSV以将简单产品设置为不可见。当设置为“不可见”时仍然显示产品

清除Magento缓存和Reindexing后,产品仍显示在类别页面上,但点击简单的产品会给你一个404页面。

有无论如何阻止这些产品显示在类别页面上。的

例是发生这种情况http://boxchilli.co/s2as/kayaks-1.html

PROTEC ACE水头盔 - 白色顶部不彪表示,但PROTEC ACE WATER头盔 - WHITE2是

代码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> 
<!--<script type="text/javascript"> 
jQuery(window).load(function() { 
    jQuery('.page').css('background-image','none'); 
}); 
</script>--> 
<?php else: ?> 
<div class="category-products"> 
<?php $position = 'top'; ?> 
    <?php echo $this->getToolbarHtml($position) ?> 
    <?php // List mode ?> 
    <?php if($this->getMode()!='grid'): ?> 
    <?php $_iterator = 0; ?> 
    <ol class="products-list" id="products-list"> 
    <?php foreach ($_productCollection as $_product): ?> 
     <li class="item<?php if(++$_iterator == sizeof($_productCollection)): ?> last<?php endif; ?>"> 
      <?php // Product Image ?> 
      <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(130); ?>" width="130" height="130" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> 
      <?php // Product description ?> 
      <div class="product-shop"> 
       <div class="f-fix"> 
        <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?> 
        <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2> 
        <?php if($_product->getRatingSummary()): ?> 
        <?php echo $this->getReviewsSummaryHtml($_product) ?> 
        <?php endif; ?> 
        <?php echo $this->getPriceHtml($_product, true) ?> 
        <?php if($_product->isSaleable()): ?> 
         <p><button type="button" title="<?php echo $this->__('BUY NOW') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('BUY NOW') ?></span></span></button></p> 
        <?php else: ?> 
         <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p> 
        <?php endif; ?> 
        <div class="desc std"> 
         <?php $shortened = truncateText($_product['description'],250,'.'); ?> 
         <?php 
         $product_data = $_product->getData(); 
         if($_product->getName() == 'Mystic Warrior III (3) Kitesurf Waist Harness 2012 - Black'){print_r($product_data);} 
         ?> 
         <?php print_r($_product['description']); ?> 
         <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a> 
        </div> 
        <ul class="add-to-links"> 
         <?php if ($this->helper('wishlist')->isAllow()) : ?> 
          <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li> 
         <?php endif; ?> 
        </ul> 
       </div> 
      </div> 
     </li> 
    <?php endforeach; ?> 
    </ol> 
    <script type="text/javascript">decorateList('products-list', 'none-recursive')</script> 

    <?php else: ?> 

    <?php // Grid Mode ?> 

    <?php $_collectionSize = $_productCollection->count() ?> 
    <?php $_columnCount = $this->getColumnCount(); ?> 
    <?php $_columnCount = 4; ?> 
    <?php $i=0; foreach ($_productCollection as $_product): ?> 
     <?php if ($i++%$_columnCount==0): ?> 
     <ul class="products-grid"> 
     <?php endif ?> 
      <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>"> 
       <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(158); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> 
       <?php $shortened = truncateText($_product->getName(),250,'.'); ?> 
       <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($shortened, null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2> 
       <?php if($_product->getRatingSummary()): ?> 
       <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?> 
       <?php endif; ?> 
       <?php echo $this->getPriceHtml($_product, true) ?> 
       <div class="actions"> 
        <?php if($_product->isSaleable()): ?> 
         <button type="button" title="<?php echo $this->__('BUY NOW') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('BUY NOW') ?></span></span></button> 
        <?php else: ?> 
         <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p> 
        <?php endif; ?> 
        <ul class="add-to-links"> 
         <?php if ($this->helper('wishlist')->isAllow()) : ?> 
          <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li> 
         <?php endif; ?> 
        </ul> 
       </div> 
      </li> 
     <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?> 
     </ul> 
     <?php endif ?> 
     <?php endforeach ?> 
     <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script> 
    <?php endif; ?> 
    <?php $position = 'bottom'; ?> 
    <div class="toolbar-bottom"> 
     <?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar_bottom.phtml')->toHtml(); ?> 
    </div> 
</div> 
<?php endif; ?> 
+0

确保它在这些产品的可见性中实际上显示“不可见”。另外,你如何检索这个页面的产品?如果它不是默认的'base/default/template/catalog/product/list.phtml',请发布您正用于呈现产品列表的模板.phtml。或者至少只是你如何在这个页面上拉取产品集合。 – Jason

+0

@Jason新增了问题中要求的代码,我还仔细检查了magento中的产品,并将它们设置为不可见单独 –

回答

0

解决了这个问题。

索引是错误的,没有报告回来,错误日志上没有任何内容。通过逐一完成每个重建索引,它解决了这个问题。

+0

很高兴你明白了,通常如果reindex过程成功并且它们仍显示它是到期的到如何调用集合,但我现在看到您正在使用标准的'getLoadedProductCollection()'方法。有时使用直接的'Mage :: getModel('catalog/product') - > getCollection()'来调用产品而不添加可视性作为过滤器,这就是我最初要求查看模板代码的原因; D – Jason

相关问题