Magento editable grid column values โ€‹โ€‹not published using massaction

I want to change the gridview product values โ€‹โ€‹using massaction. here i created a column like this.

$this->addColumn('fineness', array( 'header'=> Mage::helper('catalog')->__('% Increase'), 'width' => '80px', 'index' => 'fineness', 'type' => 'input', 'editable' => 'TRUE', )); 

It works fine, but how can I post this value to massaction? here i wrote an action like this

 $this->getMassactionBlock()->addItem('update', array( 'label'=> Mage::helper('catalog')->__('Bulk Update'), 'url' => $this->getUrl('*/*/massUpdate'), 'confirm' => Mage::helper('catalog')->__('Are you sure?'), )); 

since i can get the column values โ€‹โ€‹in massaction.in the action i wrote but not working

 public function massUpdateAction() { $productIds = $this->getRequest()->getParam('product'); $increase_fineness = $this->getRequest()->getParam('increase_fineness'); $fineness = $this->getRequest()->getParam('fineness'); print_r($fineness);die; } 
+1
source share
1 answer

I think you can go with a simpler solution:
Just create your own template for the massaction form and change the onclick event there (or add your own listener for the submit event).
The idea here is to use your own JS code (you can include it in your new .phtml) to add some input elements to the massaction form with your user information before submitting.

// This will be inside your grid (you probably have this method now, because you have to add the elements of the array here:

 protected function _prepareMassaction() { // you can use widget/grid/massaction.phtml as a reference $this->getMassactionBlock()->setTemplate('your_custom_template_here.phtml'); ... 

As a side note, this is (basically) how the massaging form works:
When you select the input flag, it will create an input element in the form of massaction, this input will have the identifiers of your selected lines, separated by a comma.
Magento then has an Observer (listening for "adminhtml_controller_action_predispatch_start")

 Mage_Adminhtml_Model_Observer::massactionPrepareKey 

which converts comma separated values โ€‹โ€‹to an array, and how you get an array of selected elements in a massaction action.

0
source

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


All Articles