From 231a478ca975eea50b7f72e5ca775b0a2eb8227b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 25 Aug 2014 16:19:29 +0200 Subject: [PATCH] [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 --- addons/website_sale/controllers/main.py | 7 +++++- addons/website_sale/views/templates.xml | 31 ++++++++++++------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 79b04fa5ee6..0de92eb5d44 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -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) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index f4becb6ce45..6fe87097afb 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -29,18 +29,21 @@