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) 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 + 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 + diff --git a/webshop/templates/includes/macros.html b/webshop/templates/includes/macros.html index 913aa776a8..d62b4d5b9d 100644 --- a/webshop/templates/includes/macros.html +++ b/webshop/templates/includes/macros.html @@ -51,7 +51,7 @@

{{ _(section.name) }}

{{ _(card.title) }}

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

-

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

+

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

{{ _('More details') }} @@ -128,7 +128,7 @@
{{ _(card.title) }}
- {{ title or '' }} + {{ _(title) or '' }}
@@ -138,7 +138,7 @@
{{ _(card.title) }}
{% 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 ''%} - {{ ratings_with_title(average_whole_rating/5, rating_title, "md", "rating-summary-title", for_summary) }} + {% 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") }}
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 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 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 +} 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 %}