1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
changepricesactionsitem.php
См. документацию.
1<?php
2
4
6use Bitrix\Catalog\Helpers\Admin\IblockPriceChanger;
12
18final class ChangePricesActionsItem implements Action
19{
20 private int $iblockId;
21 private ProductRightsChecker $rights;
22
23 public function __construct(int $iblockId, ProductRightsChecker $rights)
24 {
25 $this->iblockId = $iblockId;
26 $this->rights = $rights;
27 }
28
32 public static function getId(): string
33 {
34 return 'change_price';
35 }
36
40 public function processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter): ?Result
41 {
42 if (empty($request->get('chprice_value_changing_price')))
43 {
44 return null;
45 }
46
47 if (!$this->rights->canEditPrices())
48 {
49 return null;
50 }
51
52 $ids = $request->getPost('ID');
53 if (!is_array($ids))
54 {
55 return null;
56 }
57
58 [$elementIds, $sectionIds] = RowType::parseIndexList($ids);
59 if (empty($elementIds) && empty($sectionIds))
60 {
61 return null;
62 }
63
64 $changerParams = [
65 'PRICE_TYPE' => $request->get('chprice_id_price_type'),
66 'UNITS' => $request->get('chprice_units'),
67 'FORMAT_RESULTS' => $request->get('chprice_format_result'),
68 'INITIAL_PRICE_TYPE' => $request->get('chprice_initial_price_type'),
69 'RESULT_MASK' => $request->get('chprice_result_mask'),
70 'DIFFERENCE_VALUE' => $request->get('chprice_difference_value'),
71 'VALUE_CHANGING' => $request->get('chprice_value_changing_price'),
72 ];
73
74 $changePrice = new IblockPriceChanger($changerParams, $this->iblockId);
75
76 return $changePrice->updatePrices([
77 'SECTIONS' => $sectionIds,
78 'ELEMENTS' => $elementIds,
79 ]);
80 }
81
85 public function getControl(): ?array
86 {
87 return null;
88 }
89}
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter)
Определения changepricesactionsitem.php:40
__construct(int $iblockId, ProductRightsChecker $rights)
Определения changepricesactionsitem.php:23
static parseIndexList(array $ids)
Определения rowtype.php:50
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$filter
Определения iblock_catalog_list.php:54