Skip to content

Commit 29cc859

Browse files
author
Oleksii Korshenko
committed
MAGETWO-65261: [GitHub][PR] Fix swatch-renderer.js product id and isProductViewExist #8484
- fixed code style issues
1 parent 155fbbd commit 29cc859

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,23 +331,29 @@ define([
331331
/**
332332
* Determine product id and related data
333333
*
334-
* @returns {{productId: *, isInProductView: boolean}}
334+
* @returns {{productId: *, isInProductView: bool}}
335335
* @private
336336
*/
337-
_determineProductData: function() {
337+
_determineProductData: function () {
338338
// Check if product is in a list of products.
339-
var productId = this.element.parents('.product-item-details')
340-
.find('.price-box.price-final_price').attr('data-product-id'),
339+
var productId,
340+
product,
341341
isInProductView = false;
342342

343+
productId = this.element.parents('.product-item-details')
344+
.find('.price-box.price-final_price').attr('data-product-id');
345+
343346
if (!productId) {
344347
// Check individual product.
345-
var product = document.getElementsByName('product')[0];
348+
product = document.getElementsByName('product')[0];
346349
productId = product ? product.value : undefined;
347350
isInProductView = productId > 0;
348351
}
349352

350-
return {productId: productId, isInProductView: isInProductView};
353+
return {
354+
productId: productId,
355+
isInProductView: isInProductView
356+
};
351357
},
352358

353359
/**

0 commit comments

Comments
 (0)