$product = {"id":1428028522595,"title":"犀牛盾CrashGuard 防摔邊框手機殼 - iPhone 7 Plus\/ 8 Plus","handle":"iphone-8-plus-crashguard-nx","description":"\u003cmeta charset=\"utf-8\"\u003e\u003cmeta charset=\"utf-8\"\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cspan\u003e1、CrashGuard NX與ModNX的飾條、按鈕皆可共用。\u003c\/span\u003e\u003c\/span\u003e\u003c\/strong\u003e\u003cbr\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cstrong\u003e2、未附背板,\u003c\/strong\u003e\u003c\/span\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cstrong\u003e若需透明背板搭配,請選購ModNX系列。\u003c\/strong\u003e\u003c\/span\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cspan style=\"color: #ff0000;\"\u003e\u003cimg src=\"\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/files\/unnamed_large.png?v=1535958095\" alt=\"\" width=\"572\" height=\"356\"\u003e\u003c\/span\u003e\u003c\/strong\u003e\u003c\/p\u003e","published_at":"2018-09-11T18:52:39+08:00","created_at":"2018-09-11T18:52:39+08:00","vendor":"Rhinoshieldtaiwan","type":"CrashGuard NX","tags":["20%","20240304-reseller-\u003ereplace_to-","25%","30%","35%","40%","45%","45degree","50%","brand-Apple","bundle-addition","crashguard","device-iphone 8 Plus","discountable-item","dropdownDevice-Apple iPhone 7 Plus\/8 Plus","member","quickbuy","refresh-2023","reseller","reseller-asus","reseller-crashguard-nx","Top50"],"price":68000,"price_min":68000,"price_max":68000,"available":true,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":12566930980963,"title":"黑色","option1":"黑色","option2":null,"option3":null,"sku":"CGN0105524","requires_shipping":true,"taxable":true,"featured_image":{"id":3896849137763,"product_id":1428028522595,"position":2,"created_at":"2018-09-11T19:10:06+08:00","updated_at":"2021-09-02T17:20:56+08:00","alt":null,"width":1807,"height":1808,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456","variant_ids":[12566930980963]},"available":true,"name":"犀牛盾CrashGuard 防摔邊框手機殼 - iPhone 7 Plus\/ 8 Plus - 黑色","public_title":"黑色","options":["黑色"],"price":68000,"weight":100,"compare_at_price":null,"inventory_quantity":-4291,"inventory_management":null,"inventory_policy":"continue","barcode":"4710227230024","featured_media":{"alt":null,"id":949541470307,"position":2,"preview_image":{"aspect_ratio":0.999,"height":1808,"width":1807,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-White-Frame_969b4328-217a-474b-8ab6-a6c4faf2099c.png?v=1630574456","\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-White-Frame_969b4328-217a-474b-8ab6-a6c4faf2099c.png?v=1630574456","options":["Color"],"media":[{"alt":null,"id":949541634147,"position":1,"preview_image":{"aspect_ratio":0.999,"height":1808,"width":1807,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-White-Frame_969b4328-217a-474b-8ab6-a6c4faf2099c.png?v=1630574456"},"aspect_ratio":0.999,"height":1808,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-White-Frame_969b4328-217a-474b-8ab6-a6c4faf2099c.png?v=1630574456","width":1807},{"alt":null,"id":949541470307,"position":2,"preview_image":{"aspect_ratio":0.999,"height":1808,"width":1807,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456"},"aspect_ratio":0.999,"height":1808,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456","width":1807}],"requires_selling_plan":false,"selling_plan_groups":[],"content":"\u003cmeta charset=\"utf-8\"\u003e\u003cmeta charset=\"utf-8\"\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cspan\u003e1、CrashGuard NX與ModNX的飾條、按鈕皆可共用。\u003c\/span\u003e\u003c\/span\u003e\u003c\/strong\u003e\u003cbr\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cstrong\u003e2、未附背板,\u003c\/strong\u003e\u003c\/span\u003e\u003cspan style=\"color: #ff0000;\" data-mce-style=\"color: #ff0000;\"\u003e\u003cstrong\u003e若需透明背板搭配,請選購ModNX系列。\u003c\/strong\u003e\u003c\/span\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cspan style=\"color: #ff0000;\"\u003e\u003cimg src=\"\/\/cdn.shopify.com\/s\/files\/1\/1082\/7110\/files\/unnamed_large.png?v=1535958095\" alt=\"\" width=\"572\" height=\"356\"\u003e\u003c\/span\u003e\u003c\/strong\u003e\u003c\/p\u003e"}; $bumper = null; $variants = [{"id":12566930980963,"title":"黑色","option1":"黑色","option2":null,"option3":null,"sku":"CGN0105524","requires_shipping":true,"taxable":true,"featured_image":{"id":3896849137763,"product_id":1428028522595,"position":2,"created_at":"2018-09-11T19:10:06+08:00","updated_at":"2021-09-02T17:20:56+08:00","alt":null,"width":1807,"height":1808,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456","variant_ids":[12566930980963]},"available":true,"name":"犀牛盾CrashGuard 防摔邊框手機殼 - iPhone 7 Plus\/ 8 Plus - 黑色","public_title":"黑色","options":["黑色"],"price":68000,"weight":100,"compare_at_price":null,"inventory_quantity":-4291,"inventory_management":null,"inventory_policy":"continue","barcode":"4710227230024","featured_media":{"alt":null,"id":949541470307,"position":2,"preview_image":{"aspect_ratio":0.999,"height":1808,"width":1807,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":12566930980963,"title":"黑色","option1":"黑色","option2":null,"option3":null,"sku":"CGN0105524","requires_shipping":true,"taxable":true,"featured_image":{"id":3896849137763,"product_id":1428028522595,"position":2,"created_at":"2018-09-11T19:10:06+08:00","updated_at":"2021-09-02T17:20:56+08:00","alt":null,"width":1807,"height":1808,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456","variant_ids":[12566930980963]},"available":true,"name":"犀牛盾CrashGuard 防摔邊框手機殼 - iPhone 7 Plus\/ 8 Plus - 黑色","public_title":"黑色","options":["黑色"],"price":68000,"weight":100,"compare_at_price":null,"inventory_quantity":-4291,"inventory_management":null,"inventory_policy":"continue","barcode":"4710227230024","featured_media":{"alt":null,"id":949541470307,"position":2,"preview_image":{"aspect_ratio":0.999,"height":1808,"width":1807,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/products\/i8_Black_-CrashGuardNX-Combined-Black-Frame_509a8ea2-dcdc-4207-8a53-2e6725885a40.png?v=1630574456"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; var sellingStatus; $device_handle = 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); }); } }); }; var storedData = sessionStorage.getItem('sellingStatusData'); try { sellingStatusData = JSON.parse(storedData) } catch (error) { console.error('JSON.parse Error', error) sellingStatusData = null } $(document).ready(function() { handleSellingStatus($defaultVariant.sku, sellingStatusData); }); function handleSellingStatus(currentSku, sellingStatusData) { const sellingStatusElement = document.getElementById('selling-status') const addToCartButton = document.getElementById('AddToCart-product-template') const currentProductSku = currentSku.replace(/-(.*)$/, '-') if ($variants) { const matchSellingStatusProduct = sellingStatusData.filter(product => currentProductSku === product.sku) if (matchSellingStatusProduct.length > 0) { const isProductPending = matchSellingStatusProduct[0].status === 'pending' const matchDate = matchSellingStatusProduct[0].date sellingStatus = isProductPending ? "缺貨中" : "預購完成出貨日:" + matchDate sellingStatusElement.textContent = sellingStatus if (sellingStatus.includes("缺貨中")){ addToCartButton.disabled ='true'; addToCartButton.textContent = "缺貨中無法加入購物車" } else { addToCartButton.textContent = "加到購物車" } } else { sellingStatusElement.textContent = '' addToCartButton.textContent = "加到購物車" }; }; }; document.addEventListener('DOMContentLoaded', function () { var currentVariantSelect = document.getElementById('SingleOptionSelector-0') currentVariantSelect.addEventListener('change', function() { var currentSku = $('#current_sku').text() var skuElement = document.getElementById('current-sku') skuElement.textContent = currentSku handleSellingStatus(currentSku, sellingStatusData) }); });
// 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: "停產" }