2015-02-24 17:50:44 +05:30
|
|
|
{% macro product_image_square(website_image, css_class="") %}
|
2016-11-14 13:13:53 +05:30
|
|
|
<div class="product-image product-image-square
|
|
|
|
{% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
|
|
|
|
{% if website_image -%}
|
|
|
|
style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');"
|
|
|
|
{%- endif %}>
|
2015-02-24 17:50:44 +05:30
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2021-02-01 20:01:37 +05:30
|
|
|
{% macro product_image(website_image, css_class="product-image", alt="") %}
|
2020-12-30 15:51:50 +05:30
|
|
|
<div class="border text-center rounded {{ css_class }}" style="overflow: hidden;">
|
2020-08-07 14:34:54 +05:30
|
|
|
<img itemprop="image" class="website-image h-100 w-100" alt="{{ alt }}" src="{{ frappe.utils.quoted(website_image or 'no-image.jpg') | abs_url }}">
|
2020-12-24 11:40:33 +05:30
|
|
|
</div>
|
2015-09-11 18:49:59 +05:30
|
|
|
{% endmacro %}
|
2017-02-13 21:52:43 +05:30
|
|
|
|
|
|
|
{% macro media_image(website_image, name, css_class="") %}
|
2017-02-14 16:32:48 +05:30
|
|
|
<div class="product-image sidebar-image-wrapper {{ css_class }}">
|
|
|
|
{% if not website_image -%}
|
|
|
|
<div class="sidebar-standard-image"> <div class="standard-image" style="background-color: rgb(250, 251, 252);">{{name}}</div> </div>
|
|
|
|
{%- endif %}
|
2020-12-24 11:40:33 +05:30
|
|
|
{% if website_image -%}
|
2017-02-13 21:52:43 +05:30
|
|
|
<a href="{{ frappe.utils.quoted(website_image) }}">
|
2017-02-14 16:32:48 +05:30
|
|
|
<img itemprop="image" src="{{ frappe.utils.quoted(website_image) | abs_url }}"
|
|
|
|
class="img-responsive img-thumbnail sidebar-image" style="min-height:100%; min-width:100%;">
|
2017-02-13 21:52:43 +05:30
|
|
|
</a>
|
2020-12-24 11:40:33 +05:30
|
|
|
{%- endif %}
|
|
|
|
</div>
|
2017-02-13 21:52:43 +05:30
|
|
|
{% endmacro %}
|
2019-03-19 11:48:32 +05:30
|
|
|
|
|
|
|
{% 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 class="container my-5">
|
|
|
|
<h3>{{ section.name }}</h3>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
{% for card in section.section_cards %}
|
|
|
|
<div class="col-md-{{ section.column_value }} mb-4">
|
|
|
|
<div class="card h-100 justify-content-between">
|
|
|
|
{% if card.image %}
|
2021-01-28 10:02:13 +03:00
|
|
|
<div class="website-image-lazy" data-class="card-img-top h-75" data-src="{{ card.image }}" data-alt="{{ card.title }}"></div>
|
2019-03-19 11:48:32 +05:30
|
|
|
{% endif %}
|
|
|
|
<div class="card-body">
|
|
|
|
<h5 class="card-title">{{ card.title }}</h5>
|
|
|
|
<p class="card-subtitle mb-2 text-muted">{{ card.subtitle or '' }}</p>
|
2019-06-01 20:56:37 +05:30
|
|
|
<p class="card-text">{{ card.content or '' | truncate(140, True) }}</p>
|
2019-03-19 11:48:32 +05:30
|
|
|
</div>
|
|
|
|
<div class="card-body flex-grow-0">
|
|
|
|
<a href="{{ card.route }}" class="card-link">{{ _('More details') }}</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-12-24 11:40:33 +05:30
|
|
|
{% endmacro %}
|
|
|
|
|
2021-03-11 21:24:47 +05:30
|
|
|
{%- macro item_card(item, is_featured=False, is_full_width=False, align="Left") -%}
|
2020-12-24 11:40:33 +05:30
|
|
|
{%- 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 -%}
|
2021-03-11 21:24:47 +05:30
|
|
|
{%- set title = item.item_name or item.item_code -%}
|
|
|
|
{%- set image = item.website_image or item.image -%}
|
|
|
|
{%- set description = item.website_description or item.description-%}
|
|
|
|
|
2020-12-24 11:40:33 +05:30
|
|
|
{% if is_featured %}
|
|
|
|
<div class="col-sm-{{ col_size*2 }} item-card">
|
|
|
|
<div class="card featured-item {{ align_items_class }}">
|
|
|
|
{% if image %}
|
|
|
|
<div class="row no-gutters">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<img class="card-img" src="{{ image }}" alt="{{ title }}">
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
2021-03-11 21:24:47 +05:30
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 11:40:33 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col-md-12">
|
2021-03-11 21:24:47 +05:30
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 11:40:33 +05:30
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="col-sm-{{ col_size }} item-card">
|
|
|
|
<div class="card {{ align_items_class }}">
|
|
|
|
{% if image %}
|
2021-03-11 10:56:00 +05:30
|
|
|
<div class="card-img-container">
|
2021-03-11 21:24:47 +05:30
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
2021-03-11 10:56:00 +05:30
|
|
|
<img class="card-img" src="{{ image }}" alt="{{ title }}">
|
|
|
|
</a>
|
|
|
|
</div>
|
2021-01-20 17:52:54 +05:30
|
|
|
{% else %}
|
2021-03-11 21:24:47 +05:30
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
2021-03-11 10:56:00 +05:30
|
|
|
<div class="card-img-top no-image">
|
|
|
|
{{ frappe.utils.get_abbr(title) }}
|
|
|
|
</div>
|
|
|
|
</a>
|
2020-12-24 11:40:33 +05:30
|
|
|
{% endif %}
|
2021-03-11 21:24:47 +05:30
|
|
|
{{ item_card_body(title, description, item, is_featured, align) }}
|
2020-12-24 11:40:33 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
2021-03-11 21:24:47 +05:30
|
|
|
{%- macro item_card_body(title, description, item, is_featured, align) -%}
|
2020-12-24 11:40:33 +05:30
|
|
|
{%- set align_class = resolve_class({
|
|
|
|
'text-right': align == 'Right',
|
|
|
|
'text-center': align == 'Center' and not is_featured,
|
|
|
|
'text-left': align == 'Left' or is_featured,
|
|
|
|
}) -%}
|
2021-03-11 10:56:00 +05:30
|
|
|
<div class="card-body {{ align_class }}" style="width:100%">
|
|
|
|
<div style="margin-top: 16px; display: flex;">
|
2021-03-11 21:24:47 +05:30
|
|
|
<a href="/{{ item.route or '#' }}">
|
2021-03-11 10:56:00 +05:30
|
|
|
<div class="product-title">{{ title or '' }}</div>
|
|
|
|
</a>
|
2021-03-11 21:24:47 +05:30
|
|
|
{% if item.in_stock %}
|
|
|
|
<span class="indicator {{ item.in_stock }} card-indicator"></span>
|
|
|
|
{% endif %}
|
|
|
|
{% if not item.has_variants %}
|
|
|
|
<div class="like-action"
|
2021-03-16 00:05:53 +05:30
|
|
|
data-item-code="{{ item.item_code }}"
|
|
|
|
data-price="{{ item.price }}"
|
|
|
|
data-formatted-price="{{ item.get('formatted_price') }}">
|
2021-03-11 21:24:47 +05:30
|
|
|
<svg class="icon sm">
|
2021-03-14 17:28:49 +05:30
|
|
|
{%- set icon_class = "wished" if item.wished else "not-wished"-%}
|
|
|
|
<use class="{{ icon_class }} wish-icon" href="#icon-heart"></use>
|
2021-03-11 21:24:47 +05:30
|
|
|
</svg>
|
|
|
|
</div>
|
2021-03-11 10:56:00 +05:30
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-12-24 11:40:33 +05:30
|
|
|
{% if is_featured %}
|
2021-03-11 21:24:47 +05:30
|
|
|
<div class="product-price">{{ item.formatted_price or '' }}</div>
|
2020-12-24 11:40:33 +05:30
|
|
|
<div class="product-description ellipsis">{{ description or '' }}</div>
|
|
|
|
{% else %}
|
2021-03-11 21:24:47 +05:30
|
|
|
<div class="product-category">{{ item.item_group or '' }}</div>
|
2021-03-11 10:56:00 +05:30
|
|
|
<div style="display: flex;">
|
2021-03-11 21:24:47 +05:30
|
|
|
{% if item.formatted_price %}
|
|
|
|
<div class="product-price">{{ item.formatted_price or '' }}</div>
|
|
|
|
{% endif %}
|
|
|
|
{% if item.has_variants %}
|
|
|
|
<a href="/{{ item.route or '#' }}">
|
|
|
|
<div class="btn btn-sm btn-explore-variants">
|
|
|
|
{{ _('Explore') }}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{% else %}
|
|
|
|
<div id="{{ item.name }}" class="btn btn-sm btn-add-to-cart-list not-added"
|
|
|
|
data-item-code="{{ item.item_code }}">
|
|
|
|
{{ _('Add to Cart') }}
|
|
|
|
</div>
|
2021-03-11 10:56:00 +05:30
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-12-24 11:40:33 +05:30
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
2021-03-16 00:05:53 +05:30
|
|
|
|
|
|
|
|
|
|
|
{%- macro wishlist_card(item, settings) %}
|
2021-03-22 16:46:51 +05:30
|
|
|
<div class="col-sm-3 item-card">
|
2021-03-16 00:05:53 +05:30
|
|
|
<div class="card text-center">
|
|
|
|
{% if item.image %}
|
|
|
|
<div class="card-img-container">
|
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
|
|
|
<img class="card-img" src="{{ item.image }}" alt="{{ title }}">
|
|
|
|
</a>
|
2021-03-22 16:17:59 +05:30
|
|
|
<div class="remove-wish" data-item-code="{{ item.item_code }}">
|
2021-03-16 00:05:53 +05:30
|
|
|
<span style="padding-bottom: 2px;">
|
|
|
|
<svg class="icon sm remove-wish-icon" style="margin-bottom: 4px; margin-left: 0.5px;">
|
|
|
|
<use class="close" href="#icon-close"></use>
|
|
|
|
</svg>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
|
|
|
|
<div class="card-img-top no-image">
|
|
|
|
{{ frappe.utils.get_abbr(title) }}
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{{ wishlist_card_body(item, settings) }}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
|
|
{%- macro wishlist_card_body(item, settings) %}
|
2021-03-22 16:17:59 +05:30
|
|
|
<div class="card-body text-center" style="width: 100%;">
|
2021-03-16 00:05:53 +05:30
|
|
|
<div style="margin-top: 16px;">
|
|
|
|
<div class="product-title">{{ item.item_name or item.item_code or ''}}</div>
|
|
|
|
</div>
|
|
|
|
<div class="product-price">{{ item.formatted_price or '' }}</div>
|
|
|
|
|
|
|
|
{% if (item.available and settings.show_stock_availability) or (not settings.show_stock_availability) %}
|
|
|
|
<!-- Show move to cart button if in stock or if showing stock availability is disabled -->
|
|
|
|
<button data-item-code="{{ item.item_code}}" class="btn btn-add-to-cart w-100 wishlist-cart-not-added">
|
|
|
|
<span class="mr-2">
|
|
|
|
<svg class="icon icon-md">
|
|
|
|
<use href="#icon-assets"></use>
|
|
|
|
</svg>
|
|
|
|
</span>
|
|
|
|
{{ _("Move to Cart") }}
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<div style="color: #F47A7A; width: 100%;">
|
|
|
|
{{ _("Not in Stock") }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{%- endmacro -%}
|