Posted: December 16, 2011 in Web
The problem
After much research, I can only assume this special price issue not working properly is a bug in Magento. The only accepted solution was to visit the admin page System > Configuration and Reindex the Data for Product Prices. Fine, but I can’t tell my client to log into his admin every morning and clear his indices.
Create cron jobs
Instead, I created some cron jobs to clear the indices and cache storage every night at midnight.
Reindex all Magento indices
Create one cron using the following command:
php /home/path/to/magento/shell/indexer.php reindexall
Clear all cache
To clear all Magento cache, we will need to create a script file that deletes everything in /var/cache/.
- Create a file called clearcache.sh in the directory one level above public_html (so it’s not publicly accessible)
- Put the following lines into that file:
#!/bin/bash rm -rf /home/path/to/magento/public_html/var/cache/* - Edit the path to your Magento installation and /var/cache/ directory as necessary.
- Create the cron job using the following command:
bash -s < /home/path/to/clearcache.sh
4 Responses to Magento special price still showing after expiration
mantel
Comment left on April 22nd, 2012 at 5:30 am
i have a website in magento and when the sales end the sale price still appears in the home page but not in the article itself could you help me
Günther Bosch
Comment left on December 3rd, 2012 at 5:25 am
Hi,
question: How does that …
bash -s < /home/path/to/clearcache.sh
… create a cron job?
Don't you mean crontab -s?
Regards
Jason Cross
Comment left on December 4th, 2012 at 12:37 pm
@Günther – I should have elaborated on this article. My terminology refers to how this was done within cPanel. There is a very nice “cron job builder” interface that let’s you call a file to run as often as you like.
Cesar
Comment left on March 1st, 2013 at 2:51 am
Thanks!! Concrete and solved.