first commit

This commit is contained in:
Axel Kee
2026-04-21 21:49:01 +08:00
commit 11d7eb91db
4 changed files with 2539 additions and 0 deletions
+323
View File
@@ -0,0 +1,323 @@
<section class="search-ajax" data-section-id="{{ section.id }}">
{%- if predictive_search.performed -%}
{%- assign clean_terms = predictive_search.terms | split: ' AND ' | last | remove_first: '*' -%}
{% assign searchTerms = predictive_search.terms | split: "AND" | first | remove: "*" %}
{%- assign total_count = 0 -%}
{%- if predictive_search.resources.queries.size > 0 -%}
{%- assign total_count = total_count | plus: predictive_search.resources.queries.size -%}
<div class='search_popular_searches_menu suggestions_menu'>
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_title' | t }}</h3>
</div>
<div class='search_popular_menu '>
{%- for suggestion in predictive_search.resources.queries -%}
<a tabindex="0" href='{{ suggestion.url }}'> {{ suggestion.styled_text }} </a>
{% endfor %}
</div>
</div>
{%- endif -%}
{%- if predictive_search.resources.products.size > 0 -%}
{%- assign total_count = total_count | plus: predictive_search.resources.queries.size -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_products' | t }}</h3>
</div>
<ul class="search-bar__result-products predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for product in predictive_search.resources.products -%}
<li class="predictive-search-item">
<a class="predictive-search-item__link"
href="{{ product.url }}" tabindex="0"
>
<div class="predictive-search__column predictive-search__column--image">
{% assign default_alt = item.title %}
<img class="predictive-search-item__image"
src="{{ product.featured_media | img_url:'300x' }}"
alt="{{ product.featured_media.alt | split: "#" | first | default: default_alt }}">
</div>
<div class="predictive-search__column predictive-search__column--content predictive-search__column--center">
<span class="predictive-search-item__title">
<span class="predictive-search-item__title-text">{{ product.title }}</span>
</span>
<div class="yagi-container" style="display: flex; gap: 0.5em;">
{% liquid
comment
start Yagi app code
endcomment
assign product_price = product.price
assign product_compare_at_price = product.compare_at_price
assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price
if product_price < product.price and product_compare_at_price == 0 or product_compare_at_price == blank
assign product_compare_at_price = product.price
endif
comment
end Yagi app code
endcomment
%}
<span class="predictive-search-item__price">
{% unless product.price_max == 0 and settings.custom_price0_text != blank %}
{% if settings.currency_code_enable %}
{{ product_price | money_with_currency }}
{% else %}
{{ product_price | money }}
{% endif %}
{% else %}
{{settings.custom_price0_text }}
{% endunless %}
</span>
{% if product_compare_at_price > 0 %}
<span class="predictive-search-item__price" style="opacity: 0.6;">
<s>{{ product_compare_at_price | money }} </s>
</span>
{% endif %}
</div>
</div>
</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{%- endfor -%}
</ul>
{%- endif -%}
{%- if predictive_search.resources.collections.size > 0 -%}
{%- assign total_count = total_count | plus: predictive_search.resources.collections.size -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_collections' | t }}</h3>
</div>
<ul class="search-bar__result-linklist predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for collection in predictive_search.resources.collections -%}
<li class='predictive-search-item__link'>
<a href="{{ collection.url }}" tabindex="0" class="search-bar__result-link">{{ collection.title }}</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{%- endfor -%}
</ul>
{%- endif -%}
{%- if predictive_search.resources.pages.size > 0 -%}
{%- assign total_count = total_count | plus: predictive_search.resources.pages.size -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_pages' | t }}</h3>
</div>
<ul class="search-bar__result-linklist predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for page in predictive_search.resources.pages -%}
<li class='predictive-search-item__link'>
<a href="{{ page.url }}" tabindex="0" class="search-bar__result-link">{{ page.title }}</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{%- endfor -%}
</ul>
{% endif %}
{%- if predictive_search.resources.articles.size > 0 -%}
{%- assign total_count = total_count | plus: predictive_search.resources.articles.size -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_articles' | t }}</h3>
</div>
<ul class="search-bar__result-linklist predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for article in predictive_search.resources.articles -%}
<li class='predictive-search-item__link'>
<a href="{{ article.url }}" tabindex="0" class="search-bar__result-link">{{ article.title }}</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{%- endfor -%}
</ul>
{%- endif -%}
{%- if total_count > 3 -%}
<div class='search-bar__view-all-button-wrapper'>
<a class="search-bar__view-all " href="{{ routes.search_url }}?q={{ predictive_search.terms }}&type={{ predictive_search.types | join: ',' }}">
<span> {{- 'general.search.view_results' | t -}}</span>
</a>
</div>
{%- endif -%}
{%- elsif search.performed -%}
{%- assign clean_terms = search.terms | split: ' AND ' | last | remove_first: '*' -%}
{% assign searchTerms = search.terms | split: "AND" | first | remove: "*" %}
{%- if search.results_count > 0 -%}
{% assign foundProduct = false %}
{% assign foundPage = false %}
{% assign foundArticle = false %}
{% for item in search.results %}
{% if item.object_type == 'product' %}
{% assign foundProduct = true %}
{% elsif item.object_type == 'page' %}
{% assign foundPage = true %}
{% elsif item.object_type == 'article' %}
{% assign foundArticle = true %}
{% endif %}
{% endfor %}
{%- if foundProduct -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_products' | t }}</h3>
</div>
<ul class="search-bar__result-products predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for item in search.results -%}
{% if item.object_type == 'product' %}
<li class="predictive-search-item">
<a class="predictive-search-item__link"
href="{{ item.url }}" tabindex="0"
>
<div class="predictive-search__column predictive-search__column--image">
{% assign default_alt = item.title %}
<img class="predictive-search-item__image"
src="{{ item.featured_media | img_url:'300x' }}"
alt="{{ item.featured_media.alt | split: "#" | first | default: default_alt }}">
</div>
<div class="predictive-search__column predictive-search__column--content predictive-search__column--center">
<span class="predictive-search-item__title">
<span class="predictive-search-item__title-text">{{ item.title }}</span>
</span>
<span class="predictive-search-item__price">
{% unless item.price_max == 0 and settings.custom_price0_text != blank %}
{% if settings.currency_code_enable %}
{{ item.price | money_with_currency }}
{% else %}
{{ item.price | money }}
{% endif %}
{% else %}
{{settings.custom_price0_text }}
{% endunless %}
</span>
</div>
</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{% endif %}
{%- endfor -%}
</ul>
{%- else -%}
{%- if foundPage -%}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_pages' | t }}</h3>
</div>
<ul class="search-bar__result-linklist predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for item in search.results -%}
{% if item.object_type == 'page' %}
<li class='predictive-search-item__link'>
<a href="{{ item.url }}" tabindex="0" class="search-bar__result-link">{{ item.title }}</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{% endif %}
{%- endfor -%}
</ul>
{% elsif foundArticle %}
<div class="predictive-search-title">
<h3 class="predictive-search-title__content">{{ 'general.search.search_articles' | t }}</h3>
</div>
<ul class="search-bar__result-linklist predictive-search__list">
{% assign product_search_limit = 0 %}
{%- for item in search.results -%}
{% if item.object_type == 'article' %}
<li class='predictive-search-item__link'>
<a href="{{ item.url }}" tabindex="0" class="search-bar__result-link">{{ item.title }}</a>
</li>
{% assign product_search_limit = product_search_limit | plus: 1 %}
{% if product_search_limit == 3 %}
{% break %}
{% endif %}
{% endif %}
{%- endfor -%}
</ul>
{% endif %}
{%- endif -%}
{% if search.types contains 'product' %}
{%- if search.results_count > 3 -%}
<div class='search-bar__view-all-button-wrapper'>
<a class="search-bar__view-all " href="{{ routes.search_url }}?q={{ search.terms }}&type={{ search.types | join: ',' }}">
{%- if settings.search_mode == 'product' -%}
<span> {{- 'general.search.view_products' | t -}}</span>
{%- else -%}
<span> {{- 'general.search.view_results' | t -}}</span>
{%- endif -%}
</a>
</div>
{%- endif -%}
{% endif %}
{%- endif -%}
{%- endif -%}
</section>
{% schema %}
{
"name": "Search ajax"
}
{% endschema %}
File diff suppressed because it is too large Load Diff
+124
View File
@@ -0,0 +1,124 @@
{% comment %}
Renders a list of product's price (regular, sale, unit)
Accompanies product listings (collection page, search result) and not updated dynamically
Accepts:
- variant: {Object} Variant Liquid object (optional)
- product: {Object} Product Liquid object (optional)
Usage:
{% render 'product-price-listing', product: product %}
{% endcomment %}
{%- liquid
if product.title
assign compare_at_price = product.compare_at_price
assign price = product.price
assign available = product.available
assign variant = product.variants.first
else
assign compare_at_price = 1999
assign price = 1999
assign available = true
endif
comment
start Yagi app code
endcomment
if product.title
assign price = product.price
assign compare_at_price = product.compare_at_price
assign price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price
if price < product.price and compare_at_price == 0 or compare_at_price == blank
assign compare_at_price = product.price
endif
endif
comment
end Yagi app code
endcomment
if settings.currency_code_enable
assign money_price = price | money_with_currency
else
assign money_price = price | money
endif
-%}
{% unless product.price_max == 0 and settings.custom_price0_text != blank or price == 0 and settings.custom_price0_text != blank %}
<div class="price price--listing
{%- if available == false %} price--sold-out {% endif -%}
{%- if compare_at_price > price %} price--on-sale {% endif -%}
{%- if product.price_varies == false and product.compare_at_price_varies %} price--compare-price-hidden {% endif -%}
{%- if variant.unit_price_measurement %} price--unit-available {% endif -%}"
>
<!-- start automatic discounted price label code -->
{% comment %}
{% render 'auto-discounted-price', product: product %}
{% endcomment %}
<!-- end automatic discounted price label code -->
<div class="price__regular">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
<span class="price-item price-item--regular">
{%- if product.price_varies -%}
{{ 'products.product.from_lowest_price_html' | t: lowest_price: money_price }}
{%- else -%}
{{ money_price }}
{%- endif -%}
</span>
</div>
<div class="price__sale">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.sale_price' | t }}</span>
<span class="price-item price-item--sale">
{%- if product.price_varies -%}
{{ 'products.product.from_lowest_price_html' | t: lowest_price: money_price }}
{%- else -%}
{{ money_price }}
{%- endif -%}
</span>
<div class="price__compare">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
<s class="price-item price-item--regular">
{% if settings.currency_code_enable %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
</div>
</div>
<div class="price__unit">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span>
<div class="price-unit-price">
{%- capture unit_price_separator -%}
<span aria-hidden="true">/</span><span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
<span>
{%- if variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}
</span>
{%- endcapture -%}
<span>
{% if settings.currency_code_enable %}
{{ variant.unit_price | money_with_currency }}
{% else %}
{{ variant.unit_price | money }}
{% endif %}
</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
</div>
</div>
</div>
{% else %}
<span class='custom_free_text'>
{{settings.custom_price0_text }}
</span>
{% endunless %}
+141
View File
@@ -0,0 +1,141 @@
{% comment %}
Renders a list of product's price (regular, sale, unit)
Accompanies product forms and meant to be updated dynamically
Accepts:
- variant: {Object} Variant Liquid object (optional)
- product: {Object} Product Liquid object (optional)
- show_vendor: {Boolean} Show the product's vendor depending on the section setting (optional)
Usage:
{% render 'product-price', variant: current_variant, product: product %}
{% endcomment %}
{%- liquid
if variant.title
assign compare_at_price = variant.compare_at_price
assign price = variant.price
assign available = variant.available
else
assign compare_at_price = 1999
assign price = 1999
assign available = true
endif
comment
start Yagi app code
endcomment
if variant.title
assign price = variant.price
assign compare_at_price = variant.compare_at_price
assign price = variant.metafields.app--168074346497.auto_discounted_price.value | default: variant.price
if price < variant.price and compare_at_price == 0 or compare_at_price == blank
assign compare_at_price = variant.price
endif
endif
comment
end Yagi app code
endcomment
if settings.currency_code_enable
assign money_price = price | money_with_currency
else
assign money_price = price | money
endif
-%}
<div class="price
{% if available == false %} price--sold-out {% endif %}
{% if compare_at_price > price %} price--on-sale {% endif %}
{% if variant.unit_price_measurement %} price--unit-available {% endif %}"
data-price
>
{% if show_vendor and product %}
<div class="price__vendor">
<span class="visually-hidden">{{ 'products.product.vendor' | t }}</span>
{{ product.vendor }}
</div>
{% endif %}
{% unless product.price_max == 0 and settings.custom_price0_text != blank %}
<div class="price__pricing-group">
<div class="price__regular">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
<span class="price-item price-item--regular" data-regular-price>
{% if price == 0 and settings.custom_price0_text != blank %}
<span class='custom_free_text'>
{{settings.custom_price0_text }}
</span>
{% else %}
{{ money_price }}
{% endif %}
</span>
</div>
<div class="price__sale">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.sale_price' | t }}</span>
<span class="price-item price-item--sale" data-sale-price>
{% if price == 0 and settings.custom_price0_text != blank %}
<span class='custom_free_text'>
{{settings.custom_price0_text }}
</span>
{% else %}
{{ money_price }}
{% endif %}
</span>
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span>
<s class="price-item price-item--regular" data-regular-price>
{% if settings.currency_code_enable %}
{{ compare_at_price | money_with_currency }}
{% else %}
{{ compare_at_price | money }}
{% endif %}
</s>
</div>
<div class="price__badges">
<span class="price__badge price__badge--sale" >
<span>{{ 'products.product.on_sale' | t }}</span>
</span>
<span class="price__badge price__badge--sold-out">
<span>{{ 'products.product.sold_out' | t }}</span>
</span>
</div>
</div>
<div class="price__unit">
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span>
<div class="price-unit-price">
{%- capture unit_price_separator -%}
<span >/</span><span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
<span data-unit-price-base-unit>
{%- if variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}
</span>
{%- endcapture -%}
<span data-unit-price>
{% if settings.currency_code_enable %}
{{ variant.unit_price | money_with_currency }}
{% else %}
{{ variant.unit_price | money }}
{% endif %}
</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}}
</div>
</div>
{% else %}
<span class='custom_free_text'>
{{settings.custom_price0_text }}
</span>
{% endunless %}
</div>