PageRenderTime 27ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/components/bitrix/sale.personal.order.list/templates/store_v3/template.php

https://gitlab.com/alexprowars/bitrix
PHP | 409 lines | 384 code | 23 blank | 2 comment | 52 complexity | cf40aca52ec91e0f42b98dca941ca184 MD5 | raw file
  1. <?
  2. if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
  3. use Bitrix\Main,
  4. Bitrix\Main\Localization\Loc;
  5. \Bitrix\Main\UI\Extension::load("ui.bootstrap4");
  6. CJSCore::Init(array('clipboard', 'fx'));
  7. Loc::loadMessages(__FILE__);
  8. ?><div class="container-fluid"><?php
  9. if (!empty($arResult['ERRORS']['FATAL']))
  10. {
  11. foreach($arResult['ERRORS']['FATAL'] as $code => $error)
  12. {
  13. if ($code !== $component::E_NOT_AUTHORIZED)
  14. ShowError($error);
  15. }
  16. $component = $this->__component;
  17. if ($arParams['AUTH_FORM_IN_TEMPLATE'] && isset($arResult['ERRORS']['FATAL'][$component::E_NOT_AUTHORIZED]))
  18. {
  19. ?>
  20. <div class="row">
  21. <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
  22. <div class="alert alert-danger"><?=$arResult['ERRORS']['FATAL'][$component::E_NOT_AUTHORIZED]?></div>
  23. </div>
  24. <? $authListGetParams = array(); ?>
  25. <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
  26. <?$APPLICATION->AuthForm('', false, false, 'N', false);?>
  27. </div>
  28. </div>
  29. <?
  30. }
  31. }
  32. else
  33. {
  34. if (!empty($arResult['ERRORS']['NONFATAL']))
  35. {
  36. foreach($arResult['ERRORS']['NONFATAL'] as $error)
  37. {
  38. ShowError($error);
  39. }
  40. }
  41. if (!count($arResult['ORDERS']))
  42. {
  43. if ($_REQUEST["filter_history"] == 'Y')
  44. {
  45. if ($_REQUEST["show_canceled"] == 'Y')
  46. {
  47. ?>
  48. <div class="mt-3 alert alert-secondary"><?= Loc::getMessage('SPOL_TPL_EMPTY_CANCELED_ORDER')?></div>
  49. <?
  50. }
  51. else
  52. {
  53. ?>
  54. <div class="mt-3 alert alert-secondary"><?= Loc::getMessage('SPOL_TPL_EMPTY_HISTORY_ORDER_LIST')?></div>
  55. <?
  56. }
  57. }
  58. else
  59. {
  60. ?>
  61. <div class="mt-3 alert alert-secondary"><?= Loc::getMessage('SPOL_TPL_EMPTY_ORDER_LIST')?></div>
  62. <?
  63. }
  64. }
  65. ?>
  66. <div class="">
  67. <?
  68. $nothing = !isset($_REQUEST["filter_history"]) && !isset($_REQUEST["show_all"]);
  69. $clearFromLink = array("filter_history","filter_status","show_all", "show_canceled");
  70. if ($nothing || $_REQUEST["filter_history"] == 'N')
  71. {
  72. ?>
  73. <a class="mr-4" href="<?=$APPLICATION->GetCurPageParam("filter_history=Y", $clearFromLink, false)?>"><?echo Loc::getMessage("SPOL_TPL_VIEW_ORDERS_HISTORY")?></a>
  74. <?
  75. }
  76. if ($_REQUEST["filter_history"] == 'Y')
  77. {
  78. ?>
  79. <a class="mr-4" href="<?=$APPLICATION->GetCurPageParam("", $clearFromLink, false)?>"><?echo Loc::getMessage("SPOL_TPL_CUR_ORDERS")?></a>
  80. <?
  81. if ($_REQUEST["show_canceled"] == 'Y')
  82. {
  83. ?>
  84. <a class="mr-4" href="<?=$APPLICATION->GetCurPageParam("filter_history=Y", $clearFromLink, false)?>"><?echo Loc::getMessage("SPOL_TPL_VIEW_ORDERS_HISTORY")?></a>
  85. <?
  86. }
  87. else
  88. {
  89. ?>
  90. <a class="mr-4" href="<?=$APPLICATION->GetCurPageParam("filter_history=Y&show_canceled=Y", $clearFromLink, false)?>"><?echo Loc::getMessage("SPOL_TPL_VIEW_ORDERS_CANCELED")?></a>
  91. <?
  92. }
  93. }
  94. ?>
  95. </div>
  96. <?
  97. if (!count($arResult['ORDERS']))
  98. {
  99. ?>
  100. <div class="">
  101. <a href="<?=htmlspecialcharsbx($arParams['PATH_TO_CATALOG'])?>" class="mr-4"><?=Loc::getMessage('SPOL_TPL_LINK_TO_CATALOG')?></a>
  102. </div>
  103. <?
  104. }
  105. if ($_REQUEST["filter_history"] !== 'Y')
  106. {
  107. $paymentChangeData = array();
  108. $orderHeaderStatus = null;
  109. foreach ($arResult['ORDERS'] as $key => $order)
  110. {
  111. ?>
  112. <div class="row personal-order-item-container">
  113. <div class="col">
  114. <div class="personal-order-item-header">
  115. <h2 class="personal-order-item-title">
  116. <?=Loc::getMessage('SPOL_TPL_ORDER')?>
  117. <?=Loc::getMessage('SPOL_TPL_NUMBER_SIGN') . htmlspecialcharsbx($order['ORDER']['ACCOUNT_NUMBER'])?>
  118. <?=Loc::getMessage('SPOL_TPL_FROM_DATE')?>
  119. <?=$order['ORDER']['DATE_INSERT_FORMATED']?>
  120. </h2>
  121. <div class="personal-order-item-order-cost">
  122. <?=count($order['BASKET_ITEMS']);?>
  123. <?
  124. $count = count($order['BASKET_ITEMS']) % 10;
  125. if ($count == '1')
  126. {
  127. echo Loc::getMessage('SPOL_TPL_GOOD');
  128. }
  129. elseif ($count >= '2' && $count <= '4')
  130. {
  131. echo Loc::getMessage('SPOL_TPL_TWO_GOODS');
  132. }
  133. else
  134. {
  135. echo Loc::getMessage('SPOL_TPL_GOODS');
  136. }
  137. ?>
  138. <?=Loc::getMessage('SPOL_TPL_SUMOF')?>
  139. <?=$order['ORDER']['FORMATED_PRICE']?>
  140. </div>
  141. </div>
  142. <div class="personal-order-item-content">
  143. <div class="personal-order-item-status-container">
  144. <?
  145. if ($order['ORDER']['DEDUCTED'] === 'Y')
  146. {
  147. ?><div class="personal-order-item-shipment-status-success"><?=Loc::getMessage('SPOL_TPL_LOADED');?></div><?
  148. }
  149. elseif ($order['ORDER']['CANCELED'] !== 'Y')
  150. {
  151. ?><div class="personal-order-item-shipment-status-alert"><?=Loc::getMessage('SPOL_TPL_NOTLOADED');?></div><?
  152. }
  153. elseif ($order['ORDER']['CANCELED'] === 'Y')
  154. {
  155. ?><div class="personal-order-item-order-status-canceled"><?= Loc::getMessage('SPOL_TPL_ORDER_CANCELED')?></div><?
  156. }
  157. if ($order['ORDER']['PAID'] === 'Y')
  158. {
  159. ?><div class="personal-order-item-paid-status-success"><?=Loc::getMessage('SPOL_TPL_PAID').", ".$order['ORDER']['FORMATED_PRICE']?></div><?
  160. }
  161. elseif ($order['ORDER']['IS_ALLOW_PAY'] == 'N')
  162. {
  163. ?><div class="personal-order-item-paid-status-restricted"><?=Loc::getMessage('SPOL_TPL_RESTRICTED_PAID')?></div><?
  164. }
  165. else
  166. {
  167. if ($order['ORDER']['CANCELED'] !== 'Y')
  168. {
  169. foreach ($order['PAYMENT'] as $payment)
  170. {
  171. if ($payment['PAID'] === 'N' && $payment['IS_CASH'] !== 'Y' && $payment['ACTION_FILE'] !== 'cash')
  172. {
  173. ?>
  174. <div class="personal-order-item-paid-status-alert"><?=Loc::getMessage('SPOL_TPL_NOTPAID')?>, <?=$payment['FORMATED_SUM']?></div>
  175. <?
  176. if (($payment['NEW_WINDOW'] === 'Y') && ($order['ORDER']['IS_ALLOW_PAY'] != 'N'))
  177. {
  178. ?><a class="personal-order-item-order-btn-pay" target="_blank" href="<?=htmlspecialcharsbx($payment['PSA_ACTION_FILE'])?>"><?=Loc::getMessage('SPOL_TPL_PAY')?></a><?
  179. }
  180. else
  181. {
  182. ?><a class="personal-order-item-order-btn-pay ajax_reload" href="<?=htmlspecialcharsbx($payment['PSA_ACTION_FILE'])?>"><?=Loc::getMessage('SPOL_TPL_PAY')?></a><?
  183. }
  184. }
  185. if ($order['ORDER']['LOCK_CHANGE_PAYSYSTEM'] !== 'Y')
  186. {
  187. $paymentChangeData[$payment['ACCOUNT_NUMBER']] = array(
  188. "order" => htmlspecialcharsbx($order['ORDER']['ACCOUNT_NUMBER']),
  189. "payment" => htmlspecialcharsbx($payment['ACCOUNT_NUMBER']),
  190. "allow_inner" => $arParams['ALLOW_INNER'],
  191. "refresh_prices" => $arParams['REFRESH_PRICES'],
  192. "path_to_payment" => $arParams['PATH_TO_PAYMENT'],
  193. "only_inner_full" => $arParams['ONLY_INNER_FULL'],
  194. "return_url" => $arResult['RETURN_URL'],
  195. );
  196. }
  197. }
  198. }
  199. if ($order['ORDER']['PAID'] !== 'Y' && $order['ORDER']['LOCK_CHANGE_PAYSYSTEM'] !== 'Y')
  200. {
  201. ?>
  202. <a href="#" class="personal-order-item-order-change-payment" id="<?= htmlspecialcharsbx($payment['ACCOUNT_NUMBER']) ?>"><?= Loc::getMessage('SPOL_TPL_CHANGE_PAY_TYPE') ?></a>
  203. <?
  204. }
  205. }
  206. foreach ($order['SHIPMENT'] as $shipment)
  207. {
  208. ?>
  209. <div class="personal-order-item-status-container">
  210. <?
  211. if ($order['ORDER']['CAN_CANCEL'] !== 'Y')
  212. {
  213. ?><a class="personal-order-item-order-btn-reorder" href="<?=htmlspecialcharsbx($order["ORDER"]["URL_TO_COPY"])?>"><?=Loc::getMessage('SPOL_TPL_REPEAT_ORDER')?></a><?
  214. }
  215. if ($shipment['TRACKING_URL'] <> '')
  216. {
  217. ?><a class="personal-order-item-order-btn-track" target="_blank" href="<?= htmlspecialcharsbx($shipment['TRACKING_URL']) ?>"><?=Loc::getMessage('SPOL_TPL_CHECK_POSTID')?></a><?
  218. }
  219. ?>
  220. </div>
  221. <?
  222. //region CHECK_DATA
  223. if (!empty($payment['CHECK_DATA']))
  224. {
  225. $listCheckLinks = "";
  226. foreach ($payment['CHECK_DATA'] as $checkInfo)
  227. {
  228. $title = Loc::getMessage('SPOL_CHECK_NUM', array('#CHECK_NUMBER#' => $checkInfo['ID']))." - ". htmlspecialcharsbx($checkInfo['TYPE_NAME']);
  229. if($checkInfo['LINK'] <> '')
  230. {
  231. $link = $checkInfo['LINK'];
  232. $listCheckLinks .= "<div><a href='$link' target='_blank'>$title</a></div>";
  233. }
  234. }
  235. if ($listCheckLinks <> '')
  236. {
  237. ?>
  238. <div class="sale-order-list-payment-check">
  239. <div class="sale-order-list-payment-check-left"><?=Loc::getMessage('SPOL_CHECK_TITLE')?>:</div>
  240. <div class="sale-order-list-payment-check-left"><?=$listCheckLinks?></div>
  241. </div>
  242. <?
  243. }
  244. }
  245. //endregion
  246. }
  247. ?>
  248. </div>
  249. <div class="personal-order-item-product-container">
  250. <div class="personal-order-item-product-image-list">
  251. <img class="personal-order-item-product-pict" src="http://store.solj.bx/upload/iblock/631/631c95680c87d7b185ead9f163315e08.jpg" alt="">
  252. </div>
  253. </div>
  254. </div>
  255. <div class="personal-order-item-additional-info">
  256. <div>
  257. <?
  258. if (!empty($order['SHIPMENT'][0]['DELIVERY_ID']))
  259. {
  260. echo "<div>".Loc::getMessage('SPOL_TPL_DELIVERY_SERVICE').": " . htmlspecialcharsbx($arResult['INFO']['DELIVERY'][$order['SHIPMENT'][0]['DELIVERY_ID']]['NAME']) . "</div>";
  261. }
  262. ?>
  263. </div>
  264. <div class="personal-order-item-additional-info-more-block">
  265. <a class="personal-order-item-additional-info-more-link" href="<?=htmlspecialcharsbx($order["ORDER"]["URL_TO_DETAIL"])?>"><?=Loc::getMessage('SPOL_TPL_MORE_ON_ORDER')?></a>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. <?
  271. }
  272. }
  273. else
  274. {
  275. $orderHeaderStatus = null;
  276. foreach ($arResult['ORDERS'] as $key => $order)
  277. {
  278. ?>
  279. <div class="row personal-order-item-container">
  280. <div class="col">
  281. <div class="personal-order-item-header">
  282. <h2 class="personal-order-item-title">
  283. <?=Loc::getMessage('SPOL_TPL_ORDER')?>
  284. <?=Loc::getMessage('SPOL_TPL_NUMBER_SIGN') . htmlspecialcharsbx($order['ORDER']['ACCOUNT_NUMBER'])?>
  285. <?=Loc::getMessage('SPOL_TPL_FROM_DATE')?>
  286. <?=$order['ORDER']['DATE_INSERT_FORMATED']?>
  287. </h2>
  288. <div class="personal-order-item-order-cost">
  289. <?=count($order['BASKET_ITEMS']);?>
  290. <?
  291. $count = count($order['BASKET_ITEMS']) % 10;
  292. if ($count == '1')
  293. {
  294. echo Loc::getMessage('SPOL_TPL_GOOD');
  295. }
  296. elseif ($count >= '2' && $count <= '4')
  297. {
  298. echo Loc::getMessage('SPOL_TPL_TWO_GOODS');
  299. }
  300. else
  301. {
  302. echo Loc::getMessage('SPOL_TPL_GOODS');
  303. }
  304. ?>
  305. <?=Loc::getMessage('SPOL_TPL_SUMOF')?>
  306. <?=$order['ORDER']['FORMATED_PRICE']?>
  307. </div>
  308. </div>
  309. <div class="personal-order-item-content">
  310. <div class="personal-order-item-status-container">
  311. <?
  312. if ($_REQUEST["show_canceled"] !== 'Y')
  313. {
  314. ?><div class="personal-order-item-order-status-success"><?= Loc::getMessage('SPOL_TPL_ORDER_FINISHED')?></div><?
  315. }
  316. else
  317. {
  318. ?><div class="personal-order-item-order-status-canceled"><?= Loc::getMessage('SPOL_TPL_ORDER_CANCELED')?></div><?
  319. }
  320. if ($order['PAYMENT'][0]['PAID'] === 'Y')
  321. {
  322. ?><div class="personal-order-item-order-status-success"><?=Loc::getMessage('SPOL_TPL_PAID')?>, <?=$order['PAYMENT'][0]['FORMATED_SUM']?></div><?
  323. }
  324. if ($order['ORDER']['CAN_CANCEL'] !== 'N')
  325. {
  326. ?><a class="g-font-size-15 sale-order-list-cancel-link" href="<?=htmlspecialcharsbx($order["ORDER"]["URL_TO_CANCEL"])?>"><?=Loc::getMessage('SPOL_TPL_CANCEL_ORDER')?></a><?
  327. }
  328. else
  329. {
  330. ?><a class="personal-order-item-order-btn-reorder" href="<?=htmlspecialcharsbx($order["ORDER"]["URL_TO_COPY"])?>"><?=Loc::getMessage('SPOL_TPL_REPEAT_ORDER')?></a><?
  331. }
  332. ?>
  333. </div>
  334. <!-- endregion -->
  335. </div>
  336. <div class="personal-order-item-additional-info">
  337. <div>
  338. <?
  339. if ($_REQUEST["show_canceled"] !== 'Y')
  340. {
  341. ?>
  342. <span class="sale-order-list-accomplished-date">
  343. <?=Loc::getMessage('SPOL_TPL_ORDER_FINISHED')?>
  344. </span>
  345. <?
  346. }
  347. else
  348. {
  349. ?>
  350. <span class="sale-order-list-accomplished-date canceled-order">
  351. <?=Loc::getMessage('SPOL_TPL_ORDER_CANCELED')?>
  352. </span>
  353. <?
  354. }
  355. ?>
  356. <span class="sale-order-list-accomplished-date"><?= $order['ORDER']['DATE_STATUS_FORMATED'] ?></span>
  357. </div>
  358. <div class="personal-order-item-additional-info-more-block">
  359. <a class="personal-order-item-additional-info-more-link" href="<?=htmlspecialcharsbx($order["ORDER"]["URL_TO_DETAIL"])?>"><?=Loc::getMessage('SPOL_TPL_MORE_ON_ORDER')?></a>
  360. </div>
  361. </div>
  362. </div>
  363. </div>
  364. <?
  365. }
  366. }
  367. echo $arResult["NAV_STRING"];
  368. if ($_REQUEST["filter_history"] !== 'Y')
  369. {
  370. $javascriptParams = array(
  371. "url" => CUtil::JSEscape($this->__component->GetPath().'/ajax.php'),
  372. "templateFolder" => CUtil::JSEscape($templateFolder),
  373. "templateName" => $this->__component->GetTemplateName(),
  374. "paymentList" => $paymentChangeData,
  375. "returnUrl" => CUtil::JSEscape($arResult["RETURN_URL"]),
  376. );
  377. $javascriptParams = CUtil::PhpToJSObject($javascriptParams);
  378. ?>
  379. <script>
  380. BX.Sale.PersonalOrderComponent.PersonalOrderList.init(<?=$javascriptParams?>);
  381. </script>
  382. <?
  383. }
  384. }
  385. ?>
  386. </div>