Jump to content

Sort by product sales not working anymore in 1.7.6.9


RabbitZzZ
 Share

Recommended Posts

Posted (edited)

Hello,

I recently upgraded from 1.7.6.2. to 1.7.6.9.
Earlier it worked to add 

?order=product.sales.desc

to any category url to see the products sorted by the sales. Now it doesn't work anymore but only shows the message that there are no products in the category.
Does somebody know how to make it work again?

Thanks!

Edited by RabbitZzZ (see edit history)

Share this post


Link to post
Share on other sites

Hi,

have you cleared the cache?

Also if you activate the debug mode, then do you have any error on that category page with this filtering parameter?

Also in your category's "Sort by" do you have the option "Best sellers"? If not then you have to create an override for this to be available on the category pages.

Kind regards, Leo

Share this post


Link to post
Share on other sites

Cache was cleared multiple times.
Debug mode says 

[PrestaShopDatabaseException]
Unknown column 'p.sales' in 'field list'<br /><br /><pre>SELECT p.id_product FROM (SELECT p.id_product, p.id_manufacturer, SUM(sa.quantity) as quantity, p.condition, p.weight, p.price, p.sales FROM ps_product p LEFT JOIN ps_product_attribute pa ON (p.id_product = pa.id_product) LEFT JOIN ps_product_attribute_combination pac ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN ps_stock_available sa ON (p.id_product = sa.id_product AND IFNULL(pac.id_product_attribute, 0) = sa.id_product_attribute AND sa.id_shop = 1 AND sa.id_shop_group = 0 ) INNER JOIN ps_category_product cp ON (p.id_product = cp.id_product) INNER JOIN ps_category c ON (cp.id_category = c.id_category AND c.active=1) INNER JOIN ps_product_shop ps ON (p.id_product = ps.id_product AND ps.id_shop = 1 AND ps.active = TRUE) WHERE p.visibility IN ('both', 'catalog') AND c.nleft>=3 AND c.nright<=4 AND ps.id_shop='1' GROUP BY p.id_product) p GROUP BY p.id_product ORDER BY p.sales DESC LIMIT 0, 24</pre>
at line 769 in file classes/db/Db.php

 

So it looks like it tries to get the sales from the wrong database table, saying from ps_product instead of ps_product_sale.

I don't have best sellers in the sort by dropdown menu, but I didn't need it there before the update when it worked.

Share this post


Link to post
Share on other sites

Hi,

well, this means that this sales value is not being defined in this version of Prestashop for the category listing, so for this ordering type I think you need to create an override for the order by "Best sellers" to appear in the category page's "Sort by:" section.

Kind regards, Leo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More