1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
singlerefreshstrategy.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\Basket;
4
5use Bitrix\Main\ArgumentNullException;
6use Bitrix\Main\ObjectNotFoundException;
7use Bitrix\Sale\BasketBase;
8
10{
11 public function __construct(array $data = null)
12 {
13 parent::__construct($data);
14
15 if (empty($this->data['BASKET_ITEM']) && empty($this->data['BASKET_ITEM_CODE']))
16 {
17 throw new ArgumentNullException('Parameters "BASKET_ITEM" or "BASKET_ITEM_CODE" should not be empty.');
18 }
19 }
20
21 protected function extractItem(BasketBase $basket)
22 {
23 $basketItem = null;
24
25 if (isset($this->data['BASKET_ITEM']) && $this->data['BASKET_ITEM'] instanceof BasketItem)
26 {
27 $basketItem = $this->data['BASKET_ITEM'];
28 }
29 elseif (!empty($this->data['BASKET_ITEM_CODE']))
30 {
31 $basketItem = $basket->getItemByBasketCode($this->data['BASKET_ITEM_CODE']);
32 }
33
34 return $basketItem;
35 }
36
37 protected function getItemToRefresh(BasketBase $basket)
38 {
39 $basketItem = $this->extractItem($basket);
40 if ($basketItem === null)
41 {
42 throw new ObjectNotFoundException('Entity "BasketItem" not found');
43 }
44
45 $basketRefreshStart = time();
47
48 $basketItemLastRefresh = $this->getBasketItemRefreshTimestamp($basketItem);
49 if ($basketRefreshStart - $basketItemLastRefresh >= $refreshGap)
50 {
51 return $basketItem;
52 }
53
54 return null;
55 }
56
57 protected function getProductData(BasketBase $basket)
58 {
59 $itemToRefresh = $this->getItemToRefresh($basket);
60
61 $items = array();
62 if (!empty($itemToRefresh))
63 {
64 $items[] = $itemToRefresh;
65 }
66
67 return $this->getProviderResult($basket, $items);
68 }
69}
getProviderResult(BasketBase $basket, $itemsToRefresh=array())
Определения baserefreshstrategy.php:373
extractItem(BasketBase $basket)
Определения singlerefreshstrategy.php:21
getItemToRefresh(BasketBase $basket)
Определения singlerefreshstrategy.php:37
getProductData(BasketBase $basket)
Определения singlerefreshstrategy.php:57
getItemByBasketCode($code)
Определения basketbase.php:47
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$items
Определения template.php:224