php - Magento load product attributes by group? -


is there way foreach loop , loop through product attributes in attribute group in magento? please check screenshot. example, wanna loop through values in attributes of design group.

https://s3.amazonaws.com/uploads.hipchat.com/62230/429611/8eocq5jqckvukjr/screen%20shot%202014-05-29%20at%204.10.10%20pm.png

thanks

no there no built in function return array of product attributes organized group. 1 of missing functionalities. need create in helper or block class.

[edit]

it looks wrong. there method return attributes given group. in mage_catalog_model_product::getattributes(). first argument there group id. can this:

$groupid = mage::getmodel('eav/entity_attribute_group')->getcollection()     ->addfieldtofilter('attribute_set_id', array('eq' => $_product->getattributesetid()))     ->addfieldtofilter('attribute_group_name', array('eq' => 'general'))     ->getfirstitem()->getid();  foreach($_product->getattributes($groupid) $attribute) {   //this return text value multiselect   $attributeval = $attribute->getfrontend()->getvalue($_product);    //or need handle retriving select , multiselect labels   $attributeval = $_product->getdata($attribute->getcode()); } 

this make easier attributes group think still require own helper or, better, own block piece of code in phtml file not best practice.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -