1/* 2 * This file is part of EC-CUBE 3 * 4 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. 5 * 6 * http://www.ec-cube.co.jp/ 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10*/ 11 12(function(window, undefined) { 13 14 // åå空éã®éè¤ãé²ã 15 if (window.eccube === undefined) { 16 window.eccube = {}; 17 } 18 19 var eccube = window.eccube; 20 21 // ã°ãã¼ãã«ã«ä½¿ç¨ã§ããããã«ãã 22 window.eccube = eccube; 23 24 /** 25 * è¦æ ¼2ã®ãã«ãã¦ã³ãè¨å®ãã. 26 */ 27 eccube.setClassCategories = function($form, product_id, $sele1, $sele2, selected_id2) { 28 if ($sele1 && $sele1.length) { 29 var classcat_id1 = $sele1.val() ? $sele1.val() : ''; 30 if ($sele2 && $sele2.length) { 31 // è¦æ ¼2ã®é¸æè¢ãã¯ãªã¢ 32 $sele2.children().remove(); 33 34 var classcat2; 35 36 if (eccube.hasOwnProperty('productsClassCategories')) { 37 // ååä¸è¦§æ 38 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]; 39 } else { 40 // 詳細表示æ 41 classcat2 = eccube.classCategories[classcat_id1]; 42 } 43 44 // è¦æ ¼2ã®è¦ç´ ãè¨å® 45 for (var key in classcat2) { 46 if (classcat2.hasOwnProperty(key)) { 47 var id = classcat2[key].classcategory_id2; 48 var name = classcat2[key].name; 49 var option = $('<option />').val(id ? id : '').text(name); 50 if (id === selected_id2) { 51 option.attr('selected', true); 52 } 53 $sele2.append(option); 54 } 55 } 56 eccube.checkStock($form, product_id, $sele1.val() ? $sele1.val() : '__unselected2', 57 $sele2.val() ? $sele2.val() : ''); 58 } 59 } 60 }; 61 62 /** 63 * è¦æ ¼ã®é¸æç¶æ ã«å¿ãã¦, ãã£ã¼ã«ããè¨å®ãã. 64 */ 65 var price02_origin = []; 66 eccube.checkStock = function($form, product_id, classcat_id1, classcat_id2) { 67 68 classcat_id2 = classcat_id2 ? classcat_id2 : ''; 69 70 var classcat2; 71 72 if (eccube.hasOwnProperty('productsClassCategories')) { 73 // ååä¸è¦§æ 74 classcat2 = eccube.productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 75 } else { 76 // 詳細表示æ 77 if (typeof eccube.classCategories[classcat_id1] !== 'undefined') { 78 classcat2 = eccube.classCategories[classcat_id1]['#' + classcat_id2]; 79 } 80 } 81 82 if (typeof classcat2 === 'undefined') { 83 // ååã³ã¼ã 84 var $product_code = $('.product-code-default'); 85 if (typeof this.product_code_origin === 'undefined') { 86 // åæå¤ãä¿æãã¦ãã 87 this.product_code_origin = $product_code.text(); 88 } 89 $product_code.text(this.product_code_origin); 90 91 // å¨åº«(ååã) 92 var $cartbtn = $form.parent().find('.add-cart').first(); 93 if (typeof this.product_cart_origin === 'undefined') { 94 // åæå¤ãä¿æãã¦ãã 95 this.product_cart_origin = $cartbtn.html(); 96 } 97 $cartbtn.prop('disabled', false); 98 $cartbtn.html(this.product_cart_origin); 99 $cartbtn.removeClass('btn -bnw -soldout add-cart'); 100 $cartbtn.addClass('btn -red -icon -cart add-cart'); 101 102 // éå¸¸ä¾¡æ ¼ 103 var $price01 = $form.parent().find('.price01-default').first(); 104 if (typeof this.price01_origin === 'undefined') { 105 // åæå¤ãä¿æãã¦ãã 106 this.price01_origin = $price01.html(); 107 } 108 $price01.html(this.price01_origin); 109 110 // è²©å£²ä¾¡æ ¼ 111 var $price02 = $form.parent().find('.price02-default').first(); 112 if (typeof price02_origin[product_id] === 'undefined') { 113 // åæå¤ãä¿æãã¦ãã 114 price02_origin[product_id] = $price02.html(); 115 } 116 $price02.html(price02_origin[product_id]); 117 118 // ååè¦æ ¼ 119 var $product_class_id_dynamic = $form.find('[id^=ProductClass]'); 120 $product_class_id_dynamic.val(''); 121 122 } else { 123 // ååã³ã¼ã 124 var $product_code = $('.product-code-default'); 125 if (classcat2 && typeof classcat2.product_code !== 'undefined') { 126 $product_code.text(classcat2.product_code); 127 } else { 128 $product_code.text(this.product_code_origin); 129 } 130 131 // å¨åº«(ååã) 132 var $cartbtn = $form.parent().find('.add-cart').first(); 133 if (typeof this.product_cart_origin === 'undefined') { 134 // åæå¤ãä¿æãã¦ãã 135 this.product_cart_origin = $cartbtn.html(); 136 } 137 if (classcat2 && classcat2.stock_find === false) { 138 $cartbtn.prop('disabled', true); 139 $cartbtn.removeClass('btn -red -icon -cart add-cart'); 140 $cartbtn.addClass('btn -bnw -soldout add-cart'); 141 $cartbtn.text(eccube_lang['front.product.out_of_stock']); 142 } else { 143 $cartbtn.prop('disabled', false); 144 $cartbtn.removeClass('btn -bnw -soldout add-cart'); 145 $cartbtn.addClass('btn -red -icon -cart add-cart'); 146 $cartbtn.html(this.product_cart_origin); 147 } 148 149 // éå¸¸ä¾¡æ ¼ 150 var $price01 = $form.parent().find('.price01-default').first(); 151 if (typeof this.price01_origin === 'undefined') { 152 // åæå¤ãä¿æãã¦ãã 153 this.price01_origin = $price01.html(); 154 } 155 if (classcat2 && typeof classcat2.price01 !== 'undefined' && String(classcat2.price01).length >= 1) { 156 $price01.text(classcat2.price01_with_currency); 157 } else { 158 $price01.html(this.price01_origin); 159 } 160 161 // è²©å£²ä¾¡æ ¼ 162 var $price02 = $form.parent().find('.price02-default').first(); 163 if (typeof price02_origin[product_id] === 'undefined') { 164 // åæå¤ãä¿æãã¦ãã 165 price02_origin[product_id] = $price02.html(); 166 } 167 if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) { 168 $price02.text(classcat2.price02_with_currency); 169 } else { 170 $price02.html(price02_origin[product_id]); 171 } 172 173 // ãã¤ã³ã 174 var $point_default = $form.find('[id^=point_default]'); 175 var $point_dynamic = $form.find('[id^=point_dynamic]'); 176 if (classcat2 && typeof classcat2.point !== 'undefined' && String(classcat2.point).length >= 1) { 177 178 $point_dynamic.text(classcat2.point).show(); 179 $point_default.hide(); 180 } else { 181 $point_dynamic.hide(); 182 $point_default.show(); 183 } 184 185 // ååè¦æ ¼ 186 var $product_class_id_dynamic = $form.find('[id^=ProductClass]'); 187 if (classcat2 && typeof classcat2.product_class_id !== 'undefined' && String(classcat2.product_class_id).length >= 1) { 188 $product_class_id_dynamic.val(classcat2.product_class_id); 189 } else { 190 $product_class_id_dynamic.val(''); 191 } 192 } 193 }; 194 195 196 /** 197 * Initialize. 198 */ 199 $(function() { 200 // è¦æ ¼1鏿æ 201 $('select[name=classcategory_id1]') 202 .change(function() { 203 var $form = $(this).parents('form'); 204 var product_id = $form.find('input[name=product_id]').val(); 205 var $sele1 = $(this); 206 var $sele2 = $form.find('select[name=classcategory_id2]'); 207 208 // è¦æ ¼1ã®ã¿ã®å ´å 209 if (!$sele2.length) { 210 eccube.checkStock($form, product_id, $sele1.val(), null); 211 // è¦æ ¼2ããã®å ´å 212 } else { 213 eccube.setClassCategories($form, product_id, $sele1, $sele2); 214 } 215 }); 216 217 // è¦æ ¼2鏿æ 218 $('select[name=classcategory_id2]') 219 .change(function() { 220 var $form = $(this).parents('form'); 221 var product_id = $form.find('input[name=product_id]').val(); 222 var $sele1 = $form.find('select[name=classcategory_id1]'); 223 var $sele2 = $(this); 224 eccube.checkStock($form, product_id, $sele1.val(), $sele2.val()); 225 }); 226 }); 227})(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.