Is it possible to refresh the Lifetime or Daily Statistics with a cron ? And if it is possible how ?
Because not everyone haves the same permissions in magento here.
Thanks in advance
Is it possible to refresh the Lifetime or Daily Statistics with a cron ? And if it is possible how ?
Because not everyone haves the same permissions in magento here.
Thanks in advance
You can also run this with cron and a php file in the root. You can run a shell script off cron that refreshes the statistics.
Are there any disadvantages to this manner? As this is much easier than creating a module and seems as simple as possible.
One issue you may run into is permission for the file, be sure to chmod +x the file.
Oh, few other important things. http://pravams.com/2011/08/09/magento-refresh-statistics-automatically/ will give you an excellent class extension of Mage_Shell_Abstract to use.
In that file be sure to check your abstact.php inclue path, it may need to be shell/, and then the usage of the shell script is at the bottom of the file- be sure your filename itself matches that value. Obviously it won't work if that is not correct.
One more thing. If the file can't be ran from the browser, but if you don't want anyone to see it anyways... you just add an deny in the htaccss, assuming apache of course.
<Files refresh_statistics.php>
order allow,deny
deny from all
</Files>
Marco,
You'll want to create your own module. Within that, you can give your module a cron schedule that you'd like it to run on. You'd want to create your own model with a method in it that would essentially emulate the refreshLifetimeAction() method in the following controller:
/app/code/core/Mage/Adminhtml/controllers/Report/StatisticsController.php
You'll see that they are looping through each different collection (which you can see and check when you are in the admin Refresh Statistics area. You'll need to figure out how to loop through whichever collections you want to refresh.
Obviously, you'll not want to include all the controller specific stuff with the redirects and such.
Hope that helps!