Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6922379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:23:55+00:00 2026-05-27T10:23:55+00:00

Regarding using multiple stores, with different root categories: I have 2 stores set up,

  • 0

Regarding using multiple stores, with different root categories:

I have 2 stores set up, with different roots. One has 14 products, the other 6.

If I use the following on my homepage (simply to show how many products are in the root category for that store – in this case with an ID of 8) I get 20 products – so all products in the store, from all roots:

$_testproductCollection = Mage::getModel('catalog/category')->load(8)  
->getProductCollection()  
->addAttributeToSelect('*')->load();
echo "NO. OF PRODUCTS IS ".$_testproductCollection->count();

However, if I change the ID to a sub-category, I get the correct amount of products. There are only 6 products in this root:

roots

But the count shows 20 (as there’s 20 in the whole store – or both roots).

Anyone know what’s up? Is it a bug?

I also noticed that if you go to Manage Products and use the store view filter, it doesn’t do anything, still showing 20 products in the store view whose root has only 6 products:

filter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:23:55+00:00Added an answer on May 27, 2026 at 10:23 am

    OK, I think this works, haven’t tested too much but seems to have done the trick. You need to first get your stores root category id, then join some fields so you have access to the products “category_id”, then filter using that:

    $_rootcatID = Mage::app()->getStore()->getRootCategoryId();
    
    $_testproductCollection = Mage::getResourceModel('catalog/product_collection')
    ->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
    ->addAttributeToFilter('category_id', array('in' => $_rootcatID))
    ->addAttributeToSelect('*');
    $_testproductCollection->load();
    
    foreach($_testproductCollection as $_testproduct){ 
        echo $this->htmlEscape($_testproduct->getName())."<br/>"; 
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any practices regarding using codenames of products in Visual Studio projects and
I have a question regarding using Semaphores HANDLE WINAPI CreateSemaphore(...); Is there anyway I
I have general question regarding the use of pointers vs. references in this particular
How to allocate memory in assembly when using multiple arrays. For instance, I have
I am reading data from multiple serial ports. At present I am using a
What are your opinions and experiences regarding using TDD when developing an user interface?
Yesterday I posted this question regarding using lambdas inside of a Join() method to
Setting up an integration server, I’m in doubt about the best approach regarding using
Specifically this is regarding when using a client session cookie to identify a session
I've recently begun working on a project regarding GUI building using some form of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.