chore: Removed Shopping Cart Module

- Moved all files and web templates from Shopping Cart to E-commerce module
- Made Shopping Cart module obsolete
- Moved select E-commerce related files from Portal to E-commerce module
- Minor cleanups
- Fixed Shopping Cart and Product Configurator tests
This commit is contained in:
marination 2021-02-25 13:56:38 +05:30
parent 37a246e738
commit 22f41a17b7
45 changed files with 182 additions and 141 deletions

View File

@ -134,7 +134,7 @@ def find_variant(template, args, variant_item_code=None):
conditions = " or ".join(conditions) conditions = " or ".join(conditions)
from erpnext.portal.product_configurator.utils import get_item_codes_by_attributes from erpnext.e_commerce.product_configurator.utils import get_item_codes_by_attributes
possible_variants = [i for i in get_item_codes_by_attributes(args, template) if i != variant_item_code] possible_variants = [i for i in get_item_codes_by_attributes(args, template) if i != variant_item_code]
for variant in possible_variants: for variant in possible_variants:

View File

@ -314,7 +314,7 @@ class WebsiteItem(WebsiteGenerator):
context.metatags['og:site_name'] = 'ERPNext' context.metatags['og:site_name'] = 'ERPNext'
def set_shopping_cart_data(self, context): def set_shopping_cart_data(self, context):
from erpnext.shopping_cart.product_info import get_product_info_for_website from erpnext.e_commerce.shopping_cart.product_info import get_product_info_for_website
context.shopping_cart = get_product_info_for_website(self.item_code, skip_quotation_creation=True) context.shopping_cart = get_product_info_for_website(self.item_code, skip_quotation_creation=True)
def copy_specification_from_item_group(self): def copy_specification_from_item_group(self):

View File

@ -14,7 +14,7 @@ class ProductFiltersBuilder:
self.item_group = item_group self.item_group = item_group
def get_field_filters(self): def get_field_filters(self):
if not self.doc.enable_field_filters: return if not self.item_group and not self.doc.enable_field_filters: return
filter_fields = [row.fieldname for row in self.doc.filter_fields] filter_fields = [row.fieldname for row in self.doc.filter_fields]
@ -31,7 +31,7 @@ class ProductFiltersBuilder:
["Website Item Group", "item_group", "=", self.item_group] ["Website Item Group", "item_group", "=", self.item_group]
]) ])
values = frappe.get_all("Item", fields=[df.fieldname], filters=filters, or_filters=or_filters, distinct="True", pluck=df.fieldname) values = frappe.get_all("Item", fields=[df.fieldname], filters=filters, distinct="True", pluck=df.fieldname)
else: else:
doctype = df.get_link_doctype() doctype = df.get_link_doctype()
@ -56,7 +56,7 @@ class ProductFiltersBuilder:
return filter_data return filter_data
def get_attribute_filters(self): def get_attribute_filters(self):
if not self.doc.enable_attribute_filters: return if not self.item_group and not self.doc.enable_attribute_filters: return
attributes = [row.attribute for row in self.doc.filter_attributes] attributes = [row.attribute for row in self.doc.filter_attributes]

View File

@ -1,76 +1,23 @@
from __future__ import unicode_literals
import unittest import unittest
import frappe import frappe
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from frappe.utils import get_html_for_route from frappe.utils import get_html_for_route
from erpnext.portal.product_configurator.utils import get_products_for_website from erpnext.e_commerce.product_query import ProductQuery
from erpnext.e_commerce.doctype.website_item.website_item import make_website_item
test_dependencies = ["Item"] test_dependencies = ["Item"]
class TestProductConfigurator(unittest.TestCase): class TestProductConfigurator(unittest.TestCase):
@classmethod def setUp(self):
def setUpClass(cls): self.create_variant_item()
cls.create_variant_item() self.publish_items_on_website()
@classmethod
def create_variant_item(cls):
if not frappe.db.exists('Item', '_Test Variant Item - 2XL'):
frappe.get_doc({
"description": "_Test Variant Item - 2XL",
"item_code": "_Test Variant Item - 2XL",
"item_name": "_Test Variant Item - 2XL",
"doctype": "Item",
"is_stock_item": 1,
"variant_of": "_Test Variant Item",
"item_group": "_Test Item Group",
"stock_uom": "_Test UOM",
"item_defaults": [{
"company": "_Test Company",
"default_warehouse": "_Test Warehouse - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC"
}],
"attributes": [
{
"attribute": "Test Size",
"attribute_value": "2XL"
}
],
"show_variant_in_website": 1
}).insert()
def create_regular_web_item(self, name, item_group=None):
if not frappe.db.exists('Item', name):
doc = frappe.get_doc({
"description": name,
"item_code": name,
"item_name": name,
"doctype": "Item",
"is_stock_item": 1,
"item_group": item_group or "_Test Item Group",
"stock_uom": "_Test UOM",
"item_defaults": [{
"company": "_Test Company",
"default_warehouse": "_Test Warehouse - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC"
}],
"show_in_website": 1
}).insert()
else:
doc = frappe.get_doc("Item", name)
return doc
def test_product_list(self): def test_product_list(self):
template_items = frappe.get_all('Item', {'show_in_website': 1}) usual_items = frappe.get_all('Website Item', {'published': 1, 'has_variants': 0, 'variant_of': ['is', 'not set']})
variant_items = frappe.get_all('Item', {'show_variant_in_website': 1}) template_items = frappe.get_all('Website Item', {'published': 1, 'has_variants': 1})
variant_items = frappe.get_all('Website Item', {'published': 1, 'variant_of': ['is', 'set']})
e_commerce_settings = frappe.get_doc('E Commerce Settings') e_commerce_settings = frappe.get_doc('E Commerce Settings')
e_commerce_settings.enable_field_filters = 1 e_commerce_settings.enable_field_filters = 1
@ -83,10 +30,10 @@ class TestProductConfigurator(unittest.TestCase):
soup = BeautifulSoup(html, 'html.parser') soup = BeautifulSoup(html, 'html.parser')
products_list = soup.find(class_='products-list') products_list = soup.find(class_='products-list')
items = products_list.find_all(class_='card') items = products_list.find_all(class_='card')
self.assertEqual(len(items), len(template_items + variant_items))
items_with_item_group = frappe.get_all('Item', {'item_group': '_Test Item Group Desktops', 'show_in_website': 1}) self.assertEqual(len(items), len(template_items + variant_items + usual_items))
variants_with_item_group = frappe.get_all('Item', {'item_group': '_Test Item Group Desktops', 'show_variant_in_website': 1})
items_with_item_group = frappe.get_all('Website Item', {'item_group': '_Test Item Group Desktops', 'published': 1})
# mock query params # mock query params
frappe.form_dict = frappe._dict({ frappe.form_dict = frappe._dict({
@ -96,12 +43,13 @@ class TestProductConfigurator(unittest.TestCase):
soup = BeautifulSoup(html, 'html.parser') soup = BeautifulSoup(html, 'html.parser')
products_list = soup.find(class_='products-list') products_list = soup.find(class_='products-list')
items = products_list.find_all(class_='card') items = products_list.find_all(class_='card')
self.assertEqual(len(items), len(items_with_item_group + variants_with_item_group)) self.assertEqual(len(items), len(items_with_item_group))
def test_get_products_for_website(self): def test_get_products_for_website(self):
items = get_products_for_website(attribute_filters={ engine = ProductQuery()
'Test Size': ['2XL'] items = engine.query(attributes={
'Test Size': ['Medium']
}) })
self.assertEqual(len(items), 1) self.assertEqual(len(items), 1)
@ -109,12 +57,31 @@ class TestProductConfigurator(unittest.TestCase):
"""Check if product is visible on multiple item group pages barring its own.""" """Check if product is visible on multiple item group pages barring its own."""
from erpnext.shopping_cart.product_query import ProductQuery from erpnext.shopping_cart.product_query import ProductQuery
if not frappe.db.exists("Item Group", {"name": "Tech Items"}): def create_variant_item(self):
item_group_doc = frappe.get_doc({ if not frappe.db.exists('Item', '_Test Variant Item 1'):
"doctype": "Item Group", frappe.get_doc({
"item_group_name": "Tech Items", "description": "_Test Variant Item 12",
"parent_item_group": "All Item Groups", "doctype": "Item",
"show_in_website": 1 "is_stock_item": 1,
"variant_of": "_Test Variant Item",
"item_code": "_Test Variant Item 1",
"item_group": "_Test Item Group",
"item_name": "_Test Variant Item 1",
"stock_uom": "_Test UOM",
"item_defaults": [{
"company": "_Test Company",
"default_warehouse": "_Test Warehouse - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
"buying_cost_center": "_Test Cost Center - _TC",
"selling_cost_center": "_Test Cost Center - _TC",
"income_account": "Sales - _TC"
}],
"attributes": [
{
"attribute": "Test Size",
"attribute_value": "Medium"
}
]
}).insert() }).insert()
else: else:
item_group_doc = frappe.get_doc("Item Group", "Tech Items") item_group_doc = frappe.get_doc("Item Group", "Tech Items")
@ -137,8 +104,14 @@ class TestProductConfigurator(unittest.TestCase):
items = engine.query({}, {"item_group": "_Test Item Group Desktops"}, None, start=0, item_group="_Test Item Group Desktops") items = engine.query({}, {"item_group": "_Test Item Group Desktops"}, None, start=0, item_group="_Test Item Group Desktops")
item_codes = [row.item_code for row in items] item_codes = [row.item_code for row in items]
self.assertIn(len(items), [2, 3]) def publish_items_on_website(self):
self.assertIn("Portal Item", item_codes) if frappe.db.exists("Item", "_Test Item") and not frappe.db.exists("Website Item", {"item_code": "_Test Item"}):
make_website_item(frappe.get_cached_doc("Item", "_Test Item"))
if frappe.db.exists("Item", "_Test Variant Item") and not frappe.db.exists("Website Item", {"item_code": "_Test Variant Item"}):
make_website_item(frappe.get_cached_doc("Item", "_Test Variant Item"))
make_website_item(frappe.get_cached_doc("Item", "_Test Variant Item 1"))
# teardown # teardown
doc.delete() doc.delete()

View File

@ -1,9 +1,65 @@
import frappe import frappe
from frappe.utils import cint from frappe.utils import cint
from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager from erpnext.e_commerce.product_configurator.item_variants_cache import ItemVariantsCacheManager
from erpnext.setup.doctype.item_group.item_group import get_child_groups from erpnext.e_commerce.shopping_cart.product_info import get_product_info_for_website
from erpnext.shopping_cart.product_info import get_product_info_for_website
def get_item_codes_by_attributes(attribute_filters, template_item_code=None):
items = []
for attribute, values in attribute_filters.items():
attribute_values = values
if not isinstance(attribute_values, list):
attribute_values = [attribute_values]
if not attribute_values: continue
wheres = []
query_values = []
for attribute_value in attribute_values:
wheres.append('( attribute = %s and attribute_value = %s )')
query_values += [attribute, attribute_value]
attribute_query = ' or '.join(wheres)
if template_item_code:
variant_of_query = 'AND t2.variant_of = %s'
query_values.append(template_item_code)
else:
variant_of_query = ''
query = '''
SELECT
t1.parent
FROM
`tabItem Variant Attribute` t1
WHERE
1 = 1
AND (
{attribute_query}
)
AND EXISTS (
SELECT
1
FROM
`tabItem` t2
WHERE
t2.name = t1.parent
{variant_of_query}
)
GROUP BY
t1.parent
ORDER BY
NULL
'''.format(attribute_query=attribute_query, variant_of_query=variant_of_query)
item_codes = set([r[0] for r in frappe.db.sql(query, query_values)])
items.append(item_codes)
res = list(set.intersection(*items))
return res
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def get_attributes_and_values(item_code): def get_attributes_and_values(item_code):
@ -86,7 +142,7 @@ def get_next_attribute_and_values(item_code, selected_attributes):
filtered_items_count = len(filtered_items) filtered_items_count = len(filtered_items)
# get product info if exact match # get product info if exact match
from erpnext.shopping_cart.product_info import get_product_info_for_website from erpnext.e_commerce.shopping_cart.product_info import get_product_info_for_website
if exact_match: if exact_match:
data = get_product_info_for_website(exact_match[0]) data = get_product_info_for_website(exact_match[0])
product_info = data.product_info product_info = data.product_info

View File

@ -3,7 +3,7 @@
import frappe import frappe
from erpnext.shopping_cart.product_info import get_product_info_for_website from erpnext.e_commerce.shopping_cart.product_info import get_product_info_for_website
class ProductQuery: class ProductQuery:

View File

@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe import frappe
from erpnext.shopping_cart.cart import _get_cart_quotation, _set_price_list from erpnext.e_commerce.shopping_cart.cart import _get_cart_quotation, _set_price_list
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import ( from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
get_shopping_cart_settings, get_shopping_cart_settings,
show_quantity_in_website show_quantity_in_website

View File

@ -9,7 +9,8 @@ import frappe
from frappe.utils import add_months, nowdate from frappe.utils import add_months, nowdate
from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule
from erpnext.shopping_cart.cart import _get_cart_quotation, get_party, update_cart from erpnext.e_commerce.doctype.website_item.website_item import make_website_item
from erpnext.e_commerce.shopping_cart.cart import _get_cart_quotation, get_party, update_cart
from erpnext.tests.utils import create_test_contact_and_address from erpnext.tests.utils import create_test_contact_and_address
# test_dependencies = ['Payment Terms Template'] # test_dependencies = ['Payment Terms Template']
@ -28,6 +29,11 @@ class TestShoppingCart(unittest.TestCase):
frappe.set_user("Administrator") frappe.set_user("Administrator")
create_test_contact_and_address() create_test_contact_and_address()
self.enable_shopping_cart() self.enable_shopping_cart()
if not frappe.db.exists("Website Item", {"item_code": "_Test Item"}):
make_website_item(frappe.get_cached_doc("Item", "_Test Item"))
if not frappe.db.exists("Website Item", {"item_code": "_Test Item 2"}):
make_website_item(frappe.get_cached_doc("Item", "_Test Item 2"))
def tearDown(self): def tearDown(self):
frappe.set_user("Administrator") frappe.set_user("Administrator")

View File

@ -16,7 +16,7 @@ def set_cart_count(login_manager):
role, parties = check_customer_or_supplier() role, parties = check_customer_or_supplier()
if role == 'Supplier': return if role == 'Supplier': return
if show_cart_count(): if show_cart_count():
from erpnext.shopping_cart.cart import set_cart_count from erpnext.e_commerce.shopping_cart.cart import set_cart_count
set_cart_count() set_cart_count()
def clear_cart_count(login_manager): def clear_cart_count(login_manager):

View File

@ -1,4 +1,5 @@
{ {
"__unsaved": 1,
"creation": "2020-11-17 15:21:51.207221", "creation": "2020-11-17 15:21:51.207221",
"docstatus": 0, "docstatus": 0,
"doctype": "Web Template", "doctype": "Web Template",
@ -273,9 +274,9 @@
} }
], ],
"idx": 2, "idx": 2,
"modified": "2020-12-29 12:30:02.794994", "modified": "2021-02-24 15:57:05.889709",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "E-commerce",
"name": "Hero Slider", "name": "Hero Slider",
"owner": "Administrator", "owner": "Administrator",
"standard": 1, "standard": 1,

View File

@ -17,15 +17,12 @@
"reqd": 0 "reqd": 0
}, },
{ {
"__unsaved": 1,
"fieldname": "primary_action_label", "fieldname": "primary_action_label",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Primary Action Label", "label": "Primary Action Label",
"reqd": 0 "reqd": 0
}, },
{ {
"__islocal": 1,
"__unsaved": 1,
"fieldname": "primary_action", "fieldname": "primary_action",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Primary Action", "label": "Primary Action",
@ -262,9 +259,9 @@
} }
], ],
"idx": 0, "idx": 0,
"modified": "2020-11-19 18:48:52.633045", "modified": "2021-02-24 16:05:31.242342",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "E-commerce",
"name": "Item Card Group", "name": "Item Card Group",
"owner": "Administrator", "owner": "Administrator",
"standard": 1, "standard": 1,

View File

@ -5,7 +5,6 @@
"doctype": "Web Template", "doctype": "Web Template",
"fields": [ "fields": [
{ {
"__unsaved": 1,
"fieldname": "item", "fieldname": "item",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Item", "label": "Item",
@ -13,7 +12,6 @@
"reqd": 0 "reqd": 0
}, },
{ {
"__unsaved": 1,
"fieldname": "featured", "fieldname": "featured",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Featured", "label": "Featured",
@ -22,9 +20,9 @@
} }
], ],
"idx": 0, "idx": 0,
"modified": "2020-11-17 15:33:34.982515", "modified": "2021-02-24 16:05:17.926610",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "E-commerce",
"name": "Product Card", "name": "Product Card",
"owner": "Administrator", "owner": "Administrator",
"standard": 1, "standard": 1,

View File

@ -74,9 +74,9 @@
} }
], ],
"idx": 0, "idx": 0,
"modified": "2020-11-18 17:26:28.726260", "modified": "2021-02-24 16:03:33.835635",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "E-commerce",
"name": "Product Category Cards", "name": "Product Category Cards",
"owner": "Administrator", "owner": "Administrator",
"standard": 1, "standard": 1,

View File

@ -53,15 +53,15 @@ additional_print_settings = "erpnext.controllers.print_settings.get_print_settin
on_session_creation = [ on_session_creation = [
"erpnext.portal.utils.create_customer_or_supplier", "erpnext.portal.utils.create_customer_or_supplier",
"erpnext.shopping_cart.utils.set_cart_count" "erpnext.e_commerce.shopping_cart.utils.set_cart_count"
] ]
on_logout = "erpnext.shopping_cart.utils.clear_cart_count" on_logout = "erpnext.e_commerce.shopping_cart.utils.clear_cart_count"
treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory', 'Assessment Group', 'Department'] treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory', 'Assessment Group', 'Department']
# website # website
update_website_context = ["erpnext.shopping_cart.utils.update_website_context", "erpnext.education.doctype.education_settings.education_settings.update_website_context"] update_website_context = ["erpnext.e_commerce.shopping_cart.utils.update_website_context", "erpnext.education.doctype.education_settings.education_settings.update_website_context"]
my_account_context = "erpnext.shopping_cart.utils.update_my_account_context" my_account_context = "erpnext.e_commerce.shopping_cart.utils.update_my_account_context"
webform_list_context = "erpnext.controllers.website_list_for_contact.get_webform_list_context" webform_list_context = "erpnext.controllers.website_list_for_contact.get_webform_list_context"
calendars = ["Task", "Work Order", "Leave Application", "Sales Order", "Holiday List", "Course Schedule"] calendars = ["Task", "Work Order", "Leave Application", "Sales Order", "Holiday List", "Course Schedule"]

View File

@ -9,7 +9,6 @@ Manufacturing
Stock Stock
Support Support
Utilities Utilities
Shopping Cart
Assets Assets
Portal Portal
Maintenance Maintenance

View File

@ -32,7 +32,7 @@ def execute():
""".format( """.format(
doctype=doctype, doctype=doctype,
fields=(",").join(['%s'] * len(fields)) fields=(",").join(['%s'] * len(fields))
), tuple(fields), as_dict=1, debug=1) ), tuple(fields), as_dict=1)
# {'enable_attribute_filters': '1', ...} # {'enable_attribute_filters': '1', ...}
mapper = {row.field: row.value for row in data} mapper = {row.field: row.value for row in data}

View File

@ -1,7 +1,7 @@
import frappe import frappe
from frappe.utils.nestedset import get_root_of from frappe.utils.nestedset import get_root_of
from erpnext.shopping_cart.cart import get_debtors_account from erpnext.e_commerce.shopping_cart.cart import get_debtors_account
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import ( from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
get_shopping_cart_settings, get_shopping_cart_settings,
) )

View File

@ -21,6 +21,6 @@ $.extend(frappe.breadcrumbs.module_map, {
'Geo': 'Settings', 'Geo': 'Settings',
'Portal': 'Website', 'Portal': 'Website',
'Utilities': 'Settings', 'Utilities': 'Settings',
'Shopping Cart': 'Website', 'E-commerce': 'Website',
'Contacts': 'CRM' 'Contacts': 'CRM'
}); });

View File

@ -63,7 +63,7 @@ $.extend(shopping_cart, {
$(".shopping-cart").on('shown.bs.dropdown', function() { $(".shopping-cart").on('shown.bs.dropdown', function() {
if (!$('.shopping-cart-menu .cart-container').length) { if (!$('.shopping-cart-menu .cart-container').length) {
return frappe.call({ return frappe.call({
method: 'erpnext.shopping_cart.cart.get_shopping_cart_menu', method: 'erpnext.e_commerce.shopping_cart.cart.get_shopping_cart_menu',
callback: function(r) { callback: function(r) {
if (r.message) { if (r.message) {
$('.shopping-cart-menu').html(r.message); $('.shopping-cart-menu').html(r.message);
@ -83,7 +83,7 @@ $.extend(shopping_cart, {
} else { } else {
return frappe.call({ return frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.update_cart", method: "erpnext.e_commerce.shopping_cart.cart.update_cart",
args: { args: {
item_code: opts.item_code, item_code: opts.item_code,
qty: opts.qty, qty: opts.qty,

View File

@ -1,8 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import copy import copy
import frappe import frappe
@ -13,9 +11,8 @@ from frappe.website.utils import clear_cache
from frappe.website.website_generator import WebsiteGenerator from frappe.website.website_generator import WebsiteGenerator
from six.moves.urllib.parse import quote from six.moves.urllib.parse import quote
from erpnext.shopping_cart.filters import ProductFiltersBuilder from erpnext.e_commerce.filters import ProductFiltersBuilder
from erpnext.shopping_cart.product_info import set_product_info_for_website from erpnext.e_commerce.product_query import ProductQuery
from erpnext.shopping_cart.product_query import ProductQuery
from erpnext.utilities.product import get_qty_in_stock from erpnext.utilities.product import get_qty_in_stock

View File

@ -116,12 +116,14 @@
"customer_code", "customer_code",
"default_item_manufacturer", "default_item_manufacturer",
"default_manufacturer_part_no", "default_manufacturer_part_no",
"total_projected_qty",
"hub_publishing_sb", "hub_publishing_sb",
"publish_in_hub", "publish_in_hub",
"hub_category_to_publish", "hub_category_to_publish",
"hub_warehouse", "hub_warehouse",
"synced_with_hub" "synced_with_hub",
"more_information_section",
"published_in_website",
"total_projected_qty"
], ],
"fields": [ "fields": [
{ {
@ -926,6 +928,20 @@
"fieldtype": "Data", "fieldtype": "Data",
"label": "Default Manufacturer Part No", "label": "Default Manufacturer Part No",
"read_only": 1 "read_only": 1
},
{
"collapsible": 1,
"fieldname": "more_information_section",
"fieldtype": "Section Break",
"label": "More Information"
},
{
"default": "0",
"depends_on": "published_in_website",
"fieldname": "published_in_website",
"fieldtype": "Check",
"label": "Published in Website",
"read_only": 1
} }
], ],
"icon": "fa fa-tag", "icon": "fa fa-tag",
@ -934,7 +950,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"max_attachments": 1, "max_attachments": 1,
"modified": "2021-08-27 12:23:07.277077", "modified": "2021-10-12 12:23:07.277077",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item", "name": "Item",

View File

@ -868,7 +868,7 @@ def invalidate_cache_for_item(doc):
def invalidate_item_variants_cache_for_website(doc): def invalidate_item_variants_cache_for_website(doc):
"""Rebuild ItemVariantsCacheManager via Item or Website Item.""" """Rebuild ItemVariantsCacheManager via Item or Website Item."""
from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager from erpnext.e_commerce.product_configurator.item_variants_cache import ItemVariantsCacheManager
item_code = None item_code = None
is_web_item = doc.get("published_in_website") or doc.get("published") is_web_item = doc.get("published_in_website") or doc.get("published")

View File

@ -280,14 +280,14 @@ class ItemConfigure {
} }
get_next_attribute_and_values(selected_attributes) { get_next_attribute_and_values(selected_attributes) {
return this.call('erpnext.portal.product_configurator.utils.get_next_attribute_and_values', { return this.call('erpnext.e_commerce.product_configurator.utils.get_next_attribute_and_values', {
item_code: this.item_code, item_code: this.item_code,
selected_attributes selected_attributes
}); });
} }
get_attributes_and_values() { get_attributes_and_values() {
return this.call('erpnext.portal.product_configurator.utils.get_attributes_and_values', { return this.call('erpnext.e_commerce.product_configurator.utils.get_attributes_and_values', {
item_code: this.item_code item_code: this.item_code
}); });
} }

View File

@ -52,7 +52,7 @@ frappe.ready(() => {
d.hide(); d.hide();
frappe.call('erpnext.shopping_cart.cart.create_lead_for_item_inquiry', { frappe.call('erpnext.e_commerce.shopping_cart.cart.create_lead_for_item_inquiry', {
lead: doc, lead: doc,
subject: values.subject, subject: values.subject,
message: values.message message: values.message

View File

@ -48,7 +48,7 @@ $.extend(shopping_cart, {
const address_name = $card.closest('[data-address-name]').attr('data-address-name'); const address_name = $card.closest('[data-address-name]').attr('data-address-name');
frappe.call({ frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.update_cart_address", method: "erpnext.e_commerce.shopping_cart.cart.update_cart_address",
freeze: true, freeze: true,
args: { args: {
address_type, address_type,
@ -185,7 +185,7 @@ $.extend(shopping_cart, {
return frappe.call({ return frappe.call({
btn: btn, btn: btn,
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.apply_shipping_rule", method: "erpnext.e_commerce.shopping_cart.cart.apply_shipping_rule",
args: { shipping_rule: rule }, args: { shipping_rule: rule },
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
@ -198,7 +198,7 @@ $.extend(shopping_cart, {
place_order: function(btn) { place_order: function(btn) {
return frappe.call({ return frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.place_order", method: "erpnext.e_commerce.shopping_cart.cart.place_order",
btn: btn, btn: btn,
callback: function(r) { callback: function(r) {
if(r.exc) { if(r.exc) {
@ -223,7 +223,7 @@ $.extend(shopping_cart, {
request_quotation: function(btn) { request_quotation: function(btn) {
return frappe.call({ return frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.request_for_quotation", method: "erpnext.e_commerce.shopping_cart.cart.request_for_quotation",
btn: btn, btn: btn,
callback: function(r) { callback: function(r) {
if(r.exc) { if(r.exc) {
@ -254,7 +254,7 @@ $.extend(shopping_cart, {
apply_coupon_code: function(btn) { apply_coupon_code: function(btn) {
return frappe.call({ return frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.cart.apply_coupon_code", method: "erpnext.e_commerce.shopping_cart.cart.apply_coupon_code",
btn: btn, btn: btn,
args : { args : {
applied_code : $('.txtcoupon').val(), applied_code : $('.txtcoupon').val(),

View File

@ -130,10 +130,10 @@ frappe.ready(() => {
], ],
primary_action_label: __('Save'), primary_action_label: __('Save'),
primary_action: (values) => { primary_action: (values) => {
frappe.call('erpnext.shopping_cart.cart.add_new_address', { doc: values }) frappe.call('erpnext.e_commerce.shopping_cart.cart.add_new_address', { doc: values })
.then(r => { .then(r => {
frappe.call({ frappe.call({
method: "erpnext.shopping_cart.cart.update_cart_address", method: "erpnext.e_commerce.shopping_cart.cart.update_cart_address",
args: { args: {
address_type: r.message.address_type, address_type: r.message.address_type,
address_name: r.message.name address_name: r.message.name

View File

@ -7,7 +7,7 @@ frappe.ready(function() {
frappe.call({ frappe.call({
type: "POST", type: "POST",
method: "erpnext.shopping_cart.product_info.get_product_info_for_website", method: "erpnext.e_commerce.shopping_cart.product_info.get_product_info_for_website",
args: { args: {
item_code: get_item_code() item_code: get_item_code()
}, },

View File

@ -96,7 +96,7 @@
}) })
}); });
function show_terms_and_conditions(terms_name) { function show_terms_and_conditions(terms_name) {
frappe.call('erpnext.shopping_cart.cart.get_terms_and_conditions', { terms_name }) frappe.call('erpnext.e_commerce.shopping_cart.cart.get_terms_and_conditions', { terms_name })
.then(r => { .then(r => {
frappe.msgprint({ frappe.msgprint({
title: terms_name, title: terms_name,

View File

@ -1,11 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
no_cache = 1 no_cache = 1
from erpnext.e_commerce.shopping_cart.cart import get_cart_quotation
from erpnext.shopping_cart.cart import get_cart_quotation
def get_context(context): def get_context(context):

View File

@ -7,7 +7,7 @@ import frappe
from frappe.utils import cint, cstr, nowdate from frappe.utils import cint, cstr, nowdate
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
from erpnext.shopping_cart.product_info import set_product_info_for_website from erpnext.e_commerce.shopping_cart.product_info import set_product_info_for_website
no_cache = 1 no_cache = 1

View File

@ -1,7 +1,7 @@
import frappe import frappe
from frappe.utils import cint from frappe.utils import cint
from erpnext.shopping_cart.product_query import ProductQuery from erpnext.e_commerce.product_query import ProductQuery
from erpnext.shopping_cart.filters import ProductFiltersBuilder from erpnext.e_commerce.filters import ProductFiltersBuilder
sitemap = 1 sitemap = 1