diff --git a/app/code/local/Shiptheory/Shippinglabels/Model/Observer.php b/app/code/local/Shiptheory/Shippinglabels/Model/Observer.php index 78c9574..5c46d6c 100644 --- a/app/code/local/Shiptheory/Shippinglabels/Model/Observer.php +++ b/app/code/local/Shiptheory/Shippinglabels/Model/Observer.php @@ -1,24 +1,34 @@ getEvent()->getBlock(); - $block = $observer->getEvent()->getBlock(); - if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract && $block->getRequest()->getControllerName() == 'sales_order') { - $block->addItem('shippinglabels', array( - 'label' => 'Ship Orders', - 'url' => Mage::app()->getStore()->getUrl('adminhtml/shippinglabels_shippinglabels/ship') - )); - } + if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction_Abstract && $block->getRequest()->getControllerName() == 'sales_order') { + $block->addItem('shippinglabels', array( + 'label' => $this->_getActionLabel(), + 'url' => Mage::app()->getStore()->getUrl('adminhtml/shippinglabels_shippinglabels/ship') + )); } + } + /* + * This allows the action label to be easiy modified by other modules + * + * @todo move this to the config + * @return string + */ + protected function _getActionLabel() + { + return Mage::helper('shippinglabels')->__('Ship Orders'); + } } diff --git a/app/code/local/Shiptheory/Shippinglabels/controllers/Adminhtml/Shippinglabels/ShippinglabelsController.php b/app/code/local/Shiptheory/Shippinglabels/controllers/Adminhtml/Shippinglabels/ShippinglabelsController.php index b3cec42..eedb787 100644 --- a/app/code/local/Shiptheory/Shippinglabels/controllers/Adminhtml/Shippinglabels/ShippinglabelsController.php +++ b/app/code/local/Shiptheory/Shippinglabels/controllers/Adminhtml/Shippinglabels/ShippinglabelsController.php @@ -185,7 +185,7 @@ public function shipAction() { if ($order->canShip()) { $item_qty = $order->getItemsCollection()->getSize(); - $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($item_qty); + $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment(array($item_qty)); $shipment = new Mage_Sales_Model_Order_Shipment_Api(); $success = false;