Some friends don’t know how to creat cron script in magento.Creating Magento cron script is very simple thing. First of all we have to create the module, (I hope that you know how to create magento module) and add in config.xml file next code:
0 1 * * * birthday/observer::sendBirthayEmail
Next step, we have to create model file observer.php (in folder model) with method sendBirthayEmail
class Inchoo_Birthday_Model_Observer
{
public function sendBirthayEmail()
{
//this collection get all users which have birthday on today
$customer = Mage::getModel("customer/customer")->getCollection();
$customer->addFieldToFilter('dob', array('like' => '%'.date("m").'-'.date("d").' 00:00:00'));
$customer->addNameToSelect();
$items = $customer->getItems();
foreach($items as $item)
{
// send email or do something
}
return $this;
}
}
From See World, post How To Creat cron script in Magento
Related Posts
- Magento 1.3: PHP Developer’s Guide
- Using jQuery in Magento
- How to create an international shipping table in magento
- How To Edit Footer In Magento stock
- “Invalid Username or Password.”Locked Out from Magento admin
- How To Solve 500 Internal Server Error When Install Magento
- Great Features of the New Magento Enterprise Release 1.10
- Magento – Get the Total Price of items currently in the Cart
- Magento FirePHP extension
- Magento error:Method Varien_Object::__tostring() cannot take arguments