Solved

Products not showing in Magento categories

Posted on 2013-01-31
11
509 Views
Last Modified: 2016-03-02
I recently moved my Magento store to a test server. I now have an issue where products are not showing in the category pages!

The show if I browse directly to the URL but no in the category list.

I've tried everything:
1) cleared cache
2) reindexed data
3) made sure item are in stock
4) made sure that are enabled
5) visibility set to catalog and search.

I have absolutely no idea how to resolve this. If anyone has had this issue and found a way to fix it please let me know I'd be so grateful.
0
Comment
Question by:rafique12
  • 7
  • 3
11 Comments
 
LVL 6

Expert Comment

by:nickinthooz
ID: 38842325
It's usually because when you moved the site, it changed the path to the images in the config file.  check your files for paths to your old site and change them to your new site.
0
 

Author Comment

by:rafique12
ID: 38842332
I also emptied the core_url rewrite table and reindexed the data. I think that is when they stopped showing.

I will have a look in the config file and let you know what I find.
0
 
LVL 6

Expert Comment

by:nickinthooz
ID: 38842371
check your index.php and your htaccess file also

 $
mageFilename = ‘Magento/app/Mage.php

Open in new window


is in your index.php, make sure it's correct.

also try this...

 file is -> app/code/core/mage/catalog/model/product/image.php

around the line 274: there is an array

$path = array(
Mage::getSingleton(’catalog/product_media_config’)->getBaseMediaPath(),
‘cache’,
Mage::app()->getStore()->getId(),
$path[] = $this->getDestinationSubdir()
);

put below code instead of above

$path = array(
Mage::getSingleton(’catalog/product_media_config’)->getBaseMediaPath(),
‘’,
Mage::app()->getStore()->getId(),
$path[] = $this->getDestinationSubdir()
); 

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 6

Expert Comment

by:nickinthooz
ID: 38842384
here's a moving sites wiki for magneto.  Hope any of this helps.

http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server
0
 

Author Comment

by:rafique12
ID: 38842399
I'm really trying to avoid having to reinstall but I can't understand why they would just disappear!

As aforesaid this only affects the catagory pages
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 38843796
Are you positive that each product is assigned to a category?
0
 

Author Comment

by:rafique12
ID: 38843809
Absolutely,

I've even created newer ones and assigned those too.

No where near to a solution but the products are showing on there individual pages and they were visible up until yesterday
0
 

Author Comment

by:rafique12
ID: 38846257
I've found the problem, but still searching for a solution.

I'm using a 3Column layout but for some reason if I use a layout update and change from 3Columns to 2Column-right-sidebar the products are displayed.

Does anyone have an idea what could be causing this strange behaviour?
0
 

Author Comment

by:rafique12
ID: 38846477
Found the problem,

Its to do with the logic in the left navigation menu.

I'm not sure why as it seems fine on my localhost and I have another test server where it is working but for some reason it fails here.

I'll post the code in case anyone can see why but I assume that this is going to take hours to fix!

When the nav is included I get "there are no products matching the selection" but removing it the products are displayed... I'm trying to track down which line or part of the code is conflicting.

If you are able to assist I'd be grateful!
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<div id="nav-vertical" class="left-nav-vertical hidden-phone">
<ul id="dcjq-vertical-mega-menu" class="nav nav-tabs-left"> 
<li id="left" class="dropdown hidden hidden-phone"> 
<a class="dropdown-toggle fade in active"><?php echo $this->__('Shop by Department') ?><b class="caret"></b></a> 
<div class="dropdown-menu fade in active">								   
<ul id="mega" class="menu fade in active"> 
<!--Top Category-->
<?php foreach($_categories as $_category): ?> 
<li class="menu-item-1">
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>"> <?php echo $_category->getName() ?></a>
<ul class="media"> 
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<?php foreach($_subcategories as $_subcategory):$products = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($_subcategory)->addAttributeToSelect('small_image');$products->getSelect()->order(new Zend_Db_Expr('RAND()'))->limit(1);$products->load();?> 
<!-- SubCategory--> 
<ul>
<li class="media-body">
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php foreach($products as $product) { ?>
<?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category); ?>

<!-- Show image thumbnail -->
<div class="sub-nav-img">
  <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>" class="pull-left">
	<img src="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(50, 50); ?>" width="50" height="50" class="static-thumbs-nav" alt="<?php echo $_subcategory->getName() ?>" />
  </a>
</div>
<!-- End Show image-->

<!-- Show sub category Description -->
<div class="sub-nav-desc">
  <?php $children = explode( ",", $this->getCurrentCategory()->getChildren()); ?>
  <?php foreach( $children as $child ): ?>
  <?php $_child = Mage::getModel('catalog/category')->load($_subcategory->getId()); ?>
	  <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
		   <span class="product-name"><?php echo $_subcategory->getName() ?></span>
	  </a> 
		<em><?php $desct = nl2br($this->htmlEscape($_child->getDescription())) ?>
		<?php echo Mage::helper('core/string')->truncate($desct, '100'); ?></em>
	  </div>
  <?php break; endforeach; ?>
  <?php break; } ?>
</li> 
<!-- End show category Description -->
</ul> 
<!-- end of subcats -->
<div class="clearer"></div>
<?php endforeach; ?> 
<?php endif; ?>  
</ul> 
<!-- end of parent cats -->
<?php endforeach; ?> 
</ul> 
</li> 
</ul> 
</li> 
</ul>
</div> 
<?php endif; ?>
<!--- Closed Navigation Menu -->

<script>
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery('#left').removeClass('hidden')
  jQuery('#mega').dcVerticalMegaMenu({
	rowItems: '1',
	speed: 'fast',
	effect: 'slide',
	direction: 'right'
  });
});
</script>

<script>
jQuery('a.dropdown-toggle').on('touchstart', function(e) {		 
	e.stopPropagation();
   var dropdown = jQuery(this).open(".dropdown-menu");
	if( open.is(":visible") ) ('a.dropdown-toggle').removeClass("open");
	jQuery(this).trigger("click");
});
</script>
<!--- Closed Navigation Menu -->

Open in new window

0
 

Accepted Solution

by:
rafique12 earned 0 total points
ID: 38846561
Problem solved guys!

Thanks for the support..

<?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category); ?>

Open in new window


to

<?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/category'); <--HERE!!
$layer->setCurrentCategory($cur_category); ?>

Open in new window

0
 

Author Closing Comment

by:rafique12
ID: 38863260
This was a tough one as the code works on another server and my local host but since moving to a Ubuntu server it caused errors which is strange...
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question