[FIX] website_sale: pager in product list
Keep the reference to category and search view in pager. Update the search template to include form and keep correct reference to the category (as a slug and not a parameter). Fixes #688
This commit is contained in:
parent
7dbb16a856
commit
231a478ca9
|
@ -149,8 +149,13 @@ class website_sale(http.Controller):
|
|||
context['pricelist'] = int(self.get_pricelist())
|
||||
product_obj = pool.get('product.template')
|
||||
|
||||
url = "/shop"
|
||||
product_count = product_obj.search_count(cr, uid, domain, context=context)
|
||||
pager = request.website.pager(url="/shop", total=product_count, page=page, step=PPG, scope=7, url_args=post)
|
||||
if search:
|
||||
post["search"] = search
|
||||
if category:
|
||||
url = "/shop/category/%s" % slug(category)
|
||||
pager = request.website.pager(url=url, total=product_count, page=page, step=PPG, scope=7, url_args=post)
|
||||
product_ids = product_obj.search(cr, uid, domain, limit=PPG+10, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context)
|
||||
products = product_obj.browse(cr, uid, product_ids, context=context)
|
||||
|
||||
|
|
|
@ -29,18 +29,21 @@
|
|||
</xpath>
|
||||
</template>
|
||||
<template id="search" name="Search hidden fields">
|
||||
<t t-if="attrib_values">
|
||||
<t t-foreach="attrib_values" t-as="a">
|
||||
<input type="hidden" name="attrib" t-att-value="'%s,%s' % (a[0], a[1])"/>
|
||||
<form t-att-action="keep('/shop'+ ('/category/'+slug(category)) if category else '', search=0)" method="get" t-att-class="search_class">
|
||||
|
||||
<t t-if="attrib_values">
|
||||
<t t-foreach="attrib_values" t-as="a">
|
||||
<input type="hidden" name="attrib" t-att-value="'%s,%s' % (a[0], a[1])"/>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
<input t-if="category" type="hidden" name="category" t-att-value="int(category or 0)"/>
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search"/>
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default a-submit"><i class="fa fa-search"/></a>
|
||||
</span>
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search..." t-att-value="search"/>
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default a-submit"><i class="fa fa-search"/></a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<template id="404">
|
||||
|
@ -125,9 +128,7 @@
|
|||
<div class="container oe_website_sale">
|
||||
<div class="products_pager">
|
||||
<div class="row">
|
||||
<form t-att-action="keep('/shop',search=0)" method="get" class="pagination form-inline col-md-3">
|
||||
<t t-call="website_sale.search"/>
|
||||
</form>
|
||||
<t t-call="website_sale.search"><t t-set="search_class">pagination form-inline col-md-3</t></t>
|
||||
<t t-call="website.pager"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -353,9 +354,7 @@
|
|||
</ol>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<form t-att-action="keep(search=0)" method="get" class="pull-right">
|
||||
<t t-call="website_sale.search"/>
|
||||
</form>
|
||||
<t t-call="website_sale.search"><t t-set="search_class">pull-right</t></t>
|
||||
</div>
|
||||
<div class="col-sm-4" groups="base.group_sale_manager">
|
||||
<t t-call="website.publish_management">
|
||||
|
|
Loading…
Reference in New Issue