magento – create custom cron job in magento

create magento cron job : How to create custom cron job in magento

In this post we will show you how to create magento cron job. here in give code we will create cron job at given your time and execute it.

default Magento have a cron.php file located at your root directory. for execute cron in magento first we have to create your own module, and in the config.xml we have to declare the method which will fired and the time. Below is a dump of a etc/config.xml file of a custom cron module ::

<?xml version="1.0"?>
				<cron_expr>08 00 * * *</cron_expr>

As per mentioned in this xml your cron will be execute or run every day @ night 00:08 min ::

Now we have to write over own functionality(code) in your Model module file, Here over model file name is Expired and the function which will trigger is productExpireds().

    // add your create magento cron job code hear
	class Onlinecode_Cronset_Model_Expired extends Mage_Core_Model_Abstract
		public function productExpireds()

Now we need login to server to call the magento root cron.php and need set to be fired in every minute.

You also like ::magento product from category id

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  55  =  60

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US