Filteri
Filteri
Novo
TONDOLORE
Od €2.235,00
€2.725,00
Novo
COSMOLORE WAVE
Od €6.519,00
€7.950,00
Novo
RONDOLORE
€3.398,00
€3.550,00
Ovaj online obrazac služi kao lista za izradu ponude. Molimo da prije slanja popisa, provjerite jesu li sve količine i odabrane opcije u listi upita navedene, kako bismo vam mogli dostaviti točnu i potpunu ponudu.
","viewProduct":"VIDI PROIZVOD ","addCustomProBtnText":"Add custom products","addCustomProHeading":"Add custom products","productNameLable":"Product Name","quantityLabel":"Quantity","customNamePlaceholder":"Unesite naziv proizvoda","customQtyPlaceholder":"1","addBtnText":"Add","stepProductSelection":"Product Selection","stepcontactInfo":"Contact Information","stepReviewInfo":"Review Information","stepNextText":"Next Step","stepPrevText":"Previous Step","basketButtonText":"DODAJ PROIZVOD","basketButtonRemoveText":"UKLONI PROIZVOD","cartBasketButton":"Request for Quote","approvePageSH":"We~re processing your request","approvePageErrH":"Something went wrong","approvePageErrSH":"There was an issue while creating your order. Your details may not be valid. Please contact the store admin via email, and they will help you resolve this issue.","approvePageH":"Please wait","portalSerialNo":"Quote serial no.","portalTotal":"Total Amount","portalCreatedAt":"Created At","portalStatus":"Status","portalActions":"Actions","portalHeading":"Customer portal","portalSubHeading":"Track quote status, review pricing, and respond to offers directly from your personalized customer portal.","portalSubTotal":"Sub total","portalTotalAmt":"Total Amount","portalDiscount":"Discount","portalShipping":"Shipping","portalMenuText":"Quote Customer Portal","portalProducts":"Products count","portalViewQuote":"View quote detail","portalPayandapprove":"Approve and pay","portalPayBtn":"Pay now","portalNoRec":"No Record Found","enFormName":"Enquiry form","provideValidForm":"Please provide valid form id to show the enquiry form","dontAccess":"Sorry, you don’t have permission to view this page.","yQuote":"Your quote","extandedTotal":"Extended total","decline":"Decline","cmtHeading":"Comment on this quote","cmtPlaceholderValue":"Write a comment...","postCmtBtnText":"Post Comment","comtErrorValue":"Comment cannot be empty","loginToCmt":"Please log in to post comments.","loginToSeeCmt":"Please log in to view comments.","noCmtFound":"No comments yet.","emailNotSameText":"Please log in using the same email address that was used for this quotation to post a comment.","loginClick":"Click here","priceClmText":"Price","customPrice":"Custom price","notSameEmailMsg":"This email is not associated with this quote. Please log in using the same email to proceed.","minCPrice":"Minimum price should greater or equal to:","expiredValue":"Expired","addItemFirstInBasket":"Please add an item before proceeding.","somethingWentWrong":"Something went wrong","quoteLimitExceeded":"Quote limit exceeded","poweredByText":"Powered By","pleaseWait":"Please wait","vendorText":"Prodavatelj","skuText":"Šifra","noProduct":"Product Not Available","loginText":"Login to see price","resolveFirst":"Please fix the errors in the form.","quoteFormName":"Quote Form","quoteFormDes":"Leave your message here and we will reply to you shortly.","nameField":"Name","namePlaceholder":"Enter your name","nameError":"Name is required","emailField":"Email","emailPlaceholder":"Enter your email","emailError":"Email is required","messageField":"Message","messagePlaceholder":"message","messageError":"Message is required","phoneField":"Phone","phonePlaceholder":"Enter your phone","phoneError":"Phone is required","buttonValue":"Submit Quote","fileSize":"File size should be less then","fileType":"Only","fileType1":"are acceptable","badgeTextValue":"Quote List","invalidEmail":"Invalid email address","cartBasketToast":"Your basket has been updated","addValidProName":"Please enter valid product name","yQuoteDes":"This quote is valid until the following date:","yQuoteDesEx":"This quote is expired on the following date:","pdfDown":"Pdf downloaded successfully","adminLanguage":"english","storeFrontLanguage":"english","priceLoginText":"Login to see price","button_text_value":"","pageTitle":"","pageSubtitle":"","priceShowText":"","portalShipiing":"","declinedQuote":"","cError":"Obavezna polja ne mogu biti prazna"} ).replace(/~/g, "'")); let wfq_shouldOtherAutoUpdateRender = false; let wfq_StoreFrontDefLang = {}; let priceThemeElements = {}; const mainProductIdOfProduct = ""; const mainProductHandleOfProduct = ""; const wfq_draftOrderCur = "EUR"; let wfq_collectionData = []; let wfqPendingFetchIds = new Set(); let collIds = mainProductIdOfProduct ? [mainProductIdOfProduct] : []; const wfq_customer = { id: null, addresses: null, tags: null, default_address: { address1: null, address2: null, city: null, province: null, country: null, country_code:null, zip: null, email: null, name: null, first_name: null, last_name: null, phone: null, company: null, } }; const wfq_market = { handle: "hr", id: "44236964", country: "Hrvatska" }; wfqGetStoreLanguage() wfqGetDefLanguage() fetch('https://cdn.shopify.com/extensions/019c9f54-cf33-7fe2-82fb-ef28649683df/wf-request-for-quote-531/assets/theme_file.json') .then(res => res.json()) .then(data => { const preloadStyle = document.getElementById("wfq-pre-hide-style"); if(!wfq_newThemeName && preloadStyle) return preloadStyle.remove() let pThemeData = data[wfq_newThemeName.trimEnd()] || data["Dawn"]; if (pThemeData && pThemeData.$extends) { const parent = data[pThemeData.$extends]; if (parent) { pThemeData = { ...parent, ...pThemeData }; delete pThemeData.$extends; } } priceThemeElements = pThemeData; const gridElements = priceThemeElements.gridElement.split(","); const catalogCartItems = priceThemeElements.catalogCart?.split(",") || []; const productClassItems = priceThemeElements.productClass.split(","); const addToCartItems = priceThemeElements.addTocart.split(","); const catalogCartSelectors = generateCombinations(gridElements, catalogCartItems); const allSelectors = [ ...gridElements.map(g => `${g.trim()} ${priceThemeElements.defaultClass}`), ...productClassItems.map(s => s.trim()), ...addToCartItems.map(s => s.trim()), ...(priceThemeElements.quickOrderList ? [priceThemeElements.quickOrderList.trim()] : []), ...catalogCartSelectors, ...(priceThemeElements.searchGrid ? [priceThemeElements.searchGrid.trim()] : []) ]; if (preloadStyle) preloadStyle.remove(); let priceCss = document.getElementById("wfq-price-style"); if (!priceCss) { priceCss = document.createElement("style"); priceCss.id = "wfq-price-style"; priceCss.innerHTML = ` ${allSelectors.join(",\n")} { display: none !important; }`; document.getElementsByTagName("head")[0].appendChild(priceCss); } const watchSelectors = [ ...gridElements.map(g => `${g.trim()} ${priceThemeElements.defaultClass}`), ...productClassItems.map(s => s.trim()) ]; if (wfq_settings.wfqPlanValue > 1) { let appStylesCustom = document.getElementById("app-config-style-custom"); if (!appStylesCustom) { appStylesCustom = document.createElement("style"); appStylesCustom.id = "app-config-style-custom"; appStylesCustom.innerHTML = wfqCustomCode.customCss; document.getElementsByTagName("head")[0].appendChild(appStylesCustom); } eval(wfqCustomCode.customJs); } waitForAnyElement(watchSelectors, () => { controlB2bsettings(); }); }); function generateCombinations(parents, children) { const validChildren = (children || []).filter(c => c && c.trim()); if (!validChildren.length) return []; return parents.flatMap(p => validChildren.map(c => `${p.trim()} ${c.trim()}`)); } function initializeDomain (){ for (const path of url_paths) { if (wfq_getDomain.includes(path)) { wfq_getDomain = wfq_getDomain.split(path)[0]; break; } } if (!wfq_getDomain.endsWith("/")) wfq_getDomain += "/"; return wfq_getDomain; }; async function wfqGetStoreLanguage() { try { const response = await fetch(`${BASEURL}/get-quote-store-language`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ shopName: wfq_permanentDomain, url: wfq_settings.wfqPlanValue > 2 ? initializeDomain() : `https://${wfq_shopDomain}/`, }), }); if (!response.ok) throw new Error(`Network response was not ok: ${response.statusText}`); const result = await response.json(); const translationData = result.data.length > 0 ? result.data[0].translations : '{"quickQuoteButtonText":"BRZI UPIT","quoteMenuName":"UPIT ZA OPREMOM","noMoreItem":"VAŠA LISTA JE TRENUTNO PRAZNA.","continueShopping":"NASTAVITE","quantityText":"Količina","modalProductHeading":"Vaša lista za ponudu","srNoText":"Red.br.","itemText":"Proizvod","totalText":"Ukupno bez pdv","actionText":"Aktivnost","estimatedTotalText":"Ukupno bez pdv","toastAdded":"Proizvod je dodan u košaricu","toastRemoved":"Proizvod je uklonjen iz košarice","isLoginParaText":"Gostujući korisnici ne mogu poslati upit. Molimo vas da se prvo prijavite, a zatim se vratite kako biste poslali svoju ponudu.","createAccountAnchor":"Kreirajte račun","loginTextAnchor":"Prijavite se","modalProductSubHeading":"Ovaj online obrazac služi kao lista za izradu ponude. Molimo da prije slanja popisa, provjerite jesu li sve količine i odabrane opcije u listi upita navedene, kako bismo vam mogli dostaviti točnu i potpunu ponudu.
","viewProduct":"VIDI PROIZVOD ","addCustomProBtnText":"Add custom products","addCustomProHeading":"Add custom products","productNameLable":"Product Name","quantityLabel":"Quantity","customNamePlaceholder":"Unesite naziv proizvoda","customQtyPlaceholder":"1","addBtnText":"Add","stepProductSelection":"Product Selection","stepcontactInfo":"Contact Information","stepReviewInfo":"Review Information","stepNextText":"Next Step","stepPrevText":"Previous Step","basketButtonText":"DODAJ PROIZVOD","basketButtonRemoveText":"UKLONI PROIZVOD","cartBasketButton":"Request for Quote","approvePageSH":"We~re processing your request","approvePageErrH":"Something went wrong","approvePageErrSH":"There was an issue while creating your order. Your details may not be valid. Please contact the store admin via email, and they will help you resolve this issue.","approvePageH":"Please wait","portalSerialNo":"Quote serial no.","portalTotal":"Total Amount","portalCreatedAt":"Created At","portalStatus":"Status","portalActions":"Actions","portalHeading":"Customer portal","portalSubHeading":"Track quote status, review pricing, and respond to offers directly from your personalized customer portal.","portalSubTotal":"Sub total","portalTotalAmt":"Total Amount","portalDiscount":"Discount","portalShipping":"Shipping","portalMenuText":"Quote Customer Portal","portalProducts":"Products count","portalViewQuote":"View quote detail","portalPayandapprove":"Approve and pay","portalPayBtn":"Pay now","portalNoRec":"No Record Found","enFormName":"Enquiry form","provideValidForm":"Please provide valid form id to show the enquiry form","dontAccess":"Sorry, you don’t have permission to view this page.","yQuote":"Your quote","extandedTotal":"Extended total","decline":"Decline","cmtHeading":"Comment on this quote","cmtPlaceholderValue":"Write a comment...","postCmtBtnText":"Post Comment","comtErrorValue":"Comment cannot be empty","loginToCmt":"Please log in to post comments.","loginToSeeCmt":"Please log in to view comments.","noCmtFound":"No comments yet.","emailNotSameText":"Please log in using the same email address that was used for this quotation to post a comment.","loginClick":"Click here","priceClmText":"Price","customPrice":"Custom price","notSameEmailMsg":"This email is not associated with this quote. Please log in using the same email to proceed.","minCPrice":"Minimum price should greater or equal to:","expiredValue":"Expired","addItemFirstInBasket":"Please add an item before proceeding.","somethingWentWrong":"Something went wrong","quoteLimitExceeded":"Quote limit exceeded","poweredByText":"Powered By","pleaseWait":"Please wait","vendorText":"Prodavatelj","skuText":"Šifra","noProduct":"Product Not Available","loginText":"Login to see price","resolveFirst":"Please fix the errors in the form.","quoteFormName":"Quote Form","quoteFormDes":"Leave your message here and we will reply to you shortly.","nameField":"Name","namePlaceholder":"Enter your name","nameError":"Name is required","emailField":"Email","emailPlaceholder":"Enter your email","emailError":"Email is required","messageField":"Message","messagePlaceholder":"message","messageError":"Message is required","phoneField":"Phone","phonePlaceholder":"Enter your phone","phoneError":"Phone is required","buttonValue":"Submit Quote","fileSize":"File size should be less then","fileType":"Only","fileType1":"are acceptable","badgeTextValue":"Quote List","invalidEmail":"Invalid email address","cartBasketToast":"Your basket has been updated","addValidProName":"Please enter valid product name","yQuoteDes":"This quote is valid until the following date:","yQuoteDesEx":"This quote is expired on the following date:","pdfDown":"Pdf downloaded successfully","adminLanguage":"english","storeFrontLanguage":"english","priceLoginText":"Login to see price","button_text_value":"","pageTitle":"","pageSubtitle":"","priceShowText":"","portalShipiing":"","declinedQuote":"","cError":"Obavezna polja ne mogu biti prazna"}'; wfq_customLanguage = JSON.parse(translationData.replace(/~/g, "'")); wfq_shouldOtherAutoUpdateRender = true; } catch (error) { console.error("Error fetching store language:", error); } } async function wfqGetDefLanguage() { const langName = `${wfq_customLanguage.storeFrontLanguage}Message`; const domainValue = wfq_settings.wfqPlanValue > 2 ? wfq_getDomain : `https://${wfq_shopDomain}/` try { const response = await fetch(`${BASEURL}/get-quote-default-store-lang`, { body: JSON.stringify({ langName, domainValue }), method: "POST", headers: { "Content-Type": "application/json", }, }); if (!response.ok) throw new Error("Network response was not ok " + response.statusText); const result = await response.json(); wfq_StoreFrontDefLang = result; return result } catch (error) { console.error("Error fetching theme data:", error); } } function waitForAnyElement(selectors, callback, maxRetries = 7) { let retryCount = 0; function checkElements() { const found = selectors.some(selector => document.querySelector(selector)); if (found) { callback(); } else if (retryCount < maxRetries) { retryCount++; setTimeout(checkElements, 500); } else { console.warn("Element not found after max retries:", selectors); } } checkElements(); } const hideQuickOrderList = () => { if (priceThemeElements?.quickOrderList) { const quickOrderList = document.querySelector(priceThemeElements.quickOrderList); if (quickOrderList) wfq_generalSetting?.hideQuickOrderList === "yes" ? quickOrderList.style.setProperty("display", "none", "important") : quickOrderList.style.setProperty("display", "block", "important"); } } const updatePriceVisibility = (element, hide) => { priceThemeElements.defaultClass.split(",").forEach((selector) => { const priceContainers = element.querySelectorAll(selector.trim()); priceContainers.forEach((priceContainer) => { const newHTML = hide ? "" : (wfq_customLanguage?.priceShowText || ""); if (priceContainer.innerHTML !== newHTML) { priceContainer.innerHTML = newHTML; } }); }); }; const updateProductPagePrice = (hide, shouldRemove) => { priceThemeElements.productClass.split(",").forEach((item) => { const productPage = document.querySelector(item); if (productPage) { if (shouldRemove) { const newHTML = hide ? "" : `${wfq_customLanguage?.priceShowText || ""}`; if (productPage.innerHTML !== newHTML) { productPage.innerHTML = newHTML; } } productPage.style.setProperty("display", "block", "important") } }); }; async function fetchProductData (paths) { const fetchPromises = paths.map((path) => { return fetch(`${wfq_settings.wfq_getDomain}products/${path}.js`).then((res) => res.json()); }); return Promise.all(fetchPromises); }; const whichCollection = async (idArray) => { const existingIds = new Set(wfq_collectionData.map(item => item.productId)); const idsToFetch = idArray.filter(id => !existingIds.has(id) && !wfqPendingFetchIds.has(id)); if (idsToFetch.length === 0) return wfq_collectionData; idsToFetch.forEach(id => wfqPendingFetchIds.add(id)); try { const response = await fetch(`${BASEURL}/get-collection-product`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ shopName: wfq_permanentDomain, id: idsToFetch }), }); const result = await response.json(); const newData = result?.data || []; wfq_collectionData = [...wfq_collectionData, ...newData]; return wfq_collectionData; } catch (error) { console.error("Collection fetch error:", error); return wfq_collectionData; } finally { idsToFetch.forEach(id => wfqPendingFetchIds.delete(id)); } }; function wfqHasCollectionCondition(data) { if (!Array.isArray(data)) return false; if (data.length > 0 && data[0]?.step1) { return data.some(item => item.step1 === "collection"); } return data.some(obj => { const conditionChecks = obj.conditionValues?.formConditionChecks; return Array.isArray(conditionChecks) && conditionChecks.some(check => check.step1 === "collection"); }); } const hideByCondition = async (data, productDataMap, conditionChecks, showWhere, cartOrPrice = "price", collData, mainProductHandle, showPATC = false) => { const hasCollection = conditionChecks.some(item => item.step1 === "collection"); if (mainProductHandle) { const productPageData = await wfqFetchByJs(mainProductHandle, "product"); if (hasCollection) { const colData = wfq_collectionData?.find(item => Number(item.productId) === Number(productPageData?.id)); productPageData.hasMatch = colData?.collections?.some(item => collData.some(id => item.node.id.endsWith(id)) ); } const hideProductPageElement = fetchByCondition(productPageData, conditionChecks, showWhere); if (cartOrPrice === "price") { updateProductPagePrice(true, hideProductPageElement ? showPATC ? false : true : showPATC ? true : false ); } else { priceThemeElements.addTocart.split(",").forEach((item) => { const button = document.querySelector(item); if(button) button.style.setProperty("display", hideProductPageElement ? (showPATC ? "block" : "none") : (showPATC ? "none" : "block"), "important"); }); } } if (data.length > 0) { await Promise.all(data.map(async ({ element, path }) => { if (hasCollection) { const colData = wfq_collectionData?.find(item => Number(item.productId) === Number(productDataMap[path]?.id)); productDataMap[path].hasMatch = colData?.collections?.some(item => collData.some(id => item.node.id.endsWith(id)) ); } const hideElement = fetchByCondition(productDataMap[path], conditionChecks, showWhere); if (cartOrPrice === "price") { (showPATC ? !hideElement : hideElement) && updatePriceVisibility(element, true); } else { if (priceThemeElements.catalogCart?.trim()) { priceThemeElements.catalogCart.split(",").forEach((item) => { const cartButton = element.querySelector(item.trim()); if(cartButton) cartButton.style.setProperty("display", hideElement ? (showPATC ? "block" : "none") : (showPATC ? "none" : "block"), "important"); }); } } })); } }; function wfqGetMarketBasedSettings() { const { hidePrice, hideAddToCart, priceSpecificChecks = [], quoteSpecificChecks = [], quoteDontSpecificChecks = [],hideQuoteButton, priceConditionChecks = [], showPriceWhere, quoteConditionChecks = [], showQuoteBtnWhere, cartConditionChecks = [], showCartWhere, cartCollectionChecks = [], quoteCollectionChecks = [], priceCollectionChecks = [], cartSpecificChecks = [],loginTextAs, sPriceConditionChecks = [], showSPriceWhere, sPriceCollectionChecks = [], sCartConditionChecks = [], showSCartWhere, sCartCollectionChecks = [], sQuoteConditionChecks = [], showSQuoteBtnWhere = [], sQuoteCollectionChecks = [],marketRules = [], isMultiMarket} = wfq_generalSetting; const defaultSettings = { hidePrice, hideAddToCart, priceSpecificChecks, quoteSpecificChecks, quoteDontSpecificChecks, hideQuoteButton, priceConditionChecks, showPriceWhere, quoteConditionChecks, showQuoteBtnWhere, cartConditionChecks, showCartWhere, cartCollectionChecks, quoteCollectionChecks, priceCollectionChecks, cartSpecificChecks, loginTextAs, sPriceConditionChecks, showSPriceWhere, sPriceCollectionChecks, sCartConditionChecks, showSCartWhere, sCartCollectionChecks, sQuoteConditionChecks, showSQuoteBtnWhere, sQuoteCollectionChecks }; if (wfq_settings?.wfqPlanValue < 4 || isMultiMarket !== "yes" || !Array.isArray(marketRules) || !marketRules.length) {return defaultSettings}; const matchedRule = marketRules.find(rule => Number(rule?.id?.split("/").pop()) === Number(wfq_market?.id)); if (!matchedRule || !matchedRule.rules) {return defaultSettings}; const { rules } = matchedRule; const finalSettings = { ...defaultSettings }; if (rules.hidemPrice) { Object.assign(finalSettings, { hidePrice: rules.hidemPrice, priceConditionChecks: rules.mPriceConditionChecks || [], showPriceWhere: rules.showmPriceWhere || "", priceCollectionChecks: rules.mPriceCollectionChecks || [], sPriceConditionChecks: rules.smPriceConditionChecks || [], showSPriceWhere: rules.showSmPriceWhere || "", sPriceCollectionChecks: rules.smPriceCollectionChecks || [], priceSpecificChecks: rules.mPriceSpecificChecks || [], }); } if (rules.hidemAddToCart) { Object.assign(finalSettings, { hideAddToCart: rules.hidemAddToCart, cartConditionChecks: rules.mCartConditionChecks || [], showCartWhere: rules.showmCartWhere || "", cartCollectionChecks: rules.mCartCollectionChecks || [], sCartConditionChecks: rules.smCartConditionChecks || [], showSCartWhere: rules.showSmCartWhere || "", sCartCollectionChecks: rules.smCartCollectionChecks || [], cartSpecificChecks: rules.mCartSpecificChecks || [] }); } if (rules.hidemQuoteButton) { Object.assign(finalSettings, { hideQuoteButton: rules.hidemQuoteButton, quoteConditionChecks: rules.mQuoteConditionChecks || [], showQuoteBtnWhere: rules.showmQuoteBtnWhere || "", quoteCollectionChecks: rules.mQuoteCollectionChecks || [], sQuoteConditionChecks: rules.smQuoteConditionChecks || [], showSQuoteBtnWhere: rules.showSmQuoteBtnWhere || "", sQuoteCollectionChecks: rules.smQuoteCollectionChecks || [], quoteSpecificChecks: rules.mQuoteSpecificChecks || [], quoteDontSpecificChecks: rules.mQuoteDontSpecificChecks || [] }); } return finalSettings; } async function controlB2bsettings(quickProductId = null, quickProductHandle = null) { const mainProductId = mainProductIdOfProduct || quickProductId; const mainProductHandle = mainProductHandleOfProduct || quickProductHandle; const elements = [...document.querySelectorAll(priceThemeElements.gridElement)]; const { hidePrice, hideAddToCart, priceSpecificChecks, quoteSpecificChecks, quoteDontSpecificChecks, hideQuoteButton, priceConditionChecks, showPriceWhere, quoteConditionChecks, showQuoteBtnWhere, cartConditionChecks, showCartWhere, cartCollectionChecks, quoteCollectionChecks, priceCollectionChecks, cartSpecificChecks, loginTextAs, sPriceConditionChecks, showSPriceWhere, sPriceCollectionChecks, sCartConditionChecks, showSCartWhere, sCartCollectionChecks, sQuoteConditionChecks, showSQuoteBtnWhere, sQuoteCollectionChecks } = wfqGetMarketBasedSettings(); const priceCheckSet = new Set(priceSpecificChecks); const quoteCheckSet = new Set(quoteSpecificChecks); const cartCheckSet = new Set(cartSpecificChecks); const quoteDontCheckSet = new Set(quoteDontSpecificChecks); const isBlock = (hidePrice === "hide where condition matches" && wfq_settings.wfqPlanValue > 1 && wfqHasCollectionCondition(priceConditionChecks)) || (hideAddToCart === "hide where condition matches" && wfq_settings.wfqPlanValue > 1 && wfqHasCollectionCondition(cartConditionChecks)) || (hideQuoteButton === "show where condition matches" && quoteConditionChecks) || (wfq_customButton.showButtons === "mix quote button" && wfq_settings.wfqPlanValue >= 4 && wfqHasCollectionCondition(wfq_customButton.mixProductData)) || (hidePrice === "show where condition matches" && wfq_settings.wfqPlanValue > 1 && wfqHasCollectionCondition(sPriceConditionChecks)) || (hideAddToCart === "show where condition matches" && wfq_settings.wfqPlanValue > 1 && wfqHasCollectionCondition(sCartConditionChecks)) || (hideQuoteButton === "hide where condition matches" && wfq_settings.wfqPlanValue > 1 && wfqHasCollectionCondition(sQuoteConditionChecks)) const products = elements.map((element) => { const matchedSelector = priceThemeElements.productLink.split(",").find((item) => { const productLink = element.querySelector(item.trim()); if (productLink) { const matchedValue = /\/products\/(.*)/.exec(productLink.getAttribute("href")); if (matchedValue) { element.__productPath = matchedValue[1].split('?')[0]; return true; } } return false; }); if (matchedSelector) return { element, path: element.__productPath }; return null; }).filter(Boolean); const responses = await fetchProductData(products.map((p) => p.path)); const productDataMap = products.reduce((acc, product, index) => { const singleProduct = responses[index]; acc[product.path] = singleProduct ? { title: singleProduct.title, type: singleProduct.type, tags: singleProduct.tags, vendor: singleProduct.vendor, price: Number(singleProduct?.variants[0]?.price) / 100, available: singleProduct?.variants[0]?.available, id: singleProduct.id } : null; return acc; }, {}); const colProductDataMap = [ ...Object.values(productDataMap) .filter(Boolean) .map((p) => p.id), ...(mainProductId ? [mainProductId] : []) ]; collIds = colProductDataMap if (isBlock) await whichCollection(colProductDataMap) const getProductId = (path) => productDataMap[path]?.id?.toString() || ""; // Hide Price Logic if (hidePrice === "hide price on all products") { updateProductPagePrice(true, true); elements.forEach(el => updatePriceVisibility(el, true)); } else if (hidePrice === "hide price on specific products" && wfq_settings.wfqPlanValue > 1) { updateProductPagePrice(true, priceCheckSet.has(mainProductId) ? true : false); products.forEach(({ element, path }) => { if (priceCheckSet.has(getProductId(path))) updatePriceVisibility(element, true); }); } else if (hidePrice === "hide price on quoted products" && wfq_settings.wfqPlanValue > 1) { if (hideQuoteButton === "hide on all products") { updateProductPagePrice(false, false); } else if (hideQuoteButton === "show on specific products") { updateProductPagePrice(true, quoteCheckSet.has(mainProductId) ? true : false); products.forEach(({ element, path }) => { if (quoteCheckSet.has(getProductId(path))) updatePriceVisibility(element, true); }); } else if (hideQuoteButton === "don't show on specific products") { updateProductPagePrice(true, !quoteDontCheckSet.has(mainProductId) ? true : false); products.forEach(({ element, path }) => { if (!quoteDontCheckSet.has(getProductId(path))) updatePriceVisibility(element, true); }); } else if (hideQuoteButton === "show where condition matches") { await hideByCondition(products, productDataMap, quoteConditionChecks, showQuoteBtnWhere, "price", quoteCollectionChecks, mainProductHandle); } else if (hideQuoteButton === "hide where condition matches") { await hideByCondition(products, productDataMap, sQuoteConditionChecks, showSQuoteBtnWhere, "price", sQuoteCollectionChecks, mainProductHandle, true); } else { updateProductPagePrice(true, true); elements.forEach(el => updatePriceVisibility(el, true)); } } else if (hidePrice === "hide price for everyone and show text" && wfq_settings.wfqPlanValue > 1) { updateProductPagePrice(false, true); elements.forEach((el) => updatePriceVisibility(el, false)); } else if (hidePrice === "hide price for guest users and require login" && wfq_settings.wfqPlanValue > 1) { const btnText = wfq_customLanguage?.priceLoginText || wfq_StoreFrontDefLang?.loginText || ""; if (!"") { elements.forEach(el => { priceThemeElements.defaultClass.split(",").forEach((item) => { const priceContainer = el.querySelector(item); if (priceContainer) { priceContainer.innerHTML = btnText ? `${btnText}` : ""; } }) }); } priceThemeElements.productClass.split(",").forEach((item) => { const productPage = document.querySelector(item); if (productPage) { if(!""){ productPage.innerHTML = btnText ? `${btnText}` : ""; } productPage.style.setProperty("display", "block", "important") } }); } else if (hidePrice === "hide where condition matches" && wfq_settings.wfqPlanValue > 1) { await hideByCondition(products, productDataMap, priceConditionChecks, showPriceWhere, "price", priceCollectionChecks, mainProductHandle); } else if (hidePrice === "show where condition matches" && wfq_settings.wfqPlanValue > 1) { await hideByCondition(products, productDataMap, sPriceConditionChecks, showSPriceWhere, "price", sPriceCollectionChecks, mainProductHandle, true); } else { priceThemeElements.productClass.split(",").forEach((item) => { const productPage = document.querySelector(item); if (productPage) productPage.style.setProperty("display", "block", "important") }); restorePriceDisplay() } // Restore Product Price Display function restorePriceDisplay() { const blockData = (isBlock && wfq_collectionData.length) ? "block" : isBlock && !wfq_collectionData.length ? "none" : "block" document.querySelectorAll(priceThemeElements.gridElement).forEach(gridItem => { priceThemeElements.defaultClass.split(",").forEach(selector => { const priceContainers = gridItem.querySelectorAll(selector.trim()); priceContainers.forEach(priceContainer => { priceContainer.style.setProperty("display", blockData, "important"); }); }); }); }; restorePriceDisplay(); hideQuickOrderList(); // Hide Add to Cart const showOrHideButtons = (selectors, elements, conditionFn) => { selectors.forEach((selector) => { if (!selector) return; elements.forEach((element) => { const button = element.querySelector(selector); if (button) { const shouldShow = conditionFn(element); button.style.setProperty("display", shouldShow ? "block" : "none", "important"); } }); }); }; const applyToMainProduct = (selectors, shouldShow) => { selectors.forEach((selector) => { const buttons = document.querySelectorAll(selector); buttons.forEach((button) => { button.style.setProperty("display", shouldShow ? "block" : "none", "important"); }); }); }; const catalogCartSelectors = priceThemeElements.catalogCart?.split(",").map(s => s.trim()).filter(Boolean) || []; const addToCartSelectors = priceThemeElements.addTocart?.split(",").map(s => s.trim()).filter(Boolean) || []; if (hideAddToCart === "hide on quoted products" && wfq_settings.wfqPlanValue > 1) { if (hideQuoteButton === "hide on all products") { showOrHideButtons(catalogCartSelectors, document.querySelectorAll(priceThemeElements.gridElement), () => true); applyToMainProduct(addToCartSelectors, true); } else if (hideQuoteButton === "show on specific products") { showOrHideButtons( catalogCartSelectors, products.map(p => p.element), (element) => { const productPath = products.find(p => p.element === element)?.path; return productPath && !quoteCheckSet.has(getProductId(productPath)); } ); if (mainProductId) applyToMainProduct(addToCartSelectors, !quoteCheckSet.has(mainProductId)); } else if (hideQuoteButton === "don't show on specific products") { showOrHideButtons( catalogCartSelectors, products.map(p => p.element), (element) => { const productPath = products.find(p => p.element === element)?.path; return productPath && quoteDontCheckSet.has(getProductId(productPath)); } ); if (mainProductId) applyToMainProduct(addToCartSelectors, quoteDontCheckSet.has(mainProductId)); } else if (hideQuoteButton === "show where condition matches") { await hideByCondition(products, productDataMap, quoteConditionChecks, showQuoteBtnWhere, "cart", quoteCollectionChecks, mainProductHandle); } else if (hideQuoteButton === "hide where condition matches") { await hideByCondition(products, productDataMap, sQuoteConditionChecks, showSQuoteBtnWhere, "cart", sQuoteCollectionChecks, mainProductHandle, true); } } else if (hideAddToCart === "hide cart on specific products" && wfq_settings.wfqPlanValue > 1) { showOrHideButtons( catalogCartSelectors, products.map(p => p.element), (element) => { const productPath = products.find(p => p.element === element)?.path; return productPath && !cartCheckSet.has(getProductId(productPath)); } ); if (mainProductId) applyToMainProduct(addToCartSelectors, !cartCheckSet.has(mainProductId)); } else if (hideAddToCart === "show cart on all products") { showOrHideButtons( catalogCartSelectors, document.querySelectorAll(priceThemeElements.gridElement), () => true ); applyToMainProduct(addToCartSelectors, true); } else if (hideAddToCart === "hide add to cart for guest users" && wfq_settings.wfqPlanValue > 1) { if ("") { showOrHideButtons( catalogCartSelectors, document.querySelectorAll(priceThemeElements.gridElement), () => true ); applyToMainProduct(addToCartSelectors, true); } } else if (hideAddToCart === "hide where condition matches" && wfq_settings.wfqPlanValue > 1) { await hideByCondition(products, productDataMap, cartConditionChecks, showCartWhere, "cart", cartCollectionChecks, mainProductHandle); } else if (hideAddToCart === "show where condition matches" && wfq_settings.wfqPlanValue > 1) { await hideByCondition(products, productDataMap, sCartConditionChecks, showSCartWhere, "cart", sCartCollectionChecks, mainProductHandle, true); } else { showOrHideButtons( catalogCartSelectors, products.map(p => p.element), () => false ); applyToMainProduct(addToCartSelectors, false); } } wfq_settings.wfq_getDomain = initializeDomain(); const createElementIfNotExist = (id) => { if (!document.querySelector(`#${id}`)) { const newElement = document.createElement('div'); newElement.id = id; newElement.style = "none"; newElement.setAttribute('data-aj', '0'); newElement.setAttribute('data-product-handle', '[]'); document.body.prepend(newElement); } }; createElementIfNotExist("wfq-current-product"); createElementIfNotExist("wfq-custom-icon-product"); createElementIfNotExist("wfq-custom-btn-product"); async function wfqFetchByJs(handle, where) { try { const response = await fetch(`${wfq_getDomain}products/${handle}.js`); if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`); const jsonData = await response.json(); let variantId = jsonData?.variants[0]?.id; if (where === "product") { const variantUrl = new URL(location.href).searchParams.get("variant"); variantUrl && (variantId = Number(variantUrl)) } const selectedVariant = jsonData.variants.find(variant => Number(variant.id) === Number(variantId)) || jsonData.variants[0]; const productData = { title: jsonData.title, type: jsonData.type, tags: jsonData.tags, vendor: jsonData.vendor, price: Number(selectedVariant?.price) / 100, available: selectedVariant?.available, id: jsonData.id } return productData; } catch (error) { console.error(`Error fetching data for ${handle}:`, error); } } function fetchByCondition(data, conditions, conditionType) { if (!Array.isArray(conditions) || conditions.length === 0) return false; if (conditionType === "all conditions") { return conditions.every(condition => { const { step1, step2, step3 } = condition; return evaluateCondition(data, step1, step2, step3); }); } else if (conditionType === "any conditions") { return conditions.some(condition => { const { step1, step2, step3 } = condition; return evaluateCondition(data, step1, step2, step3); }); } return false; } function evaluateCondition(data, step1, step2, step3) { switch (step1) { case "product title": return wfqCheckCondition(data.title, step2, step3); case "product type": return wfqCheckCondition(data.type, step2, step3); case "product vendor": return wfqCheckCondition(data.vendor, step2, step3); case "product price": return wfqCheckCondition(data.price, step2, parseFloat(step3)); case "product tag": return data.tags.includes(step3); case "product in stock": return wfqCheckCondition(data.available, step2, step3 === "available" ? true : false); case "collection": return data.hasMatch; default: return false; } } function wfqCheckCondition(value, operator, compareValue) { if (typeof value === "string") { value = value.toLowerCase(); compareValue = compareValue.toLowerCase(); } switch (operator) { case "is equal to": return value === compareValue; case "is not equal to": return value !== compareValue; case "starts with": return value.startsWith(compareValue); case "ends with": return value.endsWith(compareValue); case "contains": return value.includes(compareValue); case "does not contain": return !value.includes(compareValue); case "is greater than": return value > compareValue; case "is less than": return value < compareValue; case "is": return value === compareValue; default: return false; } }