1if (!funcDefined("sliceItemBlock")) { 2 sliceItemBlock = function () {}; 3} 4if (!funcDefined("sliceItemBlockSlide")) { 5 sliceItemBlockSlide = function (options) {}; 6} 7 8(function (window) { 9 if (!window.JCCatalogSectionOnlyElement) { 10 window.JCCatalogSectionOnlyElement = function (arParams) { 11 if (typeof arParams === "object") { 12 this.params = arParams; 13 14 this.obProduct = null; 15 this.set_quantity = 1; 16 17 this.currentPriceMode = ""; 18 this.currentPrices = []; 19 this.currentPriceSelected = 0; 20 this.currentQuantityRanges = []; 21 this.currentQuantityRangeSelected = 0; 22 23 if (this.params.MESS) { 24 this.mess = this.params.MESS; 25 } 26 27 this.init(); 28 } 29 }; 30 window.JCCatalogSectionOnlyElement.prototype = { 31 init: function () { 32 var i = 0, 33 j = 0, 34 treeItems = null; 35 36 this.obProduct = BX(this.params.ID); 37 38 if (!!this.obProduct) { 39 $(this.obProduct) 40 .find(".counter_wrapp .counter_block input") 41 .data("product", "ob" + this.obProduct.id + "el"); 42 this.currentPriceMode = this.params.ITEM_PRICE_MODE; 43 this.currentPrices = this.params.ITEM_PRICES; 44 this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES; 45 } 46 }, 47 48 setPriceAction: function () { 49 this.set_quantity = this.params.MIN_QUANTITY_BUY; 50 if ($(this.obProduct).find("input[name=quantity]").length) 51 this.set_quantity = $(this.obProduct).find("input[name=quantity]").val(); 52 53 this.checkPriceRange(this.set_quantity); 54 55 $(this.obProduct).find(".not_matrix").hide(); 56 $(this.obProduct) 57 .find(".with_matrix.price_matrix_wrapper .price:not(.discount) .values_wrapper") 58 .html( 59 getCurrentPrice( 60 this.currentPrices[this.currentPriceSelected].PRICE, 61 this.currentPrices[this.currentPriceSelected].CURRENCY, 62 this.currentPrices[this.currentPriceSelected].PRINT_PRICE 63 ) 64 ); 65 66 if ($(this.obProduct).find(".with_matrix.price_matrix_wrapper .discount")) { 67 $(this.obProduct) 68 .find(".with_matrix.price_matrix_wrapper .discount .values_wrapper") 69 .html( 70 getCurrentPrice( 71 this.currentPrices[this.currentPriceSelected].BASE_PRICE, 72 this.currentPrices[this.currentPriceSelected].CURRENCY, 73 this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE 74 ) 75 ); 76 } 77 78 if (this.params.SHOW_DISCOUNT_PERCENT_NUMBER == "Y") { 79 if ( 80 this.currentPrices[this.currentPriceSelected].PERCENT > 0 && 81 this.currentPrices[this.currentPriceSelected].PERCENT < 100 82 ) { 83 if (!$(this.obProduct).find(".with_matrix.price_matrix_wrapper .sale_block .sale_wrapper .value").length) 84 $('<div class="value"></div>').insertBefore( 85 $(this.obProduct).find(".with_matrix.price_matrix_wrapper .sale_block .sale_wrapper .text") 86 ); 87 88 $(this.obProduct) 89 .find(".with_matrix.price_matrix_wrapper .sale_block .sale_wrapper .value") 90 .html("-<span>" + this.currentPrices[this.currentPriceSelected].PERCENT + "</span>%"); 91 } else { 92 if ($(this.obProduct).find(".with_matrix.price_matrix_wrapper .sale_block .sale_wrapper .value").length) 93 $(this.obProduct).find(".with_matrix.price_matrix_wrapper .sale_block .sale_wrapper .value").remove(); 94 } 95 } 96 $(this.obProduct) 97 .find(".with_matrix.price_matrix_wrapper .sale_block .text .values_wrapper") 98 .html( 99 getCurrentPrice( 100 this.currentPrices[this.currentPriceSelected].DISCOUNT, 101 this.currentPrices[this.currentPriceSelected].CURRENCY, 102 this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT 103 ) 104 ); 105 106 if ("NOT_SHOW" in this.params && this.params.NOT_SHOW != "Y") $(this.obProduct).find(".with_matrix").show(); 107 108 if (arMaxOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y") { 109 if (typeof this.currentPrices[this.currentPriceSelected] !== "undefined") 110 setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE); 111 } 112 }, 113 114 checkPriceRange: function (quantity) { 115 if (typeof quantity === "undefined" || this.currentPriceMode != "Q") return; 116 117 var range, 118 found = false;
119 120 for (var i in this.currentQuantityRanges) { 121 if (this.currentQuantityRanges.hasOwnProperty(i)) { 122 range = this.currentQuantityRanges[i]; 123 124 if ( 125 parseInt(quantity) >= parseInt(range.SORT_FROM) && 126 (range.SORT_TO == "INF" || parseInt(quantity) <= parseInt(range.SORT_TO)) 127 ) { 128 found = true; 129 this.currentQuantityRangeSelected = range.HASH; 130 break; 131 } 132 } 133 } 134 135 if (!found && (range = this.getMinPriceRange())) { 136 this.currentQuantityRangeSelected = range.HASH; 137 } 138 139 for (var k in this.currentPrices) { 140 if (this.currentPrices.hasOwnProperty(k)) { 141 if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected) { 142 this.currentPriceSelected = k; 143 break; 144 } 145 } 146 } 147 }, 148 149 getMinPriceRange: function () { 150 var range; 151 152 for (var i in this.currentQuantityRanges) { 153 if (this.currentQuantityRanges.hasOwnProperty(i)) { 154 if (!range || parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)) { 155 range = this.currentQuantityRanges[i]; 156 } 157 } 158 } 159 160 return range; 161 }, 162 }; 163 } 164})(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.