[fix] product search
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index b46205c..dc6d2d9 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -41,7 +41,7 @@
self.route = frappe.get_doc('Item Group', self.parent_item_group).route + '/'
self.route += self.scrub(self.item_group_name)
-
+
return self.route
def after_rename(self, olddn, newdn, merge=False):
@@ -57,6 +57,8 @@
def get_context(self, context):
context.show_search=True
+ context.search_link = '/product_search'
+
start = int(frappe.form_dict.start or 0)
if start < 0:
start = 0
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index ea702cc..367d114 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -222,6 +222,7 @@
def get_context(self, context):
context.show_search=True
+ context.search_link = '/product_search'
if self.variant_of:
# redirect to template page!
template_item = frappe.get_doc("Item", self.variant_of)
diff --git a/erpnext/templates/includes/product_search_box.html b/erpnext/templates/includes/product_search_box.html
deleted file mode 100644
index a135396..0000000
--- a/erpnext/templates/includes/product_search_box.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<div class="product-search pull-right">
- <form class="form-inline form-search">
- <div class="input-group">
- <input class="form-control" type="text" id="product-search"
- placeholder="Product Search...">
- <span class="input-group-btn">
- <button class="btn btn-default" type="button" id="btn-product-search">
- <i class="icon-search"></i></button>
- </span>
- </div>
- </form>
-</div>
-<script>
-frappe.ready(function() {
- $("#btn-product-search").click(function() {
- var txt = $("#product-search").val();
- if(txt) {
- window.location.href="/product_search?q=" + txt;
- }
- return false;
- });
- $("#product-search").keypress(function(e) {
- if(e.which==13) $("#btn-product-search").click();
- });
- $(".form-search").on("submit", function() { return false; });
-
-});
-</script>
diff --git a/erpnext/templates/pages/product_search.html b/erpnext/templates/pages/product_search.html
index 2d80cf4..6875ba5 100644
--- a/erpnext/templates/pages/product_search.html
+++ b/erpnext/templates/pages/product_search.html
@@ -4,16 +4,12 @@
{% block header %}<h2>Product Search</h2>{% endblock %}
-{% block header_actions %}
-{% include 'templates/includes/product_search_box.html' %}
-{% endblock %}
-
{% block page_content %}
<script>{% include "templates/includes/product_list.js" %}</script>
<script>
frappe.ready(function() {
- var txt = get_url_arg("q");
+ var txt = get_url_arg("search");
$(".search-results").html("Search results for: " + txt);
window.search = txt;
window.start = 0;
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 8124215..c0c39cf 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -9,6 +9,9 @@
no_cache = 1
no_sitemap = 1
+def get_context(context):
+ context.show_search = True
+
@frappe.whitelist(allow_guest=True)
def get_product_list(search=None, start=0, limit=12):
# limit = 12 because we show 12 items in the grid view