cancel
Showing results for 
Search instead for 
Did you mean: 

Get product attribute on product list in one query

Get product attribute on product list in one query

I figure this part of a code is getting all products for product page

$collection = Mage::getResourceModel('catalog/product_collection')
        ->setStoreId($this->getStoreId())
        ->addCategoryFilter($this);

I need to get available colors only for each product on product list page. So for example if my configurable product consists of 3 simple products with colors: red, green, blue, but simple product with color green is disabled, product with color red is out of stock, how do I show only color "blue".

 

I would like to do it in single query so it doesn't waste my resources. Is it possible to do some joins on default collection to get that data?

Here is the example of loading few products and under each product's image I would like to show available color.

 

m8uXO