Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Standard ship, mail and invoice ffrom order backend
 
seansan
Member
 
Total Posts:  62
Joined:  2010-01-27
 

Please

Can you add an option to Invoice, Ship, complete and download invoice in 1 step

The backend is great, but processing orders for medium shop owners is so incredibly cumbersome

Adding one simple option to backend to Ship, complete and download invoice (also with checklist to process a couple at once)

would be so incredibly great. Please do consider. (and I know there are extensions, but ... come on doesnt this suit for being standard?)

We have programmed an extension. And it is only a couple of lines of code. This can easily be made standard. and help so many people

The problem we have not solved yet is when you Ship, complete and download invoice + last stip triggers a download with PDF with multiple invoices

is that the page doesnt refresh to show the updated statuses of ‘shipped’ (because of download action)

Please, pretty please make this standard

Create a new option + observer and reuse all the code already in the shipping objects

<?php
/**
* Adminhtml sales orders controller extension
*
* @author Magento Core Team <core@magentocommerce.com>
*/

require_once “Mage/Adminhtml/controllers/Sales/OrderController.php”;

class SNH_ShipMailInvoice_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
{

public function shipmailinvoiceAction()
{
$orderIds = $this->getRequest()->getPost(’order_ids’, array());

$size = count($orderIds);
$shipped = 0;
$not_shipped = 0;
$invoiced = 0;

if (!empty($orderIds)) {
foreach ($orderIds as $orderId) {

// SNH 26.1.12 Call to shipment and send email (step 1 and 2)
$order = Mage::getModel(’sales/order’)->load($orderId);

if($order->canShip())
{
$itemQty = $order->getItemsCollection()->count();
// $convertor = Mage::getModel(’sales/convert_order’);
// $shipment = $convertor->toShipment($order);
$shipment = Mage::getModel(’sales/service_order’, $order)->prepareShipment($itemQty);
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
// API nees OrderIncrementId, so change
$lastOrderId = $order->getIncrementId();
$shipmentId = $shipment->create($lastOrderId, array(), ‘Shipment created through ShipMailInvoice’, true, false);
$shipped++;
} else {
$not_shipped++;
}

// SNH 26.1.12 Call to invoice (step 3)
$invoices = Mage::getResourceModel(’sales/order_invoice_collection’)->setOrderFilter($orderId)->load();
if ($invoices->getSize() > 0) {
$invoiced++;
if (!isset($pdf)){
$pdf = Mage::getModel(’sales/order_pdf_invoice’)->getPdf($invoices);
} else {
$pages = Mage::getModel(’sales/order_pdf_invoice’)->getPdf($invoices);
$pdf->pages = array_merge ($pdf->pages, $pages->pages);
}
}
}
} else {

$this->_getSession()->addError(Mage::helper(’sales’)->__(’No shipments and invoices created, none selected.’));

}

if (!empty($invoiced)) {
return $this->_prepareDownloadResponse(’invoice’.Mage::getSingleton(’core/date’)->date(’Y-m-d_H-i-s’).’.pdf’, $pdf->render(), ‘application/pdf’);
// Wish we could send some feedback on how many were shipped and invoiced
} else {
$this->_getSession()->addError(Mage::helper(’sales’)->__(’Sent %s shipments and notications of %s requested. Cannot create invoices.’, $shipped, $size));
}

$this->_redirect(’*/*/’);

}

}

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top