我想在magento产品订购报告中添加一列,该报告将显示每种产品的属性集名称。
我已经添加了SKU和coverage属性,但在属性集名称方面苦苦挣扎。
这就是我现在所拥有的:
protected function _prepareColumns()
{
$this->addColumn('sku', array(
'header' =>Mage::helper('reports')->__('sku'),
'index' =>'sku'
));
$this->addColumn('name', array(
'header' =>Mage::helper('reports')->__('Product Name'),
'index' =>'order_items_name'
));
$this->addColumn('ordered_qty', array(
'header' =>Mage::helper('reports')->__('Quantity Ordered'),
'width' =>'120px',
'align' =>'right',
'index' =>'ordered_qty',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('coverage', array(
'header' =>Mage::helper('reports')->__('coverage'),
'index' =>'coverage'
));
$this->addExportType('*/*/exportSoldCsv', Mage::helper('reports')->__('CSV'));
$this->addExportType('*/*/exportSoldExcel', Mage::helper('reports')->__('Excel XML'));
return parent::_prepareColumns();
答案 0 :(得分:1)
$ attrSet = Mage :: getResourceModel('eav / entity_attribute_set_collection') - > setEntityTypeFilter(Mage :: getModel('catalog / product') - > getResource() - > getTypeId()) - > toOptionHash ();
$this->addColumnAfter('set_name',
array(
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
'width' => '100px',
'index' => 'attribute_set_id',
'type' => 'options',
'options' => $attrSet,
), 'name');