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 7584811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:00:46+00:00 2026-05-30T19:00:46+00:00

this might be a silly question, but well. I have the following code that

  • 0

this might be a silly question, but well. I have the following code that retrieves all the products on my shop.

$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToFilter('status', 1);
$products->addAttributeToFilter('visibility', 4);
$products->addAttributeToFilter('type_id', 'simple');
$products->addAttributeToSelect('*');
$products->addStoreFilter($storeId);
$prodIds = $products->getAllIds();

Im aware of the:

$category = Mage::getModel('catalog/category')->load(9);
$products->addCategoryFilter($category);

to filter by a category ID, but how to get all products except one specific category ID ? (Magento 1.6.2)

  • 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-30T19:00:48+00:00Added an answer on May 30, 2026 at 7:00 pm

    I think this should work, presuming you know what category ID you want to filter out, but I can’t test it right now

    $catId = 9;
    
    /* I'm almost positive 'e' is the alias used for catalog_product_entity, check your
       query with echo (string) $products->getSelect(); if it doesn't work */
    $products->getSelect()->join(array('cats' => 'catalog_category_product'), 'cats.product_id = e.entity_id');
    $products->getSelect()->where('cats.category_id', array('neq' => $catId));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a bit of a silly question but; If I have two
This might be a silly question but I am still learning. I have read
This might sound like a silly question but how would I make this code
This might be a silly question, but I have never found a satisfying way
this might be a silly question but... Refactoring my code, I came up with
This might seems silly question but for me it is annoying. I have installed
This might be a silly question but it struck me, and here i ask.
This might seem like a silly question but valgrind doesn't by default give you
This might sound like a silly question but is there a manual or a
HI, this might sound like a silly question but.. i've created several types in

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.