|
161 | 161 | attrchange: function (productId, hasCondition, loadPicture) {
|
162 | 162 | var form = document.getElementById('product-details-form');
|
163 | 163 | var data = new FormData(form);
|
| 164 | + var pId; |
| 165 | + |
| 166 | + if (vm.PopupQuickViewVueModal.ProductBundleModels.length > 0) { |
| 167 | + pId = vm.PopupQuickViewVueModal.Id; |
| 168 | + } else { |
| 169 | + pId = productId; |
| 170 | + } |
| 171 | + |
164 | 172 | axios({
|
165 |
| - url: '/product/productdetails_attributechange?productId=' + productId + '&validateAttributeConditions=' + hasCondition + '&loadPicture=' + loadPicture, |
| 173 | + url: '/product/productdetails_attributechange?productId=' + pId + '&validateAttributeConditions=' + hasCondition + '&loadPicture=' + loadPicture, |
166 | 174 | data: data,
|
167 | 175 | method: 'post',
|
168 |
| - params: { product: productId }, |
| 176 | + params: { product: pId }, |
169 | 177 | }).then(function (response) {
|
170 |
| - if (response.data.price) { |
171 |
| - vm.PopupQuickViewVueModal.ProductPrice.Price = response.data.price; |
172 |
| - } |
173 |
| - if (response.data.sku) { |
174 |
| - vm.PopupQuickViewVueModal.Sku = response.data.sku; |
175 |
| - } |
176 |
| - if (response.data.mpn) { |
177 |
| - vm.PopupQuickViewVueModal.Mpn = response.data.mpn; |
178 |
| - } |
179 |
| - if (response.data.gtin) { |
180 |
| - vm.PopupQuickViewVueModal.Gtin = response.data.gtin; |
181 |
| - } |
182 |
| - if (response.data.stockAvailability) { |
183 |
| - vm.PopupQuickViewVueModal.StockAvailability = response.data.stockAvailability; |
184 |
| - } |
185 |
| - if (response.data.buttonTextOutOfStockSubscription) { |
186 |
| - PopupQuickViewVueModal.StockAvailability = response.data.stockAvailability; |
187 |
| - } |
188 |
| - if (response.data.enabledattributemappingids) { |
189 |
| - for (var i = 0; i < response.data.enabledattributemappingids.length; i++) { |
190 |
| - document.querySelector('#product_attribute_label_' + response.data.enabledattributemappingids[i]).style.display = "table-cell"; |
191 |
| - document.querySelector('#product_attribute_input_' + response.data.enabledattributemappingids[i]).style.display = "table-cell"; |
| 178 | + if (vm.PopupQuickViewVueModal.ProductBundleModels.length > 0) { |
| 179 | + if (response.data.price) { |
| 180 | + vm.PopupQuickViewVueModal.ProductPrice.Price = response.data.price; |
192 | 181 | }
|
193 |
| - } |
194 |
| - if (response.data.disabledattributemappingids) { |
195 |
| - for (var i = 0; i < response.data.disabledattributemappingids.length; i++) { |
196 |
| - document.querySelector('#product_attribute_label_' + response.data.disabledattributemappingids[i]).style.display = "none"; |
197 |
| - document.querySelector('#product_attribute_input_' + response.data.disabledattributemappingids[i]).style.display = "none"; |
| 182 | + } else { |
| 183 | + if (response.data.price) { |
| 184 | + vm.PopupQuickViewVueModal.ProductPrice.Price = response.data.price; |
198 | 185 | }
|
199 |
| - } |
200 |
| - if (response.data.notAvailableAttributeMappingids) { |
201 |
| - document.querySelectorAll('[data-disable]').forEach((element) => element.disabled = false); |
202 |
| - for (var i = 0; i < response.data.notAvailableAttributeMappingids.length; i++) { |
203 |
| - if (document.querySelectorAll("[data-disable='" + response.data.notAvailableAttributeMappingids[i] + "']").length > 0) { |
204 |
| - document.querySelectorAll("[data-disable='" + response.data.notAvailableAttributeMappingids[i] + "']")[0].disabled = true; |
| 186 | + if (response.data.sku) { |
| 187 | + vm.PopupQuickViewVueModal.Sku = response.data.sku; |
| 188 | + } |
| 189 | + if (response.data.mpn) { |
| 190 | + vm.PopupQuickViewVueModal.Mpn = response.data.mpn; |
| 191 | + } |
| 192 | + if (response.data.gtin) { |
| 193 | + vm.PopupQuickViewVueModal.Gtin = response.data.gtin; |
| 194 | + } |
| 195 | + if (response.data.stockAvailability) { |
| 196 | + vm.PopupQuickViewVueModal.StockAvailability = response.data.stockAvailability; |
| 197 | + } |
| 198 | + if (response.data.buttonTextOutOfStockSubscription) { |
| 199 | + PopupQuickViewVueModal.StockAvailability = response.data.stockAvailability; |
| 200 | + } |
| 201 | + if (response.data.enabledattributemappingids) { |
| 202 | + for (var i = 0; i < response.data.enabledattributemappingids.length; i++) { |
| 203 | + document.querySelector('#product_attribute_label_' + response.data.enabledattributemappingids[i]).style.display = "table-cell"; |
| 204 | + document.querySelector('#product_attribute_input_' + response.data.enabledattributemappingids[i]).style.display = "table-cell"; |
205 | 205 | }
|
206 | 206 | }
|
207 |
| - } |
208 |
| - if (response.data.pictureDefaultSizeUrl !== null) { |
209 |
| - vm.PopupQuickViewVueModal.DefaultPictureModel.ImageUrl = response.data.pictureDefaultSizeUrl; |
| 207 | + if (response.data.disabledattributemappingids) { |
| 208 | + for (var i = 0; i < response.data.disabledattributemappingids.length; i++) { |
| 209 | + document.querySelector('#product_attribute_label_' + response.data.disabledattributemappingids[i]).style.display = "none"; |
| 210 | + document.querySelector('#product_attribute_input_' + response.data.disabledattributemappingids[i]).style.display = "none"; |
| 211 | + } |
| 212 | + } |
| 213 | + if (response.data.notAvailableAttributeMappingids) { |
| 214 | + document.querySelectorAll('[data-disable]').forEach((element) => element.disabled = false); |
| 215 | + for (var i = 0; i < response.data.notAvailableAttributeMappingids.length; i++) { |
| 216 | + if (document.querySelectorAll("[data-disable='" + response.data.notAvailableAttributeMappingids[i] + "']").length > 0) { |
| 217 | + document.querySelectorAll("[data-disable='" + response.data.notAvailableAttributeMappingids[i] + "']")[0].disabled = true; |
| 218 | + } |
| 219 | + } |
| 220 | + } |
| 221 | + if (response.data.pictureDefaultSizeUrl !== null) { |
| 222 | + vm.PopupQuickViewVueModal.DefaultPictureModel.ImageUrl = response.data.pictureDefaultSizeUrl; |
| 223 | + } |
210 | 224 | }
|
211 | 225 | });
|
212 | 226 | },
|
|
295 | 309 | QuickViewShown: function () {
|
296 | 310 | if (vm.PopupQuickViewVueModal.ProductAttributes.length > 0) {
|
297 | 311 | vm.attrchange(vm.PopupQuickViewVueModal.Id, vm.PopupQuickViewVueModal.HasCondition, true)
|
| 312 | + } else { |
| 313 | + var bundleProducts = vm.PopupQuickViewVueModal.ProductBundleModels; |
| 314 | + if (bundleProducts.length > 0) { |
| 315 | + vm.attrchange(vm.PopupQuickViewVueModal.Id, vm.PopupQuickViewVueModal.HasCondition, true) |
| 316 | + } |
298 | 317 | }
|
299 | 318 | }
|
300 | 319 | },
|
|
0 commit comments