[FIX] eCommerve search + categories & filters
Hopefully this completely solves it. More testing required... bzr revid: ddm@openerp.com-20131106175743-xxxswsc0vs5fh3x5
This commit is contained in:
@@ -264,7 +264,7 @@ class Ecommerce(http.Controller):
|
||||
post.pop(key)
|
||||
|
||||
return request.redirect("/shop/?filter=%s%s%s%s" % (
|
||||
simplejson.dumps(filter).replace(" ", ""),
|
||||
simplejson.dumps(filter),
|
||||
add_filter and "&add_filter=%s" % add_filter or "",
|
||||
post.get("search") and "&search=%s" % post.get("search") or "",
|
||||
post.get("category") and "&category=%s" % post.get("category") or ""
|
||||
@@ -331,7 +331,11 @@ class Ecommerce(http.Controller):
|
||||
'Ecommerce': self,
|
||||
'product_ids': product_ids,
|
||||
'product_ids_for_holes': fill_hole,
|
||||
'search': post or dict(),
|
||||
'search': {
|
||||
'search': post.get('search') or '',
|
||||
'category': category,
|
||||
'filter': filter or '',
|
||||
},
|
||||
'pager': pager,
|
||||
'styles': styles,
|
||||
'style_in_product': lambda style, product: style.id in [s.id for s in product.website_style_ids],
|
||||
@@ -364,7 +368,11 @@ class Ecommerce(http.Controller):
|
||||
'category_list': category_list,
|
||||
'main_object': product,
|
||||
'product': product,
|
||||
'search': post or dict(),
|
||||
'search': {
|
||||
'search': post.get('search') or '',
|
||||
'category': post.get('category') or '',
|
||||
'filter': post.get('filter') or '',
|
||||
}
|
||||
}
|
||||
return request.website.render("website_sale.product", values)
|
||||
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
|
||||
<!-- Product list -->
|
||||
|
||||
<template id="search_hidden_fields" name="Search hidden fields">
|
||||
<t t-if="search">
|
||||
<input type="hidden" name="category" t-att-value="search.get('category') or ''"/>
|
||||
<input type="hidden" name="filter" t-att-value="search.get('filter') or ''"/>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="products_cart" name="Shopping cart">
|
||||
<div class="ribbon-wrapper">
|
||||
<div class="ribbon">Promo</div>
|
||||
@@ -89,9 +96,8 @@
|
||||
<t t-set="classname">pull-right</t>
|
||||
</t>
|
||||
<form t-action="/shop/" method="get" class="pull-right pagination form-inline" style="padding-right: 5px;" t-keep-query="category,search,facettes">
|
||||
<div class="form-group">
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search.get('search') or ''"/>
|
||||
</div>
|
||||
<t t-call="website_sale.search_hidden_fields" />
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search.get('search') or ''"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -251,17 +257,10 @@
|
||||
</li>
|
||||
</t>
|
||||
</div><div class="col-sm-3 col-sm-offset-1">
|
||||
<form t-action="/shop/" method="get" class="pull-right" t-keep-query="category,facettes">
|
||||
<div class="input-group">
|
||||
<t t-if="search">
|
||||
<t t-foreach="search.items()" t-as="key">
|
||||
<input t-att-name="key[0]" t-att-value="key[1]"/>
|
||||
</t>
|
||||
</t>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-search"/></span>
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search or ''"/>
|
||||
</div>
|
||||
</form>
|
||||
<form t-action="/shop/" method="get" class="pull-right" t-keep-query="category,facettes">
|
||||
<t t-call="website_sale.search_hidden_fields" />
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search.get('search') or ''"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user