3namespace Sale\Handlers\DiscountPreset;
7use Bitrix\Main\Localization\Loc;
8use Bitrix\Sale\Discount\Preset\ArrayHelper;
9use Bitrix\Sale\Discount\Preset\BasePreset;
10use Bitrix\Sale\Discount\Preset\HtmlHelper;
11use Bitrix\Sale\Discount\Preset\Manager;
12use Bitrix\Sale\Discount\Preset\State;
17 public function getTitle()
19 return Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_PAYSYSTEM_NAME');
22 public function getDescription()
30 public function getCategory()
32 return Manager::CATEGORY_PAYMENT;
35 public function getFirstStepName()
40 public function processShowInputName(State $state)
45 public function processSaveInputName(State $state)
50 protected function getPaymentSystems()
65 while($paySystem =
$dbRes->fetch())
67 $logoFileArray = \CFile::GetFileArray($paySystem[
'LOGOTIP']);
68 $paySystem[
'LOGOTIP'] = \CFile::ShowImage($logoFileArray, 100, 100,
"border=0",
"",
false);
70 $result[$paySystem[
'ID']] = $paySystem;
76 public function processShowInputAmount(State $state)
78 $lid = $state->get(
'discount_lid');
79 $currency = \Bitrix\Sale\Internals\SiteCurrencyTable::getSiteCurrency($lid);
80 $paymentSystems = $this->getPaymentSystems();
82 $forSelectData =
array();
83 foreach($paymentSystems as $id => $paymentSystem)
85 $forSelectData[$id] = $paymentSystem[
'NAME'];
87 Main\Type\Collection::sortByColumn($forSelectData,
'NAME',
'',
null,
true);
90 <table width="100%" border="0" cellspacing="7" cellpadding="0">
93 <td class="adm-detail-content-cell-l" style="width:40%;"><strong>' . $this->
getLabelDiscountValue() .
':</strong></td>
94 <td class="adm-detail-content-cell-r" style="width:60%;">
95 <input type="text" name="discount_value" value="' .
htmlspecialcharsbx($state->get(
'discount_value')) .
'" maxlength="100" style="width: 100px;"> <span>' .
$currency .
'</span>
99 <td class="adm-detail-content-cell-l" style="width:40%;"><strong>' . Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_PAYSYSTEM_PAYMENT_LABEL') .
':</strong></td>
100 <td class="adm-detail-content-cell-r">
101 ' . HtmlHelper::generateSelect(
'discount_payment', $forSelectData, $state->get(
'discount_payment')) .
'
109 public function processSaveInputAmount(State $state)
111 if(!trim($state->get(
'discount_value')))
116 if(!$state->get(
'discount_payment'))
118 $this->errorCollection[] =
new Error(Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ERROR_EMPTY_PAYMENT'));
121 if(!$this->errorCollection->isEmpty())
123 return array($state,
'InputAmount');
126 return array($state,
'CommonSettings');
129 public function processShowCommonSettings(State $state)
134 public function processSaveCommonSettings(State $state)
139 public function generateState(
array $discountFields)
144 'discount_lid' => $discountFields[
'LID'],
145 'discount_name' => $discountFields[
'NAME'],
147 'discount_value' => ArrayHelper::getByPath($discountFields,
'ACTIONS.CHILDREN.0.DATA.Value'),
148 'discount_type' => ArrayHelper::getByPath($discountFields,
'ACTIONS.CHILDREN.0.DATA.Unit'),
149 'discount_payment' => ArrayHelper::getByPath($discountFields,
'CONDITIONS.CHILDREN.0.DATA.value.0'),
152 return parent::generateState($discountFields)->append($stateFields);
155 public function generateDiscount(State $state)
158 parent::generateDiscount($state),
161 'CLASS_ID' =>
'CondGroup',
168 'CLASS_ID' =>
'CondSalePaySystem',
171 'value' => [$state->get(
'discount_payment')],
177 'CLASS_ID' =>
'CondGroup',
183 'CLASS_ID' =>
'ActSaleBsktGrp',
185 'Type' => $this->getTypeOfDiscount(),
186 'Value' => $state->get(
'discount_value'),
187 'Unit' => $state->get(
'discount_type',
'CurAll'),
normalizeDiscountFields(array $discountFields)
processSaveCommonSettingsInternal(State $state, $nextStep=self::FINAL_STEP)
processSaveInputNameInternal(State $state, $nextStep)
processShowInputNameInternal(State $state)
processShowCommonSettingsInternal(State $state)
addErrorEmptyActionValue()
getUserGroupsByDiscount($discountId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)