1 2; /* Start:"a:4:{s:4:"full";s:130:"/bitrix/templates/aura-flowers-new/components/bitrix/catalog/default-new/bitrix/catalog.element/.default/script.js?171562863229412";s:6:"source";s:114:"/bitrix/templates/aura-flowers-new/components/bitrix/catalog/default-new/bitrix/catalog.element/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3JCCatalogElement = function (arParams) 4{ 5 this.productType = 0; 6 this.showQuantity = true; 7 this.showAbsent = true; 8 this.checkQuantity = false; 9 this.maxQuantity = 0; 10 this.stepQuantity = 1; 11 this.isDblQuantity = false; 12 this.canBuy = true; 13 this.canSubscription = true; 14 15 this.showOldPrice = false; 16 this.showPercent = false; 17 this.showSkuProps = false; 18 this.showOfferGroup = false; 19 20 this.visual = { 21 ID: '', 22 PICT_ID: '', 23 QUANTITY_ID: '', 24 QUANTITY_UP_ID: '', 25 QUANTITY_DOWN_ID: '', 26 PRICE_ID: '', 27 OLD_PRICE_ID: '', 28 DISCOUNT_VALUE_ID: '', 29 DISCOUNT_PERC_ID: '', 30 OFFER_GROUP: '' 31 }; 32 this.product = { 33 checkQuantity: false, 34 maxQuantity: 0, 35 stepQuantity: 1, 36 isDblQuantity: false, 37 canBuy: true, 38 canSubscription: true, 39 name: '', 40 pict: {}, 41 id: 0 42 }; 43 this.ajaxPath = ''; 44 this.mess = {}; 45 46 this.defaultPict = { 47 preview: null, 48 detail: null 49 }; 50 51 this.offers = []; 52 this.offerNum = 0; 53 this.treeProps = []; 54 this.obTreeRows = []; 55 this.showCount = []; 56 this.showStart = []; 57 this.selectedValues = {}; 58 this.sliders = []; 59 60 this.obProduct = null; 61 this.obQuantity = null; 62 this.obQuantityUp = null; 63 this.obQuantityDown = null; 64 this.obPict = null; 65 this.obPrice = { 66 price: null, 67 full: null, 68 discount: null, 69 percent: null 70 }; 71 this.obTree = null; 72 this.obBuyBtn = null; 73 this.obSkuProps = null; 74 this.obSlider = null; 75 this.obMeasure = null; 76 this.obQuantityLimit = { 77 all: null, 78 value: null 79 }; 80 81 this.obZoom = { 82 cont: null, 83 pict: null 84 }; 85 this.enableZoom = false;
86 this.showZoom = false; 87 88 this.errorCode = 0; 89 90 if ('object' == typeof(arParams)) 91 { 92 this.productType = parseInt(arParams.PRODUCT_TYPE); 93 this.showQuantity = arParams.SHOW_QUANTITY; 94 if (!!arParams.SHOW_DISCOUNT_PERCENT) 95 this.showPercent = true; 96 if (!!arParams.SHOW_OLD_PRICE) 97 this.showOldPrice = true; 98 if (!!arParams.SHOW_SKU_PROPS) 99 this.showSkuProps = true; 100 if (!!arParams.OFFER_GROUP) 101 this.showOfferGroup = true; 102 this.visual = arParams.VISUAL; 103 this.ajaxPath = arParams.AJAX_PATH; 104 if (!!arParams.MESS) 105 this.mess = arParams.MESS; 106 switch (this.productType) 107 { 108 case 1://product 109 case 2://set 110 if (!!arParams.PRODUCT && 'object' == typeof(arParams.PRODUCT)) 111 { 112 if (this.showQuantity) 113 { 114 this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY; 115 this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT; 116 if (this.product.checkQuantity) 117 this.product.maxQuantity = (this.product.isDblQuantity 118 ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) 119 : parseInt(arParams.PRODUCT.MAX_QUANTITY) 120 ); 121 this.product.stepQuantity = (this.product.isDblQuantity 122 ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) 123 : parseInt(arParams.PRODUCT.STEP_QUANTITY) 124 ); 125 126 this.checkQuantity = this.product.checkQuantity; 127 this.isDblQuantity = this.product.isDblQuantity; 128 this.maxQuantity = this.product.maxQuantity; 129 this.stepQuantity = this.product.stepQuantity; 130 } 131 this.product.canBuy = arParams.PRODUCT.CAN_BUY; 132 this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION; 133 this.product.buyUrl = arParams.PRODUCT.BUY_URL; 134 135 this.canBuy = this.product.canBuy; 136 this.canSubscription = this.product.canSubscription; 137 138 this.product.name = arParams.PRODUCT.NAME; 139 this.product.pict = arParams.PRODUCT.PICT; 140 this.product.id = arParams.PRODUCT.ID; 141 } 142 else 143 { 144 this.errorCode = -1; 145 } 146 break; 147 case 3://sku 148 if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) 149 { 150 this.offers = arParams.OFFERS; 151 this.offerNum = 0; 152 if (!!arParams.OFFER_SELECTED) 153 this.offerNum = parseInt(arParams.OFFER_SELECTED); 154 if (isNaN(this.offerNum)) 155 this.offerNum = 0; 156 if (!!arParams.TREE_PROPS) 157 this.treeProps = arParams.TREE_PROPS; 158 if (!!arParams.DEFAULT_PICTURE) 159 { 160 this.defaultPict.preview = arParams.DEFAULT_PICTURE.PREVIEW_PICTIRE; 161 this.defaultPict.detail = arParams.DEFAULT_PICTURE.DETAIL_PICTURE; 162 } 163 } 164 else 165 { 166 this.errorCode = -1; 167 } 168 break; 169 default: 170 this.errorCode = -1; 171 } 172 } 173 if (0 == this.errorCode) 174 { 175 BX.ready(BX.delegate(this.Init,this)); 176 } 177}; 178 179JCCatalogElement.prototype.Init = function() 180{ 181 var i = 0; 182 var j = 0; 183 this.obProduct = BX(this.visual.ID); 184 if (!this.obProduct) 185 this.errorCode = -1; 186 this.obPict = BX(this.visual.PICT_ID); 187 if (!this.obPict) 188 this.errorCode = -2; 189 this.obPrice.price = BX(this.visual.PRICE_ID); 190 if (!this.obPrice.price) 191 { 192 this.errorCode = -16; 193 } 194 else 195 { 196 if (!!this.visual.OLD_PRICE_ID) 197 { 198 this.obPrice.full = BX(this.visual.OLD_PRICE_ID); 199 if (!this.obPrice.full) 200 this.errorCode = -17; 201 } 202 if (!!this.visual.DISCOUNT_VALUE_ID) 203 { 204 this.obPrice.discount = BX(this.visual.DISCOUNT_VALUE_ID); 205 if (!this.obPrice.discount) 206 this.errorCode = -18; 207 } 208 if (this.showPercent) 209 { 210 if (!!this.visual.DISCOUNT_PERC_ID) 211 { 212 this.obPrice.percent = BX(this.visual.DISCOUNT_PERC_ID); 213 if (!this.obPrice.percent) 214 this.errorCode = -19; 215 } 216 } 217 } 218 219 if (this.showQuantity && !!this.visual.QUANTITY_ID) 220 { 221 this.obQuantity = BX(this.visual.QUANTITY_ID); 222 if (!this.obQuantity) 223 this.errorCode = -32; 224 if (!!this.visual.QUANTITY_UP_ID) 225 { 226 this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID); 227 if (!this.obQuantityUp) 228 this.errorCode = -64; 229 } 230 if (!!this.visual.QUANTITY_DOWN_ID) 231 { 232 this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID); 233 if (!this.obQuantityDown) 234 this.errorCode = -128; 235 } 236 } 237 if (3 == this.productType) 238 { 239 if (!!this.visual.TREE_ID) 240 { 241 this.obTree = BX(this.visual.TREE_ID); 242 if (!this.obTree) 243 this.errorCode = -256; 244 var strPrefix = this.visual.TREE_ITEM_ID; 245 for (i = 0; i < this.treeProps.length; i++) 246 { 247 this.obTreeRows[i] = { 248 LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'), 249 RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'), 250 LIST: BX(strPrefix+this.treeProps[i].ID+'_list'), 251 CONT: BX(strPrefix+this.treeProps[i].ID+'_cont') 252 }; 253 if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT) 254 { 255 this.errorCode = -512; 256 break; 257 } 258 } 259 } 260 if (!!this.visual.QUANTITY_MEASURE) 261 { 262 this.obMeasure = BX(this.visual.QUANTITY_MEASURE); 263 } 264 if (!!this.visual.QUANTITY_LIMIT) 265 { 266 this.obQuantityLimit.all = BX(this.visual.QUANTITY_LIMIT); 267 if (!!this.obQuantityLimit.all) 268 { 269 this.obQuantityLimit.value = BX.findChild(this.obQuantityLimit.all, {tagName: 'span'}, false, false); 270 if (!this.obQuantityLimit.value) 271 this.obQuantityLimit.all = null; 272 } 273 } 274 } 275 276 if (!!this.visual.BIG_SLIDER_ID) 277 { 278 this.obSlider = BX(this.visual.BIG_SLIDER_ID); 279 if (!this.obSlider) 280 { 281 this.errorCode = -1024; 282 } 283 } 284 if (!!this.visual.BUY_ID) 285 { 286 this.obBuyBtn = BX(this.visual.BUY_ID); 287 if (!this.obBuyBtn) 288 { 289 290 } 291 } 292 if (this.showSkuProps) 293 { 294 if (!!this.visual.DISPLAY_PROP_DIV) 295 { 296 this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV); 297 } 298 } 299 300/* if (!!this.visual.ZOOM_DIV && !!this.visual.ZOOM_PICT) 301 { 302 this.obZoom.cont = BX(this.visual.ZOOM_DIV); 303 this.obZoom.pict = BX(this.visual.ZOOM_PICT); 304 if (!this.obZoom.cont || !this.obZoom.pict) 305 { 306 307 } 308 else 309 { 310 311 } 312 } */ 313 314 if (0 == this.errorCode) 315 { 316 if (this.showQuantity) 317 { 318 BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this)); 319 BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this)); 320 BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this)); 321 } 322 switch (this.productType) 323 { 324 case 1://product 325 break; 326 case 3://sku 327 var TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true); 328 if (!!TreeItems && 0 < TreeItems.length) 329 { 330 for (i = 0; i < TreeItems.length; i++) 331 { 332 BX.bind(TreeItems[i], 'click', BX.delegate(function(e){this.SelectOfferProp(e); }, this)); 333 } 334 } 335 for (i = 0; i < this.obTreeRows.length; i++) 336 { 337 BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(function(e){this.RowLeft(e); }, this)); 338 BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(function(e){this.RowRight(e); }, this)); 339 } 340 for (i = 0; i < this.offers.length; i++) 341 { 342 if (0 == this.offers[i].SLIDER_COUNT) 343 { 344 this.sliders[i] = { 345 COUNT: this.offers[i].SLIDER_COUNT, 346 ID: '' 347 }; 348 } 349 else 350 { 351 for (j = 0; j < this.offers[i].SLIDER.length; j++) 352 { 353 this.offers[i].SLIDER[j].WIDTH = parseInt(this.offers[i].SLIDER[j].WIDTH); 354 this.offers[i].SLIDER[j].HEIGHT = parseInt(this.offers[i].SLIDER[j].HEIGHT); 355 } 356 this.sliders[i] = { 357 COUNT: this.offers[i].SLIDER_COUNT, 358 OFFER_ID: this.offers[i].ID, 359 ID: this.visual.SLIDER_CONT_OF_ID+this.offers[i].ID, 360 CONT: BX(this.visual.SLIDER_CONT_OF_ID+this.offers[i].ID), 361 LIST: BX(this.visual.SLIDER_LIST_OF_ID+this.offers[i].ID), 362 LEFT: BX(this.visual.SLIDER_LEFT_OF_ID+this.offers[i].ID), 363 RIGHT: BX(this.visual.SLIDER_RIGHT_OF_ID+this.offers[i].ID), 364 START: 0 365 }; 366 var SliderImgs = BX.findChildren(this.sliders[i].LIST, {tagName: 'li'}, true); 367 if (!!SliderImgs && 0 < SliderImgs.length) 368 { 369 for (j = 0; j < SliderImgs.length; j++) 370 { 371 BX.bind(SliderImgs[j], 'click', BX.delegate(function(e){this.SelectSliderImg(e); }, this)); 372 } 373 } 374 if (!!this.sliders[i].LEFT) 375 BX.bind(this.sliders[i].LEFT, 'click', BX.delegate(function(e){this.SliderRowLeft(e); }, this)); 376 if (!!this.sliders[i].RIGHT) 377 BX.bind(this.sliders[i].RIGHT, 'click', BX.delegate(function(e){this.SliderRowRight(e); }, this)); 378 } 379 } 380 this.SetCurrent(); 381 break; 382 } 383 384 if (!!this.obBuyBtn) 385 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this)); 386 } 387}; 388 389JCCatalogElement.prototype.SliderRowLeft = function(e) 390{ 391 if (!e) e = window.event; 392 var target = BX.proxy_context; 393 if (!!target && target.hasAttribute('data-value')) 394 { 395 var strValue = target.getAttribute('data-value'); 396 var index = -1; 397 for (var i = 0; i < this.sliders.length; i++) 398 { 399 if (this.sliders[i].OFFER_ID == strValue) 400 { 401 index = i; 402 break; 403 } 404 } 405 if (-1 < index && 5 < this.sliders[index].COUNT) 406 { 407 if ((5 - this.sliders[index].START) < this.sliders[index].COUNT) 408 { 409 this.sliders[index].START--; 410 BX.adjust(this.sliders[index].LIST, { style: { marginLeft: this.sliders[index].START*20+'%' }}); 411 } 412 } 413 } 414}; 415 416JCCatalogElement.prototype.SliderRowRight = function(e) 417{ 418 if (!e) e = window.event; 419 var target = BX.proxy_context; 420 if (!!target && target.hasAttribute('data-value')) 421 { 422 var strValue = target.getAttribute('data-value'); 423 var index = -1; 424 for (var i = 0; i < this.sliders.length; i++) 425 { 426 if (this.sliders[i].OFFER_ID == strValue) 427 { 428 index = i; 429 break; 430 } 431 } 432 if (-1 < index && 5 < this.sliders[index].COUNT) 433 { 434 if (0 > this.sliders[index].START) 435 { 436 this.sliders[index].START++; 437 BX.adjust(this.sliders[index].LIST, { style: { marginLeft: this.sliders[index].START*20+'%' }}); 438 } 439 } 440 } 441}; 442 443JCCatalogElement.prototype.SelectSliderImg = function(e) 444{ 445 if (!e) e = window.event; 446 var target = BX.proxy_context; 447 if (!!target && target.hasAttribute('data-value')) 448 { 449 var strValue = target.getAttribute('data-value'); 450 var arItem = strValue.split('_'); 451 this.SetMainPict(arItem[0], arItem[1]); 452 } 453}; 454 455JCCatalogElement.prototype.SetMainPict = function(intSlider, intPict) 456{ 457 var index = -1; 458 var indexPict = -1; 459 var i = 0; 460 var j = 0; 461 for (i = 0; i < this.offers.length; i++) 462 { 463 if (intSlider == this.offers[i].ID) 464 { 465 index = i; 466 break; 467 } 468 } 469 if (-1 < index) 470 { 471 if (0 < this.offers[index].SLIDER_COUNT) 472 { 473 for (j = 0; j < this.offers[index].SLIDER.length; j++) 474 { 475 if (intPict == this.offers[index].SLIDER[j].ID) 476 { 477 indexPict = j; 478 break; 479 } 480 } 481 if (-1 < indexPict) 482 { 483 if (!!this.obPict && !!this.offers[index].SLIDER[indexPict]) 484 { 485 BX.adjust( 486 this.obPict, 487 { 488 props: { 489 src: this.offers[index].SLIDER[indexPict].SRC, 490/* className: (this.offers[index].SLIDER[indexPict].WIDTH > this.offers[index].SLIDER[indexPict].HEIGHT ? 'landscape' : 'portrait') */ 491 className: '' 492 } 493 } 494 ); 495 } 496 var RowItems = BX.findChildren(this.sliders[index].LIST, {tagName: 'li'}, false); 497 if (!!RowItems && 0 < RowItems.length) 498 { 499 var strValue = intSlider+'_'+intPict; 500 for (i = 0; i < RowItems.length; i++) 501 { 502 value = RowItems[i].getAttribute('data-value'); 503 if (value == strValue) 504 BX.addClass(RowItems[i], 'bx_active'); 505 else 506 BX.removeClass(RowItems[i], 'bx_active'); 507 } 508 } 509 } 510 } 511 } 512}; 513 514JCCatalogElement.prototype.SetMainPictFromItem = function(index) 515{ 516 if (!!this.obPict) 517 { 518 var boolSet = false;
519 var obNewPicture = {}; 520 if (!!this.offers[index]) 521 { 522 if (!!this.offers[index].DETAIL_PICTURE) 523 { 524 obNewPict = this.offers[index].DETAIL_PICTURE; 525 boolSet = true; 526 } 527 else if (!!this.offers[index].PREVIEW_PICTURE) 528 { 529 obNewPict = this.offers[index].PREVIEW_PICTURE; 530 boolSet = true; 531 } 532 } 533 if (!boolSet) 534 { 535 if (!!this.defaultPict.detail) 536 { 537 obNewPict = this.defaultPict.detail; 538 boolSet = true; 539 } 540 else if (!!this.defaultPict.preview) 541 { 542 obNewPict = this.defaultPict.preview; 543 boolSet = true; 544 } 545 } 546 if (boolSet) 547 { 548 BX.adjust( 549 this.obPict, 550 { 551 props: { 552 src: obNewPict.SRC, 553 className: (obNewPict.WIDTH > obNewPict.HEIGHT ? 'landscape' : 'portrait') 554 } 555 } 556 ); 557 } 558 } 559}; 560 561JCCatalogElement.prototype.QuantityUp = function() 562{ 563 var curValue = 0; 564 var boolSet = true; 565 if (0 == this.errorCode && this.showQuantity) 566 { 567 curValue = ( 568 this.isDblQuantity 569 ? parseFloat(this.obQuantity.value) 570 : parseInt(this.obQuantity.value) 571 ); 572 if (!isNaN(curValue)) 573 { 574 curValue += this.stepQuantity; 575 if (this.checkQuantity) 576 { 577 if (curValue > this.maxQuantity) 578 boolSet = false; 579 } 580 581 if (boolSet) 582 { 583 this.obQuantity.value = curValue; 584 } 585 } 586 } 587}; 588 589JCCatalogElement.prototype.QuantityDown = function() 590{ 591 var curValue = 0; 592 var boolSet = true; 593 if (0 == this.errorCode && this.showQuantity) 594 { 595 curValue = ( 596 this.isDblQuantity 597 ? parseFloat(this.obQuantity.value) 598 : parseInt(this.obQuantity.value) 599 ); 600 if (!isNaN(curValue)) 601 { 602 curValue -= this.stepQuantity; 603 if (curValue < this.stepQuantity) 604 boolSet = false; 605 if (boolSet) 606 { 607 this.obQuantity.value = curValue; 608 } 609 } 610 } 611}; 612 613JCCatalogElement.prototype.QuantityChange = function() 614{ 615 var curValue = 0; 616 var boolSet = true; 617 if (0 == this.errorCode && this.showQuantity) 618 { 619 curValue = ( 620 this.isDblQuantity 621 ? parseFloat(this.obQuantity.value) 622 : parseInt(this.obQuantity.value) 623 ); 624 if (!isNaN(curValue)) 625 { 626 if (this.checkQuantity) 627 { 628 if (curValue > this.maxQuantity) 629 { 630 boolSet = false; 631 curValue = this.maxQuantity; 632 } 633 else if (curValue < this.stepQuantity) 634 { 635 boolSet = false; 636 curValue = this.stepQuantity; 637 } 638 } 639 if (!boolSet) 640 { 641 this.obQuantity.value = curValue; 642 // 643 } 644 } 645 else 646 { 647 this.obQuantity.value = this.stepQuantity; 648 // 649 } 650 } 651}; 652 653JCCatalogElement.prototype.QuantitySet = function(index) 654{ 655 if (0 == this.errorCode) 656 { 657 this.canBuy = this.offers[index].CAN_BUY; 658 if (this.showQuantity) 659 { 660 this.isDblQuantity = this.offers[index].QUANTITY_FLOAT; 661 this.checkQuantity = this.offers[index].CHECK_QUANTITY; 662 this.maxQuantity = (this.isDblQuantity 663 ? parseFloat(this.offers[index].MAX_QUANTITY) 664 : parseInt(this.offers[index].MAX_QUANTITY) 665 ); 666 this.stepQuantity = (this.isDblQuantity 667 ? parseFloat(this.offers[index].STEP_QUANTITY) 668 : parseInt(this.offers[index].STEP_QUANTITY) 669 ); 670 this.obQuantity.value = this.stepQuantity; 671 if (!!this.obMeasure) 672 { 673 if (!!this.offers[index].MEASURE) 674 { 675 BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE}); 676 } 677 else 678 { 679 BX.adjust(this.obMeasure, { html : ''}); 680 } 681 } 682 if (!!this.obQuantityLimit.all) 683 { 684 if (!this.checkQuantity) 685 { 686 BX.adjust(this.obQuantityLimit.value, { html: '' }); 687 BX.adjust(this.obQuantityLimit.all, { style: {display: 'none'} }); 688 } 689 else 690 { 691 var strLimit = this.offers[index].MAX_QUANTITY; 692 if (!!this.offers[index].MEASURE) 693 strLimit += (' '+this.offers[index].MEASURE); 694 BX.adjust(this.obQuantityLimit.value, { html: strLimit}); 695 BX.adjust(this.obQuantityLimit.all, { style: {display: ''} }); 696 } 697 } 698 } 699 } 700}; 701 702JCCatalogElement.prototype.SelectOfferProp = function(e) 703{ 704 if (!e) e = window.event; 705 var target = BX.proxy_context; 706 if (!!target && target.hasAttribute('data-treevalue')) 707 { 708 var strTreeValue = target.getAttribute('data-treevalue'); 709 var arTreeItem = strTreeValue.split('_'); 710 this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]); 711 var RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 712 if (!!RowItems && 0 < RowItems.length) 713 { 714 for (i = 0; i < RowItems.length; i++) 715 { 716 BX.removeClass(RowItems[i], 'bx_active'); 717 } 718 } 719 BX.addClass(target, 'bx_active'); 720 } 721}; 722 723JCCatalogElement.prototype.SearchOfferPropIndex = function(strPropID, strPropValue) 724{ 725 var index = -1; 726 for (var i = 0; i < this.treeProps.length; i++) 727 { 728 if (this.treeProps[i].ID == strPropID) 729 { 730 index = i; 731 break; 732 } 733 } 734 735 if (-1 < index) 736 { 737 var arFilter = {}; 738 for (i = 0; i < index; i++) 739 { 740 var strName = 'PROP_'+this.treeProps[i].ID; 741 arFilter[strName] = this.selectedValues[strName]; 742 } 743 var strName = 'PROP_'+this.treeProps[index].ID; 744 arFilter[strName] = strPropValue; 745 for (i = index+1; i < this.treeProps.length; i++) 746 { 747 strName = 'PROP_'+this.treeProps[i].ID; 748 var arShowValues = this.GetRowValues(arFilter, strName); 749 if (!arShowValues) 750 break;
751 if (this.showAbsent) 752 { 753 var arCanBuyValues = []; 754 var tmpFilter = []; 755 tmpFilter = BX.clone(arFilter, true); 756 for (var j = 0; j < arShowValues.length; j++) 757 { 758 tmpFilter[strName] = arShowValues[j]; 759 if (this.GetCanBuy(tmpFilter)) 760 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 761 } 762 } 763 else 764 { 765 var arCanBuyValues = arShowValues; 766 } 767 if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues)) 768 arFilter[strName] = this.selectedValues[strName]; 769 else 770 arFilter[strName] = arCanBuyValues[0]; 771 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 772 } 773 this.selectedValues = arFilter; 774 this.ChangeInfo(); 775 } 776}; 777 778JCCatalogElement.prototype.RowLeft = function(e) 779{ 780 if (!e) e = window.event; 781 var target = BX.proxy_context; 782 if (!!target && target.hasAttribute('data-treevalue')) 783 { 784 var strTreeValue = target.getAttribute('data-treevalue'); 785 var index = -1; 786 for (var i = 0; i < this.treeProps.length; i++) 787 { 788 if (this.treeProps[i].ID == strTreeValue) 789 { 790 index = i; 791 break; 792 } 793 } 794 if (-1 < index && 5 < this.showCount[index]) 795 { 796 if ((5 - this.showStart[index]) < this.showCount[index]) 797 { 798 this.showStart[index]--; 799 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 800 } 801 } 802 } 803}; 804 805JCCatalogElement.prototype.RowRight = function(e) 806{ 807 if (!e) e = window.event; 808 var target = BX.proxy_context; 809 if (!!target && target.hasAttribute('data-treevalue')) 810 { 811 var strTreeValue = target.getAttribute('data-treevalue'); 812 var index = -1; 813 for (var i = 0; i < this.treeProps.length; i++) 814 { 815 if (this.treeProps[i].ID == strTreeValue) 816 { 817 index = i; 818 break; 819 } 820 } 821 if (-1 < index && 5 < this.showCount[index]) 822 { 823 if (0 > this.showStart[index]) 824 { 825 this.showStart[index]++; 826 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 827 } 828 } 829 } 830}; 831 832JCCatalogElement.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID) 833{ 834 var i = 0; 835 var value; 836 var countShow = 0; 837 var strNewLen = ''; 838 if (-1 < intNumber && intNumber < this.obTreeRows.length) 839 { 840 var RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false); 841 if (!!RowItems && 0 < RowItems.length) 842 { 843 countShow = showID.length; 844 strNewLen = (5 < countShow ? (100/countShow)+'%' : '20%'); 845 obData = { 846 props: { className: '' }, 847 style: { 848 width: strNewLen 849 } 850 }; 851 if ('E' == this.treeProps[intNumber].TYPE) 852 obData.style.paddingTop = strNewLen; 853 for (i = 0; i < RowItems.length; i++) 854 { 855 value = RowItems[i].getAttribute('data-onevalue'); 856 if (BX.util.in_array(value, canBuyID)) 857 { 858 if (value == activeID) 859 obData.props.className = 'bx_active'; 860 else 861 obData.props.className = ''; 862 } 863 else 864 { 865 if (value == activeID) 866 obData.props.className = 'bx_active bx_missing'; 867 else 868 obData.props.className = 'bx_missing'; 869 } 870 if (BX.util.in_array(value, showID)) 871 obData.style.display = ''; 872 else 873 obData.style.display = 'none'; 874 BX.adjust(RowItems[i], obData); 875 } 876 obData = { 877 style: { 878 width: (5 < countShow ? 20*countShow : 100)+'%', 879 marginLeft: '0%' 880 } 881 }; 882 BX.adjust(this.obTreeRows[intNumber].LIST, obData); 883 if ('E' == this.treeProps[intNumber].TYPE) 884 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}}); 885 else 886 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_size full' : 'bx_item_detail_size')}}); 887 if (5 < countShow) 888 { 889 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: ''}}); 890 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: ''}}); 891 } 892 else 893 { 894 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}}); 895 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}}); 896 } 897 this.showCount[intNumber] = countShow; 898 this.showStart[intNumber] = 0; 899 } 900 } 901}; 902 903JCCatalogElement.prototype.GetRowValues = function(arFilter, index) 904{ 905 var arValues = []; 906 var boolSearch = false;
907 if (0 == arFilter.length) 908 { 909 for (var i = 0; i < this.offers.length; i++) 910 { 911 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 912 arValues[arValues.length] = this.offers[i].TREE[index]; 913 } 914 boolSearch = true; 915 } 916 else 917 { 918 for (var i = 0; i < this.offers.length; i++) 919 { 920 var boolOneSearch = true; 921 for (var j in arFilter) 922 { 923 if (arFilter[j] != this.offers[i].TREE[j]) 924 { 925 boolOneSearch = false; 926 break; 927 } 928 } 929 if (boolOneSearch) 930 { 931 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 932 arValues[arValues.length] = this.offers[i].TREE[index]; 933 boolSearch = true; 934 } 935 } 936 } 937 return (boolSearch ? arValues : false); 938}; 939 940JCCatalogElement.prototype.GetCanBuy = function(arFilter) 941{ 942 var boolSearch = false; 943 for (var i = 0; i < this.offers.length; i++) 944 { 945 var boolOneSearch = true; 946 for (var j in arFilter) 947 { 948 if (arFilter[j] != this.offers[i].TREE[j]) 949 { 950 boolOneSearch = false; 951 break; 952 } 953 } 954 if (boolOneSearch) 955 { 956 if (this.offers[i].CAN_BUY) 957 { 958 boolSearch = true; 959 break; 960 } 961 } 962 } 963 return boolSearch; 964}; 965 966JCCatalogElement.prototype.SetCurrent = function() 967{ 968 var arFilter = {}; 969 var current = this.offers[this.offerNum].TREE; 970 for (var i = 0; i < this.treeProps.length; i++) 971 { 972 var strName = 'PROP_'+this.treeProps[i].ID; 973 var arShowValues = this.GetRowValues(arFilter, strName); 974 if (!arShowValues) 975 break; 976 if (BX.util.in_array(current[strName], arShowValues)) 977 { 978 arFilter[strName] = current[strName]; 979 } 980 else 981 { 982 arFilter[strName] = arShowValues[0]; 983 this.offerNum = 0; 984 } 985 if (this.showAbsent) 986 { 987 var arCanBuyValues = []; 988 var tmpFilter = []; 989 tmpFilter = BX.clone(arFilter, true); 990 for (var j = 0; j < arShowValues.length; j++) 991 { 992 tmpFilter[strName] = arShowValues[j]; 993 if (this.GetCanBuy(tmpFilter)) 994 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 995 } 996 } 997 else 998 { 999 var arCanBuyValues = arShowValues; 1000 } 1001 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 1002 } 1003 this.selectedValues = arFilter; 1004 this.ChangeInfo(); 1005}; 1006 1007JCCatalogElement.prototype.ChangeInfo = function() 1008{ 1009 var index = -1; 1010 for (var i = 0; i < this.offers.length; i++) 1011 { 1012 var boolOneSearch = true; 1013 for (var j in this.selectedValues) 1014 { 1015 if (this.selectedValues[j] != this.offers[i].TREE[j]) 1016 { 1017 boolOneSearch = false; 1018 break; 1019 } 1020 } 1021 if (boolOneSearch) 1022 { 1023 index = i; 1024 break; 1025 } 1026 } 1027 if (-1 < index) 1028 { 1029 if (!!this.obPrice.price) 1030 { 1031 BX.adjust(this.obPrice.price, {html: this.offers[index].PRICE.PRINT_DISCOUNT_VALUE}); 1032 if (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE) 1033 { 1034 if (this.showOldPrice) 1035 { 1036 if (!!this.obPrice.full) 1037 BX.adjust(this.obPrice.full, {style: {display: ''}, html: this.offers[index].PRICE.PRINT_VALUE}); 1038 if (!!this.obPrice.discount) 1039 BX.adjust(this.obPrice.discount, {style: {display: ''}, html: this.offers[index].PRICE.PRINT_DISCOUNT_DIFF}); 1040 } 1041 if (this.showPercent) 1042 { 1043 if (!!this.obPrice.percent) 1044 BX.adjust(this.obPrice.percent, {style: {display: ''}, html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT+'%'}); 1045 } 1046 } 1047 else 1048 { 1049 if (this.showOldPrice) 1050 { 1051 if (!!this.obPrice.full) 1052 BX.adjust(this.obPrice.full, {style: {display: 'none'}, html: ''}); 1053 if (!!this.obPrice.discount) 1054 BX.adjust(this.obPrice.discount, {style: {display: 'none'}, html: ''}); 1055 } 1056 if (this.showPercent) 1057 { 1058 if (!!this.obPrice.percent) 1059 BX.adjust(this.obPrice.percent, {style: {display: 'none'}, html: ''}); 1060 } 1061 } 1062 } 1063 for (i = 0; i < this.offers.length; i++) 1064 { 1065 if (this.showOfferGroup && this.offers[i].OFFER_GROUP) 1066 { 1067 if (i != index) 1068 { 1069 BX.adjust(BX(this.visual.OFFER_GROUP+this.offers[i].ID), { style: {display: 'none'} }); 1070 } 1071 } 1072 if ('' == this.sliders[i].ID) 1073 continue; 1074 if (i == index) 1075 { 1076 this.sliders[i].START = 0; 1077 BX.adjust(this.sliders[i].LIST, {style: { marginLeft: '0%' }}); 1078 BX.adjust(this.sliders[i].CONT, {style: { display: ''}}); 1079 } 1080 else 1081 { 1082 BX.adjust(this.sliders[i].CONT, {style: { display: 'none'}}); 1083 } 1084 } 1085 if (this.showOfferGroup && this.offers[index].OFFER_GROUP) 1086 { 1087 BX.adjust(BX(this.visual.OFFER_GROUP+this.offers[index].ID), { style: {display: ''} }); 1088 } 1089 if (0 < this.offers[index].SLIDER_COUNT) 1090 { 1091 this.SetMainPict(this.offers[index].ID, this.offers[index].SLIDER[0].ID); 1092 } 1093 else 1094 { 1095 this.SetMainPictFromItem(index); 1096 } 1097 if (this.showSkuProps && !!this.obSkuProps) 1098 { 1099 if (0 == this.offers[index].DISPLAY_PROPERTIES.length) 1100 { 1101 BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''}); 1102 } 1103 else 1104 {
1105 BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES}); 1106 } 1107 } 1108 this.offerNum = index; 1109 if (this.showQuantity) 1110 { 1111 this.QuantitySet(this.offerNum); 1112 } 1113 BX.onCustomEvent('onCatalogStoreProductChange', [this.offers[this.offerNum].ID]); 1114 } 1115}; 1116 1117JCCatalogElement.prototype.Basket = function() 1118{ 1119 if (!this.canBuy) 1120 return; 1121 1122 switch (this.productType) 1123 { 1124 case 1://product 1125 case 2://set 1126 var strBasket = this.product.buyUrl; 1127 if (this.showQuantity) 1128 strBasket += '&quantity='+this.obQuantity.value; 1129 location.href=strBasket; 1130 break; 1131 case 3://sku 1132 var strBasket = this.offers[this.offerNum].BUY_URL; 1133 if (this.showQuantity) 1134 strBasket += '&quantity='+this.obQuantity.value; 1135 location.href=strBasket; 1136 break; 1137 default: 1138 return; 1139 } 1140}; 1141 1142JCCatalogElement.prototype.ShowBasketPopup = function(arResult) 1143{ 1144 var strContent = ''; 1145 if ('object' == typeof(arResult)) 1146 { 1147 if ('OK' == arResult.STATUS) 1148 { 1149 strName = ''; 1150 strPict = ''; 1151 switch(this.productType) 1152 { 1153 case 1:// 1154 case 2: 1155 strName = this.product.name; 1156 strPict = this.product.pict.SRC; 1157 break; 1158 case 3: 1159 strName = this.offers[this.offerNum].NAME; 1160 strPict = this.offers[this.offerNum].PICT.SRC; 1161 break; 1162 } 1163 strContent = '<p>'+BX.message('ADD_TO_BASKET_OK')+'</p>'; 1164 strContent += '<img src="'+strPict+'" height="130"><p>'+strName+'</p>'; 1165 } 1166 else 1167 { 1168 1169 } 1170 } 1171 else 1172 { 1173 1174 } 1175 var popup = BX.PopupWindowManager.create('CatalogSectionBasket'+this.visual.ID, null, { 1176 autoHide: false, 1177 // zIndex: 0, 1178 offsetLeft: 0, 1179 offsetTop: 0, 1180 overlay : true, 1181 draggable: {restrict:true}, 1182 closeByEsc: true, 1183 closeIcon: { right : "12px", top : "10px"}, 1184 content: '' + 1185 '<div style="width:300px;text-align: center;padding-top:5px; margin-bottom: 10px;">' + 1186 strContent+ 1187 '<a class="bx_bt_blue bx_medium" href="'+BX.message("setButtonBuyUrl")+'"><span class="bx_icon_cart"></span><span>'+BX.message("setButtonBuyName")+'</span></a>'+ 1188 '</div>' 1189 }); 1190 1191 popup.show(); 1192}; 1193 1194JCCatalogElementZoom = function(arParams) 1195{ 1196 1197}; 1198 1199JCCatalogElementZoom.prototype.Init = function() 1200{ 1201 1202}; 1203 1204JCCatalogElementZoom.prototype.SetPict = function(arPict) 1205{ 1206 1207}; 1208 1209JCCatalogElementZoom.prototype.Show = function(e) 1210{ 1211 1212}; 1213/* End */ 1214; 1215; /* Start:"a:4:{s:4:"full";s:90:"/bitrix/components/bitrix/catalog.comments/templates/.default/script.min.js?17156286245833";s:6:"source";s:71:"/bitrix/components/bitrix/catalog.comments/templates/.default/script.js";s:3:"min";s:75:"/bitrix/components/bitrix/catalog.comments/templates/.default/script.min.js";s:3:"map";s:75:"/bitrix/components/bitrix/catalog.comments/templates/.default/script.map.js";}"*/ 1216(function(t){if(!!t.JCCatalogSocnetsComments){return}t.JCCatalogSocnetsComments=function(t){var s;this.errorCode=0;this.params={};this.serviceList={blog:false,facebook:false,vk:false};this.settings={blog:{ajaxUrl:"",ajaxParams:{},contID:"bx-cat-soc-comments-blg"},facebook:{contID:"bx-cat-soc-comments-fb",contWidthID:"",parentContID:"soc_comments",facebookJSDK:"facebook-jssdk",facebookPath:""},vk:{}};this.services={blog:{obBlogCont:null},facebook:{obFBCont:null,obFBContWidth:null,obFBParentCont:null,obFBjSDK:null,currentWidth:0}};this.activeTabId="";this.currentTab=-1;this.tabsContId="";this.tabList=[];this.obTabList=[];if(typeof t==="object"){this.params=t;if(!!this.params.serviceList&&typeof this.params.serviceList==="object"){for(s in this.serviceList){if(this.serviceList.hasOwnProperty(s)&&!!this.params.serviceList[s])this.serviceList[s]=true}}if(this.serviceList.blog)this.initParams("blog");if(this.serviceList.facebook)this.initParams("facebook");if(typeof this.params.tabs==="object"){this.activeTabId=this.params.tabs.activeTabId;this.tabsContId=this.params.tabs.tabsContId;this.tabList=this.params.tabs.tabList}}else{this.errorCode=-1}if(this.errorCode===0)BX.ready(BX.proxy(this.Init,this))};t.JCCatalogSocnetsComments.prototype.initParams=function(t){var s;if(!!this.params.settings&&typeof this.params.settings==="object"&&typeof this.params.settings[t]==="object"){for(s in this.settings[t]){if(this.settings[t].hasOwnProperty(s)&&!!this.params.settings[t][s])this.settings[t][s]=this.params.settings[t][s]}}};t.JCCatalogSocnetsComments.prototype.Init=function(){if(!this.tabList||!BX.type.isArray(this.tabList)||this.tabList.length===0){this.errorCode=-1;return}var t,s;for(t=0;t<this.tabList.length;t++){s=this.tabsContId+this.tabList[t];this.obTabList[t]={id:this.tabList[t],tabId:s,contId:s+"_cont",tab:BX(s),cont:BX(s+"_cont")};if(!this.obTabList[t].tab||!this.obTabList[t].cont){this.errorCode=-2;break}if(this.activeTabId===this.tabList[t])this.currentTab=t;BX.bind(this.obTabList[t].tab,"click",BX.proxy(this.onClick,this))}if(this.serviceList.blog){this.services.blog.obBlogCont=BX(this.settings.blog.contID);if(!this.services.blog.obBlogCont){this.serviceList.blog=false;this.errorCode=-16}}if(this.serviceList.facebook){this.services.facebook.obFBCont=BX(this.settings.facebook.contID);if(!this.services.facebook.obFBCont){this.serviceList.facebook=false;this.errorCode=-32}else{this.services.facebook.obFBContWidth=this.services.facebook.obFBCont.firstChild}this.services.facebook.obFBParentCont=BX(this.settings.facebook.parentContID)}if(this.errorCode===0){this.showActiveTab();if(this.serviceList.blog)this.loadBlog();if(this.serviceList.facebook)this.loadFB()}this.params={}};t.JCCatalogSocnetsComments.prototype.loadBlog=function(){var t;if(this.errorCode!==0||!this.serviceList.blog||this.settings.blog.ajaxUrl.length===0){return}t=this.settings.blog.ajaxParams;t.sessid=BX.bitrix_sessid();
1216BX.ajax({timeout:30,method:"POST",dataType:"html",url:this.settings.blog.ajaxUrl,data:t,onsuccess:BX.proxy(this.loadBlogResult,this)})};t.JCCatalogSocnetsComments.prototype.loadBlogResult=function(t){if(BX.type.isNotEmptyString(t))BX.adjust(this.services.blog.obBlogCont,{html:t})};t.JCCatalogSocnetsComments.prototype.loadFB=function(){var t;if(this.services.facebook.obFBParentCont&&this.services.facebook.obFBContWidth){t=parseInt(this.services.facebook.obFBParentCont.offsetWidth,10);if(!isNaN(t)&&t>20){BX.adjust(this.services.facebook.obFBContWidth,{attrs:{"data-width":t-20}});this.services.facebook.currentWidth=t}if(!this.services.facebook.obFBjSDK){this.services.facebook.obFBjSDK=true;BX.defer(BX.proxy(function(t,s,i,o){var e,a=t.getElementsByTagName(s)[0];if(t.getElementById(i)){return}e=t.createElement(s);e.id=i;e.src=o;a.parentNode.insertBefore(e,a)}(document,"script",this.settings.facebook.facebookJSDK,this.settings.facebook.facebookPath),this))}}};t.JCCatalogSocnetsComments.prototype.getFBParentWidth=function(){var t=0;if(!!this.services.facebook.obFBParentCont){t=parseInt(this.services.facebook.obFBParentCont.offsetWidth,10);if(isNaN(t))t=0}return t};t.JCCatalogSocnetsComments.prototype.setFBWidth=function(t){var s=null,i,o;if(this.serviceList.facebook&&this.services.facebook.currentWidth!==t&&t>20&&!!this.services.facebook.obFBContWidth){if(!!this.services.facebook.obFBContWidth.firstChild&&!!this.services.facebook.obFBContWidth.firstChild.fitrstChild){s=this.services.facebook.obFBContWidth.firstChild.fitrstChild;if(!!s){i=s.getAttribute("src");o=i.replace(/width=(\d+)/gi,"width="+t);BX.adjust(this.services.facebook.obFBContWidth,{attrs:{"data-width":t-20}});this.services.facebook.currentWidth=t;BX.style(this.services.facebook.obFBContWidth.firstChild,"width",t+"px");BX.adjust(s,{attrs:{src:o},style:{width:t+"px"}})}}}};t.JCCatalogSocnetsComments.prototype.onResize=function(){if(this.serviceList.facebook)this.setFBWidth(this.getFBParentWidth())};t.JCCatalogSocnetsComments.prototype.onClick=function(){var t=BX.proxy_context,s=-1,i;for(i=0;i<this.obTabList.length;i++){if(t.id===this.obTabList[i].tabId){s=i;break}}if(s>-1){if(s!==this.currentTab){this.hideActiveTab();this.currentTab=s;this.showActiveTab()}}};t.JCCatalogSocnetsComments.prototype.hideActiveTab=function(){BX.removeClass(this.obTabList[this.currentTab].tab,"active");BX.addClass(this.obTabList[this.currentTab].cont,"tab-off");BX.addClass(this.obTabList[this.currentTab].cont,"hidden")};t.JCCatalogSocnetsComments.prototype.showActiveTab=function(){BX.onCustomEvent("onAfterBXCatTabsSetActive_"+this.tabsContId,[{activeTab:this.obTabList[this.currentTab].id}]);BX.addClass(this.obTabList[this.currentTab].tab,"active");BX.removeClass(this.obTabList[this.currentTab].cont,"tab-off");BX.removeClass(this.obTabList[this.currentTab].cont,"hidden")}})(window); 1217/* End */ 1218; 1219; /* Start:"a:4:{s:4:"full";
1219s:101:"/bitrix/templates/aura-flowers-new/components/bitrix/catalog.section/slider/script.js?171562863322217";s:6:"source";s:85:"/bitrix/templates/aura-flowers-new/components/bitrix/catalog.section/slider/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 1220JCCatalogSection = function (arParams) 1221{ 1222 this.productType = 0; 1223 this.showQuantity = true; 1224 this.showAbsent = true; 1225 this.secondPict = false; 1226 this.showOldPrice = false; 1227 this.showPercent = false; 1228 this.showSkuProps = false; 1229 this.visual = { 1230 ID: '', 1231 PICT_ID: '', 1232 SECOND_PICT_ID: '', 1233 QUANTITY_ID: '', 1234 QUANTITY_UP_ID: '', 1235 QUANTITY_DOWN_ID: '', 1236 PRICE_ID: '', 1237 DSC_PERC: '', 1238 SECOND_DSC_PERC: '', 1239 DISPLAY_PROP_DIV: '' 1240 }; 1241 this.product = { 1242 checkQuantity: false, 1243 maxQuantity: 0, 1244 stepQuantity: 1, 1245 isDblQuantity: false, 1246 canBuy: true, 1247 canSubscription: true, 1248 name: '', 1249 pict: {}, 1250 id: 0 1251 }; 1252 1253 this.defaultPict = { 1254 pict: null, 1255 secondPict: null 1256 }; 1257 1258 this.ajaxPath = ''; 1259 1260 this.checkQuantity = false; 1261 this.maxQuantity = 0; 1262 this.stepQuantity = 1; 1263 this.isDblQuantity = false; 1264 this.canBuy = true; 1265 this.canSubscription = true; 1266 1267 this.offers = []; 1268 this.offerNum = 0; 1269 this.treeProps = []; 1270 this.obTreeRows = []; 1271 this.showCount = []; 1272 this.showStart = []; 1273 this.selectedValues = {}; 1274 1275 this.obProduct = null; 1276 this.obQuantity = null; 1277 this.obQuantityUp = null; 1278 this.obQuantityDown = null; 1279 this.obPict = null; 1280 this.obSecondPict = null; 1281 this.obPrice = null; 1282 this.obTree = null; 1283 this.obBuyBtn = null; 1284 this.obDscPerc = null; 1285 this.obSecondDscPerc = null; 1286 this.obSkuProps = null; 1287 this.obMeasure = null; 1288 1289 this.errorCode = 0; 1290 1291 if ('object' == typeof(arParams)) 1292 { 1293 this.productType = parseInt(arParams.PRODUCT_TYPE); 1294 this.showQuantity = arParams.SHOW_QUANTITY; 1295 this.showAbsent = arParams.SHOW_ABSENT; 1296 if (!!arParams.SECOND_PICT) 1297 this.secondPict = true; 1298 if (!!arParams.SHOW_OLD_PRICE) 1299 this.showOldPrice = true; 1300 if (!!arParams.SHOW_DISCOUNT_PERCENT) 1301 this.showPercent = true; 1302 if (!!arParams.SHOW_SKU_PROPS) 1303 this.showSkuProps = true; 1304 this.visual = arParams.VISUAL; 1305 this.ajaxPath = arParams.AJAX_PATH; 1306 switch (this.productType) 1307 { 1308 case 1://product 1309 case 2://set 1310 if (!!arParams.PRODUCT && 'object' == typeof(arParams.PRODUCT)) 1311 { 1312 if (this.showQuantity) 1313 { 1314 this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY; 1315 this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT; 1316 if (this.product.checkQuantity) 1317 this.product.maxQuantity = (this.product.isDblQuantity 1318 ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) 1319 : parseInt(arParams.PRODUCT.MAX_QUANTITY) 1320 ); 1321 this.product.stepQuantity = (this.product.isDblQuantity 1322 ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) 1323 : parseInt(arParams.PRODUCT.STEP_QUANTITY) 1324 ); 1325 1326 this.checkQuantity = this.product.checkQuantity; 1327 this.isDblQuantity = this.product.isDblQuantity; 1328 this.maxQuantity = this.product.maxQuantity; 1329 this.stepQuantity = this.product.stepQuantity; 1330 } 1331 this.product.canBuy = arParams.PRODUCT.CAN_BUY; 1332 this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION; 1333 1334 this.canBuy = this.product.canBuy; 1335 this.canSubscription = this.product.canSubscription; 1336 1337 this.product.name = arParams.PRODUCT.NAME; 1338 this.product.pict = arParams.PRODUCT.PICT; 1339 this.product.id = arParams.PRODUCT.ID; 1340 } 1341 else 1342 { 1343 this.errorCode = -1; 1344 } 1345 break; 1346 case 3://sku 1347 if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) 1348 { 1349 this.offers = arParams.OFFERS; 1350 this.offerNum = 0; 1351 if (!!arParams.OFFER_SELECTED) 1352 this.offerNum = parseInt(arParams.OFFER_SELECTED); 1353 if (isNaN(this.offerNum)) 1354 this.offerNum = 0; 1355 if (!!arParams.TREE_PROPS) 1356 this.treeProps = arParams.TREE_PROPS; 1357 if (!!arParams.DEFAULT_PICTURE) 1358 { 1359 this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE; 1360 this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND; 1361 } 1362 } 1363 else 1364 { 1365 this.errorCode = -1; 1366 } 1367 break; 1368 default: 1369 this.errorCode = -1; 1370 } 1371 } 1372 if (0 == this.errorCode) 1373 { 1374 BX.ready(BX.delegate(this.Init,this)); 1375 } 1376}; 1377 1378JCCatalogSection.prototype.Init = function() 1379{ 1380 var i = 0; 1381 this.obProduct = BX(this.visual.ID); 1382 if (!this.obProduct) 1383 this.errorCode = -1; 1384 this.obPict = BX(this.visual.PICT_ID); 1385 if (!this.obPict) 1386 this.errorCode = -2; 1387 if (this.secondPict && !!this.visual.SECOND_PICT_ID) 1388 { 1389 this.obSecondPict = BX(this.visual.SECOND_PICT_ID); 1390 } 1391 this.obPrice = BX(this.visual.PRICE_ID); 1392 if (!this.obPrice) 1393 this.errorCode = -16; 1394 if (this.showQuantity && !!this.visual.QUANTITY_ID) 1395 { 1396 this.obQuantity = BX(this.visual.QUANTITY_ID); 1397 if (!this.obQuantity) 1398 this.errorCode = -32; 1399 if (!!this.visual.QUANTITY_UP_ID) 1400 { 1401 this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID); 1402 if (!this.obQuantityUp) 1403 this.errorCode = -64; 1404 } 1405 if (!!this.visual.QUANTITY_DOWN_ID) 1406 { 1407 this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID); 1408 if (!this.obQuantityDown) 1409 this.errorCode = -128; 1410 } 1411 } 1412 if (3 == this.productType) 1413 { 1414 if (!!this.visual.TREE_ID) 1415 { 1416 this.obTree = BX(this.visual.TREE_ID); 1417 if (!this.obTree) 1418 this.errorCode = -256; 1419 var strPrefix = this.visual.TREE_ITEM_ID; 1420 for (i = 0; i < this.treeProps.length; i++) 1421 { 1422 this.obTreeRows[i] = { 1423 LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'), 1424 RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'), 1425 LIST: BX(strPrefix+this.treeProps[i].ID+'_list'), 1426 CONT: BX(strPrefix+this.treeProps[i].ID+'_cont') 1427 }; 1428 if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT) 1429 { 1430 this.errorCode = -512; 1431 break; 1432 } 1433 } 1434 } 1435 if (!!this.visual.QUANTITY_MEASURE) 1436 { 1437 this.obMeasure = BX(this.visual.QUANTITY_MEASURE); 1438 } 1439 } 1440 if (!!this.visual.BUY_ID) 1441 { 1442 this.obBuyBtn = BX(this.visual.BUY_ID); 1443 if (!this.obBuyBtn) 1444 { 1445 1446 } 1447 } 1448 1449 if (this.showPercent) 1450 { 1451 if (!!this.visual.DSC_PERC) 1452 { 1453 this.obDscPerc = BX(this.visual.DSC_PERC); 1454 } 1455 if (this.secondPict && !!this.visual.SECOND_DSC_PERC) 1456 { 1457 this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC); 1458 } 1459 } 1460 1461 if (this.showSkuProps) 1462 { 1463 if (!!this.visual.DISPLAY_PROP_DIV) 1464 { 1465 this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV); 1466 } 1467 } 1468 1469 if (0 == this.errorCode) 1470 { 1471 if (this.showQuantity) 1472 { 1473 BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this)); 1474 BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this)); 1475 BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this)); 1476 } 1477 switch (this.productType) 1478 { 1479 case 1://product 1480 break; 1481 case 3://sku 1482 var TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true); 1483 if (!!TreeItems && 0 < TreeItems.length) 1484 { 1485 for (i = 0; i < TreeItems.length; i++) 1486 { 1487 BX.bind(TreeItems[i], 'click', BX.delegate(function(e){this.SelectOfferProp(e); }, this)); 1488 } 1489 } 1490 for (i = 0; i < this.obTreeRows.length; i++) 1491 { 1492 BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(function(e){this.RowLeft(e); }, this)); 1493 BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(function(e){this.RowRight(e); }, this)); 1494 } 1495 this.SetCurrent(); 1496 break; 1497 } 1498 if (!!this.obBuyBtn) 1499 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this)); 1500 } 1501}; 1502 1503JCCatalogSection.prototype.QuantityUp = function() 1504{ 1505 var curValue = 0; 1506 var boolSet = true; 1507 if (0 == this.errorCode && this.showQuantity) 1508 { 1509 curValue = ( 1510 this.isDblQuantity 1511 ? parseFloat(this.obQuantity.value) 1512 : parseInt(this.obQuantity.value) 1513 ); 1514 if (!isNaN(curValue)) 1515 { 1516 curValue += this.stepQuantity; 1517 if (this.checkQuantity) 1518 { 1519 if (curValue > this.maxQuantity) 1520 boolSet = false;
1521 } 1522 if (boolSet) 1523 { 1524 this.obQuantity.value = curValue; 1525 } 1526 } 1527 } 1528}; 1529 1530JCCatalogSection.prototype.QuantityDown = function() 1531{ 1532 var curValue = 0; 1533 var boolSet = true; 1534 if (0 == this.errorCode && this.showQuantity) 1535 { 1536 curValue = ( 1537 this.isDblQuantity 1538 ? parseFloat(this.obQuantity.value) 1539 : parseInt(this.obQuantity.value) 1540 ); 1541 if (!isNaN(curValue)) 1542 { 1543 curValue -= this.stepQuantity; 1544 if (curValue < this.stepQuantity) 1545 boolSet = false; 1546 if (boolSet) 1547 { 1548 this.obQuantity.value = curValue; 1549 } 1550 } 1551 } 1552}; 1553 1554JCCatalogSection.prototype.QuantityChange = function() 1555{ 1556 var curValue = 0; 1557 var boolSet = true; 1558 if (0 == this.errorCode && this.showQuantity) 1559 { 1560 curValue = ( 1561 this.isDblQuantity 1562 ? parseFloat(this.obQuantity.value) 1563 : parseInt(this.obQuantity.value) 1564 ); 1565 if (!isNaN(curValue)) 1566 { 1567 if (this.checkQuantity) 1568 { 1569 if (curValue > this.maxQuantity) 1570 { 1571 boolSet = false; 1572 curValue = this.maxQuantity; 1573 } 1574 else if (curValue < this.stepQuantity) 1575 { 1576 boolSet = false; 1577 curValue = this.stepQuantity; 1578 } 1579 } 1580 if (!boolSet) 1581 { 1582 this.obQuantity.value = curValue; 1583 // 1584 } 1585 } 1586 else 1587 { 1588 this.obQuantity.value = this.stepQuantity; 1589 // 1590 } 1591 } 1592}; 1593 1594JCCatalogSection.prototype.QuantitySet = function(index) 1595{ 1596 if (0 == this.errorCode) 1597 { 1598 this.canBuy = this.offers[index].CAN_BUY; 1599 if (this.showQuantity) 1600 { 1601 this.isDblQuantity = this.offers[index].QUANTITY_FLOAT; 1602 this.checkQuantity = this.offers[index].CHECK_QUANTITY; 1603 this.maxQuantity = (this.isDblQuantity 1604 ? parseFloat(this.offers[index].MAX_QUANTITY) 1605 : parseInt(this.offers[index].MAX_QUANTITY) 1606 ); 1607 this.stepQuantity = (this.isDblQuantity 1608 ? parseFloat(this.offers[index].STEP_QUANTITY) 1609 : parseInt(this.offers[index].STEP_QUANTITY) 1610 ); 1611 this.obQuantity.value = this.stepQuantity; 1612 if (!!this.obMeasure) 1613 { 1614 if (!!this.offers[index].MEASURE) 1615 { 1616 BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE}); 1617 } 1618 else 1619 { 1620 BX.adjust(this.obMeasure, { html : ''}); 1621 } 1622 } 1623 } 1624 } 1625}; 1626 1627JCCatalogSection.prototype.SelectOfferProp = function(e) 1628{ 1629 if (!e) e = window.event; 1630 var target = BX.proxy_context; 1631 if (!!target && target.hasAttribute('data-treevalue')) 1632 { 1633 var strTreeValue = target.getAttribute('data-treevalue'); 1634 var arTreeItem = strTreeValue.split('_'); 1635 if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1])) 1636 { 1637 var RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 1638 if (!!RowItems && 0 < RowItems.length) 1639 { 1640 for (i = 0; i < RowItems.length; i++) 1641 { 1642 value = RowItems[i].getAttribute('data-onevalue'); 1643 if (value == arTreeItem[1]) 1644 BX.addClass(RowItems[i], 'bx_active'); 1645 else 1646 BX.removeClass(RowItems[i], 'bx_active'); 1647 } 1648 } 1649 } 1650 } 1651}; 1652 1653JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue) 1654{ 1655 var index = -1; 1656 for (var i = 0; i < this.treeProps.length; i++) 1657 { 1658 if (this.treeProps[i].ID == strPropID) 1659 { 1660 index = i; 1661 break; 1662 } 1663 } 1664 1665 if (-1 < index) 1666 { 1667 var arFilter = {}; 1668 for (i = 0; i < index; i++) 1669 { 1670 var strName = 'PROP_'+this.treeProps[i].ID; 1671 arFilter[strName] = this.selectedValues[strName]; 1672 } 1673 var strName = 'PROP_'+this.treeProps[index].ID; 1674 var arShowValues = this.GetRowValues(arFilter, strName); 1675 if (!arShowValues) 1676 return false; 1677 if (!BX.util.in_array(strPropValue, arShowValues)) 1678 return false; 1679 arFilter[strName] = strPropValue; 1680 for (i = index+1; i < this.treeProps.length; i++) 1681 { 1682 strName = 'PROP_'+this.treeProps[i].ID; 1683 var arShowValues = this.GetRowValues(arFilter, strName); 1684 if (!arShowValues) 1685 return false; 1686 if (this.showAbsent) 1687 { 1688 var arCanBuyValues = []; 1689 var tmpFilter = []; 1690 tmpFilter = BX.clone(arFilter, true); 1691 for (var j = 0; j < arShowValues.length; j++) 1692 { 1693 tmpFilter[strName] = arShowValues[j]; 1694 if (this.GetCanBuy(tmpFilter)) 1695 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 1696 } 1697 } 1698 else 1699 { 1700 var arCanBuyValues = arShowValues; 1701 } 1702 if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arC
1702anBuyValues)) 1703 arFilter[strName] = this.selectedValues[strName]; 1704 else 1705 arFilter[strName] = arCanBuyValues[0]; 1706 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 1707 } 1708 this.selectedValues = arFilter; 1709 this.ChangeInfo(); 1710 } 1711 return true; 1712}; 1713 1714JCCatalogSection.prototype.RowLeft = function(e) 1715{ 1716 if (!e) e = window.event; 1717 var target = BX.proxy_context; 1718 if (!!target && target.hasAttribute('data-treevalue')) 1719 { 1720 var strTreeValue = target.getAttribute('data-treevalue'); 1721 var index = -1; 1722 for (var i = 0; i < this.treeProps.length; i++) 1723 { 1724 if (this.treeProps[i].ID == strTreeValue) 1725 { 1726 index = i; 1727 break; 1728 } 1729 } 1730 if (-1 < index && 5 < this.showCount[index]) 1731 { 1732 if ((5 - this.showStart[index]) < this.showCount[index]) 1733 { 1734 this.showStart[index]--; 1735 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 1736 } 1737 } 1738 } 1739}; 1740 1741JCCatalogSection.prototype.RowRight = function(e) 1742{ 1743 if (!e) e = window.event; 1744 var target = BX.proxy_context; 1745 if (!!target && target.hasAttribute('data-treevalue')) 1746 { 1747 var strTreeValue = target.getAttribute('data-treevalue'); 1748 var index = -1; 1749 for (var i = 0; i < this.treeProps.length; i++) 1750 { 1751 if (this.treeProps[i].ID == strTreeValue) 1752 { 1753 index = i; 1754 break; 1755 } 1756 } 1757 if (-1 < index && 5 < this.showCount[index]) 1758 { 1759 if (0 > this.showStart[index]) 1760 { 1761 this.showStart[index]++; 1762 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 1763 } 1764 } 1765 } 1766}; 1767 1768JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID) 1769{ 1770 var i = 0; 1771 var value; 1772 var countShow = 0; 1773 var strNewLen = ''; 1774 if (-1 < intNumber && intNumber < this.obTreeRows.length) 1775 { 1776 var RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false); 1777 if (!!RowItems && 0 < RowItems.length) 1778 { 1779 countShow = showID.length; 1780 strNewLen = (5 < countShow ? (100/countShow)+'%' : '20%'); 1781 obData = { 1782 props: { className: '' }, 1783 style: { 1784 width: strNewLen 1785 } 1786 }; 1787 if ('E' == this.treeProps[intNumber].TYPE) 1788 obData.style.paddingTop = strNewLen; 1789 for (i = 0; i < RowItems.length; i++) 1790 { 1791 value = RowItems[i].getAttribute('data-onevalue'); 1792 if (BX.util.in_array(value, canBuyID)) 1793 { 1794 if (value == activeID) 1795 obData.props.className = 'bx_active'; 1796 else 1797 obData.props.className = ''; 1798 } 1799 else 1800 { 1801 if (value == activeID) 1802 obData.props.className = 'bx_active bx_missing'; 1803 else 1804 obData.props.className = 'bx_missing'; 1805 } 1806 if (BX.util.in_array(value, showID)) 1807 obData.style.display = ''; 1808 else 1809 obData.style.display = 'none'; 1810 BX.adjust(RowItems[i], obData); 1811 } 1812 obData = { 1813 style: { 1814 width: (5 < countShow ? 20*countShow : 100)+'%', 1815 marginLeft: '0%' 1816 } 1817 }; 1818 BX.adjust(this.obTreeRows[intNumber].LIST, obData); 1819 if ('E' == this.treeProps[intNumber].TYPE) 1820 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}}); 1821 else 1822 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_size full' : 'bx_item_detail_size')}}); 1823 if (5 < countShow) 1824 { 1825 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: ''}}); 1826 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: ''}}); 1827 } 1828 else 1829 { 1830 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}}); 1831 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}}); 1832 } 1833 this.showCount[intNumber] = countShow; 1834 this.showStart[intNumber] = 0; 1835 } 1836 } 1837}; 1838 1839JCCatalogSection.prototype.GetRowValues = function(arFilter, index) 1840{ 1841 var arValues = []; 1842 var boolSearch = false; 1843 if (0 == arFilter.length) 1844 { 1845 for (var i = 0; i < this.offers.length; i++) 1846 { 1847 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 1848 arValues[arValues.length] = this.offers[i].TREE[index]; 1849 } 1850 boolSearch = true; 1851 } 1852 else 1853 { 1854 for (var i = 0; i < this.offers.length; i++) 1855 { 1856 var boolOneSearch = true; 1857 for (var j in arFilter) 1858 { 1859 if (arFilter[j] != this.offers[i].TREE[j]) 1860 { 1861 boolOneSearch = false;
1862 break; 1863 } 1864 } 1865 if (boolOneSearch) 1866 { 1867 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 1868 arValues[arValues.length] = this.offers[i].TREE[index]; 1869 boolSearch = true; 1870 } 1871 } 1872 } 1873 return (boolSearch ? arValues : false); 1874}; 1875 1876JCCatalogSection.prototype.GetCanBuy = function(arFilter) 1877{ 1878 var boolSearch = false; 1879 for (var i = 0; i < this.offers.length; i++) 1880 { 1881 var boolOneSearch = true; 1882 for (var j in arFilter) 1883 { 1884 if (arFilter[j] != this.offers[i].TREE[j]) 1885 { 1886 boolOneSearch = false; 1887 break; 1888 } 1889 } 1890 if (boolOneSearch) 1891 { 1892 if (this.offers[i].CAN_BUY) 1893 { 1894 boolSearch = true; 1895 break; 1896 } 1897 } 1898 } 1899 return boolSearch; 1900}; 1901 1902JCCatalogSection.prototype.SetCurrent = function() 1903{ 1904 var arFilter = {}; 1905 var current = this.offers[this.offerNum].TREE; 1906 for (var i = 0; i < this.treeProps.length; i++) 1907 { 1908 var strName = 'PROP_'+this.treeProps[i].ID; 1909 var arShowValues = this.GetRowValues(arFilter, strName); 1910 if (!arShowValues) 1911 break; 1912 if (BX.util.in_array(current[strName], arShowValues)) 1913 { 1914 arFilter[strName] = current[strName]; 1915 } 1916 else 1917 { 1918 arFilter[strName] = arShowValues[0]; 1919 this.offerNum = 0; 1920 } 1921 if (this.showAbsent) 1922 { 1923 var arCanBuyValues = []; 1924 var tmpFilter = []; 1925 tmpFilter = BX.clone(arFilter, true); 1926 for (var j = 0; j < arShowValues.length; j++) 1927 { 1928 tmpFilter[strName] = arShowValues[j]; 1929 if (this.GetCanBuy(tmpFilter)) 1930 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 1931 } 1932 } 1933 else 1934 { 1935 var arCanBuyValues = arShowValues; 1936 } 1937 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 1938 } 1939 this.selectedValues = arFilter; 1940 this.ChangeInfo(); 1941}; 1942 1943JCCatalogSection.prototype.ChangeInfo = function() 1944{ 1945 var index = -1; 1946 for (var i = 0; i < this.offers.length; i++) 1947 { 1948 var boolOneSearch = true; 1949 for (var j in this.selectedValues) 1950 { 1951 if (this.selectedValues[j] != this.offers[i].TREE[j]) 1952 { 1953 boolOneSearch = false; 1954 break; 1955 } 1956 } 1957 if (boolOneSearch) 1958 { 1959 index = i; 1960 break; 1961 } 1962 } 1963 if (-1 < index) 1964 { 1965 if (!!this.obPict) 1966 { 1967 if (!!this.offers[index].PREVIEW_PICTURE) 1968 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1969 else 1970 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1971 } 1972 if (this.secondPict && !!this.obSecondPict) 1973 { 1974 if (!!this.offers[index].PREVIEW_PICTURE_SECOND) 1975 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}}); 1976 else if (!!this.offers[index].PREVIEW_PICTURE.SRC) 1977 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1978 else if (!!this.defaultPict.secondPict) 1979 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}}); 1980 else 1981 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1982 } 1983 if (this.showSkuProps && !!this.obSkuProps) 1984 { 1985 if (0 == this.offers[index].DISPLAY_PROPERTIES.length) 1986 { 1987 BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''}); 1988 } 1989 else 1990 { 1991 BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES}); 1992 } 1993 } 1994 if (!!this.obPrice) 1995 { 1996 var strPrice = this.offers[index].PRICE.PRINT_DISCOUNT_VALUE; 1997 if (this.showOldPrice && (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE)) 1998 strPrice += ' <span>'+this.offers[index].PRICE.PRINT_VALUE+'</span>'; 1999 BX.adjust(this.obPrice, {html: strPrice}); 2000 if (this.showPercent) 2001 { 2002 if (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE) 2003 { 2004 var obData = { 2005 style: { 2006 display: '' 2007 }, 2008 html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT 2009 }; 2010 } 2011 else 2012 { 2013 var obData = { 2014 style: { 2015 display: 'none' 2016 }, 2017 html: '' 2018 }; 2019 } 2020 if (!!this.obDscPerc) 2021 BX.adjust(this.obDscPerc, obData); 2022 if (!!this.obSecondDscPerc) 2023 BX.adjust(this.obSecondDscPerc, obData); 2024 } 2025 } 2026 this.offerNum = index; 2027 if (this.showQuantity) 2028 { 2029 this.QuantitySet(this.offerNum); 2030 } 2031 } 2032}; 2033 2034JCCatalogSection.prototype.Basket = function() 2035{ 2036 if (!this.canBuy) 2037 return; 2038 var ajaxParams = { 2039 sessid: BX.bitrix_sessid(), 2040 action: 'ADD2BASKET', 2041 ajax_basket: 'Y' 2042 }; 2043 switch (this.productType) 2044 { 2045 case 1://product 2046 case 2://set 2047 ajaxParams.id = this.product.id; 2048 if (this.showQuantity) 2049 ajaxParams.quantity = this.obQuantity.value; 2050 break; 2051 case 3://sku 2052 ajaxParams.id = this.offers[this.offerNum].ID; 2053 if (this.showQuantity) 2054 ajaxParams.quantity = this.obQuantity.value; 2055 break; 2056 default: 2057 return; 2058 } 2059 BX.ajax.loadJSON( 2060 this.ajaxPath, 2061 ajaxParams, 2062 BX.delegate(this.ShowBasketPopup, this) 2063 ); 2064}; 2065 2066JCCatalogSection.prototype.ShowBasketPopup = function(arResult) 2067{ 2068 var strContent = ''; 2069 if ('object' == typeof(arResult)) 2070 { 2071 if ('OK' == arResult.STATUS) 2072 { 2073 strName = ''; 2074 strPict = ''; 2075 switch(this.productType) 2076 { 2077 case 1:// 2078 case 2:// 2079 strName = this.product.name; 2080 strPict = this.product.pict.SRC; 2081 break; 2082 case 3: 2083 strName = this.offers[this.offerNum].NAME; 2084 strPict = this.offers[this.offerNum].PREVIEW_PICTURE.SRC; 2085 break; 2086 } 2087 strContent = '<p>'+BX.message('ADD_TO_BASKET_OK')+'</p>'; 2088 strContent += '<img src="'+strPict+'" height="130"><p>
2088'+strName+'</p>'; 2089 } 2090 else 2091 { 2092 2093 } 2094 } 2095 else 2096 { 2097 2098 } 2099 2100 var popup = BX.PopupWindowManager.create('CatalogSectionBasket'+this.visual.ID, null, { 2101 autoHide: false, 2102 // zIndex: 0, 2103 offsetLeft: 0, 2104 offsetTop: 0, 2105 overlay : true, 2106 draggable: {restrict:true}, 2107 closeByEsc: true, 2108 closeIcon: { right : "12px", top : "10px"}, 2109 content: '' + 2110 '<div style="width:300px;text-align: center;padding-top:5px; margin-bottom: 10px;">' + 2111 strContent+ 2112 '<a class="bx_bt_blue bx_medium" href="'+BX.message("setButtonBuyUrl")+'"><span class="bx_icon_cart"></span><span>'+BX.message("setButtonBuyName")+'</span></a>'+ 2113 '</div>' 2114 }); 2115 2116 popup.show(); 2117}; 2118/* End */ 2119;; /* /bitrix/templates/aura-flowers-new/components/bitrix/catalog/default-new/bitrix/catalog.element/.default/script.js?171562863229412*/ 2120; /* /bitrix/components/bitrix/catalog.comments/templates/.default/script.min.js?17156286245833*/ 2121; /* /bitrix/templates/aura-flowers-new/components/bitrix/catalog.section/slider/script.js?171562863322217*/ 2122 2123//# sourceMappingURL=page_7023b1509842d6e1a416634ea1f31126.map.js
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.