Skip to content

Commit

Permalink
[FIX] website_sale: allow to override product order on shop
Browse files Browse the repository at this point in the history
  • Loading branch information
JKE-be authored and OCA-git-bot committed May 28, 2016
1 parent c249296 commit 8f43bd1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addons/website_sale/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def get_attribute_value_ids(self, product):

return attribute_value_ids

def _get_search_order(self, post):
# OrderBy will be parsed in orm and so no direct sql injection
return 'website_published desc,%s' % post.get('order', 'website_sequence desc')

def _get_search_domain(self, search, category, attrib_values):
domain = request.website.sale_product_domain()

Expand Down Expand Up @@ -207,7 +211,7 @@ def shop(self, page=0, category=None, search='', **post):
if attrib_list:
post['attrib'] = attrib_list
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, offset=pager['offset'], context=context)
product_ids = product_obj.search(cr, uid, domain, limit=PPG, offset=pager['offset'], order=self._get_search_order(post), context=context)
products = product_obj.browse(cr, uid, product_ids, context=context)

style_obj = pool['product.style']
Expand Down

0 comments on commit 8f43bd1

Please sign in to comment.