Itinerant Posted January 16, 2014 Share Posted January 16, 2014 Hi! My prestashop version is 1.5.3.1I am implementing a php script that sends sms to employees when a new order is formed. I introduced two more fields for employee in the DB, put some code in Employee.php and AdminEmployeeController.php to make it work. Then i have "SmsTransport.php" class that does all the work. I need to get some info - order № and final cost and send it to all employees who has phone number saved. Here's the bunch of code for that: include_once(dirname(__FILE__).'/SmsTransport.php'); ... if ($id_order_state != Configuration::get('PS_OS_ERROR') AND $id_order_state != Configuration::get('PS_OS_CANCELED') AND $customer->id) { $employees = Employee::getEmployees(); $phones = array(); foreach ($employees AS $employee) { if ($employee["send_sms"] && $employee["phone"]) { $phones[] = $employee["phone"]; } } if (!empty($phones)) { $sms_transport = new SmsTransport(); $paid = Tools::displayPrice($order->total_paid, $currency, false); $params = array("text" => "New order N".(int)$order->id." Sum: ".$paid); $sms_transport->send($params, $phones); } } According to the tutorial i found, this code should be placed in "validateOrder" function PaymentModule.php.But it doesn't work there. Moreover, it seems to me that this function is not even called when the order is being formed. What am i doing wrong? If it's a wrong function, where should i place the code? Link to comment Share on other sites More sharing options...
Recommended Posts