63 public static function loadResultFromDatabase($order, $extendedMode =
false, $basketList =
false, $basketData = array())
65 if (!is_array($basketList))
67 if (!is_array($basketData))
69 $result = parent::loadResultFromDb($order, $basketList, $basketData);
72 $data = $result->getData();
76 $data[
'DISCOUNT_MODULES'] = [];
78 if (isset($data[
'APPLY_BLOCKS'][0]))
80 $data[
'BASKET'] = $data[
'APPLY_BLOCKS'][0][
'BASKET'];
81 $data[
'ORDER'] = $data[
'APPLY_BLOCKS'][0][
'ORDER'];
83 if (!empty($data[
'DISCOUNT_LIST']))
85 foreach (array_keys($data[
'DISCOUNT_LIST']) as $index)
87 if (empty($data[
'DISCOUNT_LIST'][$index][
'MODULES']))
89 $data[
'DISCOUNT_MODULES'][$index] = $data[
'DISCOUNT_LIST'][$index][
'MODULES'];
93 $data[
'DATA'][
'STORED_ACTION_DATA'] = $data[
'STORED_ACTION_DATA'];
94 unset($data[
'STORED_ACTION_DATA']);
96 $result->setData($data);
115 $config = static::getManagerConfig();
120 case Discount\Formatter::TYPE_LIMIT_VALUE:
121 if (!is_array($data))
123 if (!isset($data[
'LIMIT_UNIT']) && isset($config[
'CURRENCY']))
124 $data[
'LIMIT_UNIT'] = $config[
'CURRENCY'];
125 if (!isset($data[
'VALUE_UNIT']) && isset($config[
'CURRENCY']))
126 $data[
'VALUE_UNIT'] = $config[
'CURRENCY'];
128 case Discount\Formatter::TYPE_VALUE:
129 case Discount\Formatter::TYPE_FIXED:
130 case Discount\Formatter::TYPE_MAX_BOUND:
131 if (!is_array($data))
133 if (!isset($data[
'VALUE_UNIT']) && isset($config[
'CURRENCY']))
134 $data[
'VALUE_UNIT'] = $config[
'CURRENCY'];
138 $description = Discount\Formatter::prepareRow($type, $data);
139 if ($description !==
null)
141 $result->setData($description);
145 self::transferFormatterErrors($result);
164 if (!is_array($data))
167 $description = Discount\Formatter::formatRow($data);
168 if ($description !==
null)
170 $result->setData(array(
'DESCRIPTION' => $description));
174 self::transferFormatterErrors($result);
192 if (!is_array($data))
194 $description = Discount\Formatter::formatRow($data);
195 if ($description !==
null)
196 $result = $description;
213 if (!empty($data) && is_array($data))
215 $description = Discount\Formatter::formatList($data);
216 if ($description !==
null)
217 $result = $description;
220 return (empty($result) ?
false: $result);
236 return Discount\Result\CompatibleFormat::createResultDescription($newPrice, $oldPrice, $currency);
250 $translate = ($translate ===
true);
254 if (is_array($basketList) && isset($basketList[$rule[
'ENTITY_ID']]))
255 $index = $basketList[$rule[
'ENTITY_ID']];
259 $index = $rule[
'ENTITY_ID'];
270 private static function transferFormatterErrors(
Result $result)
272 $errors = Discount\Formatter::getErrors();
273 Discount\Formatter::clearErrors();
274 $result->addWarning(
new Main\
Error(
static loadMessages($file)