3namespace Sale\Handlers\DiscountPreset;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Sale\Discount\Preset\ArrayHelper;
8use Bitrix\Sale\Discount\Preset\BasePreset;
9use Bitrix\Sale\Discount\Preset\HtmlHelper;
10use Bitrix\Sale\Discount\Preset\Manager;
11use Bitrix\Sale\Discount\Preset\State;
22 return Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_NAME');
35 return Manager::CATEGORY_PRODUCTS;
43 public function processShowInputName(State $state)
48 public function processSaveInputName(State $state)
53 public function processShowInputAmount(State $state)
55 $lid = $state->get(
'discount_lid');
56 $currency = \Bitrix\Sale\Internals\SiteCurrencyTable::getSiteCurrency($lid);
59 1 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_1'),
60 2 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_2'),
61 3 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_3'),
62 4 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_4'),
63 5 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_5'),
64 6 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_6'),
65 7 => Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_OF_WEEK_7')
68 $sectionCount =
count($state->get(
'discount_section',
array()));
71 <table width="100%" border="0" cellspacing="7" cellpadding="0">
74 <td class="adm-detail-content-cell-l" style="width:40%;"><strong>' . Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_ORDER_DISCOUNT_VALUE') .
':</strong></td>
75 <td class="adm-detail-content-cell-r" style="width:60%;">
76 <input type="text" name="discount_value" value="' .
htmlspecialcharsbx($state->get(
'discount_value')) .
'" maxlength="100" style="width: 100px;"> <span>' .
$currency .
'</span>
80 <td class="adm-detail-content-cell-l" style="width:40%;"><strong>' . Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ORDER_PERDAY_DAY_LABEL') .
':</strong></td>
81 <td class="adm-detail-content-cell-r">
82 ' . HtmlHelper::generateMultipleSelect(
'discount_days[]', $days, $state->get(
'discount_days',
array()),
array(
'size=7')) .
'
90 public function processSaveInputAmount(State $state)
92 if(!trim($state->get(
'discount_value')))
97 if(!$state->get(
'discount_days'))
99 $this->errorCollection[] =
new Error(Loc::getMessage(
'SALE_HANDLERS_DISCOUNTPRESET_ERROR_EMPTY_VALUE_DAYS'));
102 if(!$this->errorCollection->isEmpty())
104 return array($state,
'InputAmount');
107 return array($state,
'CommonSettings');
110 public function processShowCommonSettings(State $state)
115 public function processSaveCommonSettings(State $state)
120 public function generateState(
array $discountFields)
125 'discount_lid' => $discountFields[
'LID'],
126 'discount_name' => $discountFields[
'NAME'],
128 'discount_value' => ArrayHelper::getByPath($discountFields,
'ACTIONS.CHILDREN.0.DATA.Value'),
129 'discount_type' => ArrayHelper::getByPath($discountFields,
'ACTIONS.CHILDREN.0.DATA.Unit'),
130 'discount_days' => ArrayHelper::getByPath($discountFields,
'CONDITIONS.CHILDREN.0.DATA.value'),
133 return parent::generateState($discountFields)->append($stateFields);
136 public function generateDiscount(State $state)
139 parent::generateDiscount($state),
142 'CLASS_ID' =>
'CondGroup',
149 'CLASS_ID' =>
'CondSaleCmnDayOfWeek',
152 'value' => $state->get(
'discount_days'),
158 'CLASS_ID' =>
'CondGroup',
164 'CLASS_ID' =>
'ActSaleBsktGrp',
166 'Type' =>
'Discount',
167 'Value' => $state->get(
'discount_value'),
168 '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)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"