From 8c20f669056f57781e8c6db3e1cba90f17338446 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 17 May 2021 21:27:42 +0530 Subject: [PATCH] fix: Sider and Patches - Sider fixes - Deleted patches that worked as per old schema - Cleared instances of web fields linked to Item master --- .../doctype/website_item/website_item.py | 2 +- erpnext/e_commerce/product_grid.js | 10 +++++----- erpnext/e_commerce/product_list.js | 12 ++++++------ erpnext/e_commerce/product_view.js | 18 +++++++++--------- .../amazon_mws_settings/amazon_methods.py | 1 - 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/erpnext/e_commerce/doctype/website_item/website_item.py b/erpnext/e_commerce/doctype/website_item/website_item.py index 028ee76f11..9f47260944 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.py +++ b/erpnext/e_commerce/doctype/website_item/website_item.py @@ -203,7 +203,7 @@ class WebsiteItem(WebsiteGenerator): # load variants # also used in set_attribute_context context.variants = frappe.get_all("Item", - filters={"variant_of": self.name, "show_variant_in_website": 1}, + filters={"variant_of": self.name, "published_in_website": 1}, order_by="name asc") variant = frappe.form_dict.variant diff --git a/erpnext/e_commerce/product_grid.js b/erpnext/e_commerce/product_grid.js index 638f01701b..8712a201a1 100644 --- a/erpnext/e_commerce/product_grid.js +++ b/erpnext/e_commerce/product_grid.js @@ -27,7 +27,7 @@ erpnext.ProductGrid = class { html += me.get_image_html(item, title); html += me.get_card_body_html(item, title, me.settings); html += ``; - }) + }); let $product_wrapper = this.products_section; $product_wrapper.append(html); @@ -36,7 +36,7 @@ erpnext.ProductGrid = class { get_image_html(item, title) { let image = item.website_image || item.image; - if(image) { + if (image) { return `
@@ -85,11 +85,11 @@ erpnext.ProductGrid = class {
${ title || '' } `; - if (item.in_stock) { + if (item.in_stock && settings.show_stock_availability) { title_html += ``; } title_html += `
`; - return title_html + return title_html; } get_wishlist_icon(item) { @@ -145,4 +145,4 @@ erpnext.ProductGrid = class { `; } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/erpnext/e_commerce/product_list.js b/erpnext/e_commerce/product_list.js index e693f1e24c..2836c3acc1 100644 --- a/erpnext/e_commerce/product_list.js +++ b/erpnext/e_commerce/product_list.js @@ -27,7 +27,7 @@ erpnext.ProductList = class { html += me.get_image_html(item, title); html += me.get_row_body_html(item, title, me.settings); html += `
`; - }) + }); let $product_wrapper = this.products_section; $product_wrapper.append(html); @@ -36,7 +36,7 @@ erpnext.ProductList = class { get_image_html(item, title) { let image = item.website_image || item.image; - if(image) { + if (image) { return `
@@ -74,7 +74,7 @@ erpnext.ProductList = class { `; - if (item.in_stock) { + if (item.in_stock && settings.show_stock_availability) { title_html += ``; } title_html += `
`; @@ -92,7 +92,7 @@ erpnext.ProductList = class { return title_html; } - get_item_details(item, settings) { + get_item_details(item) { let details = `

Item Code : ${ item.item_code } @@ -104,7 +104,7 @@ erpnext.ProductList = class { ${ item.formatted_price || '' } `; - if(item.formatted_mrp) { + if (item.formatted_mrp) { details += ` ${ item.formatted_mrp } @@ -155,4 +155,4 @@ erpnext.ProductList = class { } } -} +}; \ No newline at end of file diff --git a/erpnext/e_commerce/product_view.js b/erpnext/e_commerce/product_view.js index 923bdb1272..f6727cacc5 100644 --- a/erpnext/e_commerce/product_view.js +++ b/erpnext/e_commerce/product_view.js @@ -14,7 +14,7 @@ erpnext.ProductView = class { } prepare_view_toggler() { - if(!$("#list").length || !$("#image-view").length) { + if (!$("#list").length || !$("#image-view").length) { this.render_view_toggler(); this.bind_view_toggler_actions(); this.set_view_state(); @@ -109,13 +109,13 @@ erpnext.ProductView = class { attribute_filters: attribute_filters, item_group: this.item_group, start: filters.start || null - } + }; } add_paging_section(settings) { $(".product-paging-area").remove(); - if(this.products) { + if (this.products) { let paging_html = `

@@ -126,13 +126,13 @@ erpnext.ProductView = class { let start = query_params.start ? cint(JSON.parse(query_params.start)) : 0; let page_length = settings.products_per_page || 0; - if(start > 0) { + if (start > 0) { paging_html += ` `; } - if(this.products.length > page_length || this.products.length == page_length) { + if (this.products.length > page_length || this.products.length == page_length) { paging_html += `
`; $("#product-listing").prepend(sub_group_html); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py index 66826ba8d7..c5b13c29a2 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py @@ -149,7 +149,6 @@ def create_item_code(amazon_item_json, sku): item.description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title item.brand = new_brand item.manufacturer = new_manufacturer - item.web_long_description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title item.image = amazon_item_json.Product.AttributeSets.ItemAttributes.SmallImage.URL