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__6a4e6a66b984f()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 128285),
regularPrice : 200,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"128216":{"baseOldPrice":{"amount":166.66666666667},"oldPrice":{"amount":200},"basePrice":{"amount":166.66666666667},"finalPrice":{"amount":200},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":166.66666666667},"oldPrice":{"amount":200},"basePrice":{"amount":166.66666666667},"finalPrice":{"amount":200}},"productId":"128285","chooseText":"Choose an Option...","images":[],"index":{"128216":{"93":"10","156":null}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£200.00
BB0172O
function initPriceBox__6a4e6a66bd351()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 128282),
regularPrice : 183,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"128212":{"baseOldPrice":{"amount":152.5},"oldPrice":{"amount":183},"basePrice":{"amount":152.5},"finalPrice":{"amount":183},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":152.5},"oldPrice":{"amount":183},"basePrice":{"amount":152.5},"finalPrice":{"amount":183}},"productId":"128282","chooseText":"Choose an Option...","images":[],"index":{"128212":{"93":"10","156":null}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£183.00
BIO-1029
function initPriceBox__6a4e6a66c0f0d()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123851),
regularPrice : 69,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"121946":{"baseOldPrice":{"amount":57.5},"oldPrice":{"amount":69},"basePrice":{"amount":57.5},"finalPrice":{"amount":69},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":57.5},"oldPrice":{"amount":69},"basePrice":{"amount":57.5},"finalPrice":{"amount":69}},"productId":"123851","chooseText":"Choose an Option...","images":[],"index":{"121946":{"93":"11","156":"391"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£69.00
ONB-4013
function initPriceBox__6a4e6a66c4673()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123792),
regularPrice : 67,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"121854":{"baseOldPrice":{"amount":55.833333333333},"oldPrice":{"amount":67},"basePrice":{"amount":55.833333333333},"finalPrice":{"amount":67},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":55.833333333333},"oldPrice":{"amount":67},"basePrice":{"amount":55.833333333333},"finalPrice":{"amount":67}},"productId":"123792","chooseText":"Choose an Option...","images":[],"index":{"121854":{"93":"118","156":"564"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£67.00
ONO-4524
function initPriceBox__6a4e6a66c7eb4()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 123696),
regularPrice : 62,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"121687":{"baseOldPrice":{"amount":51.666666666667},"oldPrice":{"amount":62},"basePrice":{"amount":51.666666666667},"finalPrice":{"amount":62},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":51.666666666667},"oldPrice":{"amount":62},"basePrice":{"amount":51.666666666667},"finalPrice":{"amount":62}},"productId":"123696","chooseText":"Choose an Option...","images":[],"index":{"121687":{"93":"118","156":"990"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£62.00
OR5109
function initPriceBox__6a4e6a66cb4f1()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 121573),
regularPrice : 86,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"120586":{"baseOldPrice":{"amount":71.666666666667},"oldPrice":{"amount":86},"basePrice":{"amount":71.666666666667},"finalPrice":{"amount":86},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":71.666666666667},"oldPrice":{"amount":86},"basePrice":{"amount":71.666666666667},"finalPrice":{"amount":86}},"productId":"121573","chooseText":"Choose an Option...","images":[],"index":{"120586":{"93":"10","156":"399"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£86.00
MM5151-B
function initPriceBox__6a4e6a66ce9c4()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 121419),
regularPrice : 132,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"120054":{"baseOldPrice":{"amount":110},"oldPrice":{"amount":132},"basePrice":{"amount":110},"finalPrice":{"amount":132},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":110},"oldPrice":{"amount":132},"basePrice":{"amount":110},"finalPrice":{"amount":132}},"productId":"121419","chooseText":"Choose an Option...","images":[],"index":{"120054":{"93":"113","156":"534"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£132.00
CH0278S
function initPriceBox__6a4e6a66d419e()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 116185),
regularPrice : 216,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"115091":{"baseOldPrice":{"amount":180},"oldPrice":{"amount":216},"basePrice":{"amount":180},"finalPrice":{"amount":216},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":180},"oldPrice":{"amount":216},"basePrice":{"amount":180},"finalPrice":{"amount":216}},"productId":"116185","chooseText":"Choose an Option...","images":[],"index":{"115091":{"93":"15356","156":"10066"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£216.00
CH0306SK
function initPriceBox__6a4e6a66d756e()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 116160),
regularPrice : 219,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"114083":{"baseOldPrice":{"amount":182.5},"oldPrice":{"amount":219},"basePrice":{"amount":182.5},"finalPrice":{"amount":219},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":182.5},"oldPrice":{"amount":219},"basePrice":{"amount":182.5},"finalPrice":{"amount":219}},"productId":"116160","chooseText":"Choose an Option...","images":[],"index":{"114083":{"93":"15356","156":"9844"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£219.00
BB0310SK
function initPriceBox__6a4e6a66dab80()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113666),
regularPrice : 221,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"113388":{"baseOldPrice":{"amount":184.16666666667},"oldPrice":{"amount":221},"basePrice":{"amount":184.16666666667},"finalPrice":{"amount":221},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":184.16666666667},"oldPrice":{"amount":221},"basePrice":{"amount":184.16666666667},"finalPrice":{"amount":221}},"productId":"113666","chooseText":"Choose an Option...","images":[],"index":{"113388":{"93":"4","156":"2508"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£221.00
BB0102SA
function initPriceBox__6a4e6a66de16e()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113640),
regularPrice : 209,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"113501":{"baseOldPrice":{"amount":174.16666666667},"oldPrice":{"amount":209},"basePrice":{"amount":174.16666666667},"finalPrice":{"amount":209},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":174.16666666667},"oldPrice":{"amount":209},"basePrice":{"amount":174.16666666667},"finalPrice":{"amount":209}},"productId":"113640","chooseText":"Choose an Option...","images":[],"index":{"113501":{"93":"4","156":"3926"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£209.00
Gucci GG0022S Prescription Sunglasses
function initPriceBox__6a4e6a66e16cc()
{
return {
additionalPriceElement : document.querySelector('#regular-price_' + 113194),
regularPrice : 160,
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":"\u00a3","currencyFormat":"\u00a3%s","optionPrices":{"112954":{"baseOldPrice":{"amount":133.33333333333},"oldPrice":{"amount":160},"basePrice":{"amount":133.33333333333},"finalPrice":{"amount":160},"tierPrices":[],"msrpPrice":{"amount":0}}},"priceFormat":{"pattern":"\u00a3%s","precision":2,"requiredPrecision":2,"decimalSymbol":".","groupSymbol":",","groupLength":3,"integerRequired":false},"prices":{"baseOldPrice":{"amount":133.33333333333},"oldPrice":{"amount":160},"basePrice":{"amount":133.33333333333},"finalPrice":{"amount":160}},"productId":"113194","chooseText":"Choose an Option...","images":[],"index":{"112954":{"93":"10","156":"3491"}},"salable":[],"canDisplayShowOutOfStockStatus":false,"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_uk\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
£160.00
Gucci GG0010S