I added new column in Sales Order Grid & successfully added title [say download] of column, now i want to add button [ say button name download1] for all rows of that column.
I did't created any column in database as i dont want to fetch anyy value from database.
app/code/community/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php : Function : _prepareColumns()
$this->addColumn('download',
array(
'header'=> Mage::helper('sales')->__('download'),
'width' => '70px',
'index' => 'download1',
'type' => 'text'
));
-
Try with render method it will workMagento 2– Magento 22017年11月24日 07:12:25 +00:00Commented Nov 24, 2017 at 7:12
-
@Magento2 it worked , thanks..... you can post it as an answer.....Baby in Magento– Baby in Magento2017年11月24日 07:26:06 +00:00Commented Nov 24, 2017 at 7:26
2 Answers 2
Try with render method
**''renderer' => 'module/adminhtml_sales_order_render_delete',',**
To extend Magento 2 answer , i added as below :
app/code/community/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php : Function : _prepareColumns()
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
$this->addColumn('action',
array(
'header' => Mage::helper('sales')->__('Action'),
'width' => '100px',
'type' => 'action',
'getter' => 'getId',
'renderer' => 'deleteorder/adminhtml_sales_order_render_delete',
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
}
app/code/community/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Render - Delete.php :
class Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_Render_Delete extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
$getData = $row->getData();
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
$orderID = $getData['entity_id'];
$view = $this->getUrl('*/sales_order/view',array('order_id' => $orderID));
$delete = $this->getUrl('*/deleteorder/delete',array('order_id' => $orderID));
$link = '<a href="'.$download.'">Download</a> <a>';
return $link;
}
}
-
How do I do this in magento 2Jaisa– Jaisa2019年04月15日 05:06:31 +00:00Commented Apr 15, 2019 at 5:06
-
magento.stackexchange.com/questions/270045/…Jaisa– Jaisa2019年04月15日 05:13:31 +00:00Commented Apr 15, 2019 at 5:13