[fix] product search
This commit is contained in:
parent
20bedc004e
commit
a2c4dad90e
@ -57,6 +57,8 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
|
||||
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
|
||||
|
@ -222,6 +222,7 @@ class Item(WebsiteGenerator):
|
||||
|
||||
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)
|
||||
|
@ -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>
|
@ -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;
|
||||
|
@ -9,6 +9,9 @@ from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_htm
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user