public function testGetUsedProductAttributes() { $testConfigurable = $this->_getAttributeByCode('test_configurable'); $attributeId = (int) $testConfigurable->getId(); $attributes = $this->_model->getUsedProductAttributes($this->_product); $this->assertArrayHasKey($attributeId, $attributes); $this->assertSame($testConfigurable, $attributes[$attributeId]); }
/** * Preparing layout * * @return Mage_Catalog_Block_Product_Configurable_AssociatedSelector_Backend_Grid_ColumnSet */ protected function _prepareLayout() { parent::_prepareLayout(); $product = $this->_getProduct(); $attributes = $this->_productType->getUsedProductAttributes($product); foreach ($attributes as $attribute) { /** @var $attribute Mage_Catalog_Model_Entity_Attribute */ /** @var $block Mage_Backend_Block_Widget_Grid_Column */ $block = $this->addChild($attribute->getAttributeCode(), 'Mage_Backend_Block_Widget_Grid_Column', array('header' => $attribute->getStoreLabel(), 'index' => $attribute->getAttributeCode(), 'type' => 'options', 'options' => $this->getOptions($attribute->getSource()), 'sortable' => false)); $block->setId($attribute->getAttributeCode())->setGrid($this); } return $this; }