Skip to content
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)
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>
26 changes: 13 additions & 13 deletions webshop/templates/pages/cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
<div class="frappe-card p-5 mb-4">
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
<div class="cart-items-header">
{{ _('Items') }}
{{ _("Items") }}
</div>
<table class="table mt-3 cart-table">
<thead>
<tr>
<th class="item-column">{{ _('Item') }}</th>
<th width="20%">{{ _('Quantity') }}</th>
<th class="item-column">{{ _("Item") }}</th>
<th width="20%">{{ _("Quantity") }}</th>
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
<th width="20" class="text-right column-sm-view">{{ _('Subtotal') }}</th>
<th width="20" class="text-right column-sm-view">{{ _("Subtotal") }}</th>
{% endif %}
<th width="10%" class="column-sm-view"></th>
</tr>
Expand All @@ -47,19 +47,19 @@
<div class="col-3">
{% if cart_settings.enable_checkout %}
<a class="btn btn-primary-light font-md" href="/orders">
{{ _('Past Orders') }}
{{ _("Past Orders") }}
</a>
{% else %}
<a class="btn btn-primary-light font-md" href="/quotations">
{{ _('Past Quotes') }}
{{ _("Past Quotes") }}
</a>
{% endif %}
</div>
<div class="col-9">
{% if doc.items %}
<div class="place-order-container">
<a class="btn btn-primary-light mr-2 font-md" href="/all-products">
{{ _('Continue Shopping') }}
{{ _("Continue Shopping") }}
</a>
</div>
{% endif %}
Expand Down Expand Up @@ -92,9 +92,9 @@ <h5>{{ _("Terms and Conditions") }}</h5>
{% else %}
<div class="mb-3">
<div class="d-flex w-100">
<input type="text" class="txtcoupon form-control mr-3 flex-grow-1 font-md" placeholder="{{ _("Enter coupon code") }}" name="txtcouponcode" ></input>
<button class="btn btn-secondary btn-sm bt-coupon font-md flex-shrink-0">{{ _("Apply") }}</button>
<input type="hidden" class="txtreferral_sales_partner font-md" placeholder="Enter Sales Partner" name="txtreferral_sales_partner" type="text"></input>
<input type="text" class="txtcoupon form-control mr-3 w-50 font-md" placeholder={{ _("Enter Coupon Code") }} name="txtcouponcode" ></input>
<button class="btn btn-primary btn-sm bt-coupon font-md">{{ _("Apply Coupon Code") }}</button>
<input type="hidden" class="txtreferral_sales_partner font-md" placeholder={{ _("Enter Sales Partner") }} name="txtreferral_sales_partner" type="text"></input>
</div>
</div>
{% endif %}
Expand All @@ -121,14 +121,14 @@ <h5>{{ _("Terms and Conditions") }}</h5>
<div class="cart-empty-state">
<img src="/assets/webshop/images/cart-empty-state.png" alt="Empty State">
</div>
<div class="cart-empty-message mt-4">{{ _('Your cart is Empty') }}</p>
<div class="cart-empty-message mt-4">{{ _("Your cart is Empty") }}</p>
{% if cart_settings.enable_checkout %}
<a class="btn btn-outline-primary" href="/orders" style="font-size: 16px;">
{{ _('See past orders') }}
{{ _("See past orders") }}
</a>
{% else %}
<a class="btn btn-outline-primary" href="/quotations" style="font-size: 16px;">
{{ _('See past quotations') }}
{{ _("See past quotations") }}
</a>
{% endif %}
</div>
Expand Down
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