Gotabor Posted October 26, 2018 Posted October 26, 2018 Hello, While I did this little improvments on the stores today, I thought this one might be useful to some of you. My aim was to quickly delete the 0€ carts that are taking dust on the database. Those are generated when a customer click on the cart button but don't have any product in it. Instead on relying on a module I just did the following changes on our 1.6 (same as TB) : Go to controllers/admin/AdminCartsController.php and edit the following lines : ``` Before : 'total' => array( 'title' => $this->l('Total'), 'callback' => 'getOrderTotalUsingTaxCalculationMethod', 'orderby' => false, 'search' => false, 'align' => 'text-right', 'badge_success' => true ), After : 'total' => array( 'title' => $this->l('Total'), 'callback' => 'getOrderTotalUsingTaxCalculationMethod', 'orderby' => true, //set true instead of false 'search' => true,//set true instead of false 'align' => 'text-right', 'badge_success' => true ), ``` Now, you'll be able to sort your cart by amount. You just need to do a little select all and hit delete to see all those useless carts disappear ;) I know it's bad to edit controller files directly since this should be done with override. But anyway, what do you think about bringing this change on the next core version of TB ? Unless there is something I'm unaware of, this should make merchants life easier and would help people with cleaning those useless carts.
dosbiner Posted October 26, 2018 Posted October 26, 2018 I think its very little saving. I have 16K++ records and it just have 5.6Mb in tbcart and 2.5Mb in tbcart_product. so I think it will be fine if we don't delete useless cart :)
Traumflug Posted October 27, 2018 Posted October 27, 2018 Me has seen a shop installation with 1.5 million carts (they collect over the years), which certainly doesn't exactly improve performance.
Briljander Posted October 27, 2018 Posted October 27, 2018 The best improvement would be to automate this. Make it possible to delete carts of certain criterias with cron job. Set it and forget it ?
Traumflug Posted October 27, 2018 Posted October 27, 2018 Maybe even hardcoding such a criterion. Like removing empty carts after the time which is also used for cookie timeout. I can hardly see any use for empty carts, but maybe I'm missing something.
Beeta Posted October 29, 2018 Posted October 29, 2018 @traumflug said in Sort Cart controller by total amount: Maybe even hardcoding such a criterion. Like removing empty carts after the time which is also used for cookie timeout. I can hardly see any use for empty carts, but maybe I'm missing something. I vote to adding it to the core
dosbiner Posted October 29, 2018 Posted October 29, 2018 I use tidy module + cron to auto delete this zero carts (abandoned cart) from @Daresh https://codecanyon.net/item/prestashop-tidy/18965736
Traumflug Posted October 29, 2018 Posted October 29, 2018 See https://github.com/thirtybees/thirtybees/issues/642 and https://github.com/thirtybees/thirtybees/issues/643
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