diff --git a/erpnext/e_commerce/website_item_indexing.py b/erpnext/e_commerce/website_item_indexing.py index faf5760a6aa..a4c45cc3b80 100644 --- a/erpnext/e_commerce/website_item_indexing.py +++ b/erpnext/e_commerce/website_item_indexing.py @@ -153,7 +153,6 @@ def reindex_all_web_items(): for item in items: web_item = create_web_item_map(item) key = get_cache_key(item.name) - print(key, web_item) r.hset(key, mapping=web_item) def get_cache_key(name): diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py index 8b7aeab066f..523fd3e6433 100644 --- a/erpnext/templates/pages/product_search.py +++ b/erpnext/templates/pages/product_search.py @@ -72,7 +72,7 @@ def search(query): query_string = query for s in suggestions: - query_string += f"|({s.string})" + query_string += f"|('{s.string}')" q = Query(query_string) diff --git a/erpnext/www/all-products/search.html b/erpnext/www/all-products/search.html index 1c58e65cc76..c6c87089e80 100644 --- a/erpnext/www/all-products/search.html +++ b/erpnext/www/all-products/search.html @@ -11,20 +11,29 @@ {% endblock header %} {% block page_content %} - - - -

Products

- - -{% set show_categories = frappe.db.get_single_value('E Commerce Settings', 'show_categories_in_search_autocomplete') %} - -{% if show_categories %} -
-

Categories

- +
+ +
+ +
+
+ +
+ +
+

Products

+
    +
    + + {% set show_categories = frappe.db.get_single_value('E Commerce Settings', 'show_categories_in_search_autocomplete') %} + + {% if show_categories %} +
    +

    Categories

    +
      +
    +
    + {% endif %}
    -{% endif %} {% endblock %} \ No newline at end of file diff --git a/erpnext/www/all-products/search.js b/erpnext/www/all-products/search.js index aa47a4d7e2a..f17f7a034cf 100644 --- a/erpnext/www/all-products/search.js +++ b/erpnext/www/all-products/search.js @@ -1,4 +1,4 @@ -console.log("search.js loaded"); +let loading = false; const searchBox = document.getElementById("search-box"); const results = document.getElementById("results"); @@ -7,7 +7,7 @@ const categoryList = document.getElementById("category-suggestions"); function populateResults(data) { html = "" for (let res of data.message) { - html += `
  • + html += `
  • ${res.web_item_name}
  • ` @@ -17,7 +17,7 @@ function populateResults(data) { function populateCategoriesList(data) { if (data.length === 0) { - categoryList.innerText = "No matches"; + categoryList.innerHTML = 'Type something...'; return; } @@ -29,7 +29,15 @@ function populateCategoriesList(data) { categoryList.innerHTML = html; } +function updateLoadingState() { + if (loading) { + results.innerHTML = `
    loading...
    `; + } +} + searchBox.addEventListener("input", (e) => { + loading = true; + updateLoadingState(); frappe.call({ method: "erpnext.templates.pages.product_search.search", args: { @@ -37,6 +45,7 @@ searchBox.addEventListener("input", (e) => { }, callback: (data) => { populateResults(data); + loading = false; } });