Skip to content
Open
9 changes: 5 additions & 4 deletions webshop/patches/add_homepage_field.py
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -29,4 +30,4 @@ def execute():
],
}

create_custom_fields(custom_fields)
create_custom_fields(custom_fields)
2 changes: 1 addition & 1 deletion webshop/public/js/product_ui/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ webshop.ProductList = class {
get_item_details(item, settings) {
let details = `
<p class="product-code">
${ item.item_group } | ${ __('Item Code') } : ${ item.item_code }
${ item.item_group } | ${ __("Item Code") } : ${ item.item_code }
</p>
<div class="mt-2" style="color: var(--gray-600) !important; font-size: 13px;">
${ item.short_description || '' }
Expand Down
24 changes: 12 additions & 12 deletions webshop/templates/includes/cart/cart_address.html
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -114,7 +114,7 @@
width: "50%"
},
{
label: __('Address Type'),
label: {{ _("Address Type") }},
fieldname: 'address_type',
fieldtype: 'Select',
options: [
Expand All @@ -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 => {
Expand Down Expand Up @@ -261,4 +261,4 @@
d.show();
});
});
</script>
</script>
4 changes: 2 additions & 2 deletions webshop/templates/includes/cart/cart_items_total.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<tr>
<th></th>
<th class="text-left item-grand-total" colspan="1">
{{ _("Total") }}
{{ _("Net Total") }}
</th>
<th class="text-left item-grand-total totals" colspan="3">
{{ doc.get_formatted("total") }}
</th>
</tr>
</tr>
3 changes: 3 additions & 0 deletions webshop/webshop/doctype/override_doctype/item_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion webshop/webshop/variant_selector/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, [])
Expand Down Expand Up @@ -246,4 +256,4 @@ def get_item_variant_price_dict(item_code, cart_settings):
)
return {"price": price}

return None
return None
2 changes: 1 addition & 1 deletion webshop/webshop/web_template/hero_slider/hero_slider.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@
"standard": 1,
"template": "",
"type": "Section"
}
}
8 changes: 4 additions & 4 deletions webshop/www/all-products/index.html
Original file line number Diff line number Diff line change
@@ -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 %}
<div class="mb-6">{{ _('All Products') }}</div>
<div class="mb-6">{{ _("All Products") }}</div>
{% endblock header %}

{% block page_content %}
Expand All @@ -22,12 +22,12 @@
</div>
<!-- field filters -->
{% if field_filters %}
{{ field_filter_section(field_filters) }}
{{ _(field_filter_section(field_filters)) }}
{% endif %}

<!-- attribute filters -->
{% if attribute_filters %}
{{ attribute_filter_section(attribute_filters) }}
{{ _(attribute_filter_section(attribute_filters)) }}
{% endif %}
</div>

Expand Down