PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/components/bitrix/catalog.product.subscribe.list/templates/bootstrap_v4/template.php

https://gitlab.com/alexprowars/bitrix
PHP | 683 lines | 644 code | 34 blank | 5 comment | 68 complexity | 770fc1cb3ed473a8e9567f5cd6376e67 MD5 | raw file
  1. <?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
  2. /** @var CBitrixComponentTemplate $this */
  3. /** @var array $arParams */
  4. /** @var array $arResult */
  5. /** @global CDatabase $DB */
  6. /** @global CMain $APPLICATION */
  7. use Bitrix\Main\Localization\Loc;
  8. CJSCore::init(array('popup'));
  9. $randomString = $this->randString();
  10. $APPLICATION->setTitle(Loc::getMessage('CPSL_SUBSCRIBE_TITLE_NEW'));
  11. if(!$arResult['USER_ID'] && !isset($arParams['GUEST_ACCESS'])):?>
  12. <?
  13. $contactTypeCount = count($arResult['CONTACT_TYPES']);
  14. $authStyle = 'display: block;';
  15. $identificationStyle = 'display: none;';
  16. if(!empty($_GET['result']))
  17. {
  18. $authStyle = 'display: none;';
  19. $identificationStyle = 'display: block;';
  20. }
  21. ?>
  22. <div class="row">
  23. <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
  24. <div class="alert alert-danger"><?=Loc::getMessage('CPSL_SUBSCRIBE_PAGE_TITLE_AUTHORIZE')?></div>
  25. </div>
  26. <? $authListGetParams = array(); ?>
  27. <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3" id="catalog-subscriber-auth-form" style="<?=$authStyle?>">
  28. <?$APPLICATION->authForm('', false, false, 'N', false);?>
  29. </div>
  30. </div>
  31. <?$APPLICATION->setTitle(Loc::getMessage('CPSL_TITLE_PAGE_WHEN_ACCESSING'));?>
  32. <div class="row" id="catalog-subscriber-identification-form" style="<?=$identificationStyle?>">
  33. <div class="col-md-8 offset-md-2 col-lg-6 offset-lg-3">
  34. <div class="row">
  35. <div class="col catalog-subscriber-identification-form">
  36. <h4><?=Loc::getMessage('CPSL_HEADLINE_FORM_SEND_CODE')?></h4>
  37. <form method="post">
  38. <?=bitrix_sessid_post()?>
  39. <input type="hidden" name="siteId" value="<?=SITE_ID?>">
  40. <?if($contactTypeCount > 1):?>
  41. <div class="form-group">
  42. <label for="contactType"><?=Loc::getMessage('CPSL_CONTACT_TYPE_SELECTION')?></label>
  43. <select id="contactType" class="form-control" name="contactType">
  44. <?foreach($arResult['CONTACT_TYPES'] as $contactTypeData):?>
  45. <option value="<?=intval($contactTypeData['ID'])?>"><?=htmlspecialcharsbx($contactTypeData['NAME'])?></option>
  46. <?endforeach;?>
  47. </select>
  48. </div>
  49. <?endif;?>
  50. <div class="form-group">
  51. <?
  52. $contactLable = Loc::getMessage('CPSL_CONTACT_TYPE_NAME');
  53. $contactTypeId = 0;
  54. if($contactTypeCount == 1)
  55. {
  56. $contactType = current($arResult['CONTACT_TYPES']);
  57. $contactLable = $contactType['NAME'];
  58. $contactTypeId = $contactType['ID'];
  59. }
  60. ?>
  61. <label for="contactInputOut"><?=htmlspecialcharsbx($contactLable)?></label>
  62. <input type="text" class="form-control" name="userContact" id="contactInputOut">
  63. <input type="hidden" name="subscriberIdentification" value="Y">
  64. <?if($contactTypeId):?>
  65. <input type="hidden" name="contactType" value="<?=$contactTypeId?>">
  66. <?endif;?>
  67. </div>
  68. <button type="submit" class="btn btn-primary"><?=Loc::getMessage('CPSL_BUTTON_SUBMIT_CODE')?></button>
  69. </form>
  70. </div>
  71. </div>
  72. <div class="row">
  73. <div class="col">
  74. <h4><?=Loc::getMessage('CPSL_HEADLINE_FORM_FOR_ACCESSING')?></h4>
  75. <form method="post">
  76. <?=bitrix_sessid_post()?>
  77. <div class="form-group">
  78. <label for="contactInputCheck"><?=htmlspecialcharsbx($contactLable)?></label>
  79. <input type="text" class="form-control" name="userContact" id="contactInputCheck" value="<?=!empty($_GET['contact']) ? htmlspecialcharsbx(urldecode($_GET['contact'])): ''?>">
  80. </div>
  81. <div class="form-group">
  82. <label for="token"><?=Loc::getMessage('CPSL_CODE_LABLE')?></label>
  83. <input type="text" class="form-control" name="subscribeToken" id="token">
  84. <input type="hidden" name="accessCodeVerification" value="Y">
  85. </div>
  86. <button type="submit" class="btn btn-primary"><?=Loc::getMessage('CPSL_BUTTON_SUBMIT_ACCESS')?></button>
  87. </form>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <script type="text/javascript">
  93. BX.ready(function() {
  94. if(BX('cpsl-auth'))
  95. {
  96. BX.bind(BX('cpsl-auth'), 'click', BX.delegate(showAuthForm, this));
  97. BX.bind(BX('cpsl-identification'), 'click', BX.delegate(showAuthForm, this));
  98. }
  99. function showAuthForm()
  100. {
  101. var formType = BX.proxy_context.id.replace('cpsl-', '');
  102. var authForm = BX('catalog-subscriber-auth-form'),
  103. codeForm = BX('catalog-subscriber-identification-form');
  104. if(!authForm || !codeForm || !BX('catalog-subscriber-'+formType+'-form')) return;
  105. BX.style(authForm, 'display', 'none');
  106. BX.style(codeForm, 'display', 'none');
  107. BX.style(BX('catalog-subscriber-'+formType+'-form'), 'display', '');
  108. }
  109. });
  110. </script>
  111. <?endif;
  112. ?>
  113. <script type="text/javascript">
  114. BX.message({
  115. CPSL_MESS_BTN_DETAIL: '<?=('' != $arParams['MESS_BTN_DETAIL']
  116. ? CUtil::JSEscape($arParams['MESS_BTN_DETAIL']) : GetMessageJS('CPSL_TPL_MESS_BTN_DETAIL'));?>',
  117. CPSL_MESS_NOT_AVAILABLE: '<?=('' != $arParams['MESS_BTN_DETAIL']
  118. ? CUtil::JSEscape($arParams['MESS_BTN_DETAIL']) : GetMessageJS('CPSL_TPL_MESS_BTN_DETAIL'));?>',
  119. CPSL_BTN_MESSAGE_BASKET_REDIRECT: '<?=GetMessageJS('CPSL_CATALOG_BTN_MESSAGE_BASKET_REDIRECT');?>',
  120. CPSL_BASKET_URL: '<?=$arParams["BASKET_URL"];?>',
  121. CPSL_TITLE_ERROR: '<?=GetMessageJS('CPSL_CATALOG_TITLE_ERROR') ?>',
  122. CPSL_TITLE_BASKET_PROPS: '<?=GetMessageJS('CPSL_CATALOG_TITLE_BASKET_PROPS') ?>',
  123. CPSL_BASKET_UNKNOWN_ERROR: '<?=GetMessageJS('CPSL_CATALOG_BASKET_UNKNOWN_ERROR') ?>',
  124. CPSL_BTN_MESSAGE_SEND_PROPS: '<?=GetMessageJS('CPSL_CATALOG_BTN_MESSAGE_SEND_PROPS');?>',
  125. CPSL_BTN_MESSAGE_CLOSE: '<?=GetMessageJS('CPSL_CATALOG_BTN_MESSAGE_CLOSE') ?>',
  126. CPSL_STATUS_SUCCESS: '<?=GetMessageJS('CPSL_STATUS_SUCCESS');?>',
  127. CPSL_STATUS_ERROR: '<?=GetMessageJS('CPSL_STATUS_ERROR') ?>'
  128. });
  129. </script>
  130. <?
  131. if(!empty($_GET['result']) && !empty($_GET['message']))
  132. {
  133. $successNotify = mb_strpos($_GET['result'], 'Ok')? true : false;
  134. $postfix = $successNotify ? 'Ok' : 'Fail';
  135. $popupTitle = Loc::getMessage('CPSL_SUBSCRIBE_POPUP_TITLE_'.mb_strtoupper(str_replace($postfix, '', $_GET['result'])));
  136. $arJSParams = array(
  137. 'NOTIFY_USER' => true,
  138. 'NOTIFY_POPUP_TITLE' => $popupTitle,
  139. 'NOTIFY_SUCCESS' => $successNotify,
  140. 'NOTIFY_MESSAGE' => urldecode($_GET['message']),
  141. );
  142. ?>
  143. <script type="text/javascript">
  144. var <?='jaClass_'.$randomString;?> = new JCCatalogProductSubscribeList(<?=CUtil::PhpToJSObject($arJSParams, false, true);?>);
  145. </script>
  146. <?
  147. }
  148. if (!empty($arResult['ITEMS']))
  149. {
  150. $skuTemplate = array();
  151. if (!empty($arResult['SKU_PROPS']))
  152. {
  153. foreach ($arResult['SKU_PROPS'] as $itemId => $arProp)
  154. {
  155. foreach($arProp as $propId => $prop)
  156. {
  157. $propId = $prop['ID'];
  158. $skuTemplate[$itemId][$propId] = array(
  159. 'SCROLL' => array(
  160. 'START' => '',
  161. 'FINISH' => '',
  162. ),
  163. 'FULL' => array(
  164. 'START' => '',
  165. 'FINISH' => '',
  166. ),
  167. 'ITEMS' => array()
  168. );
  169. $templateRow = '';
  170. if ('TEXT' == $prop['SHOW_MODE'])
  171. {
  172. $skuTemplate[$itemId][$propId]['SCROLL']['START'] = '<div class="bx_item_detail_size full" id="#ITEM#_prop_'.$propId.'_cont">'.
  173. '<span class="bx_item_section_name_gray">'.htmlspecialcharsbx($prop['NAME']).'</span>'.
  174. '<div class="bx_size_scroller_container"><div class="bx_size"><ul id="#ITEM#_prop_'.$propId.'_list" style="width: #WIDTH#;">';;
  175. $skuTemplate[$itemId][$propId]['SCROLL']['FINISH'] = '</ul></div>'.
  176. '<div class="bx_slide_left" id="#ITEM#_prop_'.$propId.'_left" data-treevalue="'.$propId.'" style=""></div>'.
  177. '<div class="bx_slide_right" id="#ITEM#_prop_'.$propId.'_right" data-treevalue="'.$propId.'" style=""></div>'.
  178. '</div></div>';
  179. $skuTemplate[$itemId][$propId]['FULL']['START'] = '<div class="bx_item_detail_size" id="#ITEM#_prop_'.$propId.'_cont">'.
  180. '<span class="bx_item_section_name_gray">'.htmlspecialcharsbx($prop['NAME']).'</span>'.
  181. '<div class="bx_size_scroller_container"><div class="bx_size"><ul id="#ITEM#_prop_'.$propId.'_list" style="width: #WIDTH#;">';;
  182. $skuTemplate[$itemId][$propId]['FULL']['FINISH'] = '</ul></div>'.
  183. '<div class="bx_slide_left" id="#ITEM#_prop_'.$propId.'_left" data-treevalue="'.$propId.'" style="display: none;"></div>'.
  184. '<div class="bx_slide_right" id="#ITEM#_prop_'.$propId.'_right" data-treevalue="'.$propId.'" style="display: none;"></div>'.
  185. '</div></div>';
  186. foreach ($prop['VALUES'] as $value)
  187. {
  188. $value['NAME'] = htmlspecialcharsbx($value['NAME']);
  189. $skuTemplate[$itemId][$propId]['ITEMS'][$value['ID']] = '<li data-treevalue="'.$propId.'_'.$value['ID'].
  190. '" data-onevalue="'.$value['ID'].'" style="width: #WIDTH#;" title="'.$value['NAME'].'"><i></i><span class="cnt">'.$value['NAME'].'</span></li>';
  191. }
  192. unset($value);
  193. }
  194. elseif ('PICT' == $prop['SHOW_MODE'])
  195. {
  196. $skuTemplate[$itemId][$propId]['SCROLL']['START'] = '<div class="bx_item_detail_scu full" id="#ITEM#_prop_'.$propId.'_cont">'.
  197. '<span class="bx_item_section_name_gray">'.htmlspecialcharsbx($prop['NAME']).'</span>'.
  198. '<div class="bx_scu_scroller_container"><div class="bx_scu"><ul id="#ITEM#_prop_'.$propId.'_list" style="width: #WIDTH#;">';
  199. $skuTemplate[$itemId][$propId]['SCROLL']['FINISH'] = '</ul></div>'.
  200. '<div class="bx_slide_left" id="#ITEM#_prop_'.$propId.'_left" data-treevalue="'.$propId.'" style=""></div>'.
  201. '<div class="bx_slide_right" id="#ITEM#_prop_'.$propId.'_right" data-treevalue="'.$propId.'" style=""></div>'.
  202. '</div></div>';
  203. $skuTemplate[$itemId][$propId]['FULL']['START'] = '<div class="bx_item_detail_scu" id="#ITEM#_prop_'.$propId.'_cont">'.
  204. '<span class="bx_item_section_name_gray">'.htmlspecialcharsbx($prop['NAME']).'</span>'.
  205. '<div class="bx_scu_scroller_container"><div class="bx_scu"><ul id="#ITEM#_prop_'.$propId.'_list" style="width: #WIDTH#;">';
  206. $skuTemplate[$itemId][$propId]['FULL']['FINISH'] = '</ul></div>'.
  207. '<div class="bx_slide_left" id="#ITEM#_prop_'.$propId.'_left" data-treevalue="'.$propId.'" style="display: none;"></div>'.
  208. '<div class="bx_slide_right" id="#ITEM#_prop_'.$propId.'_right" data-treevalue="'.$propId.'" style="display: none;"></div>'.
  209. '</div></div>';
  210. foreach ($prop['VALUES'] as $value)
  211. {
  212. $value['NAME'] = htmlspecialcharsbx($value['NAME']);
  213. $skuTemplate[$itemId][$propId]['ITEMS'][$value['ID']] = '<li data-treevalue="'.$propId.'_'.$value['ID'].
  214. '" data-onevalue="'.$value['ID'].'" style="width: #WIDTH#; padding-top: #WIDTH#;"><i title="'.$value['NAME'].'"></i>'.
  215. '<span class="cnt"><span class="cnt_item" style="background-image:url(\''.$value['PICT']['SRC'].'\');" title="'.$value['NAME'].'"></span></span></li>';
  216. }
  217. unset($value);
  218. }
  219. }
  220. }
  221. unset($templateRow, $prop);
  222. }
  223. ?>
  224. <div class="bx_item_list_you_looked_horizontal col<?=$arParams['LINE_ELEMENT_COUNT'];?>">
  225. <div class="bx_item_list_section">
  226. <div class="bx_item_list_slide active">
  227. <? foreach ($arResult['ITEMS'] as $key => $arItem)
  228. {
  229. $strMainID = $this->GetEditAreaId($arItem['ID']);
  230. $arItemIDs = array(
  231. 'ID' => $strMainID,
  232. 'PICT' => $strMainID . '_pict',
  233. 'SECOND_PICT' => $strMainID . '_secondpict',
  234. 'MAIN_PROPS' => $strMainID . '_main_props',
  235. 'QUANTITY' => $strMainID . '_quantity',
  236. 'QUANTITY_DOWN' => $strMainID . '_quant_down',
  237. 'QUANTITY_UP' => $strMainID . '_quant_up',
  238. 'QUANTITY_MEASURE' => $strMainID . '_quant_measure',
  239. 'BUY_LINK' => $strMainID . '_buy_link',
  240. 'SUBSCRIBE_LINK' => $strMainID . '_subscribe',
  241. 'SUBSCRIBE_DELETE_LINK' => $strMainID . '_delete_subscribe',
  242. 'PRICE' => $strMainID . '_price',
  243. 'DSC_PERC' => $strMainID . '_dsc_perc',
  244. 'SECOND_DSC_PERC' => $strMainID . '_second_dsc_perc',
  245. 'PROP_DIV' => $strMainID . '_sku_tree',
  246. 'PROP' => $strMainID . '_prop_',
  247. 'DISPLAY_PROP_DIV' => $strMainID . '_sku_prop',
  248. 'BASKET_PROP_DIV' => $strMainID . '_basket_prop'
  249. );
  250. $strObName = 'ob' . preg_replace("/[^a-zA-Z0-9_]/", "x", $strMainID);
  251. $strTitle = (
  252. isset($arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"])
  253. && '' != isset($arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"])
  254. ? $arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"]
  255. : $arItem['NAME']
  256. );
  257. $showImgClass = $arParams['SHOW_IMAGE'] != "Y" ? "no-imgs" : "";
  258. ?>
  259. <div class="<?=($arItem['SECOND_PICT'] && $arParams ? 'bx_catalog_item double' : 'bx_catalog_item');?>" id=
  260. "<?=$strMainID;?>">
  261. <!-- <div class="catalog-product-subscribe-list-close">-->
  262. <!-- <span class="catalog-product-subscribe-list-close-item"></span>-->
  263. <!-- </div>-->
  264. <div class="bx_catalog_item_container <?=$showImgClass;?>">
  265. <a id="<?=$arItemIDs['PICT'];?>" href="<?=$arItem['DETAIL_PAGE_URL'];?>" class=
  266. "bx_catalog_item_images"<? if ($arParams['SHOW_IMAGE'] == "Y")
  267. {
  268. ?> style="background-image: url('<?=($arParams['SHOW_IMAGE'] == "Y"
  269. ? $arItem['PREVIEW_PICTURE']['SRC'] : "");?>')"<?
  270. } ?> title="<?=$strTitle;?>"><?
  271. if ('Y' == $arParams['SHOW_DISCOUNT_PERCENT'])
  272. {
  273. ?>
  274. <div id="<?=$arItemIDs['DSC_PERC'];?>" class="bx_stick_disc right bottom" style=
  275. "display:<?=(0 < $arItem['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] ? '' : 'none');?>;">
  276. -<?=$arItem['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'];?>%
  277. </div>
  278. <?
  279. }
  280. if ($arItem['LABEL'])
  281. {
  282. ?><div class="bx_stick average left top" title="<?=$arItem['LABEL_VALUE'];?>">
  283. <?=$arItem['LABEL_VALUE'];?></div><?
  284. }
  285. ?>
  286. </a><?
  287. if ($arItem['SECOND_PICT'])
  288. {
  289. ?><a id="<?=$arItemIDs['SECOND_PICT'];?>" href="<?=$arItem['DETAIL_PAGE_URL'];?>" class=
  290. "bx_catalog_item_images_double"<? if ($arParams['SHOW_IMAGE'] == "Y")
  291. {
  292. ?> style="background-image: url('<?=(
  293. !empty($arItem['PREVIEW_PICTURE_SECOND'])
  294. ? $arItem['PREVIEW_PICTURE_SECOND']['SRC']
  295. : $arItem['PREVIEW_PICTURE']['SRC']
  296. );?>')"<?
  297. } ?> title="<?=$strTitle;?>"><?
  298. if ('Y' == $arParams['SHOW_DISCOUNT_PERCENT'])
  299. {
  300. ?>
  301. <div id="<?=$arItemIDs['SECOND_DSC_PERC'];?>" class="bx_stick_disc right bottom" style=
  302. "display:<?=(0 < $arItem['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'] ? '' : 'none');?>;">
  303. -<?=$arItem['MIN_PRICE']['DISCOUNT_DIFF_PERCENT'];?>%
  304. </div>
  305. <?
  306. }
  307. if ($arItem['LABEL'])
  308. {
  309. ?><div class="bx_stick average left top" title="<?=$arItem['LABEL_VALUE'];?>">
  310. <?=$arItem['LABEL_VALUE'];?></div><?
  311. }
  312. ?>
  313. </a><?
  314. }
  315. ?>
  316. <? if ($arParams['SHOW_NAME'] == "Y")
  317. {
  318. ?>
  319. <div class="bx_catalog_item_title">
  320. <a href="<?=$arItem['DETAIL_PAGE_URL'];?>" title="<?=$arItem['NAME'];?>"><?=$arItem['NAME'];?></a>
  321. </div>
  322. <?
  323. }?>
  324. <div class="bx_catalog_item_price">
  325. <div id="<?=$arItemIDs['PRICE'];?>" class="bx_price"></div>
  326. </div>
  327. <?if (!isset($arItem['OFFERS']) || empty($arItem['OFFERS'])) // Simple Product
  328. {
  329. ?>
  330. <div class="bx_catalog_item_controls">
  331. <div>
  332. <a class="btn btn-primary" href="<?=$arItem['DETAIL_PAGE_URL'];?>">
  333. <?=GetMessage('CPSL_TPL_MESS_BTN_DETAIL');?>
  334. </a>
  335. </div>
  336. <div>
  337. <a id="<?=$arItemIDs['SUBSCRIBE_DELETE_LINK'];?>" class="btn btn-link" href="javascript:void(0)">
  338. <?=GetMessage('CPSL_TPL_MESS_BTN_UNSUBSCRIBE');?>
  339. </a>
  340. </div>
  341. <div style="clear: both;"></div><?
  342. ?></div><?
  343. if (isset($arItem['DISPLAY_PROPERTIES']) && !empty($arItem['DISPLAY_PROPERTIES']))
  344. {
  345. ?>
  346. <div class="bx_catalog_item_articul">
  347. <?
  348. foreach ($arItem['DISPLAY_PROPERTIES'] as $arOneProp)
  349. {
  350. ?><br><?=$arOneProp['NAME'];?> <strong><?
  351. echo(
  352. is_array($arOneProp['DISPLAY_VALUE'])
  353. ? implode('/', $arOneProp['DISPLAY_VALUE'])
  354. : $arOneProp['DISPLAY_VALUE']
  355. );?></strong><?
  356. }
  357. ?>
  358. </div>
  359. <?
  360. }
  361. $emptyProductProperties = empty($arItem['PRODUCT_PROPERTIES']);
  362. if ('Y' == $arParams['ADD_PROPERTIES_TO_BASKET'] && !$emptyProductProperties)
  363. {
  364. ?>
  365. <div id="<?=$arItemIDs['BASKET_PROP_DIV'];?>" style="display: none;">
  366. <?
  367. if (!empty($arItem['PRODUCT_PROPERTIES_FILL']))
  368. {
  369. foreach ($arItem['PRODUCT_PROPERTIES_FILL'] as $propID => $propInfo)
  370. {
  371. ?>
  372. <input type="hidden" name="<?=$arParams['PRODUCT_PROPS_VARIABLE'];?>[<?=$propID;?>]" value=
  373. "<?=htmlspecialcharsbx($propInfo['ID']);?>">
  374. <?
  375. if (isset($arItem['PRODUCT_PROPERTIES'][$propID]))
  376. unset($arItem['PRODUCT_PROPERTIES'][$propID]);
  377. }
  378. }
  379. $emptyProductProperties = empty($arItem['PRODUCT_PROPERTIES']);
  380. if (!$emptyProductProperties)
  381. {
  382. ?>
  383. <table>
  384. <?
  385. foreach ($arItem['PRODUCT_PROPERTIES'] as $propID => $propInfo)
  386. {
  387. ?>
  388. <tr>
  389. <td><?=$arItem['PROPERTIES'][$propID]['NAME'];?></td>
  390. <td>
  391. <?
  392. if (
  393. 'L' == $arItem['PROPERTIES'][$propID]['PROPERTY_TYPE']
  394. && 'C' == $arItem['PROPERTIES'][$propID]['LIST_TYPE']
  395. )
  396. {
  397. foreach ($propInfo['VALUES'] as $valueID => $value)
  398. {
  399. ?><label>
  400. <input type="radio" name=
  401. "<?=$arParams['PRODUCT_PROPS_VARIABLE'];?>[<?=$propID;?>]" value=
  402. "<?=$valueID;?>" <?=($valueID == $propInfo['SELECTED'] ?
  403. '"checked"' : '');?>><?=$value;?>
  404. </label><br><?
  405. }
  406. }
  407. else
  408. {
  409. ?><select name="<?=$arParams['PRODUCT_PROPS_VARIABLE'];?>[<?=$propID;?>]"><?
  410. foreach ($propInfo['VALUES'] as $valueID => $value)
  411. {
  412. ?>
  413. <option value="<?=$valueID;?>" <?=($valueID == $propInfo['SELECTED']
  414. ? '"selected"' : '');?>><?=$value;?></option><?
  415. }
  416. ?></select><?
  417. }
  418. ?>
  419. </td>
  420. </tr>
  421. <?
  422. }
  423. ?>
  424. </table>
  425. <?
  426. }
  427. ?>
  428. </div>
  429. <?
  430. }
  431. $arJSParams = array(
  432. 'PRODUCT_TYPE' => $arItem['CATALOG_TYPE'],
  433. 'SHOW_QUANTITY' => $arParams['USE_PRODUCT_QUANTITY'],
  434. 'SHOW_ADD_BASKET_BTN' => false,
  435. 'SHOW_BUY_BTN' => true,
  436. 'SHOW_ABSENT' => true,
  437. 'PRODUCT' => array(
  438. 'ID' => $arItem['ID'],
  439. 'NAME' => $arItem['~NAME'],
  440. 'PICT' => ('Y' == $arItem['SECOND_PICT']?$arItem['PREVIEW_PICTURE_SECOND']:$arItem['PREVIEW_PICTURE']),
  441. 'CAN_BUY' => $arItem["CAN_BUY"],
  442. 'SUBSCRIPTION' => ('Y' == $arItem['CATALOG_SUBSCRIPTION']),
  443. 'CHECK_QUANTITY' => $arItem['CHECK_QUANTITY'],
  444. 'MAX_QUANTITY' => $arItem['CATALOG_QUANTITY'],
  445. 'STEP_QUANTITY' => $arItem['CATALOG_MEASURE_RATIO'],
  446. 'QUANTITY_FLOAT' => is_double($arItem['CATALOG_MEASURE_RATIO']),
  447. 'ADD_URL' => $arItem['~ADD_URL'],
  448. 'SUBSCRIBE_URL' => $arItem['~SUBSCRIBE_URL'],
  449. 'LIST_SUBSCRIBE_ID' => $arParams['LIST_SUBSCRIPTIONS'],
  450. ),
  451. 'BASKET' => array(
  452. 'ADD_PROPS' => ('Y' == $arParams['ADD_PROPERTIES_TO_BASKET']),
  453. 'QUANTITY' => $arParams['PRODUCT_QUANTITY_VARIABLE'],
  454. 'PROPS' => $arParams['PRODUCT_PROPS_VARIABLE'],
  455. 'EMPTY_PROPS' => $emptyProductProperties
  456. ),
  457. 'VISUAL' => array(
  458. 'ID' => $arItemIDs['ID'],
  459. 'PICT_ID' => ('Y' == $arItem['SECOND_PICT'] ? $arItemIDs['SECOND_PICT'] : $arItemIDs['PICT']),
  460. 'QUANTITY_ID' => $arItemIDs['QUANTITY'],
  461. 'QUANTITY_UP_ID' => $arItemIDs['QUANTITY_UP'],
  462. 'QUANTITY_DOWN_ID' => $arItemIDs['QUANTITY_DOWN'],
  463. 'PRICE_ID' => $arItemIDs['PRICE'],
  464. 'BUY_ID' => $arItemIDs['BUY_LINK'],
  465. 'BASKET_PROP_DIV' => $arItemIDs['BASKET_PROP_DIV'],
  466. 'DELETE_SUBSCRIBE_ID' => $arItemIDs['SUBSCRIBE_DELETE_LINK'],
  467. ),
  468. 'LAST_ELEMENT' => $arItem['LAST_ELEMENT'],
  469. );
  470. ?>
  471. <script type="text/javascript">
  472. var <?=$strObName;?> = new JCCatalogProductSubscribeList(
  473. <?=CUtil::PhpToJSObject($arJSParams, false, true);?>);
  474. </script><?
  475. }
  476. else // Wth Sku
  477. {
  478. ?>
  479. <div class="bx_catalog_item_controls no_touch">
  480. <div>
  481. <a class="btn btn-primary" href="<?=$arItem['DETAIL_PAGE_URL'];?>">
  482. <?=GetMessage('CPSL_TPL_MESS_BTN_DETAIL');?>
  483. </a>
  484. </div>
  485. <div>
  486. <a id="<?=$arItemIDs['SUBSCRIBE_DELETE_LINK'];?>" class="btn btn-link" href="javascript:void(0)">
  487. <?=GetMessage('CPSL_TPL_MESS_BTN_UNSUBSCRIBE');?>
  488. </a>
  489. </div>
  490. <div style="clear: both;"></div>
  491. </div>
  492. <div class="bx_catalog_item_controls touch">
  493. <a class="bx_bt_button_type_2 bx_medium" href="<?=$arItem['DETAIL_PAGE_URL'];?>"><?
  494. echo('' != $arParams['MESS_BTN_DETAIL']
  495. ? $arParams['MESS_BTN_DETAIL'] : GetMessage('CPSL_TPL_MESS_BTN_DETAIL'));
  496. ?></a>
  497. </div>
  498. <?
  499. $boolShowOfferProps = !!$arItem['OFFERS_PROPS_DISPLAY'];
  500. $boolShowProductProps = (isset($arItem['DISPLAY_PROPERTIES']) && !empty($arItem['DISPLAY_PROPERTIES']));
  501. if ($boolShowProductProps || $boolShowOfferProps)
  502. {
  503. ?>
  504. <div class="bx_catalog_item_articul">
  505. <?
  506. if ($boolShowProductProps)
  507. {
  508. foreach ($arItem['DISPLAY_PROPERTIES'] as $arOneProp)
  509. {
  510. ?><br><?=$arOneProp['NAME'];?><strong> <?
  511. echo(
  512. is_array($arOneProp['DISPLAY_VALUE'])
  513. ? implode(' / ', $arOneProp['DISPLAY_VALUE'])
  514. : $arOneProp['DISPLAY_VALUE']
  515. );?></strong><?
  516. }
  517. }
  518. ?>
  519. <span id="<?=$arItemIDs['DISPLAY_PROP_DIV'];?>" style="display: none;"></span>
  520. </div>
  521. <?
  522. }
  523. if (!empty($arItem['OFFERS']) && isset($skuTemplate[$arItem['ID']]))
  524. {
  525. $arSkuProps = array();?>
  526. <div class="bx_catalog_item_scu" id="<?= $arItemIDs['PROP_DIV']; ?>"><?
  527. foreach ($skuTemplate[$arItem['ID']] as $propId => $propTemplate)
  528. {
  529. $valueCount = count($propTemplate['ITEMS']);
  530. if ($valueCount > 5)
  531. {
  532. $fullWidth = ($valueCount*20).'%';
  533. $itemWidth = (100/$valueCount).'%';
  534. $rowTemplate = $propTemplate['SCROLL'];
  535. }
  536. else
  537. {
  538. $fullWidth = '100%';
  539. $itemWidth = '20%';
  540. $rowTemplate = $propTemplate['FULL'];
  541. }
  542. unset($valueCount);
  543. echo '<div>', str_replace(array('#ITEM#_prop_', '#WIDTH#'), array($arItemIDs['PROP'], $fullWidth), $rowTemplate['START']);
  544. foreach ($propTemplate['ITEMS'] as $value => $valueItem)
  545. {
  546. echo str_replace(array('#ITEM#_prop_', '#WIDTH#'), array($arItemIDs['PROP'], $itemWidth), $valueItem);
  547. }
  548. unset($value, $valueItem);
  549. echo str_replace('#ITEM#_prop_', $arItemIDs['PROP'], $rowTemplate['FINISH']), '</div>';
  550. }
  551. unset($propTemplate);
  552. foreach ($arResult['SKU_PROPS'][$arItem['ID']] as $arOneProp)
  553. {
  554. $arSkuProps[] = array(
  555. 'ID' => $arOneProp['ID'],
  556. 'SHOW_MODE' => $arOneProp['SHOW_MODE'],
  557. 'VALUES_COUNT' => $arOneProp['VALUES_COUNT']
  558. );
  559. }?>
  560. </div>
  561. <?
  562. if($arItem['OFFERS_PROPS_DISPLAY'])
  563. {
  564. foreach($arItem['JS_OFFERS'] as $keyOffer => $arJSOffer)
  565. {
  566. $strProps = '';
  567. if (!empty($arJSOffer['DISPLAY_PROPERTIES']))
  568. {
  569. foreach ($arJSOffer['DISPLAY_PROPERTIES'] as $arOneProp)
  570. {
  571. $strProps .= '<br>'.$arOneProp['NAME'].' <strong>'.(
  572. is_array($arOneProp['VALUE'])
  573. ? implode(' / ', $arOneProp['VALUE'])
  574. : $arOneProp['VALUE']
  575. ).'</strong>';
  576. }
  577. }
  578. $arItem['JS_OFFERS'][$keyOffer]['DISPLAY_PROPERTIES'] = $strProps;
  579. }
  580. }
  581. $arJSParams = array(
  582. 'PRODUCT_TYPE' => $arItem['CATALOG_TYPE'],
  583. 'SHOW_QUANTITY' => $arParams['USE_PRODUCT_QUANTITY'],
  584. 'SHOW_ADD_BASKET_BTN' => false,
  585. 'SHOW_BUY_BTN' => true,
  586. 'SHOW_ABSENT' => true,
  587. 'SHOW_SKU_PROPS' => $arItem['OFFERS_PROPS_DISPLAY'],
  588. 'SECOND_PICT' => ($arParams['SHOW_IMAGE'] == "Y" ? $arItem['SECOND_PICT'] : false),
  589. 'SHOW_OLD_PRICE' => ('Y' == $arParams['SHOW_OLD_PRICE']),
  590. 'SHOW_DISCOUNT_PERCENT' => ('Y' == $arParams['SHOW_DISCOUNT_PERCENT']),
  591. 'DEFAULT_PICTURE' => array(
  592. 'PICTURE' => $arItem['PRODUCT_PREVIEW'],
  593. 'PICTURE_SECOND' => $arItem['PRODUCT_PREVIEW_SECOND']
  594. ),
  595. 'VISUAL' => array(
  596. 'ID' => $arItemIDs['ID'],
  597. 'PICT_ID' => $arItemIDs['PICT'],
  598. 'SECOND_PICT_ID' => $arItemIDs['SECOND_PICT'],
  599. 'QUANTITY_ID' => $arItemIDs['QUANTITY'],
  600. 'QUANTITY_UP_ID' => $arItemIDs['QUANTITY_UP'],
  601. 'QUANTITY_DOWN_ID' => $arItemIDs['QUANTITY_DOWN'],
  602. 'QUANTITY_MEASURE' => $arItemIDs['QUANTITY_MEASURE'],
  603. 'PRICE_ID' => $arItemIDs['PRICE'],
  604. 'TREE_ID' => $arItemIDs['PROP_DIV'],
  605. 'TREE_ITEM_ID' => $arItemIDs['PROP'],
  606. 'BUY_ID' => $arItemIDs['BUY_LINK'],
  607. 'ADD_BASKET_ID' => $arItemIDs['ADD_BASKET_ID'],
  608. 'DSC_PERC' => $arItemIDs['DSC_PERC'],
  609. 'SECOND_DSC_PERC' => $arItemIDs['SECOND_DSC_PERC'],
  610. 'DISPLAY_PROP_DIV' => $arItemIDs['DISPLAY_PROP_DIV'],
  611. 'DELETE_SUBSCRIBE_ID' => $arItemIDs['SUBSCRIBE_DELETE_LINK'],
  612. ),
  613. 'BASKET' => array(
  614. 'QUANTITY' => $arParams['PRODUCT_QUANTITY_VARIABLE'],
  615. 'PROPS' => $arParams['PRODUCT_PROPS_VARIABLE']
  616. ),
  617. 'PRODUCT' => array(
  618. 'ID' => $arItem['ID'],
  619. 'NAME' => $arItem['~NAME'],
  620. 'LIST_SUBSCRIBE_ID' => $arParams['LIST_SUBSCRIPTIONS'],
  621. ),
  622. 'OFFERS' => $arItem['JS_OFFERS'],
  623. 'OFFER_SELECTED' => $arItem['OFFERS_SELECTED'],
  624. 'TREE_PROPS' => $arSkuProps,
  625. 'LAST_ELEMENT' => $arItem['LAST_ELEMENT'],
  626. ); ?>
  627. <script type="text/javascript">
  628. var <?=$strObName;?> = new JCCatalogProductSubscribeList(
  629. <?=CUtil::PhpToJSObject($arJSParams, false, true);?>);
  630. </script>
  631. <?
  632. }
  633. }
  634. ?></div></div><?
  635. }
  636. ?>
  637. <div style="clear: both;"></div>
  638. </div>
  639. </div>
  640. </div>
  641. <?
  642. }
  643. else
  644. {
  645. if(isset($arParams['GUEST_ACCESS'])):
  646. echo '<h3>'.Loc::getMessage('CPSL_SUBSCRIBE_NOT_FOUND').'</h3>';
  647. endif;
  648. }
  649. ?>