Shopify.queue = [];
$product = {"id":1432686657635,"title":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列","handle":"iphone-x-solidsuit","description":"","published_at":"2018-10-17T18:49:08+08:00","created_at":"2018-09-26T00:29:36+08:00","vendor":"愛進化科技股份有限公司","type":"SolidSuit","tags":["20%","25%","30%","35%","40%","45%","45degree","50%","brand-Apple","device-iphone X","dropdownCollection-SolidSuit","dropdownDevice-Apple iPhone X","iPhone X","member","quickbuy","reseller","reseller-asus","Top50"],"price":73000,"price_min":73000,"price_max":98000,"available":true,"price_varies":true,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":12609878098019,"title":"橡木紋","option1":"橡木紋","option2":null,"option3":null,"sku":"SSA0106458","requires_shipping":true,"taxable":true,"featured_image":{"id":3963492728931,"product_id":1432686657635,"position":1,"created_at":"2018-10-05T18:57:12+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447","variant_ids":[12609878098019]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 橡木紋","public_title":"橡木紋","options":["橡木紋"],"price":98000,"weight":100,"compare_at_price":null,"inventory_quantity":-986,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967285342307,"position":1,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447"}}},{"id":12825126076515,"title":"皮革","option1":"皮革","option2":null,"option3":null,"sku":"SSA0106461","requires_shipping":true,"taxable":true,"featured_image":{"id":3963492663395,"product_id":1432686657635,"position":2,"created_at":"2018-10-05T18:57:09+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/leather_iX.png?v=1630574447","variant_ids":[12825126076515]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 皮革","public_title":"皮革","options":["皮革"],"price":98000,"weight":100,"compare_at_price":null,"inventory_quantity":-104,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967285309539,"position":2,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/leather_iX.png?v=1630574447"}}},{"id":12609878229091,"title":"碳纖維","option1":"碳纖維","option2":null,"option3":null,"sku":"SSA0106449","requires_shipping":true,"taxable":true,"featured_image":{"id":3963492335715,"product_id":1432686657635,"position":3,"created_at":"2018-10-05T18:56:54+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-04.png?v=1630574447","variant_ids":[12609878229091]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 碳纖維","public_title":"碳纖維","options":["碳纖維"],"price":83000,"weight":100,"compare_at_price":null,"inventory_quantity":-637,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967285112931,"position":3,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-04.png?v=1630574447"}}},{"id":12609878261859,"title":"經典黑","option1":"經典黑","option2":null,"option3":null,"sku":"SSA0106452","requires_shipping":true,"taxable":true,"featured_image":{"id":3963491942499,"product_id":1432686657635,"position":4,"created_at":"2018-10-05T18:56:41+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-01.png?v=1630574447","variant_ids":[12609878261859]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 經典黑","public_title":"經典黑","options":["經典黑"],"price":73000,"weight":100,"compare_at_price":null,"inventory_quantity":-510,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967284916323,"position":4,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-01.png?v=1630574447"}}},{"id":12609878294627,"title":"櫻花粉","option1":"櫻花粉","option2":null,"option3":null,"sku":"SSA0106457","requires_shipping":true,"taxable":true,"featured_image":{"id":28357475074147,"product_id":1432686657635,"position":5,"created_at":"2021-06-29T10:08:11+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":600,"height":600,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA0108457_grande_grande_460bd47f-4d6c-4ff2-8a2a-7f164c32786c.png?v=1630574447","variant_ids":[12609878294627]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 櫻花粉","public_title":"櫻花粉","options":["櫻花粉"],"price":73000,"weight":100,"compare_at_price":null,"inventory_quantity":-206,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":20664829149283,"position":5,"preview_image":{"aspect_ratio":1.0,"height":600,"width":600,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA0108457_grande_grande_460bd47f-4d6c-4ff2-8a2a-7f164c32786c.png?v=1630574447"}}},{"id":12609878360163,"title":"經典白","option1":"經典白","option2":null,"option3":null,"sku":"SSA0106453","requires_shipping":true,"taxable":true,"featured_image":{"id":3963492171875,"product_id":1432686657635,"position":6,"created_at":"2018-10-05T18:56:52+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-03.png?v=1630574447","variant_ids":[12609878360163]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 經典白","public_title":"經典白","options":["經典白"],"price":73000,"weight":100,"compare_at_price":null,"inventory_quantity":-65,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967285014627,"position":6,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-03.png?v=1630574447"}}},{"id":12609878425699,"title":"髮絲紋","option1":"髮絲紋","option2":null,"option3":null,"sku":"SSA0106468","requires_shipping":true,"taxable":true,"featured_image":{"id":3963492401251,"product_id":1432686657635,"position":7,"created_at":"2018-10-05T18:56:57+08:00","updated_at":"2021-09-02T17:20:47+08:00","alt":null,"width":1500,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-05_a249d0e5-dcbc-4904-a23b-0c2f69d3747f.png?v=1630574447","variant_ids":[12609878425699]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 髮絲紋","public_title":"髮絲紋","options":["髮絲紋"],"price":98000,"weight":100,"compare_at_price":null,"inventory_quantity":-159,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":967285178467,"position":7,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-05_a249d0e5-dcbc-4904-a23b-0c2f69d3747f.png?v=1630574447"}}},{"id":39537944068195,"title":"海軍藍","option1":"海軍藍","option2":null,"option3":null,"sku":"SSA01064J5","requires_shipping":true,"taxable":true,"featured_image":{"id":28519084228707,"product_id":1432686657635,"position":8,"created_at":"2021-09-06T11:35:24+08:00","updated_at":"2021-09-06T11:35:24+08:00","alt":null,"width":1999,"height":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/new-bumper-back-45degree-SSA01084J5.png?v=1630899324","variant_ids":[39537944068195]},"available":true,"name":"犀牛盾SolidSuit防摔背蓋手機殼 - iPhone X系列 - 海軍藍","public_title":"海軍藍","options":["海軍藍"],"price":73000,"weight":100,"compare_at_price":null,"inventory_quantity":-17,"inventory_management":null,"inventory_policy":"deny","barcode":null,"featured_media":{"alt":null,"id":20831977701475,"position":8,"preview_image":{"aspect_ratio":1.333,"height":1500,"width":1999,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/new-bumper-back-45degree-SSA01084J5.png?v=1630899324"}}}],"images":["\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/leather_iX.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-04.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-01.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA0108457_grande_grande_460bd47f-4d6c-4ff2-8a2a-7f164c32786c.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-03.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-05_a249d0e5-dcbc-4904-a23b-0c2f69d3747f.png?v=1630574447","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/new-bumper-back-45degree-SSA01084J5.png?v=1630899324","\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA-X_c3b82942-dc5a-447e-aaa9-48c53928dece.png?v=1630574447"],"featured_image":"\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447","options":["Color"],"media":[{"alt":null,"id":967285342307,"position":1,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/oak_iX.png?v=1630574447","width":1500},{"alt":null,"id":967285309539,"position":2,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/leather_iX.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/leather_iX.png?v=1630574447","width":1500},{"alt":null,"id":967285112931,"position":3,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-04.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-04.png?v=1630574447","width":1500},{"alt":null,"id":967284916323,"position":4,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-01.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-01.png?v=1630574447","width":1500},{"alt":null,"id":20664829149283,"position":5,"preview_image":{"aspect_ratio":1.0,"height":600,"width":600,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA0108457_grande_grande_460bd47f-4d6c-4ff2-8a2a-7f164c32786c.png?v=1630574447"},"aspect_ratio":1.0,"height":600,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA0108457_grande_grande_460bd47f-4d6c-4ff2-8a2a-7f164c32786c.png?v=1630574447","width":600},{"alt":null,"id":967285014627,"position":6,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-03.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-03.png?v=1630574447","width":1500},{"alt":null,"id":967285178467,"position":7,"preview_image":{"aspect_ratio":1.0,"height":1500,"width":1500,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-05_a249d0e5-dcbc-4904-a23b-0c2f69d3747f.png?v=1630574447"},"aspect_ratio":1.0,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/0330-20_solidsuit-x-05_a249d0e5-dcbc-4904-a23b-0c2f69d3747f.png?v=1630574447","width":1500},{"alt":null,"id":20831977701475,"position":8,"preview_image":{"aspect_ratio":1.333,"height":1500,"width":1999,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/new-bumper-back-45degree-SSA01084J5.png?v=1630899324"},"aspect_ratio":1.333,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/new-bumper-back-45degree-SSA01084J5.png?v=1630899324","width":1999},{"alt":null,"id":20821808808035,"position":9,"preview_image":{"aspect_ratio":1.333,"height":1500,"width":1999,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA-X_c3b82942-dc5a-447e-aaa9-48c53928dece.png?v=1630574447"},"aspect_ratio":1.333,"height":1500,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/products\/SSA-X_c3b82942-dc5a-447e-aaa9-48c53928dece.png?v=1630574447","width":1999}],"content":""};
$bumper = null;
if ($bumper) {
$(document).ready(function() {
var productImg = $product.images[0]
var bumperVariants = $bumper.variants;
var bumperColors = new Object();
var currentVariant = '';
var productType = '';
bumperVariants.forEach(variant => {
bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src;
});
if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') {
mergeImages([productImg, bumperColors[currentVariant]],{
crossOrigin: 'anonymous'
})
.then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
} else {
mergeImages([bumperColors[currentVariant], productImg],{
crossOrigin: 'anonymous'
})
.then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
}
});
}
$(function() {
// switch device
$('#select-device').on('change', function() {
window.location.href = $(this).val();
});
// listen quantity changed
$('input[name=quantity]').on('change', function() {
var quantity = $(this).val();
});
// checkbox action
$("input:checkbox").on('click', function() {
// in the handler, 'this' refers to the box clicked on
var $box = $(this);
if ($box.is(":checked")) {
// the name of the box is retrieved using the .attr() method
// as it is assumed and expected to be immutable
var group = "input:checkbox[name='" + $box.attr("name") + "']";
// the checked state of the group/box on the other hand will change
// and the current value is retrieved using .prop() method
$(group).prop("checked", false);
$box.prop("checked", true);
} else {
$box.prop("checked", false);
}
});
// add to cart
$("#AddToCart-product-template").click(function(e){
var elem;
var addition = {};
Shopify.queue = [];
e.preventDefault();
// elem = $(this);
// $(elem).prop("disabled", true);
var original_variant_id = $('.product-form').serialize().split('&')[0].split('=')[1];
var original_variant_quantity = $('.product-form').serialize().split('&')[1].split('=')[1];
addition.id = original_variant_id;
addition.quantity = original_variant_quantity;
Shopify.queue.push(addition);
$.each($("input[name^='recommend[']:checked"), function(i, v) {
var addition = {};
var name = $(this).attr('name');
var quantity = $('select[name="' + name + '"]').val();
addition.id = $(this).val();
addition.quantity = quantity;
Shopify.queue.push(addition);
});
Shopify.moveAlong();
});
Shopify.moveAlong = function() {
// If we still have requests in the queue, let's process the next one.
// console.log(Shopify.queue);
if (Shopify.queue.length) {
var request = Shopify.queue.shift();
Shopify.addItem(request.id, request.quantity, Shopify.moveAlong);
}
// If the queue is empty, take care of the main item
else {
$.getJSON('/cart.js', function(cart) {
$('#CartCount').removeClass('hide');
$('#item-count').text(cart.item_count);
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-bottom-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
toastr["success"]("成功加入購物車");
});
}
};
});
// Override default values of shop.strings for each template.
// Alternate product templates can change values of
// add to cart button, sold out, and unavailable states here.
theme.productStrings = {
addToCart: "加到購物車",
soldOut: "售完",
unavailable: "停產"
}