I need to send SMS (By using any SMS API) to customers when products are back in stock.
I have added my SMS API in Mage_ProductAlert_Model_Observer class under public_html/app/code/core/Mage/ProductAlert/Model/Observer.php file but its not sending SMS to customers. Why?
Also its only showing two customers details instead of all customers subscribed to product stock alert. Here is my code
public function process()
{
$email = Mage::getModel('productalert/email');
/* @var $email Mage_ProductAlert_Model_Email */
$this->_processPrice($email);
$this->_processStock($email);
$this->_sendErrorEmail();
return $this;
$customer_stock_alerts = Mage::getModel('productalert/stock')->getCollection()->addStatusFilter(0)->setCustomerOrder();
foreach ($customer_stock_alerts as $alert){
$stock_back_product = $alert->getProductId();
$current_product=Mage::getModel('catalog/product')->load($stock_back_product);
$current_product_name = $current_product->getName();
$customer_info = Mage::getModel('customer/customer')->load($alert->getCustomerId());
$customer_name = $customer_info->getPrimaryBillingAddress()->getFirstname();
$customer_mobile = $customer_info->getPrimaryBillingAddress()->getTelephone();
$message = 0;
$message = "Dear $customer_name, Product $current_product_name is back in Stock";
$message=urlencode($message);
$sendsms = "http://api.msg91.com/api/sendhttp.php?sender=MSGIND&route=4&mobiles=$customer_mobile&authkey=xxxxxxxxxxxxxxxxxxx&country=91&message=$message";
file_get_contents($sendsms);
}
}
Can anyone share what's the issue this & why SMS is not sending?
Thanks.