Magento – load multiple attributers using load() Magento

attributesdatabasemultipleproduct

I am using this code but it's not working with multiple parameter. I want only use load() function in magento. You can see below code any please help me.

$attributes = array('entity_id'=> 1684, 'advertise_id'=> 283);
$model= Mage::getModel('catalog/product')->load($attributes);

Thanks for support in advance.

Best Answer

Based upon your comments, I gather you are trying to iterate over a collection of products IDs and trying to get the 'advertise_id' column. In that case, I'd strongly suggest against load method. Using of load inside a loop will be like killing your mySql with your own hands.

You should try with this code :

$collection = Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('advertise_id')
    ->addIdFilter($idArray);

foreach($collection as $key => $value) {
    var_dump($value->getData('advertise_id'));
}

Where $idArray is simply the array containing all the IDs of products you are trying to access.