From b3ab0b482a05e694d0d4e5c36a194b2a56cfb043 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Sun, 23 Jun 2024 13:08:18 +0200 Subject: [PATCH 1/8] fix: login and translation in macros.html fix: login and translation in macros.html --- webshop/templates/includes/macros.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/webshop/templates/includes/macros.html b/webshop/templates/includes/macros.html index 23905a89b7..239fa9f75c 100644 --- a/webshop/templates/includes/macros.html +++ b/webshop/templates/includes/macros.html @@ -39,19 +39,19 @@ {{ section.section_html }} {% elif section.section_based_on == 'Cards' %}
-

{{ section.name }}

+

{{ _(section.name) }}

{% for card in section.section_cards %}
{% if card.image %} - {{ card.title }} + {{ _(card.title) }} {% endif %}
-
{{ card.title }}
-

{{ card.subtitle or '' }}

-

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

+
{{ _(card.title) }}
+

{{ _(card.subtitle) or '' }}

+

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

{{ _('More details') }} @@ -128,17 +128,17 @@
{{ card.title }}
{% if is_featured %}
- {{ description or '' }} + {{ _(description) or '' }}
{% else %} {% if template != "Product Card" %} -
{{ item.item_group or '' }}
+
{{ _(item.item_group) or '' }}
{% endif %} {% endif %}
@@ -233,23 +233,23 @@

{{ average_rating or 0 }}

- {{ frappe.utils.cstr(total_reviews or 0) + " " + _("ratings") }} + {{ 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 ''%} + {% 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") }}
+
{{ frappe.utils.cstr(average_rating or 0) }} {{ _("out of 5") }}
{% for percent in reviews_per_rating %}
- {{ loop.index }} star + {{ loop.index }} {{ _("star") }}
@@ -298,7 +298,7 @@

{%- set item_field = field_filter[0] %} {%- set values = field_filter[1] %}
-
{{ item_field.label }}
+
{{ _(item_field.label) }}
{% if values | len > 20 %} From 9f3724195af6fa93c79da06df3d3e5e2a546188e Mon Sep 17 00:00:00 2001 From: ccraig Date: Mon, 5 May 2025 23:06:52 -0400 Subject: [PATCH 2/8] Fix numeric attributes not returned. Issue #74 (#98) * Return numeric attributes. Fix frappe/webshop #74 * floating point numeric attributes are returned formatted corectly --- webshop/webshop/variant_selector/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webshop/webshop/variant_selector/utils.py b/webshop/webshop/variant_selector/utils.py index dacf1f9e5e..976a6e2074 100644 --- a/webshop/webshop/variant_selector/utils.py +++ b/webshop/webshop/variant_selector/utils.py @@ -93,6 +93,16 @@ def get_attributes_and_values(item_code): for iv in item_attribute_values: ordered_attribute_value_map.setdefault(iv.parent, []).append(iv.attribute_value) + """Numeric attributes are not stored in the Item Attribute Value table. + However, they are included in valid_options. If they are not found in ordered_attribute_value_map + sort and add them to it. This does not include the entire range if there is no + product associated with specific number. Only possible values are returned. + """ + for attr_name in attribute_list: + if attr_name not in ordered_attribute_value_map: + numeric_list = sorted([i for i in valid_options[attr_name] if i.replace(".","").isnumeric()], key=float) + ordered_attribute_value_map[attr_name] = numeric_list + # build attribute values in idx order for attr in attributes: valid_attribute_values = valid_options.get(attr.attribute, []) @@ -246,4 +256,4 @@ def get_item_variant_price_dict(item_code, cart_settings): ) return {"price": price} - return None \ No newline at end of file + return None From cee34680d0ba0c7b5e10b1bfd361463a5a4b8392 Mon Sep 17 00:00:00 2001 From: Corentin Forler <10946971+cogk@users.noreply.github.com> Date: Tue, 6 May 2025 05:07:13 +0200 Subject: [PATCH 3/8] chore: Disable patch on removed doctype Homepage (#126) --- webshop/patches/add_homepage_field.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webshop/patches/add_homepage_field.py b/webshop/patches/add_homepage_field.py index d894ecc0f8..d7ce7a4460 100644 --- a/webshop/patches/add_homepage_field.py +++ b/webshop/patches/add_homepage_field.py @@ -1,10 +1,11 @@ import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + def execute(): - if not frappe.db.exists("Custom Field", - {"fieldname": "products", "dt": "Homepage"} - ): + if not frappe.db.exists("DocType", "Homepage"): + return + if not frappe.db.exists("Custom Field", {"fieldname": "products", "dt": "Homepage"}): custom_fields = { "Homepage": [ dict( @@ -29,4 +30,4 @@ def execute(): ], } - create_custom_fields(custom_fields) \ No newline at end of file + create_custom_fields(custom_fields) From bac51c07ef7c1c1c8e022f9caa07eecea9c1ed07 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Tue, 6 May 2025 05:07:32 +0200 Subject: [PATCH 4/8] More whitespaces onhero_slider.json (#156) --- webshop/webshop/web_template/hero_slider/hero_slider.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webshop/webshop/web_template/hero_slider/hero_slider.json b/webshop/webshop/web_template/hero_slider/hero_slider.json index f929d3ca29..71c583e032 100644 --- a/webshop/webshop/web_template/hero_slider/hero_slider.json +++ b/webshop/webshop/web_template/hero_slider/hero_slider.json @@ -282,4 +282,4 @@ "standard": 1, "template": "", "type": "Section" -} \ No newline at end of file +} From 1d4f2044d5c8a803b66776a60a1ffa7fb82f9621 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Tue, 6 May 2025 05:08:03 +0200 Subject: [PATCH 5/8] fix: net total in cart_items_total.html (#172) fix: net total in cart_items_total.html --- webshop/templates/includes/cart/cart_items_total.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webshop/templates/includes/cart/cart_items_total.html b/webshop/templates/includes/cart/cart_items_total.html index c94fde462b..7b5c46d065 100644 --- a/webshop/templates/includes/cart/cart_items_total.html +++ b/webshop/templates/includes/cart/cart_items_total.html @@ -2,9 +2,9 @@ - {{ _("Total") }} + {{ _("Net Total") }} {{ doc.get_formatted("total") }} - \ No newline at end of file + From 77b0ad33fe6f6f793e2ddd3f84cea17fca14b122 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Tue, 6 May 2025 05:08:22 +0200 Subject: [PATCH 6/8] fix: add strings for translation in cart_address.html (#171) fix: add strings for translation in cart_address.html --- .../templates/includes/cart/cart_address.html | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/webshop/templates/includes/cart/cart_address.html b/webshop/templates/includes/cart/cart_address.html index e7065c4305..5509869278 100644 --- a/webshop/templates/includes/cart/cart_address.html +++ b/webshop/templates/includes/cart/cart_address.html @@ -70,38 +70,38 @@ $('.btn-new-address').click(() => { const d = new frappe.ui.Dialog({ - title: __('New Address'), + title: {{ _("New Address") }}, fields: [ { - label: __('Address Title'), + label: {{ _("Address Title") }}, fieldname: 'address_title', fieldtype: 'Data', reqd: 1 }, { - label: __('Address Line 1'), + label: {{ _("Address Line 1") }}, fieldname: 'address_line1', fieldtype: 'Data', reqd: 1 }, { - label: __('Address Line 2'), + label: {{ _("Address Line 2") }}, fieldname: 'address_line2', fieldtype: 'Data' }, { - label: __('City/Town'), + label: {{ _("City/Town") }}, fieldname: 'city', fieldtype: 'Data', reqd: 1 }, { - label: __('State'), + label: {{ _("State") }}, fieldname: 'state', fieldtype: 'Data' }, { - label: __('Country'), + label: {{ _("Country") }}, fieldname: 'country', fieldtype: 'Link', options: 'Country', @@ -114,7 +114,7 @@ width: "50%" }, { - label: __('Address Type'), + label: {{ _("Address Type") }}, fieldname: 'address_type', fieldtype: 'Select', options: [ @@ -124,18 +124,18 @@ reqd: 1 }, { - label: __('Postal Code'), + label: {{ _("Postal Code") }}, fieldname: 'pincode', fieldtype: 'Data' }, { fieldname: "phone", fieldtype: "Data", - label: "Phone", + label: {{ _("Phone") }}, reqd: 1 }, ], - primary_action_label: __('Save'), + primary_action_label: {{ _("Save") }}, primary_action: (values) => { frappe.call('webshop.webshop.shopping_cart.cart.add_new_address', { doc: values }) .then(r => { @@ -261,4 +261,4 @@ d.show(); }); }); - \ No newline at end of file + From 05fb4ea1807dd33678d437970a13ea60af2953a9 Mon Sep 17 00:00:00 2001 From: mahsem <137205921+mahsem@users.noreply.github.com> Date: Tue, 6 May 2025 05:08:37 +0200 Subject: [PATCH 7/8] fix: filter translation in index.html (#161) fix: filter translation in index.html --- webshop/www/all-products/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webshop/www/all-products/index.html b/webshop/www/all-products/index.html index 026bf38f26..cbd76632b6 100644 --- a/webshop/www/all-products/index.html +++ b/webshop/www/all-products/index.html @@ -1,9 +1,9 @@ {% from "webshop/templates/includes/macros.html" import attribute_filter_section, field_filter_section, discount_range_filters %} {% extends "templates/web.html" %} -{% block title %}{{ _('All Products') }}{% endblock %} +{% block title %}{{ _("All Products") }}{% endblock %} {% block header %} -
{{ _('All Products') }}
+
{{ _("All Products") }}
{% endblock header %} {% block page_content %} @@ -22,12 +22,12 @@
{% if field_filters %} - {{ field_filter_section(field_filters) }} + {{ _(field_filter_section(field_filters)) }} {% endif %} {% if attribute_filters %} - {{ attribute_filter_section(attribute_filters) }} + {{ _(attribute_filter_section(attribute_filters)) }} {% endif %}

From 541de04cdc768e2debcd563cb1382ae4e10d6c1a Mon Sep 17 00:00:00 2001 From: Corentin Forler <10946971+cogk@users.noreply.github.com> Date: Tue, 6 May 2025 05:09:01 +0200 Subject: [PATCH 8/8] fix: Show item groups for Guest on website (#54) --- webshop/webshop/doctype/override_doctype/item_group.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webshop/webshop/doctype/override_doctype/item_group.py b/webshop/webshop/doctype/override_doctype/item_group.py index 9148564392..3d74a58c30 100644 --- a/webshop/webshop/doctype/override_doctype/item_group.py +++ b/webshop/webshop/doctype/override_doctype/item_group.py @@ -82,6 +82,9 @@ def get_context(self, context): return context + def has_website_permission(self, ptype, user, verbose=False): + return ptype == "read" + def get_item_for_list_in_html(context): # add missing absolute link in files # user may forget it during upload