Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Edit Group Price? #347

Open
rmvdev opened this issue Aug 14, 2017 · 0 comments
Open

Edit Group Price? #347

rmvdev opened this issue Aug 14, 2017 · 0 comments

Comments

@rmvdev
Copy link

rmvdev commented Aug 14, 2017

I wanted to add the group price of a specific customer group to my grid, which I did using the code below;

My grid override -

protected function _prepareColumns()
    {
        $store = $this->_getStore();
        $this->addColumnAfter('value',
            array(
                'header'=> Mage::helper('catalog')->__('Group Price'),
                'column_css_class'=>'a-right',
                'type'  => 'price',
                'currency_code' => $store->getBaseCurrency()->getCode(),
                'index' => 'entity_id',
               'renderer'  => 'MyCompany_CatalogGrid_Block_Adminhtml_Catalog_Product_Groupprice', 
            ),
            'price'
         );

        return parent::_prepareColumns();
    }
}

My renderer -

    public function render(Varien_Object $row)
    {
        $product_id =  $row->getData($this->getColumn()->getIndex());
        $loadproduct = Mage::getModel('catalog/product')->load($product_id);
        $final_group_price =  '';
        $group_prices = $loadproduct->getData('group_price');
        $formatted_group_price = '';
        foreach ($group_prices as $group_price)
        {
            if($group_price['cust_group']=="2")
            {
                    $final_group_price =   $group_price['price'];
                    $formatted_group_price = Mage::helper('core')->currency($final_group_price, true, false);
                    break;
            }
        }
        return $formatted_group_price;

    }

}

It displays the group price perfectly but I can't see to make it editable from the grid - I added the following to the _getEditableFields function and it makes the cell editable but doesn't save the changes;

        'value' => array(
            'type'            => 'text',
            'required'        => false,
            'render_reload'   => false,
            'form_class'      => 'validate-number',
            'edit_block_type' => 'customgrid/widget_grid_form_static_product_inventory',
            'inventory_field' => 'entity_id',
        ),

This makes the cell editable but once the data is entered and submitted the group price isn't updated

Any help would be appreciated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant