fix: Discount Filters and Web templates
- Fixed discount filters (didn’t work after js render change)
- Fix Item Card Group template height and style
- Add placeholder to missing images in Product Category Cards template
- Code cleanup
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index aec23a2..e3511de 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -73,10 +73,10 @@
{% if is_featured %}
<div class="col-sm-{{ col_size*2 }} item-card">
- <div class="card featured-item {{ align_items_class }}">
+ <div class="card featured-item {{ align_items_class }}" style="height: 360px;">
{% if image %}
<div class="row no-gutters">
- <div class="col-md-6">
+ <div class="col-md-5 ml-4">
<img class="card-img" src="{{ image }}" alt="{{ title }}">
</div>
<div class="col-md-6">
@@ -92,7 +92,7 @@
</div>
{% else %}
<div class="col-sm-{{ col_size }} item-card">
- <div class="card {{ align_items_class }}">
+ <div class="card {{ align_items_class }}" style="height: 360px;">
{% if image %}
<div class="card-img-container">
<a href="/{{ item.route or '#' }}" style="text-decoration: none;">
@@ -119,19 +119,17 @@
'text-left': align == 'Left' or is_featured,
}) -%}
<div class="card-body {{ align_class }}" style="width:100%">
- <div style="margin-top: 16px; display: flex;">
+ <div class="mt-4">
<a href="/{{ item.route or '#' }}">
<div class="product-title">
{{ title or '' }}
- {% if item.in_stock %}
- <span class="indicator {{ item.in_stock }} card-indicator"></span>
- {% endif %}
</div>
</a>
</div>
{% if is_featured %}
- <div class="product-price">{{ item.formatted_price or '' }}</div>
- <div class="product-description ellipsis">{{ description or '' }}</div>
+ <div class="product-description ellipsis text-muted" style="white-space: normal;">
+ {{ description or '' }}
+ </div>
{% else %}
<div class="product-category">{{ item.item_group or '' }}</div>
{% endif %}
diff --git a/erpnext/templates/pages/customer_reviews.py b/erpnext/templates/pages/customer_reviews.py
index 3bb0142..b9c8a01 100644
--- a/erpnext/templates/pages/customer_reviews.py
+++ b/erpnext/templates/pages/customer_reviews.py
@@ -1,15 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
-no_cache = 1
-
import frappe
from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
def get_context(context):
+ context.no_cache = 1
context.full_page = True
context.reviews = None
+
if frappe.form_dict and frappe.form_dict.get("item_code"):
context.item_code = frappe.form_dict.get("item_code")
context.web_item = frappe.db.get_value("Website Item", {"item_code": context.item_code}, "name")
diff --git a/erpnext/templates/pages/wishlist.py b/erpnext/templates/pages/wishlist.py
index e534a23..9bbec33 100644
--- a/erpnext/templates/pages/wishlist.py
+++ b/erpnext/templates/pages/wishlist.py
@@ -1,9 +1,5 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
-no_cache = 1
-
import frappe
from erpnext.utilities.product import get_price
from erpnext.e_commerce.shopping_cart.cart import _set_price_list
@@ -32,6 +28,7 @@
context.items = items
context.settings = settings
+ context.no_cache = 1
def get_stock_availability(item_code, warehouse):
stock_qty = frappe.utils.flt(
@@ -42,7 +39,7 @@
},
"actual_qty")
)
- return True if stock_qty else False
+ return bool(stock_qty)
def get_wishlist_items():
if frappe.db.exists("Wishlist", frappe.session.user):
@@ -53,5 +50,5 @@
from
`tabWishlist Items`
where
- parent=%(user)s""" % {"user": frappe.db.escape(frappe.session.user)}, as_dict=1)
+ parent=%(user)s""", {"user": frappe.session.user}, as_dict=1)
return
\ No newline at end of file