0
votes

I have a Magento installation which worked fine, till now.

  • It has 3 storeviews;
  • 2 storeviews are already online and work fine
  • The third one is in development

In the third store I'm adding products, but after a number it stops showing in the frontend.

  • I checked where it went wrong, and it's in the middle of a category
  • I checked visibility and all additional options on categories and products

Next I did:

  • Duplicating an product which is already visible in the frontend, the duplicate didn't show up

I checked if the theme was broken so I queried the complete root category in list.phtml: - In the 2 correct stores the count of products visible is the same as the count of products displayed in the backend under category management - In the third store, category management says there are 137 products while the count in the frontend ends at 93.

I used this to query the complete root category and counted it:

$category = Mage::getModel('catalog/category')->load($cat_id);
  $productCollection = $category->getProductCollection();

It seems that it just stops the query at 93 entries. I disabled and enabled products but it doesn't make any difference to the 30+ products which are not shown for an unknown reason.. I flushed caches and indexes so that isn't the case. Settings for products are exactly the same since I tested it by duplicating.

What else can I try?

----------- EDIT: -------------

To be exact; the complete code I used to get to loop through the products in the root category is the following:

$cat_ID = 41
$category = Mage::getModel('catalog/category')->load($cat_ID);
  $productCollection = $category->getProductCollection();
  $productCollection
          ->addStoreFilter()
          ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds())
          ->addMinimalPrice()
          ->addFinalPrice()
          ->addTaxPercents()
          ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
          ->addUrlRewrite();
1

1 Answers

0
votes

Try replacing the code you pasted with this:

$products = Mage::getModel('catalog/product')
     ->getCollection()
     ->addAttributeToSelect('*')
     ->addCategoryFilter($category)
     ->setOrder('price', 'ASC')
     ->addAttributeToFilter('visibility', 4)
     ->addAttributeToFilter('status', 1)
     ->load();