【问题标题】:Add attribute set column to magento products ordered report将属性集列添加到 magento 产品订购报告
【发布时间】:2015-09-22 08:53:24
【问题描述】:

我想在 magento 产品订购报告中添加一个列,该列将显示每个产品的属性集名称。

我已添加 SKU 和覆盖率属性,但在属性集名称方面遇到了难题。

这是我目前拥有的:

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();

【问题讨论】:

    标签: magento attributes


    【解决方案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'); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-27
      • 2011-05-02
      • 2012-01-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多