const TAG = 'spz-custom-utils'; const DEFAULT_DELAY_TIME = 100; class SpzCustomUtils extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = SPZServices.templatesForDoc(); } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); } static deferredMount() { return false; } mountCallback() { } //判断是否为移动端 isMobile() { /* 判断机型与处理 */ const u = navigator.userAgent const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端 const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端 return (isAndroid || isiOS); }; /** * url query param to object * @param {string} url * @returns {object} query object */ params(url) { url = url || window.location.href; let params = {}; url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) { try { params[key] = decodeURIComponent(value); } catch (e) { params[key] = value; } }); return params; }; /** * @param fn {Function} 实际要执行的函数 * @param delay {Number} 延迟时间,单位是毫秒(ms) * @return {Function} 返回一个“防反跳”了的函数 */ debounce(fn, delay) { // 定时器,用来 setTimeout let timer; // 返回一个函数,这个函数会在一个时间区间结束后的 delay 毫秒时执行 fn 函数 return function () { // 保存函数调用时的上下文和参数,传递给 fn const context = this; const args = arguments; // 每次这个返回的函数被调用,就清除定时器,以保证不执行 fn clearTimeout(timer); // 当返回的函数被最后一次调用后(也就是用户停止了某个连续的操作), // 再过 delay 毫秒就执行 fn timer = setTimeout(function () { fn.apply(context, args); }, delay); }; }; /* 节流防抖 */ throttle(func, wait, mustRun) { var timeout, startTime = new Date(); return function () { var context = this, args = arguments, curTime = new Date(); clearTimeout(timeout); // 如果达到了规定的触发时间间隔,触发 handler if (mustRun && curTime - startTime >= mustRun) { func.apply(context, args); startTime = curTime; // 没达到触发间隔,重新设定定时器 } else { timeout = setTimeout(func, wait); } }; }; //滚动加载方法 isToPageEnd(id) { const $el = document.querySelector(`[data-section-id='${id}']`); const scrollTop = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; //滚动条距离顶部的高度 const clientHeight = window.innerHeight; //当前可视的页面高度 const scrollHeight = document.body.scrollHeight; //当前页面的总高度 const elOffsetTop = $el.getBoundingClientRect().top + window.pageYOffset - document.documentElement.clientTop; // 元素距离文档顶部距离 // 如果改卡片下面还有卡片或者dom,计算滚动加载需要考虑这个高度 const toBottom = scrollHeight - ($el.offsetHeight + elOffsetTop); //元素到浏览器底部的高度 if (scrollTop + clientHeight + toBottom + 100 >= scrollHeight) { return true; } return false; }; /** * url 添加前缀 * @param {string} path , 必须是前面有斜杠前缀的路径 * @returns string */ prefixionPath(prefix,urlPath) { if(typeof prefix !== 'string') return ; if(typeof urlPath !== 'string') return ; if(urlPath.indexOf('/') !== 0){ throw new Error('prefixPath: urlPath must be start with /'); } if(prefix.indexOf('/') !== 0){ throw new Error('prefixPath: prefix must be start with /'); } return prefix+urlPath; } /** * @param {string} urlPath * @returns {string} * @example globalizePath('/path_a/path_b')// => '/en/path_a/path_b' */ globalizePath(urlPath) { if(typeof urlPath !== 'string') return ; if(urlPath.indexOf('/') !== 0){ urlPath = '/'+urlPath; } let prefix = ((SHOPLAZZA && SHOPLAZZA.routes && SHOPLAZZA.routes.root) || ''); if(prefix.length>0){ if(prefix.indexOf('/') !== 0){ prefix = '/'+prefix; } return this.prefixionPath(prefix,urlPath); }else{ return urlPath; } } image_padding_bottom(width, height, origin) { origin = origin || 'limit'; if (width && height) { const hw_ratio = height / width; if (origin == 'limit') { if (hw_ratio < 0.62) { return '62%'; } else if (hw_ratio > 1.6) { return '160%'; } } return parseInt(hw_ratio * 100) + '%'; } return '100%'; } getNumber(str) { str = str + ''; return str.match(/\d+(\.\d+)?/g) ? Number(str.match(/\d+(\.\d+)?/g)[0]) : str; }; // 处理货币符号 finance_money_with_shop_symbol(price, onlyNumber) { const symbol = onlyNumber ? '' : window.SHOPLAZZA.currency_symbol; const position = window.SHOPLAZZA ? window.SHOPLAZZA.currency_symbol_pos : 'left'; const format = window.SHOPLAZZA ? window.SHOPLAZZA.money_format : 'amount'; if (position == 'right') { return Number(Number(price) * 1).format(format) + symbol; } return symbol + Number(Number(price) * 1).format(format); }; triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${TAG}.${name}`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomUtils) const TAG = 'spz-custom-lang-script'; class SpzCustomlangScript extends SPZ.BaseElement { constructor(element) { super(element); this.currentLangMap = null; } buildCallback() { this.getLang(); } getLang() { const i18nJSON = { 'en-US': { "start_in_text": "Start in", "end_in_text": "End in", "add_to_cart_successfully": "Added successfully", "view_cart": "View Cart", "add": "Add", "product": "Products", "modal_discount_tip": "Add {count} items for discount", "sold_out": "Sold Out", }, 'zh-CN': { "start_in_text": "距开始", "end_in_text": "距结束", "add_to_cart_successfully": "添加成功", "view_cart": "查看购物车", "add": "添加", "product": "个商品", "modal_discount_tip": "添加{count}件商品享受优惠", "sold_out": "已售罄", }, } const lang = sessionStorage._language || document.documentElement.lang || "en-US"; const currentLangMap = i18nJSON[lang] ? i18nJSON[lang] : i18nJSON["en-US"]; this.currentLangMap = currentLangMap; return currentLangMap; } getLangValue({ langKey }) { let currentLangMap = this.currentLangMap || this.getLang(); let langValue = currentLangMap[langKey]; return langValue; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomlangScript) const TAG = 'spz-custom-lang'; class SpzCustomLang extends SPZ.BaseElement { constructor(element) { super(element); this.langKey = ""; this.count = ""; this.templates_ = SPZServices.templatesForDoc(); } static deferredMount() { return false; } buildCallback() { this.langKey = this.element.getAttribute('langKey'); this.count = this.element.getAttribute('count'); } mountCallback() { const render = async () => { const tempElement = document.getElementById('spz-custom-lang-script'); SPZ.whenApiDefined(tempElement).then(async (api) => { let lang_value = await api.getLangValue({langKey: this.langKey }); if (this.count) { lang_value = lang_value.replace("{count}", this.count); } var spanDom = document.createElement("div"); spanDom.innerHTML = lang_value; this.element.innerHTML = ""; this.element.appendChild(spanDom); }); }; this.mutateElement(render); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomLang) const TAG = 'spz-custom-sort'; class SpzCustomSort extends SPZ.BaseElement { constructor(element) { super(element); this.spz_custom_id = ''; } static deferredMount() { return false; } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); } init() { this.bindEvent(); } bindEvent() { const $selectList = SPZCore.Dom.scopedQuerySelectorAll( this.element, ".sort_custom_content li" ); const $customerSelect = SPZCore.Dom.scopedQuerySelector( this.element, ".sort_custom_select" ); // 选择下拉选项 Array.from($selectList).forEach((node) => { SPZUtils.Event.listen(node, 'click', ()=> { let value = node.getAttribute('value'); let text = node.getAttribute('text'); // 触发selectChange 事件 this.triggerEvent_('selectChange', { value: value, name: value }) $customerSelect.innerHTML = text; const panelChilds = this.element.querySelectorAll(".sort_custom_panel li"); // 清空其他选项的勾选状态 Array.from(panelChilds).forEach((el) => { if(el.getAttribute('value') == value) { el.classList.add("active") } else { el.classList.remove('active'); } }) }); }) } // 渲染界面 async doRender_(data) { // 操作该组件的dom id this.spz_custom_id = data.id; return this.templates_ .findAndRenderTemplate(this.element, data) .then((el) => { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); this.element.appendChild(el); }).then(() => { this.init(); }); } setupAction_() { this.registerAction('render', async(invocation) => { const data = invocation.args.data; this.doRender_(data) }); this.registerAction('handleSelect', async(invocation) => { const data = invocation.args.data; }); this.registerAction('handleDropdownOpen', async(invocation) => { const $selectDropDown = SPZCore.Dom.scopedQuerySelector( this.element, ".select_drop_down" ); $selectDropDown.classList.add('select_drop_down_rotate'); }); this.registerAction('handleDropdownClose', async(invocation) => { const $selectDropDown = SPZCore.Dom.scopedQuerySelector( this.element, ".select_drop_down" ); $selectDropDown.classList.remove('select_drop_down_rotate'); }); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomSort) const TAG = "spz-custom-render-products"; class SpzCustomProducts extends SPZ.BaseElement { constructor(element) { super(element); } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); } doRender_(data) { return this.templates_ .findAndRenderTemplate(this.element, data) .then((el) => { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); this.element.appendChild(el); }); } getRenderTemplate(data) { const renderData = data || {}; return this.templates_ .findAndRenderTemplate(this.element, renderData) .then((el) => { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); return el; }); } setupAction_() { this.registerAction('test', (invocation) => { }); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomProducts) const TAG = 'spz-custom-discount-default'; const E_DISCOUNT_PROGRESS = { ProgressFinished : "PROGRESS_FINISHED", ProgressNotStarted : "PROGRESS_NOT_STARTED", ProgressOngoing : "PROGRESS_ONGOING" }; class SpzCustomDiscountDefault extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; let discountDefaultData = {"discount_info":{"id":"449089380720589929","center_id":"1199785","discount_name":"BOGO 50% OFF - NEW PE","display_name":"BOGO 50% OFF - NEW PE","discount_target":"DTT_PRODUCT","discount_type":"DT_BUY_ONE_GET_ONE","discount_method":"DM_AUTOMATIC","discount_code":"","starts_at":1732784399,"ends_at":1738227598,"progress":"PROGRESS_FINISHED","discount_layer":{"condition_type":"CT_PURCHASE_QUANTITY","obtain_type":"OT_PERCENT","layers":[{"condition_value":"1","obtain_count":1,"obtain_value":"50","condition_max_value":"-1"}],"layer_type":"LT_SIGNLE"},"starts_remaining_seconds":0,"ends_remaining_seconds":0,"enable_min_purchase_qty":false,"min_purchase_qty_type":"","limit_user_product_type":"LUPT_NO_LIMIT","limit_user_product_discount":-1,"oversold_type":"OTT_SALE_PRICE"},"landing_page_info":{"customer":{"is_entitled_customer":false},"banner":{"enabled":false,"text":"","config":"{\"color\":{\"banner_bg_start\":\"rgba(255, 136, 26, 1)\",\"banner_bg_end\":\"rgba(241, 48, 83, 1)\",\"banner_text\":\"rgba(255, 255, 255, 1)\",\"countdown_text\":\"rgba(34, 34, 34, 1)\",\"countdown_bg\":\"rgba(255, 246, 219, 1)\"},\"countdown\":{\"start_opened\":true,\"start_format\":\"DD:HH:mm:ss:SSS\",\"end_opened\":true,\"end_format\":\"DD:HH:mm:ss:SSS\"}}"},"poster":{"config":"{\"desktop\":\"\",\"mobile\":\"\",\"image_render\":\"fill\"}"},"additional":{"text":"","config":"{\"text_opened\":false,\"color\":{\"background\":\"rgba(230, 230, 230, 1)\",\"text\":\"rgba(34, 34, 34, 1)\"}}"},"product":{"buy_product":{"text":""},"obtain_product":{"text":""}},"price_text_config":{"text":"","config":""},"button":{"text":"","config":"","redirect_page":""},"discount_display":{"enabled":false,"text":"","config":""},"rule_description":{"enabled":false,"text":""},"product_display":{"mobile_layout":"MOBILE_LAYOUT_UNKNOWN","show_add_to_cart":false,"show_discount_label":false,"sales_progress":null,"config":""}},"buy_product_info":{"page":1,"has_more":false,"product":[{"id":"ed16a295-4320-484a-84d8-0a6b9bd5ce26","title":"Creatine Monohydrate 1000MG, Muscle Building, Muscle Recovery, 120 Capsules","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"13","inventory_tracking":true,"published":true,"handle":"creatine-monohydrate-1000mg-muscle-building-muscle-recovery-120-capsules","spu":"99712","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"32.99","price_max":"32.99","price":"32.99","compare_at_price":"32.99","compare_at_price_min":"32.99","compare_at_price_max":"32.99","url":"\/products\/creatine-monohydrate-1000mg-muscle-building-muscle-recovery-120-capsules","sales":"55","image":{"src":"\/\/img.staticdj.com\/b8bccb517de07d2aea915362eb4cb0e9.jpeg","alt":"Creatine Monohydrate 1000MG, Muscle Building, Muscle Recovery, 120 Capsules","path":"b8bccb517de07d2aea915362eb4cb0e9.jpeg","width":2000,"height":2000},"variants":[{"id":"3afdb7b9-d053-46d0-bd1a-f074ba54c678","title":"","weight_unit":"lb","inventory_quantity":"13","sku":"99712","barcode":"191609997126","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"32.99","price":"32.99","available":true,"url":"\/products\/creatine-monohydrate-1000mg-muscle-building-muscle-recovery-120-capsules?variant=3afdb7b9-d053-46d0-bd1a-f074ba54c678","available_quantity":"13","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/b8bccb517de07d2aea915362eb4cb0e9.jpeg","alt":"Creatine Monohydrate 1000MG, Muscle Building, Muscle Recovery, 120 Capsules","path":"b8bccb517de07d2aea915362eb4cb0e9.jpeg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/27771aee95020b1923d3c4966d49a079.jpeg","alt":"Creatine Monohydrate 1000MG, Muscle Building, Muscle Recovery, 120 Capsules - Supplement Facts","path":"27771aee95020b1923d3c4966d49a079.jpeg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"3bbca417-3d66-40d2-9c3c-a71090d88ded","title":"L-Glutamine Powder 5,000 mg","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"172","inventory_tracking":true,"published":true,"handle":"l-glutamine-powder-5-000-mg","spu":"","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"32.99","price_max":"32.99","price":"32.99","compare_at_price":"32.99","compare_at_price_min":"32.99","compare_at_price_max":"32.99","url":"\/products\/l-glutamine-powder-5-000-mg","sales":"10","image":{"src":"\/\/img.staticdj.com\/d3ee74569fe9859e997b5eb466558adb.jpg","alt":"L-Glutamine Powder 5,000 mg","path":"d3ee74569fe9859e997b5eb466558adb.jpg","width":2000,"height":2000},"variants":[{"id":"46f255e9-1613-49e9-b875-841e5487bacb","title":"","weight_unit":"oz","inventory_quantity":"172","sku":"99973","barcode":"191069999739","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"1.40","compare_at_price":"32.99","price":"32.99","available":true,"url":"\/products\/l-glutamine-powder-5-000-mg?variant=46f255e9-1613-49e9-b875-841e5487bacb","available_quantity":"172","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/d3ee74569fe9859e997b5eb466558adb.jpg","alt":"L-Glutamine Powder 5,000 mg","path":"d3ee74569fe9859e997b5eb466558adb.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/d87fab3c177f7d7b81d4b319a2b41301.jpg","alt":"L-Glutamine Powder 5,000 mg - Supplement Facts","path":"d87fab3c177f7d7b81d4b319a2b41301.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/37f55d271a2bae7c335e90f7a6d16042.jpg","alt":"L-Glutamine Powder 5,000 mg - Mix 5.3g of Glutamine Powder into 4-8 ounces of water or your favorite beverage one to two times daily. Drink one hour before a workout.","path":"37f55d271a2bae7c335e90f7a6d16042.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/03661918abb59ba48b1c1ff249db78e6.jpg","alt":"L-Glutamine Powder 5,000 mg - New Look, Same Great Formula","path":"03661918abb59ba48b1c1ff249db78e6.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a851788cf17ba6f37a78c2ce5ae3be62.jpg","alt":"L-Glutamine Powder 5,000 mg - Vegetarian Dietary Supplement","path":"a851788cf17ba6f37a78c2ce5ae3be62.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/3c145a72c4ff44e056dc153f9546569a.jpg","alt":"","path":"3c145a72c4ff44e056dc153f9546569a.jpg","width":2000,"height":2000}],"options":[],"product_type":"default","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"44203c06-61f6-4c57-ab15-bf31a44829f7","title":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"163","inventory_tracking":true,"published":true,"handle":"muscle-weight-gainer-rich-chocolate-muscle-building-3-6lbs","spu":"99702","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"36.99","price_max":"36.99","price":"36.99","compare_at_price":"36.99","compare_at_price_min":"36.99","compare_at_price_max":"36.99","url":"\/products\/muscle-weight-gainer-rich-chocolate-muscle-building-3-6lbs","sales":"22","image":{"src":"\/\/img.staticdj.com\/2000b3df6b8745c75c46fd54cc73236d.webp","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - 7 Servings","path":"2000b3df6b8745c75c46fd54cc73236d.webp","width":2000,"height":2000},"variants":[{"id":"92310b94-321d-464d-ae0b-ab42e757656f","title":"","weight_unit":"lb","inventory_quantity":"163","sku":"99702","barcode":"191069997025","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"36.99","price":"36.99","available":true,"url":"\/products\/muscle-weight-gainer-rich-chocolate-muscle-building-3-6lbs?variant=92310b94-321d-464d-ae0b-ab42e757656f","available_quantity":"163","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/2000b3df6b8745c75c46fd54cc73236d.webp","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - 7 Servings","path":"2000b3df6b8745c75c46fd54cc73236d.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/fa444cb8c46a4b12c23573a85c3f6486.jpg","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - Nutrition Facts","path":"fa444cb8c46a4b12c23573a85c3f6486.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/4bcba19dcf79c3b4b9d4234130ddb95d.jpg","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - Whey Protein and BCAAs","path":"4bcba19dcf79c3b4b9d4234130ddb95d.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/069e66e2ba3e0cbcb01fc65e0fc1b537.jpg","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - Helps Support Muscle Building and Weight Gaining Goals","path":"069e66e2ba3e0cbcb01fc65e0fc1b537.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/b52498a08abea1d4517a2dd6dbc490ec.webp","alt":"Muscle & Weight Gainer Rich Chocolate, Muscle Building, 3.6lbs - Supports Muscle Growth and Muscle Recovery; 860 Calories, 55g Protein, 12.2g BCAAs, 150g Carbs Per Servings","path":"b52498a08abea1d4517a2dd6dbc490ec.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/7f86fa9da36d80d39f3b55264995722b.jpg","alt":"","path":"7f86fa9da36d80d39f3b55264995722b.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"b71d00b6-aef1-4f60-b1c3-847b6431cb63","title":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"112","inventory_tracking":true,"published":true,"handle":"muscle-weight-gainer-vanilla-muscle-building-3-6-lbs","spu":"99700","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"36.99","price_max":"36.99","price":"36.99","compare_at_price":"36.99","compare_at_price_min":"36.99","compare_at_price_max":"36.99","url":"\/products\/muscle-weight-gainer-vanilla-muscle-building-3-6-lbs","sales":"104","image":{"src":"\/\/img.staticdj.com\/c9eceb47d514f1e267caaae5f1e7acd9.webp","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs","path":"c9eceb47d514f1e267caaae5f1e7acd9.webp","width":2000,"height":2000},"variants":[{"id":"b862988f-ce43-409a-a2e8-328ceec5bfb9","title":"","weight_unit":"lb","inventory_quantity":"112","sku":"99700","barcode":"191069997001","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"36.99","price":"36.99","available":true,"url":"\/products\/muscle-weight-gainer-vanilla-muscle-building-3-6-lbs?variant=b862988f-ce43-409a-a2e8-328ceec5bfb9","available_quantity":"112","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/c9eceb47d514f1e267caaae5f1e7acd9.webp","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs","path":"c9eceb47d514f1e267caaae5f1e7acd9.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a7bc0172d236d5d1d388ed40c64b8c92.jpg","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs - Nutrition Facts","path":"a7bc0172d236d5d1d388ed40c64b8c92.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/b60703afab5365259447b71bfa14cd8f.jpg","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs - Whey Protein & BCAAs","path":"b60703afab5365259447b71bfa14cd8f.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/d59e8db4b94717d1cdd185359965ed74.webp","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs - Support Muscle Growth & Muscle Recovery - 860 Calories & 55g Protein & 12.2g BCAAs & 150g Carbs PER SERVING","path":"d59e8db4b94717d1cdd185359965ed74.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/b97460201ee710e054018e9ea7d20091.jpg","alt":"","path":"b97460201ee710e054018e9ea7d20091.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/9157a9a78ef68432b7b9536734bea2ae.jpg","alt":"Muscle & Weight Gainer Vanilla, Muscle Building, 3.6 lbs - Support Muscle Building and Weight Gaining Goals","path":"9157a9a78ef68432b7b9536734bea2ae.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"6dba42fd-2e5f-4782-8b42-969d711a31d0","title":"PE BCAA + Citrulline Pwd Citrus Orng Lmnd 390g","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"200","inventory_tracking":true,"published":true,"handle":"pe-bcaa-citrulline-pwd-citrus-orng-lmnd-390g","spu":"99726","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"29.99","price_max":"29.99","price":"29.99","compare_at_price":"29.99","compare_at_price_min":"29.99","compare_at_price_max":"29.99","url":"\/products\/pe-bcaa-citrulline-pwd-citrus-orng-lmnd-390g","sales":"0","image":{"src":"\/\/img.staticdj.com\/20d787ae433e4904183df9936f506da5.webp","alt":"PE BCAA + Citrulline Pwd Citrus Orng Lmnd 390g - 8.15 OZ - Exercise Recovery, Muscle Protein Support, Fermented Amino Acids","path":"20d787ae433e4904183df9936f506da5.webp","width":2000,"height":2000},"variants":[{"id":"bf5e4272-7c1a-4c01-94c8-1248edc84c3f","title":"","weight_unit":"lb","inventory_quantity":"200","sku":"99726","barcode":"191069997261","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"29.99","price":"29.99","available":true,"url":"\/products\/pe-bcaa-citrulline-pwd-citrus-orng-lmnd-390g?variant=bf5e4272-7c1a-4c01-94c8-1248edc84c3f","available_quantity":"200","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/20d787ae433e4904183df9936f506da5.webp","alt":"PE BCAA + Citrulline Pwd Citrus Orng Lmnd 390g - 8.15 OZ - Exercise Recovery, Muscle Protein Support, Fermented Amino Acids","path":"20d787ae433e4904183df9936f506da5.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/c5381d3b0cc856dbf00972bf8144f3f4.webp","alt":"PE BCAA + Citrulline Pwd Citrus Orng Lmnd 390g - 8.15 OZ - Supplement Facts","path":"c5381d3b0cc856dbf00972bf8144f3f4.webp","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"99bbe8af-5d8a-471e-9a68-ff626ce62bb1","title":"PE BCAA Powder Unflavored 300g","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"200","inventory_tracking":true,"published":true,"handle":"pe-bcaa-powder-unflavored-300g","spu":"99717","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"29.99","price_max":"29.99","price":"29.99","compare_at_price":"29.99","compare_at_price_min":"29.99","compare_at_price_max":"29.99","url":"\/products\/pe-bcaa-powder-unflavored-300g","sales":"0","image":{"src":"\/\/img.staticdj.com\/f696528a9ec1bdaada3ce90710f25024.webp","alt":"PE BCAA Powder Unflavored 300g - Muscle Protein Support, Exercise Recovery, Fermented Amino Acids","path":"f696528a9ec1bdaada3ce90710f25024.webp","width":2000,"height":2000},"variants":[{"id":"f89db957-a185-4f21-a94b-6c14e0678739","title":"","weight_unit":"lb","inventory_quantity":"200","sku":"99717","barcode":"191069997179","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"29.99","price":"29.99","available":true,"url":"\/products\/pe-bcaa-powder-unflavored-300g?variant=f89db957-a185-4f21-a94b-6c14e0678739","available_quantity":"200","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/f696528a9ec1bdaada3ce90710f25024.webp","alt":"PE BCAA Powder Unflavored 300g - Muscle Protein Support, Exercise Recovery, Fermented Amino Acids","path":"f696528a9ec1bdaada3ce90710f25024.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/298cd4ceeb0f1cb6452abbc0368b32ea.webp","alt":"PE BCAA Powder Unflavored 300g - Supplement Facts","path":"298cd4ceeb0f1cb6452abbc0368b32ea.webp","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"f1159e72-ba71-4ec3-9fb6-f5ee6a4778c2","title":"PE BCAA+Citrulline Fruit Punch 237g","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"171","inventory_tracking":true,"published":true,"handle":"pe-bcaa-citrulline-fruit-punch-237g","spu":"99718","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"29.99","price_max":"29.99","price":"29.99","compare_at_price":"29.99","compare_at_price_min":"29.99","compare_at_price_max":"29.99","url":"\/products\/pe-bcaa-citrulline-fruit-punch-237g","sales":"13","image":{"src":"\/\/img.staticdj.com\/5891806c218e9694161c9320ac9c3606.jpg","alt":"PE BCAA+Citrulline Fruit Punch 237g - Exercise Recovery, Muscle Protein Support, Fermented Amino Acids","path":"5891806c218e9694161c9320ac9c3606.jpg","width":2000,"height":2000},"variants":[{"id":"c3576047-9b59-4294-a469-b1a0a0f68b0d","title":"","weight_unit":"lb","inventory_quantity":"171","sku":"99718","barcode":"191069997186","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"29.99","price":"29.99","available":true,"url":"\/products\/pe-bcaa-citrulline-fruit-punch-237g?variant=c3576047-9b59-4294-a469-b1a0a0f68b0d","available_quantity":"171","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/5891806c218e9694161c9320ac9c3606.jpg","alt":"PE BCAA+Citrulline Fruit Punch 237g - Exercise Recovery, Muscle Protein Support, Fermented Amino Acids","path":"5891806c218e9694161c9320ac9c3606.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/60ecbe6b5475c502ae8611cd22bca534.jpg","alt":"PE BCAA+Citrulline Fruit Punch 237g - Supplement Facts","path":"60ecbe6b5475c502ae8611cd22bca534.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"d9e34ef7-c739-4a0c-9245-bd552dbfdb64","title":"PE Casein Protein Powder Choc 1.87 lb","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"269","inventory_tracking":true,"published":true,"handle":"pe-casein-protein-powder-choc-1-87-lb","spu":"99710","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"36.99","price_max":"36.99","price":"36.99","compare_at_price":"36.99","compare_at_price_min":"36.99","compare_at_price_max":"36.99","url":"\/products\/pe-casein-protein-powder-choc-1-87-lb","sales":"13","image":{"src":"\/\/img.staticdj.com\/07152788db39828b3d8932b7a64b5068.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - 25 Servings","path":"07152788db39828b3d8932b7a64b5068.jpg","width":2000,"height":2000},"variants":[{"id":"475cc162-050d-4dba-8c04-c7d6a9dcf290","title":"","weight_unit":"lb","inventory_quantity":"269","sku":"99710","barcode":"191069997100","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"36.99","price":"36.99","available":true,"url":"\/products\/pe-casein-protein-powder-choc-1-87-lb?variant=475cc162-050d-4dba-8c04-c7d6a9dcf290","available_quantity":"269","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/07152788db39828b3d8932b7a64b5068.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - 25 Servings","path":"07152788db39828b3d8932b7a64b5068.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/7363b22c080876ed1c1636e19a7f966c.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - Nutrition Facts","path":"7363b22c080876ed1c1636e19a7f966c.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/f857d6dd91dd04d8869ffb65e1a95069.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - 25 of Protein, 5.3g of BCAAs, 2.3g of Leucine, 11.2g of EAAs","path":"f857d6dd91dd04d8869ffb65e1a95069.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/75cfdba11060210f2ee3d266dd13777d.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - 44% of EAAs, 31% of CEAAs, 25% of BBAAs","path":"75cfdba11060210f2ee3d266dd13777d.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/ef4936416ee34879f1cf919736d0b2ad.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - Delivers slow digesting, sustained-acting micellar casein","path":"ef4936416ee34879f1cf919736d0b2ad.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/0f6bc0f725cc32763a8d08e79fc119e0.jpg","alt":"PE Casein Protein Powder Choc 1.87 lb - Add 1 scoop to 6 to 10 fluid ounces of water, milk or another beverage","path":"0f6bc0f725cc32763a8d08e79fc119e0.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"a17ec399-1846-41e8-a6e3-8468e894cf81","title":"PE Casein Protein Vanilla 2lb","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"176","inventory_tracking":true,"published":true,"handle":"pe-casein-protein-vanilla-2lb","spu":"99709","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"36.99","price_max":"36.99","price":"36.99","compare_at_price":"36.99","compare_at_price_min":"36.99","compare_at_price_max":"36.99","url":"\/products\/pe-casein-protein-vanilla-2lb","sales":"4","image":{"src":"\/\/img.staticdj.com\/eb1b217442e3a0d9ecd5d1ec4763913e.jpg","alt":"PE Casein Protein Vanilla 2lb - 25 Servings","path":"eb1b217442e3a0d9ecd5d1ec4763913e.jpg","width":2000,"height":2000},"variants":[{"id":"71ab8eb9-3347-4750-b760-2c8e0e04719e","title":"","weight_unit":"lb","inventory_quantity":"176","sku":"99709","barcode":"191069997094","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"36.99","price":"36.99","available":true,"url":"\/products\/pe-casein-protein-vanilla-2lb?variant=71ab8eb9-3347-4750-b760-2c8e0e04719e","available_quantity":"176","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/eb1b217442e3a0d9ecd5d1ec4763913e.jpg","alt":"PE Casein Protein Vanilla 2lb - 25 Servings","path":"eb1b217442e3a0d9ecd5d1ec4763913e.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/5139452d4a3ac5f93136e111f9680fe2.jpg","alt":"PE Casein Protein Vanilla 2lb - Nutrition Facts","path":"5139452d4a3ac5f93136e111f9680fe2.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/f8a48c4efd1700d18853ec8d6ebea3d0.jpg","alt":"PE Casein Protein Vanilla 2lb - 25g of Protein, 5.3g of BCAAs, 2.3g of Leucine, 11.2g of EAAs","path":"f8a48c4efd1700d18853ec8d6ebea3d0.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/9e4bd3cb341c3523ba1c6f0d6722e846.jpg","alt":"PE Casein Protein Vanilla 2lb - 44% of EAAs, 31% of CEAAs, 25% of BBAAs","path":"9e4bd3cb341c3523ba1c6f0d6722e846.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/47b78d82dc2ee82f3c0ffe1d2ce1dbcc.jpg","alt":"PE Casein Protein Vanilla 2lb - Delivers slow digesting, sustained-acting micellar casein","path":"47b78d82dc2ee82f3c0ffe1d2ce1dbcc.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/6ce98ef752092310d73d6d24f0358278.jpg","alt":"PE Casein Protein Vanilla 2lb - Add 1 scoop to 6 to 10 fluid ounces of water, milk or another beverage","path":"6ce98ef752092310d73d6d24f0358278.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"b45fadf4-bacd-4536-96b5-a5ac8a2232ab","title":"PE Fireball Inferno CLA","brief":"","vendor":"ROBINSON PHARMA","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"110","inventory_tracking":true,"published":true,"handle":"pe-fireball-inferno-cla","spu":"","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"26.99","price_max":"26.99","price":"26.99","compare_at_price":"26.99","compare_at_price_min":"26.99","compare_at_price_max":"26.99","url":"\/products\/pe-fireball-inferno-cla","sales":"90","image":{"src":"\/\/img.staticdj.com\/d2692dbb7ed6a4511b37c2c45498a301.webp","alt":"PE Fireball Inferno CLA","path":"d2692dbb7ed6a4511b37c2c45498a301.webp","width":2000,"height":2000},"variants":[{"id":"696c2bb0-d18b-4889-a7b5-e24ba3391ae4","title":"","weight_unit":"kg","inventory_quantity":"110","sku":"77054","barcode":"191069770543","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"26.99","price":"26.99","available":true,"url":"\/products\/pe-fireball-inferno-cla?variant=696c2bb0-d18b-4889-a7b5-e24ba3391ae4","available_quantity":"110","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/d2692dbb7ed6a4511b37c2c45498a301.webp","alt":"PE Fireball Inferno CLA","path":"d2692dbb7ed6a4511b37c2c45498a301.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/8f61cc76b0db39555c2c94a513103239.webp","alt":"PE Fireball Inferno CLA - Supplement Facts","path":"8f61cc76b0db39555c2c94a513103239.webp","width":2000,"height":2000}],"options":[],"product_type":"default","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"b44a256d-7aae-46f5-adbf-7b89d14c7570","title":"PE Full Strength Creatine 510g","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"262","inventory_tracking":true,"published":true,"handle":"pe-full-strength-creatine-510g","spu":"99866","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"49.99","price_max":"49.99","price":"49.99","compare_at_price":"49.99","compare_at_price_min":"49.99","compare_at_price_max":"49.99","url":"\/products\/pe-full-strength-creatine-510g","sales":"13","image":{"src":"\/\/img.staticdj.com\/7029ab8412773f74bfe5ef6a6b5a2a90.webp","alt":"PE Full Strength Creatine 510g","path":"7029ab8412773f74bfe5ef6a6b5a2a90.webp","width":2000,"height":2000},"variants":[{"id":"ebab133b-47b5-4a3b-8802-f0e20fd59725","title":"","weight_unit":"lb","inventory_quantity":"262","sku":"99866","barcode":"191069998664","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"49.99","price":"49.99","available":true,"url":"\/products\/pe-full-strength-creatine-510g?variant=ebab133b-47b5-4a3b-8802-f0e20fd59725","available_quantity":"262","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/7029ab8412773f74bfe5ef6a6b5a2a90.webp","alt":"PE Full Strength Creatine 510g","path":"7029ab8412773f74bfe5ef6a6b5a2a90.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/9dcc427607d7c8dddbfa20bd3ec2f86e.webp","alt":"PE Full Strength Creatine 510g - New Look, Same Great Formula","path":"9dcc427607d7c8dddbfa20bd3ec2f86e.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/3f1b3d162fbcd7a0580e13b2a3a18d00.jpg","alt":"PE Full Strength Creatine 510g - Supplement Facts","path":"3f1b3d162fbcd7a0580e13b2a3a18d00.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/b513efe97c549348f7c1f31dead25dd8.jpg","alt":"PE Full Strength Creatine 510g - 100% Pure Creatine Monohydrate","path":"b513efe97c549348f7c1f31dead25dd8.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"8ffd96f5-bbc4-4685-a7e4-e2ce11db029d","title":"PE Syntha Phase Choc 1.9lb Powder","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"257","inventory_tracking":true,"published":true,"handle":"pe-syntha-phase-choc-1-9lb-powder","spu":"99699","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"34.99","price_max":"34.99","price":"34.99","compare_at_price":"34.99","compare_at_price_min":"34.99","compare_at_price_max":"34.99","url":"\/products\/pe-syntha-phase-choc-1-9lb-powder","sales":"46","image":{"src":"\/\/img.staticdj.com\/5407d11ec7506a009d535688354a735c.webp","alt":"PE Syntha Phase Choc 1.9lb Powder","path":"5407d11ec7506a009d535688354a735c.webp","width":4924,"height":5000},"variants":[{"id":"a894f8e0-8b4e-4f24-acb3-6e6bebe9a1eb","title":"","weight_unit":"lb","inventory_quantity":"257","sku":"99699","barcode":"191069996998","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"34.99","price":"34.99","available":true,"url":"\/products\/pe-syntha-phase-choc-1-9lb-powder?variant=a894f8e0-8b4e-4f24-acb3-6e6bebe9a1eb","available_quantity":"257","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/5407d11ec7506a009d535688354a735c.webp","alt":"PE Syntha Phase Choc 1.9lb Powder","path":"5407d11ec7506a009d535688354a735c.webp","width":4924,"height":5000},{"src":"\/\/img.staticdj.com\/4d829f51fb651b03a2380be5db37c676.jpg","alt":"PE Syntha Phase Choc 1.9lb Powder - Nutrition Facts","path":"4d829f51fb651b03a2380be5db37c676.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/62ad478fad14e55dfc52eaf3e8df4436.webp","alt":"PE Syntha Phase Choc 1.9lb Powder - 24g of Protein, 5.3g of BCAAs, 2.5g of Leucine, 7g of Prebiotic Fiber","path":"62ad478fad14e55dfc52eaf3e8df4436.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/ec388d029233d5a4dd8b278dd50a3942.jpg","alt":"PE Syntha Phase Choc 1.9lb Powder - 47% of EAAs, 27% of CEAAs, 26% of BBAAs","path":"ec388d029233d5a4dd8b278dd50a3942.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/2c2ed575c2b2b2a5ebfec21b9b3255ad.webp","alt":"PE Syntha Phase Choc 1.9lb Powder - Supports Gut Health and Hunger Balance with Prebiotic Fibers; 24 Vitamins and Essential Minerals","path":"2c2ed575c2b2b2a5ebfec21b9b3255ad.webp","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/3c663d9d63b346aa8c7eb47c8b114f37.jpg","alt":"PE Syntha Phase Choc 1.9lb Powder - Great Tasting Flavor Experience with no GMO Ingredients or Artificial Colors","path":"3c663d9d63b346aa8c7eb47c8b114f37.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"1442aff3-f577-413e-abcb-99afa72968ae","title":"PE Syntha Phase Vanilla 1.8 lb Powder","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"263","inventory_tracking":true,"published":true,"handle":"pe-syntha-phase-vanilla-1-8-lb-powder","spu":"99698","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"34.99","price_max":"34.99","price":"34.99","compare_at_price":"34.99","compare_at_price_min":"34.99","compare_at_price_max":"34.99","url":"\/products\/pe-syntha-phase-vanilla-1-8-lb-powder","sales":"56","image":{"src":"\/\/img.staticdj.com\/51530e1e0d3448f0fa6a6a46108ea1da.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - 20 Servings","path":"51530e1e0d3448f0fa6a6a46108ea1da.jpg","width":4924,"height":5000},"variants":[{"id":"e5f2f894-8e62-47db-97a2-82bf13842822","title":"","weight_unit":"lb","inventory_quantity":"263","sku":"99698","barcode":"191069996981","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"34.99","price":"34.99","available":true,"url":"\/products\/pe-syntha-phase-vanilla-1-8-lb-powder?variant=e5f2f894-8e62-47db-97a2-82bf13842822","available_quantity":"263","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/51530e1e0d3448f0fa6a6a46108ea1da.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - 20 Servings","path":"51530e1e0d3448f0fa6a6a46108ea1da.jpg","width":4924,"height":5000},{"src":"\/\/img.staticdj.com\/d97a520d9f56dfeb0cc94d45ee8290b6.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - Nutrition Facts","path":"d97a520d9f56dfeb0cc94d45ee8290b6.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/51e69e67ab5b97ed5ab7e901a0e62860.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - 24g of Protein, 5.3g of BCAAs, 2.5g of Leucine, 6g of Prebiotic Fiber","path":"51e69e67ab5b97ed5ab7e901a0e62860.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/6531aab5fe9676a520649a05fd3cdf0d.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - 47% of EAAs, 27% of CEAAs, 26% of BBAAs","path":"6531aab5fe9676a520649a05fd3cdf0d.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/9dea04299f160a6eda22856dd71c7de7.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - Support Gut Health and Hunger Balance with Prebiotic Fibers, 24 Vitamins and Essential Minerals","path":"9dea04299f160a6eda22856dd71c7de7.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/035c7511d8fe596fdb0a28248e22d1ea.jpg","alt":"PE Syntha Phase Vanilla 1.8 lb Powder - Great Tasting Flavor Experience with no GMO Ingredients or Artificial Colors","path":"035c7511d8fe596fdb0a28248e22d1ea.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"a4ab7cfb-2fda-4a83-9fdd-de654460a368","title":"PE Whey Protein Creamy Vanilla 1.98 lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"79","inventory_tracking":true,"published":true,"handle":"pe-whey-protein-creamy-vanilla-1-98-lbs","spu":"99704","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"37.99","price_max":"37.99","price":"37.99","compare_at_price":"37.99","compare_at_price_min":"37.99","compare_at_price_max":"37.99","url":"\/products\/pe-whey-protein-creamy-vanilla-1-98-lbs","sales":"137","image":{"src":"\/\/img.staticdj.com\/0208b75476d0f443088fd0f81c5b7754.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - Boost Muscle Size & Strength, Exercise Recovery and Muscle Performance","path":"0208b75476d0f443088fd0f81c5b7754.jpg","width":4924,"height":5000},"variants":[{"id":"21cb9bc8-e1f1-4aea-971a-cd921724dcb3","title":"","weight_unit":"lb","inventory_quantity":"79","sku":"99704","barcode":"191069997049","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"37.99","price":"37.99","available":true,"url":"\/products\/pe-whey-protein-creamy-vanilla-1-98-lbs?variant=21cb9bc8-e1f1-4aea-971a-cd921724dcb3","available_quantity":"79","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/0208b75476d0f443088fd0f81c5b7754.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - Boost Muscle Size & Strength, Exercise Recovery and Muscle Performance","path":"0208b75476d0f443088fd0f81c5b7754.jpg","width":4924,"height":5000},{"src":"\/\/img.staticdj.com\/10edd162da5272d63fc70da50304fa5d.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - Nutrition Facts","path":"10edd162da5272d63fc70da50304fa5d.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/4035853fd5003e528d167ac9886b26cf.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - 25g of Protein, 5.5g of BCAAs, 2.6g of Leucine, 11.7g of EAAs","path":"4035853fd5003e528d167ac9886b26cf.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/665f84abeefa5cbe714c94d9feb55854.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - Clean and free of banned substances","path":"665f84abeefa5cbe714c94d9feb55854.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a48ce795de9cdef1c057fb08a9c68e26.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - 47% EAAs, 27% CEAAs, 26% BBAAs","path":"a48ce795de9cdef1c057fb08a9c68e26.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a6109e96a299f9ed2424113b652fdd31.jpg","alt":"PE Whey Protein Creamy Vanilla 1.98 lbs - Add 1 scoop to 6 to 10 fluid ounces of water, milk or another beverage","path":"a6109e96a299f9ed2424113b652fdd31.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"4a367f66-5f33-4354-abf9-692f0c9ba22f","title":"PE Whey Protein Deluxe Choc 2.1lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"150","inventory_tracking":true,"published":true,"handle":"pe-whey-protein-deluxe-choc-2-1lbs","spu":"99705","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"37.99","price_max":"37.99","price":"37.99","compare_at_price":"37.99","compare_at_price_min":"37.99","compare_at_price_max":"37.99","url":"\/products\/pe-whey-protein-deluxe-choc-2-1lbs","sales":"69","image":{"src":"\/\/img.staticdj.com\/6e09448ff63b49abd6116b1dcba52223.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs","path":"6e09448ff63b49abd6116b1dcba52223.jpg","width":2000,"height":2000},"variants":[{"id":"61840839-3200-4b9c-8a29-414519654a5f","title":"","weight_unit":"lb","inventory_quantity":"150","sku":"99705","barcode":"191069997056","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"37.99","price":"37.99","available":true,"url":"\/products\/pe-whey-protein-deluxe-choc-2-1lbs?variant=61840839-3200-4b9c-8a29-414519654a5f","available_quantity":"150","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/6e09448ff63b49abd6116b1dcba52223.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs","path":"6e09448ff63b49abd6116b1dcba52223.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a331d11d624991f82bc68914c28b9db4.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs - Nutrition Facts","path":"a331d11d624991f82bc68914c28b9db4.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/3a55de5605c025236534ec63cd510f39.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs - 25g of Protein, 5.5g of BCAAs, 2.6g Leucine, 11.7g of EAAs","path":"3a55de5605c025236534ec63cd510f39.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/665f84abeefa5cbe714c94d9feb55854.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs - Clean and Free of Banned Substances","path":"665f84abeefa5cbe714c94d9feb55854.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/a42a05979bc5ea61c913b15af24ed534.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs - 47% EAAs, 27% of CEAAs, 26% of BBAAs","path":"a42a05979bc5ea61c913b15af24ed534.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/0db9654cde9cb68b4a8b3a61ce4c2770.jpg","alt":"PE Whey Protein Deluxe Choc 2.1lbs - Add 1 Scoop to 6 to 10 fluid ounces of water, milk or another beverage","path":"0db9654cde9cb68b4a8b3a61ce4c2770.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"4fc08fe3-2d20-49f2-9f62-ddc0e4d40b46","title":"PE Whey Protein Isolate Powder Choc 1.76lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"168","inventory_tracking":true,"published":true,"handle":"pe-whey-protein-isolate-powder-choc-1-76lbs","spu":"99707","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":true,"price_min":"39.99","price_max":"39.99","price":"39.99","compare_at_price":"39.99","compare_at_price_min":"39.99","compare_at_price_max":"39.99","url":"\/products\/pe-whey-protein-isolate-powder-choc-1-76lbs","sales":"396","image":{"src":"\/\/img.staticdj.com\/ad885b68b29938ec60fe935900e4c039.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - 25 Servings","path":"ad885b68b29938ec60fe935900e4c039.jpg","width":2000,"height":2000},"variants":[{"id":"8171c2fa-3f9a-40eb-8014-54843446bd8a","title":"","weight_unit":"lb","inventory_quantity":"168","sku":"99707","barcode":"191069997070","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"39.99","price":"39.99","available":true,"url":"\/products\/pe-whey-protein-isolate-powder-choc-1-76lbs?variant=8171c2fa-3f9a-40eb-8014-54843446bd8a","available_quantity":"168","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/ad885b68b29938ec60fe935900e4c039.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - 25 Servings","path":"ad885b68b29938ec60fe935900e4c039.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/b9575c278093d57957148e948d2ad393.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - Nutrition Facts","path":"b9575c278093d57957148e948d2ad393.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/0422dab1b816e78d3a938458b3cee41b.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - Promotes Post-workout Recovery, Low Carb, Low Sugar, Low Fat, High Protein Formula, Promotes Muscle Growth, Support Weight Loss Goals","path":"0422dab1b816e78d3a938458b3cee41b.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/47b0562bcc483639a5ca7fe03b60a6a0.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - High Concentration of BCAAs","path":"47b0562bcc483639a5ca7fe03b60a6a0.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/c250a9a8845d43f2c8659f453b15b038.jpg","alt":"","path":"c250a9a8845d43f2c8659f453b15b038.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/aaa7032b912ed69603be68fbaf225bcb.jpg","alt":"PE Whey Protein Isolate Powder Choc 1.76lbs - Helps Support Muscle Growth and Recovery","path":"aaa7032b912ed69603be68fbaf225bcb.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"67c32307-3468-4f11-a0ff-3c5cc578d355","title":"PE Whey Protein Isolate Powder Van 1.65lbs","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"0","inventory_tracking":true,"published":true,"handle":"pe-whey-protein-isolate-powder-van-1-65lbs","spu":"99706","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":false,"price_min":"39.99","price_max":"39.99","price":"39.99","compare_at_price":"39.99","compare_at_price_min":"39.99","compare_at_price_max":"39.99","url":"\/products\/pe-whey-protein-isolate-powder-van-1-65lbs","sales":"468","image":{"src":"\/\/img.staticdj.com\/fe52fdea4b882c19fbb57a53e51efe7e.jpg","alt":"PE Whey Protein Isolate Powder Van 1.65lbs - 25 Servings","path":"fe52fdea4b882c19fbb57a53e51efe7e.jpg","width":2000,"height":2000},"variants":[{"id":"238014b7-48f3-402c-a222-ebe673d3c7f6","title":"","weight_unit":"lb","inventory_quantity":"0","sku":"99706","barcode":"191069997063","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"39.99","price":"39.99","available":false,"url":"\/products\/pe-whey-protein-isolate-powder-van-1-65lbs?variant=238014b7-48f3-402c-a222-ebe673d3c7f6","available_quantity":"0","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/fe52fdea4b882c19fbb57a53e51efe7e.jpg","alt":"PE Whey Protein Isolate Powder Van 1.65lbs - 25 Servings","path":"fe52fdea4b882c19fbb57a53e51efe7e.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/2606486066e51f8f84865a39b89f0899.jpg","alt":"PE Whey Protein Isolate Powder Van 1.65lbs - Promotes Post-workout Recovery, Low Carb, Low Sugar, Low Fat, High Protein Formula, Promotes Muscle Growth, Supports Weight Loss Goals","path":"2606486066e51f8f84865a39b89f0899.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/834427e4bc1e0b28ee5d9d5bc9a9508a.jpg","alt":"PE Whey Protein Isolate Powder Van 1.65lbs - Nutrition Facts","path":"834427e4bc1e0b28ee5d9d5bc9a9508a.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}},{"id":"396bea9e-807c-4454-8bd8-4d7f6a9d1b54","title":"PE Whey Protein Isolate Unflavored 2lb","brief":"","vendor":"NUTRIVO","vendor_url":"","has_only_default_variant":true,"requires_shipping":true,"taxable":true,"inventory_policy":"deny","inventory_quantity":"0","inventory_tracking":true,"published":true,"handle":"pe-whey-protein-isolate-unflavored-2lb","spu":"99708","note":"","need_variant_image":false,"fake_sales":"0","display_fake_sales":false,"independent_seo":false,"available":false,"price_min":"38.99","price_max":"38.99","price":"38.99","compare_at_price":"38.99","compare_at_price_min":"38.99","compare_at_price_max":"38.99","url":"\/products\/pe-whey-protein-isolate-unflavored-2lb","sales":"11","image":{"src":"\/\/img.staticdj.com\/ee2c957956fd83cfde986db5becc4be4.jpg","alt":"","path":"ee2c957956fd83cfde986db5becc4be4.jpg","width":2000,"height":2000},"variants":[{"id":"897eab94-b6c3-417f-87c4-21b68401f661","title":"","weight_unit":"lb","inventory_quantity":"0","sku":"99708","barcode":"191069997087","position":1,"option1":"","option2":"","option3":"","note":"","image":null,"weight":"0.00","compare_at_price":"38.99","price":"38.99","available":false,"url":"\/products\/pe-whey-protein-isolate-unflavored-2lb?variant=897eab94-b6c3-417f-87c4-21b68401f661","available_quantity":"0","options":[],"is_hit_discount":true,"discount_info":{"total_price":"","total_received_discounts":"","discount_min_purchase_qty":0},"flash_sale_info":{"discount_price":"","discount_saved_price":"","remaining_stock":0}}],"images":[{"src":"\/\/img.staticdj.com\/ee2c957956fd83cfde986db5becc4be4.jpg","alt":"","path":"ee2c957956fd83cfde986db5becc4be4.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/834427e4bc1e0b28ee5d9d5bc9a9508a.jpg","alt":"","path":"834427e4bc1e0b28ee5d9d5bc9a9508a.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/5481d19617f57e8124436ee6f901b6b0.jpg","alt":"","path":"5481d19617f57e8124436ee6f901b6b0.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/6bd9342cf5a230df91273f3307278120.jpg","alt":"","path":"6bd9342cf5a230df91273f3307278120.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/bd625065316e905f86ba471f7446d19a.jpg","alt":"","path":"bd625065316e905f86ba471f7446d19a.jpg","width":2000,"height":2000},{"src":"\/\/img.staticdj.com\/445eeb5cf4fb58c2e924527b5114c8e9.jpg","alt":"","path":"445eeb5cf4fb58c2e924527b5114c8e9.jpg","width":2000,"height":2000}],"options":[],"product_type":"","discount_min_purchase_qty":0,"flash_sale_info":{"discount_sales":0,"discount_sales_rate":0,"discount_price":"","discount_saved_price":"","off_ratio":"0"}}],"sort":{"by":"title","direction":"asc","before":""},"has_removed":false,"has_insufficient_inventory":false,"count":18,"total_price":null},"obtain_product_info":{"page":1,"has_more":false,"product":[],"sort":null,"count":0},"discount_template_name":"default"} || {}; discountDefaultData.section_id = 15890337540001 || 1; this.discountDefaultData = discountDefaultData; this.discount_id = this.discountDefaultData.discount_info.id;// 活动id this.discountI18n = {}; const THEME_NAME = window.SHOPLAZZA.theme.merchant_theme_name || window.SHOP_PARAMS.theme_name; this.isHero = /Hero/.test(THEME_NAME); // PROGRESS_ONGOING: 进行中 PROGRESS_NOT_STARTED: 未开始 PROGRESS_FINISHED: 已结束 this.E_DISCOUNT_PROGRESS = { ProgressFinished : "PROGRESS_FINISHED", ProgressNotStarted : "PROGRESS_NOT_STARTED", ProgressOngoing : "PROGRESS_ONGOING" }; this.E_TAB_MAP = { scenario_buy : { value: "1", domId: "product_list_buy_products" }, scenario_obtain : { value: "2", domId: "product_list_obtain_products" } } this.tabContentIdMap = {}; this.currentTab = this.E_TAB_MAP.scenario_buy.value; this.model_buy = { discount_id: this.discount_id, //活动id scenario: 1, // 枚举值,1:购买商品,2:获得商品 sort: { by: 'recommend', direction: 'asc' }, page: 2, //分页码 limit: 20, // 每页数量 loading: false, // 请求数据标示 has_more: this.discountDefaultData.buy_product_info.has_more // 是否还有数据 }; this.model_get = { discount_id: this.discount_id, //活动id scenario: 2, // 枚举值,1:购买商品,2:获得商品 sort: { by: 'recommend', direction: 'asc' }, page: 2, limit: 20, loading: false, has_more: this.discountDefaultData.obtain_product_info?.has_more }; this.modelMap = { [this.E_TAB_MAP.scenario_buy.value]: this.model_buy, [this.E_TAB_MAP.scenario_obtain.value]: this.model_get, } this.sortDict = { recommend_asc: { by: 'recommend', direction: 'asc' }, title_asc: { by: 'title', direction: 'asc' }, title_desc: { by: 'title', direction: 'desc' }, price_asc: { by: 'price', direction: 'asc' }, price_desc: { by: 'price', direction: 'desc' }, created_at_desc: { by: 'created_at', direction: 'desc' }, sales_desc: { by: 'sales', direction: 'desc' }, add_to_cart_count_desc: { by: 'add_to_cart_count', direction: 'desc' }, views_desc: { by: 'views', direction: 'desc' } }; this.sortOptions = [ { value: 'recommend_asc', text: "Recommend" }, { value: 'price_asc', text: "Price, low to high" }, { value: 'price_desc', text: "Price, high to low" }, { value: 'title_asc', text: "Name, A to Z" }, { value: 'title_desc', text: "Name, Z to A" }, { value: 'created_at_desc', text: "Newest in" }, { value: 'sales_desc', text: "Total sales, high to low" }, { value: 'add_to_cart_count_desc', text: "Purchases, high to low" }, { value: 'views_desc', text: "Page views, high to low" } ]; // 直出商品数据 + 异步请求商品数据 this.products = this.discountDefaultData.buy_product_info.product; // 款式信息集合 this.productStyleInfo = []; // 弹窗内选择款式集合 this.modalVariantInfo = []; // 加购商品列表 this.lineItems = []; this.buyNowApi = "\/api\/checkout\/order"; this.batchAtcApi = "\/api\/cart\/batch"; this.debounceTimer = null; this.discount_type = this.discountDefaultData.discount_info.discount_type; this.discount_info = this.discountDefaultData.discount_info; } static deferredMount() { return false; } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); Object.entries(this.E_TAB_MAP).forEach(([key, valueObj]) => { this.tabContentIdMap[valueObj.value] = valueObj.domId; }) this.getLocalLang(); console.log(this.discountDefaultData, 'discountDefaultData'); } async mountCallback() { this.utilsApi_ = await SPZ.whenApiDefined(document.querySelector('#spz_custom_utils')); this.init(); this.handleRenderSort(); } init() { this.xhr_.fetchJson(`/api/discount-i18n`, { method: "get", }).then((res)=>{ this.discountI18n = res; this.bindEvent(); }) // url 携带 sort_by参数 var queryParams = this.utilsApi_.params(); var sortValue = queryParams.sort_by; if (sortValue) { this.model_buy.sort = this.sortDict[sortValue]; } // 经典捆绑初始化商品数据 if(this.discount_type == 'DT_CLASSIC_BUNDLE') { this.productStyleInfo.push(...this.discountDefaultData.buy_product_info.product.map((item) => { return this.getFilteredVariants_(item, 'single'); })); } } // 获取本地的多语言 async getLocalLang() { const tempElement = document.getElementById('spz-custom-lang-script'); SPZ.whenApiDefined(tempElement).then(async (api) => { this.currentLangMap = await api.getLang(); }); } handleRenderSort() { // 渲染排序 const sort_x_id = 'promotionSortProductsX'; const $sortX = document.getElementById(sort_x_id) $sortX && SPZ.whenApiDefined($sortX).then((api) => { // 渲染排序列表 api.doRender_({options: this.sortOptions, defaultValue: 'recommend_asc', id: sort_x_id }); }) const sort_y_id = 'promotionSortProductsY'; const $sortY = document.getElementById(sort_y_id) $sortY && SPZ.whenApiDefined($sortY).then((api) => { // 渲染排序列表 api.doRender_({options: this.sortOptions, defaultValue: 'recommend_asc' , id: sort_y_id}); }) } // 获取数据,拼接html模板 async getData() { // 请求数据 let model = this.modelMap[this.currentTab]; if (!model.has_more || model.loading) { return; } model.loading = true; this.handleLoading_({type: 'product', action: 'show'}); let $content = document.querySelector(`#${this.tabContentIdMap[this.currentTab]} .discount-default__productlist-wrap`) || document.querySelector(`.discount-default__productlist-wrap`); let $defaultEmpty = $content && $content.querySelector('.discount_default_empty'); //查询活动商品接口 const reqBody = { discount_id: model.discount_id, page: model.page, limit: model.limit, apply_scenario: model.scenario, sort: model.sort, sales_channel: { sale_channel_type: "online", sale_channel_id: '1199785' } } this.xhr_.fetchJson(`/api/storefront/promotion/landing_page/product/list`, { method: "post", body: reqBody }).then(async(res)=>{ // 更新参与活动的商品数量 const productCount = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionEventProductCount`); productCount && SPZ.whenApiDefined(productCount).then((api) => { api.render(res.count, true); }); this.products.push(...res.products); this.handleLoading_({type: 'product', action: 'close'}); const count = res.count; model.has_more = res.has_more; if (count > 0) { $defaultEmpty && ($defaultEmpty.style.display = 'none'); model.page++; if (res.products && res.products.length > 0) { let products = res.products.map((product) => { return { ...product, url: this.utilsApi_.globalizePath(product.url), image_padding_bottom: this.utilsApi_.image_padding_bottom(product.image.width, product.image.height,'no-limit') } }); // 获取商品列表渲染模板, dom挂载 const renderApi = await SPZ.whenApiDefined(document.querySelector('#discounts_products_render')); const el = await renderApi.getRenderTemplate({ products: products, discountI18n: this.discountI18n, discount_info: this.discountDefaultData.discount_info, }); const childNodes = el.querySelectorAll('.as-render-product-item'); if (childNodes && childNodes.length > 0) { $content.append(...el.childNodes); } if(this.discount_type == 'DT_CLASSIC_BUNDLE') { // 遍历$content 插入商品垂直虚线分割 const productListAsync = $content.querySelectorAll('.as-render-product-item'); if (productListAsync.length > 0) { productListAsync.forEach((item, index) => { const htmlStr = `<span class="promotion_dotted_line"></span> <div class="promotion_plus_bundle"> <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"> <path d="M1 6H11M6 1L6 11" stroke="black" stroke-width="1.6" stroke-linecap="round"/> </svg> </div> <span class="promotion_dotted_line"></span>`; this.createAndInsertSeparator_('promotion_separator md:hidden', (index + 1) % 4 !== 0 && index !== productListAsync.length - 1, htmlStr, $content, item); this.createAndInsertSeparator_('promotion_separator lg:hidden', (index + 1) % 2 !== 0 && index !== productListAsync.length - 1, htmlStr, $content, item); }); } } if(this.discount_type == 'DT_MIX_MATCH_BUNDLE') { const productSelector = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionProductSelector`); productSelector && SPZ.whenApiDefined(productSelector).then((api) => { api.init(); }); const currentPageSelectedProducts = res.products.filter(item => this.productStyleInfo.map(item => item.product_id).includes(item.id)); this.updateProductPrice_(currentPageSelectedProducts); } } } else { // 空列表 const $emptyTemplate = document.querySelector('#promotionDiscountEmpty .discount_default_empty'); const $cloneEmptyTemplate = $emptyTemplate.cloneNode(true); $content.innerHTML = ''; $content.append($cloneEmptyTemplate); $defaultEmpty && ($defaultEmpty.style.display = 'flex'); } model.loading = false; }).catch((err)=>{ this.handleRequestError_(err); }).finally(()=>{ model.loading = false; this.handleLoading_({type: 'product', action: 'close'}); // 经典spu纬度需要该商品信息: is_classic_bundle_product_list_variant_tag if(this.discount_type == 'DT_CLASSIC_BUNDLE' && this.discount_info.enable_min_purchase_qty == true && this.discount_info.min_purchase_qty_type == 'spu') { this.productStyleInfo = this.productStyleInfo.map((item) => { return { ...item, is_classic_bundle_product_list_variant_tag: true, } }); } const result = this.productStyleInfo.reduce((map, item) => { if (!map[item.product_id]) { map[item.product_id] = []; } map[item.product_id].push(item); return map; }, {}); // 渲染变体tags if(this.discount_type == 'DT_MIX_MATCH_BUNDLE' || this.discount_type == 'DT_CLASSIC_BUNDLE') { Object.values(result).forEach((item) => { this.handleSpzVariantRender_(item, item[0].product_id); this.handleProductOption_(item[0].product_id, true); }); } // 渲染经典额外变体 if(this.discount_type == 'DT_CLASSIC_BUNDLE' && this.discount_info.enable_min_purchase_qty == true && this.discount_info.min_purchase_qty_type == 'spu') { Object.values(result).forEach((item) => { if(item[0].is_multi_style && item[0].discount_min_purchase_qty > 1) { const classicSpuTag = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionClassicSpuTags-${item[0].product_id}`); classicSpuTag && SPZ.whenApiDefined(classicSpuTag).then((api) => { api.render(item, true); }); } }); } // 渲染经典捆绑商品最低购买数量 if(this.discount_type == 'DT_CLASSIC_BUNDLE') { Object.values(result).forEach((item) => { this.handleMinPurchaseQtyUpdate_({discount_min_purchase_qty: item[0].discount_min_purchase_qty}, item[0].product_id); }); } }) } createAndInsertSeparator_(className, condition, htmlStr, $content, item) { if (condition) { const separator = document.createElement('div'); separator.className = className; separator.innerHTML = htmlStr; $content.insertBefore(separator, item.nextSibling); } } bindEvent() { // 监听滚动,请求数据 window.addEventListener("scroll", this.utilsApi_.debounce( () => { // 判断是否到底 const model = this.modelMap[this.currentTab]; if (!model.loading && model.has_more && this.utilsApi_.isToPageEnd(this.discountDefaultData.section_id)) { this.getData(); } }, 10, 50 )) } // 商品排序 handleSort_(data) { let sortKey = data.value; this.modelMap[this.currentTab].sort = this.sortDict[sortKey || 'recommend_asc']; this.modelMap[this.currentTab].page = 1; this.modelMap[this.currentTab].has_more = true; this.productStyleInfo = this.handleMixMatchBundleFilterSelected_(this.productStyleInfo); // 清空商品列表dom, 重新请求排序数据渲染 let $productList = document.querySelector(`#${this.tabContentIdMap[this.currentTab]} .discount-default__productlist-wrap`) || document.querySelector(`.discount-default__productlist-wrap`);; $productList && ($productList.innerHTML = ''); this.getData(); } // tab 切换 tabChange_(value) { this.currentTab = value || this.E_TAB_MAP.scenario_buy.value; } // 渲染界面 doRender_(data) { return this.templates_ .findAndRenderTemplate(this.element, data) .then((el) => { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); this.element.appendChild(el); }); } // 捆绑商品加购/立即购买 handleBundleAddToCart_(data) { const { action } = data; if(this.discount_type == 'DT_CLASSIC_BUNDLE') { this.lineItems = this.productStyleInfo; } else { this.lineItems = this.handleMixMatchBundleFilterSelected_(this.productStyleInfo); } if(action == 'cart') { //add to cart this.xhr_ .fetchJson(this.batchAtcApi, { method: 'POST', body: { line_items: this.lineItems.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity } }) } }) .then(data => { setTimeout(() => { window.location.href = '/cart'; }); }) .catch(async (error) => { await error.then((data) => { this.handleRequestError_(data); }); }); } else { //checkout this.xhr_ .fetchJson(this.buyNowApi, { method: 'POST', body: { line_items: (this.lineItems || []).map((product) => { return { quantity: product.quantity, variant_id: product.variant_id, note: product.note || '', properties: product.properties || {} } }), refer_info: { source: 'buy_now' } } }) .then(async (data) => { if (data.state === 'success') { window.location.href = data.data?.checkout_url; } else { this.handleRequestError_(data); } }) .catch(async (error) => { await error.then((data) => { this.handleRequestError_(data); }); }); } } handleRequestError_(data) { const message = data?.message || data?.errors?.[0] || 'Unknown error'; const toast = SPZCore.Dom.scopedQuerySelector(document.body, '#discount_toast'); toast && SPZ.whenApiDefined(toast).then((api) => { api.showToast(message); }); }; // 渲染加购弹窗内容 async renderQuickShop(data) { this.handleLoading_({type: 'whole', action: 'show'}); const apply_scenario = this.modelMap[this.currentTab].scenario; this.xhr_.fetchJson(`/api/storefront/promotion/landing_page/product?product_id=${data.product_id}&discount_id=${this.discount_id}&apply_scenario=${apply_scenario}`, { method: "get", }).then(async(res)=>{ this.handleLoading_({type: 'whole', action: 'close'}); const $quickShop = await SPZ.whenApiDefined(document.querySelector('#promotion-quick-view-render')); // 定义默认渲染的子款式 const selectedVariant = res.product.variants.find((v)=> (v.available && v.is_hit_discount == true)) || res.product.variants[0]; let selectedValues = {}; selectedVariant.options.length && selectedVariant.options.forEach(item => { selectedValues[item.name] = item.value; }) // 默认选中的 子款式、 options res.product.defaultSelectValues = selectedValues; let data = {...res.product, product:res.product, selectedVariant}; $quickShop.render(data); // 打开加购弹窗 SPZ.whenApiDefined(document.querySelector(`#promotion-quick-view`)).then((api)=>{ api.open(); }); }).catch((err)=>{ this.handleLoading_({type: 'whole', action: 'close'}); }) } // 单变体点击添加按钮 renderSingleVariant(data) { const { product_id } = data; const currentProduct = this.products.find((product) => product.id == product_id); // 若当前商品已存在,则不再添加 而是更新数量 const index = this.productStyleInfo.findIndex((item) => item.product_id == product_id); if (index != -1) { this.productStyleInfo[index].quantity = Number(this.productStyleInfo[index].quantity) + 1; this.updateProductPrice_(this.productStyleInfo); } else { this.productStyleInfo.push(this.getFilteredVariants_(currentProduct, 'single')); } const renderProductArr = this.productStyleInfo.filter((item) => item.product_id == product_id); this.handleSpzVariantRender_(renderProductArr, product_id); this.handleProductOption_(product_id, true); } // 过滤选中商品的子款式 获取有用的信息 product_id,variant_id,price,compare_at_price,quantity,title,variant_title getFilteredVariants_(data, type = '') { const { id, title, variants, inventory_tracking, inventory_policy, inventory_quantity, product_type, discount_min_purchase_qty } = data; const { product_id, variant_id, variant, quantity, product } = data; const isSingle = type == 'single'; const variantData = isSingle ? (variants[0] || data) : variant; const productData = isSingle ? data : product; let item_quantity = 0; if (this.discount_type === 'DT_MIX_MATCH_BUNDLE') { item_quantity = isSingle ? 1 : Number(quantity); } else if (type === 'classic_spu') { item_quantity = 1; } else { item_quantity = discount_min_purchase_qty || productData.discount_min_purchase_qty || variantData.discount_info.discount_min_purchase_qty || 1; } return { product_id: isSingle ? id : product_id, variant_id: variantData?.id || '', price: variantData?.price || '0.00', compare_at_price: variantData?.compare_at_price || '0.00', quantity: item_quantity, inventory_tracking: productData.inventory_tracking, inventory_policy: productData.inventory_policy, inventory_quantity: productData.inventory_quantity, product_type: productData.product_type || this.products.find((item) => item.id == product_id)?.product_type || this.products.find((item) => item.id == id)?.product_type || '', title: productData.title, variant_title: variantData?.options.map((option) => option.value).join('/') || '', is_multi_style: productData.variants.length > 1, discount_min_purchase_qty: discount_min_purchase_qty || productData.discount_min_purchase_qty || variantData.discount_info.discount_min_purchase_qty || 0, } } // 更新价格方法 updateProductPrice_(data) { const bottomBtnContainer = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionBottomContainer`); if (data.length == 0) { bottomBtnContainer && SPZ.whenApiDefined(bottomBtnContainer).then((api) => { api.render({original_price: 0, received_discounts: 0}, true); }); return; } data = this.handleMixMatchBundleFilterSelected_(data); const reqBody = { discount_id: this.discount_id, customer: { customer_id: '', email: '', }, sales_channel: { sale_channel_type: "online", sale_channel_id: '1199785' }, line_items: data } // 如果已经有一个请求在等待,那么取消这个请求 if (this.debounceTimer) { clearTimeout(this.debounceTimer); } this.handleLoading_({type: 'whole', action: 'show'}); this.debounceTimer = setTimeout(() => { this.xhr_.fetchJson(`/api/storefront/promotion/calculate/discounted_price`, { method: "post", body: reqBody }).then((res)=>{ // 更新商品列表价格 Object.keys(res.line_items).forEach((key) => { const currentProductPrice = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionProductPrice-${key}`); currentProductPrice && SPZ.whenApiDefined(currentProductPrice).then((api) => { api.render(res.line_items[key], true); }); }); // 更新底部按钮总价/总折扣价 const picked_qty = data.reduce((acc, item) => { return acc + item.quantity; }, 0); bottomBtnContainer && SPZ.whenApiDefined(bottomBtnContainer).then((api) => { api.render({...res.total_price, picked_qty}, true); }); }).catch(async (err)=>{ await err.then((data) => { this.handleRequestError_(data); }); }).finally(()=>{ this.handleLoading_({type: 'whole', action: 'close'}); }) }, 100); } // 还原商品价格 resetProductPrice_(data) { const {price, compare_at_price, id} = data; const currentProductPrice = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionProductPrice-${id}`); currentProductPrice && SPZ.whenApiDefined(currentProductPrice).then((api) => { api.render({total_received_discounts: price, total_price: compare_at_price}, true); }); } // 处理与selector组件的交互 handleProductOption_(productId, show) { const currentProductOption = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionSelectOption-${productId}`); if(!currentProductOption) return; currentProductOption.toggleAttribute('show', show); const productSelector = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionProductSelector`); productSelector && SPZ.whenApiDefined(productSelector).then((api) => { api.toggle_({option: productId, value: show}); }); } // 调用spz-tag组件的doRender方法 handleSpzVariantRender_(data, id) { const spzVariantTag = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionSpzVariantTags-${id}`); spzVariantTag && SPZ.whenApiDefined(spzVariantTag).then((api) => { api.render(data, true); }); } // 执行经典捆绑最低购买数量更新 handleMinPurchaseQtyUpdate_(data, id) { const minPruchaseQty = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionMinPurchaseQty-${id}`); minPruchaseQty && SPZ.whenApiDefined(minPruchaseQty).then((api) => { api.render(data, true); }); } // 添加商品子款式 renderVariantTag() { let variantInfo; const quickShopBody = SPZCore.Dom.scopedQuerySelector(document.body, '#promotion-quick-shop-body'); quickShopBody && SPZ.whenApiDefined(quickShopBody).then((api) => { variantInfo = api.getVariantsData(); console.log(variantInfo, 'variantInfo'); const productId = variantInfo.product_id; const variantId = variantInfo.variant_id; const minPruchaseQtyRender = variantInfo.product.discount_min_purchase_qty || variantInfo.variant.discount_info.discount_min_purchase_qty; if(this.discount_type == 'DT_MIX_MATCH_BUNDLE') { const index = this.productStyleInfo.findIndex((item) => item.variant_id == variantInfo.variant_id); if (index != -1) { this.productStyleInfo[index].quantity = Number(this.productStyleInfo[index].quantity) + Number(variantInfo.quantity); this.updateProductPrice_(this.productStyleInfo); } else { this.productStyleInfo.push(this.getFilteredVariants_(variantInfo)); // 若当前商品已选中,更新商品价格 const currentProductOption = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionSelectOption-${productId}`); const isSelected = currentProductOption && currentProductOption.hasAttribute('selected'); isSelected && this.updateProductPrice_(this.productStyleInfo); } const selectedVariantsFilter = this.productStyleInfo.filter((item) => item.product_id == productId); this.handleSpzVariantRender_(selectedVariantsFilter, productId); this.handleProductOption_(productId, true); } else { if(this.discount_info.enable_min_purchase_qty == true && this.discount_info.min_purchase_qty_type == 'spu' && minPruchaseQtyRender > 1) { const index = this.modalVariantInfo.findIndex((item) => item.variant_id == variantId); if (index != -1) { this.modalVariantInfo[index].quantity = Number(this.modalVariantInfo[index].quantity) + 1; } else { this.modalVariantInfo.push(this.getFilteredVariants_(variantInfo, 'classic_spu')); } const modalVariantTag = SPZCore.Dom.scopedQuerySelector(document.body, '#promotionModalVariantTagRender'); modalVariantTag && SPZ.whenApiDefined(modalVariantTag).then((api) => { api.render(this.modalVariantInfo, true); }); this.handleModalInventoryCheck_(variantInfo); const selectedVariantsNum = this.modalVariantInfo.reduce((acc, item) => { return acc + item.quantity; }, 0); if(selectedVariantsNum == minPruchaseQtyRender) { this.handleSpzVariantRender_([this.getFilteredVariants_(variantInfo)], productId); this.productStyleInfo = this.productStyleInfo.filter((item) => item.product_id != productId).concat(this.modalVariantInfo); const renderData = this.productStyleInfo.filter((item) => item.product_id == productId).map((item) => { return { ...item, is_classic_bundle_product_list_variant_tag: true } }); const classicSpuTag = SPZCore.Dom.scopedQuerySelector(document.body, `#promotionClassicSpuTags-${productId}`); classicSpuTag && SPZ.whenApiDefined(classicSpuTag).then((api) => { api.render(renderData, true); }); this.updateProductPrice_(this.productStyleInfo); const quickView = SPZCore.Dom.scopedQuerySelector(document.body, '#promotion-quick-view'); quickView && SPZ.whenApiDefined(quickView).then((api)=>{ api.close(); }); this.modalVariantInfo = []; } else { return; } } // this.productStyleInfo 中已存在与productId, variantId都相同的商品 则直接return 关闭弹窗 const isExist = this.productStyleInfo.some((item) => item.product_id == productId && item.variant_id == variantId); if (isExist) { const quickView = SPZCore.Dom.scopedQuerySelector(document.body, '#promotion-quick-view'); quickView && SPZ.whenApiDefined(quickView).then((api)=>{ api.close(); }); return; } // 更新this.productStyleInfo中的商品款式信息 const index = this.productStyleInfo.findIndex((item) => item.product_id == productId); if (index != -1) { this.productStyleInfo[index] = this.getFilteredVariants_(variantInfo); } const selectedVariantsFilter = this.productStyleInfo.filter((item) => item.product_id == productId); this.handleSpzVariantRender_(selectedVariantsFilter, productId); this.handleMinPurchaseQtyUpdate_({discount_min_purchase_qty: minPruchaseQtyRender}, productId); this.updateProductPrice_(this.productStyleInfo); } const quickView = SPZCore.Dom.scopedQuerySelector(document.body, '#promotion-quick-view'); quickView && SPZ.whenApiDefined(quickView).then((api)=>{ api.close(); }); }); } // 混搭弹窗内的前端库存校验 handleModalInventoryCheck_(data) { if(this.discount_type == 'DT_CLASSIC_BUNDLE') { const currentVariantAddNum = this.modalVariantInfo.find((item) => item.variant_id == data.variant_id)?.quantity || 0; const quickShopBody = SPZCore.Dom.scopedQuerySelector(document.body, '#promotion-quick-shop-body'); if(!!data.variant && currentVariantAddNum == Number(data.variant.available_quantity)) { quickShopBody && quickShopBody.setAttribute('status', 'soldout'); } else { quickShopBody && quickShopBody.setAttribute('status', 'available'); } } } // 删除商品子款式 deleteVariantTag(data) { const { product_id, variant_id } = data; if(this.discount_info.enable_min_purchase_qty == true && this.discount_info.min_purchase_qty_type == 'spu') { const modalProductVariants = this.modalVariantInfo.filter((item) => item.product_id == product_id && item.variant_id != variant_id); const modalVariantTag = SPZCore.Dom.scopedQuerySelector(document.body, '#promotionModalVariantTagRender'); modalVariantTag && SPZ.whenApiDefined(modalVariantTag).then((api) => { api.render(modalProductVariants, true); }); this.handleModalInventoryCheck_(data); this.modalVariantInfo = modalProductVariants; return; } const currentProductVariants = this.productStyleInfo.filter((item) => item.product_id == product_id && item.variant_id != variant_id); this.handleSpzVariantRender_(currentProductVariants, product_id); // 更新selectedVariants this.productStyleInfo = this.productStyleInfo.filter((item) => item.variant_id != variant_id); if(currentProductVariants.length > 0) { // currentProductVariants 中只要有一项是多款式商品,就更新价格 const isMultiStyle = currentProductVariants.some((item) => item.is_multi_style); isMultiStyle && this.updateProductPrice_(this.productStyleInfo); this.handleProductOption_(product_id, true); } else { this.handleProductOption_(product_id, false); this.resetProductPrice_(this.products.find((item) => item.id == product_id)); } } // 加购弹窗未参与活动 加购按钮不可点击 handleNotHitDiscount_(data) { const $quickShopBody = document.querySelector('#promotion-quick-shop-body'); //当前子框式未命中活动 if(data.variant.is_hit_discount == false) { $quickShopBody.setAttribute('variantstatus', 'notHitDiscount') } else { $quickShopBody.setAttribute('variantstatus', '') } } // loading handleLoading_(event) { const { type, action } = event; const loadingElementId = type == 'product' ? '#promotionProductsLoading' : '#promotionWholeLoading'; const loadingElement = document.querySelector(loadingElementId); if (loadingElement) { SPZ.whenApiDefined(loadingElement).then((api) => { if (action == 'show') { api.show_(); } else { api.close_(); } }); } } handleSelectProduct(productArr) { // 从this.productStyleInfo 过滤出选中的商品 const selectedProducts = this.productStyleInfo.filter((item) => productArr.includes(item.product_id)); this.updateProductPrice_(selectedProducts); } handleMixMatchBundleFilterSelected_(data) { const selectedOptions = SPZCore.Dom.scopedQuerySelectorAll(document.body, '[id^="promotionSelectOption-"]'); const idArr = [...selectedOptions].reduce((acc, item) => { if (item.hasAttribute('selected')) { const optionValue = item.getAttribute('option'); if (optionValue) { acc.push(optionValue); } } return acc; }, []); if(this.discount_type == 'DT_MIX_MATCH_BUNDLE') { return data.filter((item) => idArr.includes(item.product_id)); } return data; } setupAction_() { this.registerAction('handleTabChange', (invocation) => { const { panelId } = invocation.args.data; this.tabChange_(panelId); }); // 监听排序组件 选中选项 this.registerAction('handleSort', (invocation) => { const data = invocation.args.data; this.handleSort_(data); }); // 渲染加购弹窗 this.registerAction('renderQuickShop', (invocation) => { const data = invocation.args; this.renderQuickShop(data); }); this.registerAction('renderSingleVariant', (invocation) => { const data = invocation.args; this.renderSingleVariant(data); }); // 捆绑商品加购/立即购买 this.registerAction('handleBundleAddToCart', (invocation) => { const data = invocation.args; this.handleBundleAddToCart_(data); }); // 子款式 未参与活动 this.registerAction('handleNotHitDiscount', (invocation) => { const data = invocation.args.data; this.handleNotHitDiscount_(data); }); // 加购提示 this.registerAction('handleAddToCartToast', (invocation) => { const langValue = this.currentLangMap['add_to_cart_successfully']; this.triggerEvent_("addToCartToast", langValue); }); this.registerAction('getVariantInfo', (invocation) => { this.renderVariantTag(); }); this.registerAction('deleteVariantTag', (invocation) => { const data = invocation.args; this.deleteVariantTag(data); }); this.registerAction('getSelectedProduct', (invocation) => { const data = invocation.args.data; this.handleSelectProduct(data); }); this.registerAction('pageReload', () => { window.location.reload(); }); this.registerAction('resetModalVariantInfo', () => { this.modalVariantInfo = []; }); this.registerAction('handleModalInventoryCheck', (invocation) => { const data = invocation.args.data; this.handleModalInventoryCheck_(data); }); this.registerAction('changeTextSoldOut', (invocation) => { const data = invocation.args.data; const addBtn = SPZCore.Dom.scopedQuerySelector(document.body, '.promotion-shop-btn[role="confirm"]'); if(!addBtn) return; const content = SPZCore.Dom.scopedQuerySelector(addBtn, '[role="content"]'); if (content) { const langValue = this.currentLangMap[data.variant.available ? 'add' : 'sold_out']; content.innerHTML = langValue; } }); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomDiscountDefault)