Skip to content

Commit

Permalink
fix: product card not rendered in website builder#6864 (#151) (#152)
Browse files Browse the repository at this point in the history
* fix: payment button appears even after the payment#16066

* fix: product card not renderend in website builder#16864

(cherry picked from commit 439bdbe)

Co-authored-by: Poorvi-R-Bhat <[email protected]>
  • Loading branch information
mergify[bot] and Poorvi-R-Bhat authored Jun 24, 2024
1 parent 2ba7381 commit 2d06162
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 7 additions & 5 deletions webshop/templates/includes/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h5 class="card-title">{{ card.title }}</h5>

{% endmacro %}

{%- macro item_card(item, is_featured=False, is_full_width=False, align="Left") -%}
{%- macro item_card(item, is_featured=False, is_full_width=False, align="Left",template="") -%}
{%- set align_items_class = resolve_class({
'align-items-end': align == 'Right',
'align-items-center': align == 'Center',
Expand All @@ -86,12 +86,12 @@ <h5 class="card-title">{{ card.title }}</h5>
<img class="card-img" src="{{ image }}" alt="{{ title }}">
</div>
<div class="col-md-6">
{{ item_card_body(title, description, item, is_featured, align) }}
{{ item_card_body(title, description, item, is_featured, align,template) }}
</div>
</div>
{% else %}
<div class="col-md-12">
{{ item_card_body(title, description, item, is_featured, align) }}
{{ item_card_body(title, description, item, is_featured, align,template) }}
</div>
{% endif %}
</div>
Expand All @@ -112,13 +112,13 @@ <h5 class="card-title">{{ card.title }}</h5>
</div>
</a>
{% endif %}
{{ item_card_body(title, description, item, is_featured, align) }}
{{ item_card_body(title, description, item, is_featured, align,template) }}
</div>
</div>
{% endif %}
{%- endmacro -%}

{%- macro item_card_body(title, description, item, is_featured, align) -%}
{%- macro item_card_body(title, description, item, is_featured, align,template) -%}
{%- set align_class = resolve_class({
'text-right': align == 'Right',
'text-center': align == 'Center' and not is_featured,
Expand All @@ -137,7 +137,9 @@ <h5 class="card-title">{{ card.title }}</h5>
{{ description or '' }}
</div>
{% else %}
{% if template != "Product Card" %}
<div class="product-category">{{ item.item_group or '' }}</div>
{% endif %}
{% endif %}
</div>
{%- endmacro -%}
Expand Down
10 changes: 10 additions & 0 deletions webshop/webshop/web_template/product_card/product_card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{%- from "webshop/templates/includes/macros.html" import item_card -%}

<div class="section-with-cards item-card-group-section">
<div class="container">
<div class="row">
{%- set item_doc = frappe.get_doc("Website Item", values["item"]) -%}
{{ item_card(item=item_doc, is_featured=values["featured"], is_full_width=True, align="Center", template="Product Card") }}
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions webshop/webshop/web_template/product_card/product_card.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"fieldname": "item",
"fieldtype": "Link",
"label": "Item",
"options": "Item",
"options": "Website Item",
"reqd": 0
},
{
Expand All @@ -20,7 +20,7 @@
}
],
"idx": 0,
"modified": "2023-10-16 18:02:11.801746",
"modified": "2024-06-17 15:15:09.902754",
"modified_by": "Administrator",
"module": "Webshop",
"name": "Product Card",
Expand Down

0 comments on commit 2d06162

Please sign in to comment.