manu
manu

Reputation: 82

Load all Magento product attributes for array of ids

I have an array with about 15 product ids, and i want to load all these 15 products with all attributes. Using

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*' )->addAttributeToFilter('entity_id', array('in' => $arrProductIdsToLoad ))->load();

returns only products with attributes stored in product_flat table.

Is there a way to load all attributes for a set of product ids at once? I don't want to add all the needed values in the flat table. I'm working with Magento 1.8 CE.

thx for any help

Upvotes: 0

Views: 294

Answers (1)

Serge
Serge

Reputation: 417

Try smth like this:

$p_id = 18;
$product = Mage::getModel('catalog/product')->load($p_id);
$product_attributes = $product->getAttributes();

foreach ($product_attributes as $attribute) {       
    $attributeCode = $attribute->getAttributeCode();
    $label = $attribute->getStoreLabel($product);   
    $value = $attribute->getFrontend()->getValue($product);
    echo $attributeCode . '-' . $label . '-' . $value; echo "<br />";       
} 

Upvotes: 0

Related Questions