I am going to create a plugin. This plugin will call external API once the stock level updated (i.e. decrease qty). My plugin file contains the following code. I can’t find var_dump or expected output not display. :
scheduleClearCache(ActivateContext::CACHE_LIST_DEFAULT);
}
public function deactivate(DeactivateContext $context)
{
$context->scheduleClearCache(DeactivateContext::CACHE_LIST_DEFAULT);
}
public function uninstall()
{
return true;
}
public function install()
{
# this event will be used after saving the order in the database
return [
'Shopware_Modules_Order_SaveOrder_ProcessDetails' => 'OnOrder_SaveOrderProcessDetails',
];
}
public function onOrder_SaveOrderProcessDetails(Enlight_Event_EventArgs $args)
{
// get SKU of Order items
// Write here a qty you want to update on external
//CURL code will place here
}
}
?>
[@Michael Telgmann](http://forum.shopware.com/profile/17553/Michael Telgmann „Michael Telgmann“) I have created a plugin as per above document. Plugin created and active. Show in the backend as expected. I have tried lots of way but can’t get ride out this.
I can’t get an event which allow me call extenal API.
scheduleClearCache(ActivateContext::CACHE_LIST_DEFAULT);
}
public function deactivate(DeactivateContext $context)
{
$context->scheduleClearCache(DeactivateContext::CACHE_LIST_DEFAULT);
}
public function uninstall()
{
return true;
}
public function install()
{
# this event will be used after saving the order in the database
return [
'Enlight_Controller_Action_PostDispatchSecure_Frontend_Checkout_Finish' => 'OnOrder_SaveOrderProcessDetails'
];
}
public function onOrder_SaveOrderProcessDetails(Enlight_Event_EventArgs $args)
{
$basketContent = $args->getDetails();
$order = $args->getSubject();
$orderNumber = $order->sOrderNumber;
var_dump ($basketContent);
}
}
?>
Config File :
Korona Pos
API Token
API Token
API Tken
An API token provided by Support.
[@Michael Telgmann](http://forum.shopware.com/profile/17553/Michael Telgmann “Michael Telgmann”) I have Hook issue which called some other place. Can you guide me I want to implement external API. I have code written in code PHP.
Correct place :
public static function getSubscribedEvents()
{
return [
'Shopware_Modules_Order_SaveOrder_ProcessDetails' => 'getAccountController'
];
}
require_once("KoronaApi.class.php");
require_once("KoronaHelper.class.php");
// Prepare Data Set
$token = "Token";
// Organization which Manage warehouse and other things
$orgNo = "1";
// A SKU or Number must same as both site ecommerce and korona
$productNumber = "BLVK.Choco";
$qty = 10; // QTY you want to update Minus (-) indicate
// An Object manage stock
$KoronaObject = new KoronaHelper();
echo $KoronaObject->StockAdjustment($token,$orgNo,$productNumber,$qty);