0

I want 3 decimal places for "cost" like the "Price"

app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php

        $store = $this->_getStore();
    $this->addColumn('cost',
        array(
            'header'=> Mage::helper('catalog')->__('Cost'),
            'width' => '80px',
            'currency_code' => $store->getBaseCurrency()->getCode(),
            'index' => 'cost',
    ));


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

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

Magento cost price

if anyone can help me in this...

3
  • What is cost? Is it product attribute? Mar 2 '16 at 12:14
  • Yes its a product attribute
    – Lalji
    Mar 2 '16 at 12:15
  • I want 3 decimal places for "cost" like the "Price", I have used currency_code also but no change.
    – Lalji
    Mar 2 '16 at 12:16
0

Please use below code for add column

$this->addColumn('cost',
        array(
            'header'=> Mage::helper('catalog')->__('Cost'),
            'width' => '80px',
            'currency_code' => $store->getBaseCurrency()->getCode(),
            'type'      => 'price',
            'index' => 'cost',
    ));
8
  • yes i tried it by adding 'type' => 'price', but grid goes blank after doing this
    – Lalji
    Mar 2 '16 at 12:24
  • Is it working or having any issue? Mar 2 '16 at 12:24
  • No it goes blank after that
    – Lalji
    Mar 2 '16 at 12:25
  • It is working for me check code if you miss anything Mar 2 '16 at 12:29
  • Sorry!! its not working i tried 5 times but no luck
    – Lalji
    Mar 2 '16 at 12:38
0

It is working fine with this code now

$store = $this->_getStore();
    $this->addColumn('cost',
    array(
        'header'=> Mage::helper('catalog')->__('Cost'),
        'width' => '80px',
        'type'  => 'price',
        'currency_code' => $store->getBaseCurrency()->getCode(),
        'index' => 'cost',
        ));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.