18 April 2012

Magento cron jobs not running

Sometimes you can find the cron jobs for your Magento store just aren't running, or are running intermittently even though everything has been setup correctly and there is apparently no reason for it.

Surprisingly you might find the problem is actually down to a simple caching issue with a one line code fix.  Magento caches it's cron schedule and reads this cached content on subsequent runs of cron rather than recreating the schedule each time to determine which jobs it should execute.  The problem is sometimes jobs just don't get cached despite them being configured correctly so when the time comes for them to execute nothing actually happens.

It's worth noting that the cron schedule is cached even if all caching is disabled in admin, and the only way to clear the cached schedule through admin is to Flush Cache Storage under System->Cache Management.  Unfortunately this doesn't then cause the jobs to be correctly cached the next time cron is run.

So the fix is to simply disable the caching of the cron schedule, and don't worry, benchmarks with caching disabled shows this to have no negative impact on site performance.

Copy:
app/code/core/Mage/Cron/Model/Observer.php
to:
app/code/local/Mage/Cron/Model/Observer.php
if it's not already there. Open the copied file and find the following line inside the generate() method:
Mage::app()->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null);
This is the line that initiates caching of the cron schedule, so just comment it out:
//Mage::app()->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null);
Save the changes and Flush Cache Storage to clear any currently cached cron jobs and your store should now always execute properly configured cron jobs.

11 April 2012

On page editing CMS

You won't find many sites these days that don't come with a CMS of some description - everything from the 'build your own website' type of applications offered by many shared hosting providers to full blown content management systems offered by the likes of Wordpress, Drupal and Joomla.

Despite it being easy to get hold of a CMS to manage your site content if you are at all familiar with whats available out there, you have probably come to realise that there is some what of a 'holy grail' in the field that is just not seemingly realistic, or even possible to offer.  This is the ability to edit site content right there on the frontend page your customers see rather than through a backend panel as is the norm.

Well not only is it possible, but straightforward, user friendly and robust on page editing is exactly what Hussey Coding's CMS delivers.

Our CMS gives you a powerful yet intuitive editing experience, which allows you to edit page content on any of your frontend pages with a high level of control - you can even preview exactly what those edits will look like, in real time, as you make them.  You can be sure that what you see here, is exactly what your customer gets when you click save.

Here are just a few of the features our CMS offers:
  • On page editing with powerful and versatile rich text capabilities
  • Real time preview as you edit
  • Creation of an unlimited number of pages with templating
  • Linking of pages via frontend navigation
  • Summary blocks for collections of pages (i.e. summarising news stories)
  • Timestamped pages for dated content
  • Easy asset upload and management
  • Easy user creation and management
  • Easy inclusion of social media content
Sound like something you might be interested in?  Have a look at our demo site which lets you try out all of the functionality exactly as you can have it on your own site.