Jasen Posted April 20, 2013 Share Posted April 20, 2013 So I'm using the default best sales/top sellers module in prestashop but when you click on the module to go to the grid list of products, it seems to sort them backwards; putting the best sellers at the last page. How can I fix/reverse this? Link to comment Share on other sites More sharing options...
NemoPS Posted April 20, 2013 Share Posted April 20, 2013 Hi, Can you maybe see if the sorting option (under pagination) is set to something in particular? it can be a cookie problem Link to comment Share on other sites More sharing options...
vekia Posted April 21, 2013 Share Posted April 21, 2013 Jasen let us know what's going on now with your issue, You created an interesting topic, I would like to know if everything is working well for you now Link to comment Share on other sites More sharing options...
NemoPS Posted April 22, 2013 Share Posted April 22, 2013 By the way, with pagination I mean the bar when you can chage how products are sorted, it should be above the product list Link to comment Share on other sites More sharing options...
Jasen Posted April 29, 2013 Author Share Posted April 29, 2013 Sorry about late reply. Also for pagination there is nothing about top sellers and nothing's chosen. Link to comment Share on other sites More sharing options...
NemoPS Posted April 29, 2013 Share Posted April 29, 2013 Nothing about top sellers? You mean there is no sorting/pagination bar in that page? Link to comment Share on other sites More sharing options...
Jasen Posted April 30, 2013 Author Share Posted April 30, 2013 There is sorting but there is no option to sort by best sellers, etc. and no specific sorting is selected by default. Link to comment Share on other sites More sharing options...
Jasen Posted May 6, 2013 Author Share Posted May 6, 2013 Anyone? Link to comment Share on other sites More sharing options...
Velocity Posted May 18, 2013 Share Posted May 18, 2013 (edited) I had this issue recently too. I solved it modifying function getBestSales() in classes/ProductSale.php: ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).' by ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` DESC Edited May 18, 2013 by Velocity (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 18, 2013 Share Posted May 18, 2013 I had this issue recently too. I solved it modifying classes/ProductSale.php: ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).' by ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` DESC thanks for the solution im going to check it :-) @Jasen can you check this solution, please? Link to comment Share on other sites More sharing options...
PEPPE83 Posted June 21, 2013 Share Posted June 21, 2013 The solution from velocity work in my case! (PS 1.4.8.2) Link to comment Share on other sites More sharing options...
Jasen Posted June 29, 2013 Author Share Posted June 29, 2013 So sorry about late reply, but yes I confirm that the fix is working. Link to comment Share on other sites More sharing options...
ajensen27 Posted October 9, 2013 Share Posted October 9, 2013 Anyone have the fix for 1.5? Can't find ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).' in my file so I'm assuming this isn't for 1.5 Link to comment Share on other sites More sharing options...
vekia Posted October 9, 2013 Share Posted October 9, 2013 Anyone have the fix for 1.5? Can't find ORDER BY '.(isset($orderByPrefix) ? $orderByPrefix.'.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).' in my file so I'm assuming this isn't for 1.5 there is code: ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' Link to comment Share on other sites More sharing options...
dkjo Posted October 9, 2013 Share Posted October 9, 2013 there is code: ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' and for 1.5.4.1? in classes\ProductSale.php in getBestSales function I have: ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).' in the same function at the beggining I have: if (is_null($order_way) || $order_by == 'sales') $order_way == 'DESC'; and in function getBestSalesLight I have: ORDER BY sales DESC and on best-sales page tha last item is the most often bought one? Link to comment Share on other sites More sharing options...
kancanli Posted October 9, 2013 Share Posted October 9, 2013 and for 1.5.4.1? in classes\ProductSale.php in getBestSales function I have: ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).' in the same function at the beggining I have: if (is_null($order_way) || $order_by == 'sales') $order_way == 'DESC'; and in function getBestSalesLight I have: ORDER BY sales DESC and on best-sales page tha last item is the most often bought one? hi, i fixed problem. incorrect line: if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; actually line: if (is_null($order_way) || $order_by == 'sales') $order_way =='DESC'; = There are two units need to have this character, but the first one. Link to comment Share on other sites More sharing options...
dkjo Posted October 9, 2013 Share Posted October 9, 2013 Hi kancanli, thx for a quick reply. But as I quoted above, I have "==" in my file. I don't have line with: $order_way = 'DESC'; which you marked as incorrect, so I completely can't understand your solution. :| Link to comment Share on other sites More sharing options...
Guest Posted November 4, 2013 Share Posted November 4, 2013 Hi. It's line 73 in that file where I have if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; If you find it, just change to =='DESC'; Link to comment Share on other sites More sharing options...
vekia Posted November 4, 2013 Share Posted November 4, 2013 $order_way == 'DESC'; ? == in variable definition doesn't work. Link to comment Share on other sites More sharing options...
payamtooba Posted December 6, 2013 Share Posted December 6, 2013 Is there a way to ignore some products to appear in the best sales ? for example i wanna ignore products with price of 0 in my store Link to comment Share on other sites More sharing options...
vekia Posted December 6, 2013 Share Posted December 6, 2013 in template file (product-list.tpl) you can use two if conditions: {if $controller=="best-sales"} {if $product.price != 0} CODE TO DISPLAY PRODUCT HERE {/if} {else} CODE TO DISPLAY PRODUCT HERE {/if} this is the simplest way, better one is a modification of controller, but it's not as easy as code above. Link to comment Share on other sites More sharing options...
payamtooba Posted December 7, 2013 Share Posted December 7, 2013 tanks for your reply ,but I dont know what line of "product-list.tpl" can i put this code and what should replace instead of "CODE TO DISPLAY PRODUCT HERE" Link to comment Share on other sites More sharing options...
payamtooba Posted December 19, 2013 Share Posted December 19, 2013 (edited) Finally I resolved my problem in this way: in the file 'classes\ProductSale.php' in function 'getBestSalesLight' after 'WHERE product_shop.`active` = 1' put the line 'AND p.`price` > 0' maybe it isnt very good idea to change the main file and would have problem for updating to another versions by the way thanks for your notice and dont hesitate to give ur opinion to my store Edited December 19, 2013 by payamtooba (see edit history) Link to comment Share on other sites More sharing options...
ps3z Posted November 25, 2015 Share Posted November 25, 2015 how do i sort the best sales in monthly for prestashop 1.6.1.0? Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now