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

5.9k views Asked by At

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

There are 1 answers

0
user654512 On
        $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',
    ));