1(function (window) { 2 3if (!!window.JCCatalogSection) 4{ 5 return; 6} 7 8var BasketButton = function(params) 9{ 10 BasketButton.superclass.constructor.apply(this, arguments); 11 this.nameNode = BX.create('span', { 12 props : { className : 'bx_medium bx_bt_button', id : this.id }, 13 style: typeof(params.style) === 'object' ? params.style : {}, 14 text: params.text 15 }); 16 this.buttonNode = BX.create('span', { 17 attrs: { className: params.ownerClass }, 18 style: { marginBottom: '0', borderBottom: '0 none transparent' }, 19 children: [this.nameNode], 20 events : this.contextEvents 21 }); 22 if (BX.browser.IsIE()) 23 { 24 this.buttonNode.setAttribute("hideFocus", "hidefocus"); 25 } 26}; 27BX.extend(BasketButton, BX.PopupWindowButton); 28 29window.JCCatalogSection = function (arParams) 30{ 31 this.productType = 0; 32 this.showQuantity = true; 33 this.showAbsent = true; 34 this.secondPict = false; 35 this.showOldPrice = false; 36 this.showPercent = false; 37 this.showSkuProps = false; 38 this.basketAction = 'ADD'; 39 this.showClosePopup = false; 40 this.useCompare = false; 41 this.visual = { 42 ID: '', 43 PICT_ID: '', 44 SECOND_PICT_ID: '', 45 QUANTITY_ID: '', 46 QUANTITY_UP_ID: '', 47 QUANTITY_DOWN_ID: '', 48 PRICE_ID: '', 49 DSC_PERC: '', 50 SECOND_DSC_PERC: '', 51 DISPLAY_PROP_DIV: '', 52 BASKET_PROP_DIV: '' 53 }; 54 this.product = { 55 checkQuantity: false, 56 maxQuantity: 0, 57 stepQuantity: 1, 58 isDblQuantity: false, 59 canBuy: true, 60 canSubscription: true, 61 name: '', 62 pict: {}, 63 id: 0, 64 addUrl: '', 65 buyUrl: '' 66 }; 67 68 this.basketMode = ''; 69 this.basketData = { 70 useProps: false, 71 emptyProps: false, 72 quantity: 'quantity', 73 props: 'prop', 74 basketUrl: '', 75 sku_props: '', 76 sku_props_var: 'basket_props', 77 add_url: '', 78 buy_url: '' 79 }; 80 81 this.compareData = { 82 compareUrl: '', 83 comparePath: '' 84 }; 85 86 this.defaultPict = { 87 pict: null, 88 secondPict: null 89 }; 90 91 this.checkQuantity = false; 92 this.maxQuantity = 0; 93 this.stepQuantity = 1; 94 this.isDblQuantity = false; 95 this.canBuy = true; 96 this.currentBasisPrice = {}; 97 this.canSubscription = true; 98 this.precision = 6; 99 this.precisionFactor = Math.pow(10,this.precision); 100 101 this.offers = []; 102 this.offerNum = 0; 103 this.treeProps = []; 104 this.obTreeRows = []; 105 this.showCount = []; 106 this.showStart = []; 107 this.selectedValues = {}; 108 109 this.obProduct = null; 110 this.obQuantity = null; 111 this.obQuantityUp = null; 112 this.obQuantityDown = null; 113 this.obPict = null; 114 this.obSecondPict = null; 115 this.obPrice = null; 116 this.obTree = null; 117 this.obBuyBtn = null; 118 this.obBasketActions = null; 119 this.obNotAvail = null; 120 this.obDscPerc = null; 121 this.obSecondDscPerc = null; 122 this.obSkuProps = null; 123 this.obMeasure = null; 124 this.obCompare = null; 125 126 this.obPopupWin = null; 127 this.basketUrl = ''; 128 this.basketParams = {}; 129 130 this.treeRowShowSize = 5; 131 this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 }; 132 this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 }; 133 134 this.lastElement = false; 135 this.containerHeight = 0; 136 137 this.errorCode = 0; 138 139 if ('object' === typeof arParams) 140 { 141 this.productType = parseInt(arParams.PRODUCT_TYPE, 10); 142 this.showQuantity = arParams.SHOW_QUANTITY; 143 this.showAbsent = arParams.SHOW_ABSENT; 144 this.secondPict = !!arParams.SECOND_PICT; 145 this.showOldPrice = !!arParams.SHOW_OLD_PRICE; 146 this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT; 147 this.showSkuProps = !!arParams.SHOW_SKU_PROPS; 148 if (!!arParams.ADD_TO_BASKET_ACTION) 149 { 150 this.basketAction = arParams.ADD_TO_BASKET_ACTION; 151 } 152 this.showClosePopup = !!arParams.SHOW_CLOSE_POPUP; 153 this.useCompare = !!arParams.DISPLAY_COMPARE; 154 155 this.visual = arParams.VISUAL; 156 157 switch (this.productType) 158 { 159 case 1://product 160 case 2://set 161 if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT)) 162 { 163 if (this.showQuantity) 164 { 165 this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY; 166 this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT; 167 if (this.product.checkQuantity) 168 { 169 this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10)); 170 } 171 this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10)); 172 173 this.checkQuantity = this.product.checkQuantity; 174 this.isDblQuantity = this.product.isDblQuantity; 175 this.maxQuantity = this.product.maxQuantity; 176 this.stepQuantity = this.product.stepQuantity; 177 if (this.isDblQuantity) 178 { 179 this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor; 180 } 181 }
182 this.product.canBuy = arParams.PRODUCT.CAN_BUY; 183 this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION; 184 if (!!arParams.PRODUCT.BASIS_PRICE) 185 { 186 this.currentBasisPrice = arParams.PRODUCT.BASIS_PRICE; 187 } 188 189 this.canBuy = this.product.canBuy; 190 this.canSubscription = this.product.canSubscription; 191 192 this.product.name = arParams.PRODUCT.NAME; 193 this.product.pict = arParams.PRODUCT.PICT; 194 this.product.id = arParams.PRODUCT.ID; 195 if (!!arParams.PRODUCT.ADD_URL) 196 { 197 this.product.addUrl = arParams.PRODUCT.ADD_URL; 198 } 199 if (!!arParams.PRODUCT.BUY_URL) 200 { 201 this.product.buyUrl = arParams.PRODUCT.BUY_URL; 202 } 203 if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET)) 204 { 205 this.basketData.useProps = !!arParams.BASKET.ADD_PROPS; 206 this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS; 207 } 208 } 209 else 210 { 211 this.errorCode = -1; 212 } 213 break; 214 case 3://sku 215 if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) 216 { 217 if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT)) 218 { 219 this.product.name = arParams.PRODUCT.NAME; 220 this.product.id = arParams.PRODUCT.ID; 221 } 222 this.offers = arParams.OFFERS; 223 this.offerNum = 0; 224 if (!!arParams.OFFER_SELECTED) 225 { 226 this.offerNum = parseInt(arParams.OFFER_SELECTED, 10); 227 } 228 if (isNaN(this.offerNum)) 229 { 230 this.offerNum = 0; 231 } 232 if (!!arParams.TREE_PROPS) 233 { 234 this.treeProps = arParams.TREE_PROPS; 235 } 236 if (!!arParams.DEFAULT_PICTURE) 237 { 238 this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE; 239 this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND; 240 } 241 } 242 break; 243 default: 244 this.errorCode = -1; 245 } 246 if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET)) 247 { 248 if (!!arParams.BASKET.QUANTITY) 249 { 250 this.basketData.quantity = arParams.BASKET.QUANTITY; 251 } 252 if (!!arParams.BASKET.PROPS) 253 { 254 this.basketData.props = arParams.BASKET.PROPS; 255 } 256 if (!!arParams.BASKET.BASKET_URL) 257 { 258 this.basketData.basketUrl = arParams.BASKET.BASKET_URL; 259 } 260 if (3 === this.productType) 261 { 262 if (!!arParams.BASKET.SKU_PROPS) 263 { 264 this.basketData.sku_props = arParams.BASKET.SKU_PROPS; 265 } 266 } 267 if (!!arParams.BASKET.ADD_URL_TEMPLATE) 268 { 269 this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE; 270 } 271 if (!!arParams.BASKET.BUY_URL_TEMPLATE) 272 { 273 this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE; 274 } 275 if (this.basketData.add_url === '' && this.basketData.buy_url === '') 276 { 277 this.errorCode = -1024; 278 } 279 } 280 if (this.useCompare) 281 { 282 if (!!arParams.COMPARE && typeof(arParams.COMPARE) === 'object') 283 { 284 if (!!arParams.COMPARE.COMPARE_PATH) 285 { 286 this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH; 287 } 288 if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE) 289 { 290 this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE; 291 } 292 else 293 { 294 this.useCompare = false; 295 } 296 } 297 else 298 { 299 this.useCompare = false; 300 } 301 } 302 303 this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT); 304 } 305 if (0 === this.errorCode) 306 { 307 BX.ready(BX.delegate(this.Init,this)); 308 } 309}; 310 311window.JCCatalogSection.prototype.Init = function() 312{ 313 var i = 0, 314 strPrefix = '', 315 TreeItems = null; 316 317 this.obProduct = BX(this.visual.ID); 318 if (!this.obProduct) 319 { 320 this.errorCode = -1; 321 } 322 this.obPict = BX(this.visual.PICT_ID); 323 if (!this.obPict) 324 { 325 this.errorCode = -2; 326 } 327 if (this.secondPict && !!this.visual.SECOND_PICT_ID) 328 { 329 this.obSecondPict = BX(this.visual.SECOND_PICT_ID); 330 } 331 this.obPrice = BX(this.visual.PRICE_ID); 332 if (!this.obPrice) 333 { 334 this.errorCode = -16; 335 } 336 if (this.showQuantity && !!this.visual.QUANTITY_ID) 337 { 338 this.obQuantity = BX(this.visual.QUANTITY_ID); 339 if (!!this.visual.QUANTITY_UP_ID) 340 { 341 this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID); 342 } 343 if (!!this.visual.QUANTITY_DOWN_ID) 344 { 345 this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID); 346 } 347 } 348 if (3 === this.productType && this.offers.length > 0) 349 { 350 if (!!this.visual.TREE_ID) 351 { 352 this.obTree = BX(this.visual.TREE_ID); 353 if (!this.obTree) 354 { 355 this.errorCode = -256; 356 } 357 strPrefix = this.visual.TREE_ITEM_ID; 358 for (i = 0; i < this.treeProps.length; i++) 359 { 360 this.obTreeRows[i] = { 361 LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'), 362 RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'), 363 LIST: BX(strPrefix+this.treeProps[i].ID+'_list'), 364 CONT: BX(strPrefix+this.treeProps[i].ID+'_cont') 365 }; 366 if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT) 367 { 368 this.errorCode = -512; 369 break; 370 } 371 } 372 } 373 if (!!this.visual.QUANTITY_MEASURE) 374 { 375 this.obMeasure = BX(this.visual.QUANTITY_MEASURE); 376 } 377 } 378 379 this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID); 380 if (!!this.obBasketActions) 381 { 382 if (!!this.visual.BUY_ID) 383 { 384 this.obBuyBtn = BX(this.visual.BUY_ID); 385 } 386 } 387 this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS); 388 389 if (this.showPercent) 390 { 391 if (!!this.visual.DSC_PERC) 392 { 393 this.obDscPerc = BX(this.visual.DSC_PERC); 394 } 395 if (this.secondPict && !!this.visual.SECOND_DSC_PERC) 396 { 397 this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC); 398 } 399 } 400 401 if (this.showSkuProps) 402 { 403 if (!!this.visual.DISPLAY_PROP_DIV) 404 { 405 this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV); 406 } 407 } 408 409 if (0 === this.errorCode) 410 { 411 if (this.showQuantity) 412 { 413 if (!!this.obQuantityUp) 414 { 415 BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this)); 416 } 417 if (!!this.obQuantityDown) 418 { 419 BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this)); 420 } 421 if (!!this.obQuantity) 422 { 423 BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this)); 424 } 425 } 426 switch (this.productType) 427 { 428 case 1://product 429 break; 430 case 3://sku 431 if (this.offers.length > 0) 432 { 433 TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true); 434 if (!!TreeItems && 0 < TreeItems.length) 435 { 436 for (i = 0; i < TreeItems.length; i++) 437 { 438 BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this)); 439 } 440 } 441 for (i = 0; i < this.obTreeRows.length; i++) 442 { 443 BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this)); 444 BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this)); 445 } 446 this.SetCurrent(); 447 } 448 break; 449 } 450 if (!!this.obBuyBtn) 451 { 452 if (this.basketAction === 'ADD') 453 { 454 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this)); 455 } 456 else 457 {
458 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.BuyBasket, this)); 459 } 460 } 461 if (this.lastElement) 462 { 463 this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10); 464 if (isNaN(this.containerHeight)) 465 { 466 this.containerHeight = 0; 467 } 468 this.setHeight(); 469 BX.bind(window, 'resize', BX.delegate(this.checkHeight, this)); 470 BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this)); 471 BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this)); 472 } 473 if (this.useCompare) 474 { 475 this.obCompare = BX(this.visual.COMPARE_LINK_ID); 476 if (!!this.obCompare) 477 { 478 BX.bind(this.obCompare, 'click', BX.proxy(this.Compare, this)); 479 } 480 } 481 } 482}; 483 484window.JCCatalogSection.prototype.checkHeight = function() 485{ 486 this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10); 487 if (isNaN(this.containerHeight)) 488 { 489 this.containerHeight = 0; 490 } 491}; 492 493window.JCCatalogSection.prototype.setHeight = function() 494{ 495 if (0 < this.containerHeight) 496 { 497 BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}}); 498 } 499}; 500 501window.JCCatalogSection.prototype.clearHeight = function() 502{ 503 BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}}); 504}; 505 506window.JCCatalogSection.prototype.QuantityUp = function() 507{ 508 var curValue = 0, 509 boolSet = true, 510 calcPrice; 511 512 if (0 === this.errorCode && this.showQuantity && this.canBuy) 513 { 514 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10)); 515 if (!isNaN(curValue)) 516 { 517 curValue += this.stepQuantity; 518 if (this.checkQuantity) 519 { 520 if (curValue > this.maxQuantity) 521 { 522 boolSet = false; 523 } 524 } 525 if (boolSet) 526 { 527 if (this.isDblQuantity) 528 { 529 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 530 } 531 this.obQuantity.value = curValue; 532 calcPrice = { 533 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue, 534 VALUE: this.currentBasisPrice.VALUE * curValue, 535 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue, 536 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 537 CURRENCY: this.currentBasisPrice.CURRENCY 538 }; 539 this.setPrice(calcPrice); 540 } 541 } 542 } 543}; 544 545window.JCCatalogSection.prototype.QuantityDown = function() 546{ 547 var curValue = 0, 548 boolSet = true, 549 calcPrice; 550 551 if (0 === this.errorCode && this.showQuantity && this.canBuy) 552 { 553 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10)); 554 if (!isNaN(curValue)) 555 { 556 curValue -= this.stepQuantity; 557 if (curValue < this.stepQuantity) 558 { 559 boolSet = false; 560 } 561 if (boolSet) 562 { 563 if (this.isDblQuantity) 564 { 565 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 566 } 567 this.obQuantity.value = curValue; 568 calcPrice = { 569 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue, 570 VALUE: this.currentBasisPrice.VALUE * curValue, 571 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue, 572 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 573 CURRENCY: this.currentBasisPrice.CURRENCY 574 }; 575 this.setPrice(calcPrice); 576 } 577 } 578 } 579}; 580 581window.JCCatalogSection.prototype.QuantityChange = function() 582{ 583 var curValue = 0, 584 calcPrice, 585 intCount, 586 count; 587 588 if (0 === this.errorCode && this.showQuantity) 589 { 590 if (this.canBuy) 591 { 592 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10)); 593 if (!isNaN(curValue)) 594 { 595 if (this.checkQuantity) 596 { 597 if (curValue > this.maxQuantity) 598 { 599 curValue = this.maxQuantity; 600 } 601 } 602 if (curValue < this.stepQuantity) 603 { 604 curValue = this.stepQuantity; 605 } 606 else 607 { 608 count = Math.round((curValue*this.precisionFactor)/this.stepQuantity)/this.precisionFactor; 609 intCount = parseInt(count, 10); 610 if (isNaN(intCount)) 611 { 612 intCount = 1; 613 count = 1.1; 614 } 615 if (count > intCount) 616 { 617 curValue = (intCount <= 1 ? this.stepQuantity : intCount*this.stepQuantity); 618 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 619 } 620 } 621 this.obQuantity.value = curValue; 622 } 623 else 624 {
625 this.obQuantity.value = this.stepQuantity; 626 } 627 } 628 else 629 { 630 this.obQuantity.value = this.stepQuantity; 631 } 632 calcPrice = { 633 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * this.obQuantity.value, 634 VALUE: this.currentBasisPrice.VALUE * this.obQuantity.value, 635 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * this.obQuantity.value, 636 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 637 CURRENCY: this.currentBasisPrice.CURRENCY 638 }; 639 this.setPrice(calcPrice); 640 } 641}; 642 643window.JCCatalogSection.prototype.QuantitySet = function(index) 644{ 645 if (0 === this.errorCode) 646 { 647 this.canBuy = this.offers[index].CAN_BUY; 648 if (this.canBuy) 649 { 650 if (!!this.obBasketActions) 651 { 652 BX.style(this.obBasketActions, 'display', ''); 653 } 654 if (!!this.obNotAvail) 655 { 656 BX.style(this.obNotAvail, 'display', 'none'); 657 } 658 } 659 else 660 { 661 if (!!this.obBasketActions) 662 { 663 BX.style(this.obBasketActions, 'display', 'none'); 664 } 665 if (!!this.obNotAvail) 666 { 667 BX.style(this.obNotAvail, 'display', ''); 668 } 669 } 670 if (this.showQuantity) 671 { 672 this.isDblQuantity = this.offers[index].QUANTITY_FLOAT; 673 this.checkQuantity = this.offers[index].CHECK_QUANTITY; 674 if (this.isDblQuantity) 675 { 676 this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY); 677 this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor; 678 } 679 else 680 { 681 this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10); 682 this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10); 683 } 684 685 this.obQuantity.value = this.stepQuantity; 686 this.obQuantity.disabled = !this.canBuy; 687 if (!!this.obMeasure) 688 { 689 if (!!this.offers[index].MEASURE) 690 { 691 BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE}); 692 } 693 else 694 { 695 BX.adjust(this.obMeasure, { html : ''}); 696 } 697 } 698 } 699 this.currentBasisPrice = this.offers[index].BASIS_PRICE; 700 } 701}; 702 703window.JCCatalogSection.prototype.SelectOfferProp = function() 704{ 705 var i = 0, 706 value = '', 707 strTreeValue = '', 708 arTreeItem = [], 709 RowItems = null, 710 target = BX.proxy_context; 711 712 if (!!target && target.hasAttribute('data-treevalue')) 713 { 714 strTreeValue = target.getAttribute('data-treevalue'); 715 arTreeItem = strTreeValue.split('_'); 716 if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1])) 717 { 718 RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 719 if (!!RowItems && 0 < RowItems.length) 720 { 721 for (i = 0; i < RowItems.length; i++) 722 { 723 value = RowItems[i].getAttribute('data-onevalue'); 724 if (value === arTreeItem[1]) 725 { 726 BX.addClass(RowItems[i], 'bx_active'); 727 } 728 else 729 { 730 BX.removeClass(RowItems[i], 'bx_active'); 731 } 732 } 733 } 734 } 735 } 736}; 737 738window.JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue) 739{ 740 var strName = '', 741 arShowValues = false, 742 i, j, 743 arCanBuyValues = [], 744 allValues = [], 745 index = -1, 746 arFilter = {}, 747 tmpFilter = []; 748 749 for (i = 0; i < this.treeProps.length; i++) 750 { 751 if (this.treeProps[i].ID === strPropID) 752 { 753 index = i; 754 break; 755 } 756 } 757 758 if (-1 < index) 759 { 760 for (i = 0; i < index; i++) 761 { 762 strName = 'PROP_'+this.treeProps[i].ID; 763 arFilter[strName] = this.selectedValues[strName]; 764 } 765 strName = 'PROP_'+this.treeProps[index].ID; 766 arShowValues = this.GetRowValues(arFilter, strName); 767 if (!arShowValues) 768 { 769 return false; 770 } 771 if (!BX.util.in_array(strPropValue, arShowValues)) 772 { 773 return false; 774 } 775 arFilter[strName] = strPropValue; 776 for (i = index+1; i < this.treeProps.length; i++) 777 { 778 strName = 'PROP_'+this.treeProps[i].ID; 779 arShowValues = this.GetRowValues(arFilter, strName); 780 if (!arShowValues) 781 { 782 return false; 783 } 784 allValues = []; 785 if (this.showAbsent) 786 { 787 arCanBuyValues = []; 788 tmpFilter = []; 789 tmpFilter = BX.clone(arFilter, true); 790 for (j = 0; j < arShowValues.length; j++) 791 { 792 tmpFilter[strName] = arShowValues[j]; 793 allValues[allValues.length] = arShowValues[j]; 794 if (this.GetCanBuy(tmpFilter)) 795 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 796 } 797 } 798 else 799 {
800 arCanBuyValues = arShowValues; 801 } 802 if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues)) 803 { 804 arFilter[strName] = this.selectedValues[strName]; 805 } 806 else 807 { 808 if (this.config.showAbsent) 809 arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]); 810 else 811 arFilter[strName] = arCanBuyValues[0]; 812 } 813 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 814 } 815 this.selectedValues = arFilter; 816 this.ChangeInfo(); 817 } 818 return true; 819}; 820 821window.JCCatalogSection.prototype.RowLeft = function() 822{ 823 var i = 0, 824 strTreeValue = '', 825 index = -1, 826 target = BX.proxy_context; 827 828 if (!!target && target.hasAttribute('data-treevalue')) 829 { 830 strTreeValue = target.getAttribute('data-treevalue'); 831 for (i = 0; i < this.treeProps.length; i++) 832 { 833 if (this.treeProps[i].ID === strTreeValue) 834 { 835 index = i; 836 break; 837 } 838 } 839 if (-1 < index && this.treeRowShowSize < this.showCount[index]) 840 { 841 if (0 > this.showStart[index]) 842 { 843 this.showStart[index]++; 844 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 845 BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow }); 846 } 847 848 if (0 <= this.showStart[index]) 849 { 850 BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow }); 851 } 852 } 853 } 854}; 855 856window.JCCatalogSection.prototype.RowRight = function() 857{ 858 var i = 0, 859 strTreeValue = '', 860 index = -1, 861 target = BX.proxy_context; 862 863 if (!!target && target.hasAttribute('data-treevalue')) 864 { 865 strTreeValue = target.getAttribute('data-treevalue'); 866 for (i = 0; i < this.treeProps.length; i++) 867 { 868 if (this.treeProps[i].ID === strTreeValue) 869 { 870 index = i; 871 break; 872 } 873 } 874 if (-1 < index && this.treeRowShowSize < this.showCount[index]) 875 { 876 if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index]) 877 { 878 this.showStart[index]--; 879 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 880 BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow }); 881 } 882 883 if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index]) 884 { 885 BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow }); 886 } 887 } 888 } 889}; 890 891window.JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID) 892{ 893 var i = 0, 894 showI = 0, 895 value = '', 896 countShow = 0, 897 strNewLen = '', 898 obData = {}, 899 pictMode = false, 900 extShowMode = false, 901 isCurrent = false, 902 selectIndex = 0, 903 obLeft = this.treeEnableArrow, 904 obRight = this.treeEnableArrow, 905 currentShowStart = 0, 906 RowItems = null; 907 908 if (-1 < intNumber && intNumber < this.obTreeRows.length) 909 { 910 RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false); 911 if (!!RowItems && 0 < RowItems.length) 912 { 913 pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE); 914 countShow = showID.length; 915 extShowMode = this.treeRowShowSize < countShow; 916 strNewLen = (extShowMode ? (100/countShow)+'%' : '20%'); 917 obData = { 918 props: { className: '' }, 919 style: { 920 width: strNewLen 921 } 922 }; 923 if (pictMode) 924 { 925 obData.style.paddingTop = strNewLen; 926 } 927 for (i = 0; i < RowItems.length; i++) 928 { 929 value = RowItems[i].getAttribute('data-onevalue'); 930 isCurrent = (value === activeID); 931 if (BX.util.in_array(value, canBuyID)) 932 { 933 obData.props.className = (isCurrent ? 'bx_active' : ''); 934 } 935 else 936 { 937 obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing'); 938 } 939 obData.style.display = 'none'; 940 if (BX.util.in_array(value, showID)) 941 { 942 obData.style.display = ''; 943 if (isCurrent) 944 { 945 selectIndex = showI; 946 } 947 showI++; 948 } 949 BX.adjust(RowItems[i], obData); 950 } 951 952 obData = { 953 style: { 954 width: (extShowMode ? 20*countShow : 100)+'%', 955 marginLeft: '0%' 956 } 957 }; 958 if (pictMode) 959 { 960 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}}); 961 } 962 else 963 {
964 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}}); 965 } 966 if (extShowMode) 967 { 968 if (selectIndex +1 === countShow) 969 { 970 obRight = this.treeDisableArrow; 971 } 972 if (this.treeRowShowSize <= selectIndex) 973 { 974 currentShowStart = this.treeRowShowSize - selectIndex - 1; 975 obData.style.marginLeft = currentShowStart*20+'%'; 976 } 977 if (0 === currentShowStart) 978 { 979 obLeft = this.treeDisableArrow; 980 } 981 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft }); 982 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight }); 983 } 984 else 985 { 986 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}}); 987 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}}); 988 } 989 BX.adjust(this.obTreeRows[intNumber].LIST, obData); 990 this.showCount[intNumber] = countShow; 991 this.showStart[intNumber] = currentShowStart; 992 } 993 } 994}; 995 996window.JCCatalogSection.prototype.GetRowValues = function(arFilter, index) 997{ 998 var i = 0, 999 j, 1000 arValues = [], 1001 boolSearch = false, 1002 boolOneSearch = true; 1003 1004 if (0 === arFilter.length) 1005 { 1006 for (i = 0; i < this.offers.length; i++) 1007 { 1008 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 1009 { 1010 arValues[arValues.length] = this.offers[i].TREE[index]; 1011 } 1012 } 1013 boolSearch = true; 1014 } 1015 else 1016 { 1017 for (i = 0; i < this.offers.length; i++) 1018 { 1019 boolOneSearch = true; 1020 for (j in arFilter) 1021 { 1022 if (arFilter[j] !== this.offers[i].TREE[j]) 1023 { 1024 boolOneSearch = false; 1025 break; 1026 } 1027 } 1028 if (boolOneSearch) 1029 { 1030 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 1031 { 1032 arValues[arValues.length] = this.offers[i].TREE[index]; 1033 } 1034 boolSearch = true; 1035 } 1036 } 1037 } 1038 return (boolSearch ? arValues : false); 1039}; 1040 1041window.JCCatalogSection.prototype.GetCanBuy = function(arFilter) 1042{ 1043 var i = 0, 1044 j, 1045 boolSearch = false, 1046 boolOneSearch = true; 1047 1048 for (i = 0; i < this.offers.length; i++) 1049 { 1050 boolOneSearch = true; 1051 for (j in arFilter) 1052 { 1053 if (arFilter[j] !== this.offers[i].TREE[j]) 1054 { 1055 boolOneSearch = false; 1056 break; 1057 } 1058 } 1059 if (boolOneSearch) 1060 { 1061 if (this.offers[i].CAN_BUY) 1062 { 1063 boolSearch = true; 1064 break; 1065 } 1066 } 1067 } 1068 return boolSearch; 1069}; 1070 1071window.JCCatalogSection.prototype.SetCurrent = function() 1072{ 1073 var i = 0, 1074 j = 0, 1075 arCanBuyValues = [], 1076 strName = '', 1077 arShowValues = false, 1078 arFilter = {}, 1079 tmpFilter = [], 1080 current = this.offers[this.offerNum].TREE; 1081 1082 for (i = 0; i < this.treeProps.length; i++) 1083 { 1084 strName = 'PROP_'+this.treeProps[i].ID; 1085 arShowValues = this.GetRowValues(arFilter, strName); 1086 if (!arShowValues) 1087 { 1088 break; 1089 } 1090 if (BX.util.in_array(current[strName], arShowValues)) 1091 { 1092 arFilter[strName] = current[strName]; 1093 } 1094 else 1095 { 1096 arFilter[strName] = arShowValues[0]; 1097 this.offerNum = 0; 1098 } 1099 if (this.showAbsent) 1100 { 1101 arCanBuyValues = []; 1102 tmpFilter = []; 1103 tmpFilter = BX.clone(arFilter, true); 1104 for (j = 0; j < arShowValues.length; j++) 1105 { 1106 tmpFilter[strName] = arShowValues[j]; 1107 if (this.GetCanBuy(tmpFilter)) 1108 { 1109 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 1110 } 1111 } 1112 } 1113 else 1114 { 1115 arCanBuyValues = arShowValues; 1116 } 1117 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 1118 } 1119 this.selectedValues = arFilter; 1120 this.ChangeInfo(); 1121}; 1122 1123window.JCCatalogSection.prototype.ChangeInfo = function() 1124{ 1125 var i = 0, 1126 j, 1127 index = -1, 1128 boolOneSearch = true; 1129 1130 for (i = 0; i < this.offers.length; i++) 1131 { 1132 boolOneSearch = true; 1133 for (j in this.selectedValues) 1134 { 1135 if (this.selectedValues[j] !== this.offers[i].TREE[j]) 1136 { 1137 boolOneSearch = false; 1138 break; 1139 } 1140 } 1141 if (boolOneSearch) 1142 { 1143 index = i; 1144 break; 1145 } 1146 } 1147 if (-1 < index) 1148 { 1149 if (!!this.obPict) 1150 { 1151 if (!!this.offers[index].PREVIEW_PICTURE) 1152 { 1153 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1154 } 1155 else 1156 { 1157 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1158 } 1159 } 1160 if (this.secondPict && !!this.obSecondPict) 1161 { 1162 if (!!this.offers[index].PREVIEW_PICTURE_SECOND) 1163 { 1164 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}}); 1165 } 1166 else if (!!this.offers[index].PREVIEW_PICTURE.SRC) 1167 { 1168 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1169 } 1170 else if (!!this.defaultPict.secondPict) 1171 { 1172 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}}); 1173 } 1174 else 1175 {
1176 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1177 } 1178 } 1179 if (this.showSkuProps && !!this.obSkuProps) 1180 { 1181 if (0 === this.offers[index].DISPLAY_PROPERTIES.length) 1182 { 1183 BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''}); 1184 } 1185 else 1186 { 1187 BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES}); 1188 } 1189 } 1190 this.setPrice(this.offers[index].PRICE); 1191 this.offerNum = index; 1192 this.QuantitySet(this.offerNum); 1193 } 1194}; 1195 1196window.JCCatalogSection.prototype.setPrice = function(price) 1197{ 1198 var strPrice, 1199 obData; 1200 1201 if (!!this.obPrice) 1202 { 1203 strPrice = BX.Currency.currencyFormat(price.DISCOUNT_VALUE, price.CURRENCY, true); 1204 if (this.showOldPrice && (price.DISCOUNT_VALUE !== price.VALUE)) 1205 { 1206 strPrice += ' <span>'+BX.Currency.currencyFormat(price.VALUE, price.CURRENCY, true)+'</span>'; 1207 } 1208 BX.adjust(this.obPrice, {html: strPrice}); 1209 if (this.showPercent) 1210 { 1211 if (price.DISCOUNT_VALUE !== price.VALUE) 1212 { 1213 obData = { 1214 style: { 1215 display: '' 1216 }, 1217 html: price.DISCOUNT_DIFF_PERCENT 1218 }; 1219 } 1220 else 1221 { 1222 obData = { 1223 style: { 1224 display: 'none' 1225 }, 1226 html: '' 1227 }; 1228 } 1229 if (!!this.obDscPerc) 1230 { 1231 BX.adjust(this.obDscPerc, obData); 1232 } 1233 if (!!this.obSecondDscPerc) 1234 { 1235 BX.adjust(this.obSecondDscPerc, obData); 1236 } 1237 } 1238 } 1239}; 1240 1241window.JCCatalogSection.prototype.Compare = function() 1242{ 1243 var compareParams, compareLink; 1244 if (!!this.compareData.compareUrl) 1245 { 1246 switch (this.productType) 1247 { 1248 case 1://product 1249 case 2://set 1250 compareLink = this.compareData.compareUrl.replace('#ID#', this.product.id.toString()); 1251 break; 1252 case 3://sku 1253 compareLink = this.compareData.compareUrl.replace('#ID#', this.offers[this.offerNum].ID); 1254 break; 1255 } 1256 compareParams = { 1257 ajax_action: 'Y' 1258 }; 1259 BX.ajax.loadJSON( 1260 compareLink, 1261 compareParams, 1262 BX.proxy(this.CompareResult, this) 1263 ); 1264 } 1265}; 1266 1267window.JCCatalogSection.prototype.CompareResult = function(result) 1268{ 1269 var popupContent, popupButtons, popupTitle; 1270 if (!!this.obPopupWin) 1271 { 1272 this.obPopupWin.close(); 1273 } 1274 if (typeof result !== 'object') 1275 { 1276 return false; 1277 } 1278 this.InitPopupWindow(); 1279 popupTitle = { 1280 content: BX.create('div', { 1281 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1282 text: BX.message('COMPARE_TITLE') 1283 }) 1284 }; 1285 if (result.STATUS === 'OK') 1286 { 1287 BX.onCustomEvent('OnCompareChange'); 1288 popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+BX.message('COMPARE_MESSAGE_OK')+'</p></div>'; 1289 if (this.showClosePopup) 1290 { 1291 popupButtons = [ 1292 new BasketButton({ 1293 ownerClass: this.obProduct.parentNode.parentNode.className, 1294 text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'), 1295 events: { 1296 click: BX.delegate(this.CompareRedirect, this) 1297 }, 1298 style: {marginRight: '10px'} 1299 }), 1300 new BasketButton({ 1301 ownerClass: this.obProduct.parentNode.parentNode.className, 1302 text: BX.message('BTN_MESSAGE_CLOSE_POPUP'), 1303 events: { 1304 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1305 } 1306 }) 1307 ]; 1308 } 1309 else 1310 { 1311 popupButtons = [ 1312 new BasketButton({ 1313 ownerClass: this.obProduct.parentNode.parentNode.className, 1314 text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'), 1315 events: { 1316 click: BX.delegate(this.CompareRedirect, this) 1317 } 1318 }) 1319 ]; 1320 } 1321 } 1322 else 1323 { 1324 popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))+'</p></div>'; 1325 popupButtons = [ 1326 new BasketButton({ 1327 ownerClass: this.obProduct.parentNode.parentNode.className, 1328 text: BX.message('BTN_MESSAGE_CLOSE'), 1329 events: { 1330 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1331 } 1332 1333 }) 1334 ]; 1335 } 1336 this.obPopupWin.setTitleBar(popupTitle); 1337 this.obPopupWin.setContent(popupContent); 1338 this.obPopupWin.setButtons(popupButtons); 1339 this.obPopupWin.show(); 1340 return false; 1341}; 1342 1343window.JCCatalogSection.prototype.CompareRedirect = function() 1344{ 1345 if (!!this.compareData.comparePath) 1346 { 1347 location.href = this.compareData.comparePath; 1348 } 1349 else 1350 { 1351 this.obPopupWin.close(); 1352 } 1353}; 1354 1355window.JCCatalogSection.prototype.InitBasketUrl = function() 1356{ 1357 this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url); 1358 switch (this.productType) 1359 { 1360 case 1://product 1361 case 2://set 1362 this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString()); 1363 break; 1364 case 3://sku 1365 this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID); 1366 break; 1367 } 1368 this.basketParams = { 1369 'ajax_basket': 'Y' 1370 }; 1371 if (this.showQuantity) 1372 { 1373 this.basketParams[this.basketData.quantity] = this.obQuantity.value; 1374 } 1375 if (!!this.basketData.sku_props) 1376 { 1377 this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props; 1378 } 1379}; 1380 1381window.JCCatalogSection.prototype.FillBasketProps = function() 1382{ 1383 if (!this.visual.BASKET_PROP_DIV) 1384 { 1385 return; 1386 } 1387 var 1388 i = 0, 1389 propCollection = null, 1390 foundValues = false, 1391 obBasketProps = null; 1392 1393 if (this.basketData.useProps && !this.basketData.emptyProps) 1394 { 1395 if (!!this.obPopupWin && !!this.obPopupWin.contentContainer) 1396 { 1397 obBasketProps = this.obPopupWin.contentContainer; 1398 } 1399 } 1400 else 1401 { 1402 obBasketProps = BX(this.visual.BASKET_PROP_DIV); 1403 } 1404 if (!!obBasketProps) 1405 { 1406 propCollection = obBasketProps.getElementsByTagName('select'); 1407 if (!!propCollection && !!propCollection.length) 1408 { 1409 for (i = 0; i < propCollection.length; i++) 1410 { 1411 if (!propCollection[i].disabled) 1412 { 1413 switch(propCollection[i].type.toLowerCase()) 1414 { 1415 case 'select-one': 1416 this.basketParams[propCollection[i].name] = propCollection[i].value; 1417 foundValues = true; 1418 break; 1419 default: 1420 break; 1421 } 1422 } 1423 } 1424 } 1425 propCollection = obBasketProps.getElementsByTagName('input'); 1426 if (!!propCollection && !!propCollection.length) 1427 { 1428 for (i = 0; i < propCollection.length; i++) 1429 { 1430 if (!propCollection[i].disabled) 1431 { 1432 switch(propCollection[i].type.toLowerCase()) 1433 { 1434 case 'hidden': 1435 this.basketParams[propCollection[i].name] = propCollection[i].value; 1436 foundValues = true; 1437 break; 1438 case 'radio': 1439 if (propCollection[i].checked) 1440 { 1441 this.basketParams[propCollection[i].name] = propCollection[i].value; 1442 foundValues = true; 1443 } 1444 break; 1445 default: 1446 break; 1447 } 1448 } 1449 } 1450 } 1451 } 1452 if (!foundValues) 1453 { 1454 this.basketParams[this.basketData.props] = []; 1455 this.basketParams[this.basketData.props][0] = 0; 1456 } 1457}; 1458 1459window.JCCatalogSection.prototype.Add2Basket = function() 1460{ 1461 this.basketMode = 'ADD'; 1462 this.Basket(); 1463}; 1464 1465window.JCCatalogSection.prototype.BuyBasket = function() 1466{ 1467 this.basketMode = 'BUY'; 1468 this.Basket(); 1469}; 1470 1471window.JCCatalogSection.prototype.SendToBasket = function() 1472{ 1473 if (!this.canBuy) 1474 { 1475 return; 1476 } 1477 this.InitBasketUrl(); 1478 this.FillBasketProps();
1479 BX.ajax.loadJSON( 1480 this.basketUrl, 1481 this.basketParams, 1482 BX.delegate(this.BasketResult, this) 1483 ); 1484}; 1485 1486window.JCCatalogSection.prototype.Basket = function() 1487{ 1488 var contentBasketProps = ''; 1489 if (!this.canBuy) 1490 { 1491 return; 1492 } 1493 switch (this.productType) 1494 { 1495 case 1://product 1496 case 2://set 1497 if (this.basketData.useProps && !this.basketData.emptyProps) 1498 { 1499 this.InitPopupWindow(); 1500 this.obPopupWin.setTitleBar({ 1501 content: BX.create('div', { 1502 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1503 text: BX.message('TITLE_BASKET_PROPS') 1504 }) 1505 }); 1506 if (BX(this.visual.BASKET_PROP_DIV)) 1507 { 1508 contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML; 1509 } 1510 this.obPopupWin.setContent(contentBasketProps); 1511 this.obPopupWin.setButtons([ 1512 new BasketButton({ 1513 ownerClass: this.obProduct.parentNode.parentNode.className, 1514 text: BX.message('BTN_MESSAGE_SEND_PROPS'), 1515 events: { 1516 click: BX.delegate(this.SendToBasket, this) 1517 } 1518 }) 1519 ]); 1520 this.obPopupWin.show(); 1521 } 1522 else 1523 { 1524 this.SendToBasket(); 1525 } 1526 break; 1527 case 3://sku 1528 this.SendToBasket(); 1529 break; 1530 } 1531}; 1532 1533window.JCCatalogSection.prototype.BasketResult = function(arResult) 1534{ 1535 var strContent = '', 1536 strPict = '', 1537 successful, 1538 buttons = []; 1539 1540 if (!!this.obPopupWin) 1541 { 1542 this.obPopupWin.close(); 1543 } 1544 if ('object' !== typeof arResult) 1545 { 1546 return false; 1547 } 1548 successful = (arResult.STATUS === 'OK'); 1549 if (successful && this.basketAction === 'BUY') 1550 { 1551 this.BasketRedirect(); 1552 } 1553 else 1554 { 1555 this.InitPopupWindow(); 1556 if (successful) 1557 { 1558 BX.onCustomEvent('OnBasketChange'); 1559 switch(this.productType) 1560 { 1561 case 1:// 1562 case 2:// 1563 strPict = this.product.pict.SRC; 1564 break; 1565 case 3: 1566 strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ? 1567 this.offers[this.offerNum].PREVIEW_PICTURE.SRC : 1568 this.defaultPict.pict.SRC 1569 ); 1570 break; 1571 } 1572 strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><img src="'+strPict+'" height="130"><p>'+this.product.name+'</p></div>'; 1573 if (this.showClosePopup) 1574 { 1575 buttons = [ 1576 new BasketButton({ 1577 ownerClass: this.obProduct.parentNode.parentNode.className, 1578 text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"), 1579 events: { 1580 click: BX.delegate(this.BasketRedirect, this) 1581 }, 1582 style: {marginRight: '10px'} 1583 }), 1584 new BasketButton({ 1585 ownerClass: this.obProduct.parentNode.parentNode.className, 1586 text: BX.message("BTN_MESSAGE_CLOSE_POPUP"), 1587 events: { 1588 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1589 } 1590 }) 1591 ]; 1592 } 1593 else 1594 { 1595 buttons = [ 1596 new BasketButton({ 1597 ownerClass: this.obProduct.parentNode.parentNode.className, 1598 text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"), 1599 events: { 1600 click: BX.delegate(this.BasketRedirect, this) 1601 } 1602 }) 1603 ]; 1604 } 1605 } 1606 else 1607 { 1608 strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))+'</p></div>'; 1609 buttons = [ 1610 new BasketButton({ 1611 ownerClass: this.obProduct.parentNode.parentNode.className, 1612 text: BX.message('BTN_MESSAGE_CLOSE'), 1613 events: { 1614 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1615 } 1616 }) 1617 ]; 1618 } 1619 this.obPopupWin.setTitleBar({ 1620 content: BX.create('div', { 1621 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1622 text: (successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR')) 1623 }) 1624 }); 1625 this.obPopupWin.setContent(strContent); 1626 this.obPopupWin.setButtons(buttons); 1627 this.obPopupWin.show(); 1628 } 1629}; 1630 1631window.JCCatalogSection.prototype.BasketRedirect = function() 1632{ 1633 location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL')); 1634}; 1635 1636window.JCCatalogSection.prototype.InitPopupWindow = function() 1637{ 1638 if (!!this.obPopupWin) 1639 { 1640 return; 1641 } 1642 this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, { 1643 autoHide: false, 1644 offsetLeft: 0, 1645 offsetTop: 0, 1646 overlay : true, 1647 closeByEsc: true, 1648 titleBar: true, 1649 closeIcon: {top: '10px', right: '10px'} 1650 }); 1651}; 1652})(window);
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.