Opencart send fax on order
In some cases, it’s useful to fax your orders to the store as soon as an order is placed. Now many people will think this is very hard, but in fact, it’s very easy to accomplish this. Thank god for API’s!
Browse your Opencart folder and go to /catalog/model/checkout/order.php, line 370 (after the following code), and add your fax code. If you put the code here, you can reuse the default HTML mail Opencart will send to your client (which includes all the order info).
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) { $html = $template->fetch($this->config->get('config_template') . '/template/mail/order.tpl'); } else { $html = $template->fetch('default/template/mail/order.tpl'); } |
I’d like to use Interfax since they provide a very easy PHP API. Only 1 requirement, you’ll need SOAP. Now add this code:
/* START: SEND FAX */ /**************** Settings begin **************/ $username = ''; // Enter your Interfax username here $password = ''; // Enter your Interfax password here $faxnumber = ''; // Enter your designated fax number here in the format +[country code][area code][fax number], for example: +12125554874 $texttofax = $html; // Enter your fax contents here $filetype = 'HTML'; // If $texttofax is regular text, enter TXT here. If $texttofax is HTML enter HTML here /**************** Settings end ****************/ $client = new SoapClient("http://ws.interfax.net/dfs.asmx?wsdl"); $params->Username = $username; $params->Password = $password; $params->FaxNumber = $faxnumber; $params->Data = $texttofax; $params->FileType = $filetype; $faxResult = $client->SendCharFax($params); /* END: SEND FAX */ |
Et voila. The email sent to your client for notification will also automaticly be faxed to the given fax number.