Men's Love Is Love Print Slim Fit Top Pink Shorts Two Piece Set

Men's Love Is Love Print Slim Fit Top Pink Shorts Two Piece Set

Price
$36.99
$32.99
Save  $4.00
Color
Please select a color
Size
Please select a size
Quantity
Visible only when the product is out of stock. Currently in preview mode.
Notify me when available
(function(){ function $(selector){ return document.querySelector(selector); } const EMAIL_REG = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // ่Žทๅ–domๆ•ฐๆฎ const doms = { button: $('#app-arrival-reminder-button'), previewBox: $('#app-arrival-reminder-preview-box'), toast: $('#app-arrival-reminder-toast'), lightbox: $('#arrival-lightbox'), datalist: $('#app-arrival-reminder-email-list'), imgRender: $('#app-arrival-reminder-product-image-render'), productVariant: $('#app-arrival-reminder-product-variant'), emailInput: $('#app-arrival-reminder-form .reminder-email-input'), emailWarn: $('#app-arrival-reminder-form .reminder-email-warn-wrap'), emailWarnText: $('#app-arrival-reminder-form .reminder-email-warn-text'), submitButton: $('#app-arrival-reminder-submit-button') }; // ้€‰ไธญ็š„skuๆ•ฐๆฎ let selectedVariant = {"id":"8f5a292f-eb7c-41b4-ad16-1c2035fdbcaa","product_id":"8d9ff48f-6900-4abe-89ae-9a952330d4af","title":"Pink-S","weight_unit":"kg","inventory_quantity":999,"sku":"K693991296271101952","barcode":"","position":1,"option1":"Pink","option2":"S","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/190e7d56cb0b173233b1c8a7490885ea.jpeg","path":"190e7d56cb0b173233b1c8a7490885ea.jpeg","width":800,"height":1200,"alt":"","aspect_ratio":0.6666666666666666},"wholesale_price":[{"price":32.99,"min_quantity":1}],"weight":"0.28","compare_at_price":"36.99","price":"32.99","retail_price":"36.99","available":true,"url":"\/products\/mens-love-is-love-print-slim-fit-top-pink-shorts-two-piece-set?variant=8f5a292f-eb7c-41b4-ad16-1c2035fdbcaa","available_quantity":999999999,"options":[{"name":"Color","value":"Pink"},{"name":"Size","value":"S"}],"off_ratio":11,"flashsale_info":[],"sales":2}; // ไธŠๆŠฅ function reportData(params){ // ็ผ–่พ‘/้ข„่งˆไธไธŠๆŠฅ if(false){ return; } window.sa.track(params.event_name, { business_type: 'product_plugin', function_name: 'Back_in_Stock', plugin_name: "Back_in_Stock", template_name: "product", template_type: 1, module: "apps", module_type: "Back_in_Stock", event_info: JSON.stringify({ action_type: 'Back_in_Stock' }), ...params }); } // ๆŒ‰้’ฎๆ›ๅ…‰ไธŠๆŠฅ function buttonPVReport(){ reportData({ event_name: 'function_expose', event_type: 'expose', event_desc: 'ๆ— ่ดงๅ•†ๅ“ๆ—ถ่งฆๅ‘' }); } // ๅผน็ช—ๆ›ๅ…‰ไธŠๆŠฅ function popupPVReport(){ reportData({ event_name: 'function_expose', event_type: 'popup_expose', event_desc: 'ๅผน็ช—ๆ›ๅ…‰ๆ—ถ่งฆๅ‘' }); } // submitๆŒ‰้’ฎ็‚นๅ‡ปไธŠๆŠฅ function submitClickReport(){ reportData({ event_name: 'function_click', event_type: 'popup_click', event_desc: 'ๅกซๅ…ฅ้‚ฎ็ฎฑไน‹ๅŽ๏ผŒ็‚นๅ‡ปnotify ่งฆๅ‘', event_info: JSON.stringify({ action_type: 'email_click' }), }); } // -----------------------ๅˆๅง‹ๅŒ–----------------- init(); // ๅˆๅง‹ๅŒ–ๆ“ไฝœ function init(){ // ไธบ็กฎไฟwindowๆœ‰ๅŽ้ขๆทปๅŠ ็š„ๅ€ผไพ‹ๅฆ‚window.sa ้œ€่ฆๅœจDOMContentLoadedๅ›ž่ฐƒไบ‹ไปถไธญๆ‰ง่กŒ้€ป่พ‘ document.addEventListener("DOMContentLoaded", function() { // ่ฎพ็ฝฎ้‚ฎไปถ่”ๆƒณ setDataList(); if(!true){ // ๅˆๅง‹ๆ— ่ดง ๆŒ‰้’ฎpvไบ‹ไปถๅŸ‹็‚นไธŠๆŠฅ buttonPVReport(); } }); } // ่ฎพ็ฝฎ้‚ฎไปถ่”ๆƒณ function setDataList(){ const customer_email = window.C_SETTINGS.customer.customer_email; if(customer_email){ const options = document.createElement('option'); options.setAttribute('value', customer_email); doms.datalist.appendChild(options); } } // -----------------------ไบ‹ไปถๆ“ไฝœ---------------- // ็›‘ๅฌskuๅ˜ๅŒ–ไบ‹ไปถ document.addEventListener('dj.variantChange', variantChange); // ็›‘ๅฌๆ้†’ๆŒ‰้’ฎ็‚นๅ‡ปไบ‹ไปถ doms.button.addEventListener('click', reminderButtonClick); // ็›‘ๅฌๆไบคๆŒ‰้’ฎ็‚นๅ‡ปไบ‹ไปถ doms.submitButton.addEventListener('click', submit); // ็›‘ๅฌinputๅ…ƒ็ด ็š„keydownไบ‹ไปถ doms.emailInput.addEventListener('keydown', function(e) { // ๅˆคๆ–ญๆ˜ฏๅฆๆŒ‰ไธ‹ไบ†Enter้”ฎ if (e.keyCode === 13 || e.key === 'Enter') { submit(); } }); // ๆ˜พ็คบๆญฃๅธธๆŒ‰้’ฎ function showReminderButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); buttonPVReport(); } // ๅฑ•็คบ้ข„่งˆๆŒ‰้’ฎ function showPreviewButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.remove('app-arrival-preview-hidden'); } // ้š่—ๆŒ‰้’ฎ function hiddenReminderButton(){ doms.button.classList.add('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); } // ๆไบคๆ•ฐๆฎ, ่ฏทๆฑ‚ๆŽฅๅฃ function submit(){ // ่Žทๅ–้‚ฎ็ฎฑๆ•ฐๆฎ const email = doms.emailInput.value.trim(); if(!email){ doms.emailWarnText.innerText = "Please enter your email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } if(!EMAIL_REG.test(email)){ doms.emailWarnText.innerText = "Please enter a valid email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } // ้‚ฎ็ฎฑๆ ก้ชŒๆˆๅŠŸ doms.emailWarn.classList.add('app-arrival-hidden'); // ้ข„่งˆๆ—ถไธ่ฐƒๆŽฅๅฃ if(false){ SPZ.whenApiDefined(doms.toast).then(apis => { apis.showToast("Currently in preview mode, subscription is for testing only", 3000); }); return; } // ๅŠ ๅ…ฅloadingๆ ทๅผ doms.submitButton.classList.add('reminder-submit-button-loading'); // ๆไบคๆ•ฐๆฎ่ฏทๆฑ‚ๆŽฅๅฃ let quantity = 1; const quantityDom = $('#app-arrival-reminder-quantity-render ljs-quantity'); if(quantityDom){ quantity = Number(quantityDom.getAttribute('value')) || 1; } const params = { customer_email: email, product_num: quantity, product_id: selectedVariant.product_id, product_variant_id: selectedVariant.id }; fetch(`${window.C_SETTINGS.routes.root}/api/front/gobbler/v1/subscribe`, { method: 'POST', body: JSON.stringify(params), headers: { 'Content-Type': 'application/json' } }).then((res)=>res.json()).then((res)=>{ /* ๅŽ็ซฏ้”™่ฏฏๆ็คบ */ if(res.errors && res.errors.length){ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast(res.errors[0], 3000); }); return; } /* code * 0 SUCCESS ่ฎข้˜…ๆˆๅŠŸ * 1 PRODUCT_OFFLINE ๅ•†ๅ“ไธ‹ๆžถ * 2 INVENTORY_NOT_EMPTY ๅ•†ๅ“ๅบ“ๅญ˜ไธไธบ็ฉบ * 3 REPEAT_SUBSCRIBE ้‡ๅค่ฎข้˜… * 4 EMAIL_EMPTY ้‚ฎไปถไธบ็ฉบ * 5 EMAIL_WRONG_FORMAT ้‚ฎไปถๆ ผๅผ้”™่ฏฏ * 99999 INVALID_PARAMS ๅ…ถไป–ๅ‚ๆ•ฐ้”™่ฏฏ */ const codeMap = { SUCCESS: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Thank you for your subscription! We will notify you as soon as the product is back in stock!", 3000); }); }, INVENTORY_NOT_EMPTY: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Subscription failed. Product back in stock, please proceed to checkout.", 3000); }); setTimeout(()=>{ window.location.reload(); }, 3000); }, REPEAT_SUBSCRIBE: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("You've already subscribed to this product. We'll let you know as soon as it's back in stock. Feel free to explore our other products.", 3000); }); }, EMAIL_EMPTY: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter your email address", 3000); }); }, EMAIL_WRONG_FORMAT: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter a valid email address", 3000); }); } }; codeMap.PRODUCT_OFFLINE = codeMap.SUCCESS; codeMap[res.code] && codeMap[res.code](); }).finally(()=>{ doms.submitButton.classList.remove('reminder-submit-button-loading'); }); // submit็‚นๅ‡ปไธŠๆŠฅ submitClickReport(); } // ้‡ๆ–ฐๆธฒๆŸ“dialog function refreshRenderDialog(){ console.log('selectedVariant', selectedVariant); const images = selectedVariant.image || {"src":"\/\/img.staticdj.com\/190e7d56cb0b173233b1c8a7490885ea.jpeg","path":"190e7d56cb0b173233b1c8a7490885ea.jpeg","width":800,"height":1200,"alt":"","aspect_ratio":0.6666666666666666}; const imagePosition = images.aspect_ratio > 1 ? 'left top' : 'center center'; // ้‡ๆ–ฐๆธฒๆŸ“ๅ›พ็‰‡ SPZ.whenApiDefined(doms.imgRender).then((apis)=>{ apis.render({ images, imagePosition }); }); // ้‚ฎไปถ้”™่ฏฏๆ็คบ็ฝฎ็ฉบ doms.emailWarn.classList.add('app-arrival-hidden'); // ้‡ๆ–ฐๆธฒๆŸ“ๆฌพๅผ่ฏดๆ˜Ž if(selectedVariant.title){ doms.productVariant.innerText = selectedVariant.title.split('-').join('/'); } // ่กจๅ•ๆ•ฐๆฎ็ฝฎ็ฉบ doms.emailInput.value = ''; } // skuๅ˜ๅŒ– ๅ•ไธ€ๆฌพๅผไธไผš่งฆๅ‘ function variantChange(e){ const selected = e.detail.selected; // ๅญๆฌพๅผๆฒกๅ˜ไธๆ‰ง่กŒๆ“ไฝœ ไพ‹ๅฆ‚ๆ•ฐ้‡ๅ˜ๅŒ– if(selected.id === selectedVariant.id){ return; } selectedVariant = selected; console.log('selectedVariant', selectedVariant); // ๆ•ฐ้‡ๅ˜ๅŒ– if(selected.available || selected.product_id === undefined){ // ๆœ‰ๅบ“ๅญ˜ ็ผ–่พ‘ๆ—ถๅฑ•็คบ้ข„่งˆๆŒ‰้’ฎ ๅฆๅˆ™้š่—ๆŒ‰้’ฎ if(false){ showPreviewButton(); }else { hiddenReminderButton(); } }else{ // ๆ— ๅบ“ๅญ˜ ๆ˜พ็คบๆญฃๅธธๆŒ‰้’ฎ showReminderButton(); } } // ๆ้†’ๆŒ‰้’ฎ็‚นๅ‡ป function reminderButtonClick(){ refreshRenderDialog(); // ๅผน็ช—ๆ›ๅ…‰ไธŠๆŠฅ popupPVReport(); } document.body.appendChild(doms.toast); document.body.appendChild(doms.lightbox.parentElement); })();
Free Worldwide Shipping Orders $99
Easy Returns - 30 Days Warranty
24 Hours Response
Secure Payments
SKU: K693991296271101952
        • Bring some serious summer vibes with this adorable two-piece set! ๐ŸŒˆ๐Ÿ’• The 'Love Is Love' print slim fit tee paired with pink shorts is all about spreading positivity and embracing love in all forms. Whether strolling along the beach or chilling at a pool party, this set is the perfect mix of comfort and style!

           

          The item is on pre-sale and will be shipped by Nov.29 at the latest.

           

          FABRIC & CARE

          Outer Material: Knit 95% polyester 5% spandex
        • Lined Fabric: NO
      • Cares: Machine Wash
          • DETAILS

            • Style:                                     
              Casual
            • Elasticity:
              High Elasticity
            • Type: 
              Top + Shorts
            • Color:
              Pink, White
            • Sleeve:
              Short Sleeve
            • Applicable: 
              Daily
            • Appropriate Season: 
              Summer
          • Tips: Due to the many variations in monitors, the color in the image could look slightly different, please take physical design and color shall prevail.

Where can Ciciful deliver the package to?

 

Ciciful can ship to most countries in the world, covering North and South America, Europe, United Kingdom, Asia, Africa, Oceania, and more, over 200 countries & regions.

Countries not shipped to include:

Aland Island, Ascension, Azores, Balearic Islands, Bouvet Island, Caroline Islands, China Mainland, Eritrea, Northern Mariana Islands, Somalia, Somaliland, Spanish Territories Of N.Africa, Yemen, YUGOSLAVIA, Zaire.

  • Global
ZONE SHIPPING METHOD PROCESSING TIME DELIVERY TIME ORDERS KILOGRAMS SHIPPING FEE
Global Standard 3-8 Business Days 10-15 Business Days 0-$98.99 No limit $9.99 
Global Standard 3-8 Business Days 10-15 Business Days over $99 No limit Free

 

How does Ciciful ship your order?

 

After placing an order, you will receive a product information confirmation e-mail;

After the payment, you will receive a successful payment confirmation e-mail;

After the order is shipped, you will receive a shipping information confirmation e-mail, contains tracking number, you can check the shipping state with the tracking number in https://www.17track.net/en or http://www.track718.com/en

.

 

What shipping methods are offered? And how long does it take to ship?

 

The total time it takes to receive your parcel is described as below:

Total delivery time = Processing Time + Shipping Time

Processing time = the time between when you place an order and when we ship it;

Shipping time = the time between when your order has been shipped and delivered to you;

Processing time: within 3-8 business days

The time it takes to prepare your items to ship from our warehouse. This includes preparing your items, performing quality checks, and packing for shipment.

Shipping time:

Due to COVID-19, transportation has been restricted, which affects our ability to deliver products as quickly and efficiently as we do during normal times, international deliveries may take longer than usual.

Ciciful has partnered with major international shipping companies including but not limited to DHL, UPS, FedEx, IB, and EMS to offer three shipping methods. The following is the shipping method and corresponding shipping time:

Expedited Shipping: 5-7 business days

Standard Shipping: 10-15 business days

Flat Rate Shipping: 15-30 business days

 

What is customs tax?

 

Taxes apply for imported goods/services and is regulated by the country law. cicful is not responsible for any tax charged on its products. The amount of customs taxes are depend on policies and tax rates applied per country. Please contact local customs for clear information.

 

Important Notes:

 

1. Certain items are prohibited by some shipping carriers. If your order contains these items for the shipping carrier you selected, we will re-route your order via another carrier to ensure it arrives safely. This may require additional shipping time.

2. All estimated/typical delivery time are derived from real world data collected from past orders. They are approximate times for reference only.

3. Annual Chinese Public Holidays:

Chinese Lunar New Year (usually in February)

Labor Day (1st May to 3st May every year)

Chinese National Day (1st Oct to 7st Oct every year)

Please note that all delivery times will be affected during these times of year as the service from all our suppliers and logistics operators will be disrupted. There is often a delay of 3-4 days and sometimes even longer. We sincerely apologize for any delays caused during these periods and kindly ask our customers to be patient.

4. cicful ships all packages from our warehouse and distribution center.

Refund Policy

At ciciful.com, customer satisfaction is always our top priority. We want you to be completely satisfied with your purchase.

If for any reason you are unhappy, please contact Ciciful support at  support@ciciful.com

Welcome to ciciful.com. We pride ourselves in our product quality with strict quality control checks in place, but to provide you with maximum peace of mind, we offer a comprehensive 30 Day Returns Warranty. Buy with confidence and Enjoy a great shopping experience at Ciciful! Satisfaction guaranteed.

Cancel & Refund

Order Status Reasons for Refund Request Requirements and Notice Solution
Before shipment 1. Forget to buy sth.
2. Buy the Wrong thing
3. Just don't want it anymore
Apply cancel orders within 24 hours 100% order amount
Apply cancel orders OVER 24 hours 95% of the order amount(deduct 5% processing fee)
Pre order Failed Customer service team will contact you for solutions Customer service team will contact you for solutions
Received Lack of Items
Package Broken
Quality Issues
1. Apply within 30 Days after delivery

2. Order ID

3. Clear Photos of this item

4. Brief description about the problems of the items
Contact Customer Service Team via support@ciciful.com
Unhappy about the Clothes

Return Procedure

1. Take a clear photo of the item.
2. Contact our customer service team via support@ciciful.com.
3. Send the photos and order ID to the customer service team and tell them about your problems and the resolution you prefer. Return? Refund? Exchange? Resend๏ผŸ
4. The customer service team will send you the address of Ciciful's International Center, please do not send the package back to where it came from, or it would delay your refund procedure.
5. Call the post office to arrange a collection or drop off at your nearest post office.
6. Notify us the tracking number after you have returned the item(s).
7. All the exchanges or refunds will be processed within 2 working days once we have received the item(s)

NOTICE

1. The Package must be restored to the unopened state
2. Returned items must be returned in original product packaging.
3. Returned items must have no visible signs of wear or use.
4. Items returned without authorization will not be accepted.
5. The returned package must be printed and accompanied by an RMA slip.
6. The package must be sent to the address that Ciciful offers by email.
7. Customer is responsible for all return charges.
8. The original shipping fee and insurance are non-refundable.
9. The following items cannot be returned or exchanged: stockings, bodysuits, lingerie, jewelry, beauty products, underwear, event and party supplies
10. No exchange or return or amendments on promotional items or last-chance items.
11. Customer should be responsible to the delivery problems caused by the wrong address.
12. We are only responsible for returns and refunds for products from Ciciful.


*For the below circumstances, we don't accept a refund request without return. But we can offer a coupon for your next order.

(However, we can offer a coupon for your next order, please contact our customer service for details.)

1. Don't like the item;
2. Not fit as expected without any quality problems;
3. Shipping status shows delivered but the buyer didn't received;
4. Differences/misunderstanding (on products/fabric) which has already been claimed in our description/title;
5. Placed the wrong order and shipped.

    Exchanges
    Sorry for the inconvenience, we currently do not offer exchanges. However, we will advance this part as soon as possible. Stay tuned.

    Please note:

    Please contact your local post office to confirm the actual return shipping fee. We recommend you use the cheapest registered airmail method that is available.


    *If you have any other questions, please feel free to get in touch with our customer service at support@ciciful.com

     

    class SpzSmartBlockComponent extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; this.container_ = null; this.i18n_ = {}; this.config_ = {}; this.show_type_ = 3; this.product_resource_id_ = ''; this.collection_resource_id_ = ''; this.cart_items_ = []; this.customer_id_ = ''; this.order_id_ = ''; } static deferredMount() { return false; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { const template_type = window.SHOPLAZZA.meta.page.template_type; if (template_type === 1) { this.show_type_ = 3; this.product_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 2) { this.show_type_ = 4; this.collection_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 15){ this.show_type_ = 5; } else if (template_type === 13){ this.show_type_ = 6; } else if (template_type === 20){ this.show_type_ = 7; this.customer_id_ = window.SHOPLAZZA.customer.customer_id; } else if (template_type === 35){ this.show_type_ = 8; this.order_id_ = window.location.pathname.split('/').pop(); } this.templates_ = SPZServices.templatesForDoc(this.element); this.setAction_(); } mountCallback() { console.log('smart mounted'); const that = this; const themeName = window.SHOPLAZZA.theme.merchant_theme_name; const isGeek = /Geek/.test(themeName); this.fetchRules().then((res) => { if (res && res.rules && res.rules.length) { const blockEl = document.getElementById('smart_recommend_block'); SPZ.whenApiDefined(blockEl).then((api) => { api.render({data: res}, true).then(() => { if (isGeek && that.show_type_ === 6) { blockEl.querySelector('.plugin_container_wrpper').style.padding = '30px 0'; } const recommendStyle = document.createElement('style'); recommendStyle.innerHTML = ` .plugin__recommend_container,.app-recommend-card { display: none !important; } `; document.head.appendChild(recommendStyle); const fetchList = []; res.rules.forEach((rule) => { fetchList.push(this.fetchRuleProductList(rule.id)); }); const fetchAll = Promise.all(fetchList); fetchAll.then((p_res) => { res.rules.forEach((rule, index) => { rule.products = p_res[index] && p_res[index].products; const ruleEl = document.getElementById('smart_recommend_rule_' + rule.id); SPZ.whenApiDefined(ruleEl).then((api) => { api.render({data: rule}, true).then(() => { that.impressListen(`#smart_recommend_rule_ul_${rule.id}`, function(){ that.trackRuleImpress(rule); }); const btnElList = document.querySelectorAll(`#smart_recommend_rule_ul_${rule.id} button`); btnElList.forEach((btnEl) => { if (btnEl && rule.config && rule.config.quick_shop_button_bg_color && rule.config.quick_shop_button_text_color) { btnEl.style.backgroundColor = rule.config.quick_shop_button_bg_color; btnEl.style.color = rule.config.quick_shop_button_text_color; } }) }); }); }); }); }) }) } else { if (window.top !== window.self) { const template_type = window.SHOPLAZZA.meta.page.template_type; const holderEl = document.getElementById('smart_recommend_preview_no_data_placeholder'); SPZ.whenApiDefined(holderEl).then((api) => { api.render({data: { isCart: template_type === 13, isCollection: template_type === 2, isProduct: template_type === 1, isIndex: template_type === 15 }}, true); }); } } }); } setAction_() { this.registerAction('quickShop', (data) => { const that = this; const product_id = data.args.product_id; const productIndex = data.args.productIndex; const rule_id = data.args.rule_id; const ssp = data.args.ssp; const scm = data.args.scm; const cfb = data.args.cfb; const ifb = data.args.ifb; const modalRender = document.getElementById('smart_recommend_product_modal_render'); if (product_id) { this.fetchProductData(product_id).then((res) => { const product = res.products && res.products.length && res.products[0] || {}; product.cfb = cfb; product.ifb = ifb; SPZ.whenApiDefined(modalRender).then((api) => { api.render({product: product, productIndex: productIndex, rule_id: rule_id, ssp: ssp, scm: scm, show_type: that.show_type_}, true).then(() => { const modalEl = document.getElementById('smart_recommend_product_modal'); SPZ.whenApiDefined(modalEl).then((modal) => { that.impressListen('#smart_recommend_product_modal', function(){ that.trackQuickShop({ rule_id: rule_id, product_id: product_id }); }); modal.open(); }); const formEl = document.getElementById('smart_recommend_product_form'); SPZ.whenApiDefined(formEl).then((form) => { form.setProduct(product); }); const variantEl = document.getElementById('smart_recommend_product_variants'); SPZ.whenApiDefined(variantEl).then((variant) => { variant.handleRender(product); }); }); }) }); } }); this.registerAction('handleScroll', (data) => { this.directTo(data.args.rule_id, data.args.direction); }); this.registerAction('handleProductChange', (data) => { const variant = data.args.data.variant; const product = data.args.data.product; const imageRenderEl = document.getElementById('smart_recommend_product_image'); SPZ.whenApiDefined(imageRenderEl).then((api) => { api.render({ variant: variant, product: product }, true); }); }); this.registerAction('handleAtcSuccess', (detail) => { const data = detail.args; data.data.product = data.data.product || {}; data.data.variant = data.data.variant || {}; const product_id = data.data.product.id; const product_title = data.data.product.title; const variant_id = data.data.variant.id; const price = data.data.variant.price; const rule_id = data.rule_id; const aid = `smart_recommend.${this.show_type_}.${rule_id}`; const ifb = data.data.product.ifb; const cfb = data.data.product.cfb; const ssp = data.ssp; const scm = data.scm; const spm = `smart_recommend_${this.show_type_}.${data.spmIndex}`; const params = { id: product_id, product_id: product_id, number: 1, name: product_title, variant_id: variant_id, childrenId: variant_id, item_price: price, source: 'add_to_cart', _extra: { aid: aid, ifb: ifb, cfb: cfb, scm: scm, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, ssp: ssp, } }; this.tranckAddToCart(params); }); this.registerAction('addATCHook', (data) => { const params = data.args; const spm = `smart_recommend_${this.show_type_}.${params.spmIndex}`; this.myInterceptor_ = window.djInterceptors && window.djInterceptors.track.use({ event: 'dj.addToCart', params: { aid: `smart_recommend.${this.show_type_}.` + params.rule_id, ssp: params.ssp, scm: params.scm, cfb: params.cfb, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, }, once: true }); }); } tranckAddToCart(detail) { if (window.$) { window.$(document.body).trigger('dj.addToCart', detail); } } fetchRules() { const payload = { show_type: this.show_type_, }; let that = this; if (this.show_type_ === 6) { let line_items = []; return this.fetchCart().then((res) => { if (res && res.cart && res.cart.line_items) { line_items = res.cart.line_items.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity, price: item.price } }); } payload.line_items = line_items; that.cart_items_ = line_items; return that.fetchRulesRequest(payload); }); } else { if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return this.fetchRulesRequest(payload); } } fetchRulesRequest(payload) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_query", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }); } fetchCart() { return fetch(`/api/cart/cart-select?r=${Math.random().toString(36).slice(-4)}`) .then((res) => { if (res.ok) { return res.json(); } }); } fetchRuleProductList(rule_id) { const payload = { page: 1, limit: 100, fields: ["title", "url", "image", "min_price_variant.price", "min_price_variant.compare_at_price"], rule_id: rule_id, }; if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 6) { payload.line_items = this.cart_items_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); }); } fetchProductData(product_id) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_ids: [product_id], fields: [ "images", "options", "min_price_variant", "variants"] }) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); const loadingEl = document.getElementById('smart_recommend_loading'); if (loadingEl) { loadingEl.style.display = 'none'; } }); } getStyle(ele, style) { if (!ele) return; if (window.getComputedStyle) { return window.getComputedStyle(ele)[style]; } return ele.currentStyle[style]; } directTo(id, direction) { const scrollElement = document.getElementById(`smart_recommend_rule_ul_${id}`); const blockWidth = parseInt(this.getStyle(scrollElement, 'width')); const scrollLength = (blockWidth * 0.19 - 12) * 5; const scrollPoint = scrollElement.scrollWidth - scrollElement.clientWidth; if (!scrollElement) return; if (direction === 'left') { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft - scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: Math.max(scrollElement.scrollLeft - scrollLength, 0), behavior: 'smooth' }); } else { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint + 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: scrollElement.scrollLeft >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); } } trackRuleImpress(rule) { if (window.sa && window.sa.track) { window.sa.track("plugin_common", { plugin_name: "upsell", event_type: "impressions", rule_id: rule.id, ssp: rule.ssp, scm: rule.scm, show_type: this.show_type_, support_app_block: window.SHOPLAZZA.theme.support_app_block }); window.sa.track("module_impressions", { aid: `smart_recommend.${this.show_type_}.${rule.id}`, support_app_block: window.SHOPLAZZA.theme.support_app_block }); } } trackQuickShop(data) { window.sa && sa.track && sa.track("plugin_common", { plugin_name: "upsell", event_type: "quick_shop", rule_id: data.rule_id, product_id: data.product_id, show_type: this.show_type_, }); } impressListen(selector, cb) { const el = document.querySelector(selector); const onImpress = (e) => { if (e) { e.stopPropagation(); } cb(); }; if (el && !el.getAttribute('imprsd')) { el.addEventListener('impress', onImpress) } else if (el) { onImpress(); } } } SPZ.defineElement('spz-custom-smart-block', SpzSmartBlockComponent);