add a new column for special price in grid in admin panel in magento

怎甘沉沦 提交于 2019-12-05 02:47:25

问题


I am designing an admin module in Magento 1.4.2. I am developing a grid layout displaying the product details (product name, SKU, price, special price, qty) I displayed all the columns. I cannot figure out how to display the special price in one column. I cannot retrieve the special price. Help me to solve this.

I used this code for getting the price.

$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());

This code I used for adding a column for price.

$this->addColumn('price', array(
            'header'    => Mage::helper('catalog')->__('Price'),
            'type'  => 'number',
            'width'     => '1',
            'currency_code' =(string)Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
            'index'     => 'price',
         'editable' =>true
            ));

But I cannot do the same for special price.


回答1:


        $collection->joinAttribute('special_price', 'catalog_product/special_price', 'entity_id', null, 'left', $store->getId());

and then add this:

 $this->addColumn('special_price',
        array(
            'header'=> Mage::helper('catalog')->__('Special Price'),
            'type'  => 'price',
            'currency_code' => $store->getBaseCurrency()->getCode(),
            'index' => 'special_price',
    ));


来源:https://stackoverflow.com/questions/4897310/add-a-new-column-for-special-price-in-grid-in-admin-panel-in-magento

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!