Locus2010 Posted September 7, 2010 Share Posted September 7, 2010 I used the prestatshop for more than one year.but what the problem i found is that the best seller model can not work well.all of our customers make the order online,but always can not show the best seller products automatically.what happened to this model,is there anybody know how to solve it,tks a lot for your attention and solution suggestion from everyone.tks &best;regards ! Link to comment Share on other sites More sharing options...
Zenith Posted September 7, 2010 Share Posted September 7, 2010 I also found this modules quantities wasn't being updated when products were sold so I did a small script that I run at the end of every day. Can set up a cron job to do this on a daily basis. This updates the quantities for the table that the best sellers module uses.Use the following code, save it as a php file, name is something like sync_sales.php and stick it on your server, and call it from a browser when you need to (will show a blank/white page) <?php include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); return Db::getInstance()->Execute(' REPLACE INTO '._DB_PREFIX_.'product_sale (`id_product`, `quantity`, `sale_nbr`, `date_upd`) SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW() FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id'); ?> In my opinion the best sales should be those products that have sold the most quantities, but Prestahop does not figure it that way, it counts how many times the product was sold on a per order basis, so you need to alter the code in "classes/ProductSale.php" to change this.find ps.`quantity` AS sales replace with ps.`sale_nbr` AS sales This code occurs twice in that file, once for the block and the other for the best-sales page.Hope this helps. Link to comment Share on other sites More sharing options...
Locus2010 Posted September 7, 2010 Author Share Posted September 7, 2010 hi,tks a lot for your soon reply and suggestion,will try it.hope it is ok,tks a lot again! Link to comment Share on other sites More sharing options...
Locus2010 Posted September 7, 2010 Author Share Posted September 7, 2010 have tried,but it seems not working well too.so here to look forward if the prestashop team can find the perfect solution or develope another new such bestseller moudle for usage.tks a lot ! Link to comment Share on other sites More sharing options...
Zenith Posted September 7, 2010 Share Posted September 7, 2010 It works fine, it displays the best sellers in order of how many have sold, these can be compared to the Best Products Stats block in the BO to match the figures. What else do you want?Are you using the latest version? Link to comment Share on other sites More sharing options...
Locus2010 Posted September 7, 2010 Author Share Posted September 7, 2010 nope,not the lastest version.it is the previous version prestashop Link to comment Share on other sites More sharing options...
Zenith Posted September 7, 2010 Share Posted September 7, 2010 Maybe you should think about updating then, as best sellers works in the latest version perfectly with my changes. Link to comment Share on other sites More sharing options...
Locus2010 Posted September 7, 2010 Author Share Posted September 7, 2010 ok,friend.tks a lot for ur suggestion and favor for that ,will have a try.and if any more questions,will come back and consult you for that,tks a lot! Link to comment Share on other sites More sharing options...
Patric Posted September 7, 2010 Share Posted September 7, 2010 If you think that is a bug, could you please post it into the Bug Tracker. 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