|
2 | 2 |
|
3 | 3 | class MplusQAPIclient |
4 | 4 | { |
5 | | - const CLIENT_VERSION = '1.25.1'; |
| 5 | + const CLIENT_VERSION = '1.26.0'; |
6 | 6 | const WSDL_TTL = 300; // 5 min WSDL TTL |
7 | 7 |
|
8 | 8 | var $MIN_API_VERSION_MAJOR = 0; |
@@ -3301,6 +3301,46 @@ public function getSalePromotions($branchNumbers = [], $attempts=0) |
3301 | 3301 | throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e); |
3302 | 3302 | } |
3303 | 3303 | } // END getSalePromotions() |
| 3304 | + |
| 3305 | + //---------------------------------------------------------------------------- |
| 3306 | + public function getProductOverview($selectFields, $pageNumber = null, $maxPerPage = null, $orderField = null, $sortOrder = null, $filters = null, $search=null, $attempts=0) |
| 3307 | + { |
| 3308 | + try { |
| 3309 | + $request = $this->parser->convertGetProductOverviewRequest($selectFields, $pageNumber, $maxPerPage, $orderField, $sortOrder, $filters, $search); |
| 3310 | + $result = $this->client->getProductOverview($request); |
| 3311 | + return $this->parser->parseGetProductOverviewResult($result); |
| 3312 | + } catch (SoapFault $e) { |
| 3313 | + $msg = $e->getMessage(); |
| 3314 | + if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) { |
| 3315 | + sleep(1); |
| 3316 | + return $this->getProductOverview($selectFields, $pageNumber, $maxPerPage, $orderField, $sortOrder, $filters, $search, $attempts+1); |
| 3317 | + } else { |
| 3318 | + throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e); |
| 3319 | + } |
| 3320 | + } catch (Exception $e) { |
| 3321 | + throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e); |
| 3322 | + } |
| 3323 | + } // END getProductOverview() |
| 3324 | + |
| 3325 | + //---------------------------------------------------------------------------- |
| 3326 | + public function getProductOverviewFields($attempts=0) |
| 3327 | + { |
| 3328 | + try { |
| 3329 | + $request = $this->parser->convertGetProductOverviewFieldsRequest(); |
| 3330 | + $result = $this->client->getProductOverviewFields($request); |
| 3331 | + return $this->parser->parseGetProductOverviewFieldsResult($result); |
| 3332 | + } catch (SoapFault $e) { |
| 3333 | + $msg = $e->getMessage(); |
| 3334 | + if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) { |
| 3335 | + sleep(1); |
| 3336 | + return $this->getProductOverviewFields($attempts+1); |
| 3337 | + } else { |
| 3338 | + throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e); |
| 3339 | + } |
| 3340 | + } catch (Exception $e) { |
| 3341 | + throw new MplusQAPIException('Exception occurred: '.$e->getMessage(), 0, $e); |
| 3342 | + } |
| 3343 | + } // END getProductOverview() |
3304 | 3344 |
|
3305 | 3345 | } |
3306 | 3346 |
|
@@ -5749,6 +5789,32 @@ public function parseGetSalePromotionsResult($soapGetSalePromotionsResult) { |
5749 | 5789 | return $salePromotions; |
5750 | 5790 | } // END parseGetSalePromotionsResult() |
5751 | 5791 |
|
| 5792 | + //---------------------------------------------------------------------------- |
| 5793 | + public function parseGetProductOverviewResult($soapGetProductOverviewResult) { |
| 5794 | + $productOverview = array(); |
| 5795 | + if(isset($soapGetProductOverviewResult->productOverview)) { |
| 5796 | + $productOverview = objectToArray($soapGetProductOverviewResult->productOverview); |
| 5797 | + } |
| 5798 | + if (isset($soapGetProductOverviewResult->productOverviewArticleList->productOverviewArticle)) { |
| 5799 | + $productOverview['productOverviewArticleList'] = objectToArray($soapGetProductOverviewResult->productOverviewArticleList->productOverviewArticle); |
| 5800 | + } |
| 5801 | + return $productOverview; |
| 5802 | + } // END parseGetProductOverviewResult() |
| 5803 | + |
| 5804 | + //---------------------------------------------------------------------------- |
| 5805 | + public function parseGetProductOverviewFieldsResult($soapGetProductOverviewFieldsResult) { |
| 5806 | + $productOverviewFields = array(); |
| 5807 | + die(print_r($soapGetProductOverviewFieldsResult, true)); |
| 5808 | + |
| 5809 | + if(isset($soapGetProductOverviewResult->productOverview)) { |
| 5810 | + $productOverview = objectToArray($soapGetProductOverviewResult->productOverview); |
| 5811 | + } |
| 5812 | + if (isset($soapGetProductOverviewResult->productOverviewArticleList->productOverviewArticle)) { |
| 5813 | + $productOverview['productOverviewArticleList'] = objectToArray($soapGetProductOverviewResult->productOverviewArticleList->productOverviewArticle); |
| 5814 | + } |
| 5815 | + return $productOverview; |
| 5816 | + } // END parseGetProductOverviewFieldsResult() |
| 5817 | + |
5752 | 5818 |
|
5753 | 5819 | //---------------------------------------------------------------------------- |
5754 | 5820 |
|
@@ -8027,6 +8093,48 @@ public function convertGetSalePromotionsRequest($branchNumbers) |
8027 | 8093 | $object = arrayToObject($array); |
8028 | 8094 | return $object; |
8029 | 8095 | } // END convertGetSalePromotionsRequest() |
| 8096 | + |
| 8097 | + //---------------------------------------------------------------------------- |
| 8098 | + public function convertGetProductOverviewRequest($selectFieldList, $pageNumber, $maxPerPage, $orderField, $sortOrder, $filters, $search) |
| 8099 | + { |
| 8100 | + $request = new stdClass(); |
| 8101 | + $request->request = new stdClass(); |
| 8102 | + |
| 8103 | + if(!is_array($selectFieldList)) { |
| 8104 | + $selectFieldList = array($selectFieldList); |
| 8105 | + } |
| 8106 | + $request->request->selectFieldNameList = $selectFieldList; |
| 8107 | + |
| 8108 | + if(isset($pageNumber)) { |
| 8109 | + $request->request->pageNumber = $pageNumber; |
| 8110 | + } |
| 8111 | + if(isset($maxPerPage)) { |
| 8112 | + $request->request->maxPerPage = $maxPerPage; |
| 8113 | + } |
| 8114 | + if(isset($orderField)) { |
| 8115 | + $request->request->orderField = $orderField; |
| 8116 | + } |
| 8117 | + if(isset($sortOrder)) { |
| 8118 | + $request->request->sortOrder = $sortOrder; |
| 8119 | + } |
| 8120 | + |
| 8121 | + if(isset($filters)) { |
| 8122 | + $request->request->filterList = $filters; |
| 8123 | + } |
| 8124 | + |
| 8125 | + if(isset($search)) { |
| 8126 | + $request->request->search = $search; |
| 8127 | + } |
| 8128 | + return $request; |
| 8129 | + } // END convertGetProductOverviewRequest() |
| 8130 | + |
| 8131 | + //---------------------------------------------------------------------------- |
| 8132 | + public function convertGetProductOverviewFieldsRequest() |
| 8133 | + { |
| 8134 | + $request = new stdClass(); |
| 8135 | + $request->request = new stdClass(); |
| 8136 | + return $request; |
| 8137 | + } // END convertGetProductOverviewFieldsRequest() |
8030 | 8138 |
|
8031 | 8139 | //---------------------------------------------------------------------------- |
8032 | 8140 |
|
|
0 commit comments