September 28, 2022
#html-body [data-pb-style=WJ0WVEK]{justify-content:flex-start;display:flex;flex-direction:column;background-position:left top;background-size:cover;background-repeat:no-repeat;background-attachment:scroll}
Exercising when wearing glasses can be an unpleasant experience. It can feel uncomfortable, create potential safety issues and really affect the quality of your workout.
If you experience problems with your glasses steaming up, slipping down your nose, or falling off completely, then read on. We have put together some helpful tips that will make exercising when wearing glasses a whole lot easier.
Wear Sports Glasses
.product-items .glide__slide {
max-width: calc((100% - 30px)/4);
margin-left: 5px;
margin-right: 5px;
}
@media (max-width: 1280px) {
.product-items .glide__slide {
max-width: calc(100% /3);
}
}
@media (max-width: 1024px) {
.product-items .glide__slide {
max-width: calc(100%/2);
}
}
@media (max-width: 740px) {
.product-items .glide__slide {
max-width: calc(10/11*100%);
}
}
Eligible for Speedy Shipping:
This product qualifies for our Speedy Shipping service! Your order will be sent via Royal Mail Tracked 48hr, ensuring quick and reliable delivery straight to your door.
GG1326S
function initPriceBox__6a4dd36829426()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 128285),
regularPrice : 276,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
58
function initConfigurableSwatchOptions_128285() {
const configurableOptionsComponent = initConfigurableOptions(
'128285',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"10","label":"Black","products":["128216"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"4928","label":"58-19-140","products":[]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"128216":{"baseOldPrice":{"amount":230},"oldPrice":{"amount":276},"basePrice":{"amount":230},"finalPrice":{"amount":276},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":230},"oldPrice":{"amount":276},"basePrice":{"amount":230},"finalPrice":{"amount":276}},"productId":"128285","chooseText":"Choose an Option...","images":[],"index":{"128216":{"93":"10","156":null}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"128216":"001"}},"additional_product_data":{"configurable":{"id":"128285","sku":"GG1326S","custom_options":null},"simples":{"128216":{"sku":"GG1326S-001-58-19-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"10":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/l\/black_20.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/l\/black_20.png","label":"Black"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-128285",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$276.00
BB0172O
function initPriceBox__6a4dd3683cea2()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 128282),
regularPrice : 252.54,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
54
function initConfigurableSwatchOptions_128282() {
const configurableOptionsComponent = initConfigurableOptions(
'128282',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"10","label":"Black","products":["128212"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"456","label":"54-16-140","products":[]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"128212":{"baseOldPrice":{"amount":210.45},"oldPrice":{"amount":252.54},"basePrice":{"amount":210.45},"finalPrice":{"amount":252.54},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":210.45},"oldPrice":{"amount":252.54},"basePrice":{"amount":210.45},"finalPrice":{"amount":252.54}},"productId":"128282","chooseText":"Choose an Option...","images":[],"index":{"128212":{"93":"10","156":null}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"128212":"001"}},"additional_product_data":{"configurable":{"id":"128282","sku":"BB0172O","custom_options":null},"simples":{"128212":{"sku":"BB0172O-001-54-16-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"10":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/l\/black_20.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/l\/black_20.png","label":"Black"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-128282",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$252.54
BIO-1029
function initPriceBox__6a4dd36845138()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123851),
regularPrice : 95.22,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
53.0
function initConfigurableSwatchOptions_123851() {
const configurableOptionsComponent = initConfigurableOptions(
'123851',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"11","label":"Gold","products":["121946"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"391","label":"53-20-145","products":["121946"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"121946":{"baseOldPrice":{"amount":79.35},"oldPrice":{"amount":95.22},"basePrice":{"amount":79.35},"finalPrice":{"amount":95.22},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":79.35},"oldPrice":{"amount":95.22},"basePrice":{"amount":79.35},"finalPrice":{"amount":95.22}},"productId":"123851","chooseText":"Choose an Option...","images":[],"index":{"121946":{"93":"11","156":"391"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"121946":"Gold"}},"additional_product_data":{"configurable":{"id":"123851","sku":"BIO-1029","custom_options":null},"simples":{"121946":{"sku":"BIO-1029-001"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"11":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/g\/o\/gold_58.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/g\/o\/gold_58.png","label":"Gold"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-123851",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$95.22
ONB-4013
function initPriceBox__6a4dd3684db2e()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123792),
regularPrice : 92.46,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
50.0
function initConfigurableSwatchOptions_123792() {
const configurableOptionsComponent = initConfigurableOptions(
'123792',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"118","label":"Tortoise","products":["121854"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"564","label":"50-19-140","products":["121854"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"121854":{"baseOldPrice":{"amount":77.05},"oldPrice":{"amount":92.46},"basePrice":{"amount":77.05},"finalPrice":{"amount":92.46},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":77.05},"oldPrice":{"amount":92.46},"basePrice":{"amount":77.05},"finalPrice":{"amount":92.46}},"productId":"123792","chooseText":"Choose an Option...","images":[],"index":{"121854":{"93":"118","156":"564"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"121854":"Tort"}},"additional_product_data":{"configurable":{"id":"123792","sku":"ONB-4013","custom_options":null},"simples":{"121854":{"sku":"ONB-4013-102"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"118":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/h\/a\/havana_1__5.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/h\/a\/havana_1__5.png","label":"Tortoise"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-123792",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$92.46
ONO-4524
function initPriceBox__6a4dd368555b7()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123696),
regularPrice : 85.56,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
52.0
function initConfigurableSwatchOptions_123696() {
const configurableOptionsComponent = initConfigurableOptions(
'123696',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"118","label":"Tortoise","products":["121687"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"990","label":"52-16-135","products":["121687"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"121687":{"baseOldPrice":{"amount":71.3},"oldPrice":{"amount":85.56},"basePrice":{"amount":71.3},"finalPrice":{"amount":85.56},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":71.3},"oldPrice":{"amount":85.56},"basePrice":{"amount":71.3},"finalPrice":{"amount":85.56}},"productId":"123696","chooseText":"Choose an Option...","images":[],"index":{"121687":{"93":"118","156":"990"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"121687":"Tort"}},"additional_product_data":{"configurable":{"id":"123696","sku":"ONO-4524","custom_options":null},"simples":{"121687":{"sku":"ONO-4524-102"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"118":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/h\/a\/havana_1__5.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/h\/a\/havana_1__5.png","label":"Tortoise"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-123696",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$85.56
OR5109
function initPriceBox__6a4dd3685cea1()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 121573),
regularPrice : 118.68,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_121573() {
const configurableOptionsComponent = initConfigurableOptions(
'121573',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"10","label":"Black","products":["120586"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"399","label":"55-16-145","products":["120586"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"120586":{"baseOldPrice":{"amount":98.9},"oldPrice":{"amount":118.68},"basePrice":{"amount":98.9},"finalPrice":{"amount":118.68},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":98.9},"oldPrice":{"amount":118.68},"basePrice":{"amount":98.9},"finalPrice":{"amount":118.68}},"productId":"121573","chooseText":"Choose an Option...","images":[],"index":{"120586":{"93":"10","156":"399"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"120586":"55001"}},"additional_product_data":{"configurable":{"id":"121573","sku":"OR5109","custom_options":null},"simples":{"120586":{"sku":"OR5109-55001-55-16-145"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"10":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/l\/black_20.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/l\/black_20.png","label":"Black"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-121573",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$118.68
MM5151-B
function initPriceBox__6a4dd3686360f()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 121419),
regularPrice : 182.16,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_121419() {
const configurableOptionsComponent = initConfigurableOptions(
'121419',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"113","label":"Green","products":["120054"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"534","label":"52-14-140","products":["120054"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"120054":{"baseOldPrice":{"amount":151.8},"oldPrice":{"amount":182.16},"basePrice":{"amount":151.8},"finalPrice":{"amount":182.16},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":151.8},"oldPrice":{"amount":182.16},"basePrice":{"amount":151.8},"finalPrice":{"amount":182.16}},"productId":"121419","chooseText":"Choose an Option...","images":[],"index":{"120054":{"93":"113","156":"534"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"120054":"52098"}},"additional_product_data":{"configurable":{"id":"121419","sku":"MM5151-B","custom_options":null},"simples":{"120054":{"sku":"MM5151-B-52098-52-14-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"113":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/g\/r\/green_2.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/g\/r\/green_2.png","label":"Green"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-121419",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$182.16
CH0278S
function initPriceBox__6a4dd36871725()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 116185),
regularPrice : 298.08,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_116185() {
const configurableOptionsComponent = initConfigurableOptions(
'116185',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"15356","label":"Gold1","products":["115091"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"10066","label":"62-12-140","products":["115091"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"115091":{"baseOldPrice":{"amount":248.4},"oldPrice":{"amount":298.08},"basePrice":{"amount":248.4},"finalPrice":{"amount":298.08},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":248.4},"oldPrice":{"amount":298.08},"basePrice":{"amount":248.4},"finalPrice":{"amount":298.08}},"productId":"116185","chooseText":"Choose an Option...","images":[],"index":{"115091":{"93":"15356","156":"10066"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"115091":"006"}},"additional_product_data":{"configurable":{"id":"116185","sku":"CH0278S","custom_options":null},"simples":{"115091":{"sku":"CH0278S-006-62-12-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"15356":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/g\/o\/gold_57.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/g\/o\/gold_57.png","label":"Gold1"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-116185",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$298.08
CH0306SK
function initPriceBox__6a4dd36879142()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 116160),
regularPrice : 302.22,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_116160() {
const configurableOptionsComponent = initConfigurableOptions(
'116160',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"15356","label":"Gold1","products":["114083"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"9844","label":"59-16-145","products":["114083"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"114083":{"baseOldPrice":{"amount":251.85},"oldPrice":{"amount":302.22},"basePrice":{"amount":251.85},"finalPrice":{"amount":302.22},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":251.85},"oldPrice":{"amount":302.22},"basePrice":{"amount":251.85},"finalPrice":{"amount":302.22}},"productId":"116160","chooseText":"Choose an Option...","images":[],"index":{"114083":{"93":"15356","156":"9844"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"114083":"003"}},"additional_product_data":{"configurable":{"id":"116160","sku":"CH0306SK","custom_options":null},"simples":{"114083":{"sku":"CH0306SK-003-59-16-145"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"15356":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/g\/o\/gold_57.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/g\/o\/gold_57.png","label":"Gold1"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-116160",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$302.22
BB0310SK
function initPriceBox__6a4dd368800fd()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113666),
regularPrice : 304.98,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_113666() {
const configurableOptionsComponent = initConfigurableOptions(
'113666',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"4","label":"Brown","products":["113388"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"2508","label":"53-22-140","products":["113388"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"113388":{"baseOldPrice":{"amount":254.15},"oldPrice":{"amount":304.98},"basePrice":{"amount":254.15},"finalPrice":{"amount":304.98},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":254.15},"oldPrice":{"amount":304.98},"basePrice":{"amount":254.15},"finalPrice":{"amount":304.98}},"productId":"113666","chooseText":"Choose an Option...","images":[],"index":{"113388":{"93":"4","156":"2508"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"113388":"002"}},"additional_product_data":{"configurable":{"id":"113666","sku":"BB0310SK","custom_options":null},"simples":{"113388":{"sku":"BB0310SK-002-53-22-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"4":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/r\/brown_9.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/r\/brown_9.png","label":"Brown"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-113666",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$304.98
BB0102SA
function initPriceBox__6a4dd36887303()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113640),
regularPrice : 288.42,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
function initConfigurableSwatchOptions_113640() {
const configurableOptionsComponent = initConfigurableOptions(
'113640',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"4","label":"Brown","products":["113501"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"3926","label":"57-16-145","products":["113501"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"113501":{"baseOldPrice":{"amount":240.35},"oldPrice":{"amount":288.42},"basePrice":{"amount":240.35},"finalPrice":{"amount":288.42},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":240.35},"oldPrice":{"amount":288.42},"basePrice":{"amount":240.35},"finalPrice":{"amount":288.42}},"productId":"113640","chooseText":"Choose an Option...","images":[],"index":{"113501":{"93":"4","156":"3926"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"113501":"002"}},"additional_product_data":{"configurable":{"id":"113640","sku":"BB0102SA","custom_options":null},"simples":{"113501":{"sku":"BB0102SA-002-57-16-145"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"4":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/r\/brown_9.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/r\/brown_9.png","label":"Brown"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-113640",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$288.42
Gucci GG0022S Prescription Sunglasses
function initPriceBox__6a4dd3688d7d8()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113194),
regularPrice : 220.8,
updatePrice(priceData) {
const regularPriceLabel = this.$root.querySelector('.normal-price .price-label');
const regularPriceElement = this.$root.querySelector('.normal-price [data-price-type=finalPrice].price-wrapper .price');
const basePriceElement = this.$root.querySelector('.normal-price [data-price-type=basePrice].price-wrapper .price');
if (regularPriceLabel) {
if (priceData.finalPrice.amount < priceData.oldPrice.amount) {
regularPriceLabel.classList.add('hidden');
} else {
regularPriceLabel.classList.remove('hidden');
}
}
regularPriceElement.innerText = hyva.formatPrice(priceData.finalPrice.amount);
basePriceElement && (basePriceElement.innerText = hyva.formatPrice(priceData.basePrice.amount));
if (this.additionalPriceElement) {
if (priceData.finalPrice.amount === this.regularPrice) {
this.additionalPriceElement.classList.add('hidden');
} else if (priceData.finalPrice.amount < this.regularPrice) {
this.additionalPriceElement.classList.remove('hidden');
}
}
}
}
}
57
function initConfigurableSwatchOptions_113194() {
const configurableOptionsComponent = initConfigurableOptions(
'113194',
{"attributes":{"93":{"id":"93","code":"color","label":"Colour","options":[{"id":"10","label":"Black","products":["112954"]}],"position":"0"},"156":{"id":"156","code":"a01_size_option","label":"Size Option","options":[{"id":"3491","label":"57-18-140","products":["112954"]}],"position":"1"}},"template":"$","currencyFormat":"$%s","optionPrices":{"112954":{"baseOldPrice":{"amount":184},"oldPrice":{"amount":220.8},"basePrice":{"amount":184},"finalPrice":{"amount":220.8},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"$%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":184},"oldPrice":{"amount":220.8},"basePrice":{"amount":184},"finalPrice":{"amount":220.8}},"productId":"113194","chooseText":"Choose an Option...","images":[],"index":{"112954":{"93":"10","156":"3491"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"preSelectedGallery":[],"supplier_colour_data":{"colour_attribute_id":93,"mapping":{"112954":"001"}},"additional_product_data":{"configurable":{"id":"113194","sku":"GG0022S","custom_options":null},"simples":{"112954":{"sku":"GG0022S-001-57-18-140"}}}} );
const swatchOptionsComponent = initSwatchOptions({"93":{"10":{"type":"2","value":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_image\/40x24\/b\/l\/black_20.png","thumb":"https:\/\/jpopticians.com\/media\/attribute\/swatch\/swatch_thumb\/110x90\/b\/l\/black_20.png","label":"Black"},"additional_data":"{\"swatch_input_type\":\"visual\",\"update_product_preview_image\":\"1\",\"use_product_image_for_swatch\":\"0\"}"}});
return Object.assign(
configurableOptionsComponent,
swatchOptionsComponent,
{
mediaCallback: "https\u003A\u002F\u002Fjpopticians.com\u002Fjp_us\u002Fswatches\u002Fajax\u002Fmedia\u002F",
changeOption(optionId, value, skipUpdateGallery) {
if (value === '') {
this.selectedValues = this.removeAttrFromSelection(this.selectedValues, optionId)
} else {
this.selectedValues[optionId] = value;
}
this.findSimpleIndex();
this.findAllowedAttributeOptions();
this.updatePrices();
!skipUpdateGallery && this.updateGallery();
let candidates = this.findProductIdsForPartialSelection(this.selectedValues);
window.dispatchEvent(new CustomEvent('listing-configurable-selection-changed', {
detail: {
productId: this.productId,
optionId,
value,
productIndex: this.productIndex,
selectedValues: this.selectedValues,
candidates: candidates,
skuCandidates: this.optionConfig.sku ? Object.values(candidates).map(id => this.optionConfig.sku[id]) : [],
}
}));
},
updateGallery() {
if (!this.productIndex) {
return;
}
fetch(`${this.mediaCallback}?product_id=${this.productIndex}&parent_id=${this.productId}&isAjax=true`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
}
).then(response => {
return response.json()
}
).then(data => {
if (data.errors) {
// non critical failure only console logged
console.warn(data.errors);
} else {
const image = data && data.medium;
image && window.dispatchEvent(
new CustomEvent(
"update-gallery-113194",
{detail: image}
)
);
}
}).catch(error => {
console.warn(error)
});
},
preselectQuerystringItems() {
// pre-select option like ?size=167
const urlQueryParams = new URLSearchParams(window.location.search.replace('?', ''));
Object.values(this.optionConfig.attributes).map(attribute => {
// Don't update images on load, since PLPs already set the main image to the selected options
const skipUpdateGallery = true;
urlQueryParams.get(attribute.code) &&
this.changeOption(attribute.id, urlQueryParams.get(attribute.code), skipUpdateGallery);
});
},
mouseDown: false,
startX: 0,
maxScroll: 0,
scrollLeft: null,
slider: null,
scrollEvents: {
['@mousedown'](e) {
this.slider = e.target.closest('.snap');
if (!this.slider) {
return;
}
this.maxScroll = this.slider.scrollWidth - this.slider.offsetWidth;
this.startX = e.pageX - this.slider.offsetLeft;
this.scrollLeft = this.slider.scrollLeft;
this.mouseDown = true;
},
['@mouseout.self']() {
this.mouseDown = false;
},
['@mouseup']() {
this.mouseDown = false;
},
['@mousemove'](e) {
e.preventDefault();
if (!this.mouseDown) {
return;
}
const x = e.pageX - this.slider.offsetLeft;
const scroll = x - this.startX;
const scrollLeft = this.scrollLeft - scroll;
if (scrollLeft > this.maxScroll) {
this.slider.scrollLeft = this.maxScroll;
return
}
this.slider.scrollLeft = this.scrollLeft - scroll;
},
['@onselectstart']() {
return false;
}
},
resizeEvent() {
Array.from(this.$root.querySelectorAll('.snap')).forEach(slider => {
slider.scrollLeft = 0;
})
}
}
);
}
As low as
$220.80
Gucci GG0010S