• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 541
  • Last Modified:

Products not showing in Magento categories

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
rafique12
Asked:
rafique12
  • 7
  • 3
1 Solution
 
nickinthoozCommented:
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
 
rafique12Author Commented:
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
 
nickinthoozCommented:
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
nickinthoozCommented:
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
 
rafique12Author Commented:
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
 
Eddie ShipmanAll-around developerCommented:
Are you positive that each product is assigned to a category?
0
 
rafique12Author Commented:
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
 
rafique12Author Commented:
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
 
rafique12Author Commented:
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
 
rafique12Author Commented:
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
 
rafique12Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now