我在magento后端发售了一个新的群发动作>使用扩展名命名为发票的订单。 我创建了grid.phtml在我的模块Block / Sale / Order中显示我在销售订单后端的群发行动。
grid.phmtl: -
<?php
class Iclp_Batchupdate_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareMassaction()
{
parent::_prepareMassaction();
// Append new mass action option
$this->getMassactionBlock()->addItem('batchupdate',array('label' => $this->__('invoice'),
'url' => $this->getUrl('batchupdate/index/batchinvoice') //this should be the url where there will be mass operation
)
);
}
}
使用此我的新群众行动将显示在后端。但现在,我正在尝试根据字母排序所有群众行动,但我不能成功。
附有截屏 -
请告诉我如何分类群众行动。答案 0 :(得分:1)
你必须自己重新安排群众行动。
打开app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
在这个方法中,您有一个名为_prepareMassaction()
的方法,我们已经编写了所有批量操作。如果您要将取消群发操作显示为最后一个选项,则在添加所有群发操作后添加它。在下面的代码中,我也做了同样的事情。
protected function _prepareMassaction()
{
$this->setMassactionIdField('entity_id');
$this->getMassactionBlock()->setFormFieldName('order_ids');
$this->getMassactionBlock()->setUseSelectAll(false);
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
$this->getMassactionBlock()->addItem('hold_order', array(
'label'=> Mage::helper('sales')->__('Hold'),
'url' => $this->getUrl('*/sales_order/massHold'),
));
}
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
$this->getMassactionBlock()->addItem('unhold_order', array(
'label'=> Mage::helper('sales')->__('Unhold'),
'url' => $this->getUrl('*/sales_order/massUnhold'),
));
}
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
'label'=> Mage::helper('sales')->__('Print Invoices'),
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
));
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
'label'=> Mage::helper('sales')->__('Print Packingslips'),
'url' => $this->getUrl('*/sales_order/pdfshipments'),
));
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
));
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
'label'=> Mage::helper('sales')->__('Print All'),
'url' => $this->getUrl('*/sales_order/pdfdocs'),
));
$this->getMassactionBlock()->addItem('print_shipping_label', array(
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
));
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
$this->getMassactionBlock()->addItem('cancel_order', array(
'label'=> Mage::helper('sales')->__('Cancel'),
'url' => $this->getUrl('*/sales_order/massCancel'),
));
}
return $this;
}
注意:请记住不要直接更改核心文件。覆盖模块中的文件。
通过此
替换您的文件 <?php
class Iclp_Batchupdate_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareMassaction()
{
$this->setMassactionIdField('entity_id');
$this->getMassactionBlock()->setFormFieldName('order_ids');
$this->getMassactionBlock()->setUseSelectAll(false);
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
$this->getMassactionBlock()->addItem('cancel_order', array(
'label'=> $this->__('Cancel'),
'url' => $this->getUrl('*/sales_order/massCancel'),
));
}
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
$this->getMassactionBlock()->addItem('hold_order', array(
'label'=> $this->__('Hold'),
'url' => $this->getUrl('*/sales_order/massHold'),
));
}
/**
* This is your mass action. It's starts from here.
* Also check this url is working or not
*/
$this->getMassactionBlock()->addItem('batchupdate',array(
'label' => $this->__('invoice'),
'url' => $this->getUrl('batchupdate/index/batchinvoice') //this should be the url where there will be mass operation
));
/**
* It's end here
*/
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
'label'=> $this->__('Print All'),
'url' => $this->getUrl('*/sales_order/pdfdocs'),
));
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
'label'=> $this->__('Print Credit Memos'),
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
));
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
'label'=> $this->__('Print Invoices'),
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
));
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
'label'=> $this->__('Print Packingslips'),
'url' => $this->getUrl('*/sales_order/pdfshipments'),
));
$this->getMassactionBlock()->addItem('print_shipping_label', array(
'label'=> $this->__('Print Shipping Labels'),
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
));
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
$this->getMassactionBlock()->addItem('unhold_order', array(
'label'=> $this->__('Unhold'),
'url' => $this->getUrl('*/sales_order/massUnhold'),
));
}
return $this;
}
}