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 100 // éå¸¸ä¾¡æ ¼ 101 var $price01 = $form.parent().find('.price01-default').first(); 102 if (typeof this.price01_origin === 'undefined') { 103 // åæå¤ãä¿æãã¦ãã 104 this.price01_origin = $price01.html(); 105 } 106 $price01.html(this.price01_origin); 107 108 // è²©å£²ä¾¡æ ¼ 109 var $price02 = $form.parent().find('.price02-default').first(); 110 if (typeof price02_origin[product_id] === 'undefined') { 111 // åæå¤ãä¿æãã¦ãã 112 price02_origin[product_id] = $price02.html(); 113 } 114 $price02.html(price02_origin[product_id]); 115 116 // ååè¦æ ¼ 117 var $product_class_id_dynamic = $form.find('[id^=ProductClass]'); 118 $product_class_id_dynamic.val(''); 119 120 } else { 121 // ååã³ã¼ã 122 var $product_code = $('.product-code-default'); 123 if (classcat2 && typeof classcat2.product_code !== 'undefined') { 124 $product_code.text(classcat2.product_code); 125 } else { 126 $product_code.text(this.product_code_origin); 127 } 128 129 // å¨åº«(ååã) 130 var $cartbtn = $form.parent().find('.add-cart').first(); 131 if (typeof this.product_cart_origin === 'undefined') { 132 // åæå¤ãä¿æãã¦ãã 133 this.product_cart_origin = $cartbtn.html(); 134 } 135 if (classcat2 && classcat2.stock_find === false) { 136 $cartbtn.prop('disabled', true); 137 $cartbtn.text(eccube_lang['front.product.out_of_stock']); 138 } else { 139 $cartbtn.prop('disabled', false); 140 $cartbtn.html(this.product_cart_origin); 141 } 142 143 // éå¸¸ä¾¡æ ¼ 144 var $price01 = $form.parent().find('.price01-default').first(); 145 if (typeof this.price01_origin === 'undefined') { 146 // åæå¤ãä¿æãã¦ãã 147 this.price01_origin = $price01.html(); 148 } 149 if (classcat2 && typeof classcat2.price01_inc_tax !== 'undefined' && String(classcat2.price01_inc_tax).length >= 1) { 150 $price01.text(classcat2.price01_inc_tax_with_currency); 151 } else { 152 $price01.html(this.price01_origin); 153 } 154 155 // è²©å£²ä¾¡æ ¼ 156 var $price02 = $form.parent().find('.price02-default').first(); 157 if (typeof price02_origin[product_id] === 'undefined') { 158 // åæå¤ãä¿æãã¦ãã 159 price02_origin[product_id] = $price02.html(); 160 } 161 if (classcat2 && typeof classcat2.price02_inc_tax !== 'undefined' && String(classcat2.price02_inc_tax).length >= 1) { 162 $price02.text(classcat2.price02_inc_tax_with_currency); 163 } else { 164 $price02.html(price02_origin[product_id]); 165 } 166 167 // ãã¤ã³ã 168 var $point_default = $form.find('[id^=point_default]'); 169 var $point_dynamic = $form.find('[id^=point_dynamic]'); 170 if (classcat2 && typeof classcat2.point !== 'undefined' && String(classcat2.point).length >= 1) { 171 172 $point_dynamic.text(classcat2.point).show(); 173 $point_default.hide(); 174 } else { 175 $point_dynamic.hide(); 176 $point_default.show(); 177 } 178 179 // ååè¦æ ¼ 180 var $product_class_id_dynamic = $form.find('[id^=ProductClass]'); 181 if (classcat2 && typeof classcat2.product_class_id !== 'undefined' && String(classcat2.product_class_id).length >= 1) { 182 $product_class_id_dynamic.val(classcat2.product_class_id); 183 } else { 184 $product_class_id_dynamic.val(''); 185 } 186 } 187 }; 188 189 190 /** 191 * Initialize. 192 */ 193 $(function() { 194 // ç¡éã¹ã¯ãã¼ã«çã§å¾ãã追å ãããè¦ç´ ã«ãå¹ãããã¤ãã³ãå§è²ãã 195 // è¦æ ¼1鏿æ 196 $(document) 197 .on('change', 'select[name=classcategory_id1]', function() { 198 var $form = $(this).parents('form'); 199 var product_id = $form.find('input[name=product_id]').val(); 200 var $sele1 = $(this); 201 var $sele2 = $form.find('select[name=classcategory_id2]'); 202 203 // è¦æ ¼1ã®ã¿ã®å ´å 204 if (!$sele2.length) { 205 eccube.checkStock($form, product_id, $sele1.val(), null); 206 // è¦æ ¼2ããã®å ´å 207 } else { 208 eccube.setClassCategories($form, product_id, $sele1, $sele2); 209 } 210 }); 211 212 // è¦æ ¼2鏿æ 213 $(document) 214 .on('change', 'select[name=classcategory_id2]', function() { 215 var $form = $(this).parents('form'); 216 var product_id = $form.find('input[name=product_id]').val(); 217 var $sele1 = $form.find('select[name=classcategory_id1]'); 218 var $sele2 = $(this); 219 eccube.checkStock($form, product_id, $sele1.val(), $sele2.val()); 220 }); 221 }); 222})(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.