0

I have an attribute called main_category belonging to a product. When I load the product the attribute does not load with it.

If I do a

      var_dump($product)

it is not included in the array.

I don't want to load the full product by doing

    $product->load();

How can I just get this attribute without loading every attribute for each product

0

So I managed it by making a simple call just to the products attribute without loading the full product. Seems to be a good solution as it uses minimum resources.

    $mainCat = Mage::getResourceModel('catalog/product')->getAttributeRawValue($product->getId(), 'main_category');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.