Skip to content

Order Management FAQ

How to add a custom group into the “Group” column

In order to add another order group into the ‘Group’ column of the Order grid, do the following:

  • Edit the file app/code/community/MageWorx/OrdersGrid/controllers/Adminhtml/ Mageworx/OrdersgridController.php and add the function:
<?php
public function massFlaggingAction() {
    $orderIds = $this->getRequest()->getPost('order_ids', array());
    $count = Mage::helper('mageworx_ordersgrid')->addToOrderGroup($orderIds, 3);
    if ($count>0) Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('mageworx_ordersgrid')->__('Selected orders were flagged.'));
    $this->_redirect('*/*/');
}
  • Edit the file app/code/community/MageWorx/OrdersGrid/Model/Observer.php and add to existing addMassActionToSalesOrdersGrid() function the following block:
<?php
$block->addItem('flagging_order', array(
     'label'=> Mage::helper('mageworx_ordersgrid')->__('Flagging'),
     'url'  => $this->getUrl('adminhtml/mageworx_ordersgrid/massFlagging'),
));
  • Execute the database query
INSERT INTO `mageworx_ordersgrid_order_group` (`order_group_id`, `title`) VALUES ('3', 'Flagged');

Here 3 is a group ID (“Deleted” ID is 1, “Archived” ID is 2 and so on). Flagged is a custom name. You are free to specify any other one.

How to get a bunch of dummy order numbers re-start from 10XXXXXXXX

The website can go down and this can lead to the situation when several orders would be lost. After that Paypal may block the new orders saying that these orders are already paid. It appears due to the fact that Magento is creating order numbers that were already created and then lost. This situations happen from time to time so we've made the guide to solve this issue.

  • Execute the database query
ALTER TABLE `sales_flat_order` AUTO_INCREMENT = 10XXXXXXXY;

where this number is bigger by 1 (10XXXXXXXY=10XXXXXXXX+1)

  • Execute the database query

SELECT * FROM `eav_entity_type` WHERE `entity_type_code` LIKE 'order';
Now you should remember entity_type_id (in our case it is 4). Go to eav_entity_store table and manually edit the field records (increment_last_id), where entity_type_id = 4

Note each store has its own increment_last_id.