From 783b2b2484bcba18a0e3c2ea1b83d6e188d1861e Mon Sep 17 00:00:00 2001 From: Axel Date: Sat, 22 Nov 2025 02:28:27 +0800 Subject: [PATCH] first commit --- .DS_Store | Bin 0 -> 6148 bytes README.md | 3 + snippets/product-card-default.liquid | 205 +++++++++++++++++++++++++++ snippets/product-card-search.liquid | 100 +++++++++++++ 4 files changed, 308 insertions(+) create mode 100644 .DS_Store create mode 100644 README.md create mode 100644 snippets/product-card-default.liquid create mode 100644 snippets/product-card-search.liquid diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fec2f93a2a4b622164b7b54a2d7c03dde1ff28e9 GIT binary patch literal 6148 zcmeHKOG?B*5UtV?8r;lMcYTEc56}*A;d(A0Gb4_WF@fklXLBQX1TUknJ`RRNa3vyD zq5DTY9AKx^6ZT6a7V#ynCXK z9_XH0JcsvR*UcI}5X0xd*LM}&!YIDJTdX$CzE!VvqnLeDRX%4*Z_gLq?&T7p6LH%g z#kIT9nqQU=H5dp6f`MQl82FX}+}R@O)G+#BAQ%V+4h+cokkJH-V{fQO2RbbQfHRm? zpi3*t~mCFmQL)&2m8vO#S81|m_KVcaWRZO7zhT2 z3>@2VF8BWxKAFiPf0z=ZU?3RyXAJPHT2)JI%J0_E_T;Y3Xg6pg64#3Yfj;;Nz(CHC eGj*Cji;lSB*c-|$V%KzF{0Jx^(FFs)z`zGPfIQ>? literal 0 HcmV?d00001 diff --git a/README.md b/README.md new file mode 100644 index 0000000..fd03e0b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Product page price selector is + +`, #product--page .product__price--holder` \ No newline at end of file diff --git a/snippets/product-card-default.liquid b/snippets/product-card-default.liquid new file mode 100644 index 0000000..c18dfaa --- /dev/null +++ b/snippets/product-card-default.liquid @@ -0,0 +1,205 @@ +{%- liquid + assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price + assign product_price_min = product.price_min + assign product_compare_at_price = product.compare_at_price + assign product_compare_at_price_min = product.compare_at_price_min + assign product_compare_at_price_max = product.compare_at_price_max + + if product.metafields.app--168074346497.discount_percentage.value > 0.01 + assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value + + assign product_price = product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil + assign product_price_min = product_price + + assign product_compare_at_price = product.price + assign product_compare_at_price_min = product.price + assign product_compare_at_price_max = product.price_max + + if product.compare_at_price > product_compare_at_price + assign product_compare_at_price = product.compare_at_price + assign product_compare_at_price_min = product.compare_at_price + endif + + if product.compare_at_price_max > product_compare_at_price_max + assign product_compare_at_price_max = product.compare_at_price_max + endif + endif + + if product_price < product.price and product_compare_at_price == blank + assign product_compare_at_price = product.price + assign product_compare_at_price_min = product.price + endif + + if product_price < product.price and product_compare_at_price_max == blank + assign product_compare_at_price_max = product.price_max + endif +-%} + +
+{% if settings.productCompare %} + {% render 'product-compare' product: product %} +{% endif %} + +
+
+ {% if settings.tagEnabled %} +
+ {% if product.available == false and settings.tagSoldOut %} + {{'general.buttons.sold_out' | t}} + {% endif %} + {% if product_compare_at_price_min > 0 and settings.tagSale %} + {% if product.price_varies %} + {{'general.tags.sale' | t}} + {% else %} + {% unless product_price >= product_compare_at_price %} + {% assign s_type = settings.saleType | default: 'percent' %} + + + {%- case s_type %} + {% when 'percent' %} + {{ product_price | minus: product_compare_at_price_max | times: 100 | divided_by: product_compare_at_price_max }}% {{'general.tags.sale' | t}} + {% when 'amount' %} + {{ product_compare_at_price | minus: product_price | money | strip_html }} {{'general.tags.sale' | t}} + {% when 'text' %} + {{'general.tags.sale' | t}} + {%- endcase -%} + + {% endunless %} + {% endif %} + {% endif %} + {% for tag in product.tags %} + {% if tag contains 'bstr-tag-' %} {% comment %} this needs to be an if not unless {% endcomment %} + {{ tag | remove_first: 'bstr-tag-' | replace: '-', ' ' }} + {% endif %} + {% endfor %} +
+ {% endif %} + {% unless settings.cardShowGallery %} + {% render 'card-image', image: product.featured_image.src, alt: product.featured_image.alt, desktop: dsize %} + {% unless product.images.size < 2 or settings.cardShowSecondary == false %} + {% assign secondaryImage = product.images[1] %} + {% render 'card-image', image: secondaryImage.src, alt: secondaryImage.alt, desktop: dsize, class: 'card__img--secondary' %} + {% endunless %} + {% else %} +
+
+ {% for image in product.images %} + + {% endfor %} +
+ {% if product.images.size > 1 %} + + + {% endif %} +
+ {% endunless %} + {% if product_compare_at_price_min > 0 and settings.countdownCard and settings.countdown %} +
+ 00
DAYS
+ 00
HRS
+ 00
MIN
+ 00
SEC
+
+ {% endif %} +
+
+
+ +{% if settings.cardShowSwatches and settings.cardShowGallery %} + {% render 'product-card-swatches' product: product%} +{% endif %} + + +{% unless settings.cardStyle == 'catalog' %} +
+{% if settings.cardShowBrand %} + +{{product.vendor}} + +{% endif %} +{% if settings.cardShowRating %} +{% render 'product-card__review-stars' with product as product %} +{% endif %} +{% if settings.cardNameLimit == "words" %} + {% assign truncatedProductTitle = product.title | truncatewords: settings.cardNameLimitAmount %} +{% elsif settings.cardNameLimit == 'chars' %} + {% assign truncatedProductTitle = product.title | truncate: settings.cardNameLimitAmount %} +{% endif %} + +{% unless settings.cardNameLimit != "none" %} +{{ product.title }} +{% else %} +{% if settings.cardNameLimit == "words" %} +{{ product.title | truncatewords: settings.cardNameLimitAmount }} +{% else %} +{{ product.title | truncate: settings.cardNameLimitAmount }} +{% endif %} +{% endunless %} + +{% if product_compare_at_price_min > 0 %} +{% assign sale = true %} +{% endif %} + +{% if product.price_varies %} +{{'product_page.card.from'|t}} {{ product_price_min | money | strip_html }} +{% else %} +{{ product_price | money | strip_html }} +{% endif %} +{% unless product_price == product_compare_at_price %} +{% if sale == true %} +{% unless product_price >= product_compare_at_price %} + +{{product_compare_at_price | money | strip_html}} + +{% endunless %} +{% endif %} +{% endunless %} + + +
+{{product.description | strip_html}} +
+ +{% unless settings.cardStyle == "noButton" %} +
+{% assign var = product.first_available_variant %} + +{% if product.available %} + {% if settings.quickShop %} + {% assign button_text = 'general.buttons.quick_shop' | t %} + {% assign btnType = 'quickShop' %} + {% render 'quick-buy-button', href: product.url, price: product_price, product_id: product.id, text: button_text, btnType: btnType %} + {% endif %} + {% if product.has_only_default_variant or product.variants.size == 1 %} + {% form 'product', product %} + + {% render 'add-to-cart-button', variant: var.id, quantity: 1, price: product_price, product: product %} + {% endform %} + {% else %} + {% if product.variants.size > 1 %} + {% if settings.quickShop %} + {% assign button_text = 'general.buttons.see_options' | t %} + {% endif %} + {% assign btnType = 'quickBuy' %} + {% render 'quick-buy-button', href: product.url, price: product_price, product_id: product.id, text: button_text, btnType: btnType %} + {% else %} + {% render 'quick-buy-button', href: product.url, price: product_price, product_id: product.id %} + {% endif %} + {% endif %} +{% else %} + {% render 'sold-out-button', disabled: 'disabled' %} +{% endif %} +
+{%endunless%} +
+{% endunless %} + + +
\ No newline at end of file diff --git a/snippets/product-card-search.liquid b/snippets/product-card-search.liquid new file mode 100644 index 0000000..1e1ce0e --- /dev/null +++ b/snippets/product-card-search.liquid @@ -0,0 +1,100 @@ +{%- liquid + assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price + assign product_price_min = product.price_min + assign product_compare_at_price = product.compare_at_price + assign product_compare_at_price_min = product.compare_at_price_min + assign product_compare_at_price_max = product.compare_at_price_max + + if product.metafields.app--168074346497.discount_percentage.value > 0.01 + assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value + + assign product_price = product.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil + assign product_price_min = product_price + + assign product_compare_at_price = product.price + assign product_compare_at_price_min = product.price + assign product_compare_at_price_max = product.price_max + + if product.compare_at_price > product_compare_at_price + assign product_compare_at_price = product.compare_at_price + assign product_compare_at_price_min = product.compare_at_price + endif + + if product.compare_at_price_max > product_compare_at_price_max + assign product_compare_at_price_max = product.compare_at_price_max + endif + endif + + if product_price < product.price and product_compare_at_price == blank + assign product_compare_at_price = product.price + assign product_compare_at_price_min = product.price + endif + + if product_price < product.price and product_compare_at_price_max == blank + assign product_compare_at_price_max = product.price_max + endif +-%} + + +
+ + +
+
+ {% render 'card-image', image: product.featured_image, alt: product.featured_image.alt, desktop: dsize %} + {% unless product.images.size < 2 or settings.cardShowSecondary == false %} + {% assign secondaryImage = product.images[1] %} + {% render 'card-image', image: secondaryImage, alt: secondaryImage.alt, desktop: dsize, class: 'card__img--secondary' %} + {% endunless %} + {% if product.compare_at_price_min > 0 and settings.countdownCard and settings.countdown %} +
+ 00
DAYS
+ 00
HRS
+ 00
MIN
+ 00
SEC
+
+ {% endif %} +
+
+
+ +{% unless settings.cardStyle == 'catalog' %} +{% if settings.cardNameLimit == "words" %} + {% assign truncatedProductTitle = product.title | truncatewords: settings.cardNameLimitAmount %} +{% elsif settings.cardNameLimit == 'chars' %} + {% assign truncatedProductTitle = product.title | truncate: settings.cardNameLimitAmount %} +{% endif %} +
+ +{% unless settings.cardNameLimit != "none" %} +{{ product.title }} +{% else %} +{% if settings.cardNameLimit == "words" %} +{{ product.title | truncatewords: settings.cardNameLimitAmount }} +{% else %} +{{ product.title | truncate: settings.cardNameLimitAmount }} +{% endif %} +{% endunless %} + +{% if product_compare_at_price_min > 0 %} +{% assign sale = true %} +{% endif %} + +{% if product.price_varies %} +{{'product_page.card.from'|t}} {{ product_price_min | money | strip_html }} +{% else %} +{{ product_price | money | strip_html }} +{% endif %} +{% if sale == true %} + +{{product_compare_at_price | money | strip_html}} + +{% endif %} + +
+{% endunless %} +
\ No newline at end of file