Version Notes
Synchronize your Magento contacts with SendinBlue platform, send your marketing and transactional emails and SMS
Download this release
Release Info
Developer | Sendinblue |
Extension | Sendinblue |
Version | 1.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.6
- app/code/community/Sendinblue/Sendinblue/Block/Sendinblue.php +120 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Helper/Data.php +0 -3
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Email.php +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Email/Template.php +6 -20
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Mysql4/Sendinblue.php +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Mysql4/Sendinblue/Collection.php +0 -0
- app/code/community/Sendinblue/Sendinblue/Model/Observer.php +251 -0
- app/code/community/Sendinblue/Sendinblue/Model/Psmailin.php +1188 -0
- app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php +1583 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php +0 -0
- app/code/community/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +593 -0
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php +1 -2
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php +1 -2
- app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php +766 -0
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/IndexController.php +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/etc/adminhtml.xml +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/etc/config.xml +321 -325
- app/code/{local/Sendinblue/Sendinblue/sql/sendinblue_setup/install-0.1.0.php → community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-install-0.1.0.php} +0 -0
- app/code/community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php +14 -0
- app/code/local/Sendinblue/Sendinblue/Block/Sendinblue.php +0 -90
- app/code/local/Sendinblue/Sendinblue/Model/Observer.php +0 -260
- app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php +0 -1072
- app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +0 -520
- app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php +0 -473
- app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php +0 -22
- app/design/adminhtml/default/default/layout/sendinblue.xml +4 -8
- app/design/adminhtml/default/default/template/sendinblue/myform.phtml +267 -99
- app/etc/modules/Sendinblue_Sendinblue.xml +2 -2
- app/locale/en_US/template/email/doubleoptin_temp.html +58 -0
- app/locale/en_US/template/email/sendin_notification.html +3 -3
- app/locale/en_US/template/email/sendinsmtp_conf.html +3 -3
- app/locale/fr_FR/Sendinblue.csv +25 -2
- app/locale/fr_FR/template/email/doubleoptin_temp.html +58 -0
- app/locale/fr_FR/template/email/sendin_notification.html +3 -3
- app/locale/fr_FR/template/email/sendinsmtp_conf.html +3 -3
- package.xml +16 -16
- skin/adminhtml/default/default/sendinblue/css/styles.css +24 -44
- skin/adminhtml/default/default/sendinblue/js/sendinblue.js +434 -375
- skin/adminhtml/default/default/sendinblue/js/sendinblue.min.js +1 -1
app/code/community/Sendinblue/Sendinblue/Block/Sendinblue.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
class Sendinblue_Sendinblue_Block_Sendinblue extends Mage_Core_Block_Template
|
12 |
+
{
|
13 |
+
public function _prepareLayout()
|
14 |
+
{
|
15 |
+
return parent::_prepareLayout();
|
16 |
+
}
|
17 |
+
public function getPagerHtml()
|
18 |
+
{
|
19 |
+
return $this->getChildHtml('pager');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _toHtml()
|
23 |
+
{
|
24 |
+
$sendinblueData = Mage::getModel('sendinblue/sendinblue');
|
25 |
+
$get_Enable_Status = $sendinblueData->getEnableStatus();
|
26 |
+
$get_Tracking_Status = $sendinblueData->getTrackingStatus();
|
27 |
+
$get_order_status = $sendinblueData->getOrderSmsStatus();
|
28 |
+
$get_User_lists = $sendinblueData->getUserlists();
|
29 |
+
$value = $sendinblueData->TrackingSmtp();
|
30 |
+
$attributesName = $sendinblueData->allAttributesName();
|
31 |
+
$resp = array();
|
32 |
+
|
33 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
34 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
35 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
36 |
+
$dataDisplay = $order->getBillingAddress()->getData();
|
37 |
+
$orderData = $order->getData();
|
38 |
+
$custData = $customer->getData();
|
39 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
40 |
+
|
41 |
+
if($get_Enable_Status && $get_order_status)
|
42 |
+
{
|
43 |
+
if (!empty($dataDisplay['telephone']) && !empty($dataDisplay['country_id']))
|
44 |
+
{
|
45 |
+
$country_code = $sendinblueData->getCountryCode($dataDisplay['country_id']);
|
46 |
+
$dataDisplay['telephone'] = $sendinblueData->checkMobileNumber($dataDisplay['telephone'],$country_code);
|
47 |
+
}
|
48 |
+
$ref_num = $orderData['increment_id'];
|
49 |
+
$orderprice = $orderData['grand_total'];
|
50 |
+
$currencycode = $orderData['base_currency_code'];
|
51 |
+
$orderdate = $orderData['created_at'];
|
52 |
+
if ($locale == 'fr_FR')
|
53 |
+
$ord_date = date('d/m/Y', strtotime($orderdate));
|
54 |
+
else
|
55 |
+
$ord_date = date('m/d/Y', strtotime($orderdate));
|
56 |
+
$total_pay = $orderprice.' '.$currencycode;
|
57 |
+
$msgbody = $sendinblueData->getSendSmsmOrderMessage();
|
58 |
+
$fname = str_replace('{first_name}', $dataDisplay['firstname'], $msgbody);
|
59 |
+
$lname = str_replace('{last_name}', $dataDisplay['lastname']."\r\n", $fname);
|
60 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
61 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
62 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
63 |
+
|
64 |
+
$arr = array();
|
65 |
+
$arr['to'] = $dataDisplay['telephone'];
|
66 |
+
$arr['from'] = $sendinblueData->getSendSmsOrderSubject();
|
67 |
+
$arr['text'] = $msgbody;
|
68 |
+
$responce = $sendinblueData->sendSmsApi($arr);
|
69 |
+
}
|
70 |
+
$allData = array_merge($dataDisplay, $custData);
|
71 |
+
$resp = $sendinblueData->merge_my_array($attributesName, $allData);
|
72 |
+
if (!empty($custData['firstname'])|| !empty($custData['firstname']))
|
73 |
+
$client = 1;
|
74 |
+
else
|
75 |
+
$client = 0;
|
76 |
+
$resp['CLIENT'] = $client;
|
77 |
+
$email = $custData['email']; // for email address
|
78 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
79 |
+
$nlStatus = $costomer_data->getStatus();
|
80 |
+
$user_lang =$custData['created_in'];
|
81 |
+
|
82 |
+
if ($nlStatus == 1)
|
83 |
+
$sendinblueData->emailAdd($email, $resp, $nlStatus);
|
84 |
+
|
85 |
+
if ($get_Enable_Status == 1 && $get_Tracking_Status == 1 && $nlStatus == 1)
|
86 |
+
{
|
87 |
+
$value_config = $sendinblueData->getApiConfigValue();
|
88 |
+
if ($value_config->date_format == 'dd-mm-yyyy')
|
89 |
+
$date = date('d-m-Y', strtotime($orderData['created_at']));
|
90 |
+
else
|
91 |
+
$date = date('m-d-Y', strtotime($orderData['created_at']));
|
92 |
+
|
93 |
+
$html = '';
|
94 |
+
$html .= '<script type="text/javascript">
|
95 |
+
/**Code for NB tracking*/
|
96 |
+
function loadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(script.readyState){script.onreadystatechange=function(){
|
97 |
+
if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback(url)}}}else{
|
98 |
+
script.onload=function(){callback(url)}}script.src=url;if(document.body){document.body.appendChild(script)}else{
|
99 |
+
document.head.appendChild(script)}}
|
100 |
+
var nbJsURL = (("https:" == document.location.protocol) ? "https://my-tracking-orders.googlecode.com/files" : "http://my-tracking-orders.googlecode.com/files");
|
101 |
+
var nbBaseURL = "http://tracking.mailin.fr/";
|
102 |
+
loadScript(nbJsURL+"/nbv2.js",
|
103 |
+
function(){
|
104 |
+
/*You can put your custom variables here as shown in example.*/
|
105 |
+
try {
|
106 |
+
var nbTracker = nb.getTracker(nbBaseURL , "'.$value->result->tracking_data->site_id.'");
|
107 |
+
var list = ["'.$get_User_lists.'"];
|
108 |
+
var attributes = ["EMAIL","PRENOM","NOM","ORDER_ID","ORDER_DATE","ORDER_PRICE"];
|
109 |
+
var values = ["'.$email.'","'.$custData['firstname'].'","'.$custData['lastname'].'","'.$ref_num.'","'.$date.'","'.$orderprice.'"];
|
110 |
+
nbTracker.setListData(list);
|
111 |
+
nbTracker.setTrackingData(attributes,values);
|
112 |
+
nbTracker.trackPageView();
|
113 |
+
} catch( err ) {}
|
114 |
+
});
|
115 |
+
|
116 |
+
</script>';
|
117 |
+
echo $html;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/Helper/Data.php
RENAMED
@@ -30,9 +30,6 @@ class Sendinblue_Sendinblue_Helper_Data extends Mage_Core_Helper_Abstract
|
|
30 |
$config['port'] = $port;
|
31 |
$config['ssl'] = null;
|
32 |
$config['auth'] = $auth;
|
33 |
-
//echo "<pre>";
|
34 |
-
//print_r($config);
|
35 |
-
//die;
|
36 |
$transport = new Zend_Mail_Transport_Smtp($host, $config);
|
37 |
}
|
38 |
else
|
30 |
$config['port'] = $port;
|
31 |
$config['ssl'] = null;
|
32 |
$config['auth'] = $auth;
|
|
|
|
|
|
|
33 |
$transport = new Zend_Mail_Transport_Smtp($host, $config);
|
34 |
}
|
35 |
else
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Email.php
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Email/Template.php
RENAMED
@@ -17,10 +17,8 @@ class Sendinblue_Sendinblue_Model_Email_Template extends Mage_Core_Model_Email_T
|
|
17 |
// If it's not enabled, just return the parent result.
|
18 |
if (Mage::helper('sendinblue')->isEnabled()==0 || Mage::helper('sendinblue')->ModuleisEnabled()==0) {
|
19 |
return parent::send($email, $name, $variables);
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
if(!$this->isValidForSend()) {
|
25 |
Mage::log('SMTP: Email not valid for sending - check template, and smtp enabled/disabled setting');
|
26 |
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
@@ -40,24 +38,17 @@ class Sendinblue_Sendinblue_Model_Email_Template extends Mage_Core_Model_Email_T
|
|
40 |
$variables['name'] = reset($names);
|
41 |
|
42 |
$mail = $this->getMail();
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
if (true) {
|
47 |
-
|
48 |
$email = Mage::getStoreConfig('contacts/email/recipient_email', $this->getDesignConfig()->getStore());
|
49 |
-
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
50 |
-
|
51 |
}
|
52 |
|
53 |
-
// In Magento core they set the Return-Path here, for the sendmail command.
|
54 |
-
|
55 |
|
56 |
foreach ($emails as $key => $email) {
|
57 |
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
58 |
}
|
59 |
-
|
60 |
-
|
61 |
$this->setUseAbsoluteLinks(true);
|
62 |
$text = $this->getProcessedTemplate($variables, true);
|
63 |
|
@@ -69,8 +60,6 @@ class Sendinblue_Sendinblue_Model_Email_Template extends Mage_Core_Model_Email_T
|
|
69 |
|
70 |
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
|
71 |
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
72 |
-
|
73 |
-
|
74 |
$transport = Mage::helper('sendinblue')->getTransport();
|
75 |
|
76 |
try {
|
@@ -88,8 +77,6 @@ class Sendinblue_Sendinblue_Model_Email_Template extends Mage_Core_Model_Email_T
|
|
88 |
$mail->send($transport); // Zend_Mail warning..
|
89 |
|
90 |
Mage::log('Finished sending email');
|
91 |
-
|
92 |
-
|
93 |
$this->_mail = null;
|
94 |
} catch (Exception $e) {
|
95 |
|
@@ -99,6 +86,5 @@ class Sendinblue_Sendinblue_Model_Email_Template extends Mage_Core_Model_Email_T
|
|
99 |
}
|
100 |
$responceArr = array('result'=>true);
|
101 |
return json_encode($responceArr);
|
102 |
-
|
103 |
}
|
104 |
}
|
17 |
// If it's not enabled, just return the parent result.
|
18 |
if (Mage::helper('sendinblue')->isEnabled()==0 || Mage::helper('sendinblue')->ModuleisEnabled()==0) {
|
19 |
return parent::send($email, $name, $variables);
|
20 |
+
}
|
21 |
+
|
|
|
|
|
22 |
if(!$this->isValidForSend()) {
|
23 |
Mage::log('SMTP: Email not valid for sending - check template, and smtp enabled/disabled setting');
|
24 |
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
38 |
$variables['name'] = reset($names);
|
39 |
|
40 |
$mail = $this->getMail();
|
41 |
+
|
42 |
+
if (true) {
|
|
|
|
|
|
|
43 |
$email = Mage::getStoreConfig('contacts/email/recipient_email', $this->getDesignConfig()->getStore());
|
44 |
+
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
|
|
45 |
}
|
46 |
|
47 |
+
// In Magento core they set the Return-Path here, for the sendmail command.
|
|
|
48 |
|
49 |
foreach ($emails as $key => $email) {
|
50 |
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
51 |
}
|
|
|
|
|
52 |
$this->setUseAbsoluteLinks(true);
|
53 |
$text = $this->getProcessedTemplate($variables, true);
|
54 |
|
60 |
|
61 |
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
|
62 |
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
|
|
|
|
63 |
$transport = Mage::helper('sendinblue')->getTransport();
|
64 |
|
65 |
try {
|
77 |
$mail->send($transport); // Zend_Mail warning..
|
78 |
|
79 |
Mage::log('Finished sending email');
|
|
|
|
|
80 |
$this->_mail = null;
|
81 |
} catch (Exception $e) {
|
82 |
|
86 |
}
|
87 |
$responceArr = array('result'=>true);
|
88 |
return json_encode($responceArr);
|
|
|
89 |
}
|
90 |
}
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Mysql4/Sendinblue.php
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Mysql4/Sendinblue/Collection.php
RENAMED
File without changes
|
app/code/community/Sendinblue/Sendinblue/Model/Observer.php
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
class Sendinblue_Sendinblue_Model_Observer
|
11 |
+
{
|
12 |
+
protected static $fields = array();
|
13 |
+
public function adminSubcriberDelete($observer)
|
14 |
+
{
|
15 |
+
$params = Mage::app()->getRequest()->getParams();
|
16 |
+
$params = empty($params)?array():$params;
|
17 |
+
if (isset($params['subscriber']) && count($params['subscriber'] > 0))
|
18 |
+
{
|
19 |
+
$customer_email = array();
|
20 |
+
$nbSubscriber = Mage::getModel('newsletter/subscriber');
|
21 |
+
foreach ($params['subscriber'] as $costomer_id)
|
22 |
+
{
|
23 |
+
$costomer_data = $nbSubscriber->load($costomer_id)->toArray();
|
24 |
+
$customer_email[] = empty($costomer_data['subscriber_email'])?array():$costomer_data['subscriber_email'];
|
25 |
+
}
|
26 |
+
$customer_emails = implode('|', $customer_email);
|
27 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
28 |
+
}
|
29 |
+
if ($responce->result)
|
30 |
+
Mage::getModel('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function adminCustomerDelete($observer)
|
35 |
+
{
|
36 |
+
$params = Mage::app()->getRequest()->getParams();
|
37 |
+
$params = empty($params)?array():$params;
|
38 |
+
if (isset($params['customer']) && count($params['customer'] > 0))
|
39 |
+
{
|
40 |
+
$customer_email = array();
|
41 |
+
$customerObj = Mage::getModel('customer/customer');
|
42 |
+
foreach ($params['customer'] as $costomer_id)
|
43 |
+
{
|
44 |
+
$costomer_data = $customerObj->load($costomer_id)->toArray();
|
45 |
+
$customer_email[] = empty($costomer_data['email'])?array():$costomer_data['email'];
|
46 |
+
}
|
47 |
+
$customer_emails = implode('|', $customer_email);
|
48 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
49 |
+
}
|
50 |
+
if ($responce->result)
|
51 |
+
Mage::getModel('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
public function adminCustomerSubscribe($observer)
|
55 |
+
{
|
56 |
+
$params = Mage::app()->getRequest()->getParams();
|
57 |
+
$params = empty($params)?array():$params;
|
58 |
+
if (isset($params['customer']) && count($params['customer'] > 0))
|
59 |
+
{
|
60 |
+
$customer_email = array();
|
61 |
+
$customerObj = Mage::getModel('customer/customer');
|
62 |
+
foreach ($params['customer'] as $costomer_id)
|
63 |
+
{
|
64 |
+
$costomer_data = $customerObj->load($costomer_id)->toArray();
|
65 |
+
$customer_email[] = empty($costomer_data['email'])?array():$costomer_data['email'];
|
66 |
+
}
|
67 |
+
$customer_emails = implode('|', $customer_email);
|
68 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->addEmailList($customer_emails);
|
69 |
+
}
|
70 |
+
if ($responce->result)
|
71 |
+
Mage::getModel('core/session')->addSuccess('Total of '.$responce->result->infoUpdatedCount.' record(s) were subscribed');
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
public function subscribeObserver($observer)
|
75 |
+
{
|
76 |
+
$extra = array();
|
77 |
+
$params = Mage::app()->getRequest()->getParams();
|
78 |
+
$params = empty($params)?array():$params;
|
79 |
+
$extra = Mage::getModel('newsletter/subscriber')->loadByEmail($params['email'])->getData();
|
80 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
81 |
+
$attributesName = $sendinModule->allAttributesName();
|
82 |
+
|
83 |
+
if ($params['email'] != '')
|
84 |
+
$newsletter_status = 0;
|
85 |
+
|
86 |
+
$client = 0;
|
87 |
+
$resp = $sendinModule->merge_my_array($attributesName, $extra);
|
88 |
+
$resp['CLIENT'] = $client;
|
89 |
+
$responce = $sendinModule->emailAdd($params['email'], $resp, $newsletter_status);
|
90 |
+
return $this;
|
91 |
+
}
|
92 |
+
public function updateNewObserver($observer)
|
93 |
+
{
|
94 |
+
$params = Mage::app()->getRequest()->getParams();
|
95 |
+
$params = empty($params)?array():$params;
|
96 |
+
$cus_session = Mage::getSingleton('customer/session')->getCustomer();
|
97 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
98 |
+
$attributesName = $sendinModule->allAttributesName();
|
99 |
+
|
100 |
+
$customerSessionEmail = $cus_session->getEmail();
|
101 |
+
if (empty($customerSessionEmail)) {
|
102 |
+
$customer = $observer->getCustomer();
|
103 |
+
$customerData = $customer->getData();
|
104 |
+
}
|
105 |
+
else
|
106 |
+
$customerData = $cus_session->getData();
|
107 |
+
|
108 |
+
$user_lang = isset($customerData['created_in'])? $customerData['created_in'] :'';
|
109 |
+
$email = $customerData['email'];
|
110 |
+
$cid = isset($customerData['entity_id'])?$customerData['entity_id']:'';
|
111 |
+
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('country_id')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',$cid);
|
112 |
+
|
113 |
+
$telephone = '';
|
114 |
+
$customer_addr = array();
|
115 |
+
$customer_addr_data = array();
|
116 |
+
foreach ($collectionAddress as $customerPhno) {
|
117 |
+
$customer_addr = $customerPhno->getData();
|
118 |
+
if (!empty($customer_addr['telephone']))
|
119 |
+
{
|
120 |
+
if(!empty($customer_addr['country_id']))
|
121 |
+
{
|
122 |
+
$country_code = $sendinModule->getCountryCode($customer_addr['country_id']);
|
123 |
+
$customer_addr['telephone'] = $sendinModule->checkMobileNumber($customer_addr['telephone'], $country_code);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$customer_addr_data = array_merge($customer_addr, $customerData);
|
128 |
+
if (!empty($customerData['firstname']) && !empty($customerData['lastname']))
|
129 |
+
$client = 1;
|
130 |
+
else
|
131 |
+
$client = 0;
|
132 |
+
|
133 |
+
$is_subscribed = !empty($customer_addr_data['is_subscribed'])?$customer_addr_data['is_subscribed']:$params['is_subscribed'];
|
134 |
+
|
135 |
+
if (!empty($customerData['firstname']) || !empty($customer_addr['telephone']) || !empty($email))
|
136 |
+
{
|
137 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
138 |
+
$nlStatus = $costomer_data->getStatus();
|
139 |
+
$resp = $sendinModule->merge_my_array($attributesName, $customer_addr_data);
|
140 |
+
$resp['CLIENT'] = $client;
|
141 |
+
if (isset($is_subscribed) && $is_subscribed == 1 && empty($nlStatus))
|
142 |
+
{
|
143 |
+
$responce = $sendinModule->emailAdd($email, $resp, $is_subscribed);
|
144 |
+
$sendinModule->sendWsTemplateMail($email);
|
145 |
+
}
|
146 |
+
elseif (!empty($nlStatus))
|
147 |
+
{
|
148 |
+
$responce = $sendinModule->emailAdd($email, $resp);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
if (isset($is_subscribed) && !empty($is_subscribed) && $is_subscribed === 0) {
|
153 |
+
|
154 |
+
$responce = $sendinModule->emailDelete($email);
|
155 |
+
}
|
156 |
+
|
157 |
+
return $this;
|
158 |
+
|
159 |
+
}
|
160 |
+
public function syncData()
|
161 |
+
{
|
162 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
163 |
+
return $this;
|
164 |
+
}
|
165 |
+
public function updateStatus($observer)
|
166 |
+
{
|
167 |
+
$order = $observer->getEvent()->getOrder();
|
168 |
+
|
169 |
+
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING)
|
170 |
+
{
|
171 |
+
$history = $order->getShipmentsCollection();
|
172 |
+
$history_array=$history->toarray();
|
173 |
+
if($history_array['totalRecords'] > 0)
|
174 |
+
{
|
175 |
+
$order_id = isset($history_array['items']['0']['order_id'])?$history_array['items']['0']['order_id']:'';
|
176 |
+
$shippingaddrid = isset($history_array['items']['0']['shipping_address_id'])?$history_array['items']['0']['shipping_address_id']:'';
|
177 |
+
$_order = Mage::getModel('sales/order')->load($order_id);
|
178 |
+
$_shippingAddress = $_order->getShippingAddress();
|
179 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
180 |
+
$mobile_sms = $_shippingAddress->getTelephone();
|
181 |
+
$mobile_sms = !empty($mobile_sms)?$mobile_sms:'';
|
182 |
+
$countryid = $_shippingAddress->getCountryId();
|
183 |
+
$countryid = !empty($countryid)?$countryid:'';
|
184 |
+
$codeResource = Mage::getSingleton('core/resource');
|
185 |
+
$tableCountry = $codeResource->getTableName('sendinblue_country_codes');
|
186 |
+
$sql = 'SELECT `country_prefix` FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'" ';
|
187 |
+
$connection = $codeResource->getConnection('core_read');
|
188 |
+
$data = $connection->fetchRow($sql);
|
189 |
+
$mobile = '';
|
190 |
+
$country_prefix = $data['country_prefix'];
|
191 |
+
$sendinblueModule = Mage::getModel('sendinblue/sendinblue');
|
192 |
+
if(isset($country_prefix) && !empty($country_prefix))
|
193 |
+
$mobile = $sendinblueModule->checkMobileNumber($mobile_sms,$country_prefix);
|
194 |
+
$firstname = $_shippingAddress->getFirstname();
|
195 |
+
$firstname = !empty($firstname )?$firstname :'';
|
196 |
+
$lastname = $_shippingAddress->getLastname();
|
197 |
+
$lastname = !empty($lastname)?$lastname:'';
|
198 |
+
$ref_num = $_order->getIncrementId();
|
199 |
+
$ref_num = !empty($ref_num)?$ref_num:'';
|
200 |
+
$orderprice = $_order->getGrandTotal();
|
201 |
+
$orderprice = !empty($orderprice)?$orderprice:'';
|
202 |
+
$courrencycode = $_order->getBaseCurrencyCode();
|
203 |
+
$courrencycode = !empty($courrencycode)?$courrencycode:'';
|
204 |
+
$orderdate = $_order->getCreatedAt();
|
205 |
+
$orderdate = !empty($orderdate)?$orderdate:'';
|
206 |
+
if ($locale == 'fr_FR')
|
207 |
+
$ord_date = date('d/m/Y', strtotime($orderdate));
|
208 |
+
else
|
209 |
+
$ord_date = date('m/d/Y', strtotime($orderdate));
|
210 |
+
|
211 |
+
$total_pay = $orderprice.' '.$courrencycode;
|
212 |
+
$msgbody = $sendinblueModule->getSendSmsShipingMessage();
|
213 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
214 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
215 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
216 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
217 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
218 |
+
|
219 |
+
$arr = array();
|
220 |
+
$arr['to'] = $mobile;
|
221 |
+
$arr['from'] = $sendinblueModule->getSendSmsShipingSubject();
|
222 |
+
$arr['text'] = $msgbody;
|
223 |
+
$sendinblueModule->sendSmsApi($arr);
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
public function subscribedToNewsletter($observer)
|
229 |
+
{
|
230 |
+
$data = $observer->subscriber;
|
231 |
+
$params = Mage::app()->getRequest()->getParams();
|
232 |
+
$params = empty($params)?array():$params;
|
233 |
+
|
234 |
+
if (empty($params['firstname']) && empty($params['lastname']))
|
235 |
+
{
|
236 |
+
$sibObj = Mage::getModel('sendinblue/sendinblue');
|
237 |
+
$subscriber_email = $data->subscriber_email;
|
238 |
+
|
239 |
+
if($data->subscriber_status == 3)
|
240 |
+
$sibObj->emailDelete($subscriber_email);
|
241 |
+
elseif ($data->subscriber_status == 1 && !empty($subscriber_email))
|
242 |
+
{
|
243 |
+
$sibObj->emailSubscribe($data->subscriber_email);
|
244 |
+
if( !isset($params['newsletter'])) {
|
245 |
+
$sibObj->sendWsTemplateMail($data->subscriber_email);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Psmailin.php
ADDED
@@ -0,0 +1,1188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 2007-2014 PrestaShop
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@prestashop.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
18 |
+
* versions in the future. If you wish to customize PrestaShop for your
|
19 |
+
* needs please refer to http://www.prestashop.com for more information.
|
20 |
+
*
|
21 |
+
* @author PrestaShop SA <contact@prestashop.com>
|
22 |
+
* @copyright 2007-2014 PrestaShop SA
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
* International Registered Trademark & Property of PrestaShop SA
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Sendinblue_Sendinblue_Model_Psmailin
|
28 |
+
{
|
29 |
+
public $api_key;
|
30 |
+
public $base_url;
|
31 |
+
public function __construct($params)
|
32 |
+
{
|
33 |
+
if (!function_exists('curl_init')) {
|
34 |
+
throw new Exception('Mailin requires CURL module');
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->base_url = $params['url'];
|
38 |
+
$this->api_key = $params['api_key'];
|
39 |
+
|
40 |
+
}
|
41 |
+
/**
|
42 |
+
* Do CURL request with authorization
|
43 |
+
*/
|
44 |
+
|
45 |
+
private function doRequest($resource, $method, $input)
|
46 |
+
{
|
47 |
+
$called_url = $this->base_url."/".$resource;
|
48 |
+
$ch = curl_init($called_url);
|
49 |
+
$auth_header = 'api-key:'.$this->api_key;
|
50 |
+
$content_header = "Content-Type:application/json";
|
51 |
+
$track_header = "sib-plugin:magento-1.2.6";
|
52 |
+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
53 |
+
// Windows only over-ride
|
54 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
55 |
+
}
|
56 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth_header, $content_header, $track_header));
|
57 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
58 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
59 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
60 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
61 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
|
62 |
+
$data = curl_exec($ch);
|
63 |
+
if (curl_errno($ch)) {
|
64 |
+
echo '<div style="background:#d14836; padding:10px; color:#fff; font-weight:600; position:aboslute;width:100%;top:0;">Curl error: '.curl_error($ch).'</div>';
|
65 |
+
}
|
66 |
+
curl_close($ch);
|
67 |
+
return json_decode($data, true);
|
68 |
+
}
|
69 |
+
public function get($resource, $input)
|
70 |
+
{
|
71 |
+
return $this->doRequest($resource, "GET", $input);
|
72 |
+
}
|
73 |
+
public function put($resource, $input)
|
74 |
+
{
|
75 |
+
return $this->doRequest($resource, "PUT", $input);
|
76 |
+
}
|
77 |
+
public function post($resource, $input)
|
78 |
+
{
|
79 |
+
return $this->doRequest($resource, "POST", $input);
|
80 |
+
}
|
81 |
+
public function delete($resource, $input)
|
82 |
+
{
|
83 |
+
return $this->doRequest($resource, "DELETE", $input);
|
84 |
+
}
|
85 |
+
|
86 |
+
/*
|
87 |
+
Get Account.
|
88 |
+
No input required
|
89 |
+
*/
|
90 |
+
public function getAccount()
|
91 |
+
{
|
92 |
+
return $this->get("account", "");
|
93 |
+
}
|
94 |
+
|
95 |
+
/*
|
96 |
+
Get SMTP details.
|
97 |
+
No input required
|
98 |
+
*/
|
99 |
+
public function getSmtpDetails()
|
100 |
+
{
|
101 |
+
return $this->get("account/smtpdetail", "");
|
102 |
+
}
|
103 |
+
|
104 |
+
/*
|
105 |
+
Create Child Account.
|
106 |
+
@param {Array} data contains php array with key value pair.
|
107 |
+
@options data {String} child_email: Email address of Reseller child [Mandatory]
|
108 |
+
@options data {String} password: Password of Reseller child to login [Mandatory]
|
109 |
+
@options data {String} company_org: Name of Reseller child’s company [Mandatory]
|
110 |
+
@options data {String} first_name: First name of Reseller child [Mandatory]
|
111 |
+
@options data {String} last_name: Last name of Reseller child [Mandatory]
|
112 |
+
@options data {Array} credits: Number of email & sms credits respectively, which will be
|
113 |
+
assigned to the Reseller child’s account [Optional]
|
114 |
+
- email_credit {Integer} number of email credits
|
115 |
+
- sms_credit {Integer} Number of sms credts
|
116 |
+
@options data {Array} associate_ip: Associate dedicated IPs to reseller child.
|
117 |
+
You can use commas to separate multiple IPs [Optional]
|
118 |
+
*/
|
119 |
+
public function createChildAccount($data)
|
120 |
+
{
|
121 |
+
return $this->post("account", json_encode($data));
|
122 |
+
}
|
123 |
+
|
124 |
+
/*
|
125 |
+
Update Child Account.
|
126 |
+
@param {Array} data contains php array with key value pair.
|
127 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to
|
128 |
+
be modified [Mandatory]
|
129 |
+
@options data {String} company_org: Name of Reseller child’s company [Optional]
|
130 |
+
@options data {String} first_name: First name of Reseller child [Optional]
|
131 |
+
@options data {String} last_name: Last name of Reseller child [Optional]
|
132 |
+
@options data {String} password: Password of Reseller child to login [Optional]
|
133 |
+
@options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use
|
134 |
+
commas to separate multiple IPs [Optional]
|
135 |
+
@options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can
|
136 |
+
use commas to separate multiple IPs [Optional]
|
137 |
+
*/
|
138 |
+
public function updateChildAccount($data)
|
139 |
+
{
|
140 |
+
return $this->put("account", json_decode($data));
|
141 |
+
}
|
142 |
+
|
143 |
+
/*
|
144 |
+
Delete Child Account.
|
145 |
+
@param {Array} data contains php array with key value pair.
|
146 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to be
|
147 |
+
deleted [Mandatory]
|
148 |
+
*/
|
149 |
+
public function deleteChildAccount($data)
|
150 |
+
{
|
151 |
+
return $this->delete("account/".$data['auth_key'], "");
|
152 |
+
}
|
153 |
+
|
154 |
+
/*
|
155 |
+
Get Reseller child Account.
|
156 |
+
@param {Array} data contains php array with key value pair.
|
157 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child.
|
158 |
+
Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL",
|
159 |
+
"key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
|
160 |
+
*/
|
161 |
+
public function getResellerChild($data)
|
162 |
+
{
|
163 |
+
return $this->post("account/getchildv2", json_encode($data));
|
164 |
+
}
|
165 |
+
|
166 |
+
/*
|
167 |
+
Add/Remove Reseller child's Email/Sms credits.
|
168 |
+
@param {Array} data contains php array with key value pair.
|
169 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to modify
|
170 |
+
credits [Mandatory]
|
171 |
+
@options data {Array} add_credit: Number of email & sms credits to be added. You can assign
|
172 |
+
either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
|
173 |
+
- email_credit {Integer} number of email credits
|
174 |
+
- sms_credit {Integer} Number of sms credts
|
175 |
+
@options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign
|
176 |
+
either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
|
177 |
+
- email_credit {Integer} number of email credits
|
178 |
+
- sms_credit {Integer} Number of sms credts
|
179 |
+
*/
|
180 |
+
public function addRemoveChildCredits($data)
|
181 |
+
{
|
182 |
+
return $this->post("account/addrmvcredit", json_decode($data));
|
183 |
+
}
|
184 |
+
|
185 |
+
/*
|
186 |
+
Get a particular campaign detail.
|
187 |
+
@param {Array} data contains php array with key value pair.
|
188 |
+
@options data {Integer} id: Unique Id of the campaign [Mandatory]
|
189 |
+
*/
|
190 |
+
public function getCampaignV2($data)
|
191 |
+
{
|
192 |
+
return $this->get("campaign/".$data['id']."/detailsv2", "");
|
193 |
+
}
|
194 |
+
|
195 |
+
/*
|
196 |
+
Get all campaigns detail.
|
197 |
+
@param {Array} data contains php array with key value pair.
|
198 |
+
@options data {String} type: Type of campaign. Possible values – classic, trigger,
|
199 |
+
sms, template ( case sensitive ) [Optional]
|
200 |
+
@options data {String} status: Status of campaign. Possible values – draft, sent, archive
|
201 |
+
, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
|
202 |
+
@options data {Integer} page: Maximum number of records per request is 500, if there are
|
203 |
+
more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
|
204 |
+
@options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
|
205 |
+
*/
|
206 |
+
public function getCampaignsV2($data)
|
207 |
+
{
|
208 |
+
return $this->get("campaign/detailsv2", json_decode($data));
|
209 |
+
}
|
210 |
+
|
211 |
+
/*
|
212 |
+
Create and Schedule your campaigns. It returns the ID of the created campaign.
|
213 |
+
@param {Array} data contains php array with key value pair.
|
214 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
215 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
216 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
217 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
218 |
+
sender exists]
|
219 |
+
@options data {String} name: Name of the campaign [Mandatory]
|
220 |
+
@options data {String} bat: Email address for test mail [Optional]
|
221 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
222 |
+
more than 10 characters [Mandatory: if html_url is empty]
|
223 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
224 |
+
html_content is empty]
|
225 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent
|
226 |
+
[Mandatory: if scheduled_date is not empty]
|
227 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
228 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
229 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
230 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
231 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
232 |
+
sender exists]
|
233 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
234 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to
|
235 |
+
include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact
|
236 |
+
attributes here, these should already exist in SendinBlue account [Optional]
|
237 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
238 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
239 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default)
|
240 |
+
& 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be
|
241 |
+
embedded, in the email [Optional]
|
242 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0
|
243 |
+
& 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1
|
244 |
+
means mirror links are activated, in the campaign [Optional]
|
245 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default)
|
246 |
+
& 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to
|
247 |
+
send now [Optional]
|
248 |
+
|
249 |
+
*/
|
250 |
+
public function createCampaign($data)
|
251 |
+
{
|
252 |
+
return $this->post("campaign", json_decode($data));
|
253 |
+
}
|
254 |
+
|
255 |
+
/*
|
256 |
+
Update your campaign.
|
257 |
+
@param {Array} data contains php array with key value pair.
|
258 |
+
@options data {Integer} id: Id of campaign to be modified [Mandatory]
|
259 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
260 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
261 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
262 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
263 |
+
sender exists]
|
264 |
+
@options data {String} name: Name of the campaign [Optional]
|
265 |
+
@options data {String} bat: Email address for test mail [Optional]
|
266 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
267 |
+
more than 10 characters [Optional]
|
268 |
+
@options data {String} html_url: Url which content is the body of content [Optional]
|
269 |
+
@options data {Array} listid These are the lists to which the campaign has been sent
|
270 |
+
[Mandatory: if scheduled_date is not empty]
|
271 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to
|
272 |
+
run[Optional]
|
273 |
+
@options data {String} subject: Subject of the campaign.
|
274 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
275 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
276 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients,
|
277 |
+
if sender exists]
|
278 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
279 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to
|
280 |
+
include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the
|
281 |
+
contact attributes here, these should already exist in SendinBlue account [Optional]
|
282 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the
|
283 |
+
campaign [Optional]
|
284 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
285 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0
|
286 |
+
(default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1
|
287 |
+
means image can be embedded, in the email [Optional]
|
288 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible
|
289 |
+
values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, &
|
290 |
+
mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
291 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0
|
292 |
+
(default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means
|
293 |
+
campaign ready to send now [Optional]
|
294 |
+
*/
|
295 |
+
public function updateCampaign($data)
|
296 |
+
{
|
297 |
+
$id = $data['id'];
|
298 |
+
unset($data['id']);
|
299 |
+
return $this->put("campaign/".$id, json_decode($data));
|
300 |
+
}
|
301 |
+
|
302 |
+
/*
|
303 |
+
Delete your campaigns.
|
304 |
+
@param {Array} data contains php array with key value pair.
|
305 |
+
@options data {Integer} id: Id of campaign to be deleted [Mandatory]
|
306 |
+
*/
|
307 |
+
public function deleteCampaign($data)
|
308 |
+
{
|
309 |
+
return $this->delete("campaign/".$data['id'], "");
|
310 |
+
}
|
311 |
+
|
312 |
+
/*
|
313 |
+
Send report of Sent and Archived campaign.
|
314 |
+
@param {Array} data contains php array with key value pair.
|
315 |
+
@options data {Integer} id: Id of campaign to send its report [Mandatory]
|
316 |
+
@options data {String} lang: Language of email content. Possible values – fr
|
317 |
+
(default), en, es, it & pt [Optional]
|
318 |
+
@options data {String} email_subject: Message subject [Mandatory]
|
319 |
+
@options data {Array} email_to: Email address of the recipient(s). Example:
|
320 |
+
"test@example.net". You can use commas to separate multiple recipients [Mandatory]
|
321 |
+
@options data {String} email_content_type: Body of the message in text/HTML version.
|
322 |
+
Possible values – text & html [Mandatory]
|
323 |
+
@options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
|
324 |
+
@options data {Array} email_cc: Same as email_to but for Cc [Optional]
|
325 |
+
@options data {String} email_body: Body of the message [Mandatory]
|
326 |
+
*/
|
327 |
+
public function campaignReportEmail($data)
|
328 |
+
{
|
329 |
+
$id = $data['id'];
|
330 |
+
unset($data['id']);
|
331 |
+
return $this->post("campaign/".$id."/report", json_decode($data));
|
332 |
+
}
|
333 |
+
|
334 |
+
/*
|
335 |
+
Export the recipients of a specified campaign.
|
336 |
+
@param {Array} data contains php array with key value pair.
|
337 |
+
@options data {Integer} id: Id of campaign to export its recipients [Mandatory]
|
338 |
+
@options data {String} notify_url: URL that will be called once the export process
|
339 |
+
is finished [Mandatory]
|
340 |
+
@options data {String} type: Type of recipients. Possible values – all, non_clicker,
|
341 |
+
non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
|
342 |
+
*/
|
343 |
+
public function campaignRecipientsExport($data)
|
344 |
+
{
|
345 |
+
$id = $data['id'];
|
346 |
+
unset($data['id']);
|
347 |
+
return $this->post("campaign/".$id."/recipients", json_decode($data));
|
348 |
+
}
|
349 |
+
|
350 |
+
/*
|
351 |
+
Get the Campaign name, subject and share link of the classic type campaigns only which
|
352 |
+
are sent, for those which are not sent and the rest of campaign types like trigger, template
|
353 |
+
& sms, will return an error message of share link not available.
|
354 |
+
@param {Array} data contains php array with key value pair.
|
355 |
+
@options data {Array} camp_ids: Id of campaign to get share link. You can use commas to
|
356 |
+
separate multiple ids [Mandatory]
|
357 |
+
*/
|
358 |
+
|
359 |
+
public function shareCampaign($data)
|
360 |
+
{
|
361 |
+
return $this->post("campaign/sharelinkv2", json_encode($data));
|
362 |
+
}
|
363 |
+
|
364 |
+
/*
|
365 |
+
Send a Test Campaign.
|
366 |
+
@param {Array} data contains php array with key value pair.
|
367 |
+
@options data {Integer} id: Id of the campaign [Mandatory]
|
368 |
+
@options data {Array} emails: Email address of recipient(s) existing in the one of the lists &
|
369 |
+
should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple
|
370 |
+
recipients [Mandatory]
|
371 |
+
*/
|
372 |
+
public function sendBatEmail($data)
|
373 |
+
{
|
374 |
+
$id = $data['id'];
|
375 |
+
unset($data['id']);
|
376 |
+
return $this->post("campaign/".$id."/test", json_encode($data));
|
377 |
+
}
|
378 |
+
|
379 |
+
/*
|
380 |
+
Update the Campaign status.
|
381 |
+
@param {Array} data contains php array with key value pair.
|
382 |
+
@options data {Integer} id: Id of campaign to update its status [Mandatory]
|
383 |
+
@options data {String} status: Types of status. Possible values – suspended,
|
384 |
+
archive, darchive, sent, queued, replicate and replicate_template ( case sensitive )
|
385 |
+
[Mandatory]
|
386 |
+
*/
|
387 |
+
public function updateCampaignStatus($data)
|
388 |
+
{
|
389 |
+
$id = $data['id'];
|
390 |
+
unset($data['id']);
|
391 |
+
return $this->put("campaign/".$id."/updatecampstatus", json_encode($data));
|
392 |
+
}
|
393 |
+
|
394 |
+
/*
|
395 |
+
Create and schedule your Trigger campaigns.
|
396 |
+
@param {Array} data contains php array with key value pair.
|
397 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
398 |
+
@options data {String} from_name: Sender name from which the campaign emails are
|
399 |
+
sent [Mandatory: for Dedicated IP clients, please make sure that the sender details
|
400 |
+
are defined here, and in case of no sender, you can add them also via API & for Shared
|
401 |
+
IP clients, if sender exists]
|
402 |
+
@options data {String} trigger_name: Name of the campaign [Mandatory]
|
403 |
+
@options data {String} bat: Email address for test mail [Optional]
|
404 |
+
@options data {String} html_content: Body of the content. The HTML content field must
|
405 |
+
have more than 10 characters [Mandatory: if html_url is empty]
|
406 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
407 |
+
html_content is empty]
|
408 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent
|
409 |
+
[Mandatory: if scheduled_date is not empty]
|
410 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to
|
411 |
+
run[Optional]
|
412 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
413 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
414 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
415 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
416 |
+
sender exists]
|
417 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
418 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include
|
419 |
+
the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes
|
420 |
+
here, these should already exist in SendinBlue account [Optional]
|
421 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign
|
422 |
+
[Optional]
|
423 |
+
@options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1.
|
424 |
+
recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1
|
425 |
+
means contact can receive the same Trigger campaign several times [Optional]
|
426 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
427 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) &
|
428 |
+
1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded,
|
429 |
+
in the email [Optional]
|
430 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1
|
431 |
+
(default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror
|
432 |
+
links are activated, in the campaign [Optional]
|
433 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
434 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
435 |
+
[Optional]
|
436 |
+
*/
|
437 |
+
public function createTriggerCampaign($data)
|
438 |
+
{
|
439 |
+
return $this->post("campaign", json_encode($data));
|
440 |
+
}
|
441 |
+
|
442 |
+
/*
|
443 |
+
Update and schedule your Trigger campaigns.
|
444 |
+
@param {Array} data contains php array with key value pair.
|
445 |
+
@options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
|
446 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
447 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
448 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here,
|
449 |
+
and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
450 |
+
@options data {String} trigger_name: Name of the campaign [Mandatory]
|
451 |
+
@options data {String} bat Email address for test mail [Optional]
|
452 |
+
@options data {String} html_content: Body of the content. The HTML content field must have more
|
453 |
+
than 10 characters [Mandatory: if html_url is empty]
|
454 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
455 |
+
html_content is empty]
|
456 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory:
|
457 |
+
if scheduled_date is not empty]
|
458 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
459 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
460 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory:
|
461 |
+
for Dedicated IP clients, please make sure that the sender details are defined here, and in case of
|
462 |
+
no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
463 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
464 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include the
|
465 |
+
first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here
|
466 |
+
, these should already exist in SendinBlue account [Optional]
|
467 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign
|
468 |
+
[Optional]
|
469 |
+
@options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1.
|
470 |
+
recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1
|
471 |
+
means contact can receive the same Trigger campaign several times [Optional]
|
472 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
473 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) &
|
474 |
+
1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded,
|
475 |
+
in the email [Optional]
|
476 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 &
|
477 |
+
1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror
|
478 |
+
links are activated, in the campaign [Optional]
|
479 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
480 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
481 |
+
[Optional]
|
482 |
+
*/
|
483 |
+
public function updateTriggerCampaign($data)
|
484 |
+
{
|
485 |
+
$id = $data['id'];
|
486 |
+
unset($data['id']);
|
487 |
+
return $this->put("campaign/".$id, json_encode($data));
|
488 |
+
}
|
489 |
+
|
490 |
+
/*
|
491 |
+
Get all folders detail.
|
492 |
+
@param {Array} data contains php array with key value pair.
|
493 |
+
@options data {Integer} page: Maximum number of records per request is 50,
|
494 |
+
if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
|
495 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
496 |
+
*/
|
497 |
+
public function getFolders($data)
|
498 |
+
{
|
499 |
+
return $this->get("folder", json_encode($data));
|
500 |
+
}
|
501 |
+
|
502 |
+
/*
|
503 |
+
Get a particular folder detail.
|
504 |
+
@param {Array} data contains php array with key value pair.
|
505 |
+
@options data {Integer} id: Id of folder to get details [Mandatory]
|
506 |
+
*/
|
507 |
+
public function getFolder($data)
|
508 |
+
{
|
509 |
+
return $this->get("folder/".$data['id'], "");
|
510 |
+
}
|
511 |
+
|
512 |
+
/*
|
513 |
+
Create a new folder.
|
514 |
+
@param {Array} data contains php array with key value pair.
|
515 |
+
@options data {String} name: Desired name of the folder to be created [Mandatory]
|
516 |
+
*/
|
517 |
+
public function createFolder($data)
|
518 |
+
{
|
519 |
+
return $this->post("folder", json_encode($data));
|
520 |
+
}
|
521 |
+
|
522 |
+
/*
|
523 |
+
Delete a specific folder information.
|
524 |
+
@param {Array} data contains php array with key value pair.
|
525 |
+
@options data {Integer} id: Id of folder to be deleted [Mandatory]
|
526 |
+
*/
|
527 |
+
public function deleteFolder($data)
|
528 |
+
{
|
529 |
+
return $this->delete("folder/".$data['id'], "");
|
530 |
+
}
|
531 |
+
|
532 |
+
/*
|
533 |
+
Update an existing folder.
|
534 |
+
@param {Array} data contains php array with key value pair.
|
535 |
+
@options data {Integer} id: Id of folder to be modified [Mandatory]
|
536 |
+
@options data {String} name: Desired name of the folder to be modified [Mandatory]
|
537 |
+
*/
|
538 |
+
public function updateFolder($data)
|
539 |
+
{
|
540 |
+
$id = $data['id'];
|
541 |
+
unset($data['id']);
|
542 |
+
return $this->put("folder/".$id, json_encode($data));
|
543 |
+
}
|
544 |
+
|
545 |
+
/*
|
546 |
+
Get all lists detail.
|
547 |
+
@param {Array} data contains php array with key value pair.
|
548 |
+
@options data {Integer} list_parent: This is the existing folder id & can be used to
|
549 |
+
get all lists belonging to it [Optional]
|
550 |
+
@options data {Integer} page: Maximum number of records per request is 50, if there are
|
551 |
+
more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
|
552 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
553 |
+
*/
|
554 |
+
public function getLists($data)
|
555 |
+
{
|
556 |
+
return $this->get("list", json_encode($data));
|
557 |
+
}
|
558 |
+
|
559 |
+
/*
|
560 |
+
Get a particular list detail.
|
561 |
+
@param {Array} data contains php array with key value pair.
|
562 |
+
@options data {Integer} id: Id of list to get details [Mandatory]
|
563 |
+
*/
|
564 |
+
public function getList($data)
|
565 |
+
{
|
566 |
+
return $this->get("list/".$data['id'], "");
|
567 |
+
}
|
568 |
+
|
569 |
+
/*
|
570 |
+
Create a new list.
|
571 |
+
@param {Array} data contains php array with key value pair.
|
572 |
+
@options data {String} list_name: Desired name of the list to be created [Mandatory]
|
573 |
+
@options data {Integer} list_parent: Folder ID [Mandatory]
|
574 |
+
*/
|
575 |
+
public function createList($data)
|
576 |
+
{
|
577 |
+
return $this->post("list", json_encode($data));
|
578 |
+
}
|
579 |
+
|
580 |
+
/*
|
581 |
+
Update a list.
|
582 |
+
@param {Array} data contains php array with key value pair.
|
583 |
+
@options data {Integer} id: Id of list to be modified [Mandatory]
|
584 |
+
@options data {String} list_name: Desired name of the list to be modified [Optional]
|
585 |
+
@options data {Integer} list_parent: Folder ID [Mandatory]
|
586 |
+
*/
|
587 |
+
public function updateList($data)
|
588 |
+
{
|
589 |
+
$id = $data['id'];
|
590 |
+
unset($data['id']);
|
591 |
+
return $this->put("list/".$id, json_encode($data));
|
592 |
+
}
|
593 |
+
|
594 |
+
/*
|
595 |
+
Delete a specific list.
|
596 |
+
@param {Array} data contains php array with key value pair.
|
597 |
+
@options data {Integer} id: Id of list to be deleted [Mandatory]
|
598 |
+
*/
|
599 |
+
public function deleteList($data)
|
600 |
+
{
|
601 |
+
return $this->delete("list/".$data['id'], "");
|
602 |
+
}
|
603 |
+
|
604 |
+
/*
|
605 |
+
Display details of all users for the given lists.
|
606 |
+
@param {Array} data contains php array with key value pair.
|
607 |
+
@options data {Array} listids: These are the list ids to get their data. The ids found
|
608 |
+
will display records [Mandatory]
|
609 |
+
@options data {String} timestamp: This is date-time filter to fetch modified user records >=
|
610 |
+
this time. Valid format Y-m-d H:i:s. Example: "2015-05-22 14:30:00" [Optional]
|
611 |
+
@options data {Integer} page: Maximum number of records per request is 500, if in your list
|
612 |
+
there are more than 500 users then you can use this parameter to get next 500 results [Optional]
|
613 |
+
@options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
|
614 |
+
*/
|
615 |
+
public function displayListUsers($data)
|
616 |
+
{
|
617 |
+
return $this->post("list/display", json_encode($data));
|
618 |
+
}
|
619 |
+
|
620 |
+
/*
|
621 |
+
Add already existing users in the SendinBlue contacts to the list.
|
622 |
+
@param {Array} data contains php array with key value pair.
|
623 |
+
@options data {Integer} id: Id of list to link users in it [Mandatory]
|
624 |
+
@options data {Array} users: Email address of the already existing user(s) in the
|
625 |
+
SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple
|
626 |
+
users [Mandatory]
|
627 |
+
*/
|
628 |
+
|
629 |
+
public function addUsersList($data)
|
630 |
+
{
|
631 |
+
$id = $data['id'];
|
632 |
+
unset($data['id']);
|
633 |
+
return $this->post("list/".$id."/users", json_encode($data));
|
634 |
+
}
|
635 |
+
|
636 |
+
/*
|
637 |
+
Delete already existing users in the SendinBlue contacts from the list.
|
638 |
+
@param {Array} data contains php array with key value pair.
|
639 |
+
@options data {Integer} id: Id of list to unlink users from it [Mandatory]
|
640 |
+
@options data {Array} users: Email address of the already existing user(s) in the
|
641 |
+
SendinBlue contacts to be modified. Example: "test@example.net". You can use commas
|
642 |
+
to separate multiple users [Mandatory]
|
643 |
+
*/
|
644 |
+
public function deleteUsersList($data)
|
645 |
+
{
|
646 |
+
$id = $data['id'];
|
647 |
+
unset($data['id']);
|
648 |
+
return $this->delete("list/".$id."/delusers", json_encode($data));
|
649 |
+
}
|
650 |
+
|
651 |
+
/*
|
652 |
+
Access all the attributes information under the account.
|
653 |
+
No input required
|
654 |
+
*/
|
655 |
+
public function getAttributes()
|
656 |
+
{
|
657 |
+
return $this->get("attribute", "");
|
658 |
+
}
|
659 |
+
|
660 |
+
/*
|
661 |
+
Access the specific type of attribute information.
|
662 |
+
@param {Array} data contains php array with key value pair.
|
663 |
+
@options data {String} type: Type of attribute. Possible values – normal, transactional,
|
664 |
+
category, calculated & global [Optional]
|
665 |
+
*/
|
666 |
+
public function getAttribute($data)
|
667 |
+
{
|
668 |
+
return $this->get("attribute/".$data['type'], "");
|
669 |
+
}
|
670 |
+
|
671 |
+
/*
|
672 |
+
Create an Attribute.
|
673 |
+
@param {Array} data contains php array with key value pair.
|
674 |
+
@options data {String} type: Type of attribute. Possible values – normal, transactional,
|
675 |
+
category, calculated & global ( case sensitive ) [Mandatory]
|
676 |
+
@options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute
|
677 |
+
to be created in your SendinBlue account. It should be sent as an associative array. Example:
|
678 |
+
array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
|
679 |
+
The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string.
|
680 |
+
Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2",
|
681 |
+
"value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
|
682 |
+
*/
|
683 |
+
public function createAttribute($data)
|
684 |
+
{
|
685 |
+
return $this->post("attribute/", json_encode($data));
|
686 |
+
}
|
687 |
+
|
688 |
+
/*
|
689 |
+
Delete a specific type of attribute information.
|
690 |
+
@param {Array} data contains php array with key value pair.
|
691 |
+
@options data {Integer} type: Type of attribute to be deleted [Mandatory]
|
692 |
+
*/
|
693 |
+
public function deleteAttribute($type, $data)
|
694 |
+
{
|
695 |
+
$type = $data['type'];
|
696 |
+
unset($data['type']);
|
697 |
+
return $this->post("attribute/".$type, json_encode($data));
|
698 |
+
}
|
699 |
+
|
700 |
+
/*
|
701 |
+
Create a new user if an email provided as input, doesn’t exists in the contact list
|
702 |
+
of your SendinBlue account, otherwise it will update the existing user.
|
703 |
+
@param {Array} data contains php array with key value pair.
|
704 |
+
@options data {String} email: Email address of the user to be created in SendinBlue contacts.
|
705 |
+
Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
|
706 |
+
@options data {Array} attributes: The name of attribute present in your SendinBlue account.
|
707 |
+
It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas
|
708 |
+
to separate multiple attributes [Optional]
|
709 |
+
@options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible
|
710 |
+
values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
|
711 |
+
@options data {Array} listid: The list id(s) to be linked from user [Optional]
|
712 |
+
@options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
|
713 |
+
@options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS
|
714 |
+
number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been
|
715 |
+
blacklisted [Optional]
|
716 |
+
*/
|
717 |
+
public function createUpdateUser($data)
|
718 |
+
{
|
719 |
+
return $this->post("user/createdituser", json_encode($data));
|
720 |
+
}
|
721 |
+
|
722 |
+
/*
|
723 |
+
Get Access a specific user Information.
|
724 |
+
@param {Array} data contains php array with key value pair.
|
725 |
+
@options data {String} email: Email address of the already existing user in the SendinBlue
|
726 |
+
contacts [Mandatory]
|
727 |
+
*/
|
728 |
+
public function getUser($data)
|
729 |
+
{
|
730 |
+
return $this->get("user/".$data['email'], "");
|
731 |
+
}
|
732 |
+
|
733 |
+
/*
|
734 |
+
Unlink existing user from all lists.
|
735 |
+
@param {Array} data contains php array with key value pair.
|
736 |
+
@options data {String} email: Email address of the already existing user in the SendinBlue
|
737 |
+
contacts to be unlinked from all lists [Mandatory]
|
738 |
+
*/
|
739 |
+
public function deleteUser($data)
|
740 |
+
{
|
741 |
+
return $this->delete("user/".$data['email'], "");
|
742 |
+
}
|
743 |
+
|
744 |
+
/*
|
745 |
+
Import Users Information.
|
746 |
+
@param {Array} data contains php array with key value pair.
|
747 |
+
@options data {String} url: The URL of the file to be imported. Possible file types – .txt,
|
748 |
+
.csv [Mandatory: if body is empty]
|
749 |
+
@options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;
|
750 |
+
EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘,
|
751 |
+
where \n separates each user data. You can use semicolon to separate multiple attributes
|
752 |
+
[Mandatory: if url is empty]
|
753 |
+
@options data {Array} listids: These are the list ids in which the the users will be imported
|
754 |
+
[Mandatory: if name is empty]
|
755 |
+
@options data {String} notify_url: URL that will be called once the import process is finished
|
756 |
+
[Optional] In notify_url, we are sending the content using POST method
|
757 |
+
@options data {String} name: This is new list name which will be created first & then users will
|
758 |
+
be imported in it [Mandatory: if listids is empty]
|
759 |
+
@options data {Integer} list_parent: This is the existing folder id & can be used with name
|
760 |
+
parameter to make newly created list’s desired parent [Optional]
|
761 |
+
*/
|
762 |
+
public function importUsers($data)
|
763 |
+
{
|
764 |
+
return $this->post("user/import", json_encode($data));
|
765 |
+
}
|
766 |
+
|
767 |
+
/*
|
768 |
+
Export Users Information.
|
769 |
+
@param {Array} data contains php array with key value pair.
|
770 |
+
@options data {String} export_attrib: The name of attribute present in your SendinBlue account.
|
771 |
+
You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
|
772 |
+
@options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}",
|
773 |
+
will export all blacklisted users [Mandatory]
|
774 |
+
@options data {String} notify_url: URL that will be called once the export process is finished
|
775 |
+
[Optional]
|
776 |
+
*/
|
777 |
+
public function exportUsers($data)
|
778 |
+
{
|
779 |
+
return $this->post("user/export", json_encode($data));
|
780 |
+
}
|
781 |
+
|
782 |
+
/*
|
783 |
+
Get all the processes information under the account.
|
784 |
+
@param {Array} data contains php array with key value pair.
|
785 |
+
@options data {Integer} page: Maximum number of records per request is 50, if there are more than 50
|
786 |
+
processes then you can use this parameter to get next 50 results [Mandatory]
|
787 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
788 |
+
*/
|
789 |
+
public function getProcesses($data)
|
790 |
+
{
|
791 |
+
return $this->get("process", json_encode($data));
|
792 |
+
}
|
793 |
+
|
794 |
+
/*
|
795 |
+
Get the process information.
|
796 |
+
@param {Array} data contains php array with key value pair.
|
797 |
+
@options data {Integer} id: Id of process to get details [Mandatory]
|
798 |
+
*/
|
799 |
+
public function getProcess($data)
|
800 |
+
{
|
801 |
+
return $this->get("process/".$data['id'], "");
|
802 |
+
}
|
803 |
+
|
804 |
+
/*
|
805 |
+
To retrieve details of all webhooks.
|
806 |
+
@param {Array} data contains php array with key value pair.
|
807 |
+
@options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get
|
808 |
+
Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all
|
809 |
+
webhooks, use $is_plat="" [Optional]
|
810 |
+
*/
|
811 |
+
public function getWebhooks($data)
|
812 |
+
{
|
813 |
+
return $this->get("webhook", json_encode($data));
|
814 |
+
}
|
815 |
+
|
816 |
+
/*
|
817 |
+
To retrieve details of any particular webhook.
|
818 |
+
@param {Array} data contains php array with key value pair.
|
819 |
+
@options data {Integer} id: Id of webhook to get details [Mandatory]
|
820 |
+
*/
|
821 |
+
public function getWebhook($data)
|
822 |
+
{
|
823 |
+
return $this->get("webhook/".$data['id'], "");
|
824 |
+
}
|
825 |
+
|
826 |
+
/*
|
827 |
+
Create a Webhook.
|
828 |
+
@param {Array} data contains php array with key value pair.
|
829 |
+
@options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
830 |
+
@options data {String} description: Webook description [Optional]
|
831 |
+
@options data {Array} events: Set of events. You can use commas to separate multiple events.
|
832 |
+
Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked,
|
833 |
+
spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam,
|
834 |
+
opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
835 |
+
@options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1.
|
836 |
+
Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use
|
837 |
+
$is_plat=1 [Optional]
|
838 |
+
*/
|
839 |
+
public function createWebhook($data)
|
840 |
+
{
|
841 |
+
return $this->post("webhook", json_encode($data));
|
842 |
+
}
|
843 |
+
|
844 |
+
/*
|
845 |
+
Delete a webhook.
|
846 |
+
@param {Array} data contains php array with key value pair.
|
847 |
+
@options data {Integer} id: Id of webhook to be deleted [Mandatory]
|
848 |
+
*/
|
849 |
+
public function deleteWebhook($data)
|
850 |
+
{
|
851 |
+
return $this->delete("webhook/".$data['id'], "");
|
852 |
+
}
|
853 |
+
|
854 |
+
/*
|
855 |
+
Update a webhook.
|
856 |
+
@param {Array} data contains php array with key value pair.
|
857 |
+
@options data {Integer} id: Id of webhook to be modified [Mandatory]
|
858 |
+
@options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
859 |
+
@options data {String} description: Webook description [Optional]
|
860 |
+
@options data {Array} events: Set of events. You can use commas to separate multiple events.
|
861 |
+
Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked,
|
862 |
+
spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam,
|
863 |
+
opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
864 |
+
*/
|
865 |
+
public function updateWebhook($data)
|
866 |
+
{
|
867 |
+
$id = $data['id'];
|
868 |
+
unset($data['id']);
|
869 |
+
return $this->put("webhook/".$id, json_encode($data));
|
870 |
+
}
|
871 |
+
|
872 |
+
/*
|
873 |
+
Get Access of created senders information.
|
874 |
+
@param {Array} data contains php array with key value pair.
|
875 |
+
@options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise
|
876 |
+
( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′,
|
877 |
+
to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option=""
|
878 |
+
[Optional]
|
879 |
+
*/
|
880 |
+
public function getSenders($data)
|
881 |
+
{
|
882 |
+
return $this->get("advanced", json_encode($data));
|
883 |
+
}
|
884 |
+
|
885 |
+
/*
|
886 |
+
Create your Senders.
|
887 |
+
@param {Array} data contains php array with key value pair.
|
888 |
+
@options data {String} name: Name of the sender [Mandatory]
|
889 |
+
@options data {String} email: Email address of the sender [Mandatory]
|
890 |
+
@options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain.
|
891 |
+
Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only
|
892 |
+
for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
893 |
+
*/
|
894 |
+
public function createSender($data)
|
895 |
+
{
|
896 |
+
return $this->post("advanced", json_encode($data));
|
897 |
+
}
|
898 |
+
|
899 |
+
/*
|
900 |
+
Update your Senders.
|
901 |
+
@param {Array} data contains php array with key value pair.
|
902 |
+
@options data {Integer} id: Id of sender to be modified [Mandatory]
|
903 |
+
@options data {String} name: Name of the sender [Mandatory]
|
904 |
+
@options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain.
|
905 |
+
Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory:
|
906 |
+
Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
907 |
+
*/
|
908 |
+
public function updateSender($data)
|
909 |
+
{
|
910 |
+
$id = $data['id'];
|
911 |
+
unset($data['id']);
|
912 |
+
return $this->put("advanced/".$id, json_encode($data));
|
913 |
+
}
|
914 |
+
|
915 |
+
/*
|
916 |
+
Delete your Sender Information.
|
917 |
+
@param {Array} data contains php array with key value pair.
|
918 |
+
@options data {Integer} id: Id of sender to be deleted [Mandatory]
|
919 |
+
*/
|
920 |
+
public function deleteSender($data)
|
921 |
+
{
|
922 |
+
return $this->delete("advanced/".$data['id'], "");
|
923 |
+
}
|
924 |
+
|
925 |
+
/*
|
926 |
+
Send Transactional Email.
|
927 |
+
@param {Array} data contains php array with key value pair.
|
928 |
+
@options data {Array} to: Email address of the recipient(s). It should be sent as an associative
|
929 |
+
array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients
|
930 |
+
[Mandatory]
|
931 |
+
@options data {String} subject: Message subject [Mandatory]
|
932 |
+
@options data {Array} from Email address for From header. It should be sent as an array. Example: array
|
933 |
+
("from@email.com","from email") [Mandatory]
|
934 |
+
@options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images,
|
935 |
+
use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {}
|
936 |
+
(curly braces) should be same as the filename used in 'inline_image' parameter
|
937 |
+
@options data {String} text: Body of the message. (text version) [Optional]
|
938 |
+
@options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
|
939 |
+
@options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom")
|
940 |
+
[Optional]
|
941 |
+
@options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from
|
942 |
+
email") [Optional]
|
943 |
+
@options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension
|
944 |
+
values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt,
|
945 |
+
tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename &
|
946 |
+
its base64 encoded chunk data as an associative array. Example: array("YourFileName.
|
947 |
+
Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
|
948 |
+
@options data {Array} headers: The headers will be sent along with the mail headers in original email.
|
949 |
+
Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate
|
950 |
+
multiple headers [Optional]
|
951 |
+
@options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk
|
952 |
+
data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData").
|
953 |
+
You can use commas to separate multiple inline images [Optional]
|
954 |
+
*/
|
955 |
+
public function sendEmail($data)
|
956 |
+
{
|
957 |
+
return $this->post("email", json_encode($data));
|
958 |
+
}
|
959 |
+
|
960 |
+
/*
|
961 |
+
Aggregate / date-wise report of the SendinBlue SMTP account.
|
962 |
+
@param {Array} data contains php array with key value pair.
|
963 |
+
@options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals.
|
964 |
+
Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per
|
965 |
+
day/date wise [Optional]
|
966 |
+
@options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD
|
967 |
+
format and should be before the end_date [Optional]
|
968 |
+
@options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD
|
969 |
+
format and should be after the start_date [Optional]
|
970 |
+
@options data {Integer} days: Number of days in the past to include statistics ( Includes today ).
|
971 |
+
It must be an integer greater than 0 [Optional]
|
972 |
+
@options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an
|
973 |
+
existing tag that has statistics [Optional]
|
974 |
+
*/
|
975 |
+
public function getStatistics($data)
|
976 |
+
{
|
977 |
+
return $this->post("statistics", json_encode($data));
|
978 |
+
}
|
979 |
+
|
980 |
+
/*
|
981 |
+
Get Email Event report.
|
982 |
+
@param {Array} data contains php array with key value pair.
|
983 |
+
@options data {Integer} limit: To limit the number of results returned. It should be an integer
|
984 |
+
[Optional]
|
985 |
+
@options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD
|
986 |
+
format and should be before the end_date [Optional]
|
987 |
+
@options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD
|
988 |
+
format and should be after the start_date [Optional]
|
989 |
+
@options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer
|
990 |
+
[Optional]
|
991 |
+
@options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and
|
992 |
+
should be earlier than todays date [Optional]
|
993 |
+
@options data {Integer} days: Number of days in the past (includes today). If specified, must be an
|
994 |
+
integer greater than 0 [Optional]
|
995 |
+
@options data {String} email: Email address to search report for [Optional]
|
996 |
+
*/
|
997 |
+
public function getReport($data)
|
998 |
+
{
|
999 |
+
return $this->post("report", json_encode($data));
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/*
|
1003 |
+
Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
|
1004 |
+
@param {Array} data contains php array with key value pair.
|
1005 |
+
@options data {String} start_date: The start date to get report from. Date must be in
|
1006 |
+
YYYY-MM-DD format and should be before the end_date [Optional]
|
1007 |
+
@options data {String} end_date: The end date to get report till date. Date must be in
|
1008 |
+
YYYY-MM-DD format and should be after the start_date [Optional]
|
1009 |
+
@options data {String} email: Email address to delete its bounces [Optional]
|
1010 |
+
*/
|
1011 |
+
public function deleteBounces($data)
|
1012 |
+
{
|
1013 |
+
return $this->post("bounces", json_encode($data));
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
/*
|
1017 |
+
Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
|
1018 |
+
@param {Array} data contains php array with key value pair.
|
1019 |
+
@options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
|
1020 |
+
@options data {String} to: Email address of the recipient(s). You can use pipe ( | )
|
1021 |
+
to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net"
|
1022 |
+
[Mandatory]
|
1023 |
+
@options data {String} cc: Same as to but for Cc [Optional]
|
1024 |
+
@options data {String} bcc: Same as to but for Bcc [Optional]
|
1025 |
+
@options data {Array} attrv The name of attribute present in your SendinBlue account. It should
|
1026 |
+
be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate
|
1027 |
+
multiple attributes [Optional]
|
1028 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed
|
1029 |
+
from local machine. File must be hosted somewhere [Optional]
|
1030 |
+
@options data {Array} attachment: To send attachment/s generated on the fly you have to pass
|
1031 |
+
your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
|
1032 |
+
*/
|
1033 |
+
public function sendTransactionalTemplate($data)
|
1034 |
+
{
|
1035 |
+
$id = $data['id'];
|
1036 |
+
unset($data['id']);
|
1037 |
+
return $this->put("template/".$id, json_encode($data));
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
/*
|
1041 |
+
Create a Template.
|
1042 |
+
@param {Array} data contains php array with key value pair.
|
1043 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
1044 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1045 |
+
@options data {String} template_name: Name of the Template [Mandatory]
|
1046 |
+
@options data {String} bat: Email address for test mail [Optional]
|
1047 |
+
@options data {String} html_content: Body of the content. The HTML content field must have more
|
1048 |
+
than 10 characters [Mandatory: if html_url is empty]
|
1049 |
+
@options data {String} html_url Url: which content is the body of content [Mandatory: if
|
1050 |
+
html_content is empty]
|
1051 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
1052 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
1053 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1054 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
1055 |
+
@options data {String} to_fieldv This is to personalize the «To» Field. If you want to include
|
1056 |
+
the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes
|
1057 |
+
here, these should already exist in SendinBlue account [Optional]
|
1058 |
+
@options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0
|
1059 |
+
means template is inactive, & status = 1 means template is active [Optional]
|
1060 |
+
@options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1.
|
1061 |
+
attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in
|
1062 |
+
the email [Optional]
|
1063 |
+
*/
|
1064 |
+
public function createTemplate($data)
|
1065 |
+
{
|
1066 |
+
return $this->post("template", json_encode($data));
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
/*
|
1070 |
+
Update a Template.
|
1071 |
+
@param {Array} data contains php array with key value pair.
|
1072 |
+
@options data {Integer} id: Id of Template to be modified [Mandatory]
|
1073 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
1074 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1075 |
+
@options data {String} template_name: Name of the Template [Mandatory]
|
1076 |
+
@options data {String} bat: Email address for test mail [Optional]
|
1077 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
1078 |
+
more than 10 characters [Mandatory: if html_url is empty]
|
1079 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
1080 |
+
html_content is empty]
|
1081 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
1082 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
1083 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1084 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
1085 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include the
|
1086 |
+
first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here,
|
1087 |
+
these should already exist in SendinBlue account [Optional]
|
1088 |
+
@options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0
|
1089 |
+
means template is inactive, & status = 1 means template is active [Optional]
|
1090 |
+
@options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1.
|
1091 |
+
attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the
|
1092 |
+
email [Optional]
|
1093 |
+
*/
|
1094 |
+
public function updateTemplate($data)
|
1095 |
+
{
|
1096 |
+
$id = $data['id'];
|
1097 |
+
unset($data['id']);
|
1098 |
+
return $this->put("template/".$id, json_encode($data));
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
/*
|
1102 |
+
Send a transactional SMS.
|
1103 |
+
@param {Array} data contains php array with key value pair.
|
1104 |
+
@options data {String} to: The mobile number to send SMS to with country code [Mandatory]
|
1105 |
+
@options data {String} from: The name of the sender. The number of characters is limited to 11
|
1106 |
+
(alphanumeric format) [Mandatory]
|
1107 |
+
@options data {String} text: The text of the message. The maximum characters used per SMS is 160,
|
1108 |
+
if used more than that, it will be counted as more than one SMS [Mandatory]
|
1109 |
+
@options data {String} web_url: The web URL that can be called once the message is successfully
|
1110 |
+
delivered [Optional]
|
1111 |
+
@options data {String} tag: The tag that you can associate with the message [Optional]
|
1112 |
+
@options data {String} type: Type of message. Possible values – marketing (default) & transactional.
|
1113 |
+
You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional
|
1114 |
+
type [Optional]
|
1115 |
+
*/
|
1116 |
+
public function sendSms($data)
|
1117 |
+
{
|
1118 |
+
return $this->post("sms", json_encode($data));
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
/*
|
1122 |
+
Create & Schedule your SMS campaigns.
|
1123 |
+
@param {Array} data contains php array with key value pair.
|
1124 |
+
@options data {String} name: Name of the SMS campaign [Mandatory]
|
1125 |
+
@options data {String} sender: This allows you to customize the SMS sender. The number of
|
1126 |
+
characters is limited to 11 ( alphanumeric format ) [Optional]
|
1127 |
+
@options data {String} content: Content of the message. The maximum characters used per SMS is 160,
|
1128 |
+
if used more than that, it will be counted as more than one SMS [Optional]
|
1129 |
+
@options data {String} bat: Mobile number with the country code to send test SMS. The mobile number
|
1130 |
+
defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted
|
1131 |
+
[Optional]
|
1132 |
+
@options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if
|
1133 |
+
scheduled_date is not empty]
|
1134 |
+
@options data {Array} exclude_list: These are the list ids which will be excluded from the SMS
|
1135 |
+
campaign [Optional]
|
1136 |
+
@options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
1137 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
1138 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
1139 |
+
[Optional]
|
1140 |
+
*/
|
1141 |
+
public function createSmsCampaign($data)
|
1142 |
+
{
|
1143 |
+
return $this->post("sms", json_encode($data));
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
/*
|
1147 |
+
Update your SMS campaigns.
|
1148 |
+
@param {Array} data contains php array with key value pair.
|
1149 |
+
@options data {Integer} id: Id of the SMS campaign [Mandatory]
|
1150 |
+
@options data {String} name: Name of the SMS campaign [Optional]
|
1151 |
+
@options data {String} sender: This allows you to customize the SMS sender. The number of characters
|
1152 |
+
is limited to 11 ( alphanumeric format ) [Optional]
|
1153 |
+
@options data {String} content: Content of the message. The maximum characters used per SMS is 160,
|
1154 |
+
if used more than that, it will be counted as more than one SMS [Optional]
|
1155 |
+
@options data {String} bat: Mobile number with the country code to send test SMS. The mobile number
|
1156 |
+
defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted
|
1157 |
+
[Optional]
|
1158 |
+
@options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if
|
1159 |
+
scheduled_date is not empty]
|
1160 |
+
@options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign
|
1161 |
+
[Optional]
|
1162 |
+
@options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
1163 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
1164 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
1165 |
+
[Optional]
|
1166 |
+
*/
|
1167 |
+
public function updateSmsCampaign($data)
|
1168 |
+
{
|
1169 |
+
$id = $data['id'];
|
1170 |
+
unset($data['id']);
|
1171 |
+
return $this->put("sms/".$id, json_encode($data));
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
/*
|
1175 |
+
Send a Test SMS.
|
1176 |
+
@param {Array} data contains php array with key value pair.
|
1177 |
+
@options data {Integer} id: Id of the SMS campaign [Mandatory]
|
1178 |
+
@options data {String} to: Mobile number with the country code to send test SMS. The mobile
|
1179 |
+
number defined here should belong to one of your contacts in SendinBlue account and should not be
|
1180 |
+
blacklisted [Mandatory]
|
1181 |
+
*/
|
1182 |
+
public function sendBatSms($data)
|
1183 |
+
{
|
1184 |
+
$id = $data['id'];
|
1185 |
+
unset($data['id']);
|
1186 |
+
return $this->get("sms/".$id, json_encode($data));
|
1187 |
+
}
|
1188 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php
ADDED
@@ -0,0 +1,1583 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
var $api_url;
|
13 |
+
var $api_key;
|
14 |
+
var $smtp_status;
|
15 |
+
var $error_message;
|
16 |
+
var $error_code;
|
17 |
+
var $lists_ids;
|
18 |
+
var $module_enable;
|
19 |
+
var $st;
|
20 |
+
public function _construct()
|
21 |
+
{
|
22 |
+
parent::_construct();
|
23 |
+
$this->_init('sendinblue/sendinblue');
|
24 |
+
$this->MIAPI();
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* functions used for set module config
|
28 |
+
*/
|
29 |
+
public function MIAPI()
|
30 |
+
{
|
31 |
+
$scope = ($this->getScope()) ? $this->getScope() : Mage::app()->getStore()->getStoreId();
|
32 |
+
$this->module_enable = $this->getEnableStatus($scope);
|
33 |
+
$this->api_url = 'http://ws.mailin.fr/';
|
34 |
+
$this->api_key = $this->getApiKey();
|
35 |
+
$value_language = $this->getApiConfigValue();
|
36 |
+
if(isset($value_language->language)) {
|
37 |
+
$this->user_language = $value_language->language;
|
38 |
+
}
|
39 |
+
|
40 |
+
if (!$this->lists_ids) {
|
41 |
+
$this->lists_ids = str_replace(',', '|', $this->getUserlists($scope));
|
42 |
+
}
|
43 |
+
|
44 |
+
$params = Mage::app()->getRequest()->getParams();
|
45 |
+
$params = empty($params)?array():$params;
|
46 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != '')
|
47 |
+
$this->CreateFolderCaseTwo();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function checkMobileNumber($number, $call_prefix)
|
51 |
+
{
|
52 |
+
$number = preg_replace('/\s+/', '', $number);
|
53 |
+
$charone = substr($number, 0, 1);
|
54 |
+
$chartwo = substr($number, 0, 2);
|
55 |
+
|
56 |
+
if (preg_match('/^'.$call_prefix.'/', $number))
|
57 |
+
return '00'.$number;
|
58 |
+
|
59 |
+
elseif ($charone == '0' && $chartwo != '00')
|
60 |
+
{
|
61 |
+
if (preg_match('/^0'.$call_prefix.'/', $number))
|
62 |
+
return '00'.substr($number, 1);
|
63 |
+
else
|
64 |
+
return '00'.$call_prefix.substr($number, 1);
|
65 |
+
}
|
66 |
+
elseif ($chartwo == '00')
|
67 |
+
{
|
68 |
+
if (preg_match('/^00'.$call_prefix.'/', $number))
|
69 |
+
return $number;
|
70 |
+
else
|
71 |
+
return '00'.$call_prefix.substr($number, 2);
|
72 |
+
}
|
73 |
+
elseif ($charone == '+')
|
74 |
+
{
|
75 |
+
if (preg_match('/^\+'.$call_prefix.'/', $number))
|
76 |
+
return '00'.substr($number, 1);
|
77 |
+
else
|
78 |
+
return '00'.$call_prefix.substr($number, 1);
|
79 |
+
}
|
80 |
+
elseif ($charone != '0')
|
81 |
+
return '00'.$call_prefix.$number;
|
82 |
+
}
|
83 |
+
/**
|
84 |
+
* functions used for getting module status
|
85 |
+
*/
|
86 |
+
public function getEnableStatus()
|
87 |
+
{
|
88 |
+
$status = $this->getGeneralConfig('enabled', Mage::app()->getStore()->getStoreId());
|
89 |
+
if (!$status)
|
90 |
+
return false;
|
91 |
+
return $status;
|
92 |
+
}
|
93 |
+
/**
|
94 |
+
* functions used for send order sms module status
|
95 |
+
*/
|
96 |
+
public function getOrderSmsStatus()
|
97 |
+
{
|
98 |
+
$status = $this->getGeneralConfig('sms/order', Mage::app()->getStore()->getStoreId());
|
99 |
+
if (!$status)
|
100 |
+
return false;
|
101 |
+
return $status;
|
102 |
+
}
|
103 |
+
/**
|
104 |
+
* functions used for getting notify sms status
|
105 |
+
*/
|
106 |
+
public function getNotifySmsStatus()
|
107 |
+
{
|
108 |
+
$status = $this->getGeneralConfig('sms/credit', Mage::app()->getStore()->getStoreId());
|
109 |
+
if (!$status)
|
110 |
+
return false;
|
111 |
+
return $status;
|
112 |
+
}
|
113 |
+
/**
|
114 |
+
* functions used for getting Notify value limit
|
115 |
+
*/
|
116 |
+
public function getNotifyValueStatus()
|
117 |
+
{
|
118 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Value', Mage::app()->getStore()->getStoreId());
|
119 |
+
if (!$status)
|
120 |
+
return false;
|
121 |
+
return $status;
|
122 |
+
}
|
123 |
+
/**
|
124 |
+
* functions used for getting Notify email limit
|
125 |
+
*/
|
126 |
+
public function getNotifyEmailStatus()
|
127 |
+
{
|
128 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Email', Mage::app()->getStore()->getStoreId());
|
129 |
+
if (!$status)
|
130 |
+
return false;
|
131 |
+
return $status;
|
132 |
+
}
|
133 |
+
/**
|
134 |
+
* functions used for getting Notify email limit
|
135 |
+
*/
|
136 |
+
public function getNotifyCronStatus()
|
137 |
+
{
|
138 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Cron_Executed', Mage::app()->getStore()->getStoreId());
|
139 |
+
if (!$status)
|
140 |
+
return false;
|
141 |
+
return $status;
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* functions used for getting shiping sms status
|
145 |
+
*/
|
146 |
+
public function getShipingSmsStatus()
|
147 |
+
{
|
148 |
+
$status = $this->getGeneralConfig('sms/shiping', Mage::app()->getStore()->getStoreId());
|
149 |
+
if (!$status)
|
150 |
+
return false;
|
151 |
+
return $status;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* functions used for getting campaign sms status
|
156 |
+
*/
|
157 |
+
public function getCampaignStatus()
|
158 |
+
{
|
159 |
+
$status = $this->getGeneralConfig('sms/campaign', Mage::app()->getStore()->getStoreId());
|
160 |
+
if (!$status)
|
161 |
+
return false;
|
162 |
+
return $status;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* functions used for getting send sms order subject
|
167 |
+
*/
|
168 |
+
public function getSendSmsOrderSubject()
|
169 |
+
{
|
170 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order', Mage::app()->getStore()->getStoreId());
|
171 |
+
if (!$status)
|
172 |
+
return false;
|
173 |
+
return $status;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* functions used for getting order sms message
|
178 |
+
*/
|
179 |
+
public function getSendSmsmOrderMessage()
|
180 |
+
{
|
181 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order_Message', Mage::app()->getStore()->getStoreId());
|
182 |
+
if (!$status)
|
183 |
+
return false;
|
184 |
+
return $status;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
*functions used for getting send sms shiping subject
|
189 |
+
*/
|
190 |
+
public function getSendSmsShipingSubject()
|
191 |
+
{
|
192 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment', Mage::app()->getStore()->getStoreId());
|
193 |
+
if (!$status)
|
194 |
+
return false;
|
195 |
+
return $status;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
*functions used for getting shiping sms message
|
200 |
+
*/
|
201 |
+
public function getSendSmsShipingMessage()
|
202 |
+
{
|
203 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment_Message', Mage::app()->getStore()->getStoreId());
|
204 |
+
if (!$status)
|
205 |
+
return false;
|
206 |
+
return $status;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* functions used for get api key
|
211 |
+
*/
|
212 |
+
public function getApiKey()
|
213 |
+
{
|
214 |
+
$apikey = $this->getGeneralConfig('api', Mage::app()->getStore()->getStoreId());
|
215 |
+
if (!$apikey)
|
216 |
+
return false;
|
217 |
+
return $apikey;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* functions used for get SMPT password
|
222 |
+
*/
|
223 |
+
public function getSmtpPassword()
|
224 |
+
{
|
225 |
+
$smtpPassword = $this->getSendinSmtpStatus('password', Mage::app()->getStore()->getStoreId());
|
226 |
+
if (!$smtpPassword)
|
227 |
+
return false;
|
228 |
+
return $smtpPassword;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* functions used for get user name
|
233 |
+
*/
|
234 |
+
public function getUserName()
|
235 |
+
{
|
236 |
+
$userName = $this->getSendinSmtpStatus('username', Mage::app()->getStore()->getStoreId());
|
237 |
+
if (!$userName)
|
238 |
+
return false;
|
239 |
+
return $userName;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* functions used for getting smtp status
|
244 |
+
*/
|
245 |
+
public function getSmtpStatus()
|
246 |
+
{
|
247 |
+
$status = $this->getSendinSmtpStatus('status', Mage::app()->getStore()->getStoreId());
|
248 |
+
if (!$status)
|
249 |
+
return false;
|
250 |
+
return $status;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* functions used for getting tracking status
|
255 |
+
*/
|
256 |
+
public function getTrackingStatus()
|
257 |
+
{
|
258 |
+
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
259 |
+
if (!$status) {
|
260 |
+
return false;
|
261 |
+
}
|
262 |
+
return $status;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* functions used for getting tracking status
|
267 |
+
*/
|
268 |
+
public function getTrackingHistoryStatus()
|
269 |
+
{
|
270 |
+
$status = $this->getSendinTrackingHistoryStatus('history', Mage::app()->getStore()->getStoreId());
|
271 |
+
if (!$status) {
|
272 |
+
return false;
|
273 |
+
}
|
274 |
+
return $status;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* functions used for getting userlists
|
279 |
+
*/
|
280 |
+
public function getUserlists()
|
281 |
+
{
|
282 |
+
$userlist = $this->getGeneralConfig('list', Mage::app()->getStore()->getStoreId());
|
283 |
+
if (!$userlist)
|
284 |
+
return false;
|
285 |
+
return $userlist;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* functions used for getting importOldSubscribers status
|
290 |
+
*/
|
291 |
+
public function getImportOldSubsStatus()
|
292 |
+
{
|
293 |
+
$importStatus = $this->getGeneralConfig('importOldUserStatus', Mage::app()->getStore()->getStoreId());
|
294 |
+
if (!$importStatus)
|
295 |
+
return false;
|
296 |
+
return $importStatus;
|
297 |
+
}
|
298 |
+
|
299 |
+
/**
|
300 |
+
* functions used for get templateid
|
301 |
+
*/
|
302 |
+
public function getTemplateId()
|
303 |
+
{
|
304 |
+
$TemplateId = $this->getGeneralConfig('SendinTemplateId', Mage::app()->getStore()->getStoreId());
|
305 |
+
if (!$TemplateId)
|
306 |
+
return false;
|
307 |
+
return $TemplateId;
|
308 |
+
}
|
309 |
+
/**
|
310 |
+
* functions used for get value final email recive.
|
311 |
+
*/
|
312 |
+
public function getFinalTemplate()
|
313 |
+
{
|
314 |
+
$FinalTemplate = $this->getGeneralConfig('SendinTemplateFinal', Mage::app()->getStore()->getStoreId());
|
315 |
+
if (!$FinalTemplate)
|
316 |
+
return false;
|
317 |
+
return $FinalTemplate;
|
318 |
+
}
|
319 |
+
/**
|
320 |
+
* functions used for get value subscribe type like doubleoptin and simple.
|
321 |
+
*/
|
322 |
+
public function getSubscribeConfirmType()
|
323 |
+
{
|
324 |
+
$SubscribeConfirmType = $this->getGeneralConfig('SendinSubscribeConfirmType', Mage::app()->getStore()->getStoreId());
|
325 |
+
if (!$SubscribeConfirmType)
|
326 |
+
return false;
|
327 |
+
return $SubscribeConfirmType;
|
328 |
+
}
|
329 |
+
/**
|
330 |
+
* functions used for get value for redirect url
|
331 |
+
*/
|
332 |
+
public function getOptinRedirectUrlCheck()
|
333 |
+
{
|
334 |
+
$OptinRedirectUrlCheck = $this->getGeneralConfig('SendinOptinRedirectUrlCheck', Mage::app()->getStore()->getStoreId());
|
335 |
+
if (!$OptinRedirectUrlCheck)
|
336 |
+
return false;
|
337 |
+
return $OptinRedirectUrlCheck;
|
338 |
+
}
|
339 |
+
/**
|
340 |
+
* functions used for get double optin redirect url after click email link.
|
341 |
+
*/
|
342 |
+
public function getSendinDoubleoptinRedirectUrl()
|
343 |
+
{
|
344 |
+
$SendinDoubleoptinRedirectUr = $this->getGeneralConfig('SendinDoubleoptinRedirectUrl', Mage::app()->getStore()->getStoreId());
|
345 |
+
if (!$SendinDoubleoptinRedirectUr)
|
346 |
+
return false;
|
347 |
+
return $SendinDoubleoptinRedirectUr;
|
348 |
+
}
|
349 |
+
/**
|
350 |
+
* functions used for get final confirmation email for double optin functionality.
|
351 |
+
*/
|
352 |
+
public function getSendinFinalConfirmEmail()
|
353 |
+
{
|
354 |
+
$SendinFinalConfirmEmail = $this->getGeneralConfig('SendinFinalConfirmEmail', Mage::app()->getStore()->getStoreId());
|
355 |
+
if (!$SendinFinalConfirmEmail)
|
356 |
+
return false;
|
357 |
+
return $SendinFinalConfirmEmail;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* functions used for get doubleoptin id geting by sendinblue.
|
362 |
+
*/
|
363 |
+
public function getSendinOptinListId()
|
364 |
+
{
|
365 |
+
$SendinOptinListId = $this->getGeneralConfig('SendinOptinListId', Mage::app()->getStore()->getStoreId());
|
366 |
+
if (!$SendinOptinListId)
|
367 |
+
return false;
|
368 |
+
return $SendinOptinListId;
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* functions used for getting general config
|
373 |
+
*/
|
374 |
+
public function getGeneralConfig($field, $store = null)
|
375 |
+
{
|
376 |
+
return Mage::getStoreConfig('sendinblue/'.$field, $store);
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* functions used for get sendinsmtp status
|
381 |
+
*/
|
382 |
+
public function getSendinSmtpStatus($field, $store = null)
|
383 |
+
{
|
384 |
+
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* functions used for get sendinblue email status
|
389 |
+
*/
|
390 |
+
public function getSyncronizeStatus()
|
391 |
+
{
|
392 |
+
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
393 |
+
}
|
394 |
+
/**
|
395 |
+
* functions used for get sendin tracking status
|
396 |
+
*/
|
397 |
+
public function getSendinTrackingCodeStatus($field, $store = null)
|
398 |
+
{
|
399 |
+
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* functions used for get sendin tracking history status
|
404 |
+
*/
|
405 |
+
public function getSendinTrackingHistoryStatus($field, $store = null)
|
406 |
+
{
|
407 |
+
return Mage::getStoreConfig('sendinblue/improt/'.$field, $store);
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* functions used for module functionality
|
412 |
+
*/
|
413 |
+
public function getLists()
|
414 |
+
{
|
415 |
+
return $this->lists();
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* functions used for email adds
|
420 |
+
*/
|
421 |
+
public function emailAdd($email, $extra, $is_subscribed = '', $list_id = '')
|
422 |
+
{
|
423 |
+
$attributesName = $this->allAttributesName();
|
424 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
425 |
+
{
|
426 |
+
$apikey = $this->api_key;
|
427 |
+
if (!$apikey)
|
428 |
+
return false;
|
429 |
+
|
430 |
+
$Sendin_Confirm_Type = Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType');
|
431 |
+
if (empty($list_id)) {
|
432 |
+
if (isset($Sendin_Confirm_Type) && $Sendin_Confirm_Type === 'doubleoptin') {
|
433 |
+
$list_id = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
434 |
+
} else {
|
435 |
+
$list_id = $this->lists_ids;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
$params = array();
|
439 |
+
$params['email'] = $email;
|
440 |
+
$params['id'] = '';
|
441 |
+
if ($is_subscribed != '')
|
442 |
+
$params['blacklisted'] = 0;
|
443 |
+
|
444 |
+
if ($extra != null)
|
445 |
+
{
|
446 |
+
$key_value = array_keys($attributesName);
|
447 |
+
$attrName = implode('|', $key_value);
|
448 |
+
$params['attributes_name'] = $attrName;
|
449 |
+
$attrValue = implode('|', $extra);
|
450 |
+
$params['attributes_value'] = $attrValue;
|
451 |
+
} else
|
452 |
+
{
|
453 |
+
$params['attributes_value'] = $email;
|
454 |
+
}
|
455 |
+
$params['listid'] = $list_id;
|
456 |
+
|
457 |
+
return $this->callServer('USERCREADITM', $params);
|
458 |
+
} else
|
459 |
+
return false;
|
460 |
+
}
|
461 |
+
|
462 |
+
/**
|
463 |
+
* functions subscribeuser
|
464 |
+
*/
|
465 |
+
public function emailSubscribe($email)
|
466 |
+
{
|
467 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
468 |
+
{
|
469 |
+
$apikey = $this->api_key;
|
470 |
+
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
471 |
+
$timez = str_replace('Calcutta', 'Kolkata', $timezone);
|
472 |
+
$tm = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
473 |
+
|
474 |
+
if (!$apikey)
|
475 |
+
return false;
|
476 |
+
$data = array();
|
477 |
+
$data['key'] = $apikey;
|
478 |
+
$data['webaction'] = 'UPDATE-USER-SUBSCRIPTION-STATUS';
|
479 |
+
$data['timezone'] = $timez;
|
480 |
+
$data['user_status'] = $email.', '.'1'.', '.$tm;
|
481 |
+
return $this->curlRequest($data);
|
482 |
+
} else
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* functions used for sync data
|
488 |
+
*/
|
489 |
+
public function syncData()
|
490 |
+
{
|
491 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
492 |
+
{
|
493 |
+
$apikey = $this->api_key;
|
494 |
+
if (!$apikey)
|
495 |
+
return false;
|
496 |
+
$params = array();
|
497 |
+
$params['listids'] = str_replace(',', '|', $this->lists_ids);
|
498 |
+
$response = $this->callServer('DISPLAYLISTDATABLACK', $params);
|
499 |
+
$result_arr = $response->result;
|
500 |
+
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()->showCustomerInfo()->toArray();
|
501 |
+
$subscriber_data = $collection['items'];
|
502 |
+
$emails = array();
|
503 |
+
$subscriber_data_email = array();
|
504 |
+
foreach($subscriber_data as $s)
|
505 |
+
{
|
506 |
+
$subscriber_data_email[$s['subscriber_email']] = $s;
|
507 |
+
}
|
508 |
+
|
509 |
+
if (count($result_arr) > 0)
|
510 |
+
{
|
511 |
+
$newsletterSub = Mage::getModel('newsletter/subscriber');
|
512 |
+
foreach ($result_arr as $key => $value)
|
513 |
+
{
|
514 |
+
foreach ($value as $user_data)
|
515 |
+
{
|
516 |
+
if(isset($subscriber_data_email[$user_data->email]))
|
517 |
+
{
|
518 |
+
// on a trouvé le subscriber magento
|
519 |
+
$data = $subscriber_data_email[$user_data->email];
|
520 |
+
$temp_sub_status = ($data['subscriber_status'] == 3) ? 1 : 0;
|
521 |
+
if ($temp_sub_status != $user_data->blacklisted)
|
522 |
+
{
|
523 |
+
$emails[] = $data['subscriber_email'];
|
524 |
+
$subscribe_data['subscriber_id'] = $data['subscriber_id'];
|
525 |
+
$subscribe_data['subscriber_status'] = ($user_data->blacklisted == 1)?3:1;
|
526 |
+
$costomer_data = $newsletterSub->loadByEmail($data['subscriber_email']);
|
527 |
+
$costomer_data->setStatus($subscribe_data['subscriber_status']);
|
528 |
+
$costomer_data->setIsStatusChanged(true);
|
529 |
+
$costomer_data->save();
|
530 |
+
}
|
531 |
+
}
|
532 |
+
}
|
533 |
+
}
|
534 |
+
}
|
535 |
+
if (count($emails) > 0)
|
536 |
+
Mage::getModel('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
537 |
+
else
|
538 |
+
Mage::getModel('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
539 |
+
return true;
|
540 |
+
}
|
541 |
+
else
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
/**
|
545 |
+
* This method is used for add email list
|
546 |
+
*/
|
547 |
+
public function addEmailList($email, $list_id = '')
|
548 |
+
{
|
549 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
550 |
+
{
|
551 |
+
$apikey = $this->api_key;
|
552 |
+
if (!$apikey)
|
553 |
+
return false;
|
554 |
+
|
555 |
+
$Sendin_Confirm_Type = Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType');
|
556 |
+
if (empty($list_id)) {
|
557 |
+
if (isset($Sendin_Confirm_Type) && $Sendin_Confirm_Type === 'doubleoptin') {
|
558 |
+
$list_id = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
559 |
+
} else {
|
560 |
+
$list_id = $this->lists_ids;
|
561 |
+
}
|
562 |
+
}
|
563 |
+
$params = array();
|
564 |
+
$params['email'] = $email;
|
565 |
+
$params['id'] = '';
|
566 |
+
$params['blacklisted'] = 0;
|
567 |
+
$params['attributes_name'] = '';
|
568 |
+
$params['attributes_value'] = '';
|
569 |
+
$params['listid'] = $list_id;
|
570 |
+
return $this->callServer('USERCREADITM', $params);
|
571 |
+
} else
|
572 |
+
return false;
|
573 |
+
}
|
574 |
+
/**
|
575 |
+
* This method is used used for email unsubscribe
|
576 |
+
*/
|
577 |
+
public function emailDelete($email)
|
578 |
+
{
|
579 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
580 |
+
{
|
581 |
+
$apikey = $this->api_key;
|
582 |
+
if (!$apikey)
|
583 |
+
return false;
|
584 |
+
$params = array();
|
585 |
+
$params['email'] = $email;
|
586 |
+
$params['listid'] = $this->lists_ids;
|
587 |
+
return $this->callServer('UNSUBAPI', $params);
|
588 |
+
} else
|
589 |
+
return false;
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* This method is used used for check api status
|
594 |
+
*/
|
595 |
+
public function checkApikey($api_key)
|
596 |
+
{
|
597 |
+
$params['key'] = $api_key;
|
598 |
+
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
599 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
600 |
+
return $lists['error'] = $response->errorMsg;
|
601 |
+
}
|
602 |
+
|
603 |
+
/**
|
604 |
+
* functions used for smtp details and order tracking
|
605 |
+
*/
|
606 |
+
public function SmtpDetailsWithTracking()
|
607 |
+
{
|
608 |
+
$params['key'] = $this->api_key;
|
609 |
+
$response = $this->callServer('TRACKINGDATA', $params);
|
610 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
611 |
+
{
|
612 |
+
$tracking['error'] = $response->errorMsg;
|
613 |
+
return $tracking;
|
614 |
+
}
|
615 |
+
return $response;
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Fetches all the list of the user from the Sendinblue platform.
|
620 |
+
*/
|
621 |
+
public function lists($filters = array())
|
622 |
+
{
|
623 |
+
$params = array();
|
624 |
+
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
625 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
626 |
+
{
|
627 |
+
$this->error_message = $response->errorMsg;
|
628 |
+
$lists['error'] = $response->errorMsg;
|
629 |
+
} else
|
630 |
+
{
|
631 |
+
$i = 0;
|
632 |
+
$lists = array();
|
633 |
+
foreach ($response->result as $list_data)
|
634 |
+
{
|
635 |
+
$lists[$i]['id'] = $list_data->id;
|
636 |
+
$lists[$i]['name'] = $list_data->name;
|
637 |
+
$i++;
|
638 |
+
}
|
639 |
+
}
|
640 |
+
return $lists;
|
641 |
+
}
|
642 |
+
|
643 |
+
/**
|
644 |
+
* Fetches the list status of the user from the Sendinblue platform.
|
645 |
+
*/
|
646 |
+
public function getUserListStats()
|
647 |
+
{
|
648 |
+
if ($this->module_enable == 1)
|
649 |
+
{
|
650 |
+
$params = array();
|
651 |
+
$params['list'] = 'ALL';
|
652 |
+
return $this->callServer('DISPLAYLISTDATA', $params);
|
653 |
+
} else
|
654 |
+
return Mage::getModel('core/session')->addError('Sendinblue not enabled');
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* Fetches all folders and all list within each folder of the user's Sendinblue
|
659 |
+
* account and displays them to the user.
|
660 |
+
*/
|
661 |
+
public function checkFolderListDoubleoptin()
|
662 |
+
{
|
663 |
+
$params = array();
|
664 |
+
$s_array = array();
|
665 |
+
$list_response = $this->callServer('DISPLAY-FOLDERS-LISTS', $params);
|
666 |
+
$list_response = json_encode($list_response);
|
667 |
+
$res = json_decode($list_response, true);
|
668 |
+
if (isset($res) && !empty($res))
|
669 |
+
{
|
670 |
+
foreach ($res as $value)
|
671 |
+
{
|
672 |
+
if (strtolower($value['name']) == 'form')
|
673 |
+
{
|
674 |
+
if (!empty($value['lists']))
|
675 |
+
{
|
676 |
+
foreach ($value['lists'] as $key => $val)
|
677 |
+
{
|
678 |
+
if ($val['name'] == 'Temp - DOUBLE OPTIN')
|
679 |
+
$s_array['optin_id'] = $key;
|
680 |
+
}
|
681 |
+
}
|
682 |
+
}
|
683 |
+
}
|
684 |
+
if (count($s_array) > 0) {
|
685 |
+
$return = $s_array;
|
686 |
+
} else {
|
687 |
+
$return = false;
|
688 |
+
}
|
689 |
+
}
|
690 |
+
return $return;
|
691 |
+
}
|
692 |
+
/**
|
693 |
+
* Create temporary doubleoptin list if not exist in Sendinblue.
|
694 |
+
*/
|
695 |
+
public function createListIdDoubleoptin()
|
696 |
+
{
|
697 |
+
$data = array();
|
698 |
+
$data['foldername'] = 'FORM';
|
699 |
+
$res = $this->callServer('ADDFOLDER', $data);
|
700 |
+
$folder_id = $res->folder_id;
|
701 |
+
if (!empty($folder_id)) {
|
702 |
+
$params = array();
|
703 |
+
$params['listname'] = 'Temp - DOUBLE OPTIN';
|
704 |
+
$params['list_parent'] = $folder_id;
|
705 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
706 |
+
$list_id = $list_response->result;
|
707 |
+
}
|
708 |
+
return $list_id;
|
709 |
+
}
|
710 |
+
|
711 |
+
/**
|
712 |
+
* Fetches all folders and all list within each folder of the user's Sendinblue
|
713 |
+
* account and displays them to the user.
|
714 |
+
*/
|
715 |
+
public function checkFolderList()
|
716 |
+
{
|
717 |
+
$params = array();
|
718 |
+
$array = array();
|
719 |
+
$list_response = $this->callServer('DISPLAY-FOLDERS-LISTS', $params);
|
720 |
+
$list_response = json_encode($list_response);
|
721 |
+
$res = json_decode($list_response, true);
|
722 |
+
if (isset($res) && !empty($res))
|
723 |
+
{
|
724 |
+
foreach ($res as $key => $value)
|
725 |
+
{
|
726 |
+
if (strtolower($value['name']) == 'magento')
|
727 |
+
{
|
728 |
+
$array[] = $key;
|
729 |
+
$array[] = $value['name'];
|
730 |
+
}
|
731 |
+
if (!empty($value['lists']))
|
732 |
+
{
|
733 |
+
foreach ($value['lists'] as $val)
|
734 |
+
{
|
735 |
+
if (strtolower($val['name']) == 'magento')
|
736 |
+
$array[] = $val['name'];
|
737 |
+
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
}
|
741 |
+
return $array;
|
742 |
+
}
|
743 |
+
/**
|
744 |
+
* folder create in Sendinblue after removing from Sendinblue
|
745 |
+
*/
|
746 |
+
public function createFolderCaseTwo()
|
747 |
+
{
|
748 |
+
$apikey = $this->api_key;
|
749 |
+
if($apikey == '')
|
750 |
+
return false;
|
751 |
+
$response = $this->checkApikey($apikey); // check api key is valid or not
|
752 |
+
if ($this->module_enable != 1 && $apikey == '' && $response['error'] != '' && $this->getSyncronizeStatus())
|
753 |
+
return false;
|
754 |
+
$result = $this->checkFolderList();
|
755 |
+
$list_name = 'magento';
|
756 |
+
$param = array();
|
757 |
+
$data = array();
|
758 |
+
$folder_id = $result[0];
|
759 |
+
$exist_list = $result[2];
|
760 |
+
if (empty($result[1]))
|
761 |
+
{
|
762 |
+
$params = array();
|
763 |
+
$params['foldername'] = 'magento';
|
764 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
765 |
+
$folder_id = $res->folder_id;
|
766 |
+
$params = array();
|
767 |
+
$params['listname'] = $list_name;
|
768 |
+
$params['list_parent'] = $folder_id; //folder id
|
769 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
770 |
+
$this->sendAllMailIDToSendin($list_response);
|
771 |
+
} elseif (empty($exist_list))
|
772 |
+
{
|
773 |
+
$params = array();
|
774 |
+
$params['listname'] = $list_name;
|
775 |
+
$params['list_parent'] = $folder_id; //folder id
|
776 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
777 |
+
$this->sendAllMailIDToSendin($list_response);
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
/**
|
782 |
+
* folder create in Sendinblue after installing
|
783 |
+
*/
|
784 |
+
public function createFolderName($api_key)
|
785 |
+
{
|
786 |
+
$this->api_key = $api_key;
|
787 |
+
$this->createAttributesName();
|
788 |
+
$result = $this->checkFolderList();
|
789 |
+
if (empty($result[1]))
|
790 |
+
{
|
791 |
+
$params = array();
|
792 |
+
$params['foldername'] = 'magento';
|
793 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
794 |
+
$folder_id = $res->folder_id;
|
795 |
+
$exist_list = '';
|
796 |
+
} else
|
797 |
+
{
|
798 |
+
$folder_id = $result[0];
|
799 |
+
$exist_list = $result[2];
|
800 |
+
}
|
801 |
+
$this->createNewList($folder_id, $exist_list);
|
802 |
+
$this->partnerMagento();
|
803 |
+
}
|
804 |
+
|
805 |
+
/**
|
806 |
+
* Method is used to add the partner's name in Sendinblue.
|
807 |
+
* In this case its "MAGENTO".
|
808 |
+
*/
|
809 |
+
public function partnerMagento()
|
810 |
+
{
|
811 |
+
$params = array();
|
812 |
+
$params['partner'] = 'MAGENTO';
|
813 |
+
$this->callServer('MAILIN-PARTNER', $params);
|
814 |
+
}
|
815 |
+
|
816 |
+
/**
|
817 |
+
* Creates a list by the name "magento" on user's Sendinblue account.
|
818 |
+
*/
|
819 |
+
public function createNewList($response, $exist_list)
|
820 |
+
{
|
821 |
+
if ($exist_list != '')
|
822 |
+
{
|
823 |
+
$date = date('dmY');
|
824 |
+
$list_name = 'magento_'.$date;
|
825 |
+
}
|
826 |
+
else
|
827 |
+
$list_name = 'magento';
|
828 |
+
$params = array();
|
829 |
+
$params['listname'] = $list_name;
|
830 |
+
$params['list_parent'] = $response;
|
831 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
832 |
+
$this->sendAllMailIDToSendin($list_response);
|
833 |
+
$this->createAttributesName();
|
834 |
+
}
|
835 |
+
|
836 |
+
/**
|
837 |
+
* Fetch attributes and their values
|
838 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
839 |
+
*/
|
840 |
+
public function allAttributesName()
|
841 |
+
{
|
842 |
+
if ($this->user_language == 'fr')
|
843 |
+
$params = array('PRENOM'=>'firstname', 'NOM'=>'lastname', 'MAGENTO_LANG'=>'created_in','CLIENT'=>'client','SMS'=>'telephone','COMPANY'=>'company','CITY'=>'city','COUNTRY_ID'=>'country_id','POSTCODE'=>'postcode','STREET'=>'street','REGION'=>'region','STORE_ID'=>'store_id');
|
844 |
+
else
|
845 |
+
$params = array('NAME'=>'firstname', 'SURNAME'=>'lastname', 'MAGENTO_LANG'=>'created_in','CLIENT'=>'client','SMS'=>'telephone','COMPANY'=>'company','CITY'=>'city','COUNTRY_ID'=>'country_id','POSTCODE'=>'postcode','STREET'=>'street','REGION'=>'region','STORE_ID'=>'store_id');
|
846 |
+
return $params;
|
847 |
+
}
|
848 |
+
|
849 |
+
/**
|
850 |
+
* Fetch attributes name and type
|
851 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
852 |
+
*/
|
853 |
+
public function allAttributesType()
|
854 |
+
{
|
855 |
+
if ($this->user_language == 'fr')
|
856 |
+
$params = array('PRENOM'=>'text', 'NOM'=>'text', 'MAGENTO_LANG'=>'text','CLIENT'=>'number','SMS'=>'text','COMPANY'=>'text','CITY'=>'text','COUNTRY_ID'=>'text','POSTCODE'=>'number','STREET'=>'text','REGION'=>'text','STORE_ID'=>'number');
|
857 |
+
else
|
858 |
+
$params = array('NAME'=>'text', 'SURNAME'=>'text', 'MAGENTO_LANG'=>'text','CLIENT'=>'number','SMS'=>'text','COMPANY'=>'text','CITY'=>'text','COUNTRY_ID'=>'text','POSTCODE'=>'number','STREET'=>'text','REGION'=>'text','STORE_ID'=>'number');
|
859 |
+
return $params;
|
860 |
+
}
|
861 |
+
|
862 |
+
/**
|
863 |
+
* Fetch all Transactional Attributes
|
864 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
865 |
+
*/
|
866 |
+
public function allTransactionalAttributes()
|
867 |
+
{
|
868 |
+
$params = array('ORDER_ID'=>'id', 'ORDER_DATE'=>'date', 'ORDER_PRICE'=>'number');
|
869 |
+
return $params;
|
870 |
+
}
|
871 |
+
|
872 |
+
/**
|
873 |
+
* Create Normal, Transactional, Calculated and Global attributes and their values
|
874 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
875 |
+
*/
|
876 |
+
public function createAttributesName()
|
877 |
+
{
|
878 |
+
$params = array();
|
879 |
+
$attrData = array();
|
880 |
+
$transData = array();
|
881 |
+
$attributesName = $this->allAttributesName();
|
882 |
+
$attributesType = $this->allAttributesType();
|
883 |
+
$tranArray = $this->allTransactionalAttributes();
|
884 |
+
$keyValue = array_keys($attributesName);
|
885 |
+
foreach ($keyValue as $value)
|
886 |
+
{
|
887 |
+
$attr = $attributesType[$value];
|
888 |
+
$attrData[] = $value.','.$attr;
|
889 |
+
}
|
890 |
+
$normalAttributes = implode('|', $attrData);
|
891 |
+
$tranKey = array_keys($tranArray);
|
892 |
+
$params['normal_attributes'] = $normalAttributes;
|
893 |
+
foreach ($tranKey as $value)
|
894 |
+
{
|
895 |
+
$attr = $tranArray[$value];
|
896 |
+
$transData[] = $value.','.$attr;
|
897 |
+
}
|
898 |
+
$transAttributes = implode('|', $transData);
|
899 |
+
$params['transactional_attributes'] = $transAttributes;
|
900 |
+
$this->callServer('ATTRIBUTES_CREATION', $params);
|
901 |
+
}
|
902 |
+
/**
|
903 |
+
* Method is used to send all the subscribers from magento to
|
904 |
+
* Sendinblue for adding / updating purpose.
|
905 |
+
*/
|
906 |
+
public function sendAllMailIDToSendin($list)
|
907 |
+
{
|
908 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
909 |
+
$allemail = $this->getcustomers();
|
910 |
+
if ($allemail > 0)
|
911 |
+
{
|
912 |
+
$params = array();
|
913 |
+
$params['webaction'] = 'IMPORTUSERS';
|
914 |
+
$params['key'] = $this->api_key;
|
915 |
+
$params['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
916 |
+
$params['listids'] = $list->result;
|
917 |
+
$params['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
918 |
+
$responce_data = $this->curlRequestAsyc($params);
|
919 |
+
$res_value = json_decode($responce_data);
|
920 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 0, 'default', 0);
|
921 |
+
if (empty($res_value->process_id))
|
922 |
+
{
|
923 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 1);
|
924 |
+
}
|
925 |
+
}
|
926 |
+
$sendin_switch->saveConfig('sendinblue/list', $list->result, 'default', 0);
|
927 |
+
}
|
928 |
+
|
929 |
+
/**
|
930 |
+
* Send SMS from Sendin.
|
931 |
+
*/
|
932 |
+
public function sendSmsApi($array)
|
933 |
+
{
|
934 |
+
$params = array();
|
935 |
+
$params['key'] = $this->api_key;
|
936 |
+
$params['to'] = $array['to'];
|
937 |
+
$params['from'] = $array['from'];
|
938 |
+
$params['text'] = $array['text'];
|
939 |
+
return $this->callServer('SENDSMS', $params);
|
940 |
+
}
|
941 |
+
|
942 |
+
public function sendOrder($mobile)
|
943 |
+
{
|
944 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
945 |
+
if (isset($mobile))
|
946 |
+
{
|
947 |
+
$arr = array();
|
948 |
+
$arr['to'] = $mobile;
|
949 |
+
$arr['from'] = $this->getSendSmsOrderSubject();
|
950 |
+
$arr['text'] = $this->getSendSmsmOrderMessage();
|
951 |
+
|
952 |
+
return $result = $this->sendSmsApi($arr);
|
953 |
+
}
|
954 |
+
}
|
955 |
+
|
956 |
+
public function notifySmsEmail()
|
957 |
+
{
|
958 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
959 |
+
|
960 |
+
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->module_enable == 1 && $this->getNotifySmsStatus() == 1)
|
961 |
+
{
|
962 |
+
if($this->getNotifyCronStatus() == 0)
|
963 |
+
{
|
964 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
965 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
966 |
+
$email_template_variables = array();
|
967 |
+
if ($locale == 'fr_FR')
|
968 |
+
{
|
969 |
+
$email_template_variables['text0'] = ' [SendinBlue] Alerte: Vos crédits SMS seront bientôt épuisés';
|
970 |
+
$sender_name = 'SendinBlue';
|
971 |
+
$sender_email = 'contact@sendinblue.com';
|
972 |
+
}
|
973 |
+
else
|
974 |
+
{
|
975 |
+
$email_template_variables['text0'] = '[SendinBlue] Alert: You do not have enough credits SMS';
|
976 |
+
$sender_name = 'SendinBlue';
|
977 |
+
$sender_email = 'contact@sendinblue.com';
|
978 |
+
}
|
979 |
+
$email = $this->getNotifyEmailStatus();
|
980 |
+
|
981 |
+
$email_template = Mage::getModel('core/email_template')->loadDefault('notification_template');
|
982 |
+
$temp = $email_template->template_text;
|
983 |
+
$web_site = Mage::app()->getWebsite()->getName();
|
984 |
+
$credit = $this->getSmsCredit();
|
985 |
+
preg_match_all('#{(.*)}#', $temp, $match);
|
986 |
+
|
987 |
+
$temp_params = array(
|
988 |
+
'{site_name}'=>$web_site,
|
989 |
+
'{present_credit}'=>$credit
|
990 |
+
);
|
991 |
+
foreach($match[0] as $var=>$value){
|
992 |
+
$temp = preg_replace('#'.$value.'#',$temp_params[$value],$temp);
|
993 |
+
}
|
994 |
+
$email_template->template_text = $temp;
|
995 |
+
$email_template->getProcessedTemplate($email_template_variables);
|
996 |
+
$email_template->setSenderName($sender_name);
|
997 |
+
$email_template->setSenderEmail($sender_email);
|
998 |
+
$email_template->setTemplateSubject($email_template_variables['text0']);
|
999 |
+
$email_template->send($email, '', $email_template_variables);
|
1000 |
+
}
|
1001 |
+
}
|
1002 |
+
else
|
1003 |
+
{
|
1004 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
Mage::getModel('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
/**
|
1011 |
+
* show SMS credit from Sendinblue.
|
1012 |
+
*/
|
1013 |
+
public function getSmsCredit()
|
1014 |
+
{
|
1015 |
+
$params = array();
|
1016 |
+
$params['key'] = $this->api_key;
|
1017 |
+
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
1018 |
+
|
1019 |
+
foreach($result as $val)
|
1020 |
+
{
|
1021 |
+
if(is_object($val)){
|
1022 |
+
if($val->plan_type=='SMS')
|
1023 |
+
{
|
1024 |
+
return $val->credits;
|
1025 |
+
}
|
1026 |
+
}
|
1027 |
+
}
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Method is used to send test email to the user.
|
1032 |
+
*/
|
1033 |
+
public function sendTestMail($email)
|
1034 |
+
{
|
1035 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
1036 |
+
$email_template_variables = array();
|
1037 |
+
if ($locale == 'fr_FR')
|
1038 |
+
{
|
1039 |
+
$email_template_variables['text0'] = '[SendinBlue SMTP] e-mail de test';
|
1040 |
+
$sender_name = 'SendinBlue';
|
1041 |
+
$sender_email = 'contact@sendinblue.com';
|
1042 |
+
}
|
1043 |
+
else
|
1044 |
+
{
|
1045 |
+
$email_template_variables['text0'] = '[SendinBlue SMTP] test email';
|
1046 |
+
$sender_name = 'SendinBlue';
|
1047 |
+
$sender_email = 'contact@sendinblue.com';
|
1048 |
+
}
|
1049 |
+
try {
|
1050 |
+
$email_template = Mage::getModel('core/email_template')->loadDefault('custom_template');
|
1051 |
+
$email_template->getProcessedTemplate($email_template_variables);
|
1052 |
+
$email_template->setSenderName($sender_name);
|
1053 |
+
$email_template->setSenderEmail($sender_email);
|
1054 |
+
$email_template->setTemplateSubject($email_template_variables['text0']);
|
1055 |
+
return $email_template->send($email, '', $email_template_variables);
|
1056 |
+
}
|
1057 |
+
catch(Exception $e) {
|
1058 |
+
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
/**
|
1063 |
+
* This method is used to compare key and value
|
1064 |
+
* return all value in array whose present in array key
|
1065 |
+
*/
|
1066 |
+
public function merge_my_array($one, $two)
|
1067 |
+
{
|
1068 |
+
$resArr = array();
|
1069 |
+
if (count($one) > 0) {
|
1070 |
+
foreach($one as $k => $v) {
|
1071 |
+
$resArr[$k] = isset($two[$v])?$two[$v]:'';
|
1072 |
+
}
|
1073 |
+
}
|
1074 |
+
return $resArr;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
/**
|
1078 |
+
* This method is used to fetch all users from the default customer table to list
|
1079 |
+
* them in the Sendinblue magento module.
|
1080 |
+
*/
|
1081 |
+
public function getcustomers()
|
1082 |
+
{
|
1083 |
+
$data = array();
|
1084 |
+
$customer_addr_data = array();
|
1085 |
+
$attributesName = $this->allAttributesName();
|
1086 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
1087 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1088 |
+
foreach ($collection as $customer)
|
1089 |
+
{
|
1090 |
+
$start_detail = array();
|
1091 |
+
$resp = array();
|
1092 |
+
$respone = array();
|
1093 |
+
|
1094 |
+
$respone = $customer->getData();
|
1095 |
+
$email = $respone['email'];
|
1096 |
+
$cid = $respone['entity_id'];
|
1097 |
+
$user_lang = $respone['created_in'];
|
1098 |
+
|
1099 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$cid);
|
1100 |
+
$telephone = '';
|
1101 |
+
$customer_addr = array();
|
1102 |
+
foreach ($collectionAddress as $customerPhno) {
|
1103 |
+
$customer_addr = $customerPhno->getData();
|
1104 |
+
$customer_addr['client'] = $cid>0?1:0;
|
1105 |
+
}
|
1106 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
1107 |
+
}
|
1108 |
+
$newsletterArr = array();
|
1109 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
1110 |
+
$cnt = 0;
|
1111 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
1112 |
+
{
|
1113 |
+
$subsdata = $subscriber->getData();
|
1114 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
1115 |
+
|
1116 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
1117 |
+
$customer_addr_data[$subscriber_email]['email'] = $subscriber_email;
|
1118 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
1119 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1120 |
+
}
|
1121 |
+
else
|
1122 |
+
{
|
1123 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
1124 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
1125 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1126 |
+
$resp[$cnt]['STORE_ID'] = $subsdata['store_id'];
|
1127 |
+
}
|
1128 |
+
$cnt++;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
1132 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
1133 |
+
|
1134 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
1135 |
+
$key_value = array_keys($attributesName);
|
1136 |
+
$key_value[] = 'EMAIL';
|
1137 |
+
fwrite($handle, implode(',', $key_value)."\n");
|
1138 |
+
|
1139 |
+
foreach ($resp as $newsdata)
|
1140 |
+
{
|
1141 |
+
if(!empty($newsdata['COUNTRY_ID']) && !empty($newsdata['SMS']))
|
1142 |
+
{
|
1143 |
+
$country_id = $this->getCountryCode($newsdata['COUNTRY_ID']);
|
1144 |
+
$newsdata['SMS'] = $this->checkMobileNumber($newsdata['SMS'], $country_id);
|
1145 |
+
}
|
1146 |
+
$key_value = $newsdata;
|
1147 |
+
fwrite($handle, str_replace("\n", "",implode(',', $key_value))."\n");
|
1148 |
+
}
|
1149 |
+
fclose($handle);
|
1150 |
+
$total_value = count($resp);
|
1151 |
+
return $total_value;
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
/**
|
1155 |
+
* This method is used to fetch all users from the default newsletter table to list
|
1156 |
+
* them in the Sendinblue magento module.
|
1157 |
+
*/
|
1158 |
+
public function getNewsletterSubscribe($start, $per_page)
|
1159 |
+
{
|
1160 |
+
$customer_addr_data = array();
|
1161 |
+
$attributesName = $this->allAttributesName();
|
1162 |
+
$attributesName['email'] = 'email';
|
1163 |
+
$attributesName['customer_id'] = 'entity_id';
|
1164 |
+
|
1165 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
1166 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1167 |
+
foreach ($collection as $customer)
|
1168 |
+
{
|
1169 |
+
$start_detail = array();
|
1170 |
+
$respone = array();
|
1171 |
+
$respone = $customer->getData();
|
1172 |
+
$email = $respone['email'];
|
1173 |
+
$cid = $respone['entity_id'];
|
1174 |
+
$user_lang = $respone['created_in'];
|
1175 |
+
|
1176 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
1177 |
+
$telephone = '';
|
1178 |
+
$customer_addr = array();
|
1179 |
+
foreach ($collectionAddress as $customerPhno) {
|
1180 |
+
$customer_addr = $customerPhno->getData();
|
1181 |
+
if (!empty($customer_addr['telephone']) && !empty($customer_addr['country_id']))
|
1182 |
+
{
|
1183 |
+
$country_code = $this->getCountryCode($customer_addr['country_id']);
|
1184 |
+
$customer_addr['telephone'] = $this->checkMobileNumber($customer_addr['telephone'], $country_code);
|
1185 |
+
}
|
1186 |
+
$customer_addr['client'] = $cid>0?1:0;
|
1187 |
+
}
|
1188 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
$newsletterArr = array();
|
1192 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
1193 |
+
$cnt = 0;
|
1194 |
+
$resp = array();
|
1195 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
1196 |
+
{
|
1197 |
+
$subsdata = $subscriber->getData();
|
1198 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
1199 |
+
$subscriber_status = $subsdata['subscriber_status'];
|
1200 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
1201 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
1202 |
+
unset($customer_addr_data[$subscriber_email]);
|
1203 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1204 |
+
$resp[$cnt]['email'] = $subscriber_email;
|
1205 |
+
}
|
1206 |
+
else
|
1207 |
+
{
|
1208 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
1209 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
1210 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1211 |
+
$resp[$cnt]['email'] = $subscriber_email;
|
1212 |
+
}
|
1213 |
+
$cnt++;
|
1214 |
+
}
|
1215 |
+
if (count($customer_addr_data) > 0) {
|
1216 |
+
foreach ($customer_addr_data as $email => $cVal) {
|
1217 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $cVal);
|
1218 |
+
$resp[$cnt]['subscriber_status'] = 3;
|
1219 |
+
$resp[$cnt]['email'] = $email;
|
1220 |
+
|
1221 |
+
$cnt++;
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
return array_slice($resp, $start, $per_page, true);
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
/**
|
1228 |
+
* This method is used to fetch total count unsubscribe users from the default newsletter table to list
|
1229 |
+
* them in the Sendinblue magento module.
|
1230 |
+
*/
|
1231 |
+
public function getNewsletterUnSubscribeCount()
|
1232 |
+
{
|
1233 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1234 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
1235 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1236 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableCustomer.' CE
|
1237 |
+
LEFT JOIN '.$tableNewsletter.' NS
|
1238 |
+
ON CE.entity_id=NS.customer_id WHERE subscriber_status != 1 or subscriber_status is null';
|
1239 |
+
$unsubs_count1 = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1240 |
+
|
1241 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableNewsletter.' WHERE customer_id = 0 AND subscriber_status = 3';
|
1242 |
+
$unsubs_count2 = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1243 |
+
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
/**
|
1247 |
+
* This method is used to fetch total count subscribe users from the default newsletter table to list
|
1248 |
+
* them in the Sendinblue magento module.
|
1249 |
+
*/
|
1250 |
+
public function getNewsletterSubscribeCount()
|
1251 |
+
{
|
1252 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1253 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1254 |
+
$sql = 'SELECT count(*) as totalvalue from '.$tableNewsletter.' where subscriber_status = 1';
|
1255 |
+
$data = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1256 |
+
return $data['totalvalue'];
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
/**
|
1260 |
+
* This method is used to check the subscriber's newsletter subscription status in Sendinblue
|
1261 |
+
*/
|
1262 |
+
public function checkUserSendinStatus($result)
|
1263 |
+
{
|
1264 |
+
$userstatus = array();
|
1265 |
+
foreach ($result as $subscriber)
|
1266 |
+
$userstatus[] = $subscriber['email'];
|
1267 |
+
$email = implode(',', $userstatus);
|
1268 |
+
$params = array();
|
1269 |
+
$params['key'] = $this->api_key;
|
1270 |
+
$params['email'] = $email;
|
1271 |
+
$response = $this->callServer('USERS-STATUS-BLACKLIST', $params);
|
1272 |
+
$response = json_encode($response);
|
1273 |
+
return json_decode($response, true);
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
/**
|
1277 |
+
* Fetches the SMTP and order tracking details
|
1278 |
+
*/
|
1279 |
+
public function TrackingSmtp()
|
1280 |
+
{
|
1281 |
+
$params = array();
|
1282 |
+
$params['key'] = $this->api_key;
|
1283 |
+
return $this->callServer('TRACKINGDATA', $params);
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
/**
|
1287 |
+
* CURL function to send request to the Sendinblue API server
|
1288 |
+
*/
|
1289 |
+
public function callServer($method, $params)
|
1290 |
+
{
|
1291 |
+
$host = $this->api_url;
|
1292 |
+
$params['key'] = (isset($params['key']) && !empty($params['key'])) ? $params['key'] : $this->api_key;
|
1293 |
+
$params['webaction'] = $method;
|
1294 |
+
$this->error_message = '';
|
1295 |
+
$this->error_code = '';
|
1296 |
+
$response = $this->curlRequest($params);
|
1297 |
+
return json_decode($response);
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
/**
|
1301 |
+
* CURL function to send request to the Sendinblue API server
|
1302 |
+
*/
|
1303 |
+
public function curlRequest($data)
|
1304 |
+
{
|
1305 |
+
$url = $this->api_url; // WS URL
|
1306 |
+
$ch = curl_init();
|
1307 |
+
$ndata = '';
|
1308 |
+
$data['source'] = 'MagentoNew';
|
1309 |
+
if (is_array($data))
|
1310 |
+
{
|
1311 |
+
foreach ($data as $key => $value)
|
1312 |
+
$ndata .= $key.'='.urlencode($value).'&';
|
1313 |
+
}
|
1314 |
+
else
|
1315 |
+
$ndata = $data;
|
1316 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1317 |
+
'Expect:', 'sib-plugin:magento-1.2.6'
|
1318 |
+
));
|
1319 |
+
|
1320 |
+
$ndata = trim($ndata,'&');
|
1321 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1322 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
1323 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1324 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1325 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1326 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1327 |
+
$data2 = curl_exec($ch);
|
1328 |
+
curl_close($ch);
|
1329 |
+
return $data2;
|
1330 |
+
}
|
1331 |
+
/**
|
1332 |
+
* CURL function to send request to the Sendinblue API server
|
1333 |
+
*/
|
1334 |
+
public function curlRequestAsyc($data)
|
1335 |
+
{
|
1336 |
+
$url = $this->api_url; // WS URL
|
1337 |
+
$ch = curl_init();
|
1338 |
+
$ndata = '';
|
1339 |
+
$data['source'] = 'MagentoNew';
|
1340 |
+
if (is_array($data))
|
1341 |
+
{
|
1342 |
+
foreach ($data as $key => $value)
|
1343 |
+
$ndata .= $key.'='.urlencode($value).'&';
|
1344 |
+
}
|
1345 |
+
else
|
1346 |
+
$ndata = $data;
|
1347 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1348 |
+
'Expect:', 'sib-plugin:magento-1.2.6'
|
1349 |
+
));
|
1350 |
+
|
1351 |
+
$ndata = trim($ndata,'&');
|
1352 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1353 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
1354 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1355 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1356 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
|
1357 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1358 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1359 |
+
$data2 = curl_exec($ch);
|
1360 |
+
curl_close($ch);
|
1361 |
+
return $data2;
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
public function removeOldEntry()
|
1365 |
+
{
|
1366 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
1367 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', '');
|
1368 |
+
$sendin_switch->saveConfig('sendinblue/smtp/authentication', '');
|
1369 |
+
$sendin_switch->saveConfig('sendinblue/smtp/username', '');
|
1370 |
+
$sendin_switch->saveConfig('sendinblue/smtp/password', '');
|
1371 |
+
$sendin_switch->saveConfig('sendinblue/smtp/host', '');
|
1372 |
+
$sendin_switch->saveConfig('sendinblue/smtp/port', '');
|
1373 |
+
$sendin_switch->saveConfig('sendinblue/smtp/ssl', '');
|
1374 |
+
$sendin_switch->saveConfig('sendinblue/smtp/option', '');
|
1375 |
+
$sendin_switch->saveConfig('sendinblue/tracking/code', '');
|
1376 |
+
}
|
1377 |
+
protected function _uninstallResourceDb($version)
|
1378 |
+
{
|
1379 |
+
Mage::dispatchEvent('module_uninstall', array('resource' => $this->_resourceName));
|
1380 |
+
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1381 |
+
return $this;
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
/**
|
1385 |
+
* This method is used to fetch all subscribe users from the default customer table to list
|
1386 |
+
* them in the Sendinblue magento module.
|
1387 |
+
*/
|
1388 |
+
public function smsCampaignList()
|
1389 |
+
{
|
1390 |
+
$customer_addr_data = array();
|
1391 |
+
$attributesName = $this->allAttributesName();
|
1392 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
1393 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1394 |
+
foreach ($collection as $customer)
|
1395 |
+
{
|
1396 |
+
$start_detail = array();
|
1397 |
+
$resp = array();
|
1398 |
+
$respone = array();
|
1399 |
+
|
1400 |
+
$respone = $customer->getData();
|
1401 |
+
$email = $respone['email'];
|
1402 |
+
$cid = $respone['entity_id'];
|
1403 |
+
$user_lang = $respone['created_in'];
|
1404 |
+
|
1405 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$cid);
|
1406 |
+
$telephone = '';
|
1407 |
+
$customer_addr = array();
|
1408 |
+
foreach ($collectionAddress as $customerPhno) {
|
1409 |
+
$customer_addr = $customerPhno->getData();
|
1410 |
+
if (!empty($customer_addr['telephone']) && !empty($customer_addr['country_id']))
|
1411 |
+
{
|
1412 |
+
$country_code = $this->getCountryCode($customer_addr['country_id']);
|
1413 |
+
$customer_addr['telephone'] = $this->checkMobileNumber($customer_addr['telephone'], $country_code);
|
1414 |
+
}
|
1415 |
+
$customer_addr['client'] = $cid>0?1:0;
|
1416 |
+
}
|
1417 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
1418 |
+
}
|
1419 |
+
$newsletterArr = array();
|
1420 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
1421 |
+
$cnt = 0;
|
1422 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
1423 |
+
{
|
1424 |
+
$subsdata = $subscriber->getData();
|
1425 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
1426 |
+
$subscriber_status = $subsdata['subscriber_status'];
|
1427 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
1428 |
+
$customer_addr_data[$subscriber_email]['email'] = $subscriber_email;
|
1429 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
1430 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1431 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1432 |
+
}
|
1433 |
+
else
|
1434 |
+
{
|
1435 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
1436 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
1437 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1438 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1439 |
+
$resp[$cnt]['STORE_ID'] = $subsdata['store_id'];
|
1440 |
+
}
|
1441 |
+
$cnt++;
|
1442 |
+
}
|
1443 |
+
$i = 0;
|
1444 |
+
$data = array();
|
1445 |
+
foreach($resp as $result)
|
1446 |
+
{
|
1447 |
+
if(!empty($result['SMS']))
|
1448 |
+
{
|
1449 |
+
$data[$i]= $result;
|
1450 |
+
}
|
1451 |
+
$i++;
|
1452 |
+
}
|
1453 |
+
return json_encode($data);
|
1454 |
+
}
|
1455 |
+
/**
|
1456 |
+
* API config value from SendinBlue.
|
1457 |
+
*/
|
1458 |
+
public function getApiConfigValue()
|
1459 |
+
{
|
1460 |
+
$data = array();
|
1461 |
+
$data['key'] = $this->api_key;
|
1462 |
+
$data['webaction'] = 'PLUGIN-CONFIG';
|
1463 |
+
$value_config = $this->curlRequest($data);
|
1464 |
+
$result = json_decode($value_config);
|
1465 |
+
return $result;
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
/**
|
1469 |
+
* Send template email by sendinblue for newsletter subscriber user .
|
1470 |
+
*/
|
1471 |
+
public function sendWsTemplateMail($to, $templateid = false)
|
1472 |
+
{
|
1473 |
+
$mail_url = "http://mysmtp.mailin.fr/ws/template/"; //Curl url
|
1474 |
+
|
1475 |
+
$Sendin_Confirm_Type = $this->getSubscribeConfirmType();
|
1476 |
+
if (empty($Sendin_Confirm_Type) || $Sendin_Confirm_Type == 'nocon') {
|
1477 |
+
return false;
|
1478 |
+
}
|
1479 |
+
if (!$templateid) {
|
1480 |
+
if ($Sendin_Confirm_Type == 'simplemail') {
|
1481 |
+
$temp_id_value = $this->getTemplateId();
|
1482 |
+
$templateid = !empty($temp_id_value) ? $temp_id_value : '';// should be the campaign id of template created on mailin. Please remember this template should be active than only it will be sent, otherwise it will return error.
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
if ($Sendin_Confirm_Type == 'doubleoptin') {
|
1486 |
+
$path_resp = '';
|
1487 |
+
$email_user = base64_encode($to);
|
1488 |
+
$path_resp = Mage::getBaseUrl().'sendinblue/ajax/mailResponce?value='.base64_encode($to);
|
1489 |
+
return $this->defaultDoubleoptinTemp($to, $path_resp);
|
1490 |
+
}
|
1491 |
+
}
|
1492 |
+
$smtpPassword = $this->getSmtpPassword();
|
1493 |
+
$user = $this->getUserName();
|
1494 |
+
//$to = str_replace('+', '%2B', $to);
|
1495 |
+
$post_data['to'] = $to;
|
1496 |
+
$post_data['key'] = $smtpPassword;
|
1497 |
+
$post_data['user'] = $user;
|
1498 |
+
$post_data['templateid'] = $templateid;
|
1499 |
+
$post_data = http_build_query($post_data);
|
1500 |
+
$ch = curl_init();
|
1501 |
+
|
1502 |
+
curl_setopt ($ch, CURLOPT_POST, 1);
|
1503 |
+
curl_setopt ($ch, CURLOPT_URL, $mail_url);
|
1504 |
+
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
|
1505 |
+
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
|
1506 |
+
$return_data = curl_exec ($ch);
|
1507 |
+
curl_close ($ch);
|
1508 |
+
|
1509 |
+
$res = json_decode($return_data, true);
|
1510 |
+
return $res;
|
1511 |
+
}
|
1512 |
+
/**
|
1513 |
+
* send double optin template and manage.
|
1514 |
+
*/
|
1515 |
+
public function defaultDoubleoptinTemp($subscriber_email, $doubleoptin_url)
|
1516 |
+
{
|
1517 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
1518 |
+
$email_template_variables = array();
|
1519 |
+
if ($locale == 'fr_FR')
|
1520 |
+
{
|
1521 |
+
$email_template_variables['text0'] = 'Confirmez votre inscription';
|
1522 |
+
$sender_name = 'SendinBlue';
|
1523 |
+
$sender_email = 'contact@sendinblue.com';
|
1524 |
+
}
|
1525 |
+
else
|
1526 |
+
{
|
1527 |
+
$email_template_variables['text0'] = 'Please confirm your subscription';
|
1528 |
+
$sender_name = 'SendinBlue';
|
1529 |
+
$sender_email = 'contact@sendinblue.com';
|
1530 |
+
}
|
1531 |
+
try {
|
1532 |
+
$email_template = Mage::getModel('core/email_template')->loadDefault('doubleoptin_template');
|
1533 |
+
$temp = $email_template->template_text;
|
1534 |
+
$web_site = Mage::app()->getWebsite()->getName();
|
1535 |
+
preg_match_all('#{(.*)}#', $temp, $match);
|
1536 |
+
|
1537 |
+
$temp_params = array(
|
1538 |
+
'{double_optin}'=>$doubleoptin_url,
|
1539 |
+
'{site_name}'=> $web_site
|
1540 |
+
);
|
1541 |
+
foreach($match[0] as $var=>$value){
|
1542 |
+
$temp = preg_replace('#'.$value.'#',$temp_params[$value],$temp);
|
1543 |
+
}
|
1544 |
+
|
1545 |
+
$email_template->template_text = $temp;
|
1546 |
+
$email_template->getProcessedTemplate($email_template_variables);
|
1547 |
+
$email_template->setSenderName($sender_name);
|
1548 |
+
$email_template->setSenderEmail($sender_email);
|
1549 |
+
$email_template->setTemplateSubject($email_template_variables['text0']);
|
1550 |
+
return $email_template->send($subscriber_email, '', $email_template_variables);
|
1551 |
+
|
1552 |
+
}
|
1553 |
+
catch(Exception $e) {
|
1554 |
+
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
/**
|
1560 |
+
* Get all temlpate list id by sendinblue.
|
1561 |
+
*/
|
1562 |
+
public function templateDisplay()
|
1563 |
+
{
|
1564 |
+
$data = array();
|
1565 |
+
$data['key'] = $this->api_key;
|
1566 |
+
$data['webaction'] = 'CAMPAIGNDETAIL';
|
1567 |
+
$data['show'] = 'ALL';
|
1568 |
+
$data['messageType'] = 'template';
|
1569 |
+
return json_decode($this->curlRequest($data));
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
/**
|
1573 |
+
* Get getCountryCode from sendinblue_country table,
|
1574 |
+
*/
|
1575 |
+
public function getCountryCode($countryid)
|
1576 |
+
{
|
1577 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
1578 |
+
$sql = 'SELECT country_prefix FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'"';
|
1579 |
+
$country_id = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
1580 |
+
$country_prefix = $country_id['country_prefix'];
|
1581 |
+
return $country_prefix;
|
1582 |
+
}
|
1583 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php
RENAMED
File without changes
|
app/code/community/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
ADDED
@@ -0,0 +1,593 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
+
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$params = Mage::app()->getRequest()->getParams();
|
16 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != '')
|
17 |
+
$this->CreateFolderCaseTwo();
|
18 |
+
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->renderLayout();
|
21 |
+
}
|
22 |
+
public function syncronizepostAction()
|
23 |
+
{
|
24 |
+
$post = $this->getRequest()->getPost();
|
25 |
+
try {
|
26 |
+
if (empty($post))
|
27 |
+
Mage::throwException($this->__('Invalid form data.'));
|
28 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
29 |
+
|
30 |
+
if (isset($post['syncronizeSubmit']))
|
31 |
+
{
|
32 |
+
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
33 |
+
if (!empty($post['subscribe_confirm_type']))
|
34 |
+
{
|
35 |
+
$sendin_switch->saveConfig('sendinblue/SendinSubscribeConfirmType', $post['subscribe_confirm_type']);
|
36 |
+
$sendin_switch->saveConfig('sendinblue/SendinTemplateId', $post['template_simple']);
|
37 |
+
$sendin_switch->saveConfig('sendinblue/SendinOptinRedirectUrlCheck', $post['optin_redirect_url_check']);
|
38 |
+
$sendin_switch->saveConfig('sendinblue/SendinDoubleoptinRedirectUrl', $post['doubleoptin-redirect-url']);
|
39 |
+
$sendin_switch->saveConfig('sendinblue/SendinFinalConfirmEmail', $post['final_confirm_email']);
|
40 |
+
$sendin_switch->saveConfig('sendinblue/SendinTemplateFinal', $post['template_final']);
|
41 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
42 |
+
if ($post['subscribe_confirm_type'] === 'doubleoptin') {
|
43 |
+
$res_optin = $sendinModule->checkFolderListDoubleoptin();
|
44 |
+
if (!empty($res_optin['optin_id'])) {
|
45 |
+
$sendin_switch->saveConfig('sendinblue/SendinOptinListId', $res_optin['optin_id']);
|
46 |
+
}
|
47 |
+
if ($res_optin === false) {
|
48 |
+
$optin_id = $sendinModule->createListIdDoubleoptin();
|
49 |
+
$sendin_switch->saveConfig('sendinblue/SendinOptinListId', $optin_id);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$message = $this->__('Your setting has been successfully saved');
|
53 |
+
}
|
54 |
+
|
55 |
+
if (!empty($post['sendin_list']))
|
56 |
+
{
|
57 |
+
$list = implode('|', $post['sendin_list']);
|
58 |
+
$sendin_switch->saveConfig('sendinblue/list', $list);
|
59 |
+
$message = $this->__('Your setting has been successfully saved');
|
60 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
61 |
+
} else
|
62 |
+
{
|
63 |
+
$message = $this->__('Please select a list');
|
64 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
catch (Exception $e)
|
69 |
+
{
|
70 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
71 |
+
}
|
72 |
+
$this->_redirect('*/*');
|
73 |
+
}
|
74 |
+
|
75 |
+
public function reimportpostAction()
|
76 |
+
{
|
77 |
+
$post = $this->getRequest()->getPost();
|
78 |
+
try {
|
79 |
+
if (empty($post))
|
80 |
+
Mage::throwException($this->__('Invalid form data.'));
|
81 |
+
|
82 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
83 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
84 |
+
if (isset($post['importoldSubmit']) && !empty($post['importoldSubmit']))
|
85 |
+
{
|
86 |
+
$list = $sendinModule->getUserlists();
|
87 |
+
$list_id = str_replace('|', ',', $list);
|
88 |
+
$apikey = $sendinModule->getApiKey();
|
89 |
+
$allemail = $sendinModule->getcustomers();
|
90 |
+
if ($allemail > 0)
|
91 |
+
{
|
92 |
+
$params = array();
|
93 |
+
$params['webaction'] = 'IMPORTUSERS';
|
94 |
+
$params['key'] = $apikey;
|
95 |
+
$params['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
96 |
+
$params['listids'] = $list_id;
|
97 |
+
$params['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
98 |
+
$responce_data = $sendinModule->curlRequestAsyc($params);
|
99 |
+
|
100 |
+
$res_value = json_decode($responce_data);
|
101 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 0);
|
102 |
+
if (empty($res_value->process_id))
|
103 |
+
{
|
104 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 1);
|
105 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
106 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
107 |
+
}
|
108 |
+
else
|
109 |
+
{
|
110 |
+
$message = $this->__('Your setting has been successfully saved');
|
111 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
catch (Exception $e)
|
117 |
+
{
|
118 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
119 |
+
}
|
120 |
+
$this->_redirect('*/*');
|
121 |
+
}
|
122 |
+
|
123 |
+
public function apikeypostAction()
|
124 |
+
{
|
125 |
+
$post = $this->getRequest()->getPost();
|
126 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
127 |
+
try {
|
128 |
+
if (empty($post))
|
129 |
+
Mage::throwException($this->__('Invalid form data.'));
|
130 |
+
elseif (isset($post['sendin_apikey']) && !empty($post['sendin_apikey']))
|
131 |
+
{
|
132 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
133 |
+
$result = $sendinModule->checkApikey(trim($post['sendin_apikey']));
|
134 |
+
if (empty($result['error']))
|
135 |
+
{
|
136 |
+
$get_key = $sendinModule->getApiKey();
|
137 |
+
if ($get_key == '')
|
138 |
+
$sendinModule->createFolderName($post['sendin_apikey']);
|
139 |
+
elseif ($get_key != $post['sendin_apikey'])
|
140 |
+
$sendinModule->createFolderName($post['sendin_apikey']);
|
141 |
+
|
142 |
+
$sendin_switch->saveConfig('sendinblue/api', trim($post['sendin_apikey']));
|
143 |
+
$sendin_switch->saveConfig('sendinblue/enabled', $post['sendin_api_status']);
|
144 |
+
$sendin_switch->saveConfig('sendinblue/syncronize', 1);
|
145 |
+
$sendinModule->removeOldEntry();
|
146 |
+
if($sendinModule->getImportOldSubsStatus() == 1)
|
147 |
+
{
|
148 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
149 |
+
Mage::getModel('core/session')->addError($message);
|
150 |
+
}
|
151 |
+
else
|
152 |
+
{
|
153 |
+
$message = $this->__('Your setting has been successfully saved');
|
154 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
155 |
+
}
|
156 |
+
|
157 |
+
} else if (isset($result['error']))
|
158 |
+
{
|
159 |
+
$message = $this->__('You have entered wrong api key');
|
160 |
+
Mage::getModel('core/session')->addError($message);
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
catch (Exception $e)
|
165 |
+
{
|
166 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
167 |
+
}
|
168 |
+
$this->_redirect('*/*');
|
169 |
+
}
|
170 |
+
public function sendmailAction()
|
171 |
+
{
|
172 |
+
$post = $this->getRequest()->getPost();
|
173 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
174 |
+
try {
|
175 |
+
if (empty($post))
|
176 |
+
Mage::throwException($this->__('Invalid form data.'));
|
177 |
+
elseif (isset($post['SmtpSubmit']) && !empty($post['SmtpSubmit']))
|
178 |
+
{
|
179 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
180 |
+
$get_key = $sendinModule->getApiKey();
|
181 |
+
$result = $sendinModule->checkApikey($get_key);
|
182 |
+
if (empty($result['error']))
|
183 |
+
{
|
184 |
+
$smtp_response = $sendinModule->TrackingSmtp(); // get tracking code
|
185 |
+
|
186 |
+
if ($smtp_response->result->relay_data->status == 'enabled')
|
187 |
+
{
|
188 |
+
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
189 |
+
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
190 |
+
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
191 |
+
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
192 |
+
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
193 |
+
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
194 |
+
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
195 |
+
if ($post['email'])
|
196 |
+
{
|
197 |
+
$data11 = $sendinModule->sendTestMail($post['email']);
|
198 |
+
$resArr = json_decode($data11, true);
|
199 |
+
if ($resArr['result'] != true) {
|
200 |
+
$message = $this->__('Mail not sent').' '.$this->__(trim($resArr['error']));
|
201 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
202 |
+
}
|
203 |
+
else {
|
204 |
+
$message = $this->__('Mail sent!');
|
205 |
+
Mage::getModel('core/session')->addSuccess($message);
|
206 |
+
}
|
207 |
+
|
208 |
+
} else
|
209 |
+
{
|
210 |
+
$message = $this->__('Mail not sent');
|
211 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
212 |
+
}
|
213 |
+
}
|
214 |
+
else
|
215 |
+
{
|
216 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
217 |
+
$message = $this->__('Your SMTP account is not activated and therefore you can not use SendinBlue SMTP. For more informations, Please contact our support to: contact@sendinblue.com');
|
218 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
219 |
+
}
|
220 |
+
} elseif (isset($responce['error']))
|
221 |
+
{
|
222 |
+
$message = $this->__('You have entered wrong api key');
|
223 |
+
Mage::getModel('core/session')->addError($message);
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
catch (Exception $e)
|
228 |
+
{
|
229 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
230 |
+
}
|
231 |
+
$this->_redirect('*/*');
|
232 |
+
}
|
233 |
+
public function sendorderAction()
|
234 |
+
{
|
235 |
+
$post = $this->getRequest()->getPost();
|
236 |
+
try
|
237 |
+
{
|
238 |
+
if (empty($post))
|
239 |
+
Mage::throwException($this->__('Invalid form data.'));
|
240 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
241 |
+
if (isset($post['sender_order_save']))
|
242 |
+
{
|
243 |
+
$sender_order = $post['sender_order'];
|
244 |
+
$sender_order_message = $post['sender_order_message'];
|
245 |
+
|
246 |
+
if (isset($sender_order) && $sender_order == '')
|
247 |
+
{
|
248 |
+
$message = $this->__('Please fill the message field');
|
249 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
250 |
+
}
|
251 |
+
else if ($sender_order_message == '')
|
252 |
+
{
|
253 |
+
$message = $this->__('Please fill the message field');
|
254 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
255 |
+
}
|
256 |
+
else
|
257 |
+
{
|
258 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order', $sender_order);
|
259 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order_Message', $sender_order_message);
|
260 |
+
$message = $this->__('Your setting has been successfully saved');
|
261 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
265 |
+
}
|
266 |
+
catch (Exception $e)
|
267 |
+
{
|
268 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
269 |
+
}
|
270 |
+
$this->_redirect('*/*');
|
271 |
+
}
|
272 |
+
public function sendshipmentAction()
|
273 |
+
{
|
274 |
+
$post = $this->getRequest()->getPost();
|
275 |
+
try {
|
276 |
+
if (empty($post))
|
277 |
+
Mage::throwException($this->__('Invalid form data.'));
|
278 |
+
|
279 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
280 |
+
if (isset($post['sender_shipment_save']))
|
281 |
+
{
|
282 |
+
$sender_shipment = $post['sender_shipment'];
|
283 |
+
$sender_shipment_message = $post['sender_shipment_message'];
|
284 |
+
|
285 |
+
if (isset($sender_shipment) && $sender_shipment == '')
|
286 |
+
{
|
287 |
+
$message = $this->__('Please fill the message field');
|
288 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
289 |
+
}
|
290 |
+
else if ($sender_shipment_message == '')
|
291 |
+
{
|
292 |
+
$message = $this->__('Please fill the message field');
|
293 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
294 |
+
}
|
295 |
+
else
|
296 |
+
{
|
297 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment', $sender_shipment);
|
298 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment_Message', $sender_shipment_message);
|
299 |
+
$message = $this->__('Your setting has been successfully saved');
|
300 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
301 |
+
}
|
302 |
+
|
303 |
+
}
|
304 |
+
}
|
305 |
+
catch (Exception $e)
|
306 |
+
{
|
307 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
308 |
+
}
|
309 |
+
$this->_redirect('*/*');
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* This method is called when the user test Shipment Sms and hits the submit button.
|
314 |
+
*/
|
315 |
+
|
316 |
+
public function sendordertestAction()
|
317 |
+
{
|
318 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
319 |
+
$post = $this->getRequest()->getPost();
|
320 |
+
try {
|
321 |
+
if (empty($post))
|
322 |
+
Mage::throwException($this->__('Invalid form data.'));
|
323 |
+
|
324 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
325 |
+
|
326 |
+
if (isset($post['sender_order_submit']))
|
327 |
+
{
|
328 |
+
$arr = array();
|
329 |
+
$arr['to'] = $post['sender_order_number'];
|
330 |
+
$arr['from'] = $sendinModule->getSendSmsOrderSubject();
|
331 |
+
$arr['text'] = $sendinModule->getSendSmsmOrderMessage();
|
332 |
+
|
333 |
+
$result = $sendinModule->sendSmsApi($arr);
|
334 |
+
|
335 |
+
if (isset($result->status) && $result->status == 'OK')
|
336 |
+
{
|
337 |
+
$message = $this->__('Message has been sent successfully');
|
338 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
339 |
+
}
|
340 |
+
else
|
341 |
+
{
|
342 |
+
$message = $this->__('Message has not been sent successfully');
|
343 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
344 |
+
}
|
345 |
+
|
346 |
+
}
|
347 |
+
}
|
348 |
+
catch (Exception $e)
|
349 |
+
{
|
350 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
351 |
+
}
|
352 |
+
$this->_redirect('*/*');
|
353 |
+
}
|
354 |
+
|
355 |
+
|
356 |
+
/**
|
357 |
+
* This method is called when the user test Shipment Sms and hits the submit button.
|
358 |
+
*/
|
359 |
+
|
360 |
+
public function sendshipmenttestAction()
|
361 |
+
{
|
362 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
363 |
+
$post = $this->getRequest()->getPost();
|
364 |
+
try {
|
365 |
+
if (empty($post))
|
366 |
+
Mage::throwException($this->__('Invalid form data.'));
|
367 |
+
|
368 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
369 |
+
|
370 |
+
if (isset($post['sender_shipment_submit']))
|
371 |
+
{
|
372 |
+
$arr = array();
|
373 |
+
$arr['to'] = $post['sender_shipment_number'];
|
374 |
+
$arr['from'] = $sendinModule->getSendSmsShipingSubject();
|
375 |
+
$arr['text'] = $sendinModule->getSendSmsShipingMessage();
|
376 |
+
|
377 |
+
$result = $sendinModule->sendSmsApi($arr);
|
378 |
+
|
379 |
+
if (isset($result->status) && $result->status == 'OK')
|
380 |
+
{
|
381 |
+
$message = $this->__('Message has been sent successfully');
|
382 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
383 |
+
}
|
384 |
+
else
|
385 |
+
{
|
386 |
+
$message = $this->__('Message has not been sent successfully');
|
387 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
388 |
+
}
|
389 |
+
|
390 |
+
}
|
391 |
+
}
|
392 |
+
catch (Exception $e)
|
393 |
+
{
|
394 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
395 |
+
}
|
396 |
+
$this->_redirect('*/*');
|
397 |
+
}
|
398 |
+
|
399 |
+
public function sendnotifysmsAction()
|
400 |
+
{
|
401 |
+
$post = $this->getRequest()->getPost();
|
402 |
+
try {
|
403 |
+
if (empty($post))
|
404 |
+
Mage::throwException($this->__('Invalid form data.'));
|
405 |
+
|
406 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
407 |
+
|
408 |
+
if (isset($post['notify_sms_mail']))
|
409 |
+
{
|
410 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Value', $post['sendin_notify_value']);
|
411 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Email', $post['sendin_notify_email']);
|
412 |
+
$message = $this->__('Your setting has been successfully saved');
|
413 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
catch (Exception $e)
|
417 |
+
{
|
418 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
419 |
+
}
|
420 |
+
$this->_redirect('*/*');
|
421 |
+
}
|
422 |
+
|
423 |
+
public function sendcampaignAction()
|
424 |
+
{
|
425 |
+
$post = $this->getRequest()->getPost();
|
426 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
427 |
+
try {
|
428 |
+
if (empty($post))
|
429 |
+
Mage::throwException($this->__('Invalid form data.'));
|
430 |
+
|
431 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
432 |
+
|
433 |
+
if (isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 1)
|
434 |
+
{
|
435 |
+
$arr = array();
|
436 |
+
$arr['to'] = $post['singlechoice'];
|
437 |
+
$arr['from'] = $post['sender_campaign'];
|
438 |
+
$arr['text'] = $post['sender_campaign_message'];
|
439 |
+
|
440 |
+
$result = $sendinModule->sendSmsApi($arr);
|
441 |
+
if (isset($result->status) && $result->status == 'OK')
|
442 |
+
{
|
443 |
+
$message = $this->__('Message has been sent successfully');
|
444 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
445 |
+
}
|
446 |
+
else
|
447 |
+
{
|
448 |
+
$message = $this->__('Message has not been sent successfully');
|
449 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
450 |
+
}
|
451 |
+
}
|
452 |
+
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 0)
|
453 |
+
{
|
454 |
+
$smscredit = $sendinModule->getSmsCredit();
|
455 |
+
$collection = Mage::getModel('customer/customer')
|
456 |
+
->getCollection()
|
457 |
+
->addAttributeToSelect('*')
|
458 |
+
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
459 |
+
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left');
|
460 |
+
|
461 |
+
$results = array();
|
462 |
+
foreach ($collection as $customer) {
|
463 |
+
$results[] = $customer->toArray();
|
464 |
+
}
|
465 |
+
|
466 |
+
foreach ($results as $i => $result)
|
467 |
+
{
|
468 |
+
if(!empty($result['shipping_telephone']) && !empty($result['shipping_country_code']))
|
469 |
+
{
|
470 |
+
$country_code = $sendinModule->getCountryCode($result['shipping_country_code']);
|
471 |
+
$number = $sendinModule->checkMobileNumber($result['shipping_telephone'],$country_code);
|
472 |
+
$firstname = !empty($result['firstname'])?$result['firstname']:'';
|
473 |
+
$lastname = !empty($result['lastname'])?$result['lastname']:'';
|
474 |
+
$msgbody = !empty($post['sender_campaign_message'])?$post['sender_campaign_message']:'';
|
475 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
476 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
477 |
+
$arr = array();
|
478 |
+
$arr['to'] = $number;
|
479 |
+
$arr['from'] = !empty($post['sender_campaign'])?$post['sender_campaign']:'';
|
480 |
+
$arr['text'] = $msgbody;
|
481 |
+
$sendinModule->sendSmsApi($arr);
|
482 |
+
}
|
483 |
+
}
|
484 |
+
if ($smscredit >= 1)
|
485 |
+
{
|
486 |
+
$message = $this->__('Message has been sent successfully');
|
487 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
488 |
+
}
|
489 |
+
else
|
490 |
+
{
|
491 |
+
$message = $this->__('Message has not been sent successfully');
|
492 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
493 |
+
}
|
494 |
+
}
|
495 |
+
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
496 |
+
{
|
497 |
+
$smscredit = $sendinModule->getSmsCredit();
|
498 |
+
|
499 |
+
$schedule_month = $post['sib_datetimepicker'];
|
500 |
+
$schedule_hour = $post['hour'];
|
501 |
+
$schedule_minute = $post['minute'];
|
502 |
+
if ($schedule_hour < 10) {
|
503 |
+
$schedule_hour = '0'.$schedule_hour;
|
504 |
+
}
|
505 |
+
if ($schedule_minute < 10) {
|
506 |
+
$schedule_minute = '0'.$schedule_minute;
|
507 |
+
}
|
508 |
+
$schedule_time = $schedule_month.' '.$schedule_hour.':'.$schedule_minute.':00';
|
509 |
+
|
510 |
+
$current_time = date('Y-m-d H:i:s', time() + 300);
|
511 |
+
$currenttm = strtotime($current_time);
|
512 |
+
$scheduletm = strtotime($schedule_time);
|
513 |
+
|
514 |
+
if ($schedule_time != '' || $scheduletm >= $currenttm)
|
515 |
+
{
|
516 |
+
$camp_name = 'SMS_'.date('Ymd');
|
517 |
+
$key = $sendinModule->getApiKey();
|
518 |
+
if ($key == '')
|
519 |
+
return false;
|
520 |
+
$param['key'] = $key;
|
521 |
+
$param['listname'] = $camp_name;
|
522 |
+
$param['webaction'] = 'NEWLIST';
|
523 |
+
$param['list_parent'] = '1';
|
524 |
+
//folder id
|
525 |
+
$list_response = $sendinModule->curlRequest($param);
|
526 |
+
$res = json_decode($list_response);
|
527 |
+
$list_id = $res->result;
|
528 |
+
// import old user to SendinBlue
|
529 |
+
|
530 |
+
$iso_code = $this->context->language->iso_code;
|
531 |
+
$allemail = $sendinModule->smsCampaignList();
|
532 |
+
|
533 |
+
$data['webaction'] = 'MULTI-USERCREADIT';
|
534 |
+
$data['key'] = $key;
|
535 |
+
$data['attributes'] = $allemail;
|
536 |
+
$data['listid'] = $list_id;
|
537 |
+
// List id should be optional
|
538 |
+
|
539 |
+
$data_responce = $sendinModule->curlRequest($data);
|
540 |
+
$msgbody = $post['sender_campaign_message'];
|
541 |
+
$value_langauge = $sendinModule->getApiConfigValue();
|
542 |
+
if ($value_langauge->language == 'fr')
|
543 |
+
{
|
544 |
+
$firstname = '{NOM}';
|
545 |
+
$lastname = '{PRENOM}';
|
546 |
+
}
|
547 |
+
else
|
548 |
+
{
|
549 |
+
$firstname = '{NAME}';
|
550 |
+
$lastname = '{SURNAME}';
|
551 |
+
}
|
552 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
553 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
554 |
+
$arr = array();
|
555 |
+
$sender_campaign = $post['sender_campaign'];
|
556 |
+
$content = $msgbody;
|
557 |
+
$arr['key'] =$sendinModule->getApiKey();
|
558 |
+
$arr['webaction'] = 'SMSCAMPCREADIT';
|
559 |
+
$arr['camp_name'] = $camp_name; // mandatory
|
560 |
+
$arr['sender'] = $sender_campaign;
|
561 |
+
$arr['content'] = $content;
|
562 |
+
$arr['bat_sent'] = '';
|
563 |
+
$arr['listids'] = $list_id; // mandatory if SMS campaign is scheduled
|
564 |
+
$arr['exclude_list'] = '';
|
565 |
+
$arr['schedule'] = $scheduletm;
|
566 |
+
|
567 |
+
$data_camp = $sendinModule->curlRequest($arr);
|
568 |
+
|
569 |
+
if ($smscredit >= 1)
|
570 |
+
{
|
571 |
+
$message = $this->__('Message has been sent successfully');
|
572 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
573 |
+
}
|
574 |
+
else
|
575 |
+
{
|
576 |
+
$message = $this->__('Message has not been sent successfully');
|
577 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
578 |
+
}
|
579 |
+
}
|
580 |
+
else
|
581 |
+
{
|
582 |
+
$message = $this->__('Scheduled date may not be prior to the current date');
|
583 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
584 |
+
}
|
585 |
+
}
|
586 |
+
}
|
587 |
+
catch (Exception $e)
|
588 |
+
{
|
589 |
+
Mage::getModel('adminhtml/session')->addError($e->getMessage());
|
590 |
+
}
|
591 |
+
$this->_redirect('*/*');
|
592 |
+
}
|
593 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php
RENAMED
@@ -13,9 +13,8 @@ class Sendinblue_Sendinblue_Adminhtml_NotifyController extends Mage_Adminhtml_Co
|
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->notifySmsEmail();
|
16 |
-
$this->loadLayout()->_setActiveMenu('system')->_addContent()->renderLayout();
|
17 |
$msg_disp = $this->__('The CRON has been well executed.');
|
18 |
-
Mage::
|
19 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
20 |
}
|
21 |
}
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->notifySmsEmail();
|
|
|
16 |
$msg_disp = $this->__('The CRON has been well executed.');
|
17 |
+
Mage::getModel('adminhtml/session')->addSuccess($msg_disp);
|
18 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
19 |
}
|
20 |
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php
RENAMED
@@ -13,9 +13,8 @@ class Sendinblue_Sendinblue_Adminhtml_SyncController extends Mage_Adminhtml_Cont
|
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
16 |
-
$this->loadLayout()->_setActiveMenu('system')->_addContent()->renderLayout();
|
17 |
$msg_disp = $this->__('The CRON has been well executed.');
|
18 |
-
Mage::
|
19 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
20 |
}
|
21 |
}
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
|
|
16 |
$msg_disp = $this->__('The CRON has been well executed.');
|
17 |
+
Mage::getModel('adminhtml/session')->addSuccess($msg_disp);
|
18 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
19 |
}
|
20 |
}
|
app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php
ADDED
@@ -0,0 +1,766 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Action
|
12 |
+
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$this->loadLayout();
|
16 |
+
$this->renderLayout();
|
17 |
+
$params = Mage::app()->getRequest()->getParams();
|
18 |
+
$params = empty($params)?array():$params;
|
19 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != '')
|
20 |
+
$this->CreateFolderCaseTwo();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function campaignAction()
|
24 |
+
{
|
25 |
+
$post = $this->getRequest()->getPost();
|
26 |
+
try {
|
27 |
+
if (empty($post))
|
28 |
+
echo Mage::throwException($this->__('Invalid form data.'));
|
29 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
30 |
+
$sendin_switch->saveConfig('sendinblue/sms/campaign', $post['campaignSetting']);
|
31 |
+
echo $this->__('Your setting has been successfully saved');
|
32 |
+
}
|
33 |
+
catch (Exception $e)
|
34 |
+
{
|
35 |
+
echo $this->__($e->getMessage());
|
36 |
+
}
|
37 |
+
}
|
38 |
+
public function orderAction()
|
39 |
+
{
|
40 |
+
$post = $this->getRequest()->getPost();
|
41 |
+
try {
|
42 |
+
if (empty($post))
|
43 |
+
Mage::throwException($this->__('Invalid form data.'));
|
44 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
45 |
+
$sendin_switch->saveConfig('sendinblue/sms/order', $post['orderSetting']);
|
46 |
+
echo $this->__('Your setting has been successfully saved');
|
47 |
+
}
|
48 |
+
catch (Exception $e)
|
49 |
+
{
|
50 |
+
echo $this->__($e->getMessage());
|
51 |
+
}
|
52 |
+
}
|
53 |
+
public function creditAction()
|
54 |
+
{
|
55 |
+
$post = $this->getRequest()->getPost();
|
56 |
+
try {
|
57 |
+
if (empty($post))
|
58 |
+
Mage::throwException($this->__('Invalid form data.'));
|
59 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
60 |
+
$sendin_switch->saveConfig('sendinblue/sms/credit', $post['sms_credit']);
|
61 |
+
echo $this->__('Your setting has been successfully saved');
|
62 |
+
}
|
63 |
+
catch (Exception $e)
|
64 |
+
{
|
65 |
+
echo $this->__($e->getMessage());
|
66 |
+
}
|
67 |
+
}
|
68 |
+
public function shipingAction()
|
69 |
+
{
|
70 |
+
$post = $this->getRequest()->getPost();
|
71 |
+
try {
|
72 |
+
if (empty($post))
|
73 |
+
Mage::throwException($this->__('Invalid form data.'));
|
74 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
75 |
+
$sendin_switch->saveConfig('sendinblue/sms/shiping', $post['shipingSetting']);
|
76 |
+
echo $this->__('Your setting has been successfully saved');
|
77 |
+
}
|
78 |
+
catch (Exception $e)
|
79 |
+
{
|
80 |
+
echo $this->__($e->getMessage());
|
81 |
+
}
|
82 |
+
}
|
83 |
+
public function codepostAction()
|
84 |
+
{
|
85 |
+
$post = $this->getRequest()->getPost();
|
86 |
+
try {
|
87 |
+
if (empty($post))
|
88 |
+
Mage::throwException($this->__('Invalid form data.'));
|
89 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
90 |
+
$sendin_switch->saveConfig('sendinblue/tracking/code', $post['script']);
|
91 |
+
$sendin_switch->saveConfig('sendinblue/improt/history', $post['script']);
|
92 |
+
echo $this->__('Your setting has been successfully saved');
|
93 |
+
}
|
94 |
+
catch (Exception $e)
|
95 |
+
{
|
96 |
+
echo $this->__($e->getMessage());
|
97 |
+
}
|
98 |
+
}
|
99 |
+
public function emptySubsUserToSendinblueAction()
|
100 |
+
{
|
101 |
+
$post = $this->getRequest()->getPost();
|
102 |
+
try {
|
103 |
+
if (empty($post))
|
104 |
+
Mage::throwException($this->__('Invalid form data.'));
|
105 |
+
if ($post['proc_success'] != '')
|
106 |
+
{
|
107 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
108 |
+
$key_value = array();
|
109 |
+
$key_value[] = '';
|
110 |
+
fputcsv($handle, $key_value);
|
111 |
+
fclose($handle);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
catch (Exception $e)
|
115 |
+
{
|
116 |
+
echo $this->__($e->getMessage());
|
117 |
+
}
|
118 |
+
}
|
119 |
+
public function mailResponceAction()
|
120 |
+
{
|
121 |
+
$post = $this->getRequest()->getParams();
|
122 |
+
try {
|
123 |
+
if (empty($post))
|
124 |
+
Mage::throwException($this->__('Invalid form data.'));
|
125 |
+
|
126 |
+
$user_email = base64_decode($post['value']);
|
127 |
+
if ($user_email != '') {
|
128 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_email', array('eq' => $user_email))->load();;
|
129 |
+
foreach ($newsletter->getItems() as $subscriber) {
|
130 |
+
$subsdata = $subscriber->getData();
|
131 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
132 |
+
$subscriber_status = $subsdata['subscriber_status'];
|
133 |
+
}
|
134 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
135 |
+
if (!empty($subscriber_email) && $subscriber_status == 1) {
|
136 |
+
$listId = $sendinModule->getUserlists();
|
137 |
+
$doubleOptinId = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
138 |
+
$api_key = $sendinModule->getApiKey();
|
139 |
+
$params['url'] = "https://api.sendinblue.com/v2.0";
|
140 |
+
$params['api_key'] = $api_key;
|
141 |
+
$obj_mailin = Mage::getModel('sendinblue/psmailin',$params);
|
142 |
+
|
143 |
+
$data = array( "email" => $subscriber_email,
|
144 |
+
"attributes" => array(),
|
145 |
+
"blacklisted" => 0,
|
146 |
+
"listid" => array($listId),
|
147 |
+
"listid_unlink" => array($doubleOptinId),
|
148 |
+
"blacklisted_sms" => 0
|
149 |
+
);
|
150 |
+
|
151 |
+
$responce = $obj_mailin->createUpdateUser($data);
|
152 |
+
$finalStatus = Mage::getStoreConfig('sendinblue/SendinFinalConfirmEmail');
|
153 |
+
if ($finalStatus === 'yes') {
|
154 |
+
$finalTempId = Mage::getStoreConfig('sendinblue/SendinTemplateFinal');
|
155 |
+
$sendinModule->sendWsTemplateMail($subscriber_email, $finalTempId);
|
156 |
+
|
157 |
+
}
|
158 |
+
$urlStatus = $sendinModule->getOptinRedirectUrlCheck();
|
159 |
+
|
160 |
+
if ($urlStatus == 'yes') {
|
161 |
+
$urlValue = $sendinModule->getSendinDoubleoptinRedirectUrl();
|
162 |
+
$this->_redirectUrl($urlValue);
|
163 |
+
} else {
|
164 |
+
$configValue = Mage::getStoreConfig('web/secure/base_url');
|
165 |
+
$this->_redirectUrl($configValue);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
catch (Exception $e)
|
171 |
+
{
|
172 |
+
echo $this->__($e->getMessage());
|
173 |
+
}
|
174 |
+
}
|
175 |
+
public function emptyImportOldOrderAction()
|
176 |
+
{
|
177 |
+
$post = $this->getRequest()->getPost();
|
178 |
+
try {
|
179 |
+
if (empty($post))
|
180 |
+
Mage::throwException($this->__('Invalid form data.'));
|
181 |
+
if ($post['proc_success'] != '')
|
182 |
+
{
|
183 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
184 |
+
$key_value = array();
|
185 |
+
$key_value[] = '';
|
186 |
+
fputcsv($handle, $key_value);
|
187 |
+
fclose($handle);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
catch (Exception $e)
|
191 |
+
{
|
192 |
+
echo $this->__($e->getMessage());
|
193 |
+
}
|
194 |
+
}
|
195 |
+
public function orderhistoryAction()
|
196 |
+
{
|
197 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
198 |
+
$post = $this->getRequest()->getPost();
|
199 |
+
try {
|
200 |
+
if (empty($post))
|
201 |
+
Mage::throwException($this->__('Invalid form data.'));
|
202 |
+
|
203 |
+
if ($post['history_status'] == 1)
|
204 |
+
{
|
205 |
+
$value = $sendinModule->TrackingSmtp();
|
206 |
+
$date_value = $sendinModule->getApiConfigValue();
|
207 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
208 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
209 |
+
|
210 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
211 |
+
|
212 |
+
fwrite($handle, 'EMAIL,ORDER_ID,ORDER_PRICE,ORDER_DATE'.PHP_EOL);
|
213 |
+
|
214 |
+
|
215 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
216 |
+
|
217 |
+
$salesOrderColection = Mage::getModel('sales/order');
|
218 |
+
foreach ($collection as $customer)
|
219 |
+
{
|
220 |
+
$cid = $customer->getData('entity_id');
|
221 |
+
$email = $customer->getData('email');
|
222 |
+
$total_orders = $salesOrderColection->getCollection()->addFieldToFilter('customer_id', $cid);
|
223 |
+
$orderCnt = $total_orders->count();
|
224 |
+
if ($orderCnt > 0)
|
225 |
+
{
|
226 |
+
$data = array();
|
227 |
+
$data['key'] = $sendinModule->getApiKey();
|
228 |
+
$data['webaction'] = 'USERS-STATUS';
|
229 |
+
$data['email'] = $email;
|
230 |
+
$curl_responce = $sendinModule->curlRequest($data);
|
231 |
+
$user_status = json_decode($curl_responce);
|
232 |
+
}
|
233 |
+
if (isset($user_status->result) != '')
|
234 |
+
{
|
235 |
+
foreach($total_orders as $order_data)
|
236 |
+
{
|
237 |
+
if ($date_value->date_format == 'dd-mm-yyyy')
|
238 |
+
$date = date('d-m-Y', strtotime($order_data['created_at']));
|
239 |
+
else
|
240 |
+
$date = date('m-d-Y', strtotime($order_data['created_at']));
|
241 |
+
$history_data= array();
|
242 |
+
$history_data[] = array($order_data['customer_email'],$order_data['increment_id'],$order_data['grand_total'],$date);
|
243 |
+
foreach ($history_data as $line)
|
244 |
+
fputcsv($handle, $line);
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
fclose($handle);
|
250 |
+
|
251 |
+
$get_User_lists = $sendinModule->getUserlists();
|
252 |
+
$list = str_replace('|', ',', $get_User_lists);
|
253 |
+
if (preg_match('/^[0-9,]+$/', $list))
|
254 |
+
$list = $list;
|
255 |
+
else
|
256 |
+
$list = '';
|
257 |
+
|
258 |
+
$import_data = array();
|
259 |
+
$import_data['webaction'] = 'IMPORTUSERS';
|
260 |
+
$import_data['key'] = $sendinModule->getApiKey();
|
261 |
+
$import_data['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportOldOrdersToSendinblue.csv';
|
262 |
+
$import_data['listids'] = $list;
|
263 |
+
$import_data['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptyImportOldOrder';
|
264 |
+
/**
|
265 |
+
* List id should be optional
|
266 |
+
*/
|
267 |
+
$sendinModule->curlRequestAsyc($import_data);
|
268 |
+
|
269 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
270 |
+
$sendin_switch->saveConfig('sendinblue/improt/history', 0);
|
271 |
+
if($post['langvalue'] == 'fr_FR')
|
272 |
+
$msg = 'Historique des commandes a été importé avec succès.';
|
273 |
+
else
|
274 |
+
$msg = 'Order history has been import successfully';
|
275 |
+
|
276 |
+
echo $msg;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
catch (Exception $e)
|
280 |
+
{
|
281 |
+
echo $this->__($e->getMessage());
|
282 |
+
}
|
283 |
+
}
|
284 |
+
public function smtppostAction()
|
285 |
+
{
|
286 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
287 |
+
$post = $this->getRequest()->getPost();
|
288 |
+
try {
|
289 |
+
if (empty($post))
|
290 |
+
Mage::throwException($this->__('Invalid form data.'));
|
291 |
+
else
|
292 |
+
{
|
293 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
294 |
+
$get_key = $sendinModule->getApiKey();
|
295 |
+
$result = $sendinModule->checkApikey($get_key);
|
296 |
+
if (empty($result['error']))
|
297 |
+
{
|
298 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', $post['smtptest']);
|
299 |
+
$smtp_response = $sendinModule->TrackingSmtp(); // get tracking code
|
300 |
+
if ($smtp_response->result->relay_data->status == 'enabled')
|
301 |
+
{
|
302 |
+
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
303 |
+
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
304 |
+
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
305 |
+
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
306 |
+
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
307 |
+
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
308 |
+
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
309 |
+
echo $this->__('Your setting has been successfully saved');
|
310 |
+
}else
|
311 |
+
{
|
312 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
313 |
+
echo $this->__('Your SMTP account is not activated and therefore you can\'t use SendinBlue SMTP. For more informations, please contact our support to: contact@sendinblue.com');
|
314 |
+
}
|
315 |
+
}elseif (isset($responce['error']))
|
316 |
+
echo $this->__('You have entered wrong api key');
|
317 |
+
}
|
318 |
+
}
|
319 |
+
catch (Exception $e)
|
320 |
+
{
|
321 |
+
echo $this->__($e->getMessage());
|
322 |
+
}
|
323 |
+
}
|
324 |
+
public function ajaxcontentAction()
|
325 |
+
{
|
326 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
327 |
+
$post = $this->getRequest()->getPost();
|
328 |
+
try {
|
329 |
+
if (empty($post))
|
330 |
+
Mage::throwException($this->__('Invalid form data.'));
|
331 |
+
else
|
332 |
+
{
|
333 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
334 |
+
if ($locale == 'fr_FR')
|
335 |
+
{
|
336 |
+
$title1 = 'Inscrire le contact';
|
337 |
+
$title2 = 'Désinscrire le contact';
|
338 |
+
$title3 = 'Inscrire le sms';
|
339 |
+
$title4 = 'Désinscrire le sms';
|
340 |
+
$first = 'Première page';
|
341 |
+
$last = 'Dernière page';
|
342 |
+
$previous = 'Précédente';
|
343 |
+
$next = 'Suivante';
|
344 |
+
$yes = 'oui';
|
345 |
+
$no = 'non';
|
346 |
+
} else
|
347 |
+
{
|
348 |
+
$title1 = 'Unsubscribe the contact';
|
349 |
+
$title2 = 'Subscribe the contact';
|
350 |
+
$title3 = 'Unsubscribe the sms';
|
351 |
+
$title4 = 'Subscribe the sms';
|
352 |
+
$first = 'First';
|
353 |
+
$last = 'Last';
|
354 |
+
$previous = 'Previous';
|
355 |
+
$next = 'Next';
|
356 |
+
$yes = 'yes';
|
357 |
+
$no = 'no';
|
358 |
+
}
|
359 |
+
$page = (int)$post['page'];
|
360 |
+
$cur_page = $page;
|
361 |
+
$page -= 1;
|
362 |
+
$per_page = 20;
|
363 |
+
$previous_btn = true;
|
364 |
+
$next_btn = true;
|
365 |
+
$first_btn = true;
|
366 |
+
$last_btn = true;
|
367 |
+
$start = $page * $per_page;
|
368 |
+
$count = $sendinModule->getNewsletterSubscribeCount() + $sendinModule->getNewsletterUnSubscribeCount();
|
369 |
+
$no_of_paginations = ceil($count / $per_page);
|
370 |
+
if ($cur_page >= 7)
|
371 |
+
{
|
372 |
+
$start_loop = $cur_page - 3;
|
373 |
+
if ($no_of_paginations > $cur_page + 3)
|
374 |
+
$end_loop = $cur_page + 3;
|
375 |
+
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6)
|
376 |
+
{
|
377 |
+
$start_loop = $no_of_paginations - 6;
|
378 |
+
$end_loop = $no_of_paginations;
|
379 |
+
} else
|
380 |
+
$end_loop = $no_of_paginations;
|
381 |
+
} else
|
382 |
+
{
|
383 |
+
$start_loop = 1;
|
384 |
+
if ($no_of_paginations > 7)
|
385 |
+
$end_loop = 7;
|
386 |
+
else
|
387 |
+
$end_loop = $no_of_paginations;
|
388 |
+
}
|
389 |
+
$collection = $sendinModule->getNewsletterSubscribe($start, $per_page);
|
390 |
+
$sendin_status = $sendinModule->checkUserSendinStatus($collection);
|
391 |
+
$sendin_result = isset($sendin_status['result'])?$sendin_status['result']:'';
|
392 |
+
if (count($collection) > 0)
|
393 |
+
{
|
394 |
+
$i = 1;
|
395 |
+
$msg = '';
|
396 |
+
$skinUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
397 |
+
foreach ($collection as $subscriber)
|
398 |
+
{
|
399 |
+
$email = isset($subscriber['email'])?$subscriber['email']:'';
|
400 |
+
$phone = isset($subscriber['SMS'])?$subscriber['SMS'] : '';
|
401 |
+
|
402 |
+
if (!empty($subscriber['customer_id']) > 0)
|
403 |
+
$client = $yes;
|
404 |
+
else
|
405 |
+
$client = $no;
|
406 |
+
|
407 |
+
$show_status = '';
|
408 |
+
$sms_status = '';
|
409 |
+
if(isset($sendin_result[$email])) {
|
410 |
+
$email_bl_value = isset($sendin_result[$email]['email_bl'])?$sendin_result[$email]['email_bl']:'';
|
411 |
+
if ($email_bl_value === 1 || $sendin_result[$email] == null)
|
412 |
+
$show_status = 0;
|
413 |
+
if ($email_bl_value === 0)
|
414 |
+
$show_status = 1;
|
415 |
+
|
416 |
+
$sms_bl = isset($sendin_result[$email]['sms_bl'])?$sendin_result[$email]['sms_bl']:'';
|
417 |
+
$sms_exist = isset($sendin_result[$email]['sms_exist'])?$sendin_result[$email]['sms_exist']:'';
|
418 |
+
$subs_telephone = isset($subscriber['SMS'])?$subscriber['SMS']:'';
|
419 |
+
if ($sms_bl === 1 && $sms_exist > 0)
|
420 |
+
$sms_status = 0;
|
421 |
+
elseif ($sms_bl === 0 && $sms_exist > 0)
|
422 |
+
$sms_status = 1;
|
423 |
+
elseif ($sms_exist <= 0 && empty($subs_telephone))
|
424 |
+
$sms_status = 2;
|
425 |
+
else if ($sms_exist <= 0 && !empty($subs_telephone))
|
426 |
+
$sms_status = 3;
|
427 |
+
}
|
428 |
+
if ($subscriber['subscriber_status'] != 3)
|
429 |
+
$img_magento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
430 |
+
else
|
431 |
+
$img_magento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
432 |
+
|
433 |
+
$sms_status = $sms_status >= 0?$sms_status:'';
|
434 |
+
|
435 |
+
if ($sms_status === 1)
|
436 |
+
$img_sms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif"
|
437 |
+
id="ajax_contact_status_'.$i.'" title="'.$title3.'" >';
|
438 |
+
else if ($sms_status === 0)
|
439 |
+
$img_sms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif"
|
440 |
+
id="ajax_contact_status_'.$i.'" title="'.$title4.'" >';
|
441 |
+
else if ($sms_status === 2 || $sms_status === '')
|
442 |
+
$img_sms = '';
|
443 |
+
else if ($sms_status === 3)
|
444 |
+
$img_sms = 'Not synchronized';
|
445 |
+
$show_status = !empty($show_status)?$show_status:'0';
|
446 |
+
if ($show_status == 1)
|
447 |
+
$img_sendin = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif"
|
448 |
+
id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
449 |
+
else
|
450 |
+
$img_sendin = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif"
|
451 |
+
id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
452 |
+
$msg .= '<tr class="even pointer"><td class="a-left">'.$email.'</td><td class="a-left">'.$client.'</td><td class="a-left">'.$phone.'</td><td class="a-left">'.$img_magento.'</td>
|
453 |
+
<td class="a-left"><a status="'.$show_status.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
454 |
+
'.$img_sendin.'</a></td><td class="a-left last"><a status="'.$sms_status.'" email="'.$email.'" class="ajax_sms_subs_href" href="javascript:void(0)">
|
455 |
+
'.$img_sms.'</a></td></tr>';
|
456 |
+
$i++;
|
457 |
+
}
|
458 |
+
}
|
459 |
+
$msg_paging = '';
|
460 |
+
$msg_paging .= '<tr><td colspan="7"><div class="pagination"><ul class="pull-left">';
|
461 |
+
if ($first_btn && $cur_page > 1)
|
462 |
+
$msg_paging .= '<li p="1" class="active">'.$first.'</li>';
|
463 |
+
else if ($first_btn)
|
464 |
+
$msg_paging .= '<li p="1" class="inactive">'.$first.'</li>';
|
465 |
+
if ($previous_btn && $cur_page > 1)
|
466 |
+
{
|
467 |
+
$pre = $cur_page - 1;
|
468 |
+
$msg_paging .= '<li p="'.$pre.'" class="active">'.$previous.'</li>';
|
469 |
+
} else if ($previous_btn)
|
470 |
+
$msg_paging .= '<li class="inactive">'.$previous.'</li>';
|
471 |
+
for ($i = $start_loop; $i <= $end_loop; $i++)
|
472 |
+
{
|
473 |
+
if ($cur_page == $i)
|
474 |
+
$msg_paging .= '<li p="'.$i.'" style="color:#fff;background-color:#000000;" class="active">'.$i.'</li>';
|
475 |
+
else
|
476 |
+
$msg_paging .= '<li p="'.$i.'" class="active">'.$i.'</li>';
|
477 |
+
}
|
478 |
+
if ($next_btn && $cur_page < $no_of_paginations)
|
479 |
+
{
|
480 |
+
$nex = $cur_page + 1;
|
481 |
+
$msg_paging .= '<li p="'.$nex.'" class="active">'.$next.'</li>';
|
482 |
+
} else if ($next_btn)
|
483 |
+
$msg_paging .= '<li class="inactive">'.$next.'</li>';
|
484 |
+
if ($last_btn && $cur_page < $no_of_paginations)
|
485 |
+
$msg_paging .= '<li p="'.$no_of_paginations.'" class="active">'.$last.'</li>';
|
486 |
+
else if ($last_btn)
|
487 |
+
$msg_paging .= '<li p="'.$no_of_paginations.'" class="inactive">'.$last.'</li>';
|
488 |
+
if ($count != 0)
|
489 |
+
echo $msg.$msg_paging.'</td></tr>';
|
490 |
+
}
|
491 |
+
}catch (Exception $e)
|
492 |
+
{
|
493 |
+
echo $this->__($e->getMessage());
|
494 |
+
}
|
495 |
+
}
|
496 |
+
public function ajaxsmssubscribeAction()
|
497 |
+
{
|
498 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
499 |
+
$post = $this->getRequest()->getPost();
|
500 |
+
try {
|
501 |
+
if (empty($post))
|
502 |
+
Mage::throwException($this->__('Invalid form data.'));
|
503 |
+
$email = $post['email'];
|
504 |
+
$data = array();
|
505 |
+
$data['key'] = $sendinModule->getApiKey();
|
506 |
+
$data['webaction'] = 'USERUNSUBSCRIBEDSMS';
|
507 |
+
$data['email'] = $email;
|
508 |
+
$sendinModule->curlRequest($data);
|
509 |
+
}
|
510 |
+
catch (Exception $e)
|
511 |
+
{
|
512 |
+
echo $this->__($e->getMessage());
|
513 |
+
}
|
514 |
+
}
|
515 |
+
public function ajaxupdateAction()
|
516 |
+
{
|
517 |
+
$post = $this->getRequest()->getPost();
|
518 |
+
$coreResource = Mage::getSingleton('core/resource');
|
519 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
520 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
521 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
522 |
+
$attributesName = $sendinModule->allAttributesName();
|
523 |
+
try {
|
524 |
+
if (empty($post))
|
525 |
+
Mage::throwException($this->__('Invalid form data.'));
|
526 |
+
$list_id = str_replace(',', '|', $sendinModule->getUserlists());
|
527 |
+
$post_email = !empty($post['email'])?$post['email']:'';
|
528 |
+
$post_newsletter = !empty($post['newsletter'])?$post['newsletter']:'';
|
529 |
+
$temp_sub_status = ($post_newsletter == 0) ? 1 : 3;
|
530 |
+
$sql = 'SELECT `store_id`, `entity_id` from '.$tableCustomer.' where email = "'.$post_email.'" ';
|
531 |
+
$connection = $coreResource->getConnection('core_read');
|
532 |
+
$custdata = $connection->fetchRow($sql);
|
533 |
+
if (!empty($post_email) && $post_newsletter == 0)
|
534 |
+
{
|
535 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
536 |
+
$responce = $sendinModule->emailSubscribe($post_email);
|
537 |
+
$responce_data = json_decode($responce);
|
538 |
+
$customerAddr = array();
|
539 |
+
if (isset($responce_data->errorMsg) == 'User not exists')
|
540 |
+
{
|
541 |
+
if (isset($custdata['entity_id']) != '')
|
542 |
+
{
|
543 |
+
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$custdata['entity_id']);
|
544 |
+
$telephone = '';
|
545 |
+
foreach ($collectionAddress as $customerPhno)
|
546 |
+
{
|
547 |
+
$customerAddr = $customerPhno->getData();
|
548 |
+
if (!empty($customerAddr['telephone']) && !empty($customerAddr['country_id']))
|
549 |
+
{
|
550 |
+
$country_code = $sendinModule->getCountryCode($customerAddr['country_id']);
|
551 |
+
$customerAddr['telephone'] = $sendinModule->checkMobileNumber($customerAddr['telephone'], $country_code);
|
552 |
+
}
|
553 |
+
}
|
554 |
+
$customer = Mage::getModel("customer/customer");
|
555 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
556 |
+
$customer->loadByEmail($post_email); //load customer by email id
|
557 |
+
$customer_name = $customer->getData();
|
558 |
+
$user_lang = isset($customer_name['created_in'])?$customer_name['created_in'] : '';
|
559 |
+
$customerData = array_merge($customerAddr, $customer_name);
|
560 |
+
$resp = $sendinModule->merge_my_array($attributesName, $customerData);
|
561 |
+
$resp['CLIENT'] = 1;
|
562 |
+
$resp['MAGENTO_LANG'] = $user_lang;
|
563 |
+
$responce = $sendinModule->emailAdd($post_email, $resp, $post_newsletter, $list_id);
|
564 |
+
}
|
565 |
+
else
|
566 |
+
{
|
567 |
+
$client = 0;
|
568 |
+
$customerData = array();
|
569 |
+
$subsdata = Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getData();
|
570 |
+
$resp = $sendinModule->merge_my_array($attributesName, $subsdata);
|
571 |
+
$resp['CLIENT'] = $client;
|
572 |
+
$responce = $sendinModule->emailAdd($post_email, $resp, $post_newsletter, $list_id);
|
573 |
+
}
|
574 |
+
}
|
575 |
+
$sql = 'SELECT `subscriber_email` from '.$tableNewsletter.' where subscriber_email = "'.$post_email.'" ';
|
576 |
+
$custdatanews = $connection->fetchRow($sql);
|
577 |
+
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
578 |
+
{
|
579 |
+
$connection->query("insert into ".$tableNewsletter."(store_id, customer_id, subscriber_email, subscriber_status)
|
580 |
+
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$post_email."','1')");
|
581 |
+
|
582 |
+
}
|
583 |
+
else
|
584 |
+
{
|
585 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post_email);
|
586 |
+
$costomer_data->setStatus($temp_sub_status);
|
587 |
+
$costomer_data->setIsStatusChanged(true);
|
588 |
+
$costomer_data->save();
|
589 |
+
}
|
590 |
+
|
591 |
+
}
|
592 |
+
else{
|
593 |
+
$responce = $sendinModule->emailDelete($post_email);
|
594 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post_email);
|
595 |
+
|
596 |
+
if (!$costomer_data->getStoreId())
|
597 |
+
{
|
598 |
+
$costomer_data->setSubscriberEmail($post_email);
|
599 |
+
$costomer_data->setCustomerId($custdata['entity_id']);
|
600 |
+
$costomer_data->setStoreId($custdata['store_id']);
|
601 |
+
}
|
602 |
+
$costomer_data->setStatus($temp_sub_status);
|
603 |
+
$costomer_data->setIsStatusChanged(true);
|
604 |
+
$costomer_data->save();
|
605 |
+
}
|
606 |
+
}
|
607 |
+
catch (Exception $e)
|
608 |
+
{
|
609 |
+
echo $this->__($e->getMessage());
|
610 |
+
}
|
611 |
+
}
|
612 |
+
|
613 |
+
public function ajaxordersmsAction($sender='', $message='', $number='')
|
614 |
+
{
|
615 |
+
$post = $this->getRequest()->getPost();
|
616 |
+
try {
|
617 |
+
if (empty($post))
|
618 |
+
Mage::throwException($this->__('Invalid form data.'));
|
619 |
+
$number = $post['number'];
|
620 |
+
$charone = substr($number, 0, 1);
|
621 |
+
$chartwo = substr($number, 0, 2);
|
622 |
+
if ($charone == '0' && $chartwo == '00')
|
623 |
+
$number = $number;
|
624 |
+
|
625 |
+
if (isset($number))
|
626 |
+
{
|
627 |
+
$adminUserModel = Mage::getModel('admin/user');
|
628 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
629 |
+
$admin_data = $userCollection->getData();
|
630 |
+
$firstname = isset($admin_data[0]['firstname'])?$admin_data[0]['firstname']:'';
|
631 |
+
$lastname = isset($admin_data[0]['lastname'])?$admin_data[0]['lastname']:'';
|
632 |
+
$characters = '1234567890';
|
633 |
+
$ref_num = '';
|
634 |
+
for ($i = 0; $i < 9; $i++)
|
635 |
+
$ref_num .= $characters[rand(0, strlen($characters) - 1)];
|
636 |
+
|
637 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
638 |
+
if ($locale == 'fr_FR')
|
639 |
+
$ord_date = date('d/m/Y');
|
640 |
+
else
|
641 |
+
$ord_date = date('m/d/Y');
|
642 |
+
$orderprice = rand(10, 1000);
|
643 |
+
$total_pay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
644 |
+
$msgbody = $post['message'];
|
645 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
646 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
647 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
648 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
649 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
650 |
+
$arr = array();
|
651 |
+
$arr['to'] = $number;
|
652 |
+
$arr['from'] = isset($post['sender'])?$post['sender']:'';
|
653 |
+
$arr['text'] = $msgbody;
|
654 |
+
|
655 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
656 |
+
if (isset($result->status) && $result->status == 'OK')
|
657 |
+
echo 'OK';
|
658 |
+
else
|
659 |
+
echo 'KO';
|
660 |
+
}
|
661 |
+
|
662 |
+
}
|
663 |
+
catch (Exception $e)
|
664 |
+
{
|
665 |
+
echo $this->__($e->getMessage());
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
public function ajaxordershippedAction($sender='', $message='', $number='')
|
670 |
+
{
|
671 |
+
$post = $this->getRequest()->getPost();
|
672 |
+
try {
|
673 |
+
if (empty($post))
|
674 |
+
Mage::throwException($this->__('Invalid form data.'));
|
675 |
+
$number = $post['number'];
|
676 |
+
$charone = substr($number, 0, 1);
|
677 |
+
$chartwo = substr($number, 0, 2);
|
678 |
+
|
679 |
+
if ($charone == '0' && $chartwo == '00')
|
680 |
+
$number = $number;
|
681 |
+
|
682 |
+
if (isset($number))
|
683 |
+
{
|
684 |
+
$adminUserModel = Mage::getModel('admin/user');
|
685 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
686 |
+
$admin_data = $userCollection->getData();
|
687 |
+
$firstname = isset($admin_data[0]['firstname'])?$admin_data[0]['firstname']:'';
|
688 |
+
$lastname = isset($admin_data[0]['lastname'])?$admin_data[0]['lastname']:'';
|
689 |
+
$characters = '1234567890';
|
690 |
+
$ref_num = '';
|
691 |
+
for ($i = 0; $i < 9; $i++)
|
692 |
+
$ref_num .= $characters[rand(0, strlen($characters) - 1)];
|
693 |
+
|
694 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
695 |
+
if ($locale == 'fr_FR')
|
696 |
+
$ord_date = date('d/m/Y');
|
697 |
+
else
|
698 |
+
$ord_date = date('m/d/Y');
|
699 |
+
$orderprice = rand(10, 1000);
|
700 |
+
$total_pay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
701 |
+
$msgbody = $post['message'];
|
702 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
703 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
704 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
705 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
706 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
707 |
+
$arr = array();
|
708 |
+
$arr['to'] = $number;
|
709 |
+
$arr['from'] = !empty($post['sender'])?$post['sender']:'';
|
710 |
+
$arr['text'] = $msgbody;
|
711 |
+
|
712 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
713 |
+
if (isset($result->status) && $result->status == 'OK')
|
714 |
+
echo 'OK';
|
715 |
+
else
|
716 |
+
echo 'KO';exit;
|
717 |
+
}
|
718 |
+
|
719 |
+
}
|
720 |
+
catch (Exception $e)
|
721 |
+
{
|
722 |
+
echo $this->__($e->getMessage());
|
723 |
+
}
|
724 |
+
}
|
725 |
+
|
726 |
+
public function ajaxsmscampaignAction($sender='', $message='', $number='')
|
727 |
+
{
|
728 |
+
$post = $this->getRequest()->getPost();
|
729 |
+
try {
|
730 |
+
if (empty($post))
|
731 |
+
Mage::throwException($this->__('Invalid form data.'));
|
732 |
+
$number = $post['number'];
|
733 |
+
$charone = substr($number, 0, 1);
|
734 |
+
$chartwo = substr($number, 0, 2);
|
735 |
+
if ($charone == '0' && $chartwo == '00')
|
736 |
+
$number = $number;
|
737 |
+
|
738 |
+
if (isset($number))
|
739 |
+
{
|
740 |
+
$adminUserModel = Mage::getModel('admin/user');
|
741 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
742 |
+
$admin_data = $userCollection->getData();
|
743 |
+
$firstname = isset($admin_data[0]['firstname'])?$admin_data[0]['firstname']:'';
|
744 |
+
$lastname = isset($admin_data[0]['lastname'])?$admin_data[0]['lastname']:'';
|
745 |
+
$msgbody = $post['message'];
|
746 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
747 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
748 |
+
$arr = array();
|
749 |
+
$arr['to'] = $number;
|
750 |
+
$arr['from'] = !empty($post['sender'])?$post['sender']:'';
|
751 |
+
$arr['text'] = $msgbody;
|
752 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
753 |
+
if (isset($result->status) && $result->status == 'OK')
|
754 |
+
echo 'OK';
|
755 |
+
else
|
756 |
+
echo 'KO';
|
757 |
+
}
|
758 |
+
|
759 |
+
}
|
760 |
+
catch (Exception $e)
|
761 |
+
{
|
762 |
+
echo $this->__($e->getMessage());
|
763 |
+
}
|
764 |
+
}
|
765 |
+
|
766 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/IndexController.php
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/etc/adminhtml.xml
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/etc/config.xml
RENAMED
@@ -1,325 +1,321 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Sendinblue_Sendinblue>
|
5 |
-
<version>1.
|
6 |
-
<platform>ce</platform>
|
7 |
-
</Sendinblue_Sendinblue>
|
8 |
-
</modules>
|
9 |
-
<adminhtml>
|
10 |
-
<menu>
|
11 |
-
<system>
|
12 |
-
<children>
|
13 |
-
<mails translate="title" module="sendinblue">
|
14 |
-
<title>SendinBlue Settings</title>
|
15 |
-
<action>sendinblue/adminhtml_myform</action>
|
16 |
-
<sort_order>0</sort_order>
|
17 |
-
|
18 |
-
</mails>
|
19 |
-
</children>
|
20 |
-
</system>
|
21 |
-
</menu>
|
22 |
-
<translate></translate>
|
23 |
-
<events>
|
24 |
-
|
25 |
-
<!--use for delete customer (post) -->
|
26 |
-
<controller_action_postdispatch_adminhtml_customer_massDelete>
|
27 |
-
<observers>
|
28 |
-
<sendinblue_admin_customer_massDelete>
|
29 |
-
<type>singleton</type>
|
30 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
31 |
-
<method>adminCustomerDelete</method>
|
32 |
-
</sendinblue_admin_customer_massDelete>
|
33 |
-
</observers>
|
34 |
-
</controller_action_postdispatch_adminhtml_customer_massDelete>
|
35 |
-
|
36 |
-
<!--use for delete newsletter subcriber (post) -->
|
37 |
-
<controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
38 |
-
<observers>
|
39 |
-
<sendinblue_admin_newsletter_massDelete>
|
40 |
-
<type>singleton</type>
|
41 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
42 |
-
<method>adminSubcriberDelete</method>
|
43 |
-
</sendinblue_admin_newsletter_massDelete>
|
44 |
-
</observers>
|
45 |
-
</controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
46 |
-
|
47 |
-
<!--use for subscribe customer (subscribe customer for newsletter from admin) (post) -->
|
48 |
-
<controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
49 |
-
<observers>
|
50 |
-
<sendinblue_admin_customer_massSubscribe>
|
51 |
-
<type>singleton</type>
|
52 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
53 |
-
<method>adminCustomerSubscribe</method>
|
54 |
-
</sendinblue_admin_customer_massSubscribe>
|
55 |
-
</observers>
|
56 |
-
</controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
57 |
-
|
58 |
-
<!--use for unsubscribe customer (post) -->
|
59 |
-
<controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
60 |
-
<observers>
|
61 |
-
<sendinblue_admin_customer_massUnsubscribe>
|
62 |
-
<type>singleton</type>
|
63 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
64 |
-
<method>adminCustomerDelete</method>
|
65 |
-
</sendinblue_admin_customer_massUnsubscribe>
|
66 |
-
</observers>
|
67 |
-
</controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
68 |
-
|
69 |
-
<!--use for unsubscribe newsletter subscriber (post) -->
|
70 |
-
<controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
71 |
-
<observers>
|
72 |
-
<sendinblue_admin_newsletter_massUnsubscribe>
|
73 |
-
<type>singleton</type>
|
74 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
75 |
-
<method>adminSubcriberDelete</method>
|
76 |
-
</sendinblue_admin_newsletter_massUnsubscribe>
|
77 |
-
</observers>
|
78 |
-
</controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
79 |
-
|
80 |
-
|
81 |
-
<sales_order_save_after>
|
82 |
-
<observers>
|
83 |
-
<sendinblue_update_data>
|
84 |
-
<type>singleton</type>
|
85 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
86 |
-
<method>updateStatus</method>
|
87 |
-
</sendinblue_update_data>
|
88 |
-
</observers>
|
89 |
-
</sales_order_save_after>
|
90 |
-
|
91 |
-
</events>
|
92 |
-
<acl>
|
93 |
-
<resources>
|
94 |
-
<all>
|
95 |
-
<title>Allow Everything</title>
|
96 |
-
</all>
|
97 |
-
<admin>
|
98 |
-
<children>
|
99 |
-
<mails>
|
100 |
-
<children>
|
101 |
-
<mails>
|
102 |
-
<title>Sendinblue</title>
|
103 |
-
</mails>
|
104 |
-
</children>
|
105 |
-
</mails>
|
106 |
-
<system>
|
107 |
-
<children>
|
108 |
-
<config>
|
109 |
-
<children>
|
110 |
-
<sendinblue>
|
111 |
-
<title>Sendinblue</title>
|
112 |
-
</sendinblue>
|
113 |
-
</children>
|
114 |
-
</config>
|
115 |
-
</children>
|
116 |
-
</system>
|
117 |
-
</children>
|
118 |
-
<children>
|
119 |
-
<system>
|
120 |
-
<children>
|
121 |
-
<mails translate="title" module="sendinblue">
|
122 |
-
<title>Sendinblue Settings</title>
|
123 |
-
<sort_order>0</sort_order>
|
124 |
-
<action></action>
|
125 |
-
</mails>
|
126 |
-
</children>
|
127 |
-
</system>
|
128 |
-
</children>
|
129 |
-
</admin>
|
130 |
-
</resources>
|
131 |
-
</acl>
|
132 |
-
<translate>
|
133 |
-
<modules>
|
134 |
-
<Sendinblue_Sendinblue>
|
135 |
-
<files>
|
136 |
-
<default>Sendinblue.csv</default>
|
137 |
-
</files>
|
138 |
-
</Sendinblue_Sendinblue>
|
139 |
-
</modules>
|
140 |
-
</translate>
|
141 |
-
|
142 |
-
|
143 |
-
<layout>
|
144 |
-
<updates>
|
145 |
-
<sendinblue_sendinblue>
|
146 |
-
<file>sendinblue.xml</file>
|
147 |
-
</sendinblue_sendinblue>
|
148 |
-
</updates>
|
149 |
-
</layout>
|
150 |
-
|
151 |
-
</adminhtml>
|
152 |
-
<admin>
|
153 |
-
<routers>
|
154 |
-
<sendinblue_admin>
|
155 |
-
<use>admin</use>
|
156 |
-
<args>
|
157 |
-
<module>Sendinblue_Sendinblue</module>
|
158 |
-
<frontName>sendinblue</frontName>
|
159 |
-
</args>
|
160 |
-
</sendinblue_admin>
|
161 |
-
</routers>
|
162 |
-
<children>
|
163 |
-
<system>
|
164 |
-
<children>
|
165 |
-
<mails translate="label" module="sendinblue">
|
166 |
-
<title>Sendinblue Settings</title>
|
167 |
-
<sort_order>40</sort_order>
|
168 |
-
<action>adminhtml/system_config/edit/section/sendinblue</action>
|
169 |
-
</mails>
|
170 |
-
</children>
|
171 |
-
</system>
|
172 |
-
</children>
|
173 |
-
</admin>
|
174 |
-
<global>
|
175 |
-
<events>
|
176 |
-
<newsletter_subscriber_save_commit_after>
|
177 |
-
<observers>
|
178 |
-
<sendinblue_sendinblue_model_observer>
|
179 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
180 |
-
<method>subscribedToNewsletter</method>
|
181 |
-
</sendinblue_sendinblue_model_observer>
|
182 |
-
</observers>
|
183 |
-
</newsletter_subscriber_save_commit_after>
|
184 |
-
<customer_save_after>
|
185 |
-
<observers>
|
186 |
-
<sendinblue_update_data>
|
187 |
-
<type>singleton</type>
|
188 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
189 |
-
<method>updateNewObserver</method>
|
190 |
-
</sendinblue_update_data>
|
191 |
-
</observers>
|
192 |
-
</customer_save_after>
|
193 |
-
</events>
|
194 |
-
|
195 |
-
<template>
|
196 |
-
<email>
|
197 |
-
<custom_template>
|
198 |
-
<label>Sendinblue custom email module</label>
|
199 |
-
<file>sendinsmtp_conf.html</file>
|
200 |
-
<type>html</type>
|
201 |
-
</custom_template>
|
202 |
-
<notification_template>
|
203 |
-
<label>Sendinblue notification email module</label>
|
204 |
-
<file>sendin_notification.html</file>
|
205 |
-
<type>html</type>
|
206 |
-
</notification_template>
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
</
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
<connection>
|
241 |
-
<use>
|
242 |
-
</connection>
|
243 |
-
</
|
244 |
-
<
|
245 |
-
<connection>
|
246 |
-
<use>
|
247 |
-
</connection>
|
248 |
-
</
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
<
|
257 |
-
<sendinblue>
|
258 |
-
<class>
|
259 |
-
</sendinblue>
|
260 |
-
</
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
<
|
283 |
-
<
|
284 |
-
<
|
285 |
-
<
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
</layout>
|
323 |
-
|
324 |
-
</frontend>
|
325 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sendinblue_Sendinblue>
|
5 |
+
<version>1.2.6</version>
|
6 |
+
<platform>ce</platform>
|
7 |
+
</Sendinblue_Sendinblue>
|
8 |
+
</modules>
|
9 |
+
<adminhtml>
|
10 |
+
<menu>
|
11 |
+
<system>
|
12 |
+
<children>
|
13 |
+
<mails translate="title" module="sendinblue">
|
14 |
+
<title>SendinBlue Settings</title>
|
15 |
+
<action>sendinblue/adminhtml_myform</action>
|
16 |
+
<sort_order>0</sort_order>
|
17 |
+
|
18 |
+
</mails>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</menu>
|
22 |
+
<translate></translate>
|
23 |
+
<events>
|
24 |
+
|
25 |
+
<!--use for delete customer (post) -->
|
26 |
+
<controller_action_postdispatch_adminhtml_customer_massDelete>
|
27 |
+
<observers>
|
28 |
+
<sendinblue_admin_customer_massDelete>
|
29 |
+
<type>singleton</type>
|
30 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
31 |
+
<method>adminCustomerDelete</method>
|
32 |
+
</sendinblue_admin_customer_massDelete>
|
33 |
+
</observers>
|
34 |
+
</controller_action_postdispatch_adminhtml_customer_massDelete>
|
35 |
+
|
36 |
+
<!--use for delete newsletter subcriber (post) -->
|
37 |
+
<controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
38 |
+
<observers>
|
39 |
+
<sendinblue_admin_newsletter_massDelete>
|
40 |
+
<type>singleton</type>
|
41 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
42 |
+
<method>adminSubcriberDelete</method>
|
43 |
+
</sendinblue_admin_newsletter_massDelete>
|
44 |
+
</observers>
|
45 |
+
</controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
46 |
+
|
47 |
+
<!--use for subscribe customer (subscribe customer for newsletter from admin) (post) -->
|
48 |
+
<controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
49 |
+
<observers>
|
50 |
+
<sendinblue_admin_customer_massSubscribe>
|
51 |
+
<type>singleton</type>
|
52 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
53 |
+
<method>adminCustomerSubscribe</method>
|
54 |
+
</sendinblue_admin_customer_massSubscribe>
|
55 |
+
</observers>
|
56 |
+
</controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
57 |
+
|
58 |
+
<!--use for unsubscribe customer (post) -->
|
59 |
+
<controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
60 |
+
<observers>
|
61 |
+
<sendinblue_admin_customer_massUnsubscribe>
|
62 |
+
<type>singleton</type>
|
63 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
64 |
+
<method>adminCustomerDelete</method>
|
65 |
+
</sendinblue_admin_customer_massUnsubscribe>
|
66 |
+
</observers>
|
67 |
+
</controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
68 |
+
|
69 |
+
<!--use for unsubscribe newsletter subscriber (post) -->
|
70 |
+
<controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
71 |
+
<observers>
|
72 |
+
<sendinblue_admin_newsletter_massUnsubscribe>
|
73 |
+
<type>singleton</type>
|
74 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
75 |
+
<method>adminSubcriberDelete</method>
|
76 |
+
</sendinblue_admin_newsletter_massUnsubscribe>
|
77 |
+
</observers>
|
78 |
+
</controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
79 |
+
|
80 |
+
|
81 |
+
<sales_order_save_after>
|
82 |
+
<observers>
|
83 |
+
<sendinblue_update_data>
|
84 |
+
<type>singleton</type>
|
85 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
86 |
+
<method>updateStatus</method>
|
87 |
+
</sendinblue_update_data>
|
88 |
+
</observers>
|
89 |
+
</sales_order_save_after>
|
90 |
+
|
91 |
+
</events>
|
92 |
+
<acl>
|
93 |
+
<resources>
|
94 |
+
<all>
|
95 |
+
<title>Allow Everything</title>
|
96 |
+
</all>
|
97 |
+
<admin>
|
98 |
+
<children>
|
99 |
+
<mails>
|
100 |
+
<children>
|
101 |
+
<mails>
|
102 |
+
<title>Sendinblue</title>
|
103 |
+
</mails>
|
104 |
+
</children>
|
105 |
+
</mails>
|
106 |
+
<system>
|
107 |
+
<children>
|
108 |
+
<config>
|
109 |
+
<children>
|
110 |
+
<sendinblue>
|
111 |
+
<title>Sendinblue</title>
|
112 |
+
</sendinblue>
|
113 |
+
</children>
|
114 |
+
</config>
|
115 |
+
</children>
|
116 |
+
</system>
|
117 |
+
</children>
|
118 |
+
<children>
|
119 |
+
<system>
|
120 |
+
<children>
|
121 |
+
<mails translate="title" module="sendinblue">
|
122 |
+
<title>Sendinblue Settings</title>
|
123 |
+
<sort_order>0</sort_order>
|
124 |
+
<action></action>
|
125 |
+
</mails>
|
126 |
+
</children>
|
127 |
+
</system>
|
128 |
+
</children>
|
129 |
+
</admin>
|
130 |
+
</resources>
|
131 |
+
</acl>
|
132 |
+
<translate>
|
133 |
+
<modules>
|
134 |
+
<Sendinblue_Sendinblue>
|
135 |
+
<files>
|
136 |
+
<default>Sendinblue.csv</default>
|
137 |
+
</files>
|
138 |
+
</Sendinblue_Sendinblue>
|
139 |
+
</modules>
|
140 |
+
</translate>
|
141 |
+
|
142 |
+
|
143 |
+
<layout>
|
144 |
+
<updates>
|
145 |
+
<sendinblue_sendinblue>
|
146 |
+
<file>sendinblue.xml</file>
|
147 |
+
</sendinblue_sendinblue>
|
148 |
+
</updates>
|
149 |
+
</layout>
|
150 |
+
|
151 |
+
</adminhtml>
|
152 |
+
<admin>
|
153 |
+
<routers>
|
154 |
+
<sendinblue_admin>
|
155 |
+
<use>admin</use>
|
156 |
+
<args>
|
157 |
+
<module>Sendinblue_Sendinblue</module>
|
158 |
+
<frontName>sendinblue</frontName>
|
159 |
+
</args>
|
160 |
+
</sendinblue_admin>
|
161 |
+
</routers>
|
162 |
+
<children>
|
163 |
+
<system>
|
164 |
+
<children>
|
165 |
+
<mails translate="label" module="sendinblue">
|
166 |
+
<title>Sendinblue Settings</title>
|
167 |
+
<sort_order>40</sort_order>
|
168 |
+
<action>adminhtml/system_config/edit/section/sendinblue</action>
|
169 |
+
</mails>
|
170 |
+
</children>
|
171 |
+
</system>
|
172 |
+
</children>
|
173 |
+
</admin>
|
174 |
+
<global>
|
175 |
+
<events>
|
176 |
+
<newsletter_subscriber_save_commit_after>
|
177 |
+
<observers>
|
178 |
+
<sendinblue_sendinblue_model_observer>
|
179 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
180 |
+
<method>subscribedToNewsletter</method>
|
181 |
+
</sendinblue_sendinblue_model_observer>
|
182 |
+
</observers>
|
183 |
+
</newsletter_subscriber_save_commit_after>
|
184 |
+
<customer_save_after>
|
185 |
+
<observers>
|
186 |
+
<sendinblue_update_data>
|
187 |
+
<type>singleton</type>
|
188 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
189 |
+
<method>updateNewObserver</method>
|
190 |
+
</sendinblue_update_data>
|
191 |
+
</observers>
|
192 |
+
</customer_save_after>
|
193 |
+
</events>
|
194 |
+
|
195 |
+
<template>
|
196 |
+
<email>
|
197 |
+
<custom_template>
|
198 |
+
<label>Sendinblue custom email module</label>
|
199 |
+
<file>sendinsmtp_conf.html</file>
|
200 |
+
<type>html</type>
|
201 |
+
</custom_template>
|
202 |
+
<notification_template>
|
203 |
+
<label>Sendinblue notification email module</label>
|
204 |
+
<file>sendin_notification.html</file>
|
205 |
+
<type>html</type>
|
206 |
+
</notification_template>
|
207 |
+
<doubleoptin_template>
|
208 |
+
<label>Sendinblue doubleoptin email module</label>
|
209 |
+
<file>doubleoptin_temp.html</file>
|
210 |
+
<type>html</type>
|
211 |
+
</doubleoptin_template>
|
212 |
+
</email>
|
213 |
+
</template>
|
214 |
+
|
215 |
+
<models>
|
216 |
+
<core>
|
217 |
+
<rewrite>
|
218 |
+
<email>Sendinblue_Sendinblue_Model_Email</email>
|
219 |
+
<email_template>Sendinblue_Sendinblue_Model_Email_Template</email_template>
|
220 |
+
</rewrite>
|
221 |
+
</core>
|
222 |
+
<sendinblue>
|
223 |
+
<class>Sendinblue_Sendinblue_Model</class>
|
224 |
+
<resourceModel>sendinblue_mysql4</resourceModel>
|
225 |
+
</sendinblue>
|
226 |
+
<sendinblue_mysql4>
|
227 |
+
<class>Sendinblue_Sendinblue_Model_Mysql4</class>
|
228 |
+
<entities>
|
229 |
+
<sendinblue>
|
230 |
+
<table>sendinblue_country_codes</table>
|
231 |
+
</sendinblue>
|
232 |
+
</entities>
|
233 |
+
</sendinblue_mysql4>
|
234 |
+
</models>
|
235 |
+
<resources>
|
236 |
+
<sendinblue_setup>
|
237 |
+
<setup>
|
238 |
+
<module>Sendinblue_Sendinblue</module>
|
239 |
+
</setup>
|
240 |
+
<connection>
|
241 |
+
<use>core_setup</use>
|
242 |
+
</connection>
|
243 |
+
</sendinblue_setup>
|
244 |
+
<sendinblue_write>
|
245 |
+
<connection>
|
246 |
+
<use>core_write</use>
|
247 |
+
</connection>
|
248 |
+
</sendinblue_write>
|
249 |
+
<sendinblue_read>
|
250 |
+
<connection>
|
251 |
+
<use>core_read</use>
|
252 |
+
</connection>
|
253 |
+
</sendinblue_read>
|
254 |
+
</resources>
|
255 |
+
|
256 |
+
<helpers>
|
257 |
+
<sendinblue>
|
258 |
+
<class>Sendinblue_Sendinblue_Helper</class>
|
259 |
+
</sendinblue>
|
260 |
+
</helpers>
|
261 |
+
<blocks>
|
262 |
+
<sendinblue>
|
263 |
+
<class>Sendinblue_Sendinblue_Block</class>
|
264 |
+
</sendinblue>
|
265 |
+
</blocks>
|
266 |
+
|
267 |
+
</global>
|
268 |
+
<crontab>
|
269 |
+
<jobs>
|
270 |
+
<sendinblue_sendinblue>
|
271 |
+
<schedule>
|
272 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
273 |
+
</schedule>
|
274 |
+
<run>
|
275 |
+
<model>sendinblue/observer::syncData</model>
|
276 |
+
</run>
|
277 |
+
</sendinblue_sendinblue>
|
278 |
+
</jobs>
|
279 |
+
</crontab>
|
280 |
+
<default>
|
281 |
+
<sendinblue>
|
282 |
+
<general>
|
283 |
+
<enabled>0</enabled>
|
284 |
+
<test>0</test>
|
285 |
+
<test_address />
|
286 |
+
</general>
|
287 |
+
<smtp>
|
288 |
+
<host>sendinblue.fr</host>
|
289 |
+
<port />
|
290 |
+
<login />
|
291 |
+
<password />
|
292 |
+
<ssl />
|
293 |
+
</smtp>
|
294 |
+
</sendinblue>
|
295 |
+
</default>
|
296 |
+
<frontend>
|
297 |
+
<events>
|
298 |
+
<!--use when new subcriber add for newsletter-->
|
299 |
+
<controller_action_postdispatch_newsletter_subscriber_new>
|
300 |
+
<observers>
|
301 |
+
<sendinblue_subscribe_new_observer>
|
302 |
+
<type>singleton</type>
|
303 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
304 |
+
<method>subscribeObserver</method>
|
305 |
+
</sendinblue_subscribe_new_observer>
|
306 |
+
</observers>
|
307 |
+
</controller_action_postdispatch_newsletter_subscriber_new>
|
308 |
+
|
309 |
+
<!--use when new user register check (is_subscribed = 1)-->
|
310 |
+
</events>
|
311 |
+
|
312 |
+
<layout>
|
313 |
+
<updates>
|
314 |
+
<sendinblue_sendinblue>
|
315 |
+
<file>sendinblue.xml</file>
|
316 |
+
</sendinblue_sendinblue>
|
317 |
+
</updates>
|
318 |
+
</layout>
|
319 |
+
|
320 |
+
</frontend>
|
321 |
+
</config>
|
|
|
|
|
|
|
|
app/code/{local/Sendinblue/Sendinblue/sql/sendinblue_setup/install-0.1.0.php → community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-install-0.1.0.php}
RENAMED
File without changes
|
app/code/community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
//echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number <br />';
|
12 |
+
//die();
|
13 |
+
|
14 |
+
?>
|
app/code/local/Sendinblue/Sendinblue/Block/Sendinblue.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_Block_Sendinblue extends Mage_Core_Block_Template
|
12 |
-
{
|
13 |
-
public function _prepareLayout()
|
14 |
-
{
|
15 |
-
return parent::_prepareLayout();
|
16 |
-
}
|
17 |
-
public function getPagerHtml()
|
18 |
-
{
|
19 |
-
return $this->getChildHtml('pager');
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function _toHtml()
|
23 |
-
{
|
24 |
-
|
25 |
-
$get_Enable_Status = Mage::getModel('sendinblue/sendinblue')->getEnableStatus();
|
26 |
-
|
27 |
-
$get_Tracking_Status = Mage::getModel('sendinblue/sendinblue')->getTrackingStatus();
|
28 |
-
|
29 |
-
$get_order_status = Mage::getModel('sendinblue/sendinblue')->getOrderSmsStatus();
|
30 |
-
|
31 |
-
$get_User_lists = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
32 |
-
|
33 |
-
|
34 |
-
$value = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp();
|
35 |
-
|
36 |
-
$orders = Mage::getModel('sales/order')->getCollection();
|
37 |
-
|
38 |
-
$order = $orders->getLastItem();
|
39 |
-
$order_Data = $order->getPayment()->getData();
|
40 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
41 |
-
$orderaddress = Mage::getModel('sales/order')->loadByIncrementId($order->increment_id);
|
42 |
-
|
43 |
-
$mobile = $customer->getPrimaryBillingAddress()->getTelephone();
|
44 |
-
$email = $customer->getEmail();// for email address
|
45 |
-
$firstname = $customer->getFirstname();// For first name
|
46 |
-
$lastname= $customer->getLastname();// For last name
|
47 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
48 |
-
$nlStatus = $costomer_data->getStatus();
|
49 |
-
if ($get_Enable_Status == 1 && $get_Tracking_Status == 1 && $nlStatus == 1)
|
50 |
-
{
|
51 |
-
|
52 |
-
$value_config = Mage::getModel('sendinblue/sendinblue')->getApiConfigValue();
|
53 |
-
if ($value_config->date_format == 'dd-mm-yyyy')
|
54 |
-
$date = date('d-m-Y', strtotime($order->created_at));
|
55 |
-
else
|
56 |
-
$date = date('m-d-Y', strtotime($order->created_at));
|
57 |
-
|
58 |
-
$html = '';
|
59 |
-
|
60 |
-
$html .= '<script type="text/javascript">
|
61 |
-
/**Code for NB tracking*/
|
62 |
-
function loadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(script.readyState){script.onreadystatechange=function(){
|
63 |
-
if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback(url)}}}else{
|
64 |
-
script.onload=function(){callback(url)}}script.src=url;if(document.body){document.body.appendChild(script)}else{
|
65 |
-
document.head.appendChild(script)}}
|
66 |
-
var nbJsURL = (("https:" == document.location.protocol) ? "https://my-tracking-orders.googlecode.com/files" : "http://my-tracking-orders.googlecode.com/files");
|
67 |
-
var nbBaseURL = "http://tracking.mailin.fr/";
|
68 |
-
loadScript(nbJsURL+"/nbv2.js",
|
69 |
-
function(){
|
70 |
-
/*You can put your custom variables here as shown in example.*/
|
71 |
-
try {
|
72 |
-
var nbTracker = nb.getTracker(nbBaseURL , "'.$value->result->tracking_data->site_id.'");
|
73 |
-
var list = ["'.$get_User_lists.'"];
|
74 |
-
var attributes = ["EMAIL","PRENOM","NOM","ORDER_ID","ORDER_DATE","ORDER_PRICE"];
|
75 |
-
var values = ["'.$email.'","'.$firstname.'","'.$lastname.'","'.$order->increment_id.'","'.$date.'","'.$order_Data[amount_ordered].'"];
|
76 |
-
nbTracker.setListData(list);
|
77 |
-
nbTracker.setTrackingData(attributes,values);
|
78 |
-
nbTracker.trackPageView();
|
79 |
-
} catch( err ) {}
|
80 |
-
});
|
81 |
-
|
82 |
-
</script>';
|
83 |
-
|
84 |
-
echo $html;
|
85 |
-
}
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Observer.php
DELETED
@@ -1,260 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
class Sendinblue_Sendinblue_Model_Observer
|
11 |
-
{
|
12 |
-
protected static $fields = array ();
|
13 |
-
public function adminSubcriberDelete($observer)
|
14 |
-
{
|
15 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
16 |
-
if (isset($params['subscriber']) && count($params['subscriber'] > 0))
|
17 |
-
{
|
18 |
-
$customer_email = array();
|
19 |
-
foreach ($params['subscriber'] as $costomer_id)
|
20 |
-
{
|
21 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->load($costomer_id)->toArray();
|
22 |
-
$customer_email[] = $costomer_data['subscriber_email'];
|
23 |
-
}
|
24 |
-
$customer_emails = implode('|', $customer_email);
|
25 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
26 |
-
}
|
27 |
-
if ($responce->result)
|
28 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
29 |
-
return $this;
|
30 |
-
}
|
31 |
-
public function adminCustomerDelete($observer)
|
32 |
-
{
|
33 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
34 |
-
if (isset($params['customer']) && count($params['customer'] > 0))
|
35 |
-
{
|
36 |
-
$customer_email = array();
|
37 |
-
foreach ($params['customer'] as $costomer_id)
|
38 |
-
{
|
39 |
-
$costomer_data = Mage::getModel('customer/customer')->load($costomer_id)->toArray();
|
40 |
-
$customer_email[] = $costomer_data['email'];
|
41 |
-
}
|
42 |
-
$customer_emails = implode('|', $customer_email);
|
43 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
44 |
-
}
|
45 |
-
if ($responce->result)
|
46 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
47 |
-
return $this;
|
48 |
-
}
|
49 |
-
public function adminCustomerSubscribe($observer)
|
50 |
-
{
|
51 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
52 |
-
if (isset($params['customer']) && count($params['customer'] > 0))
|
53 |
-
{
|
54 |
-
$customer_email = array();
|
55 |
-
foreach ($params['customer'] as $costomer_id)
|
56 |
-
{
|
57 |
-
$costomer_data = Mage::getModel('customer/customer')->load($costomer_id)->toArray();
|
58 |
-
$customer_email[] = $costomer_data['email'];
|
59 |
-
}
|
60 |
-
$customer_emails = implode('|', $customer_email);
|
61 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->addEmailList($customer_emails);
|
62 |
-
}
|
63 |
-
if ($responce->result)
|
64 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->infoUpdatedCount.' record(s) were subscribed');
|
65 |
-
return $this;
|
66 |
-
}
|
67 |
-
public function subscribeObserver($observer)
|
68 |
-
{
|
69 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
70 |
-
$client = 0;
|
71 |
-
$extra = ''.'|'.''.'|'.$client.'|'.'';
|
72 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($params['email'], $extra);
|
73 |
-
return $this;
|
74 |
-
}
|
75 |
-
public function updateNewObserver($observer)
|
76 |
-
{
|
77 |
-
$extra = null;
|
78 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
79 |
-
|
80 |
-
$cus_session = Mage::getSingleton('customer/session')->getCustomer();
|
81 |
-
$customer = ($cus_session->getEmail())? $cus_session : $observer->getCustomer();
|
82 |
-
$cus_data = $cus_session->getData();
|
83 |
-
$email = (isset($params['email']))? $params['email'] : $customer->getEmail();
|
84 |
-
$cid = $customer->getEntityid();
|
85 |
-
$fname = $customer->getFirstname();
|
86 |
-
$fname = empty($fname)?'':$fname;
|
87 |
-
$lname = $customer->getLastname();
|
88 |
-
$lname = empty($lname)?'':$lname;
|
89 |
-
|
90 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToFilter('parent_id',$cid);
|
91 |
-
$telephone = '';
|
92 |
-
foreach ($collectionAddress as $customerPhno) {
|
93 |
-
$telephone = $customerPhno->getData('telephone');
|
94 |
-
$firstname = $customerPhno->getData('firstname');
|
95 |
-
$lastname = $customerPhno->getData('lastname');
|
96 |
-
|
97 |
-
}
|
98 |
-
$telephone = empty($telephone)?'':$telephone;
|
99 |
-
$firstname = empty($firstname)?'':$firstname;
|
100 |
-
$lastname = empty($lastname)?'':$lastname;
|
101 |
-
|
102 |
-
if ($fname != '' || $lname != '')
|
103 |
-
$client = 1;
|
104 |
-
else
|
105 |
-
$client = 0;
|
106 |
-
|
107 |
-
$is_subscribed = (isset($params['is_subscribed']))? $params['is_subscribed'] : '';
|
108 |
-
|
109 |
-
$is_subscribedupdate = (isset($params['is_subscribed']))? 1 : 0;
|
110 |
-
if ( isset($params['is_subscribed']) == '' ) {
|
111 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
112 |
-
$nlStatus = $costomer_data->getStatus();
|
113 |
-
$is_subscribedupdate = 1;
|
114 |
-
if ($nlStatus == '') {
|
115 |
-
$is_subscribedupdate = 0;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
if ($fname != '' || $lname != '' || $telephone != '' || $email != '')
|
119 |
-
{
|
120 |
-
$extra = $fname.'|'.$lname.'|'.$client.'|'.$telephone;
|
121 |
-
if (isset($is_subscribed) && $is_subscribed == 1)
|
122 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($email, $extra);
|
123 |
-
|
124 |
-
if (isset($is_subscribedupdate) && $is_subscribedupdate == 1) {
|
125 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($email, $extra);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
if (isset($is_subscribed) && $is_subscribed != '' && $is_subscribed === 0) {
|
130 |
-
Mage::getSingleton('core/session')->addSuccess($is_subscribed);
|
131 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($email);
|
132 |
-
}
|
133 |
-
return $this;
|
134 |
-
}
|
135 |
-
public function syncData()
|
136 |
-
{
|
137 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
138 |
-
return $this;
|
139 |
-
}
|
140 |
-
public function updateStatus($observer)
|
141 |
-
{
|
142 |
-
$order = $observer->getEvent()->getOrder();
|
143 |
-
|
144 |
-
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING)
|
145 |
-
{
|
146 |
-
$history = $order->getShipmentsCollection();
|
147 |
-
$history_array=$history->toarray();
|
148 |
-
$order_id = $history_array['items']['0']['order_id'];
|
149 |
-
$shippingaddrid = $history_array['items']['0']['shipping_address_id'];
|
150 |
-
$_order = Mage::getModel('sales/order')->load($order_id);
|
151 |
-
$_shippingAddress = $_order->getShippingAddress();
|
152 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
153 |
-
$mobile = $_shippingAddress->getTelephone();
|
154 |
-
$countryid = $_shippingAddress->getCountryId();
|
155 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$countryid.'" ';
|
156 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
157 |
-
$data = $connection->fetchRow($sql);
|
158 |
-
|
159 |
-
$mobile = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($mobile,$data['country_prefix']);
|
160 |
-
$firstname = $_shippingAddress->getFirstname();
|
161 |
-
$lastname = $_shippingAddress->getLastname();
|
162 |
-
$ref_num = $_order->getIncrementId();
|
163 |
-
$orderprice = $_order->getGrandTotal();
|
164 |
-
$courrencycode = $_order->getBaseCurrencyCode();
|
165 |
-
$orderdate = $_order->getCreatedAt();
|
166 |
-
if ($locale == 'fr_FR')
|
167 |
-
$ord_date = date('d/m/Y', strtotime($orderdate));
|
168 |
-
else
|
169 |
-
$ord_date = date('m/d/Y', strtotime($orderdate));
|
170 |
-
$total_pay = $orderprice.' '.$courrencycode;
|
171 |
-
$msgbody = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage();
|
172 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
173 |
-
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
174 |
-
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
175 |
-
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
176 |
-
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
177 |
-
|
178 |
-
$arr = array();
|
179 |
-
$arr['to'] = $mobile;
|
180 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingSubject();
|
181 |
-
$arr['text'] = $msgbody;
|
182 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
183 |
-
|
184 |
-
}
|
185 |
-
}
|
186 |
-
public function ordersucess($observer)
|
187 |
-
{
|
188 |
-
$get_Enable_Status = Mage::getModel('sendinblue/sendinblue')->getEnableStatus();
|
189 |
-
$get_order_status = Mage::getModel('sendinblue/sendinblue')->getOrderSmsStatus();
|
190 |
-
$get_User_lists = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
191 |
-
$get_Tracking_Status = Mage::getModel('sendinblue/sendinblue')->getTrackingStatus();
|
192 |
-
$value = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp();
|
193 |
-
|
194 |
-
$orders = Mage::getModel('sales/order')->getCollection();
|
195 |
-
$order = $orders->getLastItem();
|
196 |
-
|
197 |
-
$order_Data = $order->getPayment()->getData();
|
198 |
-
|
199 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
200 |
-
$orderaddress = Mage::getModel('sales/order')->loadByIncrementId($order->increment_id);
|
201 |
-
|
202 |
-
//for order sms send
|
203 |
-
if($get_Enable_Status && $get_order_status)
|
204 |
-
{
|
205 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
206 |
-
$mobile = $orderaddress->getBillingAddress()->getTelephone();
|
207 |
-
$countryid = $orderaddress->getBillingAddress()->getCountryId();
|
208 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$countryid.'" ';
|
209 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
210 |
-
$data = $connection->fetchRow($sql);
|
211 |
-
|
212 |
-
$mobile = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($mobile,$data['country_prefix']);
|
213 |
-
$email = $orderaddress->getBillingAddress()->getEmail();
|
214 |
-
$firstname = $orderaddress->getBillingAddress()->getFirstname();
|
215 |
-
$lastname = $orderaddress->getBillingAddress()->getLastname();
|
216 |
-
$ref_num = $order->getIncrementId();
|
217 |
-
$orderprice = $order->getGrandTotal();
|
218 |
-
$currencycode = $order->getBaseCurrencyCode();
|
219 |
-
$orderdate = $order->getCreatedAt();
|
220 |
-
if ($locale == 'fr_FR')
|
221 |
-
$ord_date = date('d/m/Y', strtotime($orderdate));
|
222 |
-
else
|
223 |
-
$ord_date = date('m/d/Y', strtotime($orderdate));
|
224 |
-
$total_pay = $orderprice.' '.$currencycode;
|
225 |
-
$msgbody = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
226 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
227 |
-
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
228 |
-
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
229 |
-
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
230 |
-
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
231 |
-
|
232 |
-
$arr = array();
|
233 |
-
$arr['to'] = $mobile;
|
234 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
235 |
-
$arr['text'] = $msgbody;
|
236 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
237 |
-
}
|
238 |
-
|
239 |
-
}
|
240 |
-
public function subscribedToNewsletter($observer)
|
241 |
-
{
|
242 |
-
$data = $observer->subscriber;
|
243 |
-
if($data->subscriber_status == 3)
|
244 |
-
Mage::getModel('sendinblue/sendinblue')->emailDelete($data->subscriber_email);
|
245 |
-
else if ($data->subscriber_status == 1)
|
246 |
-
Mage::getModel('sendinblue/sendinblue')->emailSubscribe($data->subscriber_email);
|
247 |
-
|
248 |
-
}
|
249 |
-
public function disableCache(Varien_Event_Observer $observer)
|
250 |
-
{
|
251 |
-
$action = $observer->getEvent()->getControllerAction();
|
252 |
-
|
253 |
-
if ($action instanceof Sendinblue_Sendinblue_Adminhtml_MyformController) { // eg. Mage_Catalog_ProductController
|
254 |
-
$request = $action->getRequest();
|
255 |
-
$cache = Mage::app()->getCacheInstance();
|
256 |
-
Mage::getSingleton('core/session')->addSuccess('Done successfully');
|
257 |
-
$cache->banUse('full_page'); // Tell Magento to 'ban' the use of FPC for this request
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php
DELETED
@@ -1,1072 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
11 |
-
{
|
12 |
-
var $api_url;
|
13 |
-
var $api_key;
|
14 |
-
var $smtp_status;
|
15 |
-
var $error_message;
|
16 |
-
var $error_code;
|
17 |
-
var $lists_ids;
|
18 |
-
var $module_enable;
|
19 |
-
var $st;
|
20 |
-
public function _construct()
|
21 |
-
{
|
22 |
-
parent::_construct();
|
23 |
-
$this->_init('sendinblue/sendinblue');
|
24 |
-
$this->MIAPI();
|
25 |
-
}
|
26 |
-
/**
|
27 |
-
* functions used for set module config
|
28 |
-
*/
|
29 |
-
public function MIAPI()
|
30 |
-
{
|
31 |
-
$scope = ($this->getScope()) ? $this->getScope() : Mage::app()->getStore()->getStoreId();
|
32 |
-
$this->module_enable = $this->getEnableStatus($scope);
|
33 |
-
$this->api_url = 'http://ws.mailin.fr/';
|
34 |
-
$this->api_url2 = 'https://www.sendinblue.com/ws/getamd/';
|
35 |
-
$this->api_key = $this->getApiKey();
|
36 |
-
if (!$this->lists_ids)
|
37 |
-
$this->lists_ids = str_replace(',', '|', $this->getUserlists($scope));
|
38 |
-
$this->CreateFolderCaseTwo();
|
39 |
-
}
|
40 |
-
|
41 |
-
public function checkMobileNumber($number, $call_prefix)
|
42 |
-
{
|
43 |
-
$number = preg_replace('/\s+/', '', $number);
|
44 |
-
$charone = substr($number, 0, 1);
|
45 |
-
$chartwo = substr($number, 0, 2);
|
46 |
-
if ($charone == '0' && $chartwo != '00')
|
47 |
-
return '00'.$call_prefix.substr($number, 1);
|
48 |
-
else if ($chartwo == '00')
|
49 |
-
return $number;
|
50 |
-
else if ($charone == '+')
|
51 |
-
return '00'.substr($number, 1);
|
52 |
-
else if ($charone != '0')
|
53 |
-
return '00'.$call_prefix.$number;
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* functions used for getting module status
|
57 |
-
*/
|
58 |
-
public function getEnableStatus()
|
59 |
-
{
|
60 |
-
$status = $this->getGeneralConfig('enabled', Mage::app()->getStore()->getStoreId());
|
61 |
-
if (!$status)
|
62 |
-
return false;
|
63 |
-
return $status;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* functions used for send order sms module status
|
67 |
-
*/
|
68 |
-
public function getOrderSmsStatus()
|
69 |
-
{
|
70 |
-
$status = $this->getGeneralConfig('sms/order', Mage::app()->getStore()->getStoreId());
|
71 |
-
if (!$status)
|
72 |
-
return false;
|
73 |
-
return $status;
|
74 |
-
}
|
75 |
-
/**
|
76 |
-
* functions used for getting notify sms status
|
77 |
-
*/
|
78 |
-
public function getNotifySmsStatus()
|
79 |
-
{
|
80 |
-
$status = $this->getGeneralConfig('sms/credit', Mage::app()->getStore()->getStoreId());
|
81 |
-
if (!$status)
|
82 |
-
return false;
|
83 |
-
return $status;
|
84 |
-
}
|
85 |
-
/**
|
86 |
-
* functions used for getting Notify value limit
|
87 |
-
*/
|
88 |
-
public function getNotifyValueStatus()
|
89 |
-
{
|
90 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Value', Mage::app()->getStore()->getStoreId());
|
91 |
-
if (!$status)
|
92 |
-
return false;
|
93 |
-
return $status;
|
94 |
-
}
|
95 |
-
/**
|
96 |
-
* functions used for getting Notify email limit
|
97 |
-
*/
|
98 |
-
public function getNotifyEmailStatus()
|
99 |
-
{
|
100 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Email', Mage::app()->getStore()->getStoreId());
|
101 |
-
if (!$status)
|
102 |
-
return false;
|
103 |
-
return $status;
|
104 |
-
}
|
105 |
-
/**
|
106 |
-
* functions used for getting Notify email limit
|
107 |
-
*/
|
108 |
-
public function getNotifyCronStatus()
|
109 |
-
{
|
110 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Cron_Executed', Mage::app()->getStore()->getStoreId());
|
111 |
-
if (!$status)
|
112 |
-
return false;
|
113 |
-
return $status;
|
114 |
-
}
|
115 |
-
/**
|
116 |
-
* functions used for getting shiping sms status
|
117 |
-
*/
|
118 |
-
public function getShipingSmsStatus()
|
119 |
-
{
|
120 |
-
$status = $this->getGeneralConfig('sms/shiping', Mage::app()->getStore()->getStoreId());
|
121 |
-
if (!$status)
|
122 |
-
return false;
|
123 |
-
return $status;
|
124 |
-
}
|
125 |
-
/**
|
126 |
-
* functions used for getting campaign sms status
|
127 |
-
*/
|
128 |
-
public function getCampaignStatus()
|
129 |
-
{
|
130 |
-
$status = $this->getGeneralConfig('sms/campaign', Mage::app()->getStore()->getStoreId());
|
131 |
-
if (!$status)
|
132 |
-
return false;
|
133 |
-
return $status;
|
134 |
-
}
|
135 |
-
/**
|
136 |
-
* functions used for getting send sms order subject
|
137 |
-
*/
|
138 |
-
public function getSendSmsOrderSubject()
|
139 |
-
{
|
140 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Order', Mage::app()->getStore()->getStoreId());
|
141 |
-
if (!$status)
|
142 |
-
return false;
|
143 |
-
return $status;
|
144 |
-
}
|
145 |
-
/**
|
146 |
-
* functions used for getting order sms message
|
147 |
-
*/
|
148 |
-
public function getSendSmsmOrderMessage()
|
149 |
-
{
|
150 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Order_Message', Mage::app()->getStore()->getStoreId());
|
151 |
-
if (!$status)
|
152 |
-
return false;
|
153 |
-
return $status;
|
154 |
-
}
|
155 |
-
/**
|
156 |
-
*functions used for getting send sms shiping subject
|
157 |
-
*/
|
158 |
-
public function getSendSmsShipingSubject()
|
159 |
-
{
|
160 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Shipment', Mage::app()->getStore()->getStoreId());
|
161 |
-
if (!$status)
|
162 |
-
return false;
|
163 |
-
return $status;
|
164 |
-
}
|
165 |
-
/**
|
166 |
-
*functions used for getting shiping sms message
|
167 |
-
*/
|
168 |
-
public function getSendSmsShipingMessage()
|
169 |
-
{
|
170 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Shipment_Message', Mage::app()->getStore()->getStoreId());
|
171 |
-
if (!$status)
|
172 |
-
return false;
|
173 |
-
return $status;
|
174 |
-
}
|
175 |
-
/**
|
176 |
-
* functions used for get api key
|
177 |
-
*/
|
178 |
-
public function getApiKey()
|
179 |
-
{
|
180 |
-
$apikey = $this->getGeneralConfig('api', Mage::app()->getStore()->getStoreId());
|
181 |
-
if (!$apikey)
|
182 |
-
return false;
|
183 |
-
return $apikey;
|
184 |
-
}
|
185 |
-
/**
|
186 |
-
* functions used for getting smtp status
|
187 |
-
*/
|
188 |
-
public function getSmtpStatus()
|
189 |
-
{
|
190 |
-
$status = $this->getSendinSmtpStatus('status', Mage::app()->getStore()->getStoreId());
|
191 |
-
if (!$status)
|
192 |
-
return false;
|
193 |
-
return $status;
|
194 |
-
}
|
195 |
-
/**
|
196 |
-
* functions used for getting tracking status
|
197 |
-
*/
|
198 |
-
public function getTrackingStatus()
|
199 |
-
{
|
200 |
-
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
201 |
-
if (!$status) {
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
return $status;
|
205 |
-
}
|
206 |
-
/**
|
207 |
-
* functions used for getting userlists
|
208 |
-
*/
|
209 |
-
public function getUserlists()
|
210 |
-
{
|
211 |
-
$userlist = $this->getGeneralConfig('list', Mage::app()->getStore()->getStoreId());
|
212 |
-
if (!$userlist)
|
213 |
-
return false;
|
214 |
-
return $userlist;
|
215 |
-
}
|
216 |
-
/**
|
217 |
-
* functions used for getting general config
|
218 |
-
*/
|
219 |
-
public function getGeneralConfig($field, $store = null)
|
220 |
-
{
|
221 |
-
return Mage::getStoreConfig('sendinblue/'.$field, $store);
|
222 |
-
}
|
223 |
-
/**
|
224 |
-
* functions used for get sendinsmtp status
|
225 |
-
*/
|
226 |
-
public function getSendinSmtpStatus($field, $store = null)
|
227 |
-
{
|
228 |
-
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
229 |
-
}
|
230 |
-
public function getSyncronizeStatus()
|
231 |
-
{
|
232 |
-
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
233 |
-
}
|
234 |
-
/**
|
235 |
-
* functions used for get sendin tracking status
|
236 |
-
*/
|
237 |
-
public function getSendinTrackingCodeStatus($field, $store = null)
|
238 |
-
{
|
239 |
-
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
240 |
-
}
|
241 |
-
/**
|
242 |
-
* functions used for module functionality
|
243 |
-
*/
|
244 |
-
public function getLists()
|
245 |
-
{
|
246 |
-
return $this->lists();
|
247 |
-
}
|
248 |
-
/**
|
249 |
-
* functions used for email adds
|
250 |
-
*/
|
251 |
-
public function emailAdd($email, $extra)
|
252 |
-
{
|
253 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
254 |
-
{
|
255 |
-
$apikey = $this->api_key;
|
256 |
-
if (!$apikey)
|
257 |
-
return false;
|
258 |
-
$params = array();
|
259 |
-
$params['email'] = $email;
|
260 |
-
$params['id'] = '';
|
261 |
-
$params['blacklisted'] = '';
|
262 |
-
if ($extra != null)
|
263 |
-
{
|
264 |
-
$params['attributes_name'] = 'PRENOM|NOM|CLIENT|SMS';
|
265 |
-
$params['attributes_value'] = $extra;
|
266 |
-
} else
|
267 |
-
{
|
268 |
-
$params['attributes_value'] = $email;
|
269 |
-
|
270 |
-
}
|
271 |
-
$params['listid'] = $this->lists_ids;
|
272 |
-
return $this->callServer('USERCREADITM', $params);
|
273 |
-
} else
|
274 |
-
return false;
|
275 |
-
}
|
276 |
-
/**
|
277 |
-
* functions subscribeuser
|
278 |
-
*/
|
279 |
-
public function emailSubscribe($email)
|
280 |
-
{
|
281 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
282 |
-
{
|
283 |
-
$apikey = $this->api_key;
|
284 |
-
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
285 |
-
$timez = str_replace('Calcutta', 'Kolkata', $timezone);
|
286 |
-
$tm = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
287 |
-
|
288 |
-
if (!$apikey)
|
289 |
-
return false;
|
290 |
-
$data = array();
|
291 |
-
$data['key'] = $apikey;
|
292 |
-
$data['webaction']='UPDATE-USER-SUBSCRIPTION-STATUS';
|
293 |
-
$data['timezone'] = $timez;
|
294 |
-
$data['user_status'] = $email.', '.'1'.', '.$tm;
|
295 |
-
return $this->curlRequest($data);
|
296 |
-
} else
|
297 |
-
return false;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* functions used for sync data
|
302 |
-
*/
|
303 |
-
public function syncData()
|
304 |
-
{
|
305 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
306 |
-
{
|
307 |
-
$apikey = $this->api_key;
|
308 |
-
if (!$apikey)
|
309 |
-
return false;
|
310 |
-
$params = array();
|
311 |
-
$params['listids'] = str_replace(',', '|', $this->lists_ids);
|
312 |
-
$response = $this->callServer('DISPLAYLISTDATABLACK', $params);
|
313 |
-
$result_arr = $response->result;
|
314 |
-
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()->showCustomerInfo()->toArray();
|
315 |
-
$subscriber_data = $collection['items'];
|
316 |
-
if (count($result_arr) > 0)
|
317 |
-
{
|
318 |
-
$emails = array();
|
319 |
-
foreach ($result_arr as $key => $value)
|
320 |
-
{
|
321 |
-
foreach ($value as $user_data)
|
322 |
-
{
|
323 |
-
foreach ($subscriber_data as $data)
|
324 |
-
{
|
325 |
-
$temp_sub_status = ($data['subscriber_status'] == 3) ? 1 : 0;
|
326 |
-
if (($data['subscriber_email'] == $user_data->email) && ($temp_sub_status != $user_data->blacklisted))
|
327 |
-
{
|
328 |
-
$emails[] = $data['subscriber_email'];
|
329 |
-
$subscribe_data['subscriber_id'] = $data['subscriber_id'];
|
330 |
-
$subscribe_data['subscriber_status'] = ($user_data->blacklisted == 1)?3:1;
|
331 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($data['subscriber_email']);
|
332 |
-
$costomer_data->setStatus($subscribe_data['subscriber_status']);
|
333 |
-
$costomer_data->setIsStatusChanged(true);
|
334 |
-
$costomer_data->save();
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
}
|
340 |
-
if (count($emails) > 0)
|
341 |
-
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
342 |
-
else
|
343 |
-
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
344 |
-
return true;
|
345 |
-
}
|
346 |
-
else
|
347 |
-
return false;
|
348 |
-
}
|
349 |
-
/**
|
350 |
-
* This method is used for add email list
|
351 |
-
*/
|
352 |
-
public function addEmailList($email)
|
353 |
-
{
|
354 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
355 |
-
{
|
356 |
-
$apikey = $this->api_key;
|
357 |
-
if (!$apikey)
|
358 |
-
return false;
|
359 |
-
$params = array();
|
360 |
-
$params['email'] = $email;
|
361 |
-
$params['id'] = '';
|
362 |
-
$params['blacklisted'] = '';
|
363 |
-
$params['attributes_name'] = '';
|
364 |
-
$params['attributes_value'] = '';
|
365 |
-
$params['listid'] = $this->lists_ids;
|
366 |
-
return $this->callServer('USERCREADITM', $params);
|
367 |
-
} else
|
368 |
-
return false;
|
369 |
-
}
|
370 |
-
/**
|
371 |
-
* This method is used used for email unsubscribe
|
372 |
-
*/
|
373 |
-
public function emailDelete($email)
|
374 |
-
{
|
375 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
376 |
-
{
|
377 |
-
$apikey = $this->api_key;
|
378 |
-
if (!$apikey)
|
379 |
-
return false;
|
380 |
-
$params = array();
|
381 |
-
$params['email'] = $email;
|
382 |
-
$params['listid'] = $this->lists_ids;
|
383 |
-
return $this->callServer('UNSUBAPI', $params);
|
384 |
-
} else
|
385 |
-
return false;
|
386 |
-
}
|
387 |
-
/**
|
388 |
-
* This method is used used for check api status
|
389 |
-
*/
|
390 |
-
public function checkApikey($api_key)
|
391 |
-
{
|
392 |
-
$params['key'] = $api_key;
|
393 |
-
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
394 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
395 |
-
return $lists['error'] = $response->errorMsg;
|
396 |
-
}
|
397 |
-
/**
|
398 |
-
* functions used for smtp details and order tracking
|
399 |
-
*/
|
400 |
-
public function SmtpDetailsWithTracking()
|
401 |
-
{
|
402 |
-
$params['key'] = $this->api_key;
|
403 |
-
$response = $this->callServer('TRACKINGDATA', $params);
|
404 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
405 |
-
{
|
406 |
-
$tracking['error'] = $response->errorMsg;
|
407 |
-
return $tracking;
|
408 |
-
}
|
409 |
-
return $response;
|
410 |
-
}
|
411 |
-
/**
|
412 |
-
* Fetches all the list of the user from the Sendinblue platform.
|
413 |
-
*/
|
414 |
-
public function lists($filters = array())
|
415 |
-
{
|
416 |
-
$params = array();
|
417 |
-
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
418 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
419 |
-
{
|
420 |
-
$this->error_message = $response->errorMsg;
|
421 |
-
$lists['error'] = $response->errorMsg;
|
422 |
-
} else
|
423 |
-
{
|
424 |
-
$i = 0;
|
425 |
-
$lists = array();
|
426 |
-
foreach ($response->result as $list_data)
|
427 |
-
{
|
428 |
-
$lists[$i]['id'] = $list_data->id;
|
429 |
-
$lists[$i]['name'] = $list_data->name;
|
430 |
-
$i++;
|
431 |
-
}
|
432 |
-
}
|
433 |
-
return $lists;
|
434 |
-
}
|
435 |
-
/**
|
436 |
-
* Fetches the list status of the user from the Sendinblue platform.
|
437 |
-
*/
|
438 |
-
public function getUserListStats()
|
439 |
-
{
|
440 |
-
if ($this->module_enable == 1)
|
441 |
-
{
|
442 |
-
$params = array();
|
443 |
-
$params['list'] = 'ALL';
|
444 |
-
return $this->callServer('DISPLAYLISTDATA', $params);
|
445 |
-
} else
|
446 |
-
return Mage::getSingleton('core/session')->addError('Sendinblue not enabled');
|
447 |
-
}
|
448 |
-
/**
|
449 |
-
* Fetches all folders and all list within each folder of the user's Sendinblue
|
450 |
-
* account and displays them to the user.
|
451 |
-
*/
|
452 |
-
public function checkFolderList()
|
453 |
-
{
|
454 |
-
$params = array();
|
455 |
-
$array = array();
|
456 |
-
$list_response = $this->callServer('DISPLAY-FOLDERS-LISTS', $params);
|
457 |
-
$list_response = json_encode($list_response);
|
458 |
-
$res = json_decode($list_response, true);
|
459 |
-
if (isset($res) && !empty($res))
|
460 |
-
{
|
461 |
-
foreach ($res as $key => $value)
|
462 |
-
{
|
463 |
-
if (strtolower($value['name']) == 'magento')
|
464 |
-
{
|
465 |
-
$array[] = $key;
|
466 |
-
$array[] = $value['name'];
|
467 |
-
}
|
468 |
-
if (!empty($value['lists']))
|
469 |
-
{
|
470 |
-
foreach ($value['lists'] as $val)
|
471 |
-
{
|
472 |
-
if (strtolower($val['name']) == 'magento')
|
473 |
-
$array[] = $val['name'];
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
477 |
-
}
|
478 |
-
return $array;
|
479 |
-
}
|
480 |
-
/**
|
481 |
-
* folder create in Sendinblue after removing from Sendinblue
|
482 |
-
*/
|
483 |
-
public function createFolderCaseTwo()
|
484 |
-
{
|
485 |
-
$apikey = $this->api_key;
|
486 |
-
if($apikey == '')
|
487 |
-
return false;
|
488 |
-
$response = $this->checkApikey($apikey); // check api key is valid or not
|
489 |
-
if ($this->module_enable != 1 && $apikey == '' && $response['error'] != '' && $this->getSyncronizeStatus())
|
490 |
-
return false;
|
491 |
-
$result = $this->checkFolderList();
|
492 |
-
$list_name = 'magento';
|
493 |
-
$param = array();
|
494 |
-
$data = array();
|
495 |
-
$folder_id = $result[0];
|
496 |
-
$exist_list = $result[2];
|
497 |
-
if (empty($result[1]))
|
498 |
-
{
|
499 |
-
$params = array();
|
500 |
-
$params['foldername'] = 'magento';
|
501 |
-
$response = $this->callServer('ADDFOLDER', $params);
|
502 |
-
$folder_id = $response->folder_id;
|
503 |
-
$params = array();
|
504 |
-
$params['listname'] = $list_name;
|
505 |
-
$params['list_parent'] = $folder_id; //folder id
|
506 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
507 |
-
$this->sendAllMailIDToSendin($list_response);
|
508 |
-
} elseif (empty($exist_list))
|
509 |
-
{
|
510 |
-
$params = array();
|
511 |
-
$params['listname'] = $list_name;
|
512 |
-
$params['list_parent'] = $folder_id; //folder id
|
513 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
514 |
-
$this->sendAllMailIDToSendin($list_response);
|
515 |
-
}
|
516 |
-
}
|
517 |
-
/**
|
518 |
-
* Method is used getambassador Services.
|
519 |
-
*/
|
520 |
-
public function amdRequest($api)
|
521 |
-
{
|
522 |
-
$data['key'] = $api;
|
523 |
-
$data['campaign_id'] = '2147';
|
524 |
-
$data['campaign_short_code'] = 'zHzc';
|
525 |
-
|
526 |
-
return $list_response = $this->curlRequest($data);
|
527 |
-
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* folder create in Sendinblue after installing
|
532 |
-
*/
|
533 |
-
public function createFolderName($api_key)
|
534 |
-
{
|
535 |
-
$this->api_key = $api_key;
|
536 |
-
$this->createAttributesName();
|
537 |
-
$result = $this->checkFolderList();
|
538 |
-
if (empty($result[1]))
|
539 |
-
{
|
540 |
-
$params = array();
|
541 |
-
$params['foldername'] = 'magento';
|
542 |
-
$response = $this->callServer('ADDFOLDER', $params);
|
543 |
-
$folder_id = $response->folder_id;
|
544 |
-
$exist_list = '';
|
545 |
-
} else
|
546 |
-
{
|
547 |
-
$folder_id = $result[0];
|
548 |
-
$exist_list = $result[2];
|
549 |
-
}
|
550 |
-
$this->createNewList($folder_id, $exist_list);
|
551 |
-
$this->partnerMagento();
|
552 |
-
}
|
553 |
-
/**
|
554 |
-
* Method is used to add the partner's name in Sendinblue.
|
555 |
-
* In this case its "MAGENTO".
|
556 |
-
*/
|
557 |
-
public function partnerMagento()
|
558 |
-
{
|
559 |
-
$params = array();
|
560 |
-
$params['partner'] = 'MAGENTO';
|
561 |
-
$this->callServer('MAILIN-PARTNER', $params);
|
562 |
-
}
|
563 |
-
/**
|
564 |
-
* Creates a list by the name "magento" on user's Sendinblue account.
|
565 |
-
*/
|
566 |
-
public function createNewList($response, $exist_list)
|
567 |
-
{
|
568 |
-
if ($exist_list != '')
|
569 |
-
{
|
570 |
-
$date = date('dmY');
|
571 |
-
$list_name = 'magento_'.$date;
|
572 |
-
}
|
573 |
-
else
|
574 |
-
$list_name = 'magento';
|
575 |
-
$params = array();
|
576 |
-
$params['listname'] = $list_name;
|
577 |
-
$params['list_parent'] = $response;
|
578 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
579 |
-
$this->sendAllMailIDToSendin($list_response);
|
580 |
-
$this->createAttributesName();
|
581 |
-
}
|
582 |
-
/**
|
583 |
-
* Create Normal, Transactional, Calculated and Global attributes and their values
|
584 |
-
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
585 |
-
*/
|
586 |
-
public function createAttributesName()
|
587 |
-
{
|
588 |
-
$params = array();
|
589 |
-
$params['normal_attributes'] = 'PRENOM,text|NOM,text|SMS,text|CLIENT,number';
|
590 |
-
$params['transactional_attributes'] = 'ORDER_ID,id|ORDER_DATE,date|ORDER_PRICE,number';
|
591 |
-
$this->callServer('ATTRIBUTES_CREATION', $params);
|
592 |
-
}
|
593 |
-
/**
|
594 |
-
* Method is used to send all the subscribers from magento to
|
595 |
-
* Sendinblue for adding / updating purpose.
|
596 |
-
*/
|
597 |
-
public function sendAllMailIDToSendin($list)
|
598 |
-
{
|
599 |
-
$allemail = $this->getcustomers();
|
600 |
-
$params = array();
|
601 |
-
$params['webaction'] = 'MULTI-USERCREADIT';
|
602 |
-
$params['key'] = $this->api_key;
|
603 |
-
$params['attributes'] = $allemail;
|
604 |
-
$params['listid'] = $list->result;
|
605 |
-
$response = $this->callServer('MULTI-USERCREADIT', $params);
|
606 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
607 |
-
$sendin_switch->saveConfig('sendinblue/list', $list->result, 'default', 0);
|
608 |
-
}
|
609 |
-
/**
|
610 |
-
* Send SMS from Sendin.
|
611 |
-
*/
|
612 |
-
public function sendSmsApi($array)
|
613 |
-
{
|
614 |
-
$params = array();
|
615 |
-
$params['key'] = $this->api_key;
|
616 |
-
$params['to'] = $array['to'];
|
617 |
-
$params['from'] = $array['from'];
|
618 |
-
$params['text'] = $array['text'];
|
619 |
-
return $this->callServer('SENDSMS', $params);
|
620 |
-
}
|
621 |
-
|
622 |
-
public function sendOrder($mobile)
|
623 |
-
{
|
624 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
625 |
-
|
626 |
-
if (isset($mobile))
|
627 |
-
{
|
628 |
-
$arr = array();
|
629 |
-
$arr['to'] = $mobile;
|
630 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
631 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
632 |
-
|
633 |
-
return $result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
634 |
-
}
|
635 |
-
|
636 |
-
}
|
637 |
-
public function notifySmsEmail()
|
638 |
-
{
|
639 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
640 |
-
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->module_enable == 1 && $this->getNotifySmsStatus() == 1)
|
641 |
-
{
|
642 |
-
if($this->getNotifyCronStatus() == 0)
|
643 |
-
{
|
644 |
-
$sendin_switch->saveConfig('Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
645 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
646 |
-
$email_template_variables = array();
|
647 |
-
if ($locale == 'fr_FR')
|
648 |
-
{
|
649 |
-
$email_template_variables['text0'] = ' [SendinBlue] Alerte: Vos crédits SMS seront bientôt épuisés';
|
650 |
-
$sender_name = 'SendinBlue';
|
651 |
-
$sender_email = 'contact@sendinblue.com';
|
652 |
-
}
|
653 |
-
else
|
654 |
-
{
|
655 |
-
$email_template_variables['text0'] = '[SendinBlue] Alert: You do not have enough credits SMS';
|
656 |
-
$sender_name = 'SendinBlue';
|
657 |
-
$sender_email = 'contact@sendinblue.com';
|
658 |
-
}
|
659 |
-
$email = $this->getNotifyEmailStatus();
|
660 |
-
|
661 |
-
$email_template = Mage::getModel('core/email_template')->loadDefault('notification_template');
|
662 |
-
$temp=$email_template->template_text;
|
663 |
-
$web_site = Mage::app()->getWebsite()->getName();
|
664 |
-
$credit = $this->getSmsCredit();
|
665 |
-
preg_match_all('#{(.*)}#', $temp, $match);
|
666 |
-
|
667 |
-
$temp_params = array(
|
668 |
-
'{site_name}'=>$web_site,
|
669 |
-
'{present_credit}'=>$credit
|
670 |
-
|
671 |
-
);
|
672 |
-
foreach($match[0] as $var=>$value){
|
673 |
-
$temp = preg_replace('#'.$value.'#',$temp_params[$value],$temp);
|
674 |
-
}
|
675 |
-
$email_template->template_text = $temp;
|
676 |
-
$email_template->getProcessedTemplate($email_template_variables);
|
677 |
-
$email_template->setSenderName($sender_name);
|
678 |
-
$email_template->setSenderEmail($sender_email);
|
679 |
-
$email_template->setTemplateSubject($email_template_variables['text0']);
|
680 |
-
return $email_template->send($email, '', $email_template_variables);
|
681 |
-
|
682 |
-
}
|
683 |
-
|
684 |
-
|
685 |
-
}
|
686 |
-
else
|
687 |
-
{
|
688 |
-
$sendin_switch->saveConfig('Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
689 |
-
}
|
690 |
-
|
691 |
-
Mage::getSingleton('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
692 |
-
}
|
693 |
-
/**
|
694 |
-
* show SMS credit from Sendinblue.
|
695 |
-
*/
|
696 |
-
public function getSmsCredit()
|
697 |
-
{
|
698 |
-
$params = array();
|
699 |
-
$params['key'] = $this->api_key;
|
700 |
-
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
701 |
-
if ($result['1']->plan_type == 'SMS')
|
702 |
-
return $result['1']->credits;
|
703 |
-
}
|
704 |
-
/**
|
705 |
-
* Method is used to send test email to the user.
|
706 |
-
*/
|
707 |
-
public function sendTestMail($email)
|
708 |
-
{
|
709 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
710 |
-
$email_template_variables = array();
|
711 |
-
if ($locale == 'fr_FR')
|
712 |
-
{
|
713 |
-
$email_template_variables['text0'] = '[SendinBlue SMTP] e-mail de test';
|
714 |
-
$sender_name = 'SendinBlue';
|
715 |
-
$sender_email = 'contact@sendinblue.com';
|
716 |
-
}
|
717 |
-
else
|
718 |
-
{
|
719 |
-
$email_template_variables['text0'] = '[SendinBlue SMTP] test email';
|
720 |
-
$sender_name = 'SendinBlue';
|
721 |
-
$sender_email = 'contact@sendinblue.com';
|
722 |
-
}
|
723 |
-
try {
|
724 |
-
$email_template = Mage::getModel('core/email_template')->loadDefault('custom_template');
|
725 |
-
$email_template->getProcessedTemplate($email_template_variables);
|
726 |
-
$email_template->setSenderName($sender_name);
|
727 |
-
$email_template->setSenderEmail($sender_email);
|
728 |
-
$email_template->setTemplateSubject($email_template_variables['text0']);
|
729 |
-
return $email_template->send($email, '', $email_template_variables);
|
730 |
-
}
|
731 |
-
catch(Exception $e) {
|
732 |
-
|
733 |
-
}
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* This method is used to fetch all users from the default customer table to list
|
738 |
-
* them in the Sendinblue magento module.
|
739 |
-
*/
|
740 |
-
public function getcustomers()
|
741 |
-
{
|
742 |
-
$data = array();
|
743 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
744 |
-
foreach ($collection as $customer)
|
745 |
-
{
|
746 |
-
|
747 |
-
$email = $customer->getData('email');
|
748 |
-
$firstname = $customer->getData('firstname');
|
749 |
-
$lastname = $customer->getData('lastname');
|
750 |
-
$cid = $customer->getData('entity_id');
|
751 |
-
|
752 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
753 |
-
$telephone = '';
|
754 |
-
foreach ($collectionAddress as $customerPhno) {
|
755 |
-
$telephone = $customerPhno->getData('telephone');
|
756 |
-
$country_id = $customerPhno->getData('country_id');
|
757 |
-
}
|
758 |
-
|
759 |
-
$customer_select[$email] = array(
|
760 |
-
'email' => $email,
|
761 |
-
'PRENOM' => $firstname,
|
762 |
-
'NOM' => $lastname,
|
763 |
-
'SMS' => $telephone,
|
764 |
-
'country_id' => $country_id,
|
765 |
-
'CLIENT' => $cid>0?1:0
|
766 |
-
);
|
767 |
-
}
|
768 |
-
|
769 |
-
$newsletterArr = array();
|
770 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
771 |
-
$cnt = 0;
|
772 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
773 |
-
{
|
774 |
-
$customer_id = $subscriber->getCustomerId();;
|
775 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
776 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
777 |
-
|
778 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
779 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
780 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
781 |
-
unset($customer_select[$subscriber_email]);
|
782 |
-
}
|
783 |
-
else {
|
784 |
-
$newsletterArr[$cnt] = array(
|
785 |
-
'email' => $subscriber_email,
|
786 |
-
'PRENOM' => '',
|
787 |
-
'NOM' => '',
|
788 |
-
'SMS' => '',
|
789 |
-
'country_id' => ''
|
790 |
-
);
|
791 |
-
$newsletterArr[$cnt]['CLIENT'] = $customer_id>0?1:0;
|
792 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
793 |
-
}
|
794 |
-
$cnt++;
|
795 |
-
}
|
796 |
-
|
797 |
-
return json_encode($newsletterArr);
|
798 |
-
}
|
799 |
-
/**
|
800 |
-
* This method is used to fetch all users from the default newsletter table to list
|
801 |
-
* them in the Sendinblue magento module.
|
802 |
-
*/
|
803 |
-
public function getNewsletterSubscribe($start, $per_page)
|
804 |
-
{
|
805 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
806 |
-
foreach ($collection as $customer)
|
807 |
-
{
|
808 |
-
|
809 |
-
$email = $customer->getData('email');
|
810 |
-
$firstname = $customer->getData('firstname');
|
811 |
-
$lastname = $customer->getData('lastname');
|
812 |
-
$cid = $customer->getData('entity_id');
|
813 |
-
|
814 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
815 |
-
$telephone = '';
|
816 |
-
foreach ($collectionAddress as $customerPhno) {
|
817 |
-
$telephone = $customerPhno->getData('telephone');
|
818 |
-
$country_id = $customerPhno->getData('country_id');
|
819 |
-
}
|
820 |
-
|
821 |
-
$customer_select[$email] = array(
|
822 |
-
'email' => $email,
|
823 |
-
'firstname' => $firstname,
|
824 |
-
'lastname' => $lastname,
|
825 |
-
'telephone' => $telephone,
|
826 |
-
'country_id' => $country_id,
|
827 |
-
'customer_id' => $cid
|
828 |
-
);
|
829 |
-
}
|
830 |
-
|
831 |
-
$newsletterArr = array();
|
832 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
833 |
-
|
834 |
-
$cnt = 0;
|
835 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
836 |
-
{
|
837 |
-
$customer_id = $subscriber->getCustomerId();;
|
838 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
839 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
840 |
-
|
841 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
842 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
843 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
844 |
-
unset($customer_select[$subscriber_email]);
|
845 |
-
}
|
846 |
-
else {
|
847 |
-
$newsletterArr[$cnt] = array(
|
848 |
-
'email' => $subscriber_email,
|
849 |
-
'firstname' => '',
|
850 |
-
'lastname' => '',
|
851 |
-
'telephone' => '',
|
852 |
-
'country_id' => ''
|
853 |
-
);
|
854 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
855 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
856 |
-
}
|
857 |
-
$cnt++;
|
858 |
-
}
|
859 |
-
|
860 |
-
if ( count($customer_select) > 0 ) {
|
861 |
-
foreach ( $customer_select as $cData ) {
|
862 |
-
$newsletterArr[$cnt] = $cData;
|
863 |
-
$newsletterArr[$cnt]['subscriber_status'] = 3;
|
864 |
-
$cnt++;
|
865 |
-
}
|
866 |
-
}
|
867 |
-
|
868 |
-
return array_slice($newsletterArr, $start, $per_page, true);
|
869 |
-
}
|
870 |
-
/**
|
871 |
-
* This method is used to fetch total count users from the default newsletter table to list
|
872 |
-
* them in the Sendinblue magento module.
|
873 |
-
*/
|
874 |
-
public function getTotalCount()
|
875 |
-
{
|
876 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
877 |
-
foreach ($collection as $customer)
|
878 |
-
{
|
879 |
-
|
880 |
-
$email = $customer->getData('email');
|
881 |
-
$firstname = $customer->getData('firstname');
|
882 |
-
$lastname = $customer->getData('lastname');
|
883 |
-
$cid = $customer->getData('entity_id');
|
884 |
-
|
885 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
886 |
-
$telephone = '';
|
887 |
-
foreach ($collectionAddress as $customerPhno) {
|
888 |
-
$telephone = $customerPhno->getData('telephone');
|
889 |
-
$country_id = $customerPhno->getData('country_id');
|
890 |
-
}
|
891 |
-
|
892 |
-
$customer_select[$email] = array(
|
893 |
-
'email' => $email,
|
894 |
-
'firstname' => $firstname,
|
895 |
-
'lastname' => $lastname,
|
896 |
-
'telephone' => $telephone,
|
897 |
-
'country_id' => $country_id,
|
898 |
-
'customer_id' => $cid
|
899 |
-
);
|
900 |
-
}
|
901 |
-
|
902 |
-
$newsletterArr = array();
|
903 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
904 |
-
|
905 |
-
$cnt = 0;
|
906 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
907 |
-
{
|
908 |
-
$customer_id = $subscriber->getCustomerId();;
|
909 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
910 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
911 |
-
|
912 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
913 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
914 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
915 |
-
unset($customer_select[$subscriber_email]);
|
916 |
-
}
|
917 |
-
else {
|
918 |
-
$newsletterArr[$cnt] = array(
|
919 |
-
'email' => $subscriber_email,
|
920 |
-
'firstname' => '',
|
921 |
-
'lastname' => '',
|
922 |
-
'telephone' => '',
|
923 |
-
'country_id' => ''
|
924 |
-
);
|
925 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
926 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
927 |
-
}
|
928 |
-
$cnt++;
|
929 |
-
}
|
930 |
-
|
931 |
-
if ( count($customer_select) > 0 ) {
|
932 |
-
foreach ( $customer_select as $cData ) {
|
933 |
-
$newsletterArr[$cnt] = $cData;
|
934 |
-
$newsletterArr[$cnt]['subscriber_status'] = 3;
|
935 |
-
$cnt++;
|
936 |
-
}
|
937 |
-
}
|
938 |
-
|
939 |
-
return count($newsletterArr);
|
940 |
-
}
|
941 |
-
/**
|
942 |
-
* This method is used to fetch total count unsubscribe users from the default newsletter table to list
|
943 |
-
* them in the Sendinblue magento module.
|
944 |
-
*/
|
945 |
-
public function getNewsletterUnSubscribeCount()
|
946 |
-
{
|
947 |
-
$sql = 'SELECT count(*) as totalcoutn FROM customer_entity CE
|
948 |
-
LEFT JOIN newsletter_subscriber
|
949 |
-
ON CE.entity_id=newsletter_subscriber.customer_id WHERE subscriber_status != 1 or subscriber_status is null';
|
950 |
-
$unsubs_count1 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
951 |
-
|
952 |
-
$sql = 'SELECT count(*) as totalcoutn FROM newsletter_subscriber WHERE customer_id = 0 AND subscriber_status = 3';
|
953 |
-
$unsubs_count2 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
954 |
-
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
955 |
-
|
956 |
-
}
|
957 |
-
/**
|
958 |
-
* This method is used to fetch total count subscribe users from the default newsletter table to list
|
959 |
-
* them in the Sendinblue magento module.
|
960 |
-
*/
|
961 |
-
public function getNewsletterSubscribeCount()
|
962 |
-
{
|
963 |
-
$sql = 'SELECT count(*) as totalvalue from newsletter_subscriber where subscriber_status = 1';
|
964 |
-
$data = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
965 |
-
return $data['totalvalue'];
|
966 |
-
}
|
967 |
-
/**
|
968 |
-
* This method is used to check the subscriber's newsletter subscription status in Sendinblue
|
969 |
-
*/
|
970 |
-
public function checkUserSendinStatus($result)
|
971 |
-
{
|
972 |
-
$userstatus = array();
|
973 |
-
foreach ($result as $subscriber)
|
974 |
-
$userstatus[] = $subscriber['email'];
|
975 |
-
$email = implode(',', $userstatus);
|
976 |
-
$params = array();
|
977 |
-
$params['key'] = $this->api_key;
|
978 |
-
$params['email'] = $email;
|
979 |
-
$response = $this->callServer('USERS-STATUS', $params);
|
980 |
-
$response = json_encode($response);
|
981 |
-
return json_decode($response, true);
|
982 |
-
}
|
983 |
-
/**
|
984 |
-
* Fetches the SMTP and order tracking details
|
985 |
-
*/
|
986 |
-
public function TrackingSmtp()
|
987 |
-
{
|
988 |
-
$params = array();
|
989 |
-
$params['key'] = $this->api_key;
|
990 |
-
return $this->callServer('TRACKINGDATA', $params);
|
991 |
-
}
|
992 |
-
/**
|
993 |
-
* CURL function to send request to the Sendinblue API server
|
994 |
-
*/
|
995 |
-
public function callServer($method, $params)
|
996 |
-
{
|
997 |
-
$host = $this->api_url;
|
998 |
-
$params['key'] = (isset($params['key']) && !empty($params['key'])) ? $params['key'] : $this->api_key;
|
999 |
-
$params['webaction'] = $method;
|
1000 |
-
$this->error_message = '';
|
1001 |
-
$this->error_code = '';
|
1002 |
-
$response = $this->curlRequest($params);
|
1003 |
-
return json_decode($response);
|
1004 |
-
}
|
1005 |
-
/**
|
1006 |
-
* CURL function to send request to the Sendinblue API server
|
1007 |
-
*/
|
1008 |
-
public function curlRequest($data)
|
1009 |
-
{
|
1010 |
-
$url1 = $this->api_url;
|
1011 |
-
$url2 = $this->api_url2;
|
1012 |
-
if (array_key_exists('campaign_short_code', $data))
|
1013 |
-
$url = $url2; // WS URL
|
1014 |
-
else
|
1015 |
-
$url = $url1; // WS URL
|
1016 |
-
$ch = curl_init();
|
1017 |
-
$ndata = '';
|
1018 |
-
if (is_array($data))
|
1019 |
-
{
|
1020 |
-
foreach ($data as $key => $value)
|
1021 |
-
$ndata .= $key.'='.urlencode($value).'&';
|
1022 |
-
} else
|
1023 |
-
$ndata = $data;
|
1024 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1025 |
-
'Expect:'
|
1026 |
-
));
|
1027 |
-
|
1028 |
-
$ndata = trim($ndata,'&');
|
1029 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1030 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
1031 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1032 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1033 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1034 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
1035 |
-
$data2 = curl_exec($ch);
|
1036 |
-
curl_close($ch);
|
1037 |
-
return $data2;
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
public function removeOldEntry()
|
1041 |
-
{
|
1042 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
1043 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', '');
|
1044 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', '');
|
1045 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', '');
|
1046 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', '');
|
1047 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', '');
|
1048 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', '');
|
1049 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', '');
|
1050 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', '');
|
1051 |
-
$sendin_switch->saveConfig('sendinblue/tracking/code', '');
|
1052 |
-
}
|
1053 |
-
protected function _uninstallResourceDb($version)
|
1054 |
-
{
|
1055 |
-
Mage::dispatchEvent('module_uninstall', array('resource' => $this->_resourceName));
|
1056 |
-
|
1057 |
-
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1058 |
-
return $this;
|
1059 |
-
}
|
1060 |
-
/**
|
1061 |
-
* API config value from SendinBlue.
|
1062 |
-
*/
|
1063 |
-
public function getApiConfigValue()
|
1064 |
-
{
|
1065 |
-
$data = array();
|
1066 |
-
$data['key'] = $this->api_key;
|
1067 |
-
$data['webaction'] = 'PLUGIN-CONFIG';
|
1068 |
-
$value_config = $this->curlRequest($data);
|
1069 |
-
$result = json_decode($value_config);
|
1070 |
-
return $result;
|
1071 |
-
}
|
1072 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
DELETED
@@ -1,520 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
-
{
|
13 |
-
public function indexAction()
|
14 |
-
{
|
15 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderCaseTwo();
|
16 |
-
$this->loadLayout();
|
17 |
-
$this->renderLayout();
|
18 |
-
|
19 |
-
}
|
20 |
-
public function syncronizepostAction()
|
21 |
-
{
|
22 |
-
$post = $this->getRequest()->getPost();
|
23 |
-
try {
|
24 |
-
if (empty($post))
|
25 |
-
Mage::throwException($this->__('Invalid form data.'));
|
26 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
27 |
-
if (isset($post['syncronizeSubmit']))
|
28 |
-
{
|
29 |
-
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
30 |
-
if (!empty($post['sendin_list']))
|
31 |
-
{
|
32 |
-
$list = implode('|', $post['sendin_list']);
|
33 |
-
$sendin_switch->saveConfig('sendinblue/list', $list);
|
34 |
-
$message = $this->__('Your setting has been successfully saved');
|
35 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
36 |
-
} else
|
37 |
-
{
|
38 |
-
$message = $this->__('Please select a list');
|
39 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
catch (Exception $e)
|
44 |
-
{
|
45 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
46 |
-
}
|
47 |
-
$this->_redirect('*/*');
|
48 |
-
}
|
49 |
-
public function apikeypostAction()
|
50 |
-
{
|
51 |
-
$post = $this->getRequest()->getPost();
|
52 |
-
try {
|
53 |
-
if (empty($post))
|
54 |
-
Mage::throwException($this->__('Invalid form data.'));
|
55 |
-
elseif (isset($post['sendin_apikey']) && !empty($post['sendin_apikey']))
|
56 |
-
{
|
57 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
58 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey(trim($post['sendin_apikey']));
|
59 |
-
if (empty($result['error']))
|
60 |
-
{
|
61 |
-
Mage::getModel('sendinblue/sendinblue')->amdRequest(trim($post['sendin_apikey']));
|
62 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
63 |
-
if ($get_key == '')
|
64 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderName($post['sendin_apikey']);
|
65 |
-
elseif ($get_key != $post['sendin_apikey'])
|
66 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderName($post['sendin_apikey']);
|
67 |
-
|
68 |
-
$sendin_switch->saveConfig('sendinblue/api', trim($post['sendin_apikey']));
|
69 |
-
$sendin_switch->saveConfig('sendinblue/enabled', $post['sendin_api_status']);
|
70 |
-
$sendin_switch->saveConfig('sendinblue/syncronize', 1);
|
71 |
-
Mage::getModel('sendinblue/sendinblue')->removeOldEntry();
|
72 |
-
$message = $this->__('Your setting has been successfully saved');
|
73 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
74 |
-
} else if (isset($result['error']))
|
75 |
-
{
|
76 |
-
$message = $this->__('You have entered wrong api key');
|
77 |
-
Mage::getSingleton('core/session')->addError($message);
|
78 |
-
}
|
79 |
-
}
|
80 |
-
}
|
81 |
-
catch (Exception $e)
|
82 |
-
{
|
83 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
84 |
-
}
|
85 |
-
$this->_redirect('*/*');
|
86 |
-
}
|
87 |
-
public function sendmailAction()
|
88 |
-
{
|
89 |
-
$post = $this->getRequest()->getPost();
|
90 |
-
|
91 |
-
try {
|
92 |
-
if (empty($post))
|
93 |
-
Mage::throwException($this->__('Invalid form data.'));
|
94 |
-
elseif (isset($post['SmtpSubmit']) && !empty($post['SmtpSubmit']))
|
95 |
-
{
|
96 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
97 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
98 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey($get_key);
|
99 |
-
if (empty($result['error']))
|
100 |
-
{
|
101 |
-
$smtp_response = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp(); // get tracking code
|
102 |
-
|
103 |
-
if ($smtp_response->result->relay_data->status == 'enabled')
|
104 |
-
{
|
105 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
106 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
107 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
108 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
109 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
110 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
111 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
112 |
-
if ($post['email'])
|
113 |
-
{
|
114 |
-
$data11 = Mage::getModel('sendinblue/sendinblue')->sendTestMail($post['email']);
|
115 |
-
$resArr = json_decode($data11, true);
|
116 |
-
if ($resArr['result'] != true) {
|
117 |
-
$message = $this->__('Mail not sent').' '.$this->__(trim($resArr['error']));
|
118 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
119 |
-
}
|
120 |
-
else {
|
121 |
-
$message = $this->__('Mail sent!');
|
122 |
-
Mage::getSingleton('core/session')->addSuccess($message);
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
} else
|
127 |
-
{
|
128 |
-
$message = $this->__('Mail not sent');
|
129 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
else
|
133 |
-
{
|
134 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
135 |
-
$message = $this->__('Your SMTP account is not activated and therefore you can not use SendinBlue SMTP. For more informations, Please contact our support to: contact@sendinblue.com');
|
136 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
137 |
-
|
138 |
-
}
|
139 |
-
} elseif (isset($responce['error']))
|
140 |
-
{
|
141 |
-
$message = $this->__('You have entered wrong api key');
|
142 |
-
Mage::getSingleton('core/session')->addError($message);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
146 |
-
catch (Exception $e)
|
147 |
-
{
|
148 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
149 |
-
}
|
150 |
-
$this->_redirect('*/*');
|
151 |
-
}
|
152 |
-
public function sendorderAction()
|
153 |
-
{
|
154 |
-
$post = $this->getRequest()->getPost();
|
155 |
-
try
|
156 |
-
{
|
157 |
-
if (empty($post))
|
158 |
-
Mage::throwException($this->__('Invalid form data.'));
|
159 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
160 |
-
if (isset($post['sender_order_save']))
|
161 |
-
{
|
162 |
-
$sender_order = $post['sender_order'];
|
163 |
-
$sender_order_message = $post['sender_order_message'];
|
164 |
-
|
165 |
-
if (isset($sender_order) && $sender_order == '')
|
166 |
-
{
|
167 |
-
$message = $this->__('Please fill the message field');
|
168 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
169 |
-
}
|
170 |
-
else if ($sender_order_message == '')
|
171 |
-
{
|
172 |
-
$message = $this->__('Please fill the message field');
|
173 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
174 |
-
}
|
175 |
-
else
|
176 |
-
{
|
177 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order', $sender_order);
|
178 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order_Message', $sender_order_message);
|
179 |
-
$message = $this->__('Your setting has been successfully saved');
|
180 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
181 |
-
}
|
182 |
-
|
183 |
-
}
|
184 |
-
}
|
185 |
-
catch (Exception $e)
|
186 |
-
{
|
187 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
188 |
-
}
|
189 |
-
$this->_redirect('*/*');
|
190 |
-
}
|
191 |
-
public function sendshipmentAction()
|
192 |
-
{
|
193 |
-
$post = $this->getRequest()->getPost();
|
194 |
-
try {
|
195 |
-
if (empty($post))
|
196 |
-
Mage::throwException($this->__('Invalid form data.'));
|
197 |
-
|
198 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
199 |
-
if (isset($post['sender_shipment_save']))
|
200 |
-
{
|
201 |
-
$sender_shipment = $post['sender_shipment'];
|
202 |
-
$sender_shipment_message = $post['sender_shipment_message'];
|
203 |
-
|
204 |
-
if (isset($sender_shipment) && $sender_shipment == '')
|
205 |
-
{
|
206 |
-
$message = $this->__('Please fill the message field');
|
207 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
208 |
-
}
|
209 |
-
else if ($sender_shipment_message == '')
|
210 |
-
{
|
211 |
-
$message = $this->__('Please fill the message field');
|
212 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
213 |
-
}
|
214 |
-
else
|
215 |
-
{
|
216 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment', $sender_shipment);
|
217 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment_Message', $sender_shipment_message);
|
218 |
-
$message = $this->__('Your setting has been successfully saved');
|
219 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
220 |
-
}
|
221 |
-
|
222 |
-
}
|
223 |
-
}
|
224 |
-
catch (Exception $e)
|
225 |
-
{
|
226 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
227 |
-
}
|
228 |
-
$this->_redirect('*/*');
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* This method is called when the user test Shipment Sms and hits the submit button.
|
233 |
-
*/
|
234 |
-
|
235 |
-
public function sendordertestAction()
|
236 |
-
{
|
237 |
-
$post = $this->getRequest()->getPost();
|
238 |
-
try {
|
239 |
-
if (empty($post))
|
240 |
-
Mage::throwException($this->__('Invalid form data.'));
|
241 |
-
|
242 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
243 |
-
|
244 |
-
if (isset($post['sender_order_submit']))
|
245 |
-
{
|
246 |
-
$arr = array();
|
247 |
-
$arr['to'] = $post['sender_order_number'];
|
248 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
249 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
250 |
-
|
251 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
252 |
-
|
253 |
-
if (isset($result->status) && $result->status == 'OK')
|
254 |
-
{
|
255 |
-
$message = $this->__('Message has been sent successfully');
|
256 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
257 |
-
}
|
258 |
-
else
|
259 |
-
{
|
260 |
-
$message = $this->__('Message has not been sent successfully');
|
261 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
262 |
-
}
|
263 |
-
|
264 |
-
}
|
265 |
-
}
|
266 |
-
catch (Exception $e)
|
267 |
-
{
|
268 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
269 |
-
}
|
270 |
-
$this->_redirect('*/*');
|
271 |
-
}
|
272 |
-
|
273 |
-
|
274 |
-
/**
|
275 |
-
* This method is called when the user test Shipment Sms and hits the submit button.
|
276 |
-
*/
|
277 |
-
|
278 |
-
public function sendshipmenttestAction()
|
279 |
-
{
|
280 |
-
$post = $this->getRequest()->getPost();
|
281 |
-
try {
|
282 |
-
if (empty($post))
|
283 |
-
Mage::throwException($this->__('Invalid form data.'));
|
284 |
-
|
285 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
286 |
-
|
287 |
-
if (isset($post['sender_shipment_submit']))
|
288 |
-
{
|
289 |
-
$arr = array();
|
290 |
-
$arr['to'] = $post['sender_shipment_number'];
|
291 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingSubject();
|
292 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage();
|
293 |
-
|
294 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
295 |
-
|
296 |
-
if (isset($result->status) && $result->status == 'OK')
|
297 |
-
{
|
298 |
-
$message = $this->__('Message has been sent successfully');
|
299 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
300 |
-
}
|
301 |
-
else
|
302 |
-
{
|
303 |
-
$message = $this->__('Message has not been sent successfully');
|
304 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
305 |
-
}
|
306 |
-
|
307 |
-
}
|
308 |
-
}
|
309 |
-
catch (Exception $e)
|
310 |
-
{
|
311 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
312 |
-
}
|
313 |
-
$this->_redirect('*/*');
|
314 |
-
}
|
315 |
-
|
316 |
-
public function sendnotifysmsAction()
|
317 |
-
{
|
318 |
-
$post = $this->getRequest()->getPost();
|
319 |
-
try {
|
320 |
-
if (empty($post))
|
321 |
-
Mage::throwException($this->__('Invalid form data.'));
|
322 |
-
|
323 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
324 |
-
|
325 |
-
if (isset($post['notify_sms_mail']))
|
326 |
-
{
|
327 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Value', $post['sendin_notify_value']);
|
328 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Email', $post['sendin_notify_email']);
|
329 |
-
$message = $this->__('Your setting has been successfully saved');
|
330 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
331 |
-
}
|
332 |
-
}
|
333 |
-
catch (Exception $e)
|
334 |
-
{
|
335 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
336 |
-
}
|
337 |
-
$this->_redirect('*/*');
|
338 |
-
|
339 |
-
}
|
340 |
-
|
341 |
-
|
342 |
-
public function sendcampaignAction()
|
343 |
-
{
|
344 |
-
$post = $this->getRequest()->getPost();
|
345 |
-
try {
|
346 |
-
if (empty($post))
|
347 |
-
Mage::throwException($this->__('Invalid form data.'));
|
348 |
-
|
349 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
350 |
-
|
351 |
-
if (isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 1)
|
352 |
-
{
|
353 |
-
$arr = array();
|
354 |
-
$arr['to'] = $post['singlechoice'];
|
355 |
-
$arr['from'] = $post['sender_campaign'];
|
356 |
-
$arr['text'] = $post['sender_campaign_message'];
|
357 |
-
|
358 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
359 |
-
if (isset($result->status) && $result->status == 'OK')
|
360 |
-
{
|
361 |
-
$message = $this->__('Message has been sent successfully');
|
362 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
363 |
-
}
|
364 |
-
else
|
365 |
-
{
|
366 |
-
$message = $this->__('Message has not been sent successfully');
|
367 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
368 |
-
}
|
369 |
-
|
370 |
-
|
371 |
-
}else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 0)
|
372 |
-
{
|
373 |
-
$smscredit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
374 |
-
$collection = Mage::getModel('customer/customer')
|
375 |
-
->getCollection()
|
376 |
-
->addAttributeToSelect('*')
|
377 |
-
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
378 |
-
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left');
|
379 |
-
|
380 |
-
$results = array();
|
381 |
-
foreach ($collection as $customer) {
|
382 |
-
$results[] = $customer->toArray();
|
383 |
-
}
|
384 |
-
|
385 |
-
//$count = count($result);
|
386 |
-
foreach ($results as $i => $result)
|
387 |
-
{
|
388 |
-
|
389 |
-
if(!empty($result['shipping_telephone']))
|
390 |
-
{
|
391 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$result['shipping_country_code'].'" ';
|
392 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
393 |
-
$data = $connection->fetchRow($sql);
|
394 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($result['shipping_telephone'],$data['country_prefix']);
|
395 |
-
$firstname = $result['firstname'];
|
396 |
-
$lastname = $result['lastname'];
|
397 |
-
$msgbody = $post['sender_campaign_message'];
|
398 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
399 |
-
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
400 |
-
$arr = array();
|
401 |
-
$arr['to'] = $number;
|
402 |
-
$arr['from'] = $post['sender_campaign'];
|
403 |
-
$arr['text'] = $msgbody;
|
404 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
405 |
-
}
|
406 |
-
}
|
407 |
-
if ($smscredit >= 1)
|
408 |
-
{
|
409 |
-
$message = $this->__('Message has been sent successfully');
|
410 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
411 |
-
}
|
412 |
-
else
|
413 |
-
{
|
414 |
-
$message = $this->__('Message has not been sent successfully');
|
415 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
416 |
-
}
|
417 |
-
|
418 |
-
}
|
419 |
-
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
420 |
-
{
|
421 |
-
$smscredit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
422 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
423 |
-
foreach ($collection as $customer)
|
424 |
-
{
|
425 |
-
|
426 |
-
$email = $customer->getData('email');
|
427 |
-
$firstname = $customer->getData('firstname');
|
428 |
-
$lastname = $customer->getData('lastname');
|
429 |
-
$cid = $customer->getData('entity_id');
|
430 |
-
|
431 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
432 |
-
$telephone = '';
|
433 |
-
foreach ($collectionAddress as $customerPhno) {
|
434 |
-
$telephone = $customerPhno->getData('telephone');
|
435 |
-
$country_id = $customerPhno->getData('country_id');
|
436 |
-
}
|
437 |
-
|
438 |
-
$customer_select[$email] = array(
|
439 |
-
'email' => $email,
|
440 |
-
'firstname' => $firstname,
|
441 |
-
'lastname' => $lastname,
|
442 |
-
'telephone' => $telephone,
|
443 |
-
'country_id' => $country_id,
|
444 |
-
'customer_id' => $cid
|
445 |
-
);
|
446 |
-
}
|
447 |
-
|
448 |
-
$newsletterArr = array();
|
449 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
450 |
-
$cnt = 0;
|
451 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
452 |
-
{
|
453 |
-
$customer_id = $subscriber->getCustomerId();;
|
454 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
455 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
456 |
-
|
457 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
458 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
459 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
460 |
-
unset($customer_select[$subscriber_email]);
|
461 |
-
}
|
462 |
-
else {
|
463 |
-
$newsletterArr[$cnt] = array(
|
464 |
-
'email' => $subscriber_email,
|
465 |
-
'firstname' => '',
|
466 |
-
'lastname' => '',
|
467 |
-
'telephone' => '',
|
468 |
-
'country_id' => ''
|
469 |
-
);
|
470 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
471 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
472 |
-
}
|
473 |
-
$cnt++;
|
474 |
-
}
|
475 |
-
foreach($newsletterArr as $result)
|
476 |
-
{
|
477 |
-
|
478 |
-
|
479 |
-
if(!empty($result['telephone']))
|
480 |
-
{
|
481 |
-
|
482 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$result['country_id'].'" ';
|
483 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
484 |
-
$data = $connection->fetchRow($sql);
|
485 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($result['telephone'],$data['country_prefix']);
|
486 |
-
$msgbody = $post['sender_campaign_message'];
|
487 |
-
$firstname = $result['firstname'];
|
488 |
-
$lastname = $result['lastname'];
|
489 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
490 |
-
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
491 |
-
$arr = array();
|
492 |
-
$arr['to'] = $number;
|
493 |
-
$arr['from'] = $post['sender_campaign'];
|
494 |
-
$arr['text'] = $msgbody;
|
495 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
496 |
-
|
497 |
-
|
498 |
-
}
|
499 |
-
}
|
500 |
-
if ($smscredit >= 1)
|
501 |
-
{
|
502 |
-
$message = $this->__('Message has been sent successfully');
|
503 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
504 |
-
}
|
505 |
-
else
|
506 |
-
{
|
507 |
-
$message = $this->__('Message has not been sent successfully');
|
508 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
509 |
-
}
|
510 |
-
}
|
511 |
-
|
512 |
-
}
|
513 |
-
catch (Exception $e)
|
514 |
-
{
|
515 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
516 |
-
}
|
517 |
-
$this->_redirect('*/*');
|
518 |
-
}
|
519 |
-
|
520 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php
DELETED
@@ -1,473 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Action
|
12 |
-
{
|
13 |
-
public function indexAction()
|
14 |
-
{
|
15 |
-
$this->loadLayout();
|
16 |
-
$this->renderLayout();
|
17 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderCaseTwo();
|
18 |
-
}
|
19 |
-
|
20 |
-
public function campaignAction()
|
21 |
-
{
|
22 |
-
$post = $this->getRequest()->getPost();
|
23 |
-
try {
|
24 |
-
if (empty($post))
|
25 |
-
echo Mage::throwException($this->__('Invalid form data.'));
|
26 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
27 |
-
$sendin_switch->saveConfig('sendinblue/sms/campaign', $post['campaignSetting']);
|
28 |
-
echo $this->__('Your setting has been successfully saved');
|
29 |
-
}
|
30 |
-
catch (Exception $e)
|
31 |
-
{
|
32 |
-
echo $this->__($e->getMessage());
|
33 |
-
}
|
34 |
-
}
|
35 |
-
public function orderAction()
|
36 |
-
{
|
37 |
-
$post = $this->getRequest()->getPost();
|
38 |
-
try {
|
39 |
-
if (empty($post))
|
40 |
-
Mage::throwException($this->__('Invalid form data.'));
|
41 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
42 |
-
$sendin_switch->saveConfig('sendinblue/sms/order', $post['orderSetting']);
|
43 |
-
echo $this->__('Your setting has been successfully saved');
|
44 |
-
}
|
45 |
-
catch (Exception $e)
|
46 |
-
{
|
47 |
-
echo $this->__($e->getMessage());
|
48 |
-
}
|
49 |
-
}
|
50 |
-
public function creditAction()
|
51 |
-
{
|
52 |
-
$post = $this->getRequest()->getPost();
|
53 |
-
try {
|
54 |
-
if (empty($post))
|
55 |
-
Mage::throwException($this->__('Invalid form data.'));
|
56 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
57 |
-
$sendin_switch->saveConfig('sendinblue/sms/credit', $post['sms_credit']);
|
58 |
-
echo $this->__('Your setting has been successfully saved');
|
59 |
-
}
|
60 |
-
catch (Exception $e)
|
61 |
-
{
|
62 |
-
echo $this->__($e->getMessage());
|
63 |
-
}
|
64 |
-
}
|
65 |
-
public function shipingAction()
|
66 |
-
{
|
67 |
-
$post = $this->getRequest()->getPost();
|
68 |
-
try {
|
69 |
-
if (empty($post))
|
70 |
-
Mage::throwException($this->__('Invalid form data.'));
|
71 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
72 |
-
$sendin_switch->saveConfig('sendinblue/sms/shiping', $post['shipingSetting']);
|
73 |
-
echo $this->__('Your setting has been successfully saved');
|
74 |
-
}
|
75 |
-
catch (Exception $e)
|
76 |
-
{
|
77 |
-
echo $this->__($e->getMessage());
|
78 |
-
}
|
79 |
-
}
|
80 |
-
public function codepostAction()
|
81 |
-
{
|
82 |
-
$post = $this->getRequest()->getPost();
|
83 |
-
try {
|
84 |
-
if (empty($post))
|
85 |
-
Mage::throwException($this->__('Invalid form data.'));
|
86 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
87 |
-
$sendin_switch->saveConfig('sendinblue/tracking/code', $post['script']);
|
88 |
-
echo $this->__('Your setting has been successfully saved');
|
89 |
-
}
|
90 |
-
catch (Exception $e)
|
91 |
-
{
|
92 |
-
echo $this->__($e->getMessage());
|
93 |
-
}
|
94 |
-
}
|
95 |
-
public function smtppostAction()
|
96 |
-
{
|
97 |
-
$post = $this->getRequest()->getPost();
|
98 |
-
try {
|
99 |
-
if (empty($post))
|
100 |
-
Mage::throwException($this->__('Invalid form data.'));
|
101 |
-
else
|
102 |
-
{
|
103 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
104 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
105 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey($get_key);
|
106 |
-
if (empty($result['error']))
|
107 |
-
{
|
108 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', $post['smtptest']);
|
109 |
-
$smtp_response = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp(); // get tracking code
|
110 |
-
if ($smtp_response->result->relay_data->status == 'enabled')
|
111 |
-
{
|
112 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
113 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
114 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
115 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
116 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
117 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
118 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
119 |
-
echo $this->__('Your setting has been successfully saved');
|
120 |
-
}else
|
121 |
-
{
|
122 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
123 |
-
echo $this->__('Your SMTP account is not activated and therefore you can\'t use SendinBlue SMTP. For more informations, please contact our support to: contact@sendinblue.com');
|
124 |
-
}
|
125 |
-
}elseif (isset($responce['error']))
|
126 |
-
echo $this->__('You have entered wrong api key');
|
127 |
-
}
|
128 |
-
}
|
129 |
-
catch (Exception $e)
|
130 |
-
{
|
131 |
-
echo $this->__($e->getMessage());
|
132 |
-
}
|
133 |
-
}
|
134 |
-
public function ajaxcontentAction()
|
135 |
-
{
|
136 |
-
$post = $this->getRequest()->getPost();
|
137 |
-
try {
|
138 |
-
if (empty($post))
|
139 |
-
Mage::throwException($this->__('Invalid form data.'));
|
140 |
-
else
|
141 |
-
{
|
142 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
143 |
-
if ($locale == 'fr_FR')
|
144 |
-
{
|
145 |
-
$title1 = 'Inscrire le contact';
|
146 |
-
$title2 = 'Désinscrire le contact';
|
147 |
-
$first = 'Première page';
|
148 |
-
$last = 'Dernière page';
|
149 |
-
$previous = 'Précédente';
|
150 |
-
$next = 'Suivante';
|
151 |
-
$yes = 'oui';
|
152 |
-
$no = 'non';
|
153 |
-
} else
|
154 |
-
{
|
155 |
-
$title1 = 'Unsubscribe the contact';
|
156 |
-
$title2 = 'Subscribe the contact';
|
157 |
-
$first = 'First';
|
158 |
-
$last = 'Last';
|
159 |
-
$previous = 'Previous';
|
160 |
-
$next = 'Next';
|
161 |
-
$yes = 'yes';
|
162 |
-
$no = 'no';
|
163 |
-
}
|
164 |
-
$page = (int)$post['page'];
|
165 |
-
$cur_page = $page;
|
166 |
-
$page -= 1;
|
167 |
-
$per_page = 20;
|
168 |
-
$previous_btn = true;
|
169 |
-
$next_btn = true;
|
170 |
-
$first_btn = true;
|
171 |
-
$last_btn = true;
|
172 |
-
$start = $page * $per_page;
|
173 |
-
$count = Mage::getModel('sendinblue/sendinblue')->getTotalCount();
|
174 |
-
$no_of_paginations = ceil($count / $per_page);
|
175 |
-
if ($cur_page >= 7)
|
176 |
-
{
|
177 |
-
$start_loop = $cur_page - 3;
|
178 |
-
if ($no_of_paginations > $cur_page + 3)
|
179 |
-
$end_loop = $cur_page + 3;
|
180 |
-
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6)
|
181 |
-
{
|
182 |
-
$start_loop = $no_of_paginations - 6;
|
183 |
-
$end_loop = $no_of_paginations;
|
184 |
-
} else
|
185 |
-
$end_loop = $no_of_paginations;
|
186 |
-
} else
|
187 |
-
{
|
188 |
-
$start_loop = 1;
|
189 |
-
if ($no_of_paginations > 7)
|
190 |
-
$end_loop = 7;
|
191 |
-
else
|
192 |
-
$end_loop = $no_of_paginations;
|
193 |
-
}
|
194 |
-
$collection = Mage::getModel('sendinblue/sendinblue')->getNewsletterSubscribe($start, $per_page);
|
195 |
-
$sendin_status = Mage::getModel('sendinblue/sendinblue')->checkUserSendinStatus($collection);
|
196 |
-
$sendin_result = $sendin_status['result'];
|
197 |
-
if (count($collection) != 0)
|
198 |
-
{
|
199 |
-
$i = 1;
|
200 |
-
$msg = '';
|
201 |
-
foreach ($collection as $subscriber)
|
202 |
-
{
|
203 |
-
$email = $subscriber['email'];
|
204 |
-
$phone = !empty($subscriber['telephone'])?$subscriber['telephone'] : '';
|
205 |
-
$country_id = !empty($subscriber['country_id'])?$subscriber['country_id'] : '';
|
206 |
-
if($phone != '')
|
207 |
-
{
|
208 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$country_id.'" ';
|
209 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
210 |
-
$data = $connection->fetchRow($sql);
|
211 |
-
$phone = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($phone,$data['country_prefix']);
|
212 |
-
}
|
213 |
-
if ($subscriber['customer_id'] != 0)
|
214 |
-
$client = $yes;
|
215 |
-
else
|
216 |
-
$client = $no;
|
217 |
-
if ($sendin_result[$email] === 1 || $sendin_result[$email] === null)
|
218 |
-
$show_status = 0;
|
219 |
-
if ($sendin_result[$email] === 0)
|
220 |
-
$show_status = 1;
|
221 |
-
if ($subscriber['subscriber_status'] != 3)
|
222 |
-
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
223 |
-
else
|
224 |
-
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
225 |
-
if ($show_status)
|
226 |
-
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif"
|
227 |
-
id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
228 |
-
else
|
229 |
-
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif"
|
230 |
-
id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
231 |
-
$msg .= '<tr class="even pointer"><td class="a-left">'.$email.'</td><td class="a-left">'.$client.'</td><td class="a-left">'.$phone.'</td><td class="a-left">'.$img_magento.'</td>
|
232 |
-
<td class="a-left last"><a status="'.$show_status.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
233 |
-
'.$img_sendin.'</a></td></tr>';
|
234 |
-
$i++;
|
235 |
-
}
|
236 |
-
}
|
237 |
-
$msg_paging = '';
|
238 |
-
$msg_paging .= '<tr><td colspan="7"><div class="pagination"><ul class="pull-left">';
|
239 |
-
if ($first_btn && $cur_page > 1)
|
240 |
-
$msg_paging .= '<li p="1" class="active">'.$first.'</li>';
|
241 |
-
else if ($first_btn)
|
242 |
-
$msg_paging .= '<li p="1" class="inactive">'.$first.'</li>';
|
243 |
-
if ($previous_btn && $cur_page > 1)
|
244 |
-
{
|
245 |
-
$pre = $cur_page - 1;
|
246 |
-
$msg_paging .= '<li p="'.$pre.'" class="active">'.$previous.'</li>';
|
247 |
-
} else if ($previous_btn)
|
248 |
-
$msg_paging .= '<li class="inactive">'.$previous.'</li>';
|
249 |
-
for ($i = $start_loop; $i <= $end_loop; $i++)
|
250 |
-
{
|
251 |
-
if ($cur_page == $i)
|
252 |
-
$msg_paging .= '<li p="'.$i.'" style="color:#fff;background-color:#000000;" class="active">'.$i.'</li>';
|
253 |
-
else
|
254 |
-
$msg_paging .= '<li p="'.$i.'" class="active">'.$i.'</li>';
|
255 |
-
}
|
256 |
-
if ($next_btn && $cur_page < $no_of_paginations)
|
257 |
-
{
|
258 |
-
$nex = $cur_page + 1;
|
259 |
-
$msg_paging .= '<li p="'.$nex.'" class="active">'.$next.'</li>';
|
260 |
-
} else if ($next_btn)
|
261 |
-
$msg_paging .= '<li class="inactive">'.$next.'</li>';
|
262 |
-
if ($last_btn && $cur_page < $no_of_paginations)
|
263 |
-
$msg_paging .= '<li p="'.$no_of_paginations.'" class="active">'.$last.'</li>';
|
264 |
-
else if ($last_btn)
|
265 |
-
$msg_paging .= '<li p="'.$no_of_paginations.'" class="inactive">'.$last.'</li>';
|
266 |
-
if ($count != 0)
|
267 |
-
echo $msg.$msg_paging.'</td></tr>';
|
268 |
-
}
|
269 |
-
}catch (Exception $e)
|
270 |
-
{
|
271 |
-
echo $this->__($e->getMessage());
|
272 |
-
}
|
273 |
-
}
|
274 |
-
public function ajaxupdateAction()
|
275 |
-
{
|
276 |
-
$post = $this->getRequest()->getPost();
|
277 |
-
try {
|
278 |
-
if (empty($post))
|
279 |
-
Mage::throwException($this->__('Invalid form data.'));
|
280 |
-
$temp_sub_status = ($post['newsletter'] == 0) ? 1 : 3;
|
281 |
-
if (!empty($post['email']) && $post['newsletter'] == 0)
|
282 |
-
{
|
283 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailSubscribe($post['email']);
|
284 |
-
$responce_data = json_decode($responce);
|
285 |
-
$sql = 'SELECT * from customer_entity where email = "'.$post['email'].'" ';
|
286 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
287 |
-
$custdata = $connection->fetchRow($sql);
|
288 |
-
|
289 |
-
if ($responce_data->errorMsg == 'User not exists')
|
290 |
-
{
|
291 |
-
if ($custdata['entity_id'] != '')
|
292 |
-
{
|
293 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$custdata['entity_id']);
|
294 |
-
$telephone = '';
|
295 |
-
foreach ($collectionAddress as $customerPhno) {
|
296 |
-
$telephone = $customerPhno->getData('telephone');
|
297 |
-
$country_id = $customerPhno->getData('country_id');
|
298 |
-
|
299 |
-
}
|
300 |
-
|
301 |
-
$customer = Mage::getModel("customer/customer");
|
302 |
-
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
303 |
-
$customer->loadByEmail($post['email']); //load customer by email id
|
304 |
-
$customer_name = $customer->getData();
|
305 |
-
|
306 |
-
if (!empty($telephone))
|
307 |
-
{
|
308 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$country_id.'" ';
|
309 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
310 |
-
$data = $connection->fetchRow($sql);
|
311 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($telephone,$data['country_prefix']);
|
312 |
-
}
|
313 |
-
$client = 1;
|
314 |
-
$telephone = (isset($number))? $number : '';
|
315 |
-
$firstname = (isset($customer_name['firstname']))?$customer_name['firstname'] : '';
|
316 |
-
$lasttname = (isset($customer_name['lastname']))?$customer_name['lastname'] : '';
|
317 |
-
|
318 |
-
$extra = $firstname.'|'.$lasttname.'|'.$client.'|'.$telephone;
|
319 |
-
|
320 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
321 |
-
|
322 |
-
}
|
323 |
-
else
|
324 |
-
{
|
325 |
-
$client = 0;
|
326 |
-
$extra = ''.'|'.''.'|'.$client.'|'.'';
|
327 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
328 |
-
}
|
329 |
-
}
|
330 |
-
$sql = 'SELECT * from newsletter_subscriber where subscriber_email = "'.$post['email'].'" ';
|
331 |
-
$custdatanews = $connection->fetchRow($sql);
|
332 |
-
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
333 |
-
{
|
334 |
-
|
335 |
-
$connection->query("insert into newsletter_subscriber(store_id, customer_id, subscriber_email, subscriber_status)
|
336 |
-
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$custdata['email']."','1')");
|
337 |
-
|
338 |
-
}
|
339 |
-
else
|
340 |
-
{
|
341 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post['email']);
|
342 |
-
$costomer_data->setStatus($temp_sub_status);
|
343 |
-
$costomer_data->setIsStatusChanged(true);
|
344 |
-
$costomer_data->save();
|
345 |
-
}
|
346 |
-
|
347 |
-
}
|
348 |
-
else{
|
349 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($post['email']);
|
350 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post['email']);
|
351 |
-
$sql = 'SELECT * from customer_entity where email = "'.$post['email'].'" ';
|
352 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
353 |
-
$custdata = $connection->fetchRow($sql);
|
354 |
-
|
355 |
-
if (!$costomer_data->getStoreId())
|
356 |
-
{
|
357 |
-
$costomer_data->setSubscriberEmail($custdata['email']);
|
358 |
-
$costomer_data->setCustomerId($custdata['entity_id']);
|
359 |
-
$costomer_data->setStoreId($custdata['store_id']);
|
360 |
-
}
|
361 |
-
$costomer_data->setStatus($temp_sub_status);
|
362 |
-
$costomer_data->setIsStatusChanged(true);
|
363 |
-
$costomer_data->save();
|
364 |
-
}
|
365 |
-
}
|
366 |
-
catch (Exception $e)
|
367 |
-
{
|
368 |
-
echo $this->__($e->getMessage());
|
369 |
-
}
|
370 |
-
}
|
371 |
-
|
372 |
-
public function ajaxordersmsAction($sender, $message, $number)
|
373 |
-
{
|
374 |
-
$post = $this->getRequest()->getPost();
|
375 |
-
try {
|
376 |
-
if (empty($post))
|
377 |
-
Mage::throwException($this->__('Invalid form data.'));
|
378 |
-
$number = $post['number'];
|
379 |
-
$charone = substr($number, 0, 1);
|
380 |
-
$chartwo = substr($number, 0, 2);
|
381 |
-
if ($charone == '0' && $chartwo == '00')
|
382 |
-
$number = $number;
|
383 |
-
|
384 |
-
if (isset($number))
|
385 |
-
{
|
386 |
-
$arr = array();
|
387 |
-
$arr['to'] = $number;
|
388 |
-
$arr['from'] = $post['sender'];
|
389 |
-
$arr['text'] = $post['message'];
|
390 |
-
|
391 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
392 |
-
if (isset($result->status) && $result->status == 'OK')
|
393 |
-
echo 'OK';
|
394 |
-
else
|
395 |
-
echo 'KO';
|
396 |
-
}
|
397 |
-
|
398 |
-
}
|
399 |
-
catch (Exception $e)
|
400 |
-
{
|
401 |
-
echo $this->__($e->getMessage());
|
402 |
-
}
|
403 |
-
}
|
404 |
-
|
405 |
-
public function ajaxordershippedAction($sender,$message,$number)
|
406 |
-
{
|
407 |
-
$post = $this->getRequest()->getPost();
|
408 |
-
try {
|
409 |
-
if (empty($post))
|
410 |
-
Mage::throwException($this->__('Invalid form data.'));
|
411 |
-
$number = $post['number'];
|
412 |
-
$charone = substr($number, 0, 1);
|
413 |
-
$chartwo = substr($number, 0, 2);
|
414 |
-
|
415 |
-
if ($charone == '0' && $chartwo == '00')
|
416 |
-
$number = $number;
|
417 |
-
|
418 |
-
|
419 |
-
if (isset($number))
|
420 |
-
{
|
421 |
-
$arr = array();
|
422 |
-
$arr['to'] = $number;
|
423 |
-
$arr['from'] = $post['sender'];
|
424 |
-
$arr['text'] = $post['message'];
|
425 |
-
|
426 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
427 |
-
if (isset($result->status) && $result->status == 'OK')
|
428 |
-
echo 'OK';
|
429 |
-
else
|
430 |
-
echo 'KO';exit;
|
431 |
-
}
|
432 |
-
|
433 |
-
}
|
434 |
-
catch (Exception $e)
|
435 |
-
{
|
436 |
-
echo $this->__($e->getMessage());
|
437 |
-
}
|
438 |
-
}
|
439 |
-
|
440 |
-
public function ajaxsmscampaignAction($sender,$message,$number)
|
441 |
-
{
|
442 |
-
$post = $this->getRequest()->getPost();
|
443 |
-
try {
|
444 |
-
if (empty($post))
|
445 |
-
Mage::throwException($this->__('Invalid form data.'));
|
446 |
-
$number = $post['number'];
|
447 |
-
$charone = substr($number, 0, 1);
|
448 |
-
$chartwo = substr($number, 0, 2);
|
449 |
-
if ($charone == '0' && $chartwo == '00')
|
450 |
-
$number = $number;
|
451 |
-
|
452 |
-
if (isset($number))
|
453 |
-
{
|
454 |
-
$arr = array();
|
455 |
-
$arr['to'] = $number;
|
456 |
-
$arr['from'] = $post['sender'];
|
457 |
-
$arr['text'] = $post['message'];
|
458 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
459 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
460 |
-
if (isset($result->status) && $result->status == 'OK')
|
461 |
-
echo 'OK';
|
462 |
-
else
|
463 |
-
echo 'KO';
|
464 |
-
}
|
465 |
-
|
466 |
-
}
|
467 |
-
catch (Exception $e)
|
468 |
-
{
|
469 |
-
echo $this->__($e->getMessage());
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
//echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number <br />';
|
12 |
-
|
13 |
-
$resource = Mage::getSingleton('core/resource');
|
14 |
-
$writeConnection = $resource->getConnection('core_write');
|
15 |
-
$sql = "SELECT * FROM `core_config_data` WHERE `path` LIKE 'sendinblue/%'";
|
16 |
-
echo $datanum = count($writeConnection->fetchAll($sql));
|
17 |
-
if ($datanum > 0 )
|
18 |
-
{
|
19 |
-
$query = "DELETE FROM `core_config_data` WHERE `path` LIKE 'sendinblue/%'";
|
20 |
-
$writeConnection->query($query);
|
21 |
-
}
|
22 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/sendinblue.xml
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
<sendinblue_admin_adminhtml_myform_index>
|
|
|
|
|
|
|
|
|
4 |
<reference name="content">
|
5 |
<block type="adminhtml/template" name="sendinblue" template="sendinblue/myform.phtml"/>
|
6 |
</reference>
|
7 |
</sendinblue_admin_adminhtml_myform_index>
|
8 |
-
<!-- Code to add for js and css -->
|
9 |
-
<default>
|
10 |
-
<reference name="head">
|
11 |
-
<action method="addItem"><type>skin_css</type><name>sendinblue/css/styles.css</name><params/></action>
|
12 |
-
<action method="addItem"><type>skin_css</type><name>sendinblue/css/jquery.multiselect.css</name><params/></action>
|
13 |
-
</reference>
|
14 |
-
</default>
|
15 |
-
<!-- [end] -->
|
16 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
<sendinblue_admin_adminhtml_myform_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem"><type>skin_css</type><name>sendinblue/css/styles.css</name><params/></action>
|
6 |
+
<action method="addItem"><type>skin_css</type><name>sendinblue/css/jquery.multiselect.css</name><params/></action>
|
7 |
+
</reference>
|
8 |
<reference name="content">
|
9 |
<block type="adminhtml/template" name="sendinblue" template="sendinblue/myform.phtml"/>
|
10 |
</reference>
|
11 |
</sendinblue_admin_adminhtml_myform_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
</layout>
|
app/design/adminhtml/default/default/template/sendinblue/myform.phtml
CHANGED
@@ -8,24 +8,28 @@
|
|
8 |
* needs then we can't provide a technical support.
|
9 |
**/
|
10 |
?>
|
11 |
-
<link rel="stylesheet" type="text/css" href="
|
12 |
<script>
|
13 |
var selectoption = "<?php echo $this->__('Select option'); ?>";
|
14 |
var selected = "<?php echo $this->__('Selected'); ?>";
|
15 |
</script>
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
<script type="text/javascript" src="<?php echo
|
|
|
|
|
|
|
20 |
<div class="entry-edit">
|
21 |
<div class="">
|
22 |
-
<img class="sendin-logo" src="<?php echo
|
23 |
<div class="slogan">
|
24 |
<?php echo $this->__('SendinBlue : THE all-in-one plugin for your marketing and transactional emails.'); ?></div><div class="clear"></div>
|
25 |
</div>
|
|
|
26 |
<div class="sendin_row">
|
27 |
<fieldset class="fields">
|
28 |
-
<legend class="lgend"><img src="<?php echo
|
29 |
<?php echo $this->__('SendinBlue'); ?></legend>
|
30 |
<div class="contact-details">
|
31 |
<h2 style="color:#268CCD;"> <?php echo $this->__('Contact SendinBlue team'); ?></h2>
|
@@ -35,7 +39,7 @@
|
|
35 |
<?php echo $this->__('contact@sendinblue.com'); ?></a>
|
36 |
<br><?php echo $this->__('Phone : 0899 25 30 61'); ?></p>
|
37 |
<p style="padding-top:20px;"><b><?php echo $this->__('For further informations, please visit our website:'); ?></b>
|
38 |
-
<br><a href="<?php echo $this->__('https://www.sendinblue.com'); ?>" target="_blank" style="color:#268CCD; text-decoration: none;">
|
39 |
<?php echo $this->__('https://www.sendinblue.com'); ?></a></p>
|
40 |
</div>
|
41 |
<div><p><?php echo $this->__('With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.'); ?></p>
|
@@ -56,38 +60,48 @@
|
|
56 |
</fieldset>
|
57 |
</div>
|
58 |
<?php
|
59 |
-
$
|
|
|
|
|
|
|
60 |
if ($module_status)
|
61 |
-
$style = '';
|
62 |
else
|
63 |
$style = 'style="display:none;"';
|
64 |
-
$api_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
65 |
-
$get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus();
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
?>
|
68 |
|
69 |
<div class="sendin_row">
|
70 |
<fieldset class="fields">
|
71 |
-
<legend class="lgend"><img src="<?php echo
|
72 |
<?php echo $this->__('Prerequisites'); ?></legend>
|
73 |
<span><?php echo $this->__('- You should have a SendinBlue account. You can create a free account here:'); ?>
|
74 |
-
<a href="<?php echo $this->__('https://www.sendinblue.com'); ?>" target="_blank" style="text-decoration: none; color: #268CCD;">
|
75 |
<?php echo $this->__('https://www.sendinblue.com'); ?></a><br></span></fieldset>
|
76 |
</div>
|
77 |
|
78 |
<div class="sendin_row" >
|
79 |
<form id="edit_formapik" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/apikeypost'); ?>">
|
80 |
-
<input name="form_key" type="hidden" value="<?php echo
|
81 |
-
<input name="skin_url" id ='skin_url' type="hidden" value="<?php echo
|
82 |
<div class="section-config active">
|
83 |
<fieldset class="fields">
|
84 |
-
<legend class="lgend"><img src="<?php echo
|
85 |
<table cellspacing="0" class="form-list3">
|
86 |
<tr>
|
87 |
<td class="fix_width2"><label><?php echo $this->__('Activate the SendinBlue module:'); ?></label></td>
|
88 |
<td class="input-ele">
|
89 |
-
<input type="radio" <?php if(
|
90 |
-
<input type="radio" name="sendin_api_status" <?php if(
|
91 |
<input type="hidden" name="apistatuskey" id="apistatuskey" value="<?php echo $module_status;?>">
|
92 |
</td>
|
93 |
</tr>
|
@@ -95,7 +109,7 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
95 |
<tr <?php echo $style; ?> id="sendin_apikey">
|
96 |
<td><label><?php echo $this->__('API Key:'); ?></label></td>
|
97 |
<td class="input-ele">
|
98 |
-
<input type="text" name="sendin_apikey" id="sendin_apikey_val" class="input-text" value="<?php echo
|
99 |
<span class="toolTip" title="<?php echo stripslashes($this->__('Please enter your API key from your SendinBlue account and if you don\'t have it yet, please go to www.sendinblue.com and subscribe. You can then get the API key from https://my.sendinblue.com/advanced/apikey')); ?>"> </span>
|
100 |
</td>
|
101 |
</tr>
|
@@ -116,29 +130,30 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
116 |
<?php if ($api_key != '') { ?>
|
117 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
118 |
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/syncronizepost'); ?>">
|
|
|
119 |
<div class="section-config active">
|
120 |
-
<input name="form_key" type="hidden" value="<?php echo
|
121 |
<fieldset id="my-fieldset" class="fields">
|
122 |
-
<legend class="lgend"><img src="<?php echo
|
123 |
<table cellspacing="0" class="form-list">
|
124 |
<tr>
|
125 |
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></label>
|
126 |
</td>
|
127 |
<td class="input-ele">
|
128 |
-
<input type="radio" <?php if(
|
129 |
-
<input type="radio" <?php if(
|
130 |
</td>
|
131 |
</tr>
|
132 |
<tr>
|
133 |
<td colspan="2">
|
134 |
-
<div id="hidetabselect" <?php if(
|
135 |
<table>
|
136 |
<tr>
|
137 |
<td><label><?php echo $this->__('Your Lists'); ?></label></td>
|
138 |
<td class="input-ele"><?php
|
139 |
-
$list =
|
140 |
|
141 |
-
$selectedlist =
|
142 |
if($selectedlist!=NULL){
|
143 |
$list_array = explode('|',$selectedlist);
|
144 |
}else{
|
@@ -154,7 +169,112 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
154 |
<span title="<?php echo $this->__('Select the contact list where you want to save the contacts of your site Magento. By default, we have created a list Magento in your SendinBlue account and we have selected it'); ?>" class="toolTip"> </span>
|
155 |
</td>
|
156 |
</tr>
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
<tr>
|
159 |
<td> </td>
|
160 |
<td class="a-left">
|
@@ -162,6 +282,19 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
162 |
<input type="submit" class="btn" name="syncronizeSubmit" value ="<?php echo $this->__('Update'); ?>" /></div>
|
163 |
</td>
|
164 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
<tr><td colspan="2">
|
166 |
<?php echo $this->__('To synchronize the emails of your customers from SendinBlue platform to your e-commerce website, you should run '); ?><a href="<?php echo Mage::helper("adminhtml")->getUrl("sendinblue/adminhtml_sync/index/",array()); ?>" style="color: #000000; outline: 0 none; text-decoration: none;"><?php echo $this->__('this link'); ?> </a><?php echo $this->__('each day'); ?><span class="toolTip" title="<?php echo $this->__('Note that if you change the name of your Shop (currently ');?><?php echo ucfirst(Mage::app()->getFrontController()->getRequest()->getModuleName());?><?php echo $this->__(') the token value changes.'); ?>"> </span>
|
167 |
</td></tr>
|
@@ -173,39 +306,39 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
173 |
</table>
|
174 |
</fieldset>
|
175 |
</div>
|
176 |
-
|
177 |
</div>
|
178 |
<?php
|
179 |
}
|
180 |
-
$module_status =
|
181 |
if ($module_status == 0)
|
182 |
$style_smtp = 'style="display:none;"';
|
183 |
else
|
184 |
-
$style_smtp = '';
|
185 |
|
186 |
?>
|
187 |
<?php if ($api_key != '') { ?>
|
188 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
189 |
<form id="edit_formsmtp" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/sendmail'); ?>">
|
190 |
-
<input name="form_key" type="hidden" value="<?php echo
|
191 |
<input name="smtpUrl" type="hidden" id="smtpUrl" value="<?php echo $this->getUrl('sendinblue/ajax/smtppost'); ?>" />
|
192 |
<div class="section-config active">
|
193 |
<fieldset class="fields">
|
194 |
-
<legend class="lgend"><img src="<?php echo
|
195 |
<table cellspacing="0" class="form-list">
|
196 |
|
197 |
<tr>
|
198 |
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></label></td>
|
199 |
<td class="input-ele">
|
200 |
-
<input type="radio" class = 'smtpStatus radio_nospaceing' <?php if(
|
201 |
-
<input <?php if(
|
202 |
</td>
|
203 |
<td> </td>
|
204 |
</tr>
|
205 |
|
206 |
<tr <?php echo $style_smtp; ?> class='smtptest'>
|
207 |
<td class="fix_width"><label><?php echo $this->__('Send email test From / To :'); ?></label></td>
|
208 |
-
<td class="input-ele"><input class="input-text" name="email" id="email" value="" size="40"/>
|
209 |
<input type="submit" class="btn" style="margin-left:3px;" name="SmtpSubmit" onclick="return smtpvalidate('<?php echo $this->__('Please provide valid Email!') ;?>');" value ="<?php echo $this->__('Send'); ?>" />
|
210 |
</td>
|
211 |
</tr>
|
@@ -221,17 +354,30 @@ $style_smtp = '';
|
|
221 |
<div class="section-config active">
|
222 |
<input name="trackingUrl" type="hidden" id="trackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/codepost'); ?>" />
|
223 |
<fieldset id="my-fieldset" class="fields">
|
224 |
-
<legend class="lgend"><img src="<?php echo
|
225 |
<table cellspacing="0" class="form-list">
|
226 |
<tr>
|
227 |
<td class="fix_width"><label><?php echo $this->__('Do you want to install a tracking code when validating an order'); ?></label>
|
228 |
</td>
|
229 |
<td class="input-ele">
|
230 |
-
<input type="radio" <?php if(
|
231 |
-
<input type="radio" <?php if(
|
232 |
<span title="<?php echo $this->__('This feature will allow you to transfer all your customers orders from Magento into SendinBlue to implement your email marketing strategy.'); ?>" class="toolTip"> </span>
|
233 |
</td>
|
234 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
</table>
|
236 |
</fieldset>
|
237 |
</div>
|
@@ -239,7 +385,7 @@ $style_smtp = '';
|
|
239 |
|
240 |
<div class="sendin_row hidetableblock" <?php echo $style; ?> >
|
241 |
<fieldset class="fields">
|
242 |
-
<legend class="lgend"><img src="<?php echo
|
243 |
<?php echo $this->__('Manage SMS'); ?></legend>
|
244 |
<table width="100%" cellspacing="0" cellpadding="0" class="table hidetableblock form-list">
|
245 |
|
@@ -248,29 +394,31 @@ $style_smtp = '';
|
|
248 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
249 |
<span style="margin-bottom:10px; color:#333333;">
|
250 |
<?php echo $this->__('Currently you have '); ?>
|
251 |
-
<?php $credit =
|
252 |
-
|
|
|
|
|
253 |
|
254 |
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
255 |
-
<a target="_blank" href ="<?php echo $this->__('https://www.sendinblue.com/pricing'); ?>" style="color: #000000; outline: 0 none; text-decoration: none;">
|
256 |
<?php echo $this->__('here'); ?></a></span></td></tr>
|
257 |
<tr>
|
258 |
<td>
|
259 |
<label>
|
260 |
<?php echo $this->__('You want to be notified by e-mail when you do not have enough credits?'); ?></label>
|
261 |
-
<input name="sms_credit" <?php if(
|
262 |
<?php echo $this->__('Yes'); ?>
|
263 |
-
<input name="sms_credit" <?php if(
|
264 |
<?php echo $this->__('No'); ?>
|
265 |
<input name="credit" type="hidden" id="credits" value="<?php echo $this->getUrl('sendinblue/ajax/credit'); ?>" />
|
266 |
<div class="hideCredit" id="div_email_test" style="padding-top:20px;">
|
267 |
<form action="<?php echo $this->getUrl('*/*/sendnotifysms'); ?>" method="POST" name="notify_sms_mail_form">
|
268 |
-
<input name="form_key" type="hidden" value="<?php echo
|
269 |
<p class="form-data"><label><?php echo $this->__('Email'); ?></label>
|
270 |
-
<input name="sendin_notify_email" id="sendin_notify_email" type="text" class="input-text" value="<?php echo
|
271 |
</p>
|
272 |
<p class="form-data"> <label><?php echo $this->__('Limit'); ?></label>
|
273 |
-
<input name="sendin_notify_value" id="sendin_notify_value" type="text" class="input-text" value="<?php echo
|
274 |
</p>
|
275 |
<p class="form-data" style="width:705px"><input name="notify_sms_mail" type="submit" value="<?php echo $this->__('Save'); ?>" onclick="return validate('<?php echo $this->__('Please provide valid Email!') ;?>','<?php echo $this->__('Please provide a limit in integer format') ; ?>');" class="button btn" style=" float:right;"/></p>
|
276 |
<p class="mrgin-left" style="float:left;"><?php echo $this->__('To get the email notification, you should run '); ?> <a href="<?php echo Mage::helper("adminhtml")->getUrl("sendinblue/adminhtml_notify/index/",array()); ?>" style="color: #000000; outline: 0 none; text-decoration: none;"><?php echo $this->__('this link'); ?> </a> <?php echo $this->__(' atleast one time per day. '); ?>
|
@@ -303,9 +451,9 @@ $style_smtp = '';
|
|
303 |
<label class="r_label">
|
304 |
<?php echo $this->__('Send SMS after order confirmation'); ?></label>
|
305 |
<div class="radio_bx">
|
306 |
-
<input name="sms_order_setting" <?php if(
|
307 |
<?php echo $this->__('Yes'); ?>
|
308 |
-
<input name="sms_order_setting" <?php if(
|
309 |
<?php echo $this->__('No'); ?>
|
310 |
</div>
|
311 |
<div style="clear:both;"></div>
|
@@ -316,7 +464,7 @@ $style_smtp = '';
|
|
316 |
<tr>
|
317 |
<td>
|
318 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendorder'); ?>" name="sender_order_form">
|
319 |
-
<input name="form_key" type="hidden" value="<?php echo
|
320 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding">
|
321 |
<tr>
|
322 |
<td class="fix_width2" valign="top">
|
@@ -324,18 +472,18 @@ $style_smtp = '';
|
|
324 |
<?php echo $this->__('Sender'); ?></label>
|
325 |
</td>
|
326 |
<td>
|
327 |
-
<input name="sender_order" id="sender_order" type="text" value="<?php echo
|
328 |
-
<span class="toolTip" title="<?php echo $this->__('This field allows you to
|
329 |
-
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_order_text">
|
330 |
</div>
|
331 |
-
|
332 |
</td>
|
333 |
</tr>
|
334 |
<tr>
|
335 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
336 |
<td>
|
337 |
-
<textarea name="sender_order_message" id="sender_order_message" cols="45" rows="5" class="textarea_bx"><?php echo
|
338 |
-
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write
|
339 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:490px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_order_message_text_count">0</span>
|
340 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_order_message_text">160</span></div>
|
341 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
@@ -356,7 +504,7 @@ $style_smtp = '';
|
|
356 |
<tr>
|
357 |
<td colspan="2" valign="top" border="0">
|
358 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendordertest'); ?>" name="sender_order_testForm">
|
359 |
-
<input name="form_key" type="hidden" value="<?php echo
|
360 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
361 |
<tr>
|
362 |
<td>
|
@@ -388,9 +536,9 @@ $style_smtp = '';
|
|
388 |
<label class="r_label">
|
389 |
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></label>
|
390 |
<div class="radio_bx">
|
391 |
-
<input name="sms_shiping_setting" <?php if(
|
392 |
<?php echo $this->__('Yes'); ?>
|
393 |
-
<input name="sms_shiping_setting" type="radio" value="0" class="sms_shiping_setting radio_spaceing2" <?php if(
|
394 |
<?php echo $this->__('No'); ?>
|
395 |
</div>
|
396 |
<div style="clear:both;"></div>
|
@@ -402,14 +550,14 @@ $style_smtp = '';
|
|
402 |
<td>
|
403 |
<div class="" style="width:500px;">
|
404 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipment'); ?>" name="sender_shipment_form">
|
405 |
-
<input name="form_key" type="hidden" value="<?php echo
|
406 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
407 |
<tr>
|
408 |
<td class="fix_width2" valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
409 |
<td>
|
410 |
-
<input name="sender_shipment" maxlength="
|
411 |
-
<span class="toolTip" title="<?php echo $this->__('This field allows you to
|
412 |
-
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_shipment_text">
|
413 |
</div>
|
414 |
|
415 |
</td>
|
@@ -417,8 +565,8 @@ $style_smtp = '';
|
|
417 |
<tr>
|
418 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
419 |
<td>
|
420 |
-
<textarea name="sender_shipment_message" id="sender_shipment_message" cols="45" rows="5" class="textarea_bx"><?php echo
|
421 |
-
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write
|
422 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:470px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_shipment_message_text_count">0</span>
|
423 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_shipment_message_text">160</span></div>
|
424 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
@@ -440,7 +588,7 @@ $style_smtp = '';
|
|
440 |
<tr>
|
441 |
<td colspan="2" valign="top" border="0">
|
442 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipmenttest'); ?>" name="sender_order_testForm">
|
443 |
-
<input name="form_key" type="hidden" value="<?php echo
|
444 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
445 |
<tr>
|
446 |
<td valign="top" colspan="2">
|
@@ -471,9 +619,9 @@ $style_smtp = '';
|
|
471 |
<td class="row1 fix_width2">
|
472 |
<label class="r_label"><?php echo $this->__('Send a campaign SMS'); ?></label>
|
473 |
<div class="radio_bx">
|
474 |
-
<input name="sms_campaign_setting" <?php if(
|
475 |
<?php echo $this->__('Yes'); ?>
|
476 |
-
<input name="sms_campaign_setting" <?php if(
|
477 |
<?php echo $this->__('No'); ?>
|
478 |
</div>
|
479 |
<div class="hideCampaign">
|
@@ -483,18 +631,18 @@ $style_smtp = '';
|
|
483 |
<tr>
|
484 |
<td>
|
485 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendcampaign'); ?>" name="sender_campaign_form">
|
486 |
-
<input name="form_key" type="hidden" value="<?php echo
|
487 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding" >
|
488 |
<tr>
|
489 |
<td class="fix_width2" valign="top"> <label><?php echo $this->__('To'); ?></label></td>
|
490 |
<td>
|
491 |
-
<input name="Sendin_Sms_Choice" id="r1_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_nospaceing" type="radio" value="1" <?php if(
|
492 |
<?php echo $this->__('A single contact'); ?>
|
493 |
|
494 |
-
<input name="Sendin_Sms_Choice" id="r2_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_spaceing2" type="radio" value="0" <?php if(
|
495 |
<?php echo $this->__('All my Magento customers'); ?>
|
496 |
|
497 |
-
<input name="Sendin_Sms_Choice" id="r3_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_spaceing2" type="radio" value="2" <?php if(
|
498 |
<?php echo $this->__('Only subscribed customers'); ?>
|
499 |
</td>
|
500 |
</tr>
|
@@ -515,12 +663,32 @@ $style_smtp = '';
|
|
515 |
</td>
|
516 |
</tr>
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
<tr>
|
519 |
<td valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
520 |
<td>
|
521 |
-
<input name="sender_campaign" maxlength="
|
522 |
-
<span class="toolTip" title="<?php echo $this->__('This field allows you to
|
523 |
-
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_campaign_text">
|
524 |
</div>
|
525 |
|
526 |
</td>
|
@@ -529,7 +697,7 @@ $style_smtp = '';
|
|
529 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
530 |
<td>
|
531 |
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
532 |
-
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write
|
533 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:470px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_campaign_message_text_count">0</span>
|
534 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
535 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
@@ -543,26 +711,25 @@ $style_smtp = '';
|
|
543 |
</table>
|
544 |
</form>
|
545 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
</td>
|
558 |
</tr>
|
559 |
</table>
|
560 |
-
|
561 |
-
</div></span>
|
562 |
</td>
|
563 |
</tr>
|
564 |
</table>
|
565 |
-
</div>
|
566 |
</div>
|
567 |
</div>
|
568 |
</div>
|
@@ -576,20 +743,21 @@ $style_smtp = '';
|
|
576 |
<?php if($get_syncronize == 1) { ?>
|
577 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
578 |
<fieldset id="my-fieldset" class="fields">
|
579 |
-
<legend class="lgend"><img src="<?php echo
|
580 |
|
581 |
<input name="ajaxcontentUrl" type="hidden" id="ajaxcontentUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxcontent'); ?>" />
|
582 |
<input name="ajaxUrl" type="hidden" id="ajaxUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxupdate'); ?>" />
|
583 |
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
584 |
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
585 |
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
|
|
586 |
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
587 |
<div id="userGrid">
|
588 |
<div class="grid">
|
589 |
<div class="hor-scroll">
|
590 |
-
<?php echo $this->__('You have '); ?> <?php echo
|
591 |
<?php echo $this->__(' contacts subscribed and '); ?>
|
592 |
-
<?php echo
|
593 |
<?php echo $this->__(' contacts unsubscribed from Magento.'); ?><span id="Spantextmore" >
|
594 |
<?php echo $this->__(' For more details,'); ?></span><span id="Spantextless" style="display: none;" >
|
595 |
<?php echo $this->__(' For less details,'); ?></span><b>
|
@@ -603,15 +771,15 @@ $style_smtp = '';
|
|
603 |
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
604 |
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
605 |
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
606 |
-
<th class="no-link
|
|
|
607 |
</tr>
|
608 |
</thead>
|
609 |
<tbody class='midleft'>
|
610 |
-
|
611 |
</tbody>
|
612 |
</table>
|
613 |
-
</div></div></div>
|
614 |
</fieldset>
|
615 |
-
</div>
|
616 |
<?php }} ?>
|
617 |
-
|
8 |
* needs then we can't provide a technical support.
|
9 |
**/
|
10 |
?>
|
11 |
+
<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
|
12 |
<script>
|
13 |
var selectoption = "<?php echo $this->__('Select option'); ?>";
|
14 |
var selected = "<?php echo $this->__('Selected'); ?>";
|
15 |
</script>
|
16 |
+
<?php
|
17 |
+
$skinUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
18 |
+
?>
|
19 |
+
<script type="text/javascript" src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/js/jquery-1.9.1.min.js"></script>
|
20 |
+
<script type="text/javascript" src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/js/jquery-ui.min.js"></script>
|
21 |
+
<script type="text/javascript" src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/js/jquery.multiselect.min.js"></script>
|
22 |
+
<script type="text/javascript" src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/js/sendinblue.js"></script>
|
23 |
<div class="entry-edit">
|
24 |
<div class="">
|
25 |
+
<img class="sendin-logo" src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/<?php echo $this->__('sendinblue.png'); ?>">
|
26 |
<div class="slogan">
|
27 |
<?php echo $this->__('SendinBlue : THE all-in-one plugin for your marketing and transactional emails.'); ?></div><div class="clear"></div>
|
28 |
</div>
|
29 |
+
<input type="hidden" name="langvalue" value="<?php echo Mage::app()->getLocale()->getLocaleCode(); ?>" id="langvalue">
|
30 |
<div class="sendin_row">
|
31 |
<fieldset class="fields">
|
32 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
33 |
<?php echo $this->__('SendinBlue'); ?></legend>
|
34 |
<div class="contact-details">
|
35 |
<h2 style="color:#268CCD;"> <?php echo $this->__('Contact SendinBlue team'); ?></h2>
|
39 |
<?php echo $this->__('contact@sendinblue.com'); ?></a>
|
40 |
<br><?php echo $this->__('Phone : 0899 25 30 61'); ?></p>
|
41 |
<p style="padding-top:20px;"><b><?php echo $this->__('For further informations, please visit our website:'); ?></b>
|
42 |
+
<br><a href="<?php echo $this->__('https://www.sendinblue.com?utm_source=magento_plugin&utm_medium=plugin&utm_campaign=module_link'); ?>" target="_blank" style="color:#268CCD; text-decoration: none;">
|
43 |
<?php echo $this->__('https://www.sendinblue.com'); ?></a></p>
|
44 |
</div>
|
45 |
<div><p><?php echo $this->__('With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.'); ?></p>
|
60 |
</fieldset>
|
61 |
</div>
|
62 |
<?php
|
63 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
64 |
+
$sendinStatus = $sendinModule->getEnableStatus();
|
65 |
+
|
66 |
+
$module_status = isset($sendinStatus)?1:0;
|
67 |
if ($module_status)
|
68 |
+
$style = '';
|
69 |
else
|
70 |
$style = 'style="display:none;"';
|
|
|
|
|
71 |
|
72 |
+
$api_key = $sendinModule->getApiKey();
|
73 |
+
$get_syncronize = $sendinModule->getSyncronizeStatus();
|
74 |
+
$trackStatus = $sendinModule->getTrackingStatus();
|
75 |
+
$trackingHistory = $sendinModule->getTrackingHistoryStatus();
|
76 |
+
$notifySmsStatus = $sendinModule->getNotifySmsStatus();
|
77 |
+
$orderSmsStatus = $sendinModule->getOrderSmsStatus();
|
78 |
+
$campaignStatus = $sendinModule->getCampaignStatus();
|
79 |
+
$shipingSmsStatus = $sendinModule->getShipingSmsStatus();
|
80 |
+
$formKey = Mage::getSingleton('core/session')->getFormKey();
|
81 |
?>
|
82 |
|
83 |
<div class="sendin_row">
|
84 |
<fieldset class="fields">
|
85 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
86 |
<?php echo $this->__('Prerequisites'); ?></legend>
|
87 |
<span><?php echo $this->__('- You should have a SendinBlue account. You can create a free account here:'); ?>
|
88 |
+
<a href="<?php echo $this->__('https://www.sendinblue.com?utm_source=magento_plugin&utm_medium=plugin&utm_campaign=module_link'); ?>" target="_blank" style="text-decoration: none; color: #268CCD;">
|
89 |
<?php echo $this->__('https://www.sendinblue.com'); ?></a><br></span></fieldset>
|
90 |
</div>
|
91 |
|
92 |
<div class="sendin_row" >
|
93 |
<form id="edit_formapik" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/apikeypost'); ?>">
|
94 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
95 |
+
<input name="skin_url" id ='skin_url' type="hidden" value="<?php echo $skinUrl;?>" />
|
96 |
<div class="section-config active">
|
97 |
<fieldset class="fields">
|
98 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Settings'); ?></legend>
|
99 |
<table cellspacing="0" class="form-list3">
|
100 |
<tr>
|
101 |
<td class="fix_width2"><label><?php echo $this->__('Activate the SendinBlue module:'); ?></label></td>
|
102 |
<td class="input-ele">
|
103 |
+
<input type="radio" <?php if($sendinStatus == 1) { echo 'checked'; } ?> name="sendin_api_status" class="sendin_api_status radio_nospaceing" value="1" /> <?php echo $this->__('Yes'); ?>
|
104 |
+
<input type="radio" name="sendin_api_status" <?php if($sendinStatus == 0) { echo 'checked'; } ?> class="sendin_api_status radio_spaceing2" value="0" /> <?php echo $this->__('No'); ?>
|
105 |
<input type="hidden" name="apistatuskey" id="apistatuskey" value="<?php echo $module_status;?>">
|
106 |
</td>
|
107 |
</tr>
|
109 |
<tr <?php echo $style; ?> id="sendin_apikey">
|
110 |
<td><label><?php echo $this->__('API Key:'); ?></label></td>
|
111 |
<td class="input-ele">
|
112 |
+
<input type="text" name="sendin_apikey" id="sendin_apikey_val" class="input-text" value="<?php echo $api_key; ?>" />
|
113 |
<span class="toolTip" title="<?php echo stripslashes($this->__('Please enter your API key from your SendinBlue account and if you don\'t have it yet, please go to www.sendinblue.com and subscribe. You can then get the API key from https://my.sendinblue.com/advanced/apikey')); ?>"> </span>
|
114 |
</td>
|
115 |
</tr>
|
130 |
<?php if ($api_key != '') { ?>
|
131 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
132 |
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/syncronizepost'); ?>">
|
133 |
+
|
134 |
<div class="section-config active">
|
135 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
136 |
<fieldset id="my-fieldset" class="fields">
|
137 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></legend>
|
138 |
<table cellspacing="0" class="form-list">
|
139 |
<tr>
|
140 |
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></label>
|
141 |
</td>
|
142 |
<td class="input-ele">
|
143 |
+
<input type="radio" <?php if($get_syncronize == 1) { echo "checked"; } ?> name="syncronize" value="1" class="radio_nospaceing hdtab"/> <?php echo $this->__('Yes'); ?>
|
144 |
+
<input type="radio" <?php if($get_syncronize == 0) { echo "checked"; } ?> name="syncronize" value="0" class="radio_spaceing2 hdtab" /> <?php echo $this->__('No'); ?> <span title="<?php echo $this->__('If you activate this feature, your new contacts will be automatically added to SendinBlue or unsubscribed from SendinBlue. To synchronize the other way (SendinBlue to Magento), you should run the url (mentioned below) each day.'); ?>" class="toolTip"> </span>
|
145 |
</td>
|
146 |
</tr>
|
147 |
<tr>
|
148 |
<td colspan="2">
|
149 |
+
<div id="hidetabselect" <?php if(!$get_syncronize) {?>style="display:none;"<?php } ?>>
|
150 |
<table>
|
151 |
<tr>
|
152 |
<td><label><?php echo $this->__('Your Lists'); ?></label></td>
|
153 |
<td class="input-ele"><?php
|
154 |
+
$list = $sendinModule->lists();
|
155 |
|
156 |
+
$selectedlist = $sendinModule->getUserlists();
|
157 |
if($selectedlist!=NULL){
|
158 |
$list_array = explode('|',$selectedlist);
|
159 |
}else{
|
169 |
<span title="<?php echo $this->__('Select the contact list where you want to save the contacts of your site Magento. By default, we have created a list Magento in your SendinBlue account and we have selected it'); ?>" class="toolTip"> </span>
|
170 |
</td>
|
171 |
</tr>
|
172 |
+
<!-- double optin functionality -->
|
173 |
+
<tr>
|
174 |
+
<td></td>
|
175 |
+
<td>
|
176 |
+
<div class="col-md-6 left-wrapper radio_group_option">
|
177 |
+
<div class="form-group manage_subscribe_block">
|
178 |
+
<div>
|
179 |
+
<input type="radio" value="nocon" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'nocon') echo 'checked="checked"'; ?> name="subscribe_confirm_type" id="no_follow_email">
|
180 |
+
<label for="no_follow_email" class="radio-label"> <?php echo $this->__('No confirmation'); ?></label>
|
181 |
+
</div>
|
182 |
+
<div class="clearfix"></div>
|
183 |
+
<div style="display:block;" class="inner_manage_box">
|
184 |
+
<div class="ver_5" id="no-templates"><?php echo $this->__('With this option, contacts are directly added to your list when they enter their email address. No confirmation email is sent.'); ?></div>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
<div class="form-group manage_subscribe_block">
|
188 |
+
<div class="col-md-10">
|
189 |
+
<input type="radio" value="simplemail" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'simplemail') echo 'checked="checked"'; ?> id="follow_mail" name="subscribe_confirm_type">
|
190 |
+
<label for="follow_mail" class="radio-label"> <?php echo $this->__('Simple confirmation'); ?></label><span title="<?php echo $this->__('This confirmation email is one of your SMTP templates. By default, we have created a Default Template - Single Confirmation. You can create and activate your SMTP templates by clicking here'); ?>" class="toolTip">
|
191 |
+
</span>
|
192 |
+
</div>
|
193 |
+
<div class="inner_manage_box">
|
194 |
+
<div class="clearfix"></div>
|
195 |
+
<div class="ver_5" id="create-templates"> <?php echo $this->__('By selecting this option, contacts are directly added to your list when they enter their email address on the form. A confirmation email will automatically be sent following their subscription.'); ?></div>
|
196 |
+
<div class="clearfix"></div>
|
197 |
+
<div id="mail-templates">
|
198 |
+
<div class="listData ver_5 managesubscribeBlock"><select class="ui-state-default" name="template_simple"><option value=""><?php echo $this->__('Select Template'); ?></option>
|
199 |
+
<?php
|
200 |
+
$templatelist = $sendinModule->templateDisplay();
|
201 |
+
|
202 |
+
if (!empty($templatelist->result->campaign_records))
|
203 |
+
{
|
204 |
+
foreach ($templatelist->result->campaign_records as $template_data)
|
205 |
+
{ if ($template_data->templ_status === 'Active' && stristr($template_data->html_content, 'DOUBLEOPTIN') === false)
|
206 |
+
{ ?>
|
207 |
+
<option value="<?php echo $template_data->id; ?>" <?php if($template_data->id == Mage::getStoreConfig('sendinblue/SendinTemplateId')) echo 'selected = "selected"'; ?> ><?php echo $template_data->campaign_name; ?></option>
|
208 |
+
<?php }}} ?>
|
209 |
+
</select><span title="<?php echo $this->__('Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter'); ?>" class="toolTip"></span>
|
210 |
+
</div>
|
211 |
+
</div>
|
212 |
+
<div class="clearfix"></div>
|
213 |
+
<div id="mail-templates-active-state"></div>
|
214 |
+
</div>
|
215 |
+
<div class="clearfix"></div>
|
216 |
+
</div>
|
217 |
+
<div class="clearfix"></div>
|
218 |
+
<div class="form-group manage_subscribe_block">
|
219 |
+
<div class="col-md-10">
|
220 |
+
<input type="radio" value="doubleoptin" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'doubleoptin') echo 'checked="checked"'; ?> id="double_optin" name="subscribe_confirm_type">
|
221 |
+
<label for="double_optin" class="radio-label"> <?php echo $this->__('Double opt-in confirmation'); ?></label><span title="<?php echo $this->__("If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the 'FORM' folder, on the 'Temp - DOUBLE OPT-IN' list. After confirmation, the contact will be saved in the 'Corresponding List' selected below."); ?>" class="toolTip">
|
222 |
+
</span></div>
|
223 |
+
<div class="inner_manage_box">
|
224 |
+
<div class="clearfix"></div>
|
225 |
+
<!-- Please select a template with the [DOUBLEOPTIN] link -->
|
226 |
+
<div id="create-doubleoptin-templates">
|
227 |
+
<p><?php echo $this->__('Once the form has been completed, your contact will receive an email with a link to confirm their subscription.'); ?></p></div>
|
228 |
+
<!-- Redirect URL after click on the validation email -->
|
229 |
+
<div class="clearfix"></div>
|
230 |
+
<div id="doubleoptin-redirect-url-area" class="form-group clearfix">
|
231 |
+
<input type="checkbox" class="openCollapse" <?php if(Mage::getStoreConfig('sendinblue/SendinOptinRedirectUrlCheck') == 'yes') echo 'checked="checked"'; ?> value="yes" name="optin_redirect_url_check" id="doptin_redirect_span_icon">
|
232 |
+
<a href=""> <?php echo $this->__('Redirect URL after clicking in the validation email'); ?> </a>
|
233 |
+
<!-- <label style="margin-bottom: 5px;"></label> -->
|
234 |
+
|
235 |
+
<div id="mail-doubleoptin-redirect" class="collapse">
|
236 |
+
<p style="width: 90%;text-align: justify;text-justify: inter-word;">
|
237 |
+
<?php echo $this->__('Redirect your contacts to a landing page or to your website once they have clicked on the confirmation link in the email.'); ?></p>
|
238 |
+
<input type="url" style="margin-bottom:10px;width:370px" value="<?php echo Mage::getStoreConfig('sendinblue/SendinDoubleoptinRedirectUrl'); ?>" placeholder="http://your-domain.com" class="form-control" name="doubleoptin-redirect-url" id="doubleoptin-redirect-url">
|
239 |
+
<div class="clearfix"></div>
|
240 |
+
<div class="pull-left" id="doubleoptin-redirect-message"> </div>
|
241 |
+
<div class="clearfix"></div>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
|
245 |
+
<!-- Send a final confirmation email -->
|
246 |
+
<div class="clearfix"></div>
|
247 |
+
<div id="doubleoptin-final-confirmation-area" class="form-group clearfix">
|
248 |
+
<input type="checkbox" class="openCollapse" <?php if(Mage::getStoreConfig('sendinblue/SendinFinalConfirmEmail') == 'yes') echo 'checked="checked"'; ?> value="yes" name="final_confirm_email" id="doptin_final_confirm_email">
|
249 |
+
<a href="#doubleoptin-final-confirm"> <?php echo $this->__('Send a final confirmation email'); ?> </a>
|
250 |
+
|
251 |
+
<div id="doubleoptin-final-confirm" class="collapse">
|
252 |
+
<p><?php echo $this->__('Once a contact has clicked in the double opt-in confirmation email, send them a final confirmation email'); ?></p>
|
253 |
+
<div style="text-align: left;" class="listData ver_5 managesubscribeBlock"><select class="ui-state-default" name="template_final"><option value=""><?php echo $this->__('Select Template'); ?></option>
|
254 |
+
<?php
|
255 |
+
$templatelist = $sendinModule->templateDisplay();
|
256 |
+
|
257 |
+
if (!empty($templatelist->result->campaign_records))
|
258 |
+
{
|
259 |
+
foreach ($templatelist->result->campaign_records as $template_data)
|
260 |
+
{ if ($template_data->templ_status === 'Active' && stristr($template_data->html_content, 'DOUBLEOPTIN') === false)
|
261 |
+
{ ?>
|
262 |
+
<option value="<?php echo $template_data->id; ?>" <?php if($template_data->id == Mage::getStoreConfig('sendinblue/SendinTemplateFinal')) echo 'selected = "selected"'; ?> ><?php echo $template_data->campaign_name; ?></option>
|
263 |
+
<?php }}} ?></select><span title="<?php echo $this->__('Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter'); ?>"class="toolTip"></span></div>
|
264 |
+
<div class="clearfix"></div>
|
265 |
+
<div class="pull-left" id="final-mail-templates"></div>
|
266 |
+
<div class="clearfix"></div>
|
267 |
+
</div>
|
268 |
+
<div id="doubleoptin-templates-active-state">
|
269 |
+
|
270 |
+
</div>
|
271 |
+
</div>
|
272 |
+
</div>
|
273 |
+
</div>
|
274 |
+
<div class="clearfix"></div>
|
275 |
+
|
276 |
+
</td>
|
277 |
+
</tr>
|
278 |
<tr>
|
279 |
<td> </td>
|
280 |
<td class="a-left">
|
282 |
<input type="submit" class="btn" name="syncronizeSubmit" value ="<?php echo $this->__('Update'); ?>" /></div>
|
283 |
</td>
|
284 |
</tr>
|
285 |
+
</form>
|
286 |
+
|
287 |
+
<?php if($sendinModule->getImportOldSubsStatus()==1){ ?>
|
288 |
+
<form id="reimport_form" name="reimport_form" method="post" action="<?php echo $this->getUrl('*/*/reimportpost'); ?>">
|
289 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
290 |
+
<tr>
|
291 |
+
<td> </td>
|
292 |
+
<td class="a-left">
|
293 |
+
<div class="btnmrgn-right">
|
294 |
+
<input type="submit" class="btn" name="importoldSubmit" value ="<?php echo $this->__('Import Old Subscribers'); ?>" /></div>
|
295 |
+
</td>
|
296 |
+
</tr></form>
|
297 |
+
<?php } ?>
|
298 |
<tr><td colspan="2">
|
299 |
<?php echo $this->__('To synchronize the emails of your customers from SendinBlue platform to your e-commerce website, you should run '); ?><a href="<?php echo Mage::helper("adminhtml")->getUrl("sendinblue/adminhtml_sync/index/",array()); ?>" style="color: #000000; outline: 0 none; text-decoration: none;"><?php echo $this->__('this link'); ?> </a><?php echo $this->__('each day'); ?><span class="toolTip" title="<?php echo $this->__('Note that if you change the name of your Shop (currently ');?><?php echo ucfirst(Mage::app()->getFrontController()->getRequest()->getModuleName());?><?php echo $this->__(') the token value changes.'); ?>"> </span>
|
300 |
</td></tr>
|
306 |
</table>
|
307 |
</fieldset>
|
308 |
</div>
|
309 |
+
|
310 |
</div>
|
311 |
<?php
|
312 |
}
|
313 |
+
$module_status = $sendinModule->getSmtpStatus();
|
314 |
if ($module_status == 0)
|
315 |
$style_smtp = 'style="display:none;"';
|
316 |
else
|
317 |
+
$style_smtp = '';
|
318 |
|
319 |
?>
|
320 |
<?php if ($api_key != '') { ?>
|
321 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
322 |
<form id="edit_formsmtp" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/sendmail'); ?>">
|
323 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
324 |
<input name="smtpUrl" type="hidden" id="smtpUrl" value="<?php echo $this->getUrl('sendinblue/ajax/smtppost'); ?>" />
|
325 |
<div class="section-config active">
|
326 |
<fieldset class="fields">
|
327 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></legend>
|
328 |
<table cellspacing="0" class="form-list">
|
329 |
|
330 |
<tr>
|
331 |
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></label></td>
|
332 |
<td class="input-ele">
|
333 |
+
<input type="radio" class = 'smtpStatus radio_nospaceing' <?php if($module_status == 1) { echo 'checked'; } ?> name="smtp" value="1" /> <?php echo $this->__('Yes'); ?>
|
334 |
+
<input <?php if($module_status == 0) { echo 'checked'; } ?> type="radio" class = 'smtpStatus radio_spaceing2' name="smtp" value="0" /> <?php echo $this->__('No'); ?><span title="<?php echo $this->__('Transactional email is an expected email because it is triggered automatically after a transaction or a specific event. Common examples of transactional email are : account opening and welcome message, order shipment confirmation, shipment tracking and purchase order status, registration via a contact form, account termination, payment confirmation, invoice etc.'); ?>" class="toolTip"> </span>
|
335 |
</td>
|
336 |
<td> </td>
|
337 |
</tr>
|
338 |
|
339 |
<tr <?php echo $style_smtp; ?> class='smtptest'>
|
340 |
<td class="fix_width"><label><?php echo $this->__('Send email test From / To :'); ?></label></td>
|
341 |
+
<td class="input-ele"><input class="input-text input-height" name="email" id="email" value="" size="40"/>
|
342 |
<input type="submit" class="btn" style="margin-left:3px;" name="SmtpSubmit" onclick="return smtpvalidate('<?php echo $this->__('Please provide valid Email!') ;?>');" value ="<?php echo $this->__('Send'); ?>" />
|
343 |
</td>
|
344 |
</tr>
|
354 |
<div class="section-config active">
|
355 |
<input name="trackingUrl" type="hidden" id="trackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/codepost'); ?>" />
|
356 |
<fieldset id="my-fieldset" class="fields">
|
357 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Code tracking'); ?> </legend>
|
358 |
<table cellspacing="0" class="form-list">
|
359 |
<tr>
|
360 |
<td class="fix_width"><label><?php echo $this->__('Do you want to install a tracking code when validating an order'); ?></label>
|
361 |
</td>
|
362 |
<td class="input-ele">
|
363 |
+
<input type="radio" <?php if($trackStatus == 1) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_nospaceing' value="1" /> <?php echo $this->__('Yes'); ?>
|
364 |
+
<input type="radio" <?php if($trackStatus == 0) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_spaceing2' value="0" /> <?php echo $this->__('No'); ?>
|
365 |
<span title="<?php echo $this->__('This feature will allow you to transfer all your customers orders from Magento into SendinBlue to implement your email marketing strategy.'); ?>" class="toolTip"> </span>
|
366 |
</td>
|
367 |
</tr>
|
368 |
+
<?php
|
369 |
+
if ($trackStatus == 1 && $trackingHistory == 1)
|
370 |
+
$style_track = '';
|
371 |
+
else
|
372 |
+
$style_track = 'style="display:none;"';
|
373 |
+
if($trackStatus == 1 && $trackingHistory == 1) { ?>
|
374 |
+
<tr <?php echo $style_track; ?> class='ordertracking'>
|
375 |
+
<td> </td>
|
376 |
+
<input type="hidden" name="history_status" value="<?php echo $trackingHistory; ?>" id="history_status">
|
377 |
+
<input name="importordertrackingUrl" type="hidden" id="importordertrackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/orderhistory'); ?>" />
|
378 |
+
<td class="input-ele"><label style="text-align:left;"><a href="javascript:void(0);" class="Trackhistory button btn" style="color: #000000; outline: 0 none; text-decoration: none; font-weight: normal;"><?php echo $this->__('Import the data of previous orders'); ?></a></label></td>
|
379 |
+
</tr>
|
380 |
+
<?php } ?>
|
381 |
</table>
|
382 |
</fieldset>
|
383 |
</div>
|
385 |
|
386 |
<div class="sendin_row hidetableblock" <?php echo $style; ?> >
|
387 |
<fieldset class="fields">
|
388 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
389 |
<?php echo $this->__('Manage SMS'); ?></legend>
|
390 |
<table width="100%" cellspacing="0" cellpadding="0" class="table hidetableblock form-list">
|
391 |
|
394 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
395 |
<span style="margin-bottom:10px; color:#333333;">
|
396 |
<?php echo $this->__('Currently you have '); ?>
|
397 |
+
<?php $credit = $sendinModule->getSmsCredit();
|
398 |
+
$notify_value = $sendinModule->getNotifyValueStatus();
|
399 |
+
?>
|
400 |
+
<?php if ($credit >= $notify_value){ ?> <strong style="color:#000000;"><?php echo $credit; ?></strong><?php } else {?><strong style="color:#F03D25;"><?php echo $credit; ?></strong><?php } ?>
|
401 |
|
402 |
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
403 |
+
<a target="_blank" href ="<?php echo $this->__('https://www.sendinblue.com/pricing?utm_source=magento_plugin&utm_medium=plugin&utm_campaign=module_link'); ?>" style="color: #000000; outline: 0 none; text-decoration: none;">
|
404 |
<?php echo $this->__('here'); ?></a></span></td></tr>
|
405 |
<tr>
|
406 |
<td>
|
407 |
<label>
|
408 |
<?php echo $this->__('You want to be notified by e-mail when you do not have enough credits?'); ?></label>
|
409 |
+
<input name="sms_credit" <?php if($notifySmsStatus == 1) { echo 'checked'; } ?> type="radio" value="1" class="sms_credit radio_nospaceing" style="margin-right:10px;" />
|
410 |
<?php echo $this->__('Yes'); ?>
|
411 |
+
<input name="sms_credit" <?php if($notifySmsStatus == 0) { echo 'checked'; } ?> type="radio" value="0" class="sms_credit radio_spaceing2" style="margin-left:20px;margin-right:10px;" />
|
412 |
<?php echo $this->__('No'); ?>
|
413 |
<input name="credit" type="hidden" id="credits" value="<?php echo $this->getUrl('sendinblue/ajax/credit'); ?>" />
|
414 |
<div class="hideCredit" id="div_email_test" style="padding-top:20px;">
|
415 |
<form action="<?php echo $this->getUrl('*/*/sendnotifysms'); ?>" method="POST" name="notify_sms_mail_form">
|
416 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
417 |
<p class="form-data"><label><?php echo $this->__('Email'); ?></label>
|
418 |
+
<input name="sendin_notify_email" id="sendin_notify_email" type="text" class="input-text" value="<?php echo $sendinModule->getNotifyEmailStatus(); ?>" size="40" />
|
419 |
</p>
|
420 |
<p class="form-data"> <label><?php echo $this->__('Limit'); ?></label>
|
421 |
+
<input name="sendin_notify_value" id="sendin_notify_value" type="text" class="input-text" value="<?php echo $sendinModule->getNotifyValueStatus(); ?>" size="40" /><span class="toolTip" title="<?php echo $this->__('Alert threshold for remaining credits'); ?>"> </span>
|
422 |
</p>
|
423 |
<p class="form-data" style="width:705px"><input name="notify_sms_mail" type="submit" value="<?php echo $this->__('Save'); ?>" onclick="return validate('<?php echo $this->__('Please provide valid Email!') ;?>','<?php echo $this->__('Please provide a limit in integer format') ; ?>');" class="button btn" style=" float:right;"/></p>
|
424 |
<p class="mrgin-left" style="float:left;"><?php echo $this->__('To get the email notification, you should run '); ?> <a href="<?php echo Mage::helper("adminhtml")->getUrl("sendinblue/adminhtml_notify/index/",array()); ?>" style="color: #000000; outline: 0 none; text-decoration: none;"><?php echo $this->__('this link'); ?> </a> <?php echo $this->__(' atleast one time per day. '); ?>
|
451 |
<label class="r_label">
|
452 |
<?php echo $this->__('Send SMS after order confirmation'); ?></label>
|
453 |
<div class="radio_bx">
|
454 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 1) { echo 'checked'; } ?> class="sms_order_setting radio_nospaceing" type="radio" value="1" />
|
455 |
<?php echo $this->__('Yes'); ?>
|
456 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 0) { echo 'checked'; } ?> class="sms_order_setting radio_spaceing2" type="radio" value="0" />
|
457 |
<?php echo $this->__('No'); ?>
|
458 |
</div>
|
459 |
<div style="clear:both;"></div>
|
464 |
<tr>
|
465 |
<td>
|
466 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendorder'); ?>" name="sender_order_form">
|
467 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
468 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding">
|
469 |
<tr>
|
470 |
<td class="fix_width2" valign="top">
|
472 |
<?php echo $this->__('Sender'); ?></label>
|
473 |
</td>
|
474 |
<td>
|
475 |
+
<input name="sender_order" id="sender_order" type="text" value="<?php echo $sendinModule->getSendSmsOrderSubject(); ?>" class="input_bx" autocomplete="off" />
|
476 |
+
<span class="toolTip" title="<?php echo $this->__('This field allows you to customize the SMS sender. The number of characters is limited to 11 alphanumeric characters. You can´t configure your Sender with a phone number.'); ?>"> </span>
|
477 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_order_text">11</span></em>
|
478 |
</div>
|
479 |
+
|
480 |
</td>
|
481 |
</tr>
|
482 |
<tr>
|
483 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
484 |
<td>
|
485 |
+
<textarea name="sender_order_message" id="sender_order_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsmOrderMessage(); ?></textarea>
|
486 |
+
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.'); ?>"> </span>
|
487 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:490px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_order_message_text_count">0</span>
|
488 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_order_message_text">160</span></div>
|
489 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
504 |
<tr>
|
505 |
<td colspan="2" valign="top" border="0">
|
506 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendordertest'); ?>" name="sender_order_testForm">
|
507 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
508 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
509 |
<tr>
|
510 |
<td>
|
536 |
<label class="r_label">
|
537 |
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></label>
|
538 |
<div class="radio_bx">
|
539 |
+
<input name="sms_shiping_setting" <?php if($shipingSmsStatus==1) { echo 'checked'; } ?> class="sms_shiping_setting radio_nospaceing" type="radio" value="1" />
|
540 |
<?php echo $this->__('Yes'); ?>
|
541 |
+
<input name="sms_shiping_setting" type="radio" value="0" class="sms_shiping_setting radio_spaceing2" <?php if($shipingSmsStatus == 0) { echo 'checked'; } ?>/>
|
542 |
<?php echo $this->__('No'); ?>
|
543 |
</div>
|
544 |
<div style="clear:both;"></div>
|
550 |
<td>
|
551 |
<div class="" style="width:500px;">
|
552 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipment'); ?>" name="sender_shipment_form">
|
553 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
554 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
555 |
<tr>
|
556 |
<td class="fix_width2" valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
557 |
<td>
|
558 |
+
<input name="sender_shipment" maxlength="11" id="sender_shipment" type="text" value="<?php echo $sendinModule->getSendSmsShipingSubject(); ?>" class="input_bx" autocomplete="off" />
|
559 |
+
<span class="toolTip" title="<?php echo $this->__('This field allows you to customize the SMS sender. The number of characters is limited to 11 alphanumeric characters. You can´t configure your Sender with a phone number.'); ?>"> </span>
|
560 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_shipment_text">11</span></em>
|
561 |
</div>
|
562 |
|
563 |
</td>
|
565 |
<tr>
|
566 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
567 |
<td>
|
568 |
+
<textarea name="sender_shipment_message" id="sender_shipment_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsShipingMessage(); ?></textarea>
|
569 |
+
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.'); ?>"> </span>
|
570 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:470px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_shipment_message_text_count">0</span>
|
571 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_shipment_message_text">160</span></div>
|
572 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
588 |
<tr>
|
589 |
<td colspan="2" valign="top" border="0">
|
590 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipmenttest'); ?>" name="sender_order_testForm">
|
591 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
592 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
593 |
<tr>
|
594 |
<td valign="top" colspan="2">
|
619 |
<td class="row1 fix_width2">
|
620 |
<label class="r_label"><?php echo $this->__('Send a campaign SMS'); ?></label>
|
621 |
<div class="radio_bx">
|
622 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 1) { echo 'checked'; } ?> class="sms_campaign_setting radio_nospaceing" type="radio" value="1" />
|
623 |
<?php echo $this->__('Yes'); ?>
|
624 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 0) { echo 'checked'; } ?> class="sms_campaign_setting radio_spaceing2" type="radio" value="0" />
|
625 |
<?php echo $this->__('No'); ?>
|
626 |
</div>
|
627 |
<div class="hideCampaign">
|
631 |
<tr>
|
632 |
<td>
|
633 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendcampaign'); ?>" name="sender_campaign_form">
|
634 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
635 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding" >
|
636 |
<tr>
|
637 |
<td class="fix_width2" valign="top"> <label><?php echo $this->__('To'); ?></label></td>
|
638 |
<td>
|
639 |
+
<input name="Sendin_Sms_Choice" id="r1_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_nospaceing" type="radio" value="1" <?php if($shipingSmsStatus == 1) { echo 'checked'; } ?> />
|
640 |
<?php echo $this->__('A single contact'); ?>
|
641 |
|
642 |
+
<input name="Sendin_Sms_Choice" id="r2_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_spaceing2" type="radio" value="0" <?php if($shipingSmsStatus == 0) { echo 'checked'; } ?> />
|
643 |
<?php echo $this->__('All my Magento customers'); ?>
|
644 |
|
645 |
+
<input name="Sendin_Sms_Choice" id="r3_Sendin_Sms_Choice" class="Sendin_Sms_Choice radio_spaceing2" type="radio" value="2" <?php if($shipingSmsStatus == 0) { echo 'checked'; } ?> />
|
646 |
<?php echo $this->__('Only subscribed customers'); ?>
|
647 |
</td>
|
648 |
</tr>
|
663 |
</td>
|
664 |
</tr>
|
665 |
|
666 |
+
<tr class='sib_datepicker' style="display:none;">
|
667 |
+
<td valign="top"><label><?php echo $this->__('Schedule your sms campaign'); ?></label></td>
|
668 |
+
<td>
|
669 |
+
<input name="sib_datetimepicker" class="input_bx Datepicker" id="sib_datetimepicker" type="text" value="" autocomplete="off" />
|
670 |
+
<select name="hour">
|
671 |
+
<option value='0'><?php echo $this->__('Hour'); ?></option>
|
672 |
+
<?php for($i=1;$i<=23;$i++){ ?>
|
673 |
+
<option><?php echo $i; ?></option>
|
674 |
+
<?php } ?>
|
675 |
+
</select>
|
676 |
+
<select name="minute">
|
677 |
+
<option value='0'><?php echo $this->__('Minute'); ?></option>
|
678 |
+
<?php for($i=5;$i<=55;$i=$i+5){ ?>
|
679 |
+
<option><?php echo $i; ?></option>
|
680 |
+
<?php } ?>
|
681 |
+
</select>
|
682 |
+
|
683 |
+
</td>
|
684 |
+
</tr>
|
685 |
+
|
686 |
<tr>
|
687 |
<td valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
688 |
<td>
|
689 |
+
<input name="sender_campaign" maxlength="11" id="sender_campaign" type="text" value="" class="input_bx" autocomplete="off" />
|
690 |
+
<span class="toolTip" title="<?php echo $this->__('This field allows you to customize the SMS sender. The number of characters is limited to 11 alphanumeric characters. You can´t configure your Sender with a phone number.'); ?>"> </span>
|
691 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_campaign_text">11</span></em>
|
692 |
</div>
|
693 |
|
694 |
</td>
|
697 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
698 |
<td>
|
699 |
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
700 |
+
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.'); ?>"> </span>
|
701 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:470px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_campaign_message_text_count">0</span>
|
702 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
703 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
711 |
</table>
|
712 |
</form>
|
713 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
714 |
+
<tr>
|
715 |
+
<td>
|
716 |
+
<div class="hintmsg"><em><?php echo $this->__('Sending a test SMS will be deducted from your SMS credits.'); ?></em></div>
|
717 |
+
<label><?php echo $this->__('Send a test SMS'); ?></label>
|
718 |
+
<input name="sender_campaigntest_number" id="sender_campaigntest_number" maxlength="17" type="text" value="" class="input_bx" />
|
719 |
+
<span class="toolTip" title="<?php echo $this->__('The phone number should be in this form: 0033663309741 for this France mobile 06 63 30 97 41 (0033 is France prefix)'); ?>"> </span>
|
720 |
+
<input name="sender_campaignsms_submit" type="button" value="<?php echo $this->__('Send'); ?>" onclick="return testCampaignSmsSend('<?php echo $this->__('Please fill the Sender field'); ?>','<?php echo $this->__('Please fill the Message field'); ?>','<?php echo $this->__('Please fill the Mobile Phone field'); ?>');" class="button btn" />
|
721 |
+
<input type="hidden" name="smsCampError" id="smsCampError" style="display:none;" value="<?php echo $this->__('Message has not been sent successfully'); ?>"><input type="hidden" id="smsCampSuccess" name="smsCampSuccess" value="<?php echo $this->__('Message has been sent successfully'); ?>">
|
722 |
+
</td>
|
723 |
+
</tr>
|
724 |
+
</table>
|
725 |
</td>
|
726 |
</tr>
|
727 |
</table>
|
728 |
+
</div></span>
|
|
|
729 |
</td>
|
730 |
</tr>
|
731 |
</table>
|
732 |
+
</div>
|
733 |
</div>
|
734 |
</div>
|
735 |
</div>
|
743 |
<?php if($get_syncronize == 1) { ?>
|
744 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
745 |
<fieldset id="my-fieldset" class="fields">
|
746 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Contacts list'); ?> </legend>
|
747 |
|
748 |
<input name="ajaxcontentUrl" type="hidden" id="ajaxcontentUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxcontent'); ?>" />
|
749 |
<input name="ajaxUrl" type="hidden" id="ajaxUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxupdate'); ?>" />
|
750 |
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
751 |
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
752 |
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
753 |
+
<input name="ajaxSmsSubscribeUrl" type="hidden" id="ajaxSmsSubscribeUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmssubscribe'); ?>" />
|
754 |
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
755 |
<div id="userGrid">
|
756 |
<div class="grid">
|
757 |
<div class="hor-scroll">
|
758 |
+
<?php echo $this->__('You have '); ?> <?php echo $sendinModule->getNewsletterSubscribeCount(); ?>
|
759 |
<?php echo $this->__(' contacts subscribed and '); ?>
|
760 |
+
<?php echo $sendinModule->getNewsletterUnSubscribeCount(); ?>
|
761 |
<?php echo $this->__(' contacts unsubscribed from Magento.'); ?><span id="Spantextmore" >
|
762 |
<?php echo $this->__(' For more details,'); ?></span><span id="Spantextless" style="display: none;" >
|
763 |
<?php echo $this->__(' For less details,'); ?></span><b>
|
771 |
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
772 |
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
773 |
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
774 |
+
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter SendinBlue Status'); ?><span title="<?php echo $this->__('Click on the icon to subscribe / unsubscribe the contact from SendinBlue and Magento.'); ?>" class="toolTip"> </span></span></th>
|
775 |
+
<th class="no-link last"><span class="nobr"><?php echo $this->__('SMS SendinBlue Status'); ?><span title="<?php echo $this->__('Click on the icon to subscribe / unsubscribe the sms from SendinBlue and Magento.'); ?>" class="toolTip"> </span></span></th>
|
776 |
</tr>
|
777 |
</thead>
|
778 |
<tbody class='midleft'>
|
|
|
779 |
</tbody>
|
780 |
</table>
|
781 |
+
</div></div></div>
|
782 |
</fieldset>
|
783 |
+
</div>
|
784 |
<?php }} ?>
|
785 |
+
|
app/etc/modules/Sendinblue_Sendinblue.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
<active>true</active>
|
6 |
-
<codePool>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
9 |
-
</config>
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/doubleoptin_temp.html
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
3 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
4 |
+
<title>{title}</title>
|
5 |
+
</head>
|
6 |
+
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #222;">
|
7 |
+
<div class="moz-forward-container">
|
8 |
+
<br>
|
9 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color:#ffffff">
|
10 |
+
<tbody>
|
11 |
+
<tr style="border-collapse:collapse;">
|
12 |
+
<td align="center" style="border-collapse:collapse;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" width="570">
|
14 |
+
<tbody>
|
15 |
+
<tr>
|
16 |
+
<td height="20" style="line-height:0; font-size:0;"><img width="0" height="0" alt="{shop_name}" src="{shop_logo}"></td>
|
17 |
+
</tr>
|
18 |
+
</tbody>
|
19 |
+
</table>
|
20 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
21 |
+
<tbody>
|
22 |
+
<tr>
|
23 |
+
<td style="line-height:0; font-size:0;" height="20">
|
24 |
+
<div style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
25 |
+
Please confirm your subscription</div>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</tbody>
|
29 |
+
</table>
|
30 |
+
<table cellspacing="0" cellpadding="0" border="0" width="540">
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td align="left">
|
34 |
+
|
35 |
+
<div style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
36 |
+
<br>
|
37 |
+
Do you want to receive newsletters from {site_name} ?<br>
|
38 |
+
<br>
|
39 |
+
<a href="{double_optin}" style="color:#ffffff;display:inline-block;font-family:Arial,sans-serif;width:auto;white-space:nowrap;min-height:32px;margin:5px 5px 0 0;padding:0 22px;text-decoration:none;text-align:center;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:0;border-radius:4px;vertical-align:top;background-color:#3276b1" target="_blank">
|
40 |
+
<span style="display:inline;font-family:Arial,sans-serif;text-decoration:none;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:none;background-color:#3276b1;color:#ffffff">Yes, subscribe me to this list.</span></a>
|
41 |
+
<br>
|
42 |
+
<br>
|
43 |
+
If you received this email by mistake, simply delete it. You will not be subscribed to this list if you don't click the confirmation link above.
|
44 |
+
<br><br>
|
45 |
+
{site_name}</div>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
</tbody>
|
53 |
+
</table>
|
54 |
+
<br>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
|
58 |
+
</body></html>
|
app/locale/en_US/template/email/sendin_notification.html
CHANGED
@@ -123,12 +123,12 @@
|
|
123 |
style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0;
|
125 |
line-height:16px; color:#7e7e7e;">
|
126 |
-
|
127 |
<div
|
128 |
style="font-family:arial,sans-serif;
|
129 |
font-size:12px; margin:0;
|
130 |
line-height:16px; color:#7e7e7e;">
|
131 |
-
|
132 |
<div
|
133 |
style="font-family:arial,sans-serif;
|
134 |
font-size:12px; margin:0;
|
@@ -148,7 +148,7 @@
|
|
148 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
149 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
150 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
151 |
-
©
|
152 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
153 |
This is an automatic message generated by SendinBlue.</div>
|
154 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
123 |
style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0;
|
125 |
line-height:16px; color:#7e7e7e;">
|
126 |
+
59 rue Beaubourg</div>
|
127 |
<div
|
128 |
style="font-family:arial,sans-serif;
|
129 |
font-size:12px; margin:0;
|
130 |
line-height:16px; color:#7e7e7e;">
|
131 |
+
75003 Paris - France</div>
|
132 |
<div
|
133 |
style="font-family:arial,sans-serif;
|
134 |
font-size:12px; margin:0;
|
148 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
149 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
150 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
151 |
+
© 2014-2015 SendinBlue, all rights reserved.</div>
|
152 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
153 |
This is an automatic message generated by SendinBlue.</div>
|
154 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
app/locale/en_US/template/email/sendinsmtp_conf.html
CHANGED
@@ -119,10 +119,10 @@
|
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
-
color:#7e7e7e;">
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
-
color:#7e7e7e;">
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -136,7 +136,7 @@
|
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
139 |
-
©
|
140 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
141 |
This is an automatic message generated by SendinBlue.</div>
|
142 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
139 |
+
© 2014-2015 SendinBlue, all rights reserved.</div>
|
140 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
141 |
This is an automatic message generated by SendinBlue.</div>
|
142 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
app/locale/fr_FR/Sendinblue.csv
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
"Send a campaign SMS", "Envoyer une campagne SMS"
|
72 |
"SMS settings", "Paramètres du SMS"
|
73 |
"Sender", "Expéditeur"
|
74 |
-
"This field allows you to
|
75 |
"Number of characters left: ", "Nombre de caractères restants: "
|
76 |
"Attention line break is counted as a single character.", "Attention, un saut de ligne est compté comme un seul caractère. "
|
77 |
" Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.", "Créer le contenu de vos SMS avec une limite de 160 caractères. Au-delà de 160 caractères, il sera compté comme un second SMS. Ainsi, si vous écrivez un SMS de 240 caractères, il sera compté comme deux SMS."
|
@@ -127,4 +127,27 @@
|
|
127 |
"The phone number should be in this form: 0033663309741 for this France mobile 06 63 30 97 41 (0033 is France prefix)", "Le numéro de téléphone mobile devrait être sous cette forme: 0033663309741 pour le numéro français 06 63 30 97 41 (0033 est l'indicatif de la France)"
|
128 |
"Select option", "Sélectionnez"
|
129 |
"Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.", "Synchronisez les contacts de votre site Magento avec SendinBlue & envoyez facilement tous vos emails & SMS marketing et transactionnels."
|
130 |
-
"With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.", "Avec le module SendinBlue, retrouvez tout ce dont vous avez besoin pour envoyer simplement et efficacement vos campagnes emailing & SMS à vos prospects et clients :"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
"Send a campaign SMS", "Envoyer une campagne SMS"
|
72 |
"SMS settings", "Paramètres du SMS"
|
73 |
"Sender", "Expéditeur"
|
74 |
+
"This field allows you to customize the SMS sender. The number of characters is limited to 11 alphanumeric characters. You can´t configure your Sender with a phone number.", "Ce champs permet de personnaliser l'expéditeur du SMS. Il ne doit pas contenir plus de 11 caractères. Les caractères spéciaux (é, à ...) ne sont pas acceptés."
|
75 |
"Number of characters left: ", "Nombre de caractères restants: "
|
76 |
"Attention line break is counted as a single character.", "Attention, un saut de ligne est compté comme un seul caractère. "
|
77 |
" Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.", "Créer le contenu de vos SMS avec une limite de 160 caractères. Au-delà de 160 caractères, il sera compté comme un second SMS. Ainsi, si vous écrivez un SMS de 240 caractères, il sera compté comme deux SMS."
|
127 |
"The phone number should be in this form: 0033663309741 for this France mobile 06 63 30 97 41 (0033 is France prefix)", "Le numéro de téléphone mobile devrait être sous cette forme: 0033663309741 pour le numéro français 06 63 30 97 41 (0033 est l'indicatif de la France)"
|
128 |
"Select option", "Sélectionnez"
|
129 |
"Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.", "Synchronisez les contacts de votre site Magento avec SendinBlue & envoyez facilement tous vos emails & SMS marketing et transactionnels."
|
130 |
+
"With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.", "Avec le module SendinBlue, retrouvez tout ce dont vous avez besoin pour envoyer simplement et efficacement vos campagnes emailing & SMS à vos prospects et clients :"
|
131 |
+
"Order history has been import successfully", "Historique des commandes a été importé avec succès."
|
132 |
+
"Import the data of previous orders", "Importer les données des anciennes commandes"
|
133 |
+
"Not synchronized", "non synchronized"
|
134 |
+
"Click on the icon to subscribe / unsubscribe the sms from SendinBlue and Magento.", "Cliquez sur l'icône pour inscrire / désinscrire un sms de SendinBlue et Magento."
|
135 |
+
"SMS SendinBlue Status", "Statut SMS sur Sendinblue"
|
136 |
+
"Select template", "Sélectionnez un template"
|
137 |
+
"Manage email template", "Gestion des templates email"
|
138 |
+
"Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter", "Sélectionnez un template SendinBlue qui sera envoyé pour chaque contact qui s'abonne à votre newsletter"
|
139 |
+
"Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again", "Les anciens abonnés n'ont pas été importé. Merci de bien cliquez à nouveau sur le bouton"
|
140 |
+
"Import Old Subscribers", "Importer les anciens abonnés"
|
141 |
+
"No confirmation", "Aucune confirmation"
|
142 |
+
"With this option, contacts are directly added to your list when they enter their email address. No confirmation email is sent.","Avec cette option, votre contact s'inscrit directement à votre liste en laissant son adresse email. Aucun email de confirmation lui est envoyé."
|
143 |
+
"Simple confirmation", "Confirmation simple"
|
144 |
+
"This confirmation email is one of your SMTP templates. By default, we have created a Default Template - Single Confirmation. You can create and activate your SMTP templates by clicking here", "Cet email de confirmation fait partie de vos templates SMTP. Par défaut, nous en avons créé un 'Default Template - Simple Confirmation'."
|
145 |
+
"Double opt-in confirmation", "Double opt-in confirmation"
|
146 |
+
"If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the "FORM" folder, on the "Temp - DOUBLE OPT-IN" list. After confirmation, the contact will be saved in the "Corresponding List" selected below.", "Si vous choisissez la confirmation Double Opt-in, l'abonné recevra un email l'invitant à confirmer son inscription. Avant la confirmation, le contact est sauvegardé dans le dossier 'FORM', liste 'Temp - DOUBLE OPTIN', après confirmation, le contact est sauvegardé dans la 'Liste correspondante' choisie ci-dessous."
|
147 |
+
"Once the form has been completed, your contact will receive an email with a link to confirm their subscription.", "Lorsque le formulaire est rempli, votre contact recevra un email avec un lien de confirmation d'inscription."
|
148 |
+
"Redirect URL after clicking in the validation email", "URL de redirection après clic dans l'email de validation"
|
149 |
+
"Redirect your contacts to a landing page or to your website once they have clicked on the confirmation link in the email.", "Redirigez votre contact vers une landing page ou votre site après qu'il ait validé le lien de confirmation dans l'email."
|
150 |
+
"Send a final confirmation email", "Envoyer un email de confirmation final"
|
151 |
+
"Once a contact has clicked in the double opt-in confirmation email, send them a final confirmation email", "Lorsqu'un contact a cliqué dans le lien de l'email de confirmation double opt-in, lui envoyer un email final de confirmation"
|
152 |
+
"If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the 'FORM' folder, on the 'Temp - DOUBLE OPT-IN' list. After confirmation, the contact will be saved in the 'Corresponding List' selected below.", "Si vous choisissez la confirmation Double Opt-in, l'abonné recevra un email l'invitant à confirmer son inscription. Avant la confirmation, le contact est sauvegardé dans le dossier 'FORM', liste 'Temp - DOUBLE OPTIN', après confirmation, le contact est sauvegardé dans la 'Liste correspondante' choisie ci-dessous."
|
153 |
+
"By selecting this option, contacts are directly added to your list when they enter their email address on the form. A confirmation email will automatically be sent following their subscription.", "En choisissant cette option, votre contact s'inscrira directement à la liste en laissant son adresse email dans le formulaire. Un email de confirmation de son inscription lui sera automatiquement envoyé à la suite de son inscription."
|
app/locale/fr_FR/template/email/doubleoptin_temp.html
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
3 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
4 |
+
<title>{title}</title>
|
5 |
+
</head>
|
6 |
+
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #222;">
|
7 |
+
<div class="moz-forward-container">
|
8 |
+
<br>
|
9 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color:#ffffff">
|
10 |
+
<tbody>
|
11 |
+
<tr style="border-collapse:collapse;">
|
12 |
+
<td align="center" style="border-collapse:collapse;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" width="570">
|
14 |
+
<tbody>
|
15 |
+
<tr>
|
16 |
+
<td height="20" style="line-height:0; font-size:0;"><img width="0" height="0" alt="{shop_name}" src="{shop_logo}"></td>
|
17 |
+
</tr>
|
18 |
+
</tbody>
|
19 |
+
</table>
|
20 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
21 |
+
<tbody>
|
22 |
+
<tr>
|
23 |
+
<td style="line-height:0; font-size:0;" height="20">
|
24 |
+
<div style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
25 |
+
Confirmez votre inscription</div>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</tbody>
|
29 |
+
</table>
|
30 |
+
<table cellspacing="0" cellpadding="0" border="0" width="540">
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td align="left">
|
34 |
+
|
35 |
+
<div style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
36 |
+
<br>
|
37 |
+
Voulez vous recevoir les newsletters de {site_name} ?<br>
|
38 |
+
<br>
|
39 |
+
<a href="{double_optin}" style="color:#ffffff;display:inline-block;font-family:Arial,sans-serif;width:auto;white-space:nowrap;min-height:32px;margin:5px 5px 0 0;padding:0 22px;text-decoration:none;text-align:center;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:0;border-radius:4px;vertical-align:top;background-color:#3276b1" target="_blank">
|
40 |
+
<span style="display:inline;font-family:Arial,sans-serif;text-decoration:none;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:none;background-color:#3276b1;color:#ffffff">Oui, je confirme mon inscription</span></a>
|
41 |
+
<br>
|
42 |
+
<br>
|
43 |
+
Si vous recevez cet email par erreur, vous pouvez simplement le supprimer. Vous ne serez pas inscrit à la newsletter si vous ne cliquez pas sur le lien de confirmation ci-dessus.
|
44 |
+
<br><br>
|
45 |
+
{site_name}</div>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
</tbody>
|
53 |
+
</table>
|
54 |
+
<br>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
|
58 |
+
</body></html>
|
app/locale/fr_FR/template/email/sendin_notification.html
CHANGED
@@ -117,10 +117,10 @@
|
|
117 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
118 |
<div style="font-family:arial,sans-serif;
|
119 |
font-size:12px; margin:0; line-height:16px;
|
120 |
-
color:#7e7e7e;">
|
121 |
<div style="font-family:arial,sans-serif;
|
122 |
font-size:12px; margin:0; line-height:16px;
|
123 |
-
color:#7e7e7e;">
|
124 |
<div style="font-family:arial,sans-serif;
|
125 |
font-size:12px; margin:0; line-height:16px;
|
126 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -133,7 +133,7 @@
|
|
133 |
<td align="right" valign="top">
|
134 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
135 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
136 |
-
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> ©
|
137 |
réservés.
|
138 |
</div>
|
139 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
117 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
118 |
<div style="font-family:arial,sans-serif;
|
119 |
font-size:12px; margin:0; line-height:16px;
|
120 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
121 |
<div style="font-family:arial,sans-serif;
|
122 |
font-size:12px; margin:0; line-height:16px;
|
123 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
124 |
<div style="font-family:arial,sans-serif;
|
125 |
font-size:12px; margin:0; line-height:16px;
|
126 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
133 |
<td align="right" valign="top">
|
134 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
135 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
136 |
+
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> © 2014-2015 SendinBlue, tous droits
|
137 |
réservés.
|
138 |
</div>
|
139 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
app/locale/fr_FR/template/email/sendinsmtp_conf.html
CHANGED
@@ -119,10 +119,10 @@
|
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
-
color:#7e7e7e;">
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
-
color:#7e7e7e;">
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -135,7 +135,7 @@
|
|
135 |
<td align="right" valign="top">
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
-
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> ©
|
139 |
réservés.
|
140 |
</div>
|
141 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
135 |
<td align="right" valign="top">
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
+
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> © 2014-2015 SendinBlue, tous droits
|
139 |
réservés.
|
140 |
</div>
|
141 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
package.xml
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.</summary>
|
10 |
-
<description>With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email and SMS campaigns to your prospects and customers
|
11 |
-
Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)
|
12 |
-
Easily create good looking emailings
|
13 |
-
Schedule your campaigns
|
14 |
-
Track your results and optimize
|
15 |
-
Monitor your transactional emails (purchase confirmation, password reset, etc) with a better deliverability and real-time analytics
|
16 |
-
Why should you use SendinBlue
|
17 |
-
Optimized deliverability
|
18 |
-
Unbeatable pricing
|
19 |
Technical support, by phone or by email</description>
|
20 |
<notes>Synchronize your Magento contacts with SendinBlue platform, send your marketing and transactional emails and SMS</notes>
|
21 |
-
<authors><author><name>
|
22 |
-
<date>2014-
|
23 |
-
<time>10:
|
24 |
-
<contents><target name="
|
25 |
-
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
+
<version>1.2.6</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.</summary>
|
10 |
+
<description>With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email and SMS campaigns to your prospects and customers.
|
11 |
+
Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)
|
12 |
+
Easily create good looking emailings
|
13 |
+
Schedule your campaigns
|
14 |
+
Track your results and optimize
|
15 |
+
Monitor your transactional emails (purchase confirmation, password reset, etc) with a better deliverability and real-time analytics
|
16 |
+
Why should you use SendinBlue
|
17 |
+
Optimized deliverability
|
18 |
+
Unbeatable pricing–best value in the industry
|
19 |
Technical support, by phone or by email</description>
|
20 |
<notes>Synchronize your Magento contacts with SendinBlue platform, send your marketing and transactional emails and SMS</notes>
|
21 |
+
<authors><author><name>Sendinblue</name><user>Sendinblue_Team</user><email>contact@sendinblue.com</email></author></authors>
|
22 |
+
<date>2014-03-04</date>
|
23 |
+
<time>10:55:22</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Sendinblue"><dir name="Sendinblue"><dir name="Block"><file name="Sendinblue.php" hash="4b5adae031b714e188d576e306bfd5a1"/></dir><dir name="Helper"><file name="Data.php" hash="0532b48f611c1cc623589d5792e0dbf2"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="6d2d6eac00b7bd6da3ff53d2abe40dd4"/></dir><file name="Email.php" hash="fe07aa2dba951ee117bda2cefebfb875"/><dir name="Mysql4"><dir name="Sendinblue"><file name="Collection.php" hash="d6aff03eda9a6b2ee1c42b8dd50df402"/></dir><file name="Sendinblue.php" hash="c000c1f6a277f7c9a91ad628b02eb001"/></dir><file name="Observer.php" hash="250cc069aa5194652f6503e2cc0f8194"/><file name="Psmailin.php" hash="735ede0b7d71a71e2ce82690937bf678"/><file name="Sendinblue.php" hash="963c473c2f3ca66f23d00de0c4c9292f"/><file name="Status.php" hash="444fe4d099bd23a9d87cdf7e2b2e6cbb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MyformController.php" hash="67dd963b1f003d2b2f25c8b4643d4715"/><file name="NotifyController.php" hash="e3b43db59f8c5b7c8cd54a58a7bc2d1b"/><file name="SyncController.php" hash="352fd0d804701d0228bad7e7b92afb58"/></dir><file name="AjaxController.php" hash="b4914ddac9d4e836ecf53869055a6a82"/><file name="IndexController.php" hash="2cf5287ba31d6960eb28c2cbc03a60ed"/></dir><dir name="etc"><file name="adminhtml.xml" hash="640ba5382a16c749fc56a2a8283682ee"/><file name="config.xml" hash="ba48680b7267a4b2d27f4645792b2393"/></dir><dir name="sql"><dir name="sendinblue_setup"><file name="mysql4-install-0.1.0.php" hash="58bb365dcb29115c66f2fa3f17dcb697"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="b50e876441a247cd5feb2614ff649fd3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="e23253764fbbf0e3a2f1cb5ff65eb318"/></dir><dir name="template"><dir name="sendinblue"><file name="myform.phtml" hash="2a4748e2e456d2b95d9828bf2da90bd8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="61346d8b2b321b10c09a77fef39ec112"/></dir><dir name="template"><dir name="sendinblue"><dir name="account"><file name="edit.phtml" hash="c2b17e90e59e1d13791feded28982330"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendinblue_Sendinblue.xml" hash="1a245999d412c36ea9666b56bfc63e2d"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sendinblue.csv" hash="72507895f18a8c4a80611065790aba56"/></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="fr_FR"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="557ddb7212800b4a99937b2d8956270c"/><file name="sendinsmtp_conf.html" hash="b1c790c78605b2beb4cd38152cd8f0ca"/><file name="doubleoptin_temp.html" hash="ec6aa9880db3cc1227ad87bf0e92f233"/>
|
25 |
+
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/><file name="doubleoptin_temp.html" hash="1653f3195b1ef9e1e971c08df3b5ac04"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|
skin/adminhtml/default/default/sendinblue/css/styles.css
CHANGED
@@ -6,6 +6,10 @@
|
|
6 |
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
7 |
* needs then we can't provide a technical support.
|
8 |
*/
|
|
|
|
|
|
|
|
|
9 |
|
10 |
.pagination{width:620px; height:25px; margin:0 auto;}
|
11 |
.pagination ul li{list-style:none; float:left; border:1px solid #000; padding:2px 6px 2px 6px; margin:0 3px 0 3px; font-family:arial; font-size:12px; color:#000; font-weight:bold; background-color:#f2f2f2;}
|
@@ -20,7 +24,7 @@
|
|
20 |
.sendin_row {clear:both; margin-top:40px; width:100%;}
|
21 |
.contact-details {border:1px dashed #666666; float:right; height:205px; margin-left:12px; margin-right:12px; margin-top:10px; padding:8px; width:350px; position: absolute; right: 0;}
|
22 |
fieldset.fields {background-color:#EBEDF4; border:1px solid; margin-bottom:10px; padding:20px 0 10px 10px; position:relative;}
|
23 |
-
fieldset legend {background-color:#EBEDF4; border:1px solid #DFD5C3; display:inline; visibility:visible; float:left; font:bold 13px/13px Arial; margin:0; padding:4px 10px; position:absolute; top:-15px; width:inherit !important; height:auto;}
|
24 |
ul.listt {text-align:justify; margin:8px 0px 8px 0px;list-style:none; padding:0px; width:800px;}
|
25 |
ul.listt li:before{ content:"-"; position:relative; left:-2px;}
|
26 |
ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
@@ -35,9 +39,6 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
35 |
width: 491px;
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
.btn {
|
42 |
display: inline-block;
|
43 |
*display: inline;
|
@@ -159,10 +160,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
159 |
.tab_content {
|
160 |
display: none;
|
161 |
}
|
162 |
-
|
163 |
-
width:820px;
|
164 |
-
margin:0px auto;
|
165 |
-
}*/
|
166 |
.wrapper .row1 {
|
167 |
padding:/*10px 12px*/0px;
|
168 |
border:none;
|
@@ -172,9 +170,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
172 |
margin-top:23px;
|
173 |
clear:both;
|
174 |
}
|
175 |
-
|
176 |
-
margin-bottom:12px;
|
177 |
-
}
|
178 |
.r_label {
|
179 |
float:left;
|
180 |
width: auto;
|
@@ -240,28 +236,6 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
240 |
/* padding: 0 4px 0 6px;*/
|
241 |
}
|
242 |
|
243 |
-
/*Form*/
|
244 |
-
/*.table tr td {
|
245 |
-
color: #996633;
|
246 |
-
font-size:12px;
|
247 |
-
}
|
248 |
-
.sendin_row .form-list label{ width:670px; float:left; padding-right:20px; padding-top:0px; text-align:right;}
|
249 |
-
.sendin_row .form-list2 label{ width:385px; padding-right:20px; padding-top:0px;}
|
250 |
-
.sendin_row .form-list3 label{ width:295px; padding-right:20px; padding-top:0px;text-align:left!important;}
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
.label-small{ width:30px!important; text-align:left!important;}
|
255 |
-
.no-padding td{ padding:0px!important;}
|
256 |
-
.clear{ clear:both;}
|
257 |
-
.module_error.error{ padding-top: 8px!important;}
|
258 |
-
.module_error.error p{ display:inline-block;}
|
259 |
-
#content .alert{ width:auto!important;}
|
260 |
-
.tablepadding td{padding:5px 0px;}
|
261 |
-
.btnmrgn-right{
|
262 |
-
margin-top:12px;
|
263 |
-
margin-right:26px;
|
264 |
-
float:right;}*/
|
265 |
.radio_nospaceing{
|
266 |
margin:0px 10px 0px 0px;}
|
267 |
.radio_spaceing {
|
@@ -280,11 +254,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
280 |
|
281 |
.mrgin-left{ margin-left:466px;}
|
282 |
/*Design matched style*/
|
283 |
-
|
284 |
-
p {
|
285 |
-
color: #585A69;
|
286 |
-
margin: 0.5em 0;
|
287 |
-
}
|
288 |
|
289 |
.fix_width{width:450px}
|
290 |
.fix_width2{width:350px}
|
@@ -324,9 +294,19 @@ color:#585A69;
|
|
324 |
}
|
325 |
|
326 |
input.input-text, textarea, select { border:1px solid #c8c8c8;}
|
327 |
-
input.input-text{padding:3px 5px;}
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
7 |
* needs then we can't provide a technical support.
|
8 |
*/
|
9 |
+
a {
|
10 |
+
color: #000;
|
11 |
+
text-decoration: underline;
|
12 |
+
}
|
13 |
|
14 |
.pagination{width:620px; height:25px; margin:0 auto;}
|
15 |
.pagination ul li{list-style:none; float:left; border:1px solid #000; padding:2px 6px 2px 6px; margin:0 3px 0 3px; font-family:arial; font-size:12px; color:#000; font-weight:bold; background-color:#f2f2f2;}
|
24 |
.sendin_row {clear:both; margin-top:40px; width:100%;}
|
25 |
.contact-details {border:1px dashed #666666; float:right; height:205px; margin-left:12px; margin-right:12px; margin-top:10px; padding:8px; width:350px; position: absolute; right: 0;}
|
26 |
fieldset.fields {background-color:#EBEDF4; border:1px solid; margin-bottom:10px; padding:20px 0 10px 10px; position:relative;}
|
27 |
+
fieldset legend.lgend {background-color:#EBEDF4; border:1px solid #DFD5C3; display:inline; visibility:visible; float:left; font:bold 13px/13px Arial; margin:0; padding:4px 10px; position:absolute; top:-15px; width:inherit !important; height:auto;}
|
28 |
ul.listt {text-align:justify; margin:8px 0px 8px 0px;list-style:none; padding:0px; width:800px;}
|
29 |
ul.listt li:before{ content:"-"; position:relative; left:-2px;}
|
30 |
ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
39 |
width: 491px;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
42 |
.btn {
|
43 |
display: inline-block;
|
44 |
*display: inline;
|
160 |
.tab_content {
|
161 |
display: none;
|
162 |
}
|
163 |
+
|
|
|
|
|
|
|
164 |
.wrapper .row1 {
|
165 |
padding:/*10px 12px*/0px;
|
166 |
border:none;
|
170 |
margin-top:23px;
|
171 |
clear:both;
|
172 |
}
|
173 |
+
|
|
|
|
|
174 |
.r_label {
|
175 |
float:left;
|
176 |
width: auto;
|
236 |
/* padding: 0 4px 0 6px;*/
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
.radio_nospaceing{
|
240 |
margin:0px 10px 0px 0px;}
|
241 |
.radio_spaceing {
|
254 |
|
255 |
.mrgin-left{ margin-left:466px;}
|
256 |
/*Design matched style*/
|
257 |
+
|
|
|
|
|
|
|
|
|
258 |
|
259 |
.fix_width{width:450px}
|
260 |
.fix_width2{width:350px}
|
294 |
}
|
295 |
|
296 |
input.input-text, textarea, select { border:1px solid #c8c8c8;}
|
297 |
+
/*input.input-text{padding:3px 5px;}*/
|
298 |
+
|
299 |
+
.grid table td a{color: #000000;
|
300 |
+
text-decoration: none;}
|
301 |
+
.inner_manage_box {
|
302 |
+
display: none;
|
303 |
+
}
|
304 |
+
.radio_group_option label{width:auto;}
|
305 |
+
.radio_group_option input[type=radio]{float: left;margin-right: 5px;}
|
306 |
+
.radio_group_option .manage_subscribe_block{margin-bottom: 8px;}
|
307 |
+
.inner_manage_box{margin: 3px 0 0 20px;}
|
308 |
+
.manage_subscribe_block label{padding-right:5px;}
|
309 |
+
.clearfix{clear:both;width:100%;}
|
310 |
+
.tableblock tr td{padding:5px; border-bottom:0px;}
|
311 |
+
|
312 |
+
.manage_subscribe_block label{text-align:left; width: auto;}
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.js
CHANGED
@@ -11,33 +11,60 @@ jQuery.noConflict();
|
|
11 |
jQuery(document)
|
12 |
.ready(
|
13 |
function() {
|
14 |
-
|
15 |
-
|
16 |
var apistatuskey = jQuery('#apistatuskey').val();
|
17 |
-
|
18 |
jQuery("#select").multiselect();
|
19 |
-
|
20 |
jQuery(".sendin_api_status").click(function()
|
21 |
-
{
|
22 |
if (apistatuskey == 1 && jQuery(this).val() == 1)
|
23 |
-
{
|
24 |
-
|
25 |
jQuery("#sendin_apikey").show();
|
26 |
jQuery(".alldiv").show();
|
27 |
jQuery(".hidetableblock").show();
|
28 |
-
|
29 |
-
}
|
30 |
else{
|
31 |
if(jQuery(this).val() == 1)
|
32 |
{
|
33 |
-
|
34 |
}else{
|
35 |
jQuery("#sendin_apikey").hide();
|
36 |
jQuery(".alldiv").hide();
|
37 |
}
|
38 |
-
}
|
39 |
-
|
40 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function loadData(page) {
|
42 |
var ajaxcontentUrl = jQuery("#ajaxcontentUrl").val();
|
43 |
jQuery.ajax({
|
@@ -59,26 +86,19 @@ jQuery(document)
|
|
59 |
});
|
60 |
}
|
61 |
});
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
}
|
66 |
|
67 |
jQuery('.hdtab').click(function(){
|
68 |
-
if(parseInt(jQuery(this).val())) { jQuery('#hidetabselect').css('display','block');}
|
69 |
-
|
70 |
});
|
71 |
-
|
72 |
|
73 |
jQuery('body').on('click',' .pagination li.active',function() {
|
74 |
var page = jQuery(this).attr('p');
|
75 |
jQuery('#pagenumber').val(page);
|
76 |
loadData(page);
|
77 |
-
|
78 |
});
|
79 |
|
80 |
-
|
81 |
-
jQuery('.toolTip').hover(function () {
|
82 |
var title = jQuery(this).attr('title');
|
83 |
var offset = jQuery(this).offset();
|
84 |
|
@@ -95,24 +115,23 @@ jQuery(document)
|
|
95 |
jQuery('#sender_order').mouseover(function () {
|
96 |
var val = jQuery(this).val();
|
97 |
if(isInteger(val) || val == ''){
|
98 |
-
jQuery("#sender_order").attr('maxlength','
|
99 |
-
jQuery('#sender_order_text').text((
|
100 |
|
101 |
}
|
102 |
else{
|
103 |
jQuery("#sender_order").attr('maxlength','11');
|
104 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
105 |
jQuery("#sender_order").val(str7);
|
106 |
-
jQuery('#sender_order_text').text((11 - val.length));
|
107 |
-
|
108 |
-
}
|
109 |
});
|
110 |
|
111 |
jQuery('#sender_order').keyup(function () {
|
112 |
var val = jQuery(this).val();
|
113 |
if(isInteger(val) || val == ''){
|
114 |
-
jQuery("#sender_order").attr('maxlength','
|
115 |
-
jQuery('#sender_order_text').text((
|
116 |
|
117 |
}
|
118 |
else{
|
@@ -124,129 +143,119 @@ jQuery(document)
|
|
124 |
}
|
125 |
});
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
|
129 |
if(jQuery('#sender_order').val() != '')
|
130 |
{
|
131 |
var val = jQuery('#sender_order').val();
|
132 |
if(isInteger(val)){
|
133 |
-
jQuery("#sender_order").attr('maxlength','
|
134 |
-
jQuery('#sender_order_text').text((
|
135 |
|
136 |
}
|
137 |
else{
|
138 |
jQuery("#sender_order").attr('maxlength','11');
|
139 |
-
jQuery('#sender_order_text').text((11 - val.length));
|
140 |
-
|
141 |
}
|
142 |
}
|
143 |
-
|
144 |
jQuery('#sender_order_message').keyup(function () {
|
145 |
-
|
146 |
-
var chars = this.value.length,
|
147 |
messages = Math.ceil(chars / 160),
|
148 |
-
remaining = messages * 160 -
|
149 |
-
if(remaining == 0)
|
150 |
-
{
|
151 |
-
remaining = 160.
|
152 |
-
}
|
153 |
|
154 |
jQuery('#sender_order_message_text').text(remaining);
|
155 |
|
156 |
jQuery('#sender_order_message_text_count').text(messages);
|
157 |
-
|
158 |
});
|
159 |
|
160 |
if(jQuery('#sender_order_message').val() != '')
|
161 |
{
|
162 |
var chars = jQuery('#sender_order_message').val().length,
|
163 |
messages = Math.ceil(chars / 160),
|
164 |
-
remaining = messages * 160 -
|
165 |
|
166 |
jQuery('#sender_order_message_text').text(remaining);
|
167 |
|
168 |
jQuery('#sender_order_message_text_count').text(messages);
|
169 |
}
|
170 |
-
|
171 |
jQuery('#sender_shipment').mouseover(function () {
|
172 |
var val = jQuery(this).val();
|
173 |
|
174 |
if(isInteger(val) || val == ''){
|
175 |
-
jQuery("#sender_shipment").attr('maxlength','
|
176 |
-
jQuery('#sender_shipment_text').text((
|
177 |
-
|
178 |
}
|
179 |
else{
|
180 |
jQuery("#sender_shipment").attr('maxlength','11');
|
181 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
182 |
jQuery("#sender_shipment").val(str7);
|
183 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
184 |
-
|
185 |
}
|
186 |
});
|
187 |
jQuery('#sender_shipment').keyup(function () {
|
188 |
-
var val = jQuery(this).val();
|
189 |
-
|
190 |
if(isInteger(val) || val == ''){
|
191 |
-
jQuery("#sender_shipment").attr('maxlength','
|
192 |
-
jQuery('#sender_shipment_text').text((
|
193 |
-
|
194 |
}
|
195 |
else{
|
196 |
jQuery("#sender_shipment").attr('maxlength','11');
|
197 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
198 |
jQuery("#sender_shipment").val(str7);
|
199 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
200 |
-
|
201 |
}
|
202 |
});
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
204 |
if(jQuery('#sender_shipment').val() != '')
|
205 |
{
|
206 |
var val = jQuery('#sender_shipment').val();
|
207 |
if(isInteger(val)){
|
208 |
-
jQuery("#sender_shipment").attr('maxlength','
|
209 |
-
jQuery('#sender_shipment_text').text((
|
210 |
-
|
211 |
}
|
212 |
else{
|
213 |
jQuery("#sender_shipment").attr('maxlength','11');
|
214 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
215 |
-
|
216 |
}
|
217 |
}
|
218 |
-
|
219 |
jQuery('#sender_shipment_message').keyup(function () {
|
220 |
|
221 |
var chars = this.value.length,
|
222 |
messages = Math.ceil(chars / 160),
|
223 |
-
remaining = messages * 160 -
|
224 |
-
if(remaining == 0)
|
225 |
-
{
|
226 |
-
remaining = 160.
|
227 |
-
}
|
228 |
-
jQuery('#sender_shipment_message_text').text(remaining);
|
229 |
|
230 |
-
|
231 |
-
|
232 |
});
|
233 |
-
|
234 |
if(jQuery('#sender_shipment_message').val() != '')
|
235 |
{
|
236 |
var chars = jQuery('#sender_shipment_message').val().length,
|
237 |
messages = Math.ceil(chars / 160),
|
238 |
-
remaining = messages * 160 -
|
239 |
|
240 |
jQuery('#sender_shipment_message_text').text(remaining);
|
241 |
-
|
242 |
jQuery('#sender_shipment_message_text_count').text(messages);
|
243 |
}
|
244 |
-
|
245 |
jQuery('#sender_campaign').mouseover(function () {
|
246 |
var val = jQuery(this).val();
|
247 |
if(isInteger(val) || val == ''){
|
248 |
-
jQuery("#sender_campaign").attr('maxlength','
|
249 |
-
jQuery('#sender_campaign_text').text((
|
250 |
|
251 |
}
|
252 |
else{
|
@@ -261,26 +270,28 @@ jQuery(document)
|
|
261 |
var val = jQuery(this).val();
|
262 |
|
263 |
if(isInteger(val) || val == ''){
|
264 |
-
jQuery("#sender_campaign").attr('maxlength','
|
265 |
-
jQuery('#sender_campaign_text').text((
|
266 |
-
|
267 |
}
|
268 |
else{
|
269 |
jQuery("#sender_campaign").attr('maxlength','11');
|
270 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
271 |
jQuery("#sender_campaign").val(str7);
|
272 |
-
jQuery('#sender_campaign_text').text((11 - val.length));
|
273 |
-
|
274 |
}
|
275 |
});
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
277 |
if(jQuery('#sender_campaign').val() != '')
|
278 |
{
|
279 |
-
var val = jQuery('#sender_campaign').val();
|
280 |
-
|
281 |
if(isInteger(val)){
|
282 |
-
jQuery("#sender_campaign").attr('maxlength','
|
283 |
-
jQuery('#sender_campaign_text').text((
|
284 |
}
|
285 |
else{
|
286 |
jQuery("#sender_campaign").attr('maxlength','11');
|
@@ -293,15 +304,11 @@ jQuery(document)
|
|
293 |
var chars = this.value.length,
|
294 |
messages = Math.ceil(chars / 160),
|
295 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
296 |
-
|
297 |
-
{
|
298 |
-
remaining = 160.
|
299 |
-
}
|
300 |
jQuery('#sender_campaign_message_text').text(remaining);
|
301 |
-
jQuery('#sender_campaign_message_text_count').text(messages);
|
302 |
-
|
303 |
});
|
304 |
-
|
305 |
if(jQuery('#sender_campaign_message').val() != '')
|
306 |
{
|
307 |
var chars = jQuery('#sender_campaign_message').val().length,
|
@@ -309,10 +316,9 @@ jQuery(document)
|
|
309 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
310 |
|
311 |
jQuery('#sender_campaign_message_text').text(remaining);
|
312 |
-
|
313 |
jQuery('#sender_campaign_message_text_count').text(messages);
|
314 |
}
|
315 |
-
|
316 |
jQuery(".sms_order_setting").click(function () {
|
317 |
var orderSetting = jQuery(this).val();
|
318 |
var orderUrl = jQuery("#order").val();
|
@@ -333,13 +339,13 @@ jQuery(document)
|
|
333 |
jQuery(".hideOrder").hide();
|
334 |
}
|
335 |
}
|
336 |
-
});
|
337 |
-
|
338 |
});
|
|
|
339 |
jQuery(".sms_shiping_setting").click(function () {
|
340 |
var shipingSetting = jQuery(this).val();
|
341 |
var shipingUrl = jQuery("#shiping").val();
|
342 |
-
|
343 |
jQuery.ajax({
|
344 |
type: "POST",
|
345 |
async: false,
|
@@ -357,7 +363,6 @@ jQuery(document)
|
|
357 |
}
|
358 |
}
|
359 |
});
|
360 |
-
|
361 |
});
|
362 |
|
363 |
jQuery(".sms_campaign_setting").click(function () {
|
@@ -380,10 +385,9 @@ jQuery(document)
|
|
380 |
jQuery(".hideCampaign").hide();
|
381 |
}
|
382 |
}
|
383 |
-
});
|
384 |
-
|
385 |
});
|
386 |
-
|
387 |
if (jQuery('input:radio[name=sms_order_setting]:checked').val() == 0)
|
388 |
{
|
389 |
jQuery('.hideOrder').hide();
|
@@ -392,7 +396,7 @@ jQuery(document)
|
|
392 |
}
|
393 |
|
394 |
jQuery(".Sendin_Sms_Choice").click(function ()
|
395 |
-
{
|
396 |
if (jQuery(this).val() == 1) {
|
397 |
jQuery(".multiplechoice").hide();
|
398 |
jQuery(".singlechoice").show();
|
@@ -401,6 +405,14 @@ jQuery(document)
|
|
401 |
jQuery(".singlechoice").hide();
|
402 |
}
|
403 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
if (jQuery('input:radio[name=Sendin_Sms_Choice]:checked').val() == 0)
|
406 |
{
|
@@ -418,15 +430,13 @@ jQuery(document)
|
|
418 |
} else {
|
419 |
jQuery(".hideShiping").hide();
|
420 |
}
|
421 |
-
});
|
422 |
-
|
423 |
-
|
424 |
if (jQuery('input:radio[name=sms_credit]:checked').val() == 0)
|
425 |
jQuery(".hideCredit").hide();
|
426 |
else
|
427 |
jQuery(".hideCredit").show();
|
428 |
-
|
429 |
-
|
430 |
jQuery(".sms_credit").click(function (){
|
431 |
|
432 |
var sms_credit = jQuery(this).val();
|
@@ -503,252 +513,296 @@ jQuery(document)
|
|
503 |
return true
|
504 |
}
|
505 |
return false;
|
506 |
-
}
|
507 |
-
|
508 |
-
|
509 |
-
jQuery('#showUserlist').click(function(){
|
510 |
-
|
511 |
-
if(jQuery('.userDetails').is(':hidden'))
|
512 |
-
{
|
513 |
-
loadData(1);
|
514 |
-
jQuery('#Spantextless').show();
|
515 |
-
jQuery('#Spantextmore').hide();
|
516 |
-
}else
|
517 |
-
{
|
518 |
-
jQuery('#Spantextmore').show();
|
519 |
-
jQuery('#Spantextless').hide();
|
520 |
-
}
|
521 |
-
jQuery('.userDetails').slideToggle();
|
522 |
-
});
|
523 |
-
|
524 |
-
var base_url = getBaseURL();
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
var trackingUrl = jQuery("#trackingUrl").val();
|
530 |
-
jQuery.ajax({
|
531 |
-
type : "POST",
|
532 |
-
async : false,
|
533 |
-
url : trackingUrl,
|
534 |
-
data : "script=" + Tracking,
|
535 |
-
beforeSend : function(){
|
536 |
-
jQuery('#ajax-busy').show();
|
537 |
-
},
|
538 |
-
success : function(msg){
|
539 |
-
jQuery('#ajax-busy').hide();
|
540 |
-
}
|
541 |
-
});
|
542 |
-
});
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
jQuery(".smtpStatus").click(function() {
|
548 |
-
|
549 |
-
var smtptest = jQuery(this).val();
|
550 |
-
var smtpUrl = jQuery("#smtpUrl").val();
|
551 |
-
if (smtptest == 0) {
|
552 |
-
jQuery('.smtptest').hide();
|
553 |
-
}
|
554 |
-
if (smtptest == 1) {
|
555 |
-
jQuery('.smtptest').show();
|
556 |
-
}
|
557 |
-
jQuery.ajax({
|
558 |
-
type : "POST",
|
559 |
-
async : false,
|
560 |
-
url : smtpUrl,
|
561 |
-
data : "smtptest=" + smtptest,
|
562 |
-
beforeSend : function() {
|
563 |
-
jQuery('#ajax-busy').show();
|
564 |
-
},
|
565 |
-
success : function(msg) {
|
566 |
-
jQuery('#ajax-busy').hide();
|
567 |
-
}
|
568 |
-
});
|
569 |
-
});
|
570 |
-
|
571 |
-
|
572 |
-
var skin_url = jQuery('#skin_url').val()
|
573 |
-
jQuery('<div id="ajax-busy"/> loading..')
|
574 |
-
.css(
|
575 |
-
{
|
576 |
-
opacity : 0.5,
|
577 |
-
position : 'fixed',
|
578 |
-
top : 0,
|
579 |
-
left : 0,
|
580 |
-
width : '100%',
|
581 |
-
height : jQuery(window).height() + 'px',
|
582 |
-
background : 'white url('+skin_url+'adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center'
|
583 |
-
}).hide().appendTo('body');
|
584 |
-
|
585 |
-
// get site base url
|
586 |
-
function getBaseURL() {
|
587 |
-
var sBase = location.href.substr(0, location.href.lastIndexOf("/") + 1);
|
588 |
-
var sp = sBase.split('/');
|
589 |
-
var lastFolder = sp[ sp.length - 2 ];
|
590 |
-
return sBase.replace(lastFolder+'/', '');
|
591 |
-
}
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
jQuery('body').on('click', '.ajax_contacts_href', function (e) {
|
596 |
-
|
597 |
-
var email = jQuery(this).attr('email');
|
598 |
-
var status = jQuery(this).attr('status');
|
599 |
-
var ajaxUrl = jQuery("#ajaxUrl").val();
|
600 |
-
|
601 |
-
jQuery.ajax({
|
602 |
-
type : "POST",
|
603 |
-
async : false,
|
604 |
-
url : ajaxUrl,
|
605 |
-
data : {"email":email,"newsletter":status},
|
606 |
-
beforeSend : function() {
|
607 |
-
jQuery('#ajax-busy').show();
|
608 |
-
},
|
609 |
-
success : function(msg) {
|
610 |
-
jQuery('#ajax-busy').hide();
|
611 |
-
}
|
612 |
-
});
|
613 |
-
|
614 |
-
var page_no = jQuery('#pagenumber').val();
|
615 |
-
loadData(page_no); // For first time page load
|
616 |
-
|
617 |
-
});
|
618 |
-
|
619 |
-
});
|
620 |
-
|
621 |
-
function testsmssend(sendererr,messageerr,mobileerr) {
|
622 |
-
var sender = jQuery('#sender_order').val();
|
623 |
-
var message =jQuery('#sender_order_message').val();
|
624 |
-
var number = jQuery("#sender_order_number").val();
|
625 |
-
var ajaxOrderSmsUrl = jQuery('#ajaxOrderSmsUrl').val();
|
626 |
-
var smsCampError = jQuery("#smsCampError").val();
|
627 |
-
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
628 |
-
if(sender == '' || isValid(sender) == false)
|
629 |
{
|
630 |
-
|
631 |
-
|
632 |
-
|
|
|
633 |
{
|
634 |
-
|
|
|
635 |
}
|
636 |
-
|
637 |
-
|
638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
639 |
}
|
640 |
-
else {
|
641 |
jQuery.ajax({
|
642 |
type : "POST",
|
643 |
async : false,
|
644 |
-
url :
|
645 |
-
data :
|
646 |
-
beforeSend : function()
|
647 |
jQuery('#ajax-busy').show();
|
648 |
},
|
649 |
-
success : function(msg)
|
650 |
jQuery('#ajax-busy').hide();
|
651 |
-
if(msg.trim() == 'OK')
|
652 |
-
{ alert(smsCampSuccess); }
|
653 |
-
else { alert(smsCampError); }
|
654 |
}
|
655 |
-
});
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
type : "POST",
|
682 |
async : false,
|
683 |
-
url :
|
684 |
-
data : {"
|
685 |
beforeSend : function() {
|
686 |
jQuery('#ajax-busy').show();
|
687 |
},
|
688 |
success : function(msg) {
|
689 |
-
jQuery('#ajax-busy').hide();
|
690 |
-
if(msg.trim() == 'OK')
|
691 |
-
{ alert(smsCampSuccess); }
|
692 |
-
else { alert(smsCampError); }
|
693 |
}
|
694 |
-
});
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
{
|
712 |
-
|
|
|
|
|
|
|
713 |
}
|
714 |
-
|
715 |
-
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
}
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
|
|
|
|
|
|
|
|
|
|
735 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
function senderOrderSaveValid(sendererr,messageerr)
|
738 |
{
|
739 |
var sender = jQuery('#sender_order').val();
|
740 |
var message =jQuery('#sender_order_message').val();
|
741 |
if(sender == '' || isValid(sender) == false)
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
}
|
|
|
752 |
function senderShipmentSaveValid(sendererr,messageerr)
|
753 |
{
|
754 |
var sender = jQuery('#sender_shipment').val();
|
@@ -764,52 +818,55 @@ function senderShipmentSaveValid(sendererr,messageerr)
|
|
764 |
return false;
|
765 |
}
|
766 |
}
|
|
|
767 |
function senderCampaignSaveValid(sendererr,messageerr,mobileerr)
|
768 |
{
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
}
|
804 |
|
805 |
function isMobilevalidation(str)
|
806 |
{
|
807 |
return /^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);
|
808 |
-
}
|
|
|
809 |
function isNormalInteger(str)
|
810 |
{
|
811 |
return /^\+?(0|[1-9]\d*)$/.test(str);
|
812 |
}
|
|
|
813 |
function isValid(str) {
|
814 |
var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
|
815 |
|
@@ -820,16 +877,16 @@ function isValid(str) {
|
|
820 |
}
|
821 |
return true;
|
822 |
}
|
|
|
823 |
function RegexEmail(email)
|
824 |
{
|
825 |
var emailRegexStr = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
826 |
var isvalid = emailRegexStr.test(email);
|
827 |
return isvalid;
|
828 |
}
|
|
|
829 |
function validate(emailerr,limiter)
|
830 |
{
|
831 |
-
|
832 |
-
|
833 |
if( document.notify_sms_mail_form.sendin_notify_email.value == "" || RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value) == false )
|
834 |
{
|
835 |
alert(emailerr);
|
@@ -843,11 +900,12 @@ function validate(emailerr,limiter)
|
|
843 |
document.notify_sms_mail_form.sendin_notify_value.focus() ;
|
844 |
return false;
|
845 |
}
|
846 |
-
|
847 |
return( true );
|
848 |
-
}
|
|
|
849 |
function smtpvalidate(emailerr)
|
850 |
-
|
851 |
var email = jQuery('#email').val();
|
852 |
if(email == "" || RegexEmail(email) == false )
|
853 |
{
|
@@ -855,16 +913,17 @@ function smtpvalidate(emailerr)
|
|
855 |
jQuery('#email').focus();
|
856 |
return false;
|
857 |
}
|
858 |
-
|
|
|
859 |
function apikvalidate(apierr)
|
860 |
-
|
861 |
-
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
|
|
862 |
|
863 |
-
if(sendin_apikey_val.trim() == "")
|
864 |
{
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
}
|
869 |
-
|
870 |
-
}
|
11 |
jQuery(document)
|
12 |
.ready(
|
13 |
function() {
|
|
|
|
|
14 |
var apistatuskey = jQuery('#apistatuskey').val();
|
15 |
+
|
16 |
jQuery("#select").multiselect();
|
17 |
+
|
18 |
jQuery(".sendin_api_status").click(function()
|
19 |
+
{
|
20 |
if (apistatuskey == 1 && jQuery(this).val() == 1)
|
21 |
+
{
|
|
|
22 |
jQuery("#sendin_apikey").show();
|
23 |
jQuery(".alldiv").show();
|
24 |
jQuery(".hidetableblock").show();
|
25 |
+
}
|
|
|
26 |
else{
|
27 |
if(jQuery(this).val() == 1)
|
28 |
{
|
29 |
+
jQuery("#sendin_apikey").show();
|
30 |
}else{
|
31 |
jQuery("#sendin_apikey").hide();
|
32 |
jQuery(".alldiv").hide();
|
33 |
}
|
34 |
+
}
|
|
|
35 |
});
|
36 |
+
|
37 |
+
|
38 |
+
//date picker function
|
39 |
+
jQuery('#sib_datetimepicker').datepicker({ dateFormat: 'yy-mm-dd' });
|
40 |
+
//Double optin function
|
41 |
+
jQuery('.manage_subscribe_block input[name=subscribe_confirm_type]').click(function(){
|
42 |
+
jQuery('.manage_subscribe_block .inner_manage_box').slideUp();
|
43 |
+
jQuery(this).parents('.manage_subscribe_block').find('.inner_manage_box').slideDown();
|
44 |
+
|
45 |
+
});
|
46 |
+
|
47 |
+
jQuery('.openCollapse').each(function(){
|
48 |
+
if(!jQuery(this).is(":checked")){
|
49 |
+
jQuery(this).parent('.form-group').find('.collapse').hide();
|
50 |
+
}
|
51 |
+
});
|
52 |
+
|
53 |
+
jQuery('input[name=subscribe_confirm_type]').each(function(){
|
54 |
+
if(jQuery(this).is(":checked")){
|
55 |
+
jQuery(this).parents('.manage_subscribe_block').find('.inner_manage_box').show();
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
jQuery('.openCollapse').click(function() {
|
60 |
+
|
61 |
+
if (jQuery(this).is(":checked")){
|
62 |
+
jQuery(this).parent('.form-group').find('.collapse').slideDown();
|
63 |
+
} else {
|
64 |
+
jQuery(this).parent('.form-group').find('.collapse').slideUp();
|
65 |
+
}
|
66 |
+
});
|
67 |
+
|
68 |
function loadData(page) {
|
69 |
var ajaxcontentUrl = jQuery("#ajaxcontentUrl").val();
|
70 |
jQuery.ajax({
|
86 |
});
|
87 |
}
|
88 |
});
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
jQuery('.hdtab').click(function(){
|
92 |
+
if(parseInt(jQuery(this).val())) { jQuery('#hidetabselect').css('display','block');}
|
|
|
93 |
});
|
|
|
94 |
|
95 |
jQuery('body').on('click',' .pagination li.active',function() {
|
96 |
var page = jQuery(this).attr('p');
|
97 |
jQuery('#pagenumber').val(page);
|
98 |
loadData(page);
|
|
|
99 |
});
|
100 |
|
101 |
+
jQuery('.toolTip').hover(function () {
|
|
|
102 |
var title = jQuery(this).attr('title');
|
103 |
var offset = jQuery(this).offset();
|
104 |
|
115 |
jQuery('#sender_order').mouseover(function () {
|
116 |
var val = jQuery(this).val();
|
117 |
if(isInteger(val) || val == ''){
|
118 |
+
jQuery("#sender_order").attr('maxlength','11');
|
119 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
120 |
|
121 |
}
|
122 |
else{
|
123 |
jQuery("#sender_order").attr('maxlength','11');
|
124 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
125 |
jQuery("#sender_order").val(str7);
|
126 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
127 |
+
}
|
|
|
128 |
});
|
129 |
|
130 |
jQuery('#sender_order').keyup(function () {
|
131 |
var val = jQuery(this).val();
|
132 |
if(isInteger(val) || val == ''){
|
133 |
+
jQuery("#sender_order").attr('maxlength','11');
|
134 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
135 |
|
136 |
}
|
137 |
else{
|
143 |
}
|
144 |
});
|
145 |
|
146 |
+
jQuery("#sender_order").keydown(function (event) {
|
147 |
+
if (event.keyCode == 32) {
|
148 |
+
event.preventDefault();
|
149 |
+
}
|
150 |
+
});
|
151 |
|
152 |
|
153 |
if(jQuery('#sender_order').val() != '')
|
154 |
{
|
155 |
var val = jQuery('#sender_order').val();
|
156 |
if(isInteger(val)){
|
157 |
+
jQuery("#sender_order").attr('maxlength','11');
|
158 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
159 |
|
160 |
}
|
161 |
else{
|
162 |
jQuery("#sender_order").attr('maxlength','11');
|
163 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
|
|
164 |
}
|
165 |
}
|
166 |
+
|
167 |
jQuery('#sender_order_message').keyup(function () {
|
168 |
+
var chars = this.value.length,
|
|
|
169 |
messages = Math.ceil(chars / 160),
|
170 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
171 |
|
172 |
jQuery('#sender_order_message_text').text(remaining);
|
173 |
|
174 |
jQuery('#sender_order_message_text_count').text(messages);
|
|
|
175 |
});
|
176 |
|
177 |
if(jQuery('#sender_order_message').val() != '')
|
178 |
{
|
179 |
var chars = jQuery('#sender_order_message').val().length,
|
180 |
messages = Math.ceil(chars / 160),
|
181 |
+
remaining = messages * 160 - chars;
|
182 |
|
183 |
jQuery('#sender_order_message_text').text(remaining);
|
184 |
|
185 |
jQuery('#sender_order_message_text_count').text(messages);
|
186 |
}
|
187 |
+
|
188 |
jQuery('#sender_shipment').mouseover(function () {
|
189 |
var val = jQuery(this).val();
|
190 |
|
191 |
if(isInteger(val) || val == ''){
|
192 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
193 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
194 |
}
|
195 |
else{
|
196 |
jQuery("#sender_shipment").attr('maxlength','11');
|
197 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
198 |
jQuery("#sender_shipment").val(str7);
|
199 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
200 |
}
|
201 |
});
|
202 |
jQuery('#sender_shipment').keyup(function () {
|
203 |
+
var val = jQuery(this).val();
|
|
|
204 |
if(isInteger(val) || val == ''){
|
205 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
206 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
207 |
}
|
208 |
else{
|
209 |
jQuery("#sender_shipment").attr('maxlength','11');
|
210 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
211 |
jQuery("#sender_shipment").val(str7);
|
212 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
213 |
}
|
214 |
});
|
215 |
+
jQuery("#sender_shipment").keydown(function (event) {
|
216 |
+
if (event.keyCode == 32) {
|
217 |
+
event.preventDefault();
|
218 |
+
}
|
219 |
+
});
|
220 |
+
|
221 |
if(jQuery('#sender_shipment').val() != '')
|
222 |
{
|
223 |
var val = jQuery('#sender_shipment').val();
|
224 |
if(isInteger(val)){
|
225 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
226 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
227 |
}
|
228 |
else{
|
229 |
jQuery("#sender_shipment").attr('maxlength','11');
|
230 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
231 |
}
|
232 |
}
|
233 |
+
|
234 |
jQuery('#sender_shipment_message').keyup(function () {
|
235 |
|
236 |
var chars = this.value.length,
|
237 |
messages = Math.ceil(chars / 160),
|
238 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
+
jQuery('#sender_shipment_message_text').text(remaining);
|
241 |
+
jQuery('#sender_shipment_message_text_count').text(messages);
|
242 |
});
|
243 |
+
|
244 |
if(jQuery('#sender_shipment_message').val() != '')
|
245 |
{
|
246 |
var chars = jQuery('#sender_shipment_message').val().length,
|
247 |
messages = Math.ceil(chars / 160),
|
248 |
+
remaining = messages * 160 - chars;
|
249 |
|
250 |
jQuery('#sender_shipment_message_text').text(remaining);
|
|
|
251 |
jQuery('#sender_shipment_message_text_count').text(messages);
|
252 |
}
|
253 |
+
|
254 |
jQuery('#sender_campaign').mouseover(function () {
|
255 |
var val = jQuery(this).val();
|
256 |
if(isInteger(val) || val == ''){
|
257 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
258 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
259 |
|
260 |
}
|
261 |
else{
|
270 |
var val = jQuery(this).val();
|
271 |
|
272 |
if(isInteger(val) || val == ''){
|
273 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
274 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
275 |
}
|
276 |
else{
|
277 |
jQuery("#sender_campaign").attr('maxlength','11');
|
278 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
279 |
jQuery("#sender_campaign").val(str7);
|
280 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
281 |
}
|
282 |
});
|
283 |
+
jQuery("#sender_campaign").keydown(function (event) {
|
284 |
+
if (event.keyCode == 32) {
|
285 |
+
event.preventDefault();
|
286 |
+
}
|
287 |
+
});
|
288 |
+
|
289 |
if(jQuery('#sender_campaign').val() != '')
|
290 |
{
|
291 |
+
var val = jQuery('#sender_campaign').val();
|
|
|
292 |
if(isInteger(val)){
|
293 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
294 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
295 |
}
|
296 |
else{
|
297 |
jQuery("#sender_campaign").attr('maxlength','11');
|
304 |
var chars = this.value.length,
|
305 |
messages = Math.ceil(chars / 160),
|
306 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
307 |
+
|
|
|
|
|
|
|
308 |
jQuery('#sender_campaign_message_text').text(remaining);
|
309 |
+
jQuery('#sender_campaign_message_text_count').text(messages);
|
|
|
310 |
});
|
311 |
+
|
312 |
if(jQuery('#sender_campaign_message').val() != '')
|
313 |
{
|
314 |
var chars = jQuery('#sender_campaign_message').val().length,
|
316 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
317 |
|
318 |
jQuery('#sender_campaign_message_text').text(remaining);
|
|
|
319 |
jQuery('#sender_campaign_message_text_count').text(messages);
|
320 |
}
|
321 |
+
|
322 |
jQuery(".sms_order_setting").click(function () {
|
323 |
var orderSetting = jQuery(this).val();
|
324 |
var orderUrl = jQuery("#order").val();
|
339 |
jQuery(".hideOrder").hide();
|
340 |
}
|
341 |
}
|
342 |
+
});
|
|
|
343 |
});
|
344 |
+
|
345 |
jQuery(".sms_shiping_setting").click(function () {
|
346 |
var shipingSetting = jQuery(this).val();
|
347 |
var shipingUrl = jQuery("#shiping").val();
|
348 |
+
|
349 |
jQuery.ajax({
|
350 |
type: "POST",
|
351 |
async: false,
|
363 |
}
|
364 |
}
|
365 |
});
|
|
|
366 |
});
|
367 |
|
368 |
jQuery(".sms_campaign_setting").click(function () {
|
385 |
jQuery(".hideCampaign").hide();
|
386 |
}
|
387 |
}
|
388 |
+
});
|
|
|
389 |
});
|
390 |
+
|
391 |
if (jQuery('input:radio[name=sms_order_setting]:checked').val() == 0)
|
392 |
{
|
393 |
jQuery('.hideOrder').hide();
|
396 |
}
|
397 |
|
398 |
jQuery(".Sendin_Sms_Choice").click(function ()
|
399 |
+
{
|
400 |
if (jQuery(this).val() == 1) {
|
401 |
jQuery(".multiplechoice").hide();
|
402 |
jQuery(".singlechoice").show();
|
405 |
jQuery(".singlechoice").hide();
|
406 |
}
|
407 |
});
|
408 |
+
jQuery(".Sendin_Sms_Choice").click(function ()
|
409 |
+
{
|
410 |
+
if (jQuery(this).val() == 2) {
|
411 |
+
jQuery(".sib_datepicker").show();
|
412 |
+
} else {
|
413 |
+
jQuery(".sib_datepicker").hide();
|
414 |
+
}
|
415 |
+
});
|
416 |
|
417 |
if (jQuery('input:radio[name=Sendin_Sms_Choice]:checked').val() == 0)
|
418 |
{
|
430 |
} else {
|
431 |
jQuery(".hideShiping").hide();
|
432 |
}
|
433 |
+
});
|
434 |
+
|
|
|
435 |
if (jQuery('input:radio[name=sms_credit]:checked').val() == 0)
|
436 |
jQuery(".hideCredit").hide();
|
437 |
else
|
438 |
jQuery(".hideCredit").show();
|
439 |
+
|
|
|
440 |
jQuery(".sms_credit").click(function (){
|
441 |
|
442 |
var sms_credit = jQuery(this).val();
|
513 |
return true
|
514 |
}
|
515 |
return false;
|
516 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
+
jQuery('#showUserlist').click(function(){
|
519 |
+
|
520 |
+
if(jQuery('.userDetails').is(':hidden'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
{
|
522 |
+
loadData(1);
|
523 |
+
jQuery('#Spantextless').show();
|
524 |
+
jQuery('#Spantextmore').hide();
|
525 |
+
}else
|
526 |
{
|
527 |
+
jQuery('#Spantextmore').show();
|
528 |
+
jQuery('#Spantextless').hide();
|
529 |
}
|
530 |
+
jQuery('.userDetails').slideToggle();
|
531 |
+
});
|
532 |
+
|
533 |
+
var base_url = getBaseURL();
|
534 |
+
|
535 |
+
jQuery(".Tracking").click(function()
|
536 |
+
{
|
537 |
+
var Tracking = jQuery(this).val();
|
538 |
+
var trackingUrl = jQuery("#trackingUrl").val();
|
539 |
+
if (Tracking == 0) {
|
540 |
+
jQuery('.ordertracking').hide();
|
541 |
+
}
|
542 |
+
if (Tracking == 1) {
|
543 |
+
jQuery('.ordertracking').show();
|
544 |
}
|
|
|
545 |
jQuery.ajax({
|
546 |
type : "POST",
|
547 |
async : false,
|
548 |
+
url : trackingUrl,
|
549 |
+
data : "script=" + Tracking,
|
550 |
+
beforeSend : function(){
|
551 |
jQuery('#ajax-busy').show();
|
552 |
},
|
553 |
+
success : function(msg){
|
554 |
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
555 |
}
|
556 |
+
});
|
557 |
+
});
|
558 |
+
|
559 |
+
//for import old order history
|
560 |
+
jQuery(".Trackhistory").click(function()
|
561 |
+
{
|
562 |
+
var history_status = jQuery("#history_status").val();
|
563 |
+
var langvalue = jQuery("#langvalue").val();
|
564 |
+
var ordertrackingUrl = jQuery("#importordertrackingUrl").val();
|
565 |
+
|
566 |
+
jQuery.ajax({
|
567 |
+
type : "POST",
|
568 |
+
async : false,
|
569 |
+
url : ordertrackingUrl,
|
570 |
+
data : {"history_status":history_status,"langvalue":langvalue},
|
571 |
+
beforeSend : function(){
|
572 |
+
jQuery('#ajax-busy').show();
|
573 |
+
},
|
574 |
+
success : function(msg){
|
575 |
+
jQuery('#ajax-busy').hide();
|
576 |
+
jQuery('.ordertracking').hide();
|
577 |
+
alert(msg);
|
578 |
+
}
|
579 |
+
});
|
580 |
+
});
|
581 |
+
|
582 |
+
jQuery(".smtpStatus").click(function() {
|
583 |
+
|
584 |
+
var smtptest = jQuery(this).val();
|
585 |
+
var smtpUrl = jQuery("#smtpUrl").val();
|
586 |
+
if (smtptest == 0) {
|
587 |
+
jQuery('.smtptest').hide();
|
588 |
+
}
|
589 |
+
if (smtptest == 1) {
|
590 |
+
jQuery('.smtptest').show();
|
591 |
+
}
|
592 |
+
jQuery.ajax({
|
593 |
+
type : "POST",
|
594 |
+
async : false,
|
595 |
+
url : smtpUrl,
|
596 |
+
data : "smtptest=" + smtptest,
|
597 |
+
beforeSend : function() {
|
598 |
+
jQuery('#ajax-busy').show();
|
599 |
+
},
|
600 |
+
success : function(msg) {
|
601 |
+
jQuery('#ajax-busy').hide();
|
602 |
+
}
|
603 |
+
});
|
604 |
+
});
|
605 |
+
|
606 |
+
var skin_url = jQuery('#skin_url').val()
|
607 |
+
jQuery('<div id="ajax-busy"/> loading..')
|
608 |
+
.css(
|
609 |
+
{
|
610 |
+
opacity : 0.5,
|
611 |
+
position : 'fixed',
|
612 |
+
top : 0,
|
613 |
+
left : 0,
|
614 |
+
width : '100%',
|
615 |
+
height : jQuery(window).height() + 'px',
|
616 |
+
background : 'white url('+skin_url+'adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center'
|
617 |
+
}).hide().appendTo('body');
|
618 |
+
|
619 |
+
// get site base url
|
620 |
+
function getBaseURL() {
|
621 |
+
var sBase = location.href.substr(0, location.href.lastIndexOf("/") + 1);
|
622 |
+
var sp = sBase.split('/');
|
623 |
+
var lastFolder = sp[ sp.length - 2 ];
|
624 |
+
return sBase.replace(lastFolder+'/', '');
|
625 |
+
}
|
626 |
+
|
627 |
+
jQuery('body').on('click', '.ajax_contacts_href', function (e) {
|
628 |
+
var email = jQuery(this).attr('email');
|
629 |
+
var status = jQuery(this).attr('status');
|
630 |
+
var ajaxUrl = jQuery("#ajaxUrl").val();
|
631 |
+
|
632 |
+
jQuery.ajax({
|
633 |
type : "POST",
|
634 |
async : false,
|
635 |
+
url : ajaxUrl,
|
636 |
+
data : {"email":email,"newsletter":status},
|
637 |
beforeSend : function() {
|
638 |
jQuery('#ajax-busy').show();
|
639 |
},
|
640 |
success : function(msg) {
|
641 |
+
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
642 |
}
|
643 |
+
});
|
644 |
+
|
645 |
+
var page_no = jQuery('#pagenumber').val();
|
646 |
+
loadData(page_no); // For first time page load
|
647 |
+
});
|
648 |
+
|
649 |
+
jQuery('body').on('click', '.ajax_sms_subs_href', function (e) {
|
650 |
+
|
651 |
+
var email = jQuery(this).attr('email');
|
652 |
+
var status = jQuery(this).attr('status');
|
653 |
+
var ajaxSmsUrl = jQuery("#ajaxSmsSubscribeUrl").val();
|
654 |
+
|
655 |
+
jQuery.ajax({
|
656 |
+
type : "POST",
|
657 |
+
async : false,
|
658 |
+
url : ajaxSmsUrl,
|
659 |
+
data : {"email":email,"sms":status},
|
660 |
+
beforeSend : function() {
|
661 |
+
jQuery('#ajax-busy').show();
|
662 |
+
},
|
663 |
+
success : function(msg) {
|
664 |
+
jQuery('#ajax-busy').hide();
|
665 |
}
|
666 |
+
});
|
667 |
+
|
668 |
+
var page_no = jQuery('#pagenumber').val();
|
669 |
+
loadData(page_no); // For first time page load
|
670 |
+
|
671 |
+
});
|
672 |
+
});
|
673 |
+
|
674 |
+
function testsmssend(sendererr,messageerr,mobileerr) {
|
675 |
+
var sender = jQuery('#sender_order').val();
|
676 |
+
var message =jQuery('#sender_order_message').val();
|
677 |
+
var number = jQuery("#sender_order_number").val();
|
678 |
+
var ajaxOrderSmsUrl = jQuery('#ajaxOrderSmsUrl').val();
|
679 |
+
var smsCampError = jQuery("#smsCampError").val();
|
680 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
681 |
+
if(sender == '' || isValid(sender) == false)
|
682 |
+
{
|
683 |
+
alert(sendererr);
|
684 |
+
}
|
685 |
+
else if( message == '')
|
686 |
+
{
|
687 |
+
alert(messageerr);
|
688 |
+
}
|
689 |
+
else if(number == '')
|
690 |
+
{
|
691 |
+
alert(mobileerr);
|
692 |
+
}
|
693 |
+
else {
|
694 |
+
jQuery.ajax({
|
695 |
+
type : "POST",
|
696 |
+
async : false,
|
697 |
+
url : ajaxOrderSmsUrl,
|
698 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
699 |
+
beforeSend : function() {
|
700 |
+
jQuery('#ajax-busy').show();
|
701 |
+
},
|
702 |
+
success : function(msg) {
|
703 |
+
jQuery('#ajax-busy').hide();
|
704 |
+
if(msg.trim() == 'OK')
|
705 |
+
{ alert(smsCampSuccess); }
|
706 |
+
else { alert(smsCampError); }
|
707 |
}
|
708 |
+
});}
|
709 |
+
return false;
|
710 |
+
}
|
711 |
+
|
712 |
+
function testShippedSmsSend(sendererr,messageerr,mobileerr) {
|
713 |
+
var sender = jQuery('#sender_shipment').val();
|
714 |
+
var message =jQuery('#sender_shipment_message').val();
|
715 |
+
var number = jQuery("#sender_shipment_number").val();
|
716 |
+
var ajaxOrderShippedUrl = jQuery('#ajaxOrderShippedUrl').val();
|
717 |
+
var smsCampError = jQuery("#smsCampError").val();
|
718 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
719 |
+
if(sender == '' || isValid(sender) == false)
|
720 |
+
{
|
721 |
+
alert(sendererr);
|
722 |
+
}
|
723 |
+
else if( message == '')
|
724 |
+
{
|
725 |
+
alert(messageerr);
|
726 |
+
}
|
727 |
+
else if(number == '')
|
728 |
+
{
|
729 |
+
alert(mobileerr);
|
730 |
}
|
731 |
+
else {
|
732 |
+
jQuery.ajax({
|
733 |
+
type : "POST",
|
734 |
+
async : false,
|
735 |
+
url : ajaxOrderShippedUrl,
|
736 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
737 |
+
beforeSend : function() {
|
738 |
+
jQuery('#ajax-busy').show();
|
739 |
+
},
|
740 |
+
success : function(msg) {
|
741 |
+
jQuery('#ajax-busy').hide();
|
742 |
+
if(msg.trim() == 'OK')
|
743 |
+
{ alert(smsCampSuccess); }
|
744 |
+
else { alert(smsCampError); }
|
745 |
+
}
|
746 |
+
}); }
|
747 |
+
return false;
|
748 |
+
}
|
749 |
+
|
750 |
+
function testCampaignSmsSend(sendererr,messageerr,mobileerr) {
|
751 |
+
|
752 |
+
var sender = jQuery('#sender_campaign').val();
|
753 |
+
var message =jQuery('#sender_campaign_message').val();
|
754 |
+
var number = jQuery("#sender_campaigntest_number").val();
|
755 |
+
var ajaxSmsCampaignUrl = jQuery('#ajaxSmsCampaignUrl').val();
|
756 |
+
var smsCampError = jQuery("#smsCampError").val();
|
757 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
758 |
|
759 |
+
if(sender == '' || isValid(sender) == false)
|
760 |
+
{
|
761 |
+
alert(sendererr);
|
762 |
+
}
|
763 |
+
else if( message == '')
|
764 |
+
{
|
765 |
+
alert(messageerr);
|
766 |
+
}
|
767 |
+
else if(number == '' || isMobilevalidation(number) == false)
|
768 |
+
{
|
769 |
+
alert(mobileerr);
|
770 |
+
}
|
771 |
+
else {
|
772 |
+
jQuery.ajax({
|
773 |
+
type : "POST",
|
774 |
+
async : false,
|
775 |
+
url : ajaxSmsCampaignUrl,
|
776 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
777 |
+
beforeSend : function() {
|
778 |
+
jQuery('#ajax-busy').show();
|
779 |
+
},
|
780 |
+
success : function(msg) {
|
781 |
+
jQuery('#ajax-busy').hide();
|
782 |
+
if(msg.trim() == 'OK')
|
783 |
+
{ alert(smsCampSuccess); }
|
784 |
+
else { alert(smsCampError); }
|
785 |
+
}
|
786 |
+
});}
|
787 |
+
return false;
|
788 |
+
}
|
789 |
+
|
790 |
function senderOrderSaveValid(sendererr,messageerr)
|
791 |
{
|
792 |
var sender = jQuery('#sender_order').val();
|
793 |
var message =jQuery('#sender_order_message').val();
|
794 |
if(sender == '' || isValid(sender) == false)
|
795 |
+
{
|
796 |
+
alert(sendererr);
|
797 |
+
return false;
|
798 |
+
}
|
799 |
+
else if( message == '')
|
800 |
+
{
|
801 |
+
alert(messageerr);
|
802 |
+
return false;
|
803 |
+
}
|
804 |
}
|
805 |
+
|
806 |
function senderShipmentSaveValid(sendererr,messageerr)
|
807 |
{
|
808 |
var sender = jQuery('#sender_shipment').val();
|
818 |
return false;
|
819 |
}
|
820 |
}
|
821 |
+
|
822 |
function senderCampaignSaveValid(sendererr,messageerr,mobileerr)
|
823 |
{
|
824 |
+
var sender = jQuery('#sender_campaign').val();
|
825 |
+
var message =jQuery('#sender_campaign_message').val();
|
826 |
+
var number = jQuery("#singlechoice").val();
|
827 |
+
var radiovalue = jQuery("input[name=Sendin_Sms_Choice]:checked").val();
|
828 |
+
if(radiovalue == 1)
|
829 |
+
{
|
830 |
+
if(number == '' || isMobilevalidation(number) == false)
|
831 |
+
{
|
832 |
+
alert(mobileerr);
|
833 |
+
return false;
|
834 |
+
}
|
835 |
+
else if(sender == '' || isValid(sender) == false)
|
836 |
+
{
|
837 |
+
alert(sendererr);
|
838 |
+
return false;
|
839 |
+
}
|
840 |
+
else if(message == '')
|
841 |
+
{
|
842 |
+
alert(messageerr);
|
843 |
+
return false;
|
844 |
+
}
|
845 |
+
}
|
846 |
+
else{
|
847 |
+
if(sender == '' || isValid(sender) == false)
|
848 |
+
{
|
849 |
+
alert(sendererr);
|
850 |
+
return false;
|
851 |
+
}
|
852 |
+
else if(message == '')
|
853 |
+
{
|
854 |
+
alert(messageerr);
|
855 |
+
return false;
|
856 |
+
}
|
857 |
+
}
|
858 |
}
|
859 |
|
860 |
function isMobilevalidation(str)
|
861 |
{
|
862 |
return /^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);
|
863 |
+
}
|
864 |
+
|
865 |
function isNormalInteger(str)
|
866 |
{
|
867 |
return /^\+?(0|[1-9]\d*)$/.test(str);
|
868 |
}
|
869 |
+
|
870 |
function isValid(str) {
|
871 |
var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
|
872 |
|
877 |
}
|
878 |
return true;
|
879 |
}
|
880 |
+
|
881 |
function RegexEmail(email)
|
882 |
{
|
883 |
var emailRegexStr = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
884 |
var isvalid = emailRegexStr.test(email);
|
885 |
return isvalid;
|
886 |
}
|
887 |
+
|
888 |
function validate(emailerr,limiter)
|
889 |
{
|
|
|
|
|
890 |
if( document.notify_sms_mail_form.sendin_notify_email.value == "" || RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value) == false )
|
891 |
{
|
892 |
alert(emailerr);
|
900 |
document.notify_sms_mail_form.sendin_notify_value.focus() ;
|
901 |
return false;
|
902 |
}
|
903 |
+
|
904 |
return( true );
|
905 |
+
}
|
906 |
+
|
907 |
function smtpvalidate(emailerr)
|
908 |
+
{
|
909 |
var email = jQuery('#email').val();
|
910 |
if(email == "" || RegexEmail(email) == false )
|
911 |
{
|
913 |
jQuery('#email').focus();
|
914 |
return false;
|
915 |
}
|
916 |
+
}
|
917 |
+
|
918 |
function apikvalidate(apierr)
|
919 |
+
{
|
920 |
+
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
921 |
+
var sendin_api_check = jQuery("input[name=sendin_api_status]:checked").val();
|
922 |
|
923 |
+
if(sendin_apikey_val.trim() == "" && sendin_api_check !=0)
|
924 |
{
|
925 |
+
alert(apierr);
|
926 |
+
jQuery('#sendin_apikey_val').focus();
|
927 |
+
return false;
|
928 |
+
}
|
929 |
+
}
|
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.min.js
CHANGED
@@ -7,4 +7,4 @@
|
|
7 |
* needs then we can't provide a technical support.
|
8 |
**/
|
9 |
|
10 |
-
jQuery.noConflict();jQuery(document).ready(function(){var apistatuskey=jQuery("#apistatuskey").val();jQuery("#select").multiselect();jQuery(".sendin_api_status").click(function(){if(apistatuskey==1&&jQuery(this).val()==1){jQuery("#sendin_apikey").show();jQuery(".alldiv").show();jQuery(".hidetableblock").show();}else{if(jQuery(this).val()==1){jQuery("#sendin_apikey").show();}else{jQuery("#sendin_apikey").hide();jQuery(".alldiv").hide();}}});function loadData(page){var ajaxcontentUrl=jQuery("#ajaxcontentUrl").val();jQuery.ajax({type:"POST",async:false,url:ajaxcontentUrl,data:"page="+page,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();jQuery(".midleft").html(msg);jQuery(".midleft").ajaxComplete(function(event,request,settings){jQuery(".midleft").html(msg);});}});}jQuery(".hdtab").click(function(){if(parseInt(jQuery(this).val())){jQuery("#hidetabselect").css("display","block");}});jQuery("body").on("click"," .pagination li.active",function(){var page=jQuery(this).attr("p");jQuery("#pagenumber").val(page);loadData(page);});jQuery(".toolTip").hover(function(){var title=jQuery(this).attr("title");var offset=jQuery(this).offset();jQuery("body").append('<div id="tipkk" style="top:'+offset.top+"px; left:"+offset.left+'px; ">'+title+"</div>");var tipContentHeight=jQuery("#tipkk").height()+25;jQuery("#tipkk").css("top",(offset.top-tipContentHeight)+"px");},function(){jQuery("#tipkk").remove();});jQuery("#sender_order").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_order").val(str7);jQuery("#sender_order_text").text((11-val.length));}});jQuery("#sender_order").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_order").val(str7);jQuery("#sender_order_text").text((11-val.length));}});if(jQuery("#sender_order").val()!=""){var val=jQuery("#sender_order").val();if(isInteger(val)){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");jQuery("#sender_order_text").text((11-val.length));}}jQuery("#sender_order_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_order_message_text").text(remaining);jQuery("#sender_order_message_text_count").text(messages);});if(jQuery("#sender_order_message").val()!=""){var chars=jQuery("#sender_order_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_order_message_text").text(remaining);jQuery("#sender_order_message_text_count").text(messages);}jQuery("#sender_shipment").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_shipment").val(str7);jQuery("#sender_shipment_text").text((11-val.length));}});jQuery("#sender_shipment").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_shipment").val(str7);jQuery("#sender_shipment_text").text((11-val.length));}});if(jQuery("#sender_shipment").val()!=""){var val=jQuery("#sender_shipment").val();if(isInteger(val)){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");jQuery("#sender_shipment_text").text((11-val.length));}}jQuery("#sender_shipment_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_shipment_message_text").text(remaining);jQuery("#sender_shipment_message_text_count").text(messages);});if(jQuery("#sender_shipment_message").val()!=""){var chars=jQuery("#sender_shipment_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_shipment_message_text").text(remaining);jQuery("#sender_shipment_message_text_count").text(messages);}jQuery("#sender_campaign").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_campaign").val(str7);jQuery("#sender_campaign_text").text((11-val.length));}});jQuery("#sender_campaign").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_campaign").val(str7);jQuery("#sender_campaign_text").text((11-val.length));}});if(jQuery("#sender_campaign").val()!=""){var val=jQuery("#sender_campaign").val();if(isInteger(val)){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");jQuery("#sender_campaign_text").text((11-val.length));}}jQuery("#sender_campaign_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_campaign_message_text").text(remaining);jQuery("#sender_campaign_message_text_count").text(messages);});if(jQuery("#sender_campaign_message").val()!=""){var chars=jQuery("#sender_campaign_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_campaign_message_text").text(remaining);jQuery("#sender_campaign_message_text_count").text(messages);}jQuery(".sms_order_setting").click(function(){var orderSetting=jQuery(this).val();var orderUrl=jQuery("#order").val();jQuery.ajax({type:"POST",async:false,url:orderUrl,data:"orderSetting="+orderSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(orderSetting==1){jQuery(".hideOrder").show();}else{jQuery(".hideOrder").hide();}}});});jQuery(".sms_shiping_setting").click(function(){var shipingSetting=jQuery(this).val();var shipingUrl=jQuery("#shiping").val();jQuery.ajax({type:"POST",async:false,url:shipingUrl,data:"shipingSetting="+shipingSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(shipingSetting==1){jQuery(".hideShiping").show();}else{jQuery(".hideShiping").hide();}}});});jQuery(".sms_campaign_setting").click(function(){var campaignSetting=jQuery(this).val();var campaignUrl=jQuery("#campaign").val();jQuery.ajax({type:"POST",async:false,url:campaignUrl,data:"campaignSetting="+campaignSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(campaignSetting==1){jQuery(".hideCampaign").show();}else{jQuery(".hideCampaign").hide();}}});});if(jQuery("input:radio[name=sms_order_setting]:checked").val()==0){jQuery(".hideOrder").hide();}else{jQuery(".hideOrder").show();}jQuery(".Sendin_Sms_Choice").click(function(){if(jQuery(this).val()==1){jQuery(".multiplechoice").hide();jQuery(".singlechoice").show();}else{jQuery(".multiplechoice").show();jQuery(".singlechoice").hide();}});if(jQuery("input:radio[name=Sendin_Sms_Choice]:checked").val()==0){jQuery(".multiplechoice").show();jQuery(".singlechoice").hide();}else{jQuery(".singlechoice").show();jQuery(".multiplechoice").hide();}jQuery(".sms_shiping_setting").click(function(){if(jQuery(this).val()==1){jQuery(".hideShiping").show();}else{jQuery(".hideShiping").hide();}});if(jQuery("input:radio[name=sms_credit]:checked").val()==0){jQuery(".hideCredit").hide();}else{jQuery(".hideCredit").show();}jQuery(".sms_credit").click(function(){var sms_credit=jQuery(this).val();var creditUrl=jQuery("#credits").val();var type="sms_credit";jQuery.ajax({type:"POST",async:false,url:creditUrl,data:"sms_credit="+sms_credit,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(sms_credit==1){jQuery(".hideCredit").show();}else{jQuery(".hideCredit").hide();}}});});if(jQuery("input:radio[name=sms_shiping_setting]:checked").val()==0){jQuery(".hideShiping").hide();}else{jQuery(".hideShiping").show();}jQuery(".sms_campaign_setting").click(function(){if(jQuery(this).val()==1){jQuery(".hideCampaign").show();}else{jQuery(".hideCampaign").hide();}});if(jQuery("input:radio[name=sms_campaign_setting]:checked").val()==0){jQuery(".hideCampaign").hide();}else{jQuery(".hideCampaign").show();}jQuery("#selectSmsList").multiselect({header:false,checkall:false});jQuery("#tabs li").click(function(){jQuery("#tabs li").removeClass("active");jQuery(this).addClass("active");jQuery(".tab_content").hide();var selected_tab=jQuery(this).find("a").attr("href");jQuery(selected_tab).fadeIn();return false;});function isInteger(val){var numberRegex=/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;if(numberRegex.test(val)){return true;}return false;}jQuery("#showUserlist").click(function(){if(jQuery(".userDetails").is(":hidden")){loadData(1);jQuery("#Spantextless").show();jQuery("#Spantextmore").hide();}else{jQuery("#Spantextmore").show();jQuery("#Spantextless").hide();}jQuery(".userDetails").slideToggle();});var base_url=getBaseURL();jQuery(".Tracking").click(function(){var Tracking=jQuery(this).val();var trackingUrl=jQuery("#trackingUrl").val();jQuery.ajax({type:"POST",async:false,url:trackingUrl,data:"script="+Tracking,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});});jQuery(".smtpStatus").click(function(){var smtptest=jQuery(this).val();var smtpUrl=jQuery("#smtpUrl").val();if(smtptest==0){jQuery(".smtptest").hide();}if(smtptest==1){jQuery(".smtptest").show();}jQuery.ajax({type:"POST",async:false,url:smtpUrl,data:"smtptest="+smtptest,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});});var skin_url=jQuery("#skin_url").val();jQuery('<div id="ajax-busy"/> loading..').css({opacity:0.5,position:"fixed",top:0,left:0,width:"100%",height:jQuery(window).height()+"px",background:"white url("+skin_url+"adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center"}).hide().appendTo("body");function getBaseURL(){var sBase=location.href.substr(0,location.href.lastIndexOf("/")+1);var sp=sBase.split("/");var lastFolder=sp[sp.length-2];return sBase.replace(lastFolder+"/","");}jQuery("body").on("click",".ajax_contacts_href",function(e){var email=jQuery(this).attr("email");var status=jQuery(this).attr("status");var ajaxUrl=jQuery("#ajaxUrl").val();jQuery.ajax({type:"POST",async:false,url:ajaxUrl,data:{email:email,newsletter:status},beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});var page_no=jQuery("#pagenumber").val();loadData(page_no);});});function testsmssend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_order").val();var message=jQuery("#sender_order_message").val();var number=jQuery("#sender_order_number").val();var ajaxOrderSmsUrl=jQuery("#ajaxOrderSmsUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxOrderSmsUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function testShippedSmsSend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_shipment").val();var message=jQuery("#sender_shipment_message").val();var number=jQuery("#sender_shipment_number").val();var ajaxOrderShippedUrl=jQuery("#ajaxOrderShippedUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxOrderShippedUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function testCampaignSmsSend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_campaign").val();var message=jQuery("#sender_campaign_message").val();var number=jQuery("#sender_campaigntest_number").val();var ajaxSmsCampaignUrl=jQuery("#ajaxSmsCampaignUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""||isMobilevalidation(number)==false){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxSmsCampaignUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function senderOrderSaveValid(sendererr,messageerr){var sender=jQuery("#sender_order").val();var message=jQuery("#sender_order_message").val();if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}function senderShipmentSaveValid(sendererr,messageerr){var sender=jQuery("#sender_shipment").val();var message=jQuery("#sender_shipment_message").val();if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}function senderCampaignSaveValid(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_campaign").val();var message=jQuery("#sender_campaign_message").val();var number=jQuery("#singlechoice").val();var radiovalue=jQuery("input[name=Sendin_Sms_Choice]:checked").val();if(radiovalue==1){if(number==""||isMobilevalidation(number)==false){alert(mobileerr);return false;}else{if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}}else{if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}}function isMobilevalidation(str){return/^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);}function isNormalInteger(str){return/^\+?(0|[1-9]\d*)$/.test(str);}function isValid(str){var iChars="~`!#$%^&*+=-[]\\';,/{}|\":<>?";for(var i=0;i<str.length;i++){if(iChars.indexOf(str.charAt(i))!=-1){return false;}}return true;}function RegexEmail(email){var emailRegexStr=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;var isvalid=emailRegexStr.test(email);return isvalid;}function validate(emailerr,limiter){if(document.notify_sms_mail_form.sendin_notify_email.value==""||RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value)==false){alert(emailerr);document.notify_sms_mail_form.sendin_notify_email.focus();return false;}if(document.notify_sms_mail_form.sendin_notify_value.value==""||isNormalInteger(document.notify_sms_mail_form.sendin_notify_value.value)==false){alert(limiter);document.notify_sms_mail_form.sendin_notify_value.focus();return false;}return(true);}function smtpvalidate(emailerr){var email=jQuery("#email").val();if(email==""||RegexEmail(email)==false){alert(emailerr);jQuery("#email").focus();return false;}}function apikvalidate(apierr){var sendin_apikey_val=jQuery("#sendin_apikey_val").val();if(sendin_apikey_val.trim()==""){alert(apierr);jQuery("#sendin_apikey_val").focus();return false;}}
|
7 |
* needs then we can't provide a technical support.
|
8 |
**/
|
9 |
|
10 |
+
function testsmssend(e,r,t){var a=jQuery("#sender_order").val(),n=jQuery("#sender_order_message").val(),s=jQuery("#sender_order_number").val(),i=jQuery("#ajaxOrderSmsUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function testShippedSmsSend(e,r,t){var a=jQuery("#sender_shipment").val(),n=jQuery("#sender_shipment_message").val(),s=jQuery("#sender_shipment_number").val(),i=jQuery("#ajaxOrderShippedUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function testCampaignSmsSend(e,r,t){var a=jQuery("#sender_campaign").val(),n=jQuery("#sender_campaign_message").val(),s=jQuery("#sender_campaigntest_number").val(),i=jQuery("#ajaxSmsCampaignUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s||0==isMobilevalidation(s)?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function senderOrderSaveValid(e,r){var t=jQuery("#sender_order").val(),a=jQuery("#sender_order_message").val();return""==t||0==isValid(t)?(alert(e),!1):""==a?(alert(r),!1):void 0}function senderShipmentSaveValid(e,r){var t=jQuery("#sender_shipment").val(),a=jQuery("#sender_shipment_message").val();return""==t||0==isValid(t)?(alert(e),!1):""==a?(alert(r),!1):void 0}function senderCampaignSaveValid(e,r,t){var a=jQuery("#sender_campaign").val(),n=jQuery("#sender_campaign_message").val(),s=jQuery("#singlechoice").val(),i=jQuery("input[name=Sendin_Sms_Choice]:checked").val();if(1==i){if(""==s||0==isMobilevalidation(s))return alert(t),!1;if(""==a||0==isValid(a))return alert(e),!1;if(""==n)return alert(r),!1}else{if(""==a||0==isValid(a))return alert(e),!1;if(""==n)return alert(r),!1}}function isMobilevalidation(e){return/^(?:\+|00)[1-9][0-9]{5,15}$/.test(e)}function isNormalInteger(e){return/^\+?(0|[1-9]\d*)$/.test(e)}function isValid(e){for(var r="~`!#$%^&*+=-[]\\';,/{}|\":<>?",t=0;t<e.length;t++)if(-1!=r.indexOf(e.charAt(t)))return!1;return!0}function RegexEmail(e){var r=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,t=r.test(e);return t}function validate(e,r){return""==document.notify_sms_mail_form.sendin_notify_email.value||0==RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value)?(alert(e),document.notify_sms_mail_form.sendin_notify_email.focus(),!1):""==document.notify_sms_mail_form.sendin_notify_value.value||0==isNormalInteger(document.notify_sms_mail_form.sendin_notify_value.value)?(alert(r),document.notify_sms_mail_form.sendin_notify_value.focus(),!1):!0}function smtpvalidate(e){var r=jQuery("#email").val();return""==r||0==RegexEmail(r)?(alert(e),jQuery("#email").focus(),!1):void 0}function apikvalidate(e){var r=jQuery("#sendin_apikey_val").val(),t=jQuery("input[name=sendin_api_status]:checked").val();return""==r.trim()&&0!=t?(alert(e),jQuery("#sendin_apikey_val").focus(),!1):void 0}jQuery.noConflict(),jQuery(document).ready(function(){function e(e){var r=jQuery("#ajaxcontentUrl").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"page="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),jQuery(".midleft").html(e),jQuery(".midleft").ajaxComplete(function(r,t,a){jQuery(".midleft").html(e)})}})}function r(e){var r=/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;return r.test(e)?!0:!1}function t(){var e=location.href.substr(0,location.href.lastIndexOf("/")+1),r=e.split("/"),t=r[r.length-2];return e.replace(t+"/","")}var a=jQuery("#apistatuskey").val();if(jQuery("#select").multiselect(),jQuery(".sendin_api_status").click(function(){1==a&&1==jQuery(this).val()?(jQuery("#sendin_apikey").show(),jQuery(".alldiv").show(),jQuery(".hidetableblock").show()):1==jQuery(this).val()?jQuery("#sendin_apikey").show():(jQuery("#sendin_apikey").hide(),jQuery(".alldiv").hide())}),jQuery("#sib_datetimepicker").datepicker({dateFormat:"yy-mm-dd"}),jQuery(".manage_subscribe_block input[name=subscribe_confirm_type]").click(function(){jQuery(".manage_subscribe_block .inner_manage_box").slideUp(),jQuery(this).parents(".manage_subscribe_block").find(".inner_manage_box").slideDown()}),jQuery(".openCollapse").each(function(){jQuery(this).is(":checked")||jQuery(this).parent(".form-group").find(".collapse").hide()}),jQuery("input[name=subscribe_confirm_type]").each(function(){jQuery(this).is(":checked")&&jQuery(this).parents(".manage_subscribe_block").find(".inner_manage_box").show()}),jQuery(".openCollapse").click(function(){jQuery(this).is(":checked")?jQuery(this).parent(".form-group").find(".collapse").slideDown():jQuery(this).parent(".form-group").find(".collapse").slideUp()}),jQuery(".hdtab").click(function(){parseInt(jQuery(this).val())&&jQuery("#hidetabselect").css("display","block")}),jQuery("body").on("click"," .pagination li.active",function(){var r=jQuery(this).attr("p");jQuery("#pagenumber").val(r),e(r)}),jQuery(".toolTip").hover(function(){var e=jQuery(this).attr("title"),r=jQuery(this).offset();jQuery("body").append('<div id="tipkk" style="top:'+r.top+"px; left:"+r.left+'px; ">'+e+"</div>");var t=jQuery("#tipkk").height()+25;jQuery("#tipkk").css("top",r.top-t+"px")},function(){jQuery("#tipkk").remove()}),jQuery("#sender_order").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-e.length);else{jQuery("#sender_order").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_order").val(t),jQuery("#sender_order_text").text(11-e.length)}}),jQuery("#sender_order").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-e.length);else{jQuery("#sender_order").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_order").val(t),jQuery("#sender_order_text").text(11-e.length)}}),jQuery("#sender_order").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_order").val()){var n=jQuery("#sender_order").val();r(n)?(jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-n.length)):(jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-n.length))}if(jQuery("#sender_order_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-e;jQuery("#sender_order_message_text").text(t),jQuery("#sender_order_message_text_count").text(r)}),""!=jQuery("#sender_order_message").val()){var s=jQuery("#sender_order_message").val().length,i=Math.ceil(s/160),u=160*i-s;jQuery("#sender_order_message_text").text(u),jQuery("#sender_order_message_text_count").text(i)}if(jQuery("#sender_shipment").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-e.length);else{jQuery("#sender_shipment").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_shipment").val(t),jQuery("#sender_shipment_text").text(11-e.length)}}),jQuery("#sender_shipment").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-e.length);else{jQuery("#sender_shipment").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_shipment").val(t),jQuery("#sender_shipment_text").text(11-e.length)}}),jQuery("#sender_shipment").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_shipment").val()){var n=jQuery("#sender_shipment").val();r(n)?(jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-n.length)):(jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-n.length))}if(jQuery("#sender_shipment_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-e;jQuery("#sender_shipment_message_text").text(t),jQuery("#sender_shipment_message_text_count").text(r)}),""!=jQuery("#sender_shipment_message").val()){var s=jQuery("#sender_shipment_message").val().length,i=Math.ceil(s/160),u=160*i-s;jQuery("#sender_shipment_message_text").text(u),jQuery("#sender_shipment_message_text_count").text(i)}if(jQuery("#sender_campaign").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-e.length);else{jQuery("#sender_campaign").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_campaign").val(t),jQuery("#sender_campaign_text").text(11-e.length)}}),jQuery("#sender_campaign").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-e.length);else{jQuery("#sender_campaign").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_campaign").val(t),jQuery("#sender_campaign_text").text(11-e.length)}}),jQuery("#sender_campaign").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_campaign").val()){var n=jQuery("#sender_campaign").val();r(n)?(jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-n.length)):(jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-n.length))}if(jQuery("#sender_campaign_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-(e%(160*r)||160*r);jQuery("#sender_campaign_message_text").text(t),jQuery("#sender_campaign_message_text_count").text(r)}),""!=jQuery("#sender_campaign_message").val()){var s=jQuery("#sender_campaign_message").val().length,i=Math.ceil(s/160),u=160*i-(s%(160*i)||160*i);jQuery("#sender_campaign_message_text").text(u),jQuery("#sender_campaign_message_text_count").text(i)}jQuery(".sms_order_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#order").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"orderSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideOrder").show():jQuery(".hideOrder").hide()}})}),jQuery(".sms_shiping_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#shiping").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"shipingSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}})}),jQuery(".sms_campaign_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#campaign").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"campaignSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide()}})}),0==jQuery("input:radio[name=sms_order_setting]:checked").val()?jQuery(".hideOrder").hide():jQuery(".hideOrder").show(),jQuery(".Sendin_Sms_Choice").click(function(){1==jQuery(this).val()?(jQuery(".multiplechoice").hide(),jQuery(".singlechoice").show()):(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide())}),jQuery(".Sendin_Sms_Choice").click(function(){2==jQuery(this).val()?jQuery(".sib_datepicker").show():jQuery(".sib_datepicker").hide()}),0==jQuery("input:radio[name=Sendin_Sms_Choice]:checked").val()?(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide()):(jQuery(".singlechoice").show(),jQuery(".multiplechoice").hide()),jQuery(".sms_shiping_setting").click(function(){1==jQuery(this).val()?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}),0==jQuery("input:radio[name=sms_credit]:checked").val()?jQuery(".hideCredit").hide():jQuery(".hideCredit").show(),jQuery(".sms_credit").click(function(){var e=jQuery(this).val(),r=jQuery("#credits").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"sms_credit="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideCredit").show():jQuery(".hideCredit").hide()}})}),0==jQuery("input:radio[name=sms_shiping_setting]:checked").val()?jQuery(".hideShiping").hide():jQuery(".hideShiping").show(),jQuery(".sms_campaign_setting").click(function(){1==jQuery(this).val()?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide()}),0==jQuery("input:radio[name=sms_campaign_setting]:checked").val()?jQuery(".hideCampaign").hide():jQuery(".hideCampaign").show(),jQuery("#selectSmsList").multiselect({header:!1,checkall:!1}),jQuery("#tabs li").click(function(){jQuery("#tabs li").removeClass("active"),jQuery(this).addClass("active"),jQuery(".tab_content").hide();var e=jQuery(this).find("a").attr("href");return jQuery(e).fadeIn(),!1}),jQuery("#showUserlist").click(function(){jQuery(".userDetails").is(":hidden")?(e(1),jQuery("#Spantextless").show(),jQuery("#Spantextmore").hide()):(jQuery("#Spantextmore").show(),jQuery("#Spantextless").hide()),jQuery(".userDetails").slideToggle()});t();jQuery(".Tracking").click(function(){var e=jQuery(this).val(),r=jQuery("#trackingUrl").val();0==e&&jQuery(".ordertracking").hide(),1==e&&jQuery(".ordertracking").show(),jQuery.ajax({type:"POST",async:!1,url:r,data:"script="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}})}),jQuery(".Trackhistory").click(function(){var e=jQuery("#history_status").val(),r=jQuery("#langvalue").val(),t=jQuery("#importordertrackingUrl").val();jQuery.ajax({type:"POST",async:!1,url:t,data:{history_status:e,langvalue:r},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),jQuery(".ordertracking").hide(),alert(e)}})}),jQuery(".smtpStatus").click(function(){var e=jQuery(this).val(),r=jQuery("#smtpUrl").val();0==e&&jQuery(".smtptest").hide(),1==e&&jQuery(".smtptest").show(),jQuery.ajax({type:"POST",async:!1,url:r,data:"smtptest="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}})});var y=jQuery("#skin_url").val();jQuery('<div id="ajax-busy"/> loading..').css({opacity:.5,position:"fixed",top:0,left:0,width:"100%",height:jQuery(window).height()+"px",background:"white url("+y+"adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center"}).hide().appendTo("body"),jQuery("body").on("click",".ajax_contacts_href",function(r){var t=jQuery(this).attr("email"),a=jQuery(this).attr("status"),n=jQuery("#ajaxUrl").val();jQuery.ajax({type:"POST",async:!1,url:n,data:{email:t,newsletter:a},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}});var s=jQuery("#pagenumber").val();e(s)}),jQuery("body").on("click",".ajax_sms_subs_href",function(r){var t=jQuery(this).attr("email"),a=jQuery(this).attr("status"),n=jQuery("#ajaxSmsSubscribeUrl").val();jQuery.ajax({type:"POST",async:!1,url:n,data:{email:t,sms:a},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}});var s=jQuery("#pagenumber").val();e(s)})});
|