{% macro product_image_square(website_image, css_class="") %}
{% endmacro %} {% macro product_image(website_image, css_class="product-image", alt="", no_border=False) %}
{% if website_image %} {{ alt }} {% else %}
{{ frappe.utils.get_abbr(alt) or "NA" }}
{% endif %}
{% endmacro %} {% macro media_image(website_image, name, css_class="") %} {% endmacro %} {% macro render_homepage_section(section) %} {% if section.section_based_on == 'Custom HTML' and section.section_html %} {{ section.section_html }} {% elif section.section_based_on == 'Cards' %}

{{ section.name }}

{% for card in section.section_cards %}
{% if card.image %} {{ card.title }} {% endif %}
{{ card.title }}

{{ card.subtitle or '' }}

{{ card.content or '' | truncate(140, True) }}

{% endfor %}
{% endif %} {% endmacro %} {%- macro item_card(item, is_featured=False, is_full_width=False, align="Left") -%} {%- set align_items_class = resolve_class({ 'align-items-end': align == 'Right', 'align-items-center': align == 'Center', 'align-items-start': align == 'Left', }) -%} {%- set col_size = 3 if is_full_width else 4 -%} {%- set title = item.web_item_name or item.item_name or item.item_code -%} {%- set title = title[:50] + "..." if title|len > 50 else title -%} {%- set image = item.website_image -%} {%- set description = item.website_description or item.description-%} {% if is_featured %}
{% else %}
{% if image %} {% else %}
{{ frappe.utils.get_abbr(title) }}
{% endif %} {{ item_card_body(title, description, item, is_featured, align) }}
{% endif %} {%- endmacro -%} {%- macro item_card_body(title, description, item, is_featured, align) -%} {%- set align_class = resolve_class({ 'text-right': align == 'Right', 'text-center': align == 'Center' and not is_featured, 'text-left': align == 'Left' or is_featured, }) -%}
{{ title or '' }}
{% if is_featured %}
{{ description or '' }}
{% else %}
{{ item.item_group or '' }}
{% endif %}
{%- endmacro -%} {%- macro wishlist_card(item, settings) %} {%- set title = item.web_item_name or ''-%} {%- set title = title[:90] + "..." if title|len > 90 else title -%}
{{ wishlist_card_body(item, title, settings) }}
{%- endmacro -%} {%- macro wishlist_card_body(item, title, settings) %}
{{ title or ''}}
{{ item.item_group or '' }}
{{ item.get("formatted_price") or '' }} {% if item.get("formatted_mrp") %} {{ item.formatted_mrp }} {{ item.discount }} OFF {% endif %}
{% if (item.available and settings.show_stock_availability) or (not settings.show_stock_availability) %} {% else %}
{{ _("Out of stock") }}
{% endif %}
{%- endmacro -%} {%- macro ratings_with_title(avg_rating, title, size, rating_header_class, for_summary=False) -%}

{{ title }}

{% for i in range(1,6) %} {% set fill_class = 'star-click' if i <= avg_rating else '' %} {% endfor %}
{%- endmacro -%} {%- macro ratings_summary(reviews, reviews_per_rating, average_rating, average_whole_rating, for_summary=False, total_reviews=None)-%}

{{ average_rating or 0 }}

{{ frappe.utils.cstr(total_reviews or 0) + " " + _("ratings") }}
{% if reviews %} {% set rating_title = frappe.utils.cstr(average_rating) + " " + _("out of 5") if not for_summary else ''%} {{ ratings_with_title(average_whole_rating, rating_title, "md", "rating-summary-title", for_summary) }} {% endif %}
{{ frappe.utils.cstr(average_rating or 0) + " " + _("out of 5") }}
{% for percent in reviews_per_rating %}
{{ loop.index }} star
{{ percent }}%
{% endfor %}
{%- endmacro -%} {%- macro user_review(reviews)-%}
{% for review in reviews %}
{{ ratings_with_title(review.rating, _(review.review_title), "sm", "user-review-title") }}

{{ _(review.comment) }}

{{ _(review.customer) }} {{ review.published_on }}
{% endfor %}
{%- endmacro -%} {%- macro field_filter_section(filters)-%} {% for field_filter in filters %} {%- set item_field = field_filter[0] %} {%- set values = field_filter[1] %}
{{ item_field.label }}
{% if values | len > 20 %} {% endif %} {% if values %}
{% for value in values %}
{% endfor %}
{% else %} {{ _('No values') }} {% endif %}
{% endfor %} {%- endmacro -%} {%- macro attribute_filter_section(filters)-%} {% for attribute in filters %}
{{ attribute.name }}
{% if attribute.item_attribute_values | len > 20 %} {% endif %} {% if attribute.item_attribute_values %}
{% for attr_value in attribute.item_attribute_values %}
{% endfor %}
{% else %} {{ _('No values') }} {% endif %}
{% endfor %} {%- endmacro -%} {%- macro recommended_item_row(item)-%} {%- endmacro -%}