diff --git a/erpnext/e_commerce/doctype/website_item/website_item.py b/erpnext/e_commerce/doctype/website_item/website_item.py index ea9acd72667..7c661dc7e78 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.py +++ b/erpnext/e_commerce/doctype/website_item/website_item.py @@ -286,7 +286,7 @@ class WebsiteItem(WebsiteGenerator): # make an attribute-value map for easier access in templates variant.attribute_map = frappe._dict( - { attr.attribute : attr.value for attr in variant.attributes} + {attr.attribute : attr.value for attr in variant.attributes} ) for attr in variant.attributes: diff --git a/erpnext/e_commerce/product_data_engine/test_product_data_engine.py b/erpnext/e_commerce/product_data_engine/test_product_data_engine.py index 9a7cb3c3cb6..f6ff2d1a5c7 100644 --- a/erpnext/e_commerce/product_data_engine/test_product_data_engine.py +++ b/erpnext/e_commerce/product_data_engine/test_product_data_engine.py @@ -168,11 +168,13 @@ class TestProductDataEngine(unittest.TestCase): filter_engine = ProductFiltersBuilder() attribute_filter = filter_engine.get_attribute_filters()[0] - attribute = attribute_filter.item_attribute_values[0] + attributes = attribute_filter.item_attribute_values + + attribute_values = [d.attribute_value for d in attributes] self.assertEqual(attribute_filter.name, "Test Size") - self.assertEqual(len(attribute_filter.item_attribute_values), 1) - self.assertEqual(attribute.attribute_value, "Large") + self.assertGreater(len(attribute_values), 0) + self.assertIn("Large", attribute_values) def test_product_list_with_attribute_filter(self): "Test if attribute filters are applied correctly." diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js index 847d8c62459..127fa223b90 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -2,8 +2,8 @@ // License: GNU General Public License v3. See license.txt // shopping cart -frappe.provide("e_commerce.shopping_cart"); -var shopping_cart = e_commerce.shopping_cart; +frappe.provide("erpnext.e_commerce.shopping_cart"); +var shopping_cart = erpnext.e_commerce.shopping_cart; var getParams = function (url) { var params = []; @@ -192,7 +192,7 @@ $.extend(shopping_cart, { $btn.parent().find('.cart-indicator').removeClass('hidden'); const item_code = $btn.data('item-code'); - e_commerce.shopping_cart.update_cart({ + erpnext.e_commerce.shopping_cart.update_cart({ item_code, qty: 1 }); diff --git a/erpnext/public/js/wishlist.js b/erpnext/public/js/wishlist.js index 5231a302e84..ca5af967213 100644 --- a/erpnext/public/js/wishlist.js +++ b/erpnext/public/js/wishlist.js @@ -1,8 +1,8 @@ -frappe.provide("e_commerce.wishlist"); -var wishlist = e_commerce.wishlist; +frappe.provide("erpnext.e_commerce.wishlist"); +var wishlist = erpnext.e_commerce.wishlist; -frappe.provide("e_commerce.shopping_cart"); -var shopping_cart = e_commerce.shopping_cart; +frappe.provide("erpnext.e_commerce.shopping_cart"); +var shopping_cart = erpnext.e_commerce.shopping_cart; $.extend(wishlist, { set_wishlist_count: function() { @@ -98,7 +98,7 @@ $.extend(wishlist, { } let success_action = function() { - e_commerce.wishlist.set_wishlist_count(); + erpnext.e_commerce.wishlist.set_wishlist_count(); }; if ($wish_icon.hasClass('wished')) { diff --git a/erpnext/stock/doctype/price_list/price_list.py b/erpnext/stock/doctype/price_list/price_list.py index 002d3d898eb..e4fc291493e 100644 --- a/erpnext/stock/doctype/price_list/price_list.py +++ b/erpnext/stock/doctype/price_list/price_list.py @@ -36,12 +36,12 @@ class PriceList(Document): (self.currency, cint(self.buying), cint(self.selling), self.name)) def check_impact_on_shopping_cart(self): - "Check if Price List currency change impacts Shopping Cart." - from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import validate_cart_settings + "Check if Price List currency change impacts E Commerce Cart." + from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import validate_cart_settings doc_before_save = self.get_doc_before_save() currency_changed = self.currency != doc_before_save.currency - affects_cart = self.name == frappe.get_cached_value("Shopping Cart Settings", None, "price_list") + affects_cart = self.name == frappe.get_cached_value("E Commerce Settings", None, "price_list") if currency_changed and affects_cart: validate_cart_settings() diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js index 10cd416d0bf..b5f92989ef4 100644 --- a/erpnext/templates/generators/item/item_configure.js +++ b/erpnext/templates/generators/item/item_configure.js @@ -247,7 +247,7 @@ class ItemConfigure { const additional_notes = Object.keys(this.range_values || {}).map(attribute => { return `${attribute}: ${this.range_values[attribute]}`; }).join('\n'); - e_commerce.shopping_cart.update_cart({ + erpnext.e_commerce.shopping_cart.update_cart({ item_code, additional_notes, qty: 1 diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index c766dfd0992..ee8ec73b42a 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -4,8 +4,8 @@ // js inside blog page // shopping cart -frappe.provide("e_commerce.shopping_cart"); -var shopping_cart = e_commerce.shopping_cart; +frappe.provide("erpnext.e_commerce.shopping_cart"); +var shopping_cart = erpnext.e_commerce.shopping_cart; $.extend(shopping_cart, { show_error: function(title, text) { diff --git a/erpnext/www/all-products/index.js b/erpnext/www/all-products/index.js index 68d60b26065..7653bd5c96b 100644 --- a/erpnext/www/all-products/index.js +++ b/erpnext/www/all-products/index.js @@ -20,8 +20,8 @@ $(() => { } bind_card_actions() { - e_commerce.shopping_cart.bind_add_to_cart_action(); - e_commerce.wishlist.bind_wishlist_action(); + erpnext.e_commerce.shopping_cart.bind_add_to_cart_action(); + erpnext.e_commerce.wishlist.bind_wishlist_action(); } }