20 private $m_oSyncService;
36 public function __construct($oSyncService = null, $sApiKey =
"")
38 $this->m_sApiKey = $sApiKey;
53 public function CommonCommand($sApi, $sType, $aParameters = [], $sMode =
'')
57 'apikey' => $this->m_sApiKey,
65 $aRequest[
'command'][
'mode'] = $sMode;
67 if (!empty($aParameters))
69 $aRequest[
'command'][
'parameters'] = $aParameters;
71 $sXML = Helper\Array2XML::createXML(
'request', $aRequest, [
'version' =>
"1"])->saveXML();
73 $oReturnValue = $this->m_oSyncService->InvokeApi($sXML);
74 $aXML = Helper\XML2Array::createArray($oReturnValue);
87 return $this->CommonCommand(
'sdd',
'sdereloadconfig');
100 foreach ($aProducts as $aProduct)
102 $aParameters[
'product'][] = [
103 'mode' =>
'relative',
104 'prodref' => $aProduct[
'sProductReference'],
105 'stocktoupdate' => $aProduct[
'nQuantityOrdered'],
107 if (!empty($aProduct[
'sPermutation']))
109 $aParameters[
'product'][] = [
110 'mode' =>
'relative',
111 'prodref' => $aProduct[
'sPermutation'],
112 'stocktoupdate' => $aProduct[
'nQuantityOrdered'],
116 return $this->CommonCommand(
'stock',
'update', $aParameters);
129 foreach ($aOrders as $sOrderNumber)
131 $aParameters[
'order'][] = [
'reference' => $sOrderNumber];
133 return $this->CommonCommand(
'order',
'display', $aParameters);
147 if (is_array($vItemOrGroup))
149 $aParameters = [
'item' => $vItemOrGroup];
150 $sReference = arr_get($vItemOrGroup,
'reference', $sReference);
154 $aParameters[
'item'][
'group'] = $vItemOrGroup;
156 if (
"unlock" == $sLockOrUnlock)
158 $aParameters[
'item'][
'editaction'] =
'claimed';
160 $aParameters[
'item'][
'reference'] = $sReference;
161 return $this->CommonCommand(
'sync', $sLockOrUnlock, $aParameters,
'single');
175 'group' =>
'content',
176 'content' =>
'product',
178 return $this->CommonLockAndUnlock($sProductReference, $aItem, $sLockOrUnlock);
189 private function CommonOrderLockAndUnlock($sOrderNumber, $sLockOrUnlock =
"lock")
191 return $this->CommonLockAndUnlock($sOrderNumber,
'order', $sLockOrUnlock);
201 public function Lock($sOrderNumber)
203 return $this->CommonOrderLockAndUnlock($sOrderNumber,
"lock");
215 return $this->CommonOrderLockAndUnlock($sOrderNumber,
"unlock");
static get($sChannel="default", $sLogRoot="")
ProductLockAndUnlock($sProductReference, $sLockOrUnlock="lock")
CommonCommand($sApi, $sType, $aParameters=[], $sMode= '')
BulkStockUpdate($aProducts=[])
CommonLockAndUnlock($sReference, $vItemOrGroup, $sLockOrUnlock="lock")
__construct($oSyncService=null, $sApiKey="")
BulkRefreshOrders($aOrders=[])