Magento: Kunden-ID bei Bestellungen ändern / Bestellungen anderen Kunden zuweisen

19. November 2013 at 12:27

Möchtet ihr Bestellungen einen anderen Kunden zuweisen, ggf. weil die Bestellungen dem falschen Kunden zugewiesen sind (z.b. nach einer Datenmigration) so könnt ihr dies über die folgenden SQL-Statements erledigen:

UPDATE sales_flat_order SET customer_id = 949791 WHERE customer_id = 616151;
 UPDATE sales_flat_order_address SET customer_id = 949791 WHERE customer_id = 616151;
 UPDATE sales_flat_shipment SET customer_id = 949791 WHERE customer_id = 616151;
 UPDATE sales_flat_order_grid SET customer_id = 949791 WHERE customer_id = 616151;

Magento: Create shipment from order

18. November 2010 at 15:35

You want to create a shipment from an order?
here is the solution in php (example with invoice-data) :

$order = Mage::getModel('sales/order')->loadByIncrementId($invoice->getOrder()->getIncrementId());
if($order->canShip())
{
 $_itemQty                 = $order->getItemsCollection()->count();
 $_shipment             = Mage::getModel('sales/service_order', $order);
 $_shipment             = new Mage_Sales_Model_Order_Shipment_Api();
 $_shipmentId         = $_shipment->create($order->getIncrementId());
}