Order data extraction on subscribed event

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 ;        
    }

 

[@Michael Telgmann](http://forum.shopware.com/profile/17553/Michael Telgmann „Michael Telgmann“)‍ I want to extract product details of an order in which I have a place. I have checked above way. No success at all.

@kanuma‍ [@Moritz Naczenski](http://forum.shopware.com/profile/14574/Moritz Naczenski “Moritz Naczenski”)‍ Please can you help me.

If you push your thread one more time, I will close it.

Kind regards

Hey @vasims_zignuts‍

did you even had a look at your variable „$basketContent“ ? It should contain all cart positions. Filter the array elements for „modus == 0“ This is for products. There you should also find the information you want to have. 

Best regards from Schöppingen

cool Michael Telgmann

Thank its working.