Add a new column for the special price in the grid in the admin panel in magento

I am developing an admin module in Magento 1.4.2. I am developing a grid that displays product details (product name, SKU, price, special price, qty). I displayed all the columns. I can’t figure out how to display the special price in one column. I can not get a special price. Help me solve this problem.

I used this code to get the price.

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

This code that I used to add a column for the 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 can not do the same at a special price.

+3
source share
1 answer
        $collection->joinAttribute('special_price', 'catalog_product/special_price', 'entity_id', null, 'left', $store->getId());

and then add the following:

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

Source: https://habr.com/ru/post/1789968/


All Articles