I need an ordered products SKU and Name on subscribed event,
Subscribed Event :
public static function getSubscribedEvents()
{
return [
'Shopware_Modules_Order_SaveOrder_ProcessDetails' => 'getAccountController'
];
}
I need to extract an ordered product data. These products stock update to external sources. I am done with API testing with a static parameter. I need a dynamic parameter from shopware i.e. product SKU and ordered QTY of that product (Product may be in single or multiple in order).
/**
* @return string
*/
public function getAccountController(Enlight_Event_EventArgs $args)
{
$basketContent = $args-> getDetails ();
$order = $args-> getSubject ();
$orderNumber = $order->sOrderNumber;
// var_dump ($basketContent);
// exit;
$token = "mytoken";
// Organization which Manage warehouse and other things
$orgNo = "1";
// An SKU or Number must same as both site e-commerce and korona
$productNumber = "demo.product";
$qty = 10; // QTY you want to update Minus (-) indicate
// Create an API Object
$SWObject = new SWHelper();
$response = $SWObject->StockAdjustment($token,$orgNo,$productNumber,$qty);
//Enter Response in table for log purpose
//$response=mysql_real_escape_string(stripcslashes($response));
$sql = "INSERT INTO `s_plugin_SA_log` (`id`, `response_desc`) VALUES (NULL, '$response')";
Shopware()->Db()->query($sql);
return ;
}