attributes - Magento: Difference between loading product through collection than product model -
so trying load product through collection criteria, didn't have sku or id when did following
$prodmodel->getcollection() ->addattributetofilter('visibility', $visibility) ->addattributetoselect('*') ->addcategoryfilter($cat) ->addattributetofilter('attribute_1', $sattribute_1) ->addattributetofilter('attribute_2', $attribute_2) ->addattributetofilter('type_id', 'configurable') ->load() ->getfirstitem()
when doing got product wanted reason didn't have of attributes, though specified "*" attributes. 1 not getting media gallery attribute. ended doing saying getfirstitem()->getid() loaded product , worked find.
i don't understand whey loading product catalog product model have more attributes.
i understand asked how of attributes notice mention media gallery attribute specifically. there happens shortcut getting product image's final url.
(string)mage::helper('catalog/image')->init($product, 'media_gallery');
casting string calls __tostring
performs cleverness. can apply resizing, rotation, watermarks, etc. after initialising.
Comments
Post a Comment