1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
bundlecollection.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale;
4
5use Bitrix\Main;
6use Bitrix\Sale\Internals\CollectableEntity;
7use Bitrix\Sale\Internals\EntityCollection;
8
14{
16 protected $parentBasketItem = null;
17
21 public function setParentBasketItem(BasketItem $basketItem)
22 {
23 $this->parentBasketItem = $basketItem;
24 }
25
29 public function getParentBasketItem()
30 {
32 }
33
37 protected function getEntityParent()
38 {
39 return $this->getParentBasketItem();
40 }
41
46 public function addItem(CollectableEntity $item)
47 {
48 return parent::addItem($item);
49 }
50
56 public static function getList(array $parameters)
57 {
58 $registry = Registry::getInstance(static::getRegistryType());
59
61 $basketClassName = $registry->getBasketClassName();
62
63 return $basketClassName::getList($parameters);
64 }
65
76 public function deleteItem($index)
77 {
79 if ($order = $this->getOrder())
80 {
82 $item = $this->getItemByIndex($index);
83
84 $order->onBeforeBasketItemDelete($item);
85 }
86
87 return parent::deleteItem($index);
88 }
89
94 public static function createBundleCollectionObject()
95 {
96 $registry = Registry::getInstance(static::getRegistryType());
97 $bundleCollectionClassName = $registry->getBundleCollectionClassName();
98
99 return new $bundleCollectionClassName();
100 }
101
109 public function loadFromDb(array $filter)
110 {
111 $select = array("ID", "LID", "MODULE", "PRODUCT_ID", "QUANTITY", "WEIGHT",
112 "DELAY", "CAN_BUY", "PRICE", "CUSTOM_PRICE", "BASE_PRICE", 'PRODUCT_PRICE_ID', "CURRENCY", 'BARCODE_MULTI',
113 "RESERVED", "RESERVE_QUANTITY", "NAME", "CATALOG_XML_ID", "VAT_RATE", "NOTES", "DISCOUNT_PRICE",
114 "PRODUCT_PROVIDER_CLASS", "CALLBACK_FUNC", "ORDER_CALLBACK_FUNC", "PAY_CALLBACK_FUNC", "CANCEL_CALLBACK_FUNC",
115 "DIMENSIONS", "TYPE", "SET_PARENT_ID", "DETAIL_PAGE_URL", "FUSER_ID", 'MEASURE_CODE', 'MEASURE_NAME', 'ORDER_ID',
116 'DATE_INSERT', 'DATE_UPDATE', 'PRODUCT_XML_ID', 'SUBSCRIBE', 'RECOMMENDATION', 'VAT_INCLUDED', 'SORT'
117 );
118
119 $itemList = array();
120
121 $res = static::getList(array(
122 "filter" => $filter,
123 "select" => $select,
124 "order" => array('SORT' => 'ASC', 'ID' => 'ASC'),
125 ));
126 while ($item = $res->fetch())
127 {
128 $itemList[$item['ID']] = $item;
129 }
130
131 $this->loadFromArray($itemList);
132
133 return $this;
134 }
135
150 public function createClone(\SplObjectStorage $cloneEntity = null)
151 {
152 if ($cloneEntity === null)
153 {
154 $cloneEntity = new \SplObjectStorage();
155 }
156
158 $bundleClone = parent::createClone($cloneEntity);
159
161 if ($parentBasketItem = $this->parentBasketItem)
162 {
163 if (!$cloneEntity->contains($parentBasketItem))
164 {
165 $cloneEntity[$parentBasketItem] = $parentBasketItem->createClone($cloneEntity);
166 }
167
168 if ($cloneEntity->contains($parentBasketItem))
169 {
170 $bundleClone->parentBasketItem = $cloneEntity[$parentBasketItem];
171 }
172 }
173
174 return $bundleClone;
175 }
176
180 public function getBasket()
181 {
182 $collection = $this;
183
184 while($collection && $collection instanceof BundleCollection)
185 {
186 $entityParent = $collection->getEntityParent();
187 $collection = $entityParent->getCollection();
188 }
189
190 if ($collection instanceof BasketBase)
191 {
192 return $collection;
193 }
194
195 return null;
196 }
197
201 public static function getRegistryType()
202 {
204 }
205
221 public function onItemModify(Internals\CollectableEntity $item, $name = null, $oldValue = null, $value = null)
222 {
223 if (!($item instanceof BasketItemBase))
224 throw new Main\ArgumentTypeException($item);
225
226 $result = new Result();
227
229 $order = $this->getOrder();
230 if ($order)
231 {
232 $shipmentCollection = $order->getShipmentCollection();
233 if ($shipmentCollection)
234 {
235 $r = $shipmentCollection->onBasketModify(EventActions::UPDATE, $item, $name, $oldValue, $value);
236 if (!$r->isSuccess())
237 {
238 $result->addErrors($r->getErrors());
239 }
240 }
241 }
242
243 return $result;
244 }
245}
loadFromDb(array $filter)
Определения bundlecollection.php:109
setParentBasketItem(BasketItem $basketItem)
Определения bundlecollection.php:21
addItem(CollectableEntity $item)
Определения bundlecollection.php:46
static createBundleCollectionObject()
Определения bundlecollection.php:94
static getRegistryType()
Определения bundlecollection.php:201
const UPDATE
Определения eventactions.php:9
static getInstance($type)
Определения registry.php:183
const REGISTRY_TYPE_ORDER
Определения registry.php:16
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
$select
Определения iblock_catalog_list.php:194
$filter
Определения iblock_catalog_list.php:54
$name
Определения menu_edit.php:35
$order
Определения payment.php:8