22 if (!empty($basketItemData[
'SITE_ID']))
24 $context[
'SITE_ID'] = $basketItemData[
'SITE_ID'];
27 if (!empty($basketItemData[
'USER_ID']))
29 $context[
'USER_ID'] = $basketItemData[
'USER_ID'];
32 $providerClass = static::getProviderClass($context);
38 $productId = $basketItemData[
'PRODUCT_ID'];
39 $transfer = Sale\Internals\TransferProvider::create($providerClass, $context);
43 'ITEM_CODE' => $productId,
44 'QUANTITY_LIST' => array(
45 $basketItemData[
'BASKET_ID'] => $basketItemData[
'QUANTITY'])
49 if (!empty($basketItemData[
'BASKET_ID']))
51 $products[$productId][
'BASKET_ID'] = $basketItemData[
'BASKET_ID'];
54 $r = $transfer->getProductData($products);
58 $data = $r->getData();
59 if (!empty($data[
'PRODUCT_DATA_LIST']))
61 $productDataList = $data[
'PRODUCT_DATA_LIST'];
62 if (isset($productDataList[$productId]))
64 $productData = $productDataList[$productId];
66 if (!empty($productData[
'PRICE_LIST']))
68 $basketItemCode = $basketItemData[
'BASKET_ID'];
70 if (!empty($productData[
'PRICE_LIST'][$basketItemCode]))
72 $priceData = $productData[
'PRICE_LIST'][$basketItemCode];
74 if (!isset($priceData[
'QUANTITY']) && isset($priceData[
'AVAILABLE_QUANTITY']))
76 $priceData[
'QUANTITY'] = $priceData[
'AVAILABLE_QUANTITY'];
79 $productData = $priceData + $productData;
108 $resultList = array();
110 $providerClass = static::getProviderClass();
116 $transfer = Sale\Internals\TransferProvider::create($providerClass, static::getContext());
118 $products = array($productId => array());
119 $r = $transfer->getBundleItems($products);
123 $data = $r->getData();
124 if (!empty($data[
'BUNDLE_LIST']))
126 $resultList = $data[
'BUNDLE_LIST'];
140 $providerClass = static::getProviderClass();
146 $productId = $values[
'PRODUCT_ID'];
147 $transfer = Sale\Internals\TransferProvider::create($providerClass, static::getContext());
151 'ITEM_CODE' => $productId,
152 'QUANTITY' => $values[
'QUANTITY'] * ($values[
'UNDO_RESERVATION'] ==
'Y'? -1 : 1),
155 $r = $transfer->reserve($products);
158 $data = $r->getData();
163 $result->setData(array(
164 'RESERVED_PRODUCTS_LIST' => array(
169 $r = $transfer->setItemsResultAfterReserve($products, $result);
183 $providerClass = static::getProviderClass();
189 $productId = $values[
'PRODUCT_ID'];
190 $transfer = Sale\Internals\TransferProvider::create($providerClass, static::getContext());
194 'ITEM_CODE' => $productId,
195 'PRODUCT_ID' => $productId,
196 'QUANTITY' => $values[
'QUANTITY'] * ($values[
'UNDO_DEDUCTION'] ==
'Y'? -1 : 1),
199 $r = $transfer->ship($products);
202 $data = $r->getData();
207 $result->setData(array(
208 'SHIPPED_PRODUCTS_LIST' => array(
213 $r = $transfer->setItemsResultAfterShip($products, $result);
228 $providerClass = static::getProviderClass();
234 $productId = $values[
'PRODUCT_ID'];
235 $transfer = Sale\Internals\TransferProvider::create($providerClass, static::getContext());
237 if (empty($values[
'SITE_ID']))
239 $values[
'SITE_ID'] = SITE_ID;
244 "PRODUCT_ID" => $productId,
245 "USER_ID" => $values[
"USER_ID"],
246 "SITE_ID" => $values[
"SITE_ID"]
249 $r = $transfer->viewProduct($products);
252 $data = $r->getData();
254 if (!empty($data[
'VIEW_PRODUCTS_LIST']) && array_key_exists($productId, $data[
'VIEW_PRODUCTS_LIST']))
256 return $data[
'VIEW_PRODUCTS_LIST'][$productId];
271 $providerClass = static::getProviderClass();
277 $context = static::getContext();
279 if (!empty($values[
'SITE_ID']))
281 $context[
'SITE_ID'] = $values[
'SITE_ID'];
284 $productId = $values[
'PRODUCT_ID'];
285 $transfer = Sale\Internals\TransferProvider::create($providerClass, $context);
289 "PRODUCT_ID" => $productId,
290 "BASKET_ID" => $values[
"BASKET_ID"],
291 "SITE_ID" => $values[
"SITE_ID"]
294 $r = $transfer->getProductListStores($products);
297 $data = $r->getData();
299 if (!empty($data[
'PRODUCT_STORES_LIST']) && array_key_exists($productId, $data[
'PRODUCT_STORES_LIST']))
301 return $data[
'PRODUCT_STORES_LIST'][$productId];
316 $providerClass = static::getProviderClass();
322 $context = static::getContext();
324 if (!empty($values[
'SITE_ID']))
326 $context[
'SITE_ID'] = $values[
'SITE_ID'];
329 $productId = $values[
'PRODUCT_ID'];
330 $transfer = Sale\Internals\TransferProvider::create($providerClass, $context);
334 "PRODUCT_ID" => $productId,
335 "USER_ID" => $values[
"USER_ID"],
338 $r = $transfer->recurring($products);
341 $data = $r->getData();
343 if (!empty($data[
'RECURRING_PRODUCTS_LIST']) && array_key_exists($productId, $data[
'RECURRING_PRODUCTS_LIST']))
345 return $data[
'RECURRING_PRODUCTS_LIST'][$productId];
360 $context = static::getContext();
362 if (isset($values[
'SITE_ID']))
364 $context[
'SITE_ID'] = $values[
'SITE_ID'];
367 $providerClass = static::getProviderClass($context);
373 $transfer = Sale\Internals\TransferProvider::create($providerClass, $context);
374 $r = $transfer->getStoresCount();
377 $data = $r->getData();
379 if (isset($data[
'STORES_COUNT']))
381 return $data[
'STORES_COUNT'];
391 $providerClass = static::getProviderClass();
397 $productId = $values[
'PRODUCT_ID'];
398 $transfer = Sale\Internals\TransferProvider::create($providerClass, static::getContext());
400 if (empty($values[
'SITE_ID']))
402 $values[
'SITE_ID'] = SITE_ID;
407 "PRODUCT_ID" => $productId,
408 "USER_ID" => $values[
"USER_ID"],
409 "ORDER_ID" => $values[
"ORDER_ID"],
410 "PAID" => $values[
"PAID"],
411 "BASKET_ID" => $values[
"BASKET_ID"],
414 $r = $transfer->deliver($products);
417 $data = $r->getData();
419 if (!empty($data[
'DELIVER_PRODUCTS_LIST']) && array_key_exists($productId, $data[
'DELIVER_PRODUCTS_LIST']))
421 return $data[
'DELIVER_PRODUCTS_LIST'][$productId];