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.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.2
- 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 +247 -0
- app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php +1385 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +208 -175
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php +0 -1
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php +0 -1
- app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php +709 -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 +316 -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/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 +159 -99
- app/etc/modules/Sendinblue_Sendinblue.xml +2 -2
- 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 +12 -2
- app/locale/fr_FR/template/email/sendin_notification.html +3 -3
- app/locale/fr_FR/template/email/sendinsmtp_conf.html +3 -3
- package.xml +15 -15
- skin/adminhtml/default/default/sendinblue/css/styles.css +12 -44
- skin/adminhtml/default/default/sendinblue/js/sendinblue.js +394 -374
- 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,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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::getSingleton('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::getSingleton('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::getSingleton('core/session')->addSuccess('Total of '.$responce->result->infoUpdatedCount.' record(s) were subscribed');
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
public function subscribeObserver($observer)
|
75 |
+
{
|
76 |
+
$params = Mage::app()->getRequest()->getParams();
|
77 |
+
$params = empty($params)?array():$params;
|
78 |
+
$extra = array();
|
79 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
80 |
+
$attributesName = $sendinModule->allAttributesName();
|
81 |
+
|
82 |
+
if ($params['email'] != '')
|
83 |
+
$newsletter_status = 0;
|
84 |
+
|
85 |
+
$client = 0;
|
86 |
+
$resp = $sendinModule->merge_my_array($attributesName, $extra);
|
87 |
+
$resp['CLIENT'] = $client;
|
88 |
+
$responce = $sendinModule->emailAdd($params['email'], $resp, $newsletter_status);
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
public function updateNewObserver($observer)
|
92 |
+
{
|
93 |
+
$params = Mage::app()->getRequest()->getParams();
|
94 |
+
$params = empty($params)?array():$params;
|
95 |
+
$cus_session = Mage::getSingleton('customer/session')->getCustomer();
|
96 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
97 |
+
$attributesName = $sendinModule->allAttributesName();
|
98 |
+
|
99 |
+
$customerSessionEmail = $cus_session->getEmail();
|
100 |
+
if (empty($customerSessionEmail)) {
|
101 |
+
$customer = $observer->getCustomer();
|
102 |
+
$customerData = $customer->getData();
|
103 |
+
}
|
104 |
+
else
|
105 |
+
$customerData = $cus_session->getData();
|
106 |
+
|
107 |
+
$user_lang = isset($customerData['created_in'])? $customerData['created_in'] :'';
|
108 |
+
$email = $customerData['email'];
|
109 |
+
$cid = isset($customerData['entity_id'])?$customerData['entity_id']:'';
|
110 |
+
$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);
|
111 |
+
|
112 |
+
$telephone = '';
|
113 |
+
$customer_addr = array();
|
114 |
+
$customer_addr_data = array();
|
115 |
+
foreach ($collectionAddress as $customerPhno) {
|
116 |
+
$customer_addr = $customerPhno->getData();
|
117 |
+
if (!empty($customer_addr['telephone']))
|
118 |
+
{
|
119 |
+
if(!empty($customer_addr['country_id']))
|
120 |
+
{
|
121 |
+
$country_code = $sendinModule->getCountryCode($customer_addr['country_id']);
|
122 |
+
$customer_addr['telephone'] = $sendinModule->checkMobileNumber($customer_addr['telephone'], $country_code);
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
$customer_addr_data = array_merge($customer_addr, $customerData);
|
127 |
+
if (!empty($customerData['firstname']) && !empty($customerData['lastname']))
|
128 |
+
$client = 1;
|
129 |
+
else
|
130 |
+
$client = 0;
|
131 |
+
|
132 |
+
$is_subscribed = !empty($customer_addr_data['is_subscribed'])?$customer_addr_data['is_subscribed']:$params['is_subscribed'];
|
133 |
+
|
134 |
+
if (!empty($customerData['firstname']) || !empty($customer_addr['telephone']) || !empty($email))
|
135 |
+
{
|
136 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
137 |
+
$nlStatus = $costomer_data->getStatus();
|
138 |
+
$resp = $sendinModule->merge_my_array($attributesName, $customer_addr_data);
|
139 |
+
$resp['CLIENT'] = $client;
|
140 |
+
if (isset($is_subscribed) && $is_subscribed == 1 && empty($nlStatus))
|
141 |
+
{
|
142 |
+
$responce = $sendinModule->emailAdd($email, $resp, $is_subscribed);
|
143 |
+
$sendinModule->sendWsTemplateMail($email);
|
144 |
+
}
|
145 |
+
elseif (!empty($nlStatus))
|
146 |
+
{
|
147 |
+
$responce = $sendinModule->emailAdd($email, $resp);
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
if (isset($is_subscribed) && !empty($is_subscribed) && $is_subscribed === 0) {
|
152 |
+
|
153 |
+
$responce = $sendinModule->emailDelete($email);
|
154 |
+
}
|
155 |
+
|
156 |
+
return $this;
|
157 |
+
|
158 |
+
}
|
159 |
+
public function syncData()
|
160 |
+
{
|
161 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
162 |
+
return $this;
|
163 |
+
}
|
164 |
+
public function updateStatus($observer)
|
165 |
+
{
|
166 |
+
$order = $observer->getEvent()->getOrder();
|
167 |
+
|
168 |
+
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING)
|
169 |
+
{
|
170 |
+
$history = $order->getShipmentsCollection();
|
171 |
+
$history_array=$history->toarray();
|
172 |
+
if($history_array['totalRecords'] > 0)
|
173 |
+
{
|
174 |
+
$order_id = isset($history_array['items']['0']['order_id'])?$history_array['items']['0']['order_id']:'';
|
175 |
+
$shippingaddrid = isset($history_array['items']['0']['shipping_address_id'])?$history_array['items']['0']['shipping_address_id']:'';
|
176 |
+
$_order = Mage::getModel('sales/order')->load($order_id);
|
177 |
+
$_shippingAddress = $_order->getShippingAddress();
|
178 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
179 |
+
$mobile_sms = $_shippingAddress->getTelephone();
|
180 |
+
$mobile_sms = !empty($mobile_sms)?$mobile_sms:'';
|
181 |
+
$countryid = $_shippingAddress->getCountryId();
|
182 |
+
$countryid = !empty($countryid)?$countryid:'';
|
183 |
+
$codeResource = Mage::getSingleton('core/resource');
|
184 |
+
$tableCountry = $codeResource->getTableName('sendinblue_country_codes');
|
185 |
+
$sql = 'SELECT `country_prefix` FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'" ';
|
186 |
+
$connection = $codeResource->getConnection('core_read');
|
187 |
+
$data = $connection->fetchRow($sql);
|
188 |
+
$mobile = '';
|
189 |
+
$country_prefix = $data['country_prefix'];
|
190 |
+
$sendinblueModule = Mage::getModel('sendinblue/sendinblue');
|
191 |
+
if(isset($country_prefix) && !empty($country_prefix))
|
192 |
+
$mobile = $sendinblueModule->checkMobileNumber($mobile_sms,$country_prefix);
|
193 |
+
$firstname = $_shippingAddress->getFirstname();
|
194 |
+
$firstname = !empty($firstname )?$firstname :'';
|
195 |
+
$lastname = $_shippingAddress->getLastname();
|
196 |
+
$lastname = !empty($lastname)?$lastname:'';
|
197 |
+
$ref_num = $_order->getIncrementId();
|
198 |
+
$ref_num = !empty($ref_num)?$ref_num:'';
|
199 |
+
$orderprice = $_order->getGrandTotal();
|
200 |
+
$orderprice = !empty($orderprice)?$orderprice:'';
|
201 |
+
$courrencycode = $_order->getBaseCurrencyCode();
|
202 |
+
$courrencycode = !empty($courrencycode)?$courrencycode:'';
|
203 |
+
$orderdate = $_order->getCreatedAt();
|
204 |
+
$orderdate = !empty($orderdate)?$orderdate:'';
|
205 |
+
if ($locale == 'fr_FR')
|
206 |
+
$ord_date = date('d/m/Y', strtotime($orderdate));
|
207 |
+
else
|
208 |
+
$ord_date = date('m/d/Y', strtotime($orderdate));
|
209 |
+
|
210 |
+
$total_pay = $orderprice.' '.$courrencycode;
|
211 |
+
$msgbody = $sendinblueModule->getSendSmsShipingMessage();
|
212 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
213 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
214 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
215 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
216 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
217 |
+
|
218 |
+
$arr = array();
|
219 |
+
$arr['to'] = $mobile;
|
220 |
+
$arr['from'] = $sendinblueModule->getSendSmsShipingSubject();
|
221 |
+
$arr['text'] = $msgbody;
|
222 |
+
$sendinblueModule->sendSmsApi($arr);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
public function subscribedToNewsletter($observer)
|
228 |
+
{
|
229 |
+
$data = $observer->subscriber;
|
230 |
+
$params = Mage::app()->getRequest()->getParams();
|
231 |
+
$params = empty($params)?array():$params;
|
232 |
+
if (empty($params['firstname']) && empty($params['lastname']))
|
233 |
+
{
|
234 |
+
$sibObj = Mage::getModel('sendinblue/sendinblue');
|
235 |
+
if($data->subscriber_status == 3)
|
236 |
+
$sibObj->emailDelete($data->subscriber_email);
|
237 |
+
elseif ($data->subscriber_status == 1)
|
238 |
+
{
|
239 |
+
$sibObj->emailSubscribe($data->subscriber_email);
|
240 |
+
if(!empty($params['email']))
|
241 |
+
$sibObj->sendWsTemplateMail($data->subscriber_email);
|
242 |
+
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php
ADDED
@@ -0,0 +1,1385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$this->user_language = $value_language->language;
|
37 |
+
if (!$this->lists_ids)
|
38 |
+
$this->lists_ids = str_replace(',', '|', $this->getUserlists($scope));
|
39 |
+
|
40 |
+
$params = Mage::app()->getRequest()->getParams();
|
41 |
+
$params = empty($params)?array():$params;
|
42 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != '')
|
43 |
+
$this->CreateFolderCaseTwo();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function checkMobileNumber($number, $call_prefix)
|
47 |
+
{
|
48 |
+
$number = preg_replace('/\s+/', '', $number);
|
49 |
+
$charone = substr($number, 0, 1);
|
50 |
+
$chartwo = substr($number, 0, 2);
|
51 |
+
|
52 |
+
if (preg_match('/^'.$call_prefix.'/', $number))
|
53 |
+
return '00'.$number;
|
54 |
+
|
55 |
+
elseif ($charone == '0' && $chartwo != '00')
|
56 |
+
{
|
57 |
+
if (preg_match('/^0'.$call_prefix.'/', $number))
|
58 |
+
return '00'.substr($number, 1);
|
59 |
+
else
|
60 |
+
return '00'.$call_prefix.substr($number, 1);
|
61 |
+
}
|
62 |
+
elseif ($chartwo == '00')
|
63 |
+
{
|
64 |
+
if (preg_match('/^00'.$call_prefix.'/', $number))
|
65 |
+
return $number;
|
66 |
+
else
|
67 |
+
return '00'.$call_prefix.substr($number, 2);
|
68 |
+
}
|
69 |
+
elseif ($charone == '+')
|
70 |
+
{
|
71 |
+
if (preg_match('/^\+'.$call_prefix.'/', $number))
|
72 |
+
return '00'.substr($number, 1);
|
73 |
+
else
|
74 |
+
return '00'.$call_prefix.substr($number, 1);
|
75 |
+
}
|
76 |
+
elseif ($charone != '0')
|
77 |
+
return '00'.$call_prefix.$number;
|
78 |
+
}
|
79 |
+
/**
|
80 |
+
* functions used for getting module status
|
81 |
+
*/
|
82 |
+
public function getEnableStatus()
|
83 |
+
{
|
84 |
+
$status = $this->getGeneralConfig('enabled', Mage::app()->getStore()->getStoreId());
|
85 |
+
if (!$status)
|
86 |
+
return false;
|
87 |
+
return $status;
|
88 |
+
}
|
89 |
+
/**
|
90 |
+
* functions used for send order sms module status
|
91 |
+
*/
|
92 |
+
public function getOrderSmsStatus()
|
93 |
+
{
|
94 |
+
$status = $this->getGeneralConfig('sms/order', Mage::app()->getStore()->getStoreId());
|
95 |
+
if (!$status)
|
96 |
+
return false;
|
97 |
+
return $status;
|
98 |
+
}
|
99 |
+
/**
|
100 |
+
* functions used for getting notify sms status
|
101 |
+
*/
|
102 |
+
public function getNotifySmsStatus()
|
103 |
+
{
|
104 |
+
$status = $this->getGeneralConfig('sms/credit', Mage::app()->getStore()->getStoreId());
|
105 |
+
if (!$status)
|
106 |
+
return false;
|
107 |
+
return $status;
|
108 |
+
}
|
109 |
+
/**
|
110 |
+
* functions used for getting Notify value limit
|
111 |
+
*/
|
112 |
+
public function getNotifyValueStatus()
|
113 |
+
{
|
114 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Value', Mage::app()->getStore()->getStoreId());
|
115 |
+
if (!$status)
|
116 |
+
return false;
|
117 |
+
return $status;
|
118 |
+
}
|
119 |
+
/**
|
120 |
+
* functions used for getting Notify email limit
|
121 |
+
*/
|
122 |
+
public function getNotifyEmailStatus()
|
123 |
+
{
|
124 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Email', Mage::app()->getStore()->getStoreId());
|
125 |
+
if (!$status)
|
126 |
+
return false;
|
127 |
+
return $status;
|
128 |
+
}
|
129 |
+
/**
|
130 |
+
* functions used for getting Notify email limit
|
131 |
+
*/
|
132 |
+
public function getNotifyCronStatus()
|
133 |
+
{
|
134 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Cron_Executed', Mage::app()->getStore()->getStoreId());
|
135 |
+
if (!$status)
|
136 |
+
return false;
|
137 |
+
return $status;
|
138 |
+
}
|
139 |
+
/**
|
140 |
+
* functions used for getting shiping sms status
|
141 |
+
*/
|
142 |
+
public function getShipingSmsStatus()
|
143 |
+
{
|
144 |
+
$status = $this->getGeneralConfig('sms/shiping', Mage::app()->getStore()->getStoreId());
|
145 |
+
if (!$status)
|
146 |
+
return false;
|
147 |
+
return $status;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* functions used for getting campaign sms status
|
152 |
+
*/
|
153 |
+
public function getCampaignStatus()
|
154 |
+
{
|
155 |
+
$status = $this->getGeneralConfig('sms/campaign', Mage::app()->getStore()->getStoreId());
|
156 |
+
if (!$status)
|
157 |
+
return false;
|
158 |
+
return $status;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* functions used for getting send sms order subject
|
163 |
+
*/
|
164 |
+
public function getSendSmsOrderSubject()
|
165 |
+
{
|
166 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order', Mage::app()->getStore()->getStoreId());
|
167 |
+
if (!$status)
|
168 |
+
return false;
|
169 |
+
return $status;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* functions used for getting order sms message
|
174 |
+
*/
|
175 |
+
public function getSendSmsmOrderMessage()
|
176 |
+
{
|
177 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order_Message', Mage::app()->getStore()->getStoreId());
|
178 |
+
if (!$status)
|
179 |
+
return false;
|
180 |
+
return $status;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
*functions used for getting send sms shiping subject
|
185 |
+
*/
|
186 |
+
public function getSendSmsShipingSubject()
|
187 |
+
{
|
188 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment', Mage::app()->getStore()->getStoreId());
|
189 |
+
if (!$status)
|
190 |
+
return false;
|
191 |
+
return $status;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
*functions used for getting shiping sms message
|
196 |
+
*/
|
197 |
+
public function getSendSmsShipingMessage()
|
198 |
+
{
|
199 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment_Message', Mage::app()->getStore()->getStoreId());
|
200 |
+
if (!$status)
|
201 |
+
return false;
|
202 |
+
return $status;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* functions used for get api key
|
207 |
+
*/
|
208 |
+
public function getApiKey()
|
209 |
+
{
|
210 |
+
$apikey = $this->getGeneralConfig('api', Mage::app()->getStore()->getStoreId());
|
211 |
+
if (!$apikey)
|
212 |
+
return false;
|
213 |
+
return $apikey;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* functions used for get SMPT password
|
218 |
+
*/
|
219 |
+
public function getSmtpPassword()
|
220 |
+
{
|
221 |
+
$smtpPassword = $this->getSendinSmtpStatus('password', Mage::app()->getStore()->getStoreId());
|
222 |
+
if (!$smtpPassword)
|
223 |
+
return false;
|
224 |
+
return $smtpPassword;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* functions used for get user name
|
229 |
+
*/
|
230 |
+
public function getUserName()
|
231 |
+
{
|
232 |
+
$userName = $this->getSendinSmtpStatus('username', Mage::app()->getStore()->getStoreId());
|
233 |
+
if (!$userName)
|
234 |
+
return false;
|
235 |
+
return $userName;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* functions used for getting smtp status
|
240 |
+
*/
|
241 |
+
public function getSmtpStatus()
|
242 |
+
{
|
243 |
+
$status = $this->getSendinSmtpStatus('status', Mage::app()->getStore()->getStoreId());
|
244 |
+
if (!$status)
|
245 |
+
return false;
|
246 |
+
return $status;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* functions used for getting tracking status
|
251 |
+
*/
|
252 |
+
public function getTrackingStatus()
|
253 |
+
{
|
254 |
+
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
255 |
+
if (!$status) {
|
256 |
+
return false;
|
257 |
+
}
|
258 |
+
return $status;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* functions used for getting tracking status
|
263 |
+
*/
|
264 |
+
public function getTrackingHistoryStatus()
|
265 |
+
{
|
266 |
+
$status = $this->getSendinTrackingHistoryStatus('history', Mage::app()->getStore()->getStoreId());
|
267 |
+
if (!$status) {
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
return $status;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* functions used for getting userlists
|
275 |
+
*/
|
276 |
+
public function getUserlists()
|
277 |
+
{
|
278 |
+
$userlist = $this->getGeneralConfig('list', Mage::app()->getStore()->getStoreId());
|
279 |
+
if (!$userlist)
|
280 |
+
return false;
|
281 |
+
return $userlist;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* functions used for getting importOldSubscribers status
|
286 |
+
*/
|
287 |
+
public function getImportOldSubsStatus()
|
288 |
+
{
|
289 |
+
$importStatus = $this->getGeneralConfig('importOldUserStatus', Mage::app()->getStore()->getStoreId());
|
290 |
+
if (!$importStatus)
|
291 |
+
return false;
|
292 |
+
return $importStatus;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* functions used for get templateid
|
297 |
+
*/
|
298 |
+
public function getTemplateId()
|
299 |
+
{
|
300 |
+
$TemplateId = $this->getGeneralConfig('Sendin_Template_Id', Mage::app()->getStore()->getStoreId());
|
301 |
+
if (!$TemplateId)
|
302 |
+
return false;
|
303 |
+
return $TemplateId;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* functions used for getting general config
|
308 |
+
*/
|
309 |
+
public function getGeneralConfig($field, $store = null)
|
310 |
+
{
|
311 |
+
return Mage::getStoreConfig('sendinblue/'.$field, $store);
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* functions used for get sendinsmtp status
|
316 |
+
*/
|
317 |
+
public function getSendinSmtpStatus($field, $store = null)
|
318 |
+
{
|
319 |
+
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* functions used for get sendinblue email status
|
324 |
+
*/
|
325 |
+
public function getSyncronizeStatus()
|
326 |
+
{
|
327 |
+
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
328 |
+
}
|
329 |
+
/**
|
330 |
+
* functions used for get sendin tracking status
|
331 |
+
*/
|
332 |
+
public function getSendinTrackingCodeStatus($field, $store = null)
|
333 |
+
{
|
334 |
+
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* functions used for get sendin tracking history status
|
339 |
+
*/
|
340 |
+
public function getSendinTrackingHistoryStatus($field, $store = null)
|
341 |
+
{
|
342 |
+
return Mage::getStoreConfig('sendinblue/improt/'.$field, $store);
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* functions used for module functionality
|
347 |
+
*/
|
348 |
+
public function getLists()
|
349 |
+
{
|
350 |
+
return $this->lists();
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* functions used for email adds
|
355 |
+
*/
|
356 |
+
public function emailAdd($email, $extra, $is_subscribed = '')
|
357 |
+
{
|
358 |
+
$attributesName = $this->allAttributesName();
|
359 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
360 |
+
{
|
361 |
+
$apikey = $this->api_key;
|
362 |
+
if (!$apikey)
|
363 |
+
return false;
|
364 |
+
$params = array();
|
365 |
+
$params['email'] = $email;
|
366 |
+
$params['id'] = '';
|
367 |
+
if ($is_subscribed != '')
|
368 |
+
$params['blacklisted'] = 0;
|
369 |
+
|
370 |
+
if ($extra != null)
|
371 |
+
{
|
372 |
+
$key_value = array_keys($attributesName);
|
373 |
+
$attrName = implode('|', $key_value);
|
374 |
+
$params['attributes_name'] = $attrName;
|
375 |
+
$attrValue = implode('|', $extra);
|
376 |
+
$params['attributes_value'] = $attrValue;
|
377 |
+
} else
|
378 |
+
{
|
379 |
+
$params['attributes_value'] = $email;
|
380 |
+
}
|
381 |
+
$params['listid'] = $this->lists_ids;
|
382 |
+
|
383 |
+
return $this->callServer('USERCREADITM', $params);
|
384 |
+
} else
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* functions subscribeuser
|
390 |
+
*/
|
391 |
+
public function emailSubscribe($email)
|
392 |
+
{
|
393 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
394 |
+
{
|
395 |
+
$apikey = $this->api_key;
|
396 |
+
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
397 |
+
$timez = str_replace('Calcutta', 'Kolkata', $timezone);
|
398 |
+
$tm = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
399 |
+
|
400 |
+
if (!$apikey)
|
401 |
+
return false;
|
402 |
+
$data = array();
|
403 |
+
$data['key'] = $apikey;
|
404 |
+
$data['webaction'] = 'UPDATE-USER-SUBSCRIPTION-STATUS';
|
405 |
+
$data['timezone'] = $timez;
|
406 |
+
$data['user_status'] = $email.', '.'1'.', '.$tm;
|
407 |
+
return $this->curlRequest($data);
|
408 |
+
} else
|
409 |
+
return false;
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* functions used for sync data
|
414 |
+
*/
|
415 |
+
public function syncData()
|
416 |
+
{
|
417 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
418 |
+
{
|
419 |
+
$apikey = $this->api_key;
|
420 |
+
if (!$apikey)
|
421 |
+
return false;
|
422 |
+
$params = array();
|
423 |
+
$params['listids'] = str_replace(',', '|', $this->lists_ids);
|
424 |
+
$response = $this->callServer('DISPLAYLISTDATABLACK', $params);
|
425 |
+
$result_arr = $response->result;
|
426 |
+
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()->showCustomerInfo()->toArray();
|
427 |
+
$subscriber_data = $collection['items'];
|
428 |
+
$emails = array();
|
429 |
+
$subscriber_data_email = array();
|
430 |
+
foreach($subscriber_data as $s)
|
431 |
+
{
|
432 |
+
$subscriber_data_email[$s['subscriber_email']] = $s;
|
433 |
+
}
|
434 |
+
|
435 |
+
if (count($result_arr) > 0)
|
436 |
+
{
|
437 |
+
$newsletterSub = Mage::getModel('newsletter/subscriber');
|
438 |
+
foreach ($result_arr as $key => $value)
|
439 |
+
{
|
440 |
+
foreach ($value as $user_data)
|
441 |
+
{
|
442 |
+
if(isset($subscriber_data_email[$user_data->email]))
|
443 |
+
{
|
444 |
+
// on a trouvé le subscriber magento
|
445 |
+
$data = $subscriber_data_email[$user_data->email];
|
446 |
+
$temp_sub_status = ($data['subscriber_status'] == 3) ? 1 : 0;
|
447 |
+
if ($temp_sub_status != $user_data->blacklisted)
|
448 |
+
{
|
449 |
+
$emails[] = $data['subscriber_email'];
|
450 |
+
$subscribe_data['subscriber_id'] = $data['subscriber_id'];
|
451 |
+
$subscribe_data['subscriber_status'] = ($user_data->blacklisted == 1)?3:1;
|
452 |
+
$costomer_data = $newsletterSub->loadByEmail($data['subscriber_email']);
|
453 |
+
$costomer_data->setStatus($subscribe_data['subscriber_status']);
|
454 |
+
$costomer_data->setIsStatusChanged(true);
|
455 |
+
$costomer_data->save();
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
if (count($emails) > 0)
|
462 |
+
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
463 |
+
else
|
464 |
+
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
465 |
+
return true;
|
466 |
+
}
|
467 |
+
else
|
468 |
+
return false;
|
469 |
+
}
|
470 |
+
/**
|
471 |
+
* This method is used for add email list
|
472 |
+
*/
|
473 |
+
public function addEmailList($email)
|
474 |
+
{
|
475 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
476 |
+
{
|
477 |
+
$apikey = $this->api_key;
|
478 |
+
if (!$apikey)
|
479 |
+
return false;
|
480 |
+
$params = array();
|
481 |
+
$params['email'] = $email;
|
482 |
+
$params['id'] = '';
|
483 |
+
$params['blacklisted'] = 0;
|
484 |
+
$params['attributes_name'] = '';
|
485 |
+
$params['attributes_value'] = '';
|
486 |
+
$params['listid'] = $this->lists_ids;
|
487 |
+
return $this->callServer('USERCREADITM', $params);
|
488 |
+
} else
|
489 |
+
return false;
|
490 |
+
}
|
491 |
+
/**
|
492 |
+
* This method is used used for email unsubscribe
|
493 |
+
*/
|
494 |
+
public function emailDelete($email)
|
495 |
+
{
|
496 |
+
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
497 |
+
{
|
498 |
+
$apikey = $this->api_key;
|
499 |
+
if (!$apikey)
|
500 |
+
return false;
|
501 |
+
$params = array();
|
502 |
+
$params['email'] = $email;
|
503 |
+
$params['listid'] = $this->lists_ids;
|
504 |
+
return $this->callServer('UNSUBAPI', $params);
|
505 |
+
} else
|
506 |
+
return false;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* This method is used used for check api status
|
511 |
+
*/
|
512 |
+
public function checkApikey($api_key)
|
513 |
+
{
|
514 |
+
$params['key'] = $api_key;
|
515 |
+
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
516 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
517 |
+
return $lists['error'] = $response->errorMsg;
|
518 |
+
}
|
519 |
+
|
520 |
+
/**
|
521 |
+
* functions used for smtp details and order tracking
|
522 |
+
*/
|
523 |
+
public function SmtpDetailsWithTracking()
|
524 |
+
{
|
525 |
+
$params['key'] = $this->api_key;
|
526 |
+
$response = $this->callServer('TRACKINGDATA', $params);
|
527 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
528 |
+
{
|
529 |
+
$tracking['error'] = $response->errorMsg;
|
530 |
+
return $tracking;
|
531 |
+
}
|
532 |
+
return $response;
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Fetches all the list of the user from the Sendinblue platform.
|
537 |
+
*/
|
538 |
+
public function lists($filters = array())
|
539 |
+
{
|
540 |
+
$params = array();
|
541 |
+
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
542 |
+
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
543 |
+
{
|
544 |
+
$this->error_message = $response->errorMsg;
|
545 |
+
$lists['error'] = $response->errorMsg;
|
546 |
+
} else
|
547 |
+
{
|
548 |
+
$i = 0;
|
549 |
+
$lists = array();
|
550 |
+
foreach ($response->result as $list_data)
|
551 |
+
{
|
552 |
+
$lists[$i]['id'] = $list_data->id;
|
553 |
+
$lists[$i]['name'] = $list_data->name;
|
554 |
+
$i++;
|
555 |
+
}
|
556 |
+
}
|
557 |
+
return $lists;
|
558 |
+
}
|
559 |
+
|
560 |
+
/**
|
561 |
+
* Fetches the list status of the user from the Sendinblue platform.
|
562 |
+
*/
|
563 |
+
public function getUserListStats()
|
564 |
+
{
|
565 |
+
if ($this->module_enable == 1)
|
566 |
+
{
|
567 |
+
$params = array();
|
568 |
+
$params['list'] = 'ALL';
|
569 |
+
return $this->callServer('DISPLAYLISTDATA', $params);
|
570 |
+
} else
|
571 |
+
return Mage::getSingleton('core/session')->addError('Sendinblue not enabled');
|
572 |
+
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Fetches all folders and all list within each folder of the user's Sendinblue
|
576 |
+
* account and displays them to the user.
|
577 |
+
*/
|
578 |
+
public function checkFolderList()
|
579 |
+
{
|
580 |
+
$params = array();
|
581 |
+
$array = array();
|
582 |
+
$list_response = $this->callServer('DISPLAY-FOLDERS-LISTS', $params);
|
583 |
+
$list_response = json_encode($list_response);
|
584 |
+
$res = json_decode($list_response, true);
|
585 |
+
if (isset($res) && !empty($res))
|
586 |
+
{
|
587 |
+
foreach ($res as $key => $value)
|
588 |
+
{
|
589 |
+
if (strtolower($value['name']) == 'magento')
|
590 |
+
{
|
591 |
+
$array[] = $key;
|
592 |
+
$array[] = $value['name'];
|
593 |
+
}
|
594 |
+
if (!empty($value['lists']))
|
595 |
+
{
|
596 |
+
foreach ($value['lists'] as $val)
|
597 |
+
{
|
598 |
+
if (strtolower($val['name']) == 'magento')
|
599 |
+
$array[] = $val['name'];
|
600 |
+
}
|
601 |
+
}
|
602 |
+
}
|
603 |
+
}
|
604 |
+
return $array;
|
605 |
+
}
|
606 |
+
|
607 |
+
/**
|
608 |
+
* folder create in Sendinblue after removing from Sendinblue
|
609 |
+
*/
|
610 |
+
public function createFolderCaseTwo()
|
611 |
+
{
|
612 |
+
$apikey = $this->api_key;
|
613 |
+
if($apikey == '')
|
614 |
+
return false;
|
615 |
+
$response = $this->checkApikey($apikey); // check api key is valid or not
|
616 |
+
if ($this->module_enable != 1 && $apikey == '' && $response['error'] != '' && $this->getSyncronizeStatus())
|
617 |
+
return false;
|
618 |
+
$result = $this->checkFolderList();
|
619 |
+
$list_name = 'magento';
|
620 |
+
$param = array();
|
621 |
+
$data = array();
|
622 |
+
$folder_id = $result[0];
|
623 |
+
$exist_list = $result[2];
|
624 |
+
if (empty($result[1]))
|
625 |
+
{
|
626 |
+
$params = array();
|
627 |
+
$params['foldername'] = 'magento';
|
628 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
629 |
+
$folder_id = $res->folder_id;
|
630 |
+
$params = array();
|
631 |
+
$params['listname'] = $list_name;
|
632 |
+
$params['list_parent'] = $folder_id; //folder id
|
633 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
634 |
+
$this->sendAllMailIDToSendin($list_response);
|
635 |
+
} elseif (empty($exist_list))
|
636 |
+
{
|
637 |
+
$params = array();
|
638 |
+
$params['listname'] = $list_name;
|
639 |
+
$params['list_parent'] = $folder_id; //folder id
|
640 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
641 |
+
$this->sendAllMailIDToSendin($list_response);
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* folder create in Sendinblue after installing
|
647 |
+
*/
|
648 |
+
public function createFolderName($api_key)
|
649 |
+
{
|
650 |
+
$this->api_key = $api_key;
|
651 |
+
$this->createAttributesName();
|
652 |
+
$result = $this->checkFolderList();
|
653 |
+
if (empty($result[1]))
|
654 |
+
{
|
655 |
+
$params = array();
|
656 |
+
$params['foldername'] = 'magento';
|
657 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
658 |
+
$folder_id = $res->folder_id;
|
659 |
+
$exist_list = '';
|
660 |
+
} else
|
661 |
+
{
|
662 |
+
$folder_id = $result[0];
|
663 |
+
$exist_list = $result[2];
|
664 |
+
}
|
665 |
+
$this->createNewList($folder_id, $exist_list);
|
666 |
+
$this->partnerMagento();
|
667 |
+
}
|
668 |
+
|
669 |
+
/**
|
670 |
+
* Method is used to add the partner's name in Sendinblue.
|
671 |
+
* In this case its "MAGENTO".
|
672 |
+
*/
|
673 |
+
public function partnerMagento()
|
674 |
+
{
|
675 |
+
$params = array();
|
676 |
+
$params['partner'] = 'MAGENTO';
|
677 |
+
$this->callServer('MAILIN-PARTNER', $params);
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Creates a list by the name "magento" on user's Sendinblue account.
|
682 |
+
*/
|
683 |
+
public function createNewList($response, $exist_list)
|
684 |
+
{
|
685 |
+
if ($exist_list != '')
|
686 |
+
{
|
687 |
+
$date = date('dmY');
|
688 |
+
$list_name = 'magento_'.$date;
|
689 |
+
}
|
690 |
+
else
|
691 |
+
$list_name = 'magento';
|
692 |
+
$params = array();
|
693 |
+
$params['listname'] = $list_name;
|
694 |
+
$params['list_parent'] = $response;
|
695 |
+
$list_response = $this->callServer('NEWLIST', $params);
|
696 |
+
$this->sendAllMailIDToSendin($list_response);
|
697 |
+
$this->createAttributesName();
|
698 |
+
}
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Fetch attributes and their values
|
702 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
703 |
+
*/
|
704 |
+
public function allAttributesName()
|
705 |
+
{
|
706 |
+
if ($this->user_language == 'fr')
|
707 |
+
$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');
|
708 |
+
else
|
709 |
+
$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');
|
710 |
+
return $params;
|
711 |
+
}
|
712 |
+
|
713 |
+
/**
|
714 |
+
* Fetch attributes name and type
|
715 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
716 |
+
*/
|
717 |
+
public function allAttributesType()
|
718 |
+
{
|
719 |
+
if ($this->user_language == 'fr')
|
720 |
+
$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');
|
721 |
+
else
|
722 |
+
$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');
|
723 |
+
return $params;
|
724 |
+
}
|
725 |
+
|
726 |
+
/**
|
727 |
+
* Fetch all Transactional Attributes
|
728 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
729 |
+
*/
|
730 |
+
public function allTransactionalAttributes()
|
731 |
+
{
|
732 |
+
$params = array('ORDER_ID'=>'id', 'ORDER_DATE'=>'date', 'ORDER_PRICE'=>'number');
|
733 |
+
return $params;
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Create Normal, Transactional, Calculated and Global attributes and their values
|
738 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
739 |
+
*/
|
740 |
+
public function createAttributesName()
|
741 |
+
{
|
742 |
+
$params = array();
|
743 |
+
$attrData = array();
|
744 |
+
$transData = array();
|
745 |
+
$attributesName = $this->allAttributesName();
|
746 |
+
$attributesType = $this->allAttributesType();
|
747 |
+
$tranArray = $this->allTransactionalAttributes();
|
748 |
+
$keyValue = array_keys($attributesName);
|
749 |
+
foreach ($keyValue as $value)
|
750 |
+
{
|
751 |
+
$attr = $attributesType[$value];
|
752 |
+
$attrData[] = $value.','.$attr;
|
753 |
+
}
|
754 |
+
$normalAttributes = implode('|', $attrData);
|
755 |
+
$tranKey = array_keys($tranArray);
|
756 |
+
$params['normal_attributes'] = $normalAttributes;
|
757 |
+
foreach ($tranKey as $value)
|
758 |
+
{
|
759 |
+
$attr = $tranArray[$value];
|
760 |
+
$transData[] = $value.','.$attr;
|
761 |
+
}
|
762 |
+
$transAttributes = implode('|', $transData);
|
763 |
+
$params['transactional_attributes'] = $transAttributes;
|
764 |
+
$this->callServer('ATTRIBUTES_CREATION', $params);
|
765 |
+
}
|
766 |
+
/**
|
767 |
+
* Method is used to send all the subscribers from magento to
|
768 |
+
* Sendinblue for adding / updating purpose.
|
769 |
+
*/
|
770 |
+
public function sendAllMailIDToSendin($list)
|
771 |
+
{
|
772 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
773 |
+
$allemail = $this->getcustomers();
|
774 |
+
if ($allemail > 0)
|
775 |
+
{
|
776 |
+
$params = array();
|
777 |
+
$params['webaction'] = 'IMPORTUSERS';
|
778 |
+
$params['key'] = $this->api_key;
|
779 |
+
$params['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
780 |
+
$params['listids'] = $list->result;
|
781 |
+
$params['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
782 |
+
$responce_data = $this->curlRequestAsyc($params);
|
783 |
+
$res_value = json_decode($responce_data);
|
784 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 0, 'default', 0);
|
785 |
+
if (empty($res_value->process_id))
|
786 |
+
{
|
787 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 1);
|
788 |
+
}
|
789 |
+
}
|
790 |
+
$sendin_switch->saveConfig('sendinblue/list', $list->result, 'default', 0);
|
791 |
+
}
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Send SMS from Sendin.
|
795 |
+
*/
|
796 |
+
public function sendSmsApi($array)
|
797 |
+
{
|
798 |
+
$params = array();
|
799 |
+
$params['key'] = $this->api_key;
|
800 |
+
$params['to'] = $array['to'];
|
801 |
+
$params['from'] = $array['from'];
|
802 |
+
$params['text'] = $array['text'];
|
803 |
+
return $this->callServer('SENDSMS', $params);
|
804 |
+
}
|
805 |
+
|
806 |
+
public function sendOrder($mobile)
|
807 |
+
{
|
808 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
809 |
+
if (isset($mobile))
|
810 |
+
{
|
811 |
+
$arr = array();
|
812 |
+
$arr['to'] = $mobile;
|
813 |
+
$arr['from'] = $this->getSendSmsOrderSubject();
|
814 |
+
$arr['text'] = $this->getSendSmsmOrderMessage();
|
815 |
+
|
816 |
+
return $result = $this->sendSmsApi($arr);
|
817 |
+
}
|
818 |
+
}
|
819 |
+
|
820 |
+
public function notifySmsEmail()
|
821 |
+
{
|
822 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
823 |
+
|
824 |
+
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->module_enable == 1 && $this->getNotifySmsStatus() == 1)
|
825 |
+
{
|
826 |
+
if($this->getNotifyCronStatus() == 0)
|
827 |
+
{
|
828 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
829 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
830 |
+
$email_template_variables = array();
|
831 |
+
if ($locale == 'fr_FR')
|
832 |
+
{
|
833 |
+
$email_template_variables['text0'] = ' [SendinBlue] Alerte: Vos crédits SMS seront bientôt épuisés';
|
834 |
+
$sender_name = 'SendinBlue';
|
835 |
+
$sender_email = 'contact@sendinblue.com';
|
836 |
+
}
|
837 |
+
else
|
838 |
+
{
|
839 |
+
$email_template_variables['text0'] = '[SendinBlue] Alert: You do not have enough credits SMS';
|
840 |
+
$sender_name = 'SendinBlue';
|
841 |
+
$sender_email = 'contact@sendinblue.com';
|
842 |
+
}
|
843 |
+
$email = $this->getNotifyEmailStatus();
|
844 |
+
|
845 |
+
$email_template = Mage::getModel('core/email_template')->loadDefault('notification_template');
|
846 |
+
$temp = $email_template->template_text;
|
847 |
+
$web_site = Mage::app()->getWebsite()->getName();
|
848 |
+
$credit = $this->getSmsCredit();
|
849 |
+
preg_match_all('#{(.*)}#', $temp, $match);
|
850 |
+
|
851 |
+
$temp_params = array(
|
852 |
+
'{site_name}'=>$web_site,
|
853 |
+
'{present_credit}'=>$credit
|
854 |
+
);
|
855 |
+
foreach($match[0] as $var=>$value){
|
856 |
+
$temp = preg_replace('#'.$value.'#',$temp_params[$value],$temp);
|
857 |
+
}
|
858 |
+
$email_template->template_text = $temp;
|
859 |
+
$email_template->getProcessedTemplate($email_template_variables);
|
860 |
+
$email_template->setSenderName($sender_name);
|
861 |
+
$email_template->setSenderEmail($sender_email);
|
862 |
+
$email_template->setTemplateSubject($email_template_variables['text0']);
|
863 |
+
$email_template->send($email, '', $email_template_variables);
|
864 |
+
}
|
865 |
+
}
|
866 |
+
else
|
867 |
+
{
|
868 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
869 |
+
}
|
870 |
+
|
871 |
+
Mage::getSingleton('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
872 |
+
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* show SMS credit from Sendinblue.
|
876 |
+
*/
|
877 |
+
public function getSmsCredit()
|
878 |
+
{
|
879 |
+
$params = array();
|
880 |
+
$params['key'] = $this->api_key;
|
881 |
+
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
882 |
+
|
883 |
+
foreach($result as $val)
|
884 |
+
{
|
885 |
+
if(is_object($val)){
|
886 |
+
if($val->plan_type=='SMS')
|
887 |
+
{
|
888 |
+
return $val->credits;
|
889 |
+
}
|
890 |
+
}
|
891 |
+
}
|
892 |
+
}
|
893 |
+
|
894 |
+
/**
|
895 |
+
* Method is used to send test email to the user.
|
896 |
+
*/
|
897 |
+
public function sendTestMail($email)
|
898 |
+
{
|
899 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
900 |
+
$email_template_variables = array();
|
901 |
+
if ($locale == 'fr_FR')
|
902 |
+
{
|
903 |
+
$email_template_variables['text0'] = '[SendinBlue SMTP] e-mail de test';
|
904 |
+
$sender_name = 'SendinBlue';
|
905 |
+
$sender_email = 'contact@sendinblue.com';
|
906 |
+
}
|
907 |
+
else
|
908 |
+
{
|
909 |
+
$email_template_variables['text0'] = '[SendinBlue SMTP] test email';
|
910 |
+
$sender_name = 'SendinBlue';
|
911 |
+
$sender_email = 'contact@sendinblue.com';
|
912 |
+
}
|
913 |
+
try {
|
914 |
+
$email_template = Mage::getModel('core/email_template')->loadDefault('custom_template');
|
915 |
+
$email_template->getProcessedTemplate($email_template_variables);
|
916 |
+
$email_template->setSenderName($sender_name);
|
917 |
+
$email_template->setSenderEmail($sender_email);
|
918 |
+
$email_template->setTemplateSubject($email_template_variables['text0']);
|
919 |
+
return $email_template->send($email, '', $email_template_variables);
|
920 |
+
}
|
921 |
+
catch(Exception $e) {
|
922 |
+
|
923 |
+
}
|
924 |
+
}
|
925 |
+
|
926 |
+
/**
|
927 |
+
* This method is used to compare key and value
|
928 |
+
* return all value in array whose present in array key
|
929 |
+
*/
|
930 |
+
public function merge_my_array($one, $two)
|
931 |
+
{
|
932 |
+
$resArr = array();
|
933 |
+
if (count($one) > 0) {
|
934 |
+
foreach($one as $k => $v) {
|
935 |
+
$resArr[$k] = isset($two[$v])?$two[$v]:'';
|
936 |
+
}
|
937 |
+
}
|
938 |
+
return $resArr;
|
939 |
+
}
|
940 |
+
|
941 |
+
/**
|
942 |
+
* This method is used to fetch all users from the default customer table to list
|
943 |
+
* them in the Sendinblue magento module.
|
944 |
+
*/
|
945 |
+
public function getcustomers()
|
946 |
+
{
|
947 |
+
$data = array();
|
948 |
+
$customer_addr_data = array();
|
949 |
+
$attributesName = $this->allAttributesName();
|
950 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
951 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
952 |
+
foreach ($collection as $customer)
|
953 |
+
{
|
954 |
+
$start_detail = array();
|
955 |
+
$resp = array();
|
956 |
+
$respone = array();
|
957 |
+
|
958 |
+
$respone = $customer->getData();
|
959 |
+
$email = $respone['email'];
|
960 |
+
$cid = $respone['entity_id'];
|
961 |
+
$user_lang = $respone['created_in'];
|
962 |
+
|
963 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$cid);
|
964 |
+
$telephone = '';
|
965 |
+
$customer_addr = array();
|
966 |
+
foreach ($collectionAddress as $customerPhno) {
|
967 |
+
$customer_addr = $customerPhno->getData();
|
968 |
+
$customer_addr['client'] = $cid>0?1:0;
|
969 |
+
}
|
970 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
971 |
+
}
|
972 |
+
$newsletterArr = array();
|
973 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
974 |
+
$cnt = 0;
|
975 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
976 |
+
{
|
977 |
+
$subsdata = $subscriber->getData();
|
978 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
979 |
+
|
980 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
981 |
+
$customer_addr_data[$subscriber_email]['email'] = $subscriber_email;
|
982 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
983 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
984 |
+
}
|
985 |
+
else
|
986 |
+
{
|
987 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
988 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
989 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
990 |
+
}
|
991 |
+
$cnt++;
|
992 |
+
}
|
993 |
+
|
994 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
995 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
996 |
+
|
997 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
998 |
+
$key_value = array_keys($attributesName);
|
999 |
+
$key_value[] = 'EMAIL';
|
1000 |
+
fwrite($handle, implode(',', $key_value)."\n");
|
1001 |
+
|
1002 |
+
foreach ($resp as $newsdata)
|
1003 |
+
{
|
1004 |
+
if(!empty($newsdata['COUNTRY_ID']) && !empty($newsdata['SMS']))
|
1005 |
+
{
|
1006 |
+
$country_id = $this->getCountryCode($newsdata['COUNTRY_ID']);
|
1007 |
+
$newsdata['SMS'] = $this->checkMobileNumber($newsdata['SMS'], $country_id);
|
1008 |
+
}
|
1009 |
+
$key_value = $newsdata;
|
1010 |
+
fwrite($handle, implode(',', $key_value)."\n");
|
1011 |
+
}
|
1012 |
+
fclose($handle);
|
1013 |
+
$total_value = count($resp);
|
1014 |
+
return $total_value;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/**
|
1018 |
+
* This method is used to fetch all users from the default newsletter table to list
|
1019 |
+
* them in the Sendinblue magento module.
|
1020 |
+
*/
|
1021 |
+
public function getNewsletterSubscribe($start, $per_page)
|
1022 |
+
{
|
1023 |
+
$customer_addr_data = array();
|
1024 |
+
$attributesName = $this->allAttributesName();
|
1025 |
+
$attributesName['email'] = 'email';
|
1026 |
+
$attributesName['customer_id'] = 'entity_id';
|
1027 |
+
|
1028 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
1029 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1030 |
+
foreach ($collection as $customer)
|
1031 |
+
{
|
1032 |
+
$start_detail = array();
|
1033 |
+
$respone = array();
|
1034 |
+
$respone = $customer->getData();
|
1035 |
+
$email = $respone['email'];
|
1036 |
+
$cid = $respone['entity_id'];
|
1037 |
+
$user_lang = $respone['created_in'];
|
1038 |
+
|
1039 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
1040 |
+
$telephone = '';
|
1041 |
+
$customer_addr = array();
|
1042 |
+
foreach ($collectionAddress as $customerPhno) {
|
1043 |
+
$customer_addr = $customerPhno->getData();
|
1044 |
+
if (!empty($customer_addr['telephone']) && !empty($customer_addr['country_id']))
|
1045 |
+
{
|
1046 |
+
$country_code = $this->getCountryCode($customer_addr['country_id']);
|
1047 |
+
$customer_addr['telephone'] = $this->checkMobileNumber($customer_addr['telephone'], $country_code);
|
1048 |
+
}
|
1049 |
+
$customer_addr['client'] = $cid>0?1:0;
|
1050 |
+
}
|
1051 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
$newsletterArr = array();
|
1055 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
1056 |
+
$cnt = 0;
|
1057 |
+
$resp = array();
|
1058 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
1059 |
+
{
|
1060 |
+
$subsdata = $subscriber->getData();
|
1061 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
1062 |
+
$subscriber_status = $subsdata['subscriber_status'];
|
1063 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
1064 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
1065 |
+
unset($customer_addr_data[$subscriber_email]);
|
1066 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1067 |
+
$resp[$cnt]['email'] = $subscriber_email;
|
1068 |
+
}
|
1069 |
+
else
|
1070 |
+
{
|
1071 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
1072 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
1073 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1074 |
+
$resp[$cnt]['email'] = $subscriber_email;
|
1075 |
+
}
|
1076 |
+
$cnt++;
|
1077 |
+
}
|
1078 |
+
if (count($customer_addr_data) > 0) {
|
1079 |
+
foreach ($customer_addr_data as $email => $cVal) {
|
1080 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $cVal);
|
1081 |
+
$resp[$cnt]['subscriber_status'] = 3;
|
1082 |
+
$resp[$cnt]['email'] = $email;
|
1083 |
+
|
1084 |
+
$cnt++;
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
return array_slice($resp, $start, $per_page, true);
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
/**
|
1091 |
+
* This method is used to fetch total count unsubscribe users from the default newsletter table to list
|
1092 |
+
* them in the Sendinblue magento module.
|
1093 |
+
*/
|
1094 |
+
public function getNewsletterUnSubscribeCount()
|
1095 |
+
{
|
1096 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1097 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
1098 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1099 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableCustomer.' CE
|
1100 |
+
LEFT JOIN '.$tableNewsletter.' NS
|
1101 |
+
ON CE.entity_id=NS.customer_id WHERE subscriber_status != 1 or subscriber_status is null';
|
1102 |
+
$unsubs_count1 = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1103 |
+
|
1104 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableNewsletter.' WHERE customer_id = 0 AND subscriber_status = 3';
|
1105 |
+
$unsubs_count2 = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1106 |
+
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
/**
|
1110 |
+
* This method is used to fetch total count subscribe users from the default newsletter table to list
|
1111 |
+
* them in the Sendinblue magento module.
|
1112 |
+
*/
|
1113 |
+
public function getNewsletterSubscribeCount()
|
1114 |
+
{
|
1115 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1116 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1117 |
+
$sql = 'SELECT count(*) as totalvalue from '.$tableNewsletter.' where subscriber_status = 1';
|
1118 |
+
$data = $coreResource->getConnection('core_read')->fetchRow($sql);
|
1119 |
+
return $data['totalvalue'];
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
/**
|
1123 |
+
* This method is used to check the subscriber's newsletter subscription status in Sendinblue
|
1124 |
+
*/
|
1125 |
+
public function checkUserSendinStatus($result)
|
1126 |
+
{
|
1127 |
+
$userstatus = array();
|
1128 |
+
foreach ($result as $subscriber)
|
1129 |
+
$userstatus[] = $subscriber['email'];
|
1130 |
+
$email = implode(',', $userstatus);
|
1131 |
+
$params = array();
|
1132 |
+
$params['key'] = $this->api_key;
|
1133 |
+
$params['email'] = $email;
|
1134 |
+
$response = $this->callServer('USERS-STATUS-BLACKLIST', $params);
|
1135 |
+
$response = json_encode($response);
|
1136 |
+
return json_decode($response, true);
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
/**
|
1140 |
+
* Fetches the SMTP and order tracking details
|
1141 |
+
*/
|
1142 |
+
public function TrackingSmtp()
|
1143 |
+
{
|
1144 |
+
$params = array();
|
1145 |
+
$params['key'] = $this->api_key;
|
1146 |
+
return $this->callServer('TRACKINGDATA', $params);
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
/**
|
1150 |
+
* CURL function to send request to the Sendinblue API server
|
1151 |
+
*/
|
1152 |
+
public function callServer($method, $params)
|
1153 |
+
{
|
1154 |
+
$host = $this->api_url;
|
1155 |
+
$params['key'] = (isset($params['key']) && !empty($params['key'])) ? $params['key'] : $this->api_key;
|
1156 |
+
$params['webaction'] = $method;
|
1157 |
+
$this->error_message = '';
|
1158 |
+
$this->error_code = '';
|
1159 |
+
$response = $this->curlRequest($params);
|
1160 |
+
return json_decode($response);
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
/**
|
1164 |
+
* CURL function to send request to the Sendinblue API server
|
1165 |
+
*/
|
1166 |
+
public function curlRequest($data)
|
1167 |
+
{
|
1168 |
+
$url = $this->api_url; // WS URL
|
1169 |
+
$ch = curl_init();
|
1170 |
+
$ndata = '';
|
1171 |
+
$data['source'] = 'MagentoNew';
|
1172 |
+
if (is_array($data))
|
1173 |
+
{
|
1174 |
+
foreach ($data as $key => $value)
|
1175 |
+
$ndata .= $key.'='.urlencode($value).'&';
|
1176 |
+
}
|
1177 |
+
else
|
1178 |
+
$ndata = $data;
|
1179 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1180 |
+
'Expect:'
|
1181 |
+
));
|
1182 |
+
|
1183 |
+
$ndata = trim($ndata,'&');
|
1184 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1185 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
1186 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1187 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1188 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1189 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1190 |
+
$data2 = curl_exec($ch);
|
1191 |
+
curl_close($ch);
|
1192 |
+
return $data2;
|
1193 |
+
}
|
1194 |
+
/**
|
1195 |
+
* CURL function to send request to the Sendinblue API server
|
1196 |
+
*/
|
1197 |
+
public function curlRequestAsyc($data)
|
1198 |
+
{
|
1199 |
+
$url = $this->api_url; // WS URL
|
1200 |
+
$ch = curl_init();
|
1201 |
+
$ndata = '';
|
1202 |
+
$data['source'] = 'MagentoNew';
|
1203 |
+
if (is_array($data))
|
1204 |
+
{
|
1205 |
+
foreach ($data as $key => $value)
|
1206 |
+
$ndata .= $key.'='.urlencode($value).'&';
|
1207 |
+
}
|
1208 |
+
else
|
1209 |
+
$ndata = $data;
|
1210 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1211 |
+
'Expect:'
|
1212 |
+
));
|
1213 |
+
|
1214 |
+
$ndata = trim($ndata,'&');
|
1215 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1216 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
1217 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1218 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1219 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
|
1220 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1221 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1222 |
+
$data2 = curl_exec($ch);
|
1223 |
+
curl_close($ch);
|
1224 |
+
return $data2;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
public function removeOldEntry()
|
1228 |
+
{
|
1229 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
1230 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', '');
|
1231 |
+
$sendin_switch->saveConfig('sendinblue/smtp/authentication', '');
|
1232 |
+
$sendin_switch->saveConfig('sendinblue/smtp/username', '');
|
1233 |
+
$sendin_switch->saveConfig('sendinblue/smtp/password', '');
|
1234 |
+
$sendin_switch->saveConfig('sendinblue/smtp/host', '');
|
1235 |
+
$sendin_switch->saveConfig('sendinblue/smtp/port', '');
|
1236 |
+
$sendin_switch->saveConfig('sendinblue/smtp/ssl', '');
|
1237 |
+
$sendin_switch->saveConfig('sendinblue/smtp/option', '');
|
1238 |
+
$sendin_switch->saveConfig('sendinblue/tracking/code', '');
|
1239 |
+
}
|
1240 |
+
protected function _uninstallResourceDb($version)
|
1241 |
+
{
|
1242 |
+
Mage::dispatchEvent('module_uninstall', array('resource' => $this->_resourceName));
|
1243 |
+
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1244 |
+
return $this;
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
/**
|
1248 |
+
* This method is used to fetch all subscribe users from the default customer table to list
|
1249 |
+
* them in the Sendinblue magento module.
|
1250 |
+
*/
|
1251 |
+
public function smsCampaignList()
|
1252 |
+
{
|
1253 |
+
$customer_addr_data = array();
|
1254 |
+
$attributesName = $this->allAttributesName();
|
1255 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
1256 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1257 |
+
foreach ($collection as $customer)
|
1258 |
+
{
|
1259 |
+
$start_detail = array();
|
1260 |
+
$resp = array();
|
1261 |
+
$respone = array();
|
1262 |
+
|
1263 |
+
$respone = $customer->getData();
|
1264 |
+
$email = $respone['email'];
|
1265 |
+
$cid = $respone['entity_id'];
|
1266 |
+
$user_lang = $respone['created_in'];
|
1267 |
+
|
1268 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$cid);
|
1269 |
+
$telephone = '';
|
1270 |
+
$customer_addr = array();
|
1271 |
+
foreach ($collectionAddress as $customerPhno) {
|
1272 |
+
$customer_addr = $customerPhno->getData();
|
1273 |
+
if (!empty($customer_addr['telephone']) && !empty($customer_addr['country_id']))
|
1274 |
+
{
|
1275 |
+
$country_code = $this->getCountryCode($customer_addr['country_id']);
|
1276 |
+
$customer_addr['telephone'] = $this->checkMobileNumber($customer_addr['telephone'], $country_code);
|
1277 |
+
}
|
1278 |
+
$customer_addr['client'] = $cid>0?1:0;
|
1279 |
+
}
|
1280 |
+
$customer_addr_data[$email] = array_merge($respone, $customer_addr);
|
1281 |
+
}
|
1282 |
+
$newsletterArr = array();
|
1283 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
1284 |
+
$cnt = 0;
|
1285 |
+
foreach ( $newsletter->getItems() as $subscriber)
|
1286 |
+
{
|
1287 |
+
$subsdata = $subscriber->getData();
|
1288 |
+
$subscriber_email = $subsdata['subscriber_email'];
|
1289 |
+
$subscriber_status = $subsdata['subscriber_status'];
|
1290 |
+
if ( !empty($customer_addr_data[$subscriber_email]) ) {
|
1291 |
+
$customer_addr_data[$subscriber_email]['email'] = $subscriber_email;
|
1292 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $customer_addr_data[$subscriber_email]);
|
1293 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1294 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1295 |
+
}
|
1296 |
+
else
|
1297 |
+
{
|
1298 |
+
$newsletterArr['client'] = $subsdata['customer_id']>0?1:0;
|
1299 |
+
$resp[$cnt] = $this->merge_my_array($attributesName, $newsletterArr);
|
1300 |
+
$resp[$cnt]['EMAIL'] = $subscriber_email;
|
1301 |
+
$resp[$cnt]['subscriber_status'] = $subscriber_status;
|
1302 |
+
}
|
1303 |
+
$cnt++;
|
1304 |
+
}
|
1305 |
+
$i = 0;
|
1306 |
+
$data = array();
|
1307 |
+
foreach($resp as $result)
|
1308 |
+
{
|
1309 |
+
if(!empty($result['SMS']))
|
1310 |
+
{
|
1311 |
+
$data[$i]= $result;
|
1312 |
+
}
|
1313 |
+
$i++;
|
1314 |
+
}
|
1315 |
+
return json_encode($data);
|
1316 |
+
}
|
1317 |
+
/**
|
1318 |
+
* API config value from SendinBlue.
|
1319 |
+
*/
|
1320 |
+
public function getApiConfigValue()
|
1321 |
+
{
|
1322 |
+
$data = array();
|
1323 |
+
$data['key'] = $this->api_key;
|
1324 |
+
$data['webaction'] = 'PLUGIN-CONFIG';
|
1325 |
+
$value_config = $this->curlRequest($data);
|
1326 |
+
$result = json_decode($value_config);
|
1327 |
+
return $result;
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
/**
|
1331 |
+
* Send template email by sendinblue for newsletter subscriber user .
|
1332 |
+
*/
|
1333 |
+
public function sendWsTemplateMail($to)
|
1334 |
+
{
|
1335 |
+
$mail_url = "http://mysmtp.mailin.fr/ws/template/"; //Curl url
|
1336 |
+
|
1337 |
+
$smtpPassword = $this->getSmtpPassword();
|
1338 |
+
$user = $this->getUserName();
|
1339 |
+
$to = str_replace('+', '%2B', $to);
|
1340 |
+
$temp_id_value = $this->getTemplateId();
|
1341 |
+
$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.
|
1342 |
+
|
1343 |
+
$post_data['to'] = $to;
|
1344 |
+
$post_data['key'] = $smtpPassword;
|
1345 |
+
$post_data['user'] = $user;
|
1346 |
+
$post_data['templateid'] = $templateid;
|
1347 |
+
$post_data = http_build_query($post_data);
|
1348 |
+
$ch = curl_init();
|
1349 |
+
|
1350 |
+
curl_setopt ($ch, CURLOPT_POST, 1);
|
1351 |
+
curl_setopt ($ch, CURLOPT_URL, $mail_url);
|
1352 |
+
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
|
1353 |
+
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
|
1354 |
+
$return_data = curl_exec ($ch);
|
1355 |
+
curl_close ($ch);
|
1356 |
+
|
1357 |
+
$res = json_decode($return_data, true);
|
1358 |
+
return $res;
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
/**
|
1362 |
+
* Get all temlpate list id by sendinblue.
|
1363 |
+
*/
|
1364 |
+
public function templateDisplay()
|
1365 |
+
{
|
1366 |
+
$data = array();
|
1367 |
+
$data['key'] = $this->api_key;
|
1368 |
+
$data['webaction'] = 'CAMPAIGNDETAIL';
|
1369 |
+
$data['show'] = 'ALL';
|
1370 |
+
$data['messageType'] = 'template';
|
1371 |
+
return json_decode($this->curlRequest($data));
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
/**
|
1375 |
+
* Get getCountryCode from sendinblue_country table,
|
1376 |
+
*/
|
1377 |
+
public function getCountryCode($countryid)
|
1378 |
+
{
|
1379 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
1380 |
+
$sql = 'SELECT country_prefix FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'"';
|
1381 |
+
$country_id = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
1382 |
+
$country_prefix = $country_id['country_prefix'];
|
1383 |
+
return $country_prefix;
|
1384 |
+
}
|
1385 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
RENAMED
@@ -11,11 +11,13 @@
|
|
11 |
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
public function indexAction()
|
14 |
-
{
|
15 |
-
|
|
|
|
|
|
|
16 |
$this->loadLayout();
|
17 |
$this->renderLayout();
|
18 |
-
|
19 |
}
|
20 |
public function syncronizepostAction()
|
21 |
{
|
@@ -27,6 +29,12 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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']);
|
@@ -46,31 +54,89 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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
|
59 |
if (empty($result['error']))
|
60 |
{
|
61 |
-
|
62 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
63 |
if ($get_key == '')
|
64 |
-
|
65 |
-
elseif ($get_key != $post['sendin_apikey'])
|
66 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$message = $this->__('Your setting has been successfully saved');
|
73 |
-
|
|
|
|
|
74 |
} else if (isset($result['error']))
|
75 |
{
|
76 |
$message = $this->__('You have entered wrong api key');
|
@@ -87,18 +153,18 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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
|
98 |
-
$result
|
99 |
if (empty($result['error']))
|
100 |
{
|
101 |
-
$smtp_response =
|
102 |
|
103 |
if ($smtp_response->result->relay_data->status == 'enabled')
|
104 |
{
|
@@ -111,7 +177,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
111 |
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
112 |
if ($post['email'])
|
113 |
{
|
114 |
-
$data11 =
|
115 |
$resArr = json_decode($data11, true);
|
116 |
if ($resArr['result'] != true) {
|
117 |
$message = $this->__('Mail not sent').' '.$this->__(trim($resArr['error']));
|
@@ -119,8 +185,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
119 |
}
|
120 |
else {
|
121 |
$message = $this->__('Mail sent!');
|
122 |
-
Mage::getSingleton('core/session')->addSuccess($message);
|
123 |
-
|
124 |
}
|
125 |
|
126 |
} else
|
@@ -133,8 +198,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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 |
{
|
@@ -161,7 +225,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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');
|
@@ -188,14 +252,14 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
188 |
}
|
189 |
$this->_redirect('*/*');
|
190 |
}
|
191 |
-
|
192 |
{
|
193 |
$post = $this->getRequest()->getPost();
|
194 |
try {
|
195 |
if (empty($post))
|
196 |
Mage::throwException($this->__('Invalid form data.'));
|
197 |
-
|
198 |
-
|
199 |
if (isset($post['sender_shipment_save']))
|
200 |
{
|
201 |
$sender_shipment = $post['sender_shipment'];
|
@@ -234,6 +298,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
234 |
|
235 |
public function sendordertestAction()
|
236 |
{
|
|
|
237 |
$post = $this->getRequest()->getPost();
|
238 |
try {
|
239 |
if (empty($post))
|
@@ -245,10 +310,10 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
245 |
{
|
246 |
$arr = array();
|
247 |
$arr['to'] = $post['sender_order_number'];
|
248 |
-
$arr['from'] =
|
249 |
-
$arr['text'] =
|
250 |
|
251 |
-
$result =
|
252 |
|
253 |
if (isset($result->status) && $result->status == 'OK')
|
254 |
{
|
@@ -277,22 +342,23 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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'] =
|
292 |
-
$arr['text'] =
|
293 |
-
|
294 |
-
$result =
|
295 |
-
|
296 |
if (isset($result->status) && $result->status == 'OK')
|
297 |
{
|
298 |
$message = $this->__('Message has been sent successfully');
|
@@ -303,7 +369,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
303 |
$message = $this->__('Message has not been sent successfully');
|
304 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
305 |
}
|
306 |
-
|
307 |
}
|
308 |
}
|
309 |
catch (Exception $e)
|
@@ -319,9 +385,9 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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']);
|
@@ -335,19 +401,18 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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();
|
@@ -355,22 +420,21 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
355 |
$arr['from'] = $post['sender_campaign'];
|
356 |
$arr['text'] = $post['sender_campaign_message'];
|
357 |
|
358 |
-
$result =
|
359 |
if (isset($result->status) && $result->status == 'OK')
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
}else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 0)
|
372 |
{
|
373 |
-
$smscredit =
|
374 |
$collection = Mage::getModel('customer/customer')
|
375 |
->getCollection()
|
376 |
->addAttributeToSelect('*')
|
@@ -381,140 +445,109 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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 |
-
$
|
392 |
-
$
|
393 |
-
$
|
394 |
-
$
|
395 |
-
$
|
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 |
-
|
405 |
}
|
406 |
-
}
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
}
|
419 |
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
420 |
{
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
{
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
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 |
-
|
518 |
}
|
519 |
-
|
520 |
}
|
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 |
{
|
29 |
if (isset($post['syncronizeSubmit']))
|
30 |
{
|
31 |
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
32 |
+
if (!empty($post['template']) || empty($post['template']))
|
33 |
+
{
|
34 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Template_Id', $post['template']);
|
35 |
+
$message = $this->__('Your setting has been successfully saved');
|
36 |
+
}
|
37 |
+
|
38 |
if (!empty($post['sendin_list']))
|
39 |
{
|
40 |
$list = implode('|', $post['sendin_list']);
|
54 |
}
|
55 |
$this->_redirect('*/*');
|
56 |
}
|
57 |
+
|
58 |
+
public function reimportpostAction()
|
59 |
+
{
|
60 |
+
$post = $this->getRequest()->getPost();
|
61 |
+
try {
|
62 |
+
if (empty($post))
|
63 |
+
Mage::throwException($this->__('Invalid form data.'));
|
64 |
+
|
65 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
66 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
67 |
+
if (isset($post['importoldSubmit']) && !empty($post['importoldSubmit']))
|
68 |
+
{
|
69 |
+
$list = $sendinModule->getUserlists();
|
70 |
+
$list_id = str_replace('|', ',', $list);
|
71 |
+
$apikey = $sendinModule->getApiKey();
|
72 |
+
$allemail = $sendinModule->getcustomers();
|
73 |
+
if ($allemail > 0)
|
74 |
+
{
|
75 |
+
$params = array();
|
76 |
+
$params['webaction'] = 'IMPORTUSERS';
|
77 |
+
$params['key'] = $apikey;
|
78 |
+
$params['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
79 |
+
$params['listids'] = $list_id;
|
80 |
+
$params['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
81 |
+
$responce_data = $sendinModule->curlRequestAsyc($params);
|
82 |
+
|
83 |
+
$res_value = json_decode($responce_data);
|
84 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 0);
|
85 |
+
if (empty($res_value->process_id))
|
86 |
+
{
|
87 |
+
$sendin_switch->saveConfig('sendinblue/importOldUserStatus', 1);
|
88 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
89 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
90 |
+
}
|
91 |
+
else
|
92 |
+
{
|
93 |
+
$message = $this->__('Your setting has been successfully saved');
|
94 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
catch (Exception $e)
|
100 |
+
{
|
101 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
102 |
+
}
|
103 |
+
$this->_redirect('*/*');
|
104 |
+
}
|
105 |
+
|
106 |
public function apikeypostAction()
|
107 |
{
|
108 |
$post = $this->getRequest()->getPost();
|
109 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
110 |
try {
|
111 |
if (empty($post))
|
112 |
Mage::throwException($this->__('Invalid form data.'));
|
113 |
elseif (isset($post['sendin_apikey']) && !empty($post['sendin_apikey']))
|
114 |
{
|
115 |
$sendin_switch = new Mage_Core_Model_Config();
|
116 |
+
$result = $sendinModule->checkApikey(trim($post['sendin_apikey']));
|
117 |
if (empty($result['error']))
|
118 |
{
|
119 |
+
$get_key = $sendinModule->getApiKey();
|
|
|
120 |
if ($get_key == '')
|
121 |
+
$sendinModule->createFolderName($post['sendin_apikey']);
|
122 |
+
elseif ($get_key != $post['sendin_apikey'])
|
123 |
+
$sendinModule->createFolderName($post['sendin_apikey']);
|
124 |
+
|
125 |
$sendin_switch->saveConfig('sendinblue/api', trim($post['sendin_apikey']));
|
126 |
$sendin_switch->saveConfig('sendinblue/enabled', $post['sendin_api_status']);
|
127 |
$sendin_switch->saveConfig('sendinblue/syncronize', 1);
|
128 |
+
$sendinModule->removeOldEntry();
|
129 |
+
if($sendinModule->getImportOldSubsStatus() == 1)
|
130 |
+
{
|
131 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
132 |
+
Mage::getSingleton('core/session')->addError($message);
|
133 |
+
}
|
134 |
+
else
|
135 |
+
{
|
136 |
$message = $this->__('Your setting has been successfully saved');
|
137 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
138 |
+
}
|
139 |
+
|
140 |
} else if (isset($result['error']))
|
141 |
{
|
142 |
$message = $this->__('You have entered wrong api key');
|
153 |
public function sendmailAction()
|
154 |
{
|
155 |
$post = $this->getRequest()->getPost();
|
156 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
157 |
try {
|
158 |
if (empty($post))
|
159 |
Mage::throwException($this->__('Invalid form data.'));
|
160 |
elseif (isset($post['SmtpSubmit']) && !empty($post['SmtpSubmit']))
|
161 |
{
|
162 |
$sendin_switch = new Mage_Core_Model_Config();
|
163 |
+
$get_key = $sendinModule->getApiKey();
|
164 |
+
$result = $sendinModule->checkApikey($get_key);
|
165 |
if (empty($result['error']))
|
166 |
{
|
167 |
+
$smtp_response = $sendinModule->TrackingSmtp(); // get tracking code
|
168 |
|
169 |
if ($smtp_response->result->relay_data->status == 'enabled')
|
170 |
{
|
177 |
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
178 |
if ($post['email'])
|
179 |
{
|
180 |
+
$data11 = $sendinModule->sendTestMail($post['email']);
|
181 |
$resArr = json_decode($data11, true);
|
182 |
if ($resArr['result'] != true) {
|
183 |
$message = $this->__('Mail not sent').' '.$this->__(trim($resArr['error']));
|
185 |
}
|
186 |
else {
|
187 |
$message = $this->__('Mail sent!');
|
188 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
|
|
189 |
}
|
190 |
|
191 |
} else
|
198 |
{
|
199 |
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
200 |
$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');
|
201 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
|
|
202 |
}
|
203 |
} elseif (isset($responce['error']))
|
204 |
{
|
225 |
{
|
226 |
$sender_order = $post['sender_order'];
|
227 |
$sender_order_message = $post['sender_order_message'];
|
228 |
+
|
229 |
if (isset($sender_order) && $sender_order == '')
|
230 |
{
|
231 |
$message = $this->__('Please fill the message field');
|
252 |
}
|
253 |
$this->_redirect('*/*');
|
254 |
}
|
255 |
+
public function sendshipmentAction()
|
256 |
{
|
257 |
$post = $this->getRequest()->getPost();
|
258 |
try {
|
259 |
if (empty($post))
|
260 |
Mage::throwException($this->__('Invalid form data.'));
|
261 |
+
|
262 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
263 |
if (isset($post['sender_shipment_save']))
|
264 |
{
|
265 |
$sender_shipment = $post['sender_shipment'];
|
298 |
|
299 |
public function sendordertestAction()
|
300 |
{
|
301 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
302 |
$post = $this->getRequest()->getPost();
|
303 |
try {
|
304 |
if (empty($post))
|
310 |
{
|
311 |
$arr = array();
|
312 |
$arr['to'] = $post['sender_order_number'];
|
313 |
+
$arr['from'] = $sendinModule->getSendSmsOrderSubject();
|
314 |
+
$arr['text'] = $sendinModule->getSendSmsmOrderMessage();
|
315 |
|
316 |
+
$result = $sendinModule->sendSmsApi($arr);
|
317 |
|
318 |
if (isset($result->status) && $result->status == 'OK')
|
319 |
{
|
342 |
|
343 |
public function sendshipmenttestAction()
|
344 |
{
|
345 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
346 |
$post = $this->getRequest()->getPost();
|
347 |
try {
|
348 |
if (empty($post))
|
349 |
Mage::throwException($this->__('Invalid form data.'));
|
350 |
|
351 |
$sendin_switch = new Mage_Core_Model_Config();
|
352 |
+
|
353 |
if (isset($post['sender_shipment_submit']))
|
354 |
{
|
355 |
$arr = array();
|
356 |
$arr['to'] = $post['sender_shipment_number'];
|
357 |
+
$arr['from'] = $sendinModule->getSendSmsShipingSubject();
|
358 |
+
$arr['text'] = $sendinModule->getSendSmsShipingMessage();
|
359 |
+
|
360 |
+
$result = $sendinModule->sendSmsApi($arr);
|
361 |
+
|
362 |
if (isset($result->status) && $result->status == 'OK')
|
363 |
{
|
364 |
$message = $this->__('Message has been sent successfully');
|
369 |
$message = $this->__('Message has not been sent successfully');
|
370 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
371 |
}
|
372 |
+
|
373 |
}
|
374 |
}
|
375 |
catch (Exception $e)
|
385 |
try {
|
386 |
if (empty($post))
|
387 |
Mage::throwException($this->__('Invalid form data.'));
|
388 |
+
|
389 |
$sendin_switch = new Mage_Core_Model_Config();
|
390 |
+
|
391 |
if (isset($post['notify_sms_mail']))
|
392 |
{
|
393 |
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Value', $post['sendin_notify_value']);
|
401 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
402 |
}
|
403 |
$this->_redirect('*/*');
|
|
|
404 |
}
|
405 |
+
|
|
|
406 |
public function sendcampaignAction()
|
407 |
{
|
408 |
+
$post = $this->getRequest()->getPost();
|
409 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
410 |
try {
|
411 |
if (empty($post))
|
412 |
Mage::throwException($this->__('Invalid form data.'));
|
413 |
+
|
414 |
$sendin_switch = new Mage_Core_Model_Config();
|
415 |
+
|
416 |
if (isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 1)
|
417 |
{
|
418 |
$arr = array();
|
420 |
$arr['from'] = $post['sender_campaign'];
|
421 |
$arr['text'] = $post['sender_campaign_message'];
|
422 |
|
423 |
+
$result = $sendinModule->sendSmsApi($arr);
|
424 |
if (isset($result->status) && $result->status == 'OK')
|
425 |
+
{
|
426 |
+
$message = $this->__('Message has been sent successfully');
|
427 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
428 |
+
}
|
429 |
+
else
|
430 |
+
{
|
431 |
+
$message = $this->__('Message has not been sent successfully');
|
432 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
433 |
+
}
|
434 |
+
}
|
435 |
+
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 0)
|
|
|
436 |
{
|
437 |
+
$smscredit = $sendinModule->getSmsCredit();
|
438 |
$collection = Mage::getModel('customer/customer')
|
439 |
->getCollection()
|
440 |
->addAttributeToSelect('*')
|
445 |
foreach ($collection as $customer) {
|
446 |
$results[] = $customer->toArray();
|
447 |
}
|
448 |
+
|
|
|
449 |
foreach ($results as $i => $result)
|
450 |
+
{
|
451 |
+
if(!empty($result['shipping_telephone']) && !empty($result['shipping_country_code']))
|
|
|
452 |
{
|
453 |
+
$country_code = $sendinModule->getCountryCode($result['shipping_country_code']);
|
454 |
+
$number = $sendinModule->checkMobileNumber($result['shipping_telephone'],$country_code);
|
455 |
+
$firstname = !empty($result['firstname'])?$result['firstname']:'';
|
456 |
+
$lastname = !empty($result['lastname'])?$result['lastname']:'';
|
457 |
+
$msgbody = !empty($post['sender_campaign_message'])?$post['sender_campaign_message']:'';
|
|
|
|
|
458 |
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
459 |
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
460 |
$arr = array();
|
461 |
$arr['to'] = $number;
|
462 |
+
$arr['from'] = !empty($post['sender_campaign'])?$post['sender_campaign']:'';
|
463 |
$arr['text'] = $msgbody;
|
464 |
+
$sendinModule->sendSmsApi($arr);
|
465 |
}
|
466 |
+
}
|
467 |
+
if ($smscredit >= 1)
|
468 |
+
{
|
469 |
+
$message = $this->__('Message has been sent successfully');
|
470 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
471 |
+
}
|
472 |
+
else
|
473 |
+
{
|
474 |
+
$message = $this->__('Message has not been sent successfully');
|
475 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
476 |
+
}
|
|
|
477 |
}
|
478 |
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
479 |
{
|
480 |
+
$smscredit = $sendinModule->getSmsCredit();
|
481 |
+
|
482 |
+
$camp_name = 'SMS_'.date('Ymd');
|
483 |
+
$key = $sendinModule->getApiKey();
|
484 |
+
if ($key == '')
|
485 |
+
return false;
|
486 |
+
$param['key'] = $key;
|
487 |
+
$param['listname'] = $camp_name;
|
488 |
+
$param['webaction'] = 'NEWLIST';
|
489 |
+
$param['list_parent'] = '1';
|
490 |
+
//folder id
|
491 |
+
$list_response = $sendinModule->curlRequest($param);
|
492 |
+
$res = json_decode($list_response);
|
493 |
+
$list_id = $res->result;
|
494 |
+
// import old user to SendinBlue
|
495 |
+
|
496 |
+
$iso_code = $this->context->language->iso_code;
|
497 |
+
$allemail = $sendinModule->smsCampaignList();
|
498 |
+
|
499 |
+
$data['webaction'] = 'MULTI-USERCREADIT';
|
500 |
+
$data['key'] = $key;
|
501 |
+
$data['attributes'] = $allemail;
|
502 |
+
$data['listid'] = $list_id;
|
503 |
+
// List id should be optional
|
504 |
+
|
505 |
+
$data_responce = $sendinModule->curlRequest($data);
|
506 |
+
$msgbody = $post['sender_campaign_message'];
|
507 |
+
$value_langauge = $sendinModule->getApiConfigValue();
|
508 |
+
if ($value_langauge->language == 'fr')
|
509 |
+
{
|
510 |
+
$firstname = '{NOM}';
|
511 |
+
$lastname = '{PRENOM}';
|
512 |
+
}
|
513 |
+
else
|
514 |
+
{
|
515 |
+
$firstname = '{NAME}';
|
516 |
+
$lastname = '{SURNAME}';
|
517 |
+
}
|
518 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
519 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
520 |
+
$arr = array();
|
521 |
+
$sender_campaign = $post['sender_campaign'];
|
522 |
+
$content = $msgbody;
|
523 |
+
$arr['key'] =$sendinModule->getApiKey();
|
524 |
+
$arr['webaction'] = 'SMSCAMPCREADIT';
|
525 |
+
$arr['camp_name'] = $camp_name; // mandatory
|
526 |
+
$arr['sender'] = $sender_campaign;
|
527 |
+
$arr['content'] = $content;
|
528 |
+
$arr['bat_sent'] = '';
|
529 |
+
$arr['listids'] = $list_id; // mandatory if SMS campaign is scheduled
|
530 |
+
$arr['exclude_list'] = '';
|
531 |
+
$arr['schedule'] = date('Y-m-d H:i:s', time() + 36000);
|
532 |
+
|
533 |
+
$data_camp = $sendinModule->curlRequest($arr);
|
534 |
+
|
535 |
+
if ($smscredit >= 1)
|
536 |
+
{
|
537 |
+
$message = $this->__('Message has been sent successfully');
|
538 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
539 |
+
}
|
540 |
+
else
|
541 |
+
{
|
542 |
+
$message = $this->__('Message has not been sent successfully');
|
543 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
544 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
}
|
|
|
546 |
}
|
547 |
catch (Exception $e)
|
548 |
{
|
549 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
550 |
}
|
551 |
+
$this->_redirect('*/*');
|
552 |
}
|
|
|
553 |
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php
RENAMED
@@ -13,7 +13,6 @@ 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::getSingleton('adminhtml/session')->addSuccess($msg_disp);
|
19 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->notifySmsEmail();
|
|
|
16 |
$msg_disp = $this->__('The CRON has been well executed.');
|
17 |
Mage::getSingleton('adminhtml/session')->addSuccess($msg_disp);
|
18 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php
RENAMED
@@ -13,7 +13,6 @@ 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::getSingleton('adminhtml/session')->addSuccess($msg_disp);
|
19 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
13 |
public function indexAction()
|
14 |
{
|
15 |
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
|
|
16 |
$msg_disp = $this->__('The CRON has been well executed.');
|
17 |
Mage::getSingleton('adminhtml/session')->addSuccess($msg_disp);
|
18 |
$this->_redirect("sendinblue/adminhtml_myform/");
|
app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php
ADDED
@@ -0,0 +1,709 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 emptyImportOldOrderAction()
|
120 |
+
{
|
121 |
+
$post = $this->getRequest()->getPost();
|
122 |
+
try {
|
123 |
+
if (empty($post))
|
124 |
+
Mage::throwException($this->__('Invalid form data.'));
|
125 |
+
if ($post['proc_success'] != '')
|
126 |
+
{
|
127 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
128 |
+
$key_value = array();
|
129 |
+
$key_value[] = '';
|
130 |
+
fputcsv($handle, $key_value);
|
131 |
+
fclose($handle);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
catch (Exception $e)
|
135 |
+
{
|
136 |
+
echo $this->__($e->getMessage());
|
137 |
+
}
|
138 |
+
}
|
139 |
+
public function orderhistoryAction()
|
140 |
+
{
|
141 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
142 |
+
$post = $this->getRequest()->getPost();
|
143 |
+
try {
|
144 |
+
if (empty($post))
|
145 |
+
Mage::throwException($this->__('Invalid form data.'));
|
146 |
+
|
147 |
+
if ($post['history_status'] == 1)
|
148 |
+
{
|
149 |
+
$value = $sendinModule->TrackingSmtp();
|
150 |
+
$date_value = $sendinModule->getApiConfigValue();
|
151 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
152 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
153 |
+
|
154 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
155 |
+
|
156 |
+
fwrite($handle, 'EMAIL,ORDER_ID,ORDER_PRICE,ORDER_DATE'.PHP_EOL);
|
157 |
+
|
158 |
+
|
159 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
160 |
+
|
161 |
+
$salesOrderColection = Mage::getModel('sales/order');
|
162 |
+
foreach ($collection as $customer)
|
163 |
+
{
|
164 |
+
$cid = $customer->getData('entity_id');
|
165 |
+
$email = $customer->getData('email');
|
166 |
+
$total_orders = $salesOrderColection->getCollection()->addFieldToFilter('customer_id', $cid);
|
167 |
+
$orderCnt = $total_orders->count();
|
168 |
+
if ($orderCnt > 0)
|
169 |
+
{
|
170 |
+
$data = array();
|
171 |
+
$data['key'] = $sendinModule->getApiKey();
|
172 |
+
$data['webaction'] = 'USERS-STATUS';
|
173 |
+
$data['email'] = $email;
|
174 |
+
$curl_responce = $sendinModule->curlRequest($data);
|
175 |
+
$user_status = json_decode($curl_responce);
|
176 |
+
}
|
177 |
+
if (isset($user_status->result) != '')
|
178 |
+
{
|
179 |
+
foreach($total_orders as $order_data)
|
180 |
+
{
|
181 |
+
if ($date_value->date_format == 'dd-mm-yyyy')
|
182 |
+
$date = date('d-m-Y', strtotime($order_data['created_at']));
|
183 |
+
else
|
184 |
+
$date = date('m-d-Y', strtotime($order_data['created_at']));
|
185 |
+
$history_data= array();
|
186 |
+
$history_data[] = array($order_data['customer_email'],$order_data['increment_id'],$order_data['grand_total'],$date);
|
187 |
+
foreach ($history_data as $line)
|
188 |
+
fputcsv($handle, $line);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
fclose($handle);
|
194 |
+
|
195 |
+
$get_User_lists = $sendinModule->getUserlists();
|
196 |
+
$list = str_replace('|', ',', $get_User_lists);
|
197 |
+
if (preg_match('/^[0-9,]+$/', $list))
|
198 |
+
$list = $list;
|
199 |
+
else
|
200 |
+
$list = '';
|
201 |
+
|
202 |
+
$import_data = array();
|
203 |
+
$import_data['webaction'] = 'IMPORTUSERS';
|
204 |
+
$import_data['key'] = $sendinModule->getApiKey();
|
205 |
+
$import_data['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportOldOrdersToSendinblue.csv';
|
206 |
+
$import_data['listids'] = $list;
|
207 |
+
$import_data['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptyImportOldOrder';
|
208 |
+
/**
|
209 |
+
* List id should be optional
|
210 |
+
*/
|
211 |
+
$sendinModule->curlRequestAsyc($import_data);
|
212 |
+
|
213 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
214 |
+
$sendin_switch->saveConfig('sendinblue/improt/history', 0);
|
215 |
+
if($post['langvalue'] == 'fr_FR')
|
216 |
+
$msg = 'Historique des commandes a été importé avec succès.';
|
217 |
+
else
|
218 |
+
$msg = 'Order history has been import successfully';
|
219 |
+
|
220 |
+
echo $msg;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
catch (Exception $e)
|
224 |
+
{
|
225 |
+
echo $this->__($e->getMessage());
|
226 |
+
}
|
227 |
+
}
|
228 |
+
public function smtppostAction()
|
229 |
+
{
|
230 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
231 |
+
$post = $this->getRequest()->getPost();
|
232 |
+
try {
|
233 |
+
if (empty($post))
|
234 |
+
Mage::throwException($this->__('Invalid form data.'));
|
235 |
+
else
|
236 |
+
{
|
237 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
238 |
+
$get_key = $sendinModule->getApiKey();
|
239 |
+
$result = $sendinModule->checkApikey($get_key);
|
240 |
+
if (empty($result['error']))
|
241 |
+
{
|
242 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', $post['smtptest']);
|
243 |
+
$smtp_response = $sendinModule->TrackingSmtp(); // get tracking code
|
244 |
+
if ($smtp_response->result->relay_data->status == 'enabled')
|
245 |
+
{
|
246 |
+
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
247 |
+
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
248 |
+
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
249 |
+
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
250 |
+
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
251 |
+
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
252 |
+
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
253 |
+
echo $this->__('Your setting has been successfully saved');
|
254 |
+
}else
|
255 |
+
{
|
256 |
+
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
257 |
+
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');
|
258 |
+
}
|
259 |
+
}elseif (isset($responce['error']))
|
260 |
+
echo $this->__('You have entered wrong api key');
|
261 |
+
}
|
262 |
+
}
|
263 |
+
catch (Exception $e)
|
264 |
+
{
|
265 |
+
echo $this->__($e->getMessage());
|
266 |
+
}
|
267 |
+
}
|
268 |
+
public function ajaxcontentAction()
|
269 |
+
{
|
270 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
271 |
+
$post = $this->getRequest()->getPost();
|
272 |
+
try {
|
273 |
+
if (empty($post))
|
274 |
+
Mage::throwException($this->__('Invalid form data.'));
|
275 |
+
else
|
276 |
+
{
|
277 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
278 |
+
if ($locale == 'fr_FR')
|
279 |
+
{
|
280 |
+
$title1 = 'Inscrire le contact';
|
281 |
+
$title2 = 'Désinscrire le contact';
|
282 |
+
$title3 = 'Inscrire le sms';
|
283 |
+
$title4 = 'Désinscrire le sms';
|
284 |
+
$first = 'Première page';
|
285 |
+
$last = 'Dernière page';
|
286 |
+
$previous = 'Précédente';
|
287 |
+
$next = 'Suivante';
|
288 |
+
$yes = 'oui';
|
289 |
+
$no = 'non';
|
290 |
+
} else
|
291 |
+
{
|
292 |
+
$title1 = 'Unsubscribe the contact';
|
293 |
+
$title2 = 'Subscribe the contact';
|
294 |
+
$title3 = 'Unsubscribe the sms';
|
295 |
+
$title4 = 'Subscribe the sms';
|
296 |
+
$first = 'First';
|
297 |
+
$last = 'Last';
|
298 |
+
$previous = 'Previous';
|
299 |
+
$next = 'Next';
|
300 |
+
$yes = 'yes';
|
301 |
+
$no = 'no';
|
302 |
+
}
|
303 |
+
$page = (int)$post['page'];
|
304 |
+
$cur_page = $page;
|
305 |
+
$page -= 1;
|
306 |
+
$per_page = 20;
|
307 |
+
$previous_btn = true;
|
308 |
+
$next_btn = true;
|
309 |
+
$first_btn = true;
|
310 |
+
$last_btn = true;
|
311 |
+
$start = $page * $per_page;
|
312 |
+
$count = $sendinModule->getNewsletterSubscribeCount() + $sendinModule->getNewsletterUnSubscribeCount();
|
313 |
+
$no_of_paginations = ceil($count / $per_page);
|
314 |
+
if ($cur_page >= 7)
|
315 |
+
{
|
316 |
+
$start_loop = $cur_page - 3;
|
317 |
+
if ($no_of_paginations > $cur_page + 3)
|
318 |
+
$end_loop = $cur_page + 3;
|
319 |
+
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6)
|
320 |
+
{
|
321 |
+
$start_loop = $no_of_paginations - 6;
|
322 |
+
$end_loop = $no_of_paginations;
|
323 |
+
} else
|
324 |
+
$end_loop = $no_of_paginations;
|
325 |
+
} else
|
326 |
+
{
|
327 |
+
$start_loop = 1;
|
328 |
+
if ($no_of_paginations > 7)
|
329 |
+
$end_loop = 7;
|
330 |
+
else
|
331 |
+
$end_loop = $no_of_paginations;
|
332 |
+
}
|
333 |
+
$collection = $sendinModule->getNewsletterSubscribe($start, $per_page);
|
334 |
+
$sendin_status = $sendinModule->checkUserSendinStatus($collection);
|
335 |
+
$sendin_result = isset($sendin_status['result'])?$sendin_status['result']:'';
|
336 |
+
if (count($collection) > 0)
|
337 |
+
{
|
338 |
+
$i = 1;
|
339 |
+
$msg = '';
|
340 |
+
$skinUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
341 |
+
foreach ($collection as $subscriber)
|
342 |
+
{
|
343 |
+
$email = isset($subscriber['email'])?$subscriber['email']:'';
|
344 |
+
$phone = isset($subscriber['SMS'])?$subscriber['SMS'] : '';
|
345 |
+
|
346 |
+
if (!empty($subscriber['customer_id']) > 0)
|
347 |
+
$client = $yes;
|
348 |
+
else
|
349 |
+
$client = $no;
|
350 |
+
|
351 |
+
$show_status = '';
|
352 |
+
$sms_status = '';
|
353 |
+
if(isset($sendin_result[$email])) {
|
354 |
+
$email_bl_value = isset($sendin_result[$email]['email_bl'])?$sendin_result[$email]['email_bl']:'';
|
355 |
+
if ($email_bl_value === 1 || $sendin_result[$email] == null)
|
356 |
+
$show_status = 0;
|
357 |
+
if ($email_bl_value === 0)
|
358 |
+
$show_status = 1;
|
359 |
+
|
360 |
+
$sms_bl = isset($sendin_result[$email]['sms_bl'])?$sendin_result[$email]['sms_bl']:'';
|
361 |
+
$sms_exist = isset($sendin_result[$email]['sms_exist'])?$sendin_result[$email]['sms_exist']:'';
|
362 |
+
$subs_telephone = isset($subscriber['SMS'])?$subscriber['SMS']:'';
|
363 |
+
if ($sms_bl === 1 && $sms_exist > 0)
|
364 |
+
$sms_status = 0;
|
365 |
+
elseif ($sms_bl === 0 && $sms_exist > 0)
|
366 |
+
$sms_status = 1;
|
367 |
+
elseif ($sms_exist <= 0 && empty($subs_telephone))
|
368 |
+
$sms_status = 2;
|
369 |
+
else if ($sms_exist <= 0 && !empty($subs_telephone))
|
370 |
+
$sms_status = 3;
|
371 |
+
}
|
372 |
+
if ($subscriber['subscriber_status'] != 3)
|
373 |
+
$img_magento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
374 |
+
else
|
375 |
+
$img_magento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
376 |
+
|
377 |
+
$sms_status = $sms_status >= 0?$sms_status:'';
|
378 |
+
|
379 |
+
if ($sms_status === 1)
|
380 |
+
$img_sms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif"
|
381 |
+
id="ajax_contact_status_'.$i.'" title="'.$title3.'" >';
|
382 |
+
else if ($sms_status === 0)
|
383 |
+
$img_sms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif"
|
384 |
+
id="ajax_contact_status_'.$i.'" title="'.$title4.'" >';
|
385 |
+
else if ($sms_status === 2 || $sms_status === '')
|
386 |
+
$img_sms = '';
|
387 |
+
else if ($sms_status === 3)
|
388 |
+
$img_sms = 'Not synchronized';
|
389 |
+
$show_status = !empty($show_status)?$show_status:'0';
|
390 |
+
if ($show_status == 1)
|
391 |
+
$img_sendin = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif"
|
392 |
+
id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
393 |
+
else
|
394 |
+
$img_sendin = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif"
|
395 |
+
id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
396 |
+
$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>
|
397 |
+
<td class="a-left"><a status="'.$show_status.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
398 |
+
'.$img_sendin.'</a></td><td class="a-left last"><a status="'.$sms_status.'" email="'.$email.'" class="ajax_sms_subs_href" href="javascript:void(0)">
|
399 |
+
'.$img_sms.'</a></td></tr>';
|
400 |
+
$i++;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
$msg_paging = '';
|
404 |
+
$msg_paging .= '<tr><td colspan="7"><div class="pagination"><ul class="pull-left">';
|
405 |
+
if ($first_btn && $cur_page > 1)
|
406 |
+
$msg_paging .= '<li p="1" class="active">'.$first.'</li>';
|
407 |
+
else if ($first_btn)
|
408 |
+
$msg_paging .= '<li p="1" class="inactive">'.$first.'</li>';
|
409 |
+
if ($previous_btn && $cur_page > 1)
|
410 |
+
{
|
411 |
+
$pre = $cur_page - 1;
|
412 |
+
$msg_paging .= '<li p="'.$pre.'" class="active">'.$previous.'</li>';
|
413 |
+
} else if ($previous_btn)
|
414 |
+
$msg_paging .= '<li class="inactive">'.$previous.'</li>';
|
415 |
+
for ($i = $start_loop; $i <= $end_loop; $i++)
|
416 |
+
{
|
417 |
+
if ($cur_page == $i)
|
418 |
+
$msg_paging .= '<li p="'.$i.'" style="color:#fff;background-color:#000000;" class="active">'.$i.'</li>';
|
419 |
+
else
|
420 |
+
$msg_paging .= '<li p="'.$i.'" class="active">'.$i.'</li>';
|
421 |
+
}
|
422 |
+
if ($next_btn && $cur_page < $no_of_paginations)
|
423 |
+
{
|
424 |
+
$nex = $cur_page + 1;
|
425 |
+
$msg_paging .= '<li p="'.$nex.'" class="active">'.$next.'</li>';
|
426 |
+
} else if ($next_btn)
|
427 |
+
$msg_paging .= '<li class="inactive">'.$next.'</li>';
|
428 |
+
if ($last_btn && $cur_page < $no_of_paginations)
|
429 |
+
$msg_paging .= '<li p="'.$no_of_paginations.'" class="active">'.$last.'</li>';
|
430 |
+
else if ($last_btn)
|
431 |
+
$msg_paging .= '<li p="'.$no_of_paginations.'" class="inactive">'.$last.'</li>';
|
432 |
+
if ($count != 0)
|
433 |
+
echo $msg.$msg_paging.'</td></tr>';
|
434 |
+
}
|
435 |
+
}catch (Exception $e)
|
436 |
+
{
|
437 |
+
echo $this->__($e->getMessage());
|
438 |
+
}
|
439 |
+
}
|
440 |
+
public function ajaxsmssubscribeAction()
|
441 |
+
{
|
442 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
443 |
+
$post = $this->getRequest()->getPost();
|
444 |
+
try {
|
445 |
+
if (empty($post))
|
446 |
+
Mage::throwException($this->__('Invalid form data.'));
|
447 |
+
$email = $post['email'];
|
448 |
+
$data = array();
|
449 |
+
$data['key'] = $sendinModule->getApiKey();
|
450 |
+
$data['webaction'] = 'USERUNSUBSCRIBEDSMS';
|
451 |
+
$data['email'] = $email;
|
452 |
+
$sendinModule->curlRequest($data);
|
453 |
+
}
|
454 |
+
catch (Exception $e)
|
455 |
+
{
|
456 |
+
echo $this->__($e->getMessage());
|
457 |
+
}
|
458 |
+
}
|
459 |
+
public function ajaxupdateAction()
|
460 |
+
{
|
461 |
+
$post = $this->getRequest()->getPost();
|
462 |
+
$coreResource = Mage::getSingleton('core/resource');
|
463 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
464 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
465 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
466 |
+
$attributesName = $sendinModule->allAttributesName();
|
467 |
+
try {
|
468 |
+
if (empty($post))
|
469 |
+
Mage::throwException($this->__('Invalid form data.'));
|
470 |
+
$post_email = !empty($post['email'])?$post['email']:'';
|
471 |
+
$post_newsletter = !empty($post['newsletter'])?$post['newsletter']:'';
|
472 |
+
$temp_sub_status = ($post_newsletter == 0) ? 1 : 3;
|
473 |
+
$sql = 'SELECT `store_id`, `entity_id` from '.$tableCustomer.' where email = "'.$post_email.'" ';
|
474 |
+
$connection = $coreResource->getConnection('core_read');
|
475 |
+
$custdata = $connection->fetchRow($sql);
|
476 |
+
if (!empty($post_email) && $post_newsletter == 0)
|
477 |
+
{
|
478 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
479 |
+
$responce = $sendinModule->emailSubscribe($post_email);
|
480 |
+
$responce_data = json_decode($responce);
|
481 |
+
|
482 |
+
if (isset($responce_data->errorMsg) == 'User not exists')
|
483 |
+
{
|
484 |
+
if (isset($custdata['entity_id']) != '')
|
485 |
+
{
|
486 |
+
$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']);
|
487 |
+
$telephone = '';
|
488 |
+
foreach ($collectionAddress as $customerPhno)
|
489 |
+
{
|
490 |
+
$customerAddr = $customerPhno->getData();
|
491 |
+
if (!empty($customerAddr['telephone']) && !empty($customerAddr['country_id']))
|
492 |
+
{
|
493 |
+
$country_code = $sendinModule->getCountryCode($customerAddr['country_id']);
|
494 |
+
$customerAddr['telephone'] = $sendinModule->checkMobileNumber($customerAddr['telephone'], $country_code);
|
495 |
+
}
|
496 |
+
|
497 |
+
|
498 |
+
}
|
499 |
+
$customer = Mage::getModel("customer/customer");
|
500 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
501 |
+
$customer->loadByEmail($post_email); //load customer by email id
|
502 |
+
$customer_name = $customer->getData();
|
503 |
+
$user_lang = isset($customer_name['created_in'])?$customer_name['created_in'] : '';
|
504 |
+
$customerData = array_merge($customerAddr, $customer_name);
|
505 |
+
$resp = $sendinModule->merge_my_array($attributesName, $customerData);
|
506 |
+
$resp['CLIENT'] = 1;
|
507 |
+
$responce = $sendinModule->emailAdd($post_email, $resp, $post_newsletter);
|
508 |
+
}
|
509 |
+
else
|
510 |
+
{
|
511 |
+
$client = 0;
|
512 |
+
$customerData = array();
|
513 |
+
$resp = $sendinModule->merge_my_array($attributesName, $customerData);
|
514 |
+
$resp['CLIENT'] = $client;
|
515 |
+
$responce = $sendinModule->emailAdd($post_email, $resp, $post_newsletter);
|
516 |
+
}
|
517 |
+
}
|
518 |
+
$sql = 'SELECT `subscriber_email` from '.$tableNewsletter.' where subscriber_email = "'.$post_email.'" ';
|
519 |
+
$custdatanews = $connection->fetchRow($sql);
|
520 |
+
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
521 |
+
{
|
522 |
+
$connection->query("insert into ".$tableNewsletter."(store_id, customer_id, subscriber_email, subscriber_status)
|
523 |
+
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$post_email."','1')");
|
524 |
+
|
525 |
+
}
|
526 |
+
else
|
527 |
+
{
|
528 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post_email);
|
529 |
+
$costomer_data->setStatus($temp_sub_status);
|
530 |
+
$costomer_data->setIsStatusChanged(true);
|
531 |
+
$costomer_data->save();
|
532 |
+
}
|
533 |
+
|
534 |
+
}
|
535 |
+
else{
|
536 |
+
$responce = $sendinModule->emailDelete($post_email);
|
537 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post_email);
|
538 |
+
|
539 |
+
if (!$costomer_data->getStoreId())
|
540 |
+
{
|
541 |
+
$costomer_data->setSubscriberEmail($post_email);
|
542 |
+
$costomer_data->setCustomerId($custdata['entity_id']);
|
543 |
+
$costomer_data->setStoreId($custdata['store_id']);
|
544 |
+
}
|
545 |
+
$costomer_data->setStatus($temp_sub_status);
|
546 |
+
$costomer_data->setIsStatusChanged(true);
|
547 |
+
$costomer_data->save();
|
548 |
+
}
|
549 |
+
}
|
550 |
+
catch (Exception $e)
|
551 |
+
{
|
552 |
+
echo $this->__($e->getMessage());
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
public function ajaxordersmsAction($sender='', $message='', $number='')
|
557 |
+
{
|
558 |
+
$post = $this->getRequest()->getPost();
|
559 |
+
try {
|
560 |
+
if (empty($post))
|
561 |
+
Mage::throwException($this->__('Invalid form data.'));
|
562 |
+
$number = $post['number'];
|
563 |
+
$charone = substr($number, 0, 1);
|
564 |
+
$chartwo = substr($number, 0, 2);
|
565 |
+
if ($charone == '0' && $chartwo == '00')
|
566 |
+
$number = $number;
|
567 |
+
|
568 |
+
if (isset($number))
|
569 |
+
{
|
570 |
+
$adminUserModel = Mage::getModel('admin/user');
|
571 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
572 |
+
$admin_data = $userCollection->getData();
|
573 |
+
$firstname = isset($admin_data[0]['firstname'])?$admin_data[0]['firstname']:'';
|
574 |
+
$lastname = isset($admin_data[0]['lastname'])?$admin_data[0]['lastname']:'';
|
575 |
+
$characters = '1234567890';
|
576 |
+
$ref_num = '';
|
577 |
+
for ($i = 0; $i < 9; $i++)
|
578 |
+
$ref_num .= $characters[rand(0, strlen($characters) - 1)];
|
579 |
+
|
580 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
581 |
+
if ($locale == 'fr_FR')
|
582 |
+
$ord_date = date('d/m/Y');
|
583 |
+
else
|
584 |
+
$ord_date = date('m/d/Y');
|
585 |
+
$orderprice = rand(10, 1000);
|
586 |
+
$total_pay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
587 |
+
$msgbody = $post['message'];
|
588 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
589 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
590 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
591 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
592 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
593 |
+
$arr = array();
|
594 |
+
$arr['to'] = $number;
|
595 |
+
$arr['from'] = isset($post['sender'])?$post['sender']:'';
|
596 |
+
$arr['text'] = $msgbody;
|
597 |
+
|
598 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
599 |
+
if (isset($result->status) && $result->status == 'OK')
|
600 |
+
echo 'OK';
|
601 |
+
else
|
602 |
+
echo 'KO';
|
603 |
+
}
|
604 |
+
|
605 |
+
}
|
606 |
+
catch (Exception $e)
|
607 |
+
{
|
608 |
+
echo $this->__($e->getMessage());
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
public function ajaxordershippedAction($sender='', $message='', $number='')
|
613 |
+
{
|
614 |
+
$post = $this->getRequest()->getPost();
|
615 |
+
try {
|
616 |
+
if (empty($post))
|
617 |
+
Mage::throwException($this->__('Invalid form data.'));
|
618 |
+
$number = $post['number'];
|
619 |
+
$charone = substr($number, 0, 1);
|
620 |
+
$chartwo = substr($number, 0, 2);
|
621 |
+
|
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'] = !empty($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';exit;
|
660 |
+
}
|
661 |
+
|
662 |
+
}
|
663 |
+
catch (Exception $e)
|
664 |
+
{
|
665 |
+
echo $this->__($e->getMessage());
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
public function ajaxsmscampaignAction($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 |
+
if ($charone == '0' && $chartwo == '00')
|
679 |
+
$number = $number;
|
680 |
+
|
681 |
+
if (isset($number))
|
682 |
+
{
|
683 |
+
$adminUserModel = Mage::getModel('admin/user');
|
684 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
685 |
+
$admin_data = $userCollection->getData();
|
686 |
+
$firstname = isset($admin_data[0]['firstname'])?$admin_data[0]['firstname']:'';
|
687 |
+
$lastname = isset($admin_data[0]['lastname'])?$admin_data[0]['lastname']:'';
|
688 |
+
$msgbody = $post['message'];
|
689 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
690 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
691 |
+
$arr = array();
|
692 |
+
$arr['to'] = $number;
|
693 |
+
$arr['from'] = !empty($post['sender'])?$post['sender']:'';
|
694 |
+
$arr['text'] = $msgbody;
|
695 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
696 |
+
if (isset($result->status) && $result->status == 'OK')
|
697 |
+
echo 'OK';
|
698 |
+
else
|
699 |
+
echo 'KO';
|
700 |
+
}
|
701 |
+
|
702 |
+
}
|
703 |
+
catch (Exception $e)
|
704 |
+
{
|
705 |
+
echo $this->__($e->getMessage());
|
706 |
+
}
|
707 |
+
}
|
708 |
+
|
709 |
+
}
|
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,316 @@
|
|
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 |
-
</email>
|
208 |
-
</template>
|
209 |
-
|
210 |
-
<models>
|
211 |
-
<core>
|
212 |
-
<rewrite>
|
213 |
-
<email>Sendinblue_Sendinblue_Model_Email</email>
|
214 |
-
<email_template>Sendinblue_Sendinblue_Model_Email_Template</email_template>
|
215 |
-
</rewrite>
|
216 |
-
</core>
|
217 |
-
<sendinblue>
|
218 |
-
<class>Sendinblue_Sendinblue_Model</class>
|
219 |
-
<resourceModel>sendinblue_mysql4</resourceModel>
|
220 |
-
</sendinblue>
|
221 |
-
<sendinblue_mysql4>
|
222 |
-
<class>Sendinblue_Sendinblue_Model_Mysql4</class>
|
223 |
-
<entities>
|
224 |
-
<sendinblue>
|
225 |
-
<table>sendinblue_country_codes</table>
|
226 |
-
</sendinblue>
|
227 |
-
</entities>
|
228 |
-
</sendinblue_mysql4>
|
229 |
-
</models>
|
230 |
-
<resources>
|
231 |
-
<sendinblue_setup>
|
232 |
-
<setup>
|
233 |
-
<module>Sendinblue_Sendinblue</module>
|
234 |
-
</setup>
|
235 |
-
<connection>
|
236 |
-
<use>core_setup</use>
|
237 |
-
</connection>
|
238 |
-
</sendinblue_setup>
|
239 |
-
<sendinblue_write>
|
240 |
-
<connection>
|
241 |
-
<use>core_write</use>
|
242 |
-
</connection>
|
243 |
-
</sendinblue_write>
|
244 |
-
<sendinblue_read>
|
245 |
-
<connection>
|
246 |
-
<use>core_read</use>
|
247 |
-
</connection>
|
248 |
-
</sendinblue_read>
|
249 |
-
</resources>
|
250 |
-
|
251 |
-
<helpers>
|
252 |
-
<sendinblue>
|
253 |
-
<class>Sendinblue_Sendinblue_Helper</class>
|
254 |
-
</sendinblue>
|
255 |
-
</helpers>
|
256 |
-
<blocks>
|
257 |
-
<sendinblue>
|
258 |
-
<class>Sendinblue_Sendinblue_Block</class>
|
259 |
-
</sendinblue>
|
260 |
-
</blocks>
|
261 |
-
|
262 |
-
</global>
|
263 |
-
<crontab>
|
264 |
-
<jobs>
|
265 |
-
<sendinblue_sendinblue>
|
266 |
-
<schedule>
|
267 |
-
<cron_expr>*/5 * * * *</cron_expr>
|
268 |
-
</schedule>
|
269 |
-
<run>
|
270 |
-
<model>sendinblue/observer::syncData</model>
|
271 |
-
</run>
|
272 |
-
</sendinblue_sendinblue>
|
273 |
-
</jobs>
|
274 |
-
</crontab>
|
275 |
-
<default>
|
276 |
-
<sendinblue>
|
277 |
-
<general>
|
278 |
-
<enabled>0</enabled>
|
279 |
-
<test>0</test>
|
280 |
-
<test_address />
|
281 |
-
</general>
|
282 |
-
<smtp>
|
283 |
-
<host>sendinblue.fr</host>
|
284 |
-
<port />
|
285 |
-
<login />
|
286 |
-
<password />
|
287 |
-
<ssl />
|
288 |
-
</smtp>
|
289 |
-
</sendinblue>
|
290 |
-
</default>
|
291 |
-
<frontend>
|
292 |
-
<events>
|
293 |
-
<!--use when new subcriber add for newsletter-->
|
294 |
-
<controller_action_postdispatch_newsletter_subscriber_new>
|
295 |
-
<observers>
|
296 |
-
<sendinblue_subscribe_new_observer>
|
297 |
-
<type>singleton</type>
|
298 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
299 |
-
<method>subscribeObserver</method>
|
300 |
-
</sendinblue_subscribe_new_observer>
|
301 |
-
</observers>
|
302 |
-
</controller_action_postdispatch_newsletter_subscriber_new>
|
303 |
-
|
304 |
-
<!--use when new user register check (is_subscribed = 1)-->
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
<updates>
|
318 |
-
<sendinblue_sendinblue>
|
319 |
-
<file>sendinblue.xml</file>
|
320 |
-
</sendinblue_sendinblue>
|
321 |
-
</updates>
|
322 |
-
</layout>
|
323 |
-
|
324 |
-
</frontend>
|
325 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sendinblue_Sendinblue>
|
5 |
+
<version>1.2.2</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 |
+
</email>
|
208 |
+
</template>
|
209 |
+
|
210 |
+
<models>
|
211 |
+
<core>
|
212 |
+
<rewrite>
|
213 |
+
<email>Sendinblue_Sendinblue_Model_Email</email>
|
214 |
+
<email_template>Sendinblue_Sendinblue_Model_Email_Template</email_template>
|
215 |
+
</rewrite>
|
216 |
+
</core>
|
217 |
+
<sendinblue>
|
218 |
+
<class>Sendinblue_Sendinblue_Model</class>
|
219 |
+
<resourceModel>sendinblue_mysql4</resourceModel>
|
220 |
+
</sendinblue>
|
221 |
+
<sendinblue_mysql4>
|
222 |
+
<class>Sendinblue_Sendinblue_Model_Mysql4</class>
|
223 |
+
<entities>
|
224 |
+
<sendinblue>
|
225 |
+
<table>sendinblue_country_codes</table>
|
226 |
+
</sendinblue>
|
227 |
+
</entities>
|
228 |
+
</sendinblue_mysql4>
|
229 |
+
</models>
|
230 |
+
<resources>
|
231 |
+
<sendinblue_setup>
|
232 |
+
<setup>
|
233 |
+
<module>Sendinblue_Sendinblue</module>
|
234 |
+
</setup>
|
235 |
+
<connection>
|
236 |
+
<use>core_setup</use>
|
237 |
+
</connection>
|
238 |
+
</sendinblue_setup>
|
239 |
+
<sendinblue_write>
|
240 |
+
<connection>
|
241 |
+
<use>core_write</use>
|
242 |
+
</connection>
|
243 |
+
</sendinblue_write>
|
244 |
+
<sendinblue_read>
|
245 |
+
<connection>
|
246 |
+
<use>core_read</use>
|
247 |
+
</connection>
|
248 |
+
</sendinblue_read>
|
249 |
+
</resources>
|
250 |
+
|
251 |
+
<helpers>
|
252 |
+
<sendinblue>
|
253 |
+
<class>Sendinblue_Sendinblue_Helper</class>
|
254 |
+
</sendinblue>
|
255 |
+
</helpers>
|
256 |
+
<blocks>
|
257 |
+
<sendinblue>
|
258 |
+
<class>Sendinblue_Sendinblue_Block</class>
|
259 |
+
</sendinblue>
|
260 |
+
</blocks>
|
261 |
+
|
262 |
+
</global>
|
263 |
+
<crontab>
|
264 |
+
<jobs>
|
265 |
+
<sendinblue_sendinblue>
|
266 |
+
<schedule>
|
267 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
268 |
+
</schedule>
|
269 |
+
<run>
|
270 |
+
<model>sendinblue/observer::syncData</model>
|
271 |
+
</run>
|
272 |
+
</sendinblue_sendinblue>
|
273 |
+
</jobs>
|
274 |
+
</crontab>
|
275 |
+
<default>
|
276 |
+
<sendinblue>
|
277 |
+
<general>
|
278 |
+
<enabled>0</enabled>
|
279 |
+
<test>0</test>
|
280 |
+
<test_address />
|
281 |
+
</general>
|
282 |
+
<smtp>
|
283 |
+
<host>sendinblue.fr</host>
|
284 |
+
<port />
|
285 |
+
<login />
|
286 |
+
<password />
|
287 |
+
<ssl />
|
288 |
+
</smtp>
|
289 |
+
</sendinblue>
|
290 |
+
</default>
|
291 |
+
<frontend>
|
292 |
+
<events>
|
293 |
+
<!--use when new subcriber add for newsletter-->
|
294 |
+
<controller_action_postdispatch_newsletter_subscriber_new>
|
295 |
+
<observers>
|
296 |
+
<sendinblue_subscribe_new_observer>
|
297 |
+
<type>singleton</type>
|
298 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
299 |
+
<method>subscribeObserver</method>
|
300 |
+
</sendinblue_subscribe_new_observer>
|
301 |
+
</observers>
|
302 |
+
</controller_action_postdispatch_newsletter_subscriber_new>
|
303 |
+
|
304 |
+
<!--use when new user register check (is_subscribed = 1)-->
|
305 |
+
</events>
|
306 |
+
|
307 |
+
<layout>
|
308 |
+
<updates>
|
309 |
+
<sendinblue_sendinblue>
|
310 |
+
<file>sendinblue.xml</file>
|
311 |
+
</sendinblue_sendinblue>
|
312 |
+
</updates>
|
313 |
+
</layout>
|
314 |
+
|
315 |
+
</frontend>
|
316 |
+
</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/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,24 @@ $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 +194,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 +218,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 +266,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 +297,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 +306,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 +363,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 +376,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 +384,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 +416,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 +448,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 +462,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 +477,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 +500,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 +531,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 +543,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>
|
@@ -518,9 +578,9 @@ $style_smtp = '';
|
|
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 +589,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 +603,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 +635,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 +663,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 |
+
<tr>
|
173 |
+
<td><label><?php echo $this->__('Manage email template'); ?></label></td>
|
174 |
+
<td> <select name="template" id="template" style="width: 230.833px; height:23px;" class ="ui-widget ui-state-default ui-corner-all">
|
175 |
+
<option value=""><?php echo $this->__('Select template'); ?></option>
|
176 |
+
<?php
|
177 |
+
$templatelist = $sendinModule->templateDisplay();
|
178 |
+
|
179 |
+
if (!empty($templatelist->result->campaign_records))
|
180 |
+
{
|
181 |
+
foreach ($templatelist->result->campaign_records as $template_data)
|
182 |
+
{ if ($template_data->templ_status === 'Active')
|
183 |
+
{ ?>
|
184 |
+
<option value="<?php echo $template_data->id; ?>" <?php if($template_data->id == $sendinModule->getTemplateId()) echo 'selected = "selected"'; ?> ><?php echo $template_data->campaign_name; ?></option>
|
185 |
+
<?php }}} ?>
|
186 |
+
</select>
|
187 |
+
|
188 |
+
<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></td>
|
189 |
+
</tr>
|
190 |
<tr>
|
191 |
<td> </td>
|
192 |
<td class="a-left">
|
194 |
<input type="submit" class="btn" name="syncronizeSubmit" value ="<?php echo $this->__('Update'); ?>" /></div>
|
195 |
</td>
|
196 |
</tr>
|
197 |
+
</form>
|
198 |
+
|
199 |
+
<?php if($sendinModule->getImportOldSubsStatus()==1){ ?>
|
200 |
+
<form id="reimport_form" name="reimport_form" method="post" action="<?php echo $this->getUrl('*/*/reimportpost'); ?>">
|
201 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
202 |
+
<tr>
|
203 |
+
<td> </td>
|
204 |
+
<td class="a-left">
|
205 |
+
<div class="btnmrgn-right">
|
206 |
+
<input type="submit" class="btn" name="importoldSubmit" value ="<?php echo $this->__('Import Old Subscribers'); ?>" /></div>
|
207 |
+
</td>
|
208 |
+
</tr></form>
|
209 |
+
<?php } ?>
|
210 |
<tr><td colspan="2">
|
211 |
<?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>
|
212 |
</td></tr>
|
218 |
</table>
|
219 |
</fieldset>
|
220 |
</div>
|
221 |
+
|
222 |
</div>
|
223 |
<?php
|
224 |
}
|
225 |
+
$module_status = $sendinModule->getSmtpStatus();
|
226 |
if ($module_status == 0)
|
227 |
$style_smtp = 'style="display:none;"';
|
228 |
else
|
229 |
+
$style_smtp = '';
|
230 |
|
231 |
?>
|
232 |
<?php if ($api_key != '') { ?>
|
233 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
234 |
<form id="edit_formsmtp" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/sendmail'); ?>">
|
235 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
236 |
<input name="smtpUrl" type="hidden" id="smtpUrl" value="<?php echo $this->getUrl('sendinblue/ajax/smtppost'); ?>" />
|
237 |
<div class="section-config active">
|
238 |
<fieldset class="fields">
|
239 |
+
<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>
|
240 |
<table cellspacing="0" class="form-list">
|
241 |
|
242 |
<tr>
|
243 |
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></label></td>
|
244 |
<td class="input-ele">
|
245 |
+
<input type="radio" class = 'smtpStatus radio_nospaceing' <?php if($module_status == 1) { echo 'checked'; } ?> name="smtp" value="1" /> <?php echo $this->__('Yes'); ?>
|
246 |
+
<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>
|
247 |
</td>
|
248 |
<td> </td>
|
249 |
</tr>
|
250 |
|
251 |
<tr <?php echo $style_smtp; ?> class='smtptest'>
|
252 |
<td class="fix_width"><label><?php echo $this->__('Send email test From / To :'); ?></label></td>
|
253 |
+
<td class="input-ele"><input class="input-text input-height" name="email" id="email" value="" size="40"/>
|
254 |
<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'); ?>" />
|
255 |
</td>
|
256 |
</tr>
|
266 |
<div class="section-config active">
|
267 |
<input name="trackingUrl" type="hidden" id="trackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/codepost'); ?>" />
|
268 |
<fieldset id="my-fieldset" class="fields">
|
269 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Code tracking'); ?> </legend>
|
270 |
<table cellspacing="0" class="form-list">
|
271 |
<tr>
|
272 |
<td class="fix_width"><label><?php echo $this->__('Do you want to install a tracking code when validating an order'); ?></label>
|
273 |
</td>
|
274 |
<td class="input-ele">
|
275 |
+
<input type="radio" <?php if($trackStatus == 1) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_nospaceing' value="1" /> <?php echo $this->__('Yes'); ?>
|
276 |
+
<input type="radio" <?php if($trackStatus == 0) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_spaceing2' value="0" /> <?php echo $this->__('No'); ?>
|
277 |
<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>
|
278 |
</td>
|
279 |
</tr>
|
280 |
+
<?php
|
281 |
+
if ($trackStatus == 1 && $trackingHistory == 1)
|
282 |
+
$style_track = '';
|
283 |
+
else
|
284 |
+
$style_track = 'style="display:none;"';
|
285 |
+
if($trackStatus == 1 && $trackingHistory == 1) { ?>
|
286 |
+
<tr <?php echo $style_track; ?> class='ordertracking'>
|
287 |
+
<td> </td>
|
288 |
+
<input type="hidden" name="history_status" value="<?php echo $trackingHistory; ?>" id="history_status">
|
289 |
+
<input name="importordertrackingUrl" type="hidden" id="importordertrackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/orderhistory'); ?>" />
|
290 |
+
<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>
|
291 |
+
</tr>
|
292 |
+
<?php } ?>
|
293 |
</table>
|
294 |
</fieldset>
|
295 |
</div>
|
297 |
|
298 |
<div class="sendin_row hidetableblock" <?php echo $style; ?> >
|
299 |
<fieldset class="fields">
|
300 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
301 |
<?php echo $this->__('Manage SMS'); ?></legend>
|
302 |
<table width="100%" cellspacing="0" cellpadding="0" class="table hidetableblock form-list">
|
303 |
|
306 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
307 |
<span style="margin-bottom:10px; color:#333333;">
|
308 |
<?php echo $this->__('Currently you have '); ?>
|
309 |
+
<?php $credit = $sendinModule->getSmsCredit();
|
310 |
+
$notify_value = $sendinModule->getNotifyValueStatus();
|
311 |
+
?>
|
312 |
+
<?php if ($credit >= $notify_value){ ?> <strong style="color:#000000;"><?php echo $credit; ?></strong><?php } else {?><strong style="color:#F03D25;"><?php echo $credit; ?></strong><?php } ?>
|
313 |
|
314 |
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
315 |
+
<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;">
|
316 |
<?php echo $this->__('here'); ?></a></span></td></tr>
|
317 |
<tr>
|
318 |
<td>
|
319 |
<label>
|
320 |
<?php echo $this->__('You want to be notified by e-mail when you do not have enough credits?'); ?></label>
|
321 |
+
<input name="sms_credit" <?php if($notifySmsStatus == 1) { echo 'checked'; } ?> type="radio" value="1" class="sms_credit radio_nospaceing" style="margin-right:10px;" />
|
322 |
<?php echo $this->__('Yes'); ?>
|
323 |
+
<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;" />
|
324 |
<?php echo $this->__('No'); ?>
|
325 |
<input name="credit" type="hidden" id="credits" value="<?php echo $this->getUrl('sendinblue/ajax/credit'); ?>" />
|
326 |
<div class="hideCredit" id="div_email_test" style="padding-top:20px;">
|
327 |
<form action="<?php echo $this->getUrl('*/*/sendnotifysms'); ?>" method="POST" name="notify_sms_mail_form">
|
328 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
329 |
<p class="form-data"><label><?php echo $this->__('Email'); ?></label>
|
330 |
+
<input name="sendin_notify_email" id="sendin_notify_email" type="text" class="input-text" value="<?php echo $sendinModule->getNotifyEmailStatus(); ?>" size="40" />
|
331 |
</p>
|
332 |
<p class="form-data"> <label><?php echo $this->__('Limit'); ?></label>
|
333 |
+
<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>
|
334 |
</p>
|
335 |
<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>
|
336 |
<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. '); ?>
|
363 |
<label class="r_label">
|
364 |
<?php echo $this->__('Send SMS after order confirmation'); ?></label>
|
365 |
<div class="radio_bx">
|
366 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 1) { echo 'checked'; } ?> class="sms_order_setting radio_nospaceing" type="radio" value="1" />
|
367 |
<?php echo $this->__('Yes'); ?>
|
368 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 0) { echo 'checked'; } ?> class="sms_order_setting radio_spaceing2" type="radio" value="0" />
|
369 |
<?php echo $this->__('No'); ?>
|
370 |
</div>
|
371 |
<div style="clear:both;"></div>
|
376 |
<tr>
|
377 |
<td>
|
378 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendorder'); ?>" name="sender_order_form">
|
379 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
380 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding">
|
381 |
<tr>
|
382 |
<td class="fix_width2" valign="top">
|
384 |
<?php echo $this->__('Sender'); ?></label>
|
385 |
</td>
|
386 |
<td>
|
387 |
+
<input name="sender_order" id="sender_order" type="text" value="<?php echo $sendinModule->getSendSmsOrderSubject(); ?>" class="input_bx" autocomplete="off" />
|
388 |
+
<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>
|
389 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_order_text">11</span></em>
|
390 |
</div>
|
391 |
+
|
392 |
</td>
|
393 |
</tr>
|
394 |
<tr>
|
395 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
396 |
<td>
|
397 |
+
<textarea name="sender_order_message" id="sender_order_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsmOrderMessage(); ?></textarea>
|
398 |
+
<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>
|
399 |
<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>
|
400 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_order_message_text">160</span></div>
|
401 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
416 |
<tr>
|
417 |
<td colspan="2" valign="top" border="0">
|
418 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendordertest'); ?>" name="sender_order_testForm">
|
419 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
420 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
421 |
<tr>
|
422 |
<td>
|
448 |
<label class="r_label">
|
449 |
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></label>
|
450 |
<div class="radio_bx">
|
451 |
+
<input name="sms_shiping_setting" <?php if($shipingSmsStatus==1) { echo 'checked'; } ?> class="sms_shiping_setting radio_nospaceing" type="radio" value="1" />
|
452 |
<?php echo $this->__('Yes'); ?>
|
453 |
+
<input name="sms_shiping_setting" type="radio" value="0" class="sms_shiping_setting radio_spaceing2" <?php if($shipingSmsStatus == 0) { echo 'checked'; } ?>/>
|
454 |
<?php echo $this->__('No'); ?>
|
455 |
</div>
|
456 |
<div style="clear:both;"></div>
|
462 |
<td>
|
463 |
<div class="" style="width:500px;">
|
464 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipment'); ?>" name="sender_shipment_form">
|
465 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
466 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
467 |
<tr>
|
468 |
<td class="fix_width2" valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
469 |
<td>
|
470 |
+
<input name="sender_shipment" maxlength="11" id="sender_shipment" type="text" value="<?php echo $sendinModule->getSendSmsShipingSubject(); ?>" class="input_bx" autocomplete="off" />
|
471 |
+
<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>
|
472 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_shipment_text">11</span></em>
|
473 |
</div>
|
474 |
|
475 |
</td>
|
477 |
<tr>
|
478 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
479 |
<td>
|
480 |
+
<textarea name="sender_shipment_message" id="sender_shipment_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsShipingMessage(); ?></textarea>
|
481 |
+
<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>
|
482 |
<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>
|
483 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_shipment_message_text">160</span></div>
|
484 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
500 |
<tr>
|
501 |
<td colspan="2" valign="top" border="0">
|
502 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipmenttest'); ?>" name="sender_order_testForm">
|
503 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
504 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
505 |
<tr>
|
506 |
<td valign="top" colspan="2">
|
531 |
<td class="row1 fix_width2">
|
532 |
<label class="r_label"><?php echo $this->__('Send a campaign SMS'); ?></label>
|
533 |
<div class="radio_bx">
|
534 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 1) { echo 'checked'; } ?> class="sms_campaign_setting radio_nospaceing" type="radio" value="1" />
|
535 |
<?php echo $this->__('Yes'); ?>
|
536 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 0) { echo 'checked'; } ?> class="sms_campaign_setting radio_spaceing2" type="radio" value="0" />
|
537 |
<?php echo $this->__('No'); ?>
|
538 |
</div>
|
539 |
<div class="hideCampaign">
|
543 |
<tr>
|
544 |
<td>
|
545 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendcampaign'); ?>" name="sender_campaign_form">
|
546 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
547 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding" >
|
548 |
<tr>
|
549 |
<td class="fix_width2" valign="top"> <label><?php echo $this->__('To'); ?></label></td>
|
550 |
<td>
|
551 |
+
<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'; } ?> />
|
552 |
<?php echo $this->__('A single contact'); ?>
|
553 |
|
554 |
+
<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'; } ?> />
|
555 |
<?php echo $this->__('All my Magento customers'); ?>
|
556 |
|
557 |
+
<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'; } ?> />
|
558 |
<?php echo $this->__('Only subscribed customers'); ?>
|
559 |
</td>
|
560 |
</tr>
|
578 |
<tr>
|
579 |
<td valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
580 |
<td>
|
581 |
+
<input name="sender_campaign" maxlength="11" id="sender_campaign" type="text" value="" class="input_bx" autocomplete="off" />
|
582 |
+
<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>
|
583 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_campaign_text">11</span></em>
|
584 |
</div>
|
585 |
|
586 |
</td>
|
589 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
590 |
<td>
|
591 |
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
592 |
+
<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>
|
593 |
<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>
|
594 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
595 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
603 |
</table>
|
604 |
</form>
|
605 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
606 |
+
<tr>
|
607 |
+
<td>
|
608 |
+
<div class="hintmsg"><em><?php echo $this->__('Sending a test SMS will be deducted from your SMS credits.'); ?></em></div>
|
609 |
+
<label><?php echo $this->__('Send a test SMS'); ?></label>
|
610 |
+
<input name="sender_campaigntest_number" id="sender_campaigntest_number" maxlength="17" type="text" value="" class="input_bx" />
|
611 |
+
<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>
|
612 |
+
<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" />
|
613 |
+
<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'); ?>">
|
614 |
+
</td>
|
615 |
+
</tr>
|
616 |
+
</table>
|
617 |
</td>
|
618 |
</tr>
|
619 |
</table>
|
620 |
+
</div></span>
|
|
|
621 |
</td>
|
622 |
</tr>
|
623 |
</table>
|
624 |
+
</div>
|
625 |
</div>
|
626 |
</div>
|
627 |
</div>
|
635 |
<?php if($get_syncronize == 1) { ?>
|
636 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
637 |
<fieldset id="my-fieldset" class="fields">
|
638 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Contacts list'); ?> </legend>
|
639 |
|
640 |
<input name="ajaxcontentUrl" type="hidden" id="ajaxcontentUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxcontent'); ?>" />
|
641 |
<input name="ajaxUrl" type="hidden" id="ajaxUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxupdate'); ?>" />
|
642 |
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
643 |
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
644 |
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
645 |
+
<input name="ajaxSmsSubscribeUrl" type="hidden" id="ajaxSmsSubscribeUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmssubscribe'); ?>" />
|
646 |
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
647 |
<div id="userGrid">
|
648 |
<div class="grid">
|
649 |
<div class="hor-scroll">
|
650 |
+
<?php echo $this->__('You have '); ?> <?php echo $sendinModule->getNewsletterSubscribeCount(); ?>
|
651 |
<?php echo $this->__(' contacts subscribed and '); ?>
|
652 |
+
<?php echo $sendinModule->getNewsletterUnSubscribeCount(); ?>
|
653 |
<?php echo $this->__(' contacts unsubscribed from Magento.'); ?><span id="Spantextmore" >
|
654 |
<?php echo $this->__(' For more details,'); ?></span><span id="Spantextless" style="display: none;" >
|
655 |
<?php echo $this->__(' For less details,'); ?></span><b>
|
663 |
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
664 |
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
665 |
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
666 |
+
<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>
|
667 |
+
<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>
|
668 |
</tr>
|
669 |
</thead>
|
670 |
<tbody class='midleft'>
|
|
|
671 |
</tbody>
|
672 |
</table>
|
673 |
+
</div></div></div>
|
674 |
</fieldset>
|
675 |
+
</div>
|
676 |
<?php }} ?>
|
677 |
+
|
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/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,14 @@
|
|
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"
|
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,27 +1,27 @@
|
|
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>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
+
<version>1.2.2</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="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"/>
|
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>
|
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,7 @@ 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 |
-
text-decoration: none;
|
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;}
|
|
|
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.js
CHANGED
@@ -11,33 +11,29 @@ 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 +55,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 +84,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 +112,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 +239,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 +273,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 +285,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 +308,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 +332,6 @@ jQuery(document)
|
|
357 |
}
|
358 |
}
|
359 |
});
|
360 |
-
|
361 |
});
|
362 |
|
363 |
jQuery(".sms_campaign_setting").click(function () {
|
@@ -380,10 +354,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();
|
@@ -418,15 +391,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 +474,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 +779,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 +838,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 +861,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 +874,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 |
function loadData(page) {
|
38 |
var ajaxcontentUrl = jQuery("#ajaxcontentUrl").val();
|
39 |
jQuery.ajax({
|
55 |
});
|
56 |
}
|
57 |
});
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
jQuery('.hdtab').click(function(){
|
61 |
+
if(parseInt(jQuery(this).val())) { jQuery('#hidetabselect').css('display','block');}
|
|
|
62 |
});
|
|
|
63 |
|
64 |
jQuery('body').on('click',' .pagination li.active',function() {
|
65 |
var page = jQuery(this).attr('p');
|
66 |
jQuery('#pagenumber').val(page);
|
67 |
loadData(page);
|
|
|
68 |
});
|
69 |
|
70 |
+
jQuery('.toolTip').hover(function () {
|
|
|
71 |
var title = jQuery(this).attr('title');
|
72 |
var offset = jQuery(this).offset();
|
73 |
|
84 |
jQuery('#sender_order').mouseover(function () {
|
85 |
var val = jQuery(this).val();
|
86 |
if(isInteger(val) || val == ''){
|
87 |
+
jQuery("#sender_order").attr('maxlength','11');
|
88 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
89 |
|
90 |
}
|
91 |
else{
|
92 |
jQuery("#sender_order").attr('maxlength','11');
|
93 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
94 |
jQuery("#sender_order").val(str7);
|
95 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
96 |
+
}
|
|
|
97 |
});
|
98 |
|
99 |
jQuery('#sender_order').keyup(function () {
|
100 |
var val = jQuery(this).val();
|
101 |
if(isInteger(val) || val == ''){
|
102 |
+
jQuery("#sender_order").attr('maxlength','11');
|
103 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
104 |
|
105 |
}
|
106 |
else{
|
112 |
}
|
113 |
});
|
114 |
|
115 |
+
jQuery("#sender_order").keydown(function (event) {
|
116 |
+
if (event.keyCode == 32) {
|
117 |
+
event.preventDefault();
|
118 |
+
}
|
119 |
+
});
|
120 |
|
121 |
|
122 |
if(jQuery('#sender_order').val() != '')
|
123 |
{
|
124 |
var val = jQuery('#sender_order').val();
|
125 |
if(isInteger(val)){
|
126 |
+
jQuery("#sender_order").attr('maxlength','11');
|
127 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
128 |
|
129 |
}
|
130 |
else{
|
131 |
jQuery("#sender_order").attr('maxlength','11');
|
132 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
|
|
133 |
}
|
134 |
}
|
135 |
+
|
136 |
jQuery('#sender_order_message').keyup(function () {
|
137 |
+
var chars = this.value.length,
|
|
|
138 |
messages = Math.ceil(chars / 160),
|
139 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
140 |
|
141 |
jQuery('#sender_order_message_text').text(remaining);
|
142 |
|
143 |
jQuery('#sender_order_message_text_count').text(messages);
|
|
|
144 |
});
|
145 |
|
146 |
if(jQuery('#sender_order_message').val() != '')
|
147 |
{
|
148 |
var chars = jQuery('#sender_order_message').val().length,
|
149 |
messages = Math.ceil(chars / 160),
|
150 |
+
remaining = messages * 160 - chars;
|
151 |
|
152 |
jQuery('#sender_order_message_text').text(remaining);
|
153 |
|
154 |
jQuery('#sender_order_message_text_count').text(messages);
|
155 |
}
|
156 |
+
|
157 |
jQuery('#sender_shipment').mouseover(function () {
|
158 |
var val = jQuery(this).val();
|
159 |
|
160 |
if(isInteger(val) || val == ''){
|
161 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
162 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
163 |
}
|
164 |
else{
|
165 |
jQuery("#sender_shipment").attr('maxlength','11');
|
166 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
167 |
jQuery("#sender_shipment").val(str7);
|
168 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
169 |
}
|
170 |
});
|
171 |
jQuery('#sender_shipment').keyup(function () {
|
172 |
+
var val = jQuery(this).val();
|
|
|
173 |
if(isInteger(val) || val == ''){
|
174 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
175 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
176 |
}
|
177 |
else{
|
178 |
jQuery("#sender_shipment").attr('maxlength','11');
|
179 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
180 |
jQuery("#sender_shipment").val(str7);
|
181 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
182 |
}
|
183 |
});
|
184 |
+
jQuery("#sender_shipment").keydown(function (event) {
|
185 |
+
if (event.keyCode == 32) {
|
186 |
+
event.preventDefault();
|
187 |
+
}
|
188 |
+
});
|
189 |
+
|
190 |
if(jQuery('#sender_shipment').val() != '')
|
191 |
{
|
192 |
var val = jQuery('#sender_shipment').val();
|
193 |
if(isInteger(val)){
|
194 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
195 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
196 |
}
|
197 |
else{
|
198 |
jQuery("#sender_shipment").attr('maxlength','11');
|
199 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
200 |
}
|
201 |
}
|
202 |
+
|
203 |
jQuery('#sender_shipment_message').keyup(function () {
|
204 |
|
205 |
var chars = this.value.length,
|
206 |
messages = Math.ceil(chars / 160),
|
207 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
+
jQuery('#sender_shipment_message_text').text(remaining);
|
210 |
+
jQuery('#sender_shipment_message_text_count').text(messages);
|
211 |
});
|
212 |
+
|
213 |
if(jQuery('#sender_shipment_message').val() != '')
|
214 |
{
|
215 |
var chars = jQuery('#sender_shipment_message').val().length,
|
216 |
messages = Math.ceil(chars / 160),
|
217 |
+
remaining = messages * 160 - chars;
|
218 |
|
219 |
jQuery('#sender_shipment_message_text').text(remaining);
|
|
|
220 |
jQuery('#sender_shipment_message_text_count').text(messages);
|
221 |
}
|
222 |
+
|
223 |
jQuery('#sender_campaign').mouseover(function () {
|
224 |
var val = jQuery(this).val();
|
225 |
if(isInteger(val) || val == ''){
|
226 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
227 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
228 |
|
229 |
}
|
230 |
else{
|
239 |
var val = jQuery(this).val();
|
240 |
|
241 |
if(isInteger(val) || val == ''){
|
242 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
243 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
244 |
}
|
245 |
else{
|
246 |
jQuery("#sender_campaign").attr('maxlength','11');
|
247 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
248 |
jQuery("#sender_campaign").val(str7);
|
249 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
250 |
}
|
251 |
});
|
252 |
+
jQuery("#sender_campaign").keydown(function (event) {
|
253 |
+
if (event.keyCode == 32) {
|
254 |
+
event.preventDefault();
|
255 |
+
}
|
256 |
+
});
|
257 |
+
|
258 |
if(jQuery('#sender_campaign').val() != '')
|
259 |
{
|
260 |
+
var val = jQuery('#sender_campaign').val();
|
|
|
261 |
if(isInteger(val)){
|
262 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
263 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
264 |
}
|
265 |
else{
|
266 |
jQuery("#sender_campaign").attr('maxlength','11');
|
273 |
var chars = this.value.length,
|
274 |
messages = Math.ceil(chars / 160),
|
275 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
276 |
+
|
|
|
|
|
|
|
277 |
jQuery('#sender_campaign_message_text').text(remaining);
|
278 |
+
jQuery('#sender_campaign_message_text_count').text(messages);
|
|
|
279 |
});
|
280 |
+
|
281 |
if(jQuery('#sender_campaign_message').val() != '')
|
282 |
{
|
283 |
var chars = jQuery('#sender_campaign_message').val().length,
|
285 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
286 |
|
287 |
jQuery('#sender_campaign_message_text').text(remaining);
|
|
|
288 |
jQuery('#sender_campaign_message_text_count').text(messages);
|
289 |
}
|
290 |
+
|
291 |
jQuery(".sms_order_setting").click(function () {
|
292 |
var orderSetting = jQuery(this).val();
|
293 |
var orderUrl = jQuery("#order").val();
|
308 |
jQuery(".hideOrder").hide();
|
309 |
}
|
310 |
}
|
311 |
+
});
|
|
|
312 |
});
|
313 |
+
|
314 |
jQuery(".sms_shiping_setting").click(function () {
|
315 |
var shipingSetting = jQuery(this).val();
|
316 |
var shipingUrl = jQuery("#shiping").val();
|
317 |
+
|
318 |
jQuery.ajax({
|
319 |
type: "POST",
|
320 |
async: false,
|
332 |
}
|
333 |
}
|
334 |
});
|
|
|
335 |
});
|
336 |
|
337 |
jQuery(".sms_campaign_setting").click(function () {
|
354 |
jQuery(".hideCampaign").hide();
|
355 |
}
|
356 |
}
|
357 |
+
});
|
|
|
358 |
});
|
359 |
+
|
360 |
if (jQuery('input:radio[name=sms_order_setting]:checked').val() == 0)
|
361 |
{
|
362 |
jQuery('.hideOrder').hide();
|
391 |
} else {
|
392 |
jQuery(".hideShiping").hide();
|
393 |
}
|
394 |
+
});
|
395 |
+
|
|
|
396 |
if (jQuery('input:radio[name=sms_credit]:checked').val() == 0)
|
397 |
jQuery(".hideCredit").hide();
|
398 |
else
|
399 |
jQuery(".hideCredit").show();
|
400 |
+
|
|
|
401 |
jQuery(".sms_credit").click(function (){
|
402 |
|
403 |
var sms_credit = jQuery(this).val();
|
474 |
return true
|
475 |
}
|
476 |
return false;
|
477 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
|
479 |
+
jQuery('#showUserlist').click(function(){
|
480 |
+
|
481 |
+
if(jQuery('.userDetails').is(':hidden'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
{
|
483 |
+
loadData(1);
|
484 |
+
jQuery('#Spantextless').show();
|
485 |
+
jQuery('#Spantextmore').hide();
|
486 |
+
}else
|
487 |
{
|
488 |
+
jQuery('#Spantextmore').show();
|
489 |
+
jQuery('#Spantextless').hide();
|
490 |
}
|
491 |
+
jQuery('.userDetails').slideToggle();
|
492 |
+
});
|
493 |
+
|
494 |
+
var base_url = getBaseURL();
|
495 |
+
|
496 |
+
jQuery(".Tracking").click(function()
|
497 |
+
{
|
498 |
+
var Tracking = jQuery(this).val();
|
499 |
+
var trackingUrl = jQuery("#trackingUrl").val();
|
500 |
+
if (Tracking == 0) {
|
501 |
+
jQuery('.ordertracking').hide();
|
502 |
+
}
|
503 |
+
if (Tracking == 1) {
|
504 |
+
jQuery('.ordertracking').show();
|
505 |
}
|
|
|
506 |
jQuery.ajax({
|
507 |
type : "POST",
|
508 |
async : false,
|
509 |
+
url : trackingUrl,
|
510 |
+
data : "script=" + Tracking,
|
511 |
+
beforeSend : function(){
|
512 |
jQuery('#ajax-busy').show();
|
513 |
},
|
514 |
+
success : function(msg){
|
515 |
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
516 |
}
|
517 |
+
});
|
518 |
+
});
|
519 |
+
|
520 |
+
//for import old order history
|
521 |
+
jQuery(".Trackhistory").click(function()
|
522 |
+
{
|
523 |
+
var history_status = jQuery("#history_status").val();
|
524 |
+
var langvalue = jQuery("#langvalue").val();
|
525 |
+
var ordertrackingUrl = jQuery("#importordertrackingUrl").val();
|
526 |
+
|
527 |
+
jQuery.ajax({
|
528 |
+
type : "POST",
|
529 |
+
async : false,
|
530 |
+
url : ordertrackingUrl,
|
531 |
+
data : {"history_status":history_status,"langvalue":langvalue},
|
532 |
+
beforeSend : function(){
|
533 |
+
jQuery('#ajax-busy').show();
|
534 |
+
},
|
535 |
+
success : function(msg){
|
536 |
+
jQuery('#ajax-busy').hide();
|
537 |
+
jQuery('.ordertracking').hide();
|
538 |
+
alert(msg);
|
539 |
+
}
|
540 |
+
});
|
541 |
+
});
|
542 |
+
|
543 |
+
jQuery(".smtpStatus").click(function() {
|
544 |
+
|
545 |
+
var smtptest = jQuery(this).val();
|
546 |
+
var smtpUrl = jQuery("#smtpUrl").val();
|
547 |
+
if (smtptest == 0) {
|
548 |
+
jQuery('.smtptest').hide();
|
549 |
+
}
|
550 |
+
if (smtptest == 1) {
|
551 |
+
jQuery('.smtptest').show();
|
552 |
+
}
|
553 |
+
jQuery.ajax({
|
554 |
+
type : "POST",
|
555 |
+
async : false,
|
556 |
+
url : smtpUrl,
|
557 |
+
data : "smtptest=" + smtptest,
|
558 |
+
beforeSend : function() {
|
559 |
+
jQuery('#ajax-busy').show();
|
560 |
+
},
|
561 |
+
success : function(msg) {
|
562 |
+
jQuery('#ajax-busy').hide();
|
563 |
+
}
|
564 |
+
});
|
565 |
+
});
|
566 |
+
|
567 |
+
var skin_url = jQuery('#skin_url').val()
|
568 |
+
jQuery('<div id="ajax-busy"/> loading..')
|
569 |
+
.css(
|
570 |
+
{
|
571 |
+
opacity : 0.5,
|
572 |
+
position : 'fixed',
|
573 |
+
top : 0,
|
574 |
+
left : 0,
|
575 |
+
width : '100%',
|
576 |
+
height : jQuery(window).height() + 'px',
|
577 |
+
background : 'white url('+skin_url+'adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center'
|
578 |
+
}).hide().appendTo('body');
|
579 |
+
|
580 |
+
// get site base url
|
581 |
+
function getBaseURL() {
|
582 |
+
var sBase = location.href.substr(0, location.href.lastIndexOf("/") + 1);
|
583 |
+
var sp = sBase.split('/');
|
584 |
+
var lastFolder = sp[ sp.length - 2 ];
|
585 |
+
return sBase.replace(lastFolder+'/', '');
|
586 |
+
}
|
587 |
+
|
588 |
+
jQuery('body').on('click', '.ajax_contacts_href', function (e) {
|
589 |
+
var email = jQuery(this).attr('email');
|
590 |
+
var status = jQuery(this).attr('status');
|
591 |
+
var ajaxUrl = jQuery("#ajaxUrl").val();
|
592 |
+
|
593 |
+
jQuery.ajax({
|
594 |
type : "POST",
|
595 |
async : false,
|
596 |
+
url : ajaxUrl,
|
597 |
+
data : {"email":email,"newsletter":status},
|
598 |
beforeSend : function() {
|
599 |
jQuery('#ajax-busy').show();
|
600 |
},
|
601 |
success : function(msg) {
|
602 |
+
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
603 |
}
|
604 |
+
});
|
605 |
+
|
606 |
+
var page_no = jQuery('#pagenumber').val();
|
607 |
+
loadData(page_no); // For first time page load
|
608 |
+
});
|
609 |
+
|
610 |
+
jQuery('body').on('click', '.ajax_sms_subs_href', function (e) {
|
611 |
+
|
612 |
+
var email = jQuery(this).attr('email');
|
613 |
+
var status = jQuery(this).attr('status');
|
614 |
+
var ajaxSmsUrl = jQuery("#ajaxSmsSubscribeUrl").val();
|
615 |
+
|
616 |
+
jQuery.ajax({
|
617 |
+
type : "POST",
|
618 |
+
async : false,
|
619 |
+
url : ajaxSmsUrl,
|
620 |
+
data : {"email":email,"sms":status},
|
621 |
+
beforeSend : function() {
|
622 |
+
jQuery('#ajax-busy').show();
|
623 |
+
},
|
624 |
+
success : function(msg) {
|
625 |
+
jQuery('#ajax-busy').hide();
|
626 |
}
|
627 |
+
});
|
628 |
+
|
629 |
+
var page_no = jQuery('#pagenumber').val();
|
630 |
+
loadData(page_no); // For first time page load
|
631 |
+
|
632 |
+
});
|
633 |
+
});
|
634 |
+
|
635 |
+
function testsmssend(sendererr,messageerr,mobileerr) {
|
636 |
+
var sender = jQuery('#sender_order').val();
|
637 |
+
var message =jQuery('#sender_order_message').val();
|
638 |
+
var number = jQuery("#sender_order_number").val();
|
639 |
+
var ajaxOrderSmsUrl = jQuery('#ajaxOrderSmsUrl').val();
|
640 |
+
var smsCampError = jQuery("#smsCampError").val();
|
641 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
642 |
+
if(sender == '' || isValid(sender) == false)
|
643 |
+
{
|
644 |
+
alert(sendererr);
|
645 |
+
}
|
646 |
+
else if( message == '')
|
647 |
+
{
|
648 |
+
alert(messageerr);
|
649 |
+
}
|
650 |
+
else if(number == '')
|
651 |
+
{
|
652 |
+
alert(mobileerr);
|
653 |
+
}
|
654 |
+
else {
|
655 |
+
jQuery.ajax({
|
656 |
+
type : "POST",
|
657 |
+
async : false,
|
658 |
+
url : ajaxOrderSmsUrl,
|
659 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
660 |
+
beforeSend : function() {
|
661 |
+
jQuery('#ajax-busy').show();
|
662 |
+
},
|
663 |
+
success : function(msg) {
|
664 |
+
jQuery('#ajax-busy').hide();
|
665 |
+
if(msg.trim() == 'OK')
|
666 |
+
{ alert(smsCampSuccess); }
|
667 |
+
else { alert(smsCampError); }
|
668 |
}
|
669 |
+
});}
|
670 |
+
return false;
|
671 |
+
}
|
672 |
+
|
673 |
+
function testShippedSmsSend(sendererr,messageerr,mobileerr) {
|
674 |
+
var sender = jQuery('#sender_shipment').val();
|
675 |
+
var message =jQuery('#sender_shipment_message').val();
|
676 |
+
var number = jQuery("#sender_shipment_number").val();
|
677 |
+
var ajaxOrderShippedUrl = jQuery('#ajaxOrderShippedUrl').val();
|
678 |
+
var smsCampError = jQuery("#smsCampError").val();
|
679 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
680 |
+
if(sender == '' || isValid(sender) == false)
|
681 |
+
{
|
682 |
+
alert(sendererr);
|
683 |
+
}
|
684 |
+
else if( message == '')
|
685 |
+
{
|
686 |
+
alert(messageerr);
|
687 |
+
}
|
688 |
+
else if(number == '')
|
689 |
+
{
|
690 |
+
alert(mobileerr);
|
691 |
}
|
692 |
+
else {
|
693 |
+
jQuery.ajax({
|
694 |
+
type : "POST",
|
695 |
+
async : false,
|
696 |
+
url : ajaxOrderShippedUrl,
|
697 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
698 |
+
beforeSend : function() {
|
699 |
+
jQuery('#ajax-busy').show();
|
700 |
+
},
|
701 |
+
success : function(msg) {
|
702 |
+
jQuery('#ajax-busy').hide();
|
703 |
+
if(msg.trim() == 'OK')
|
704 |
+
{ alert(smsCampSuccess); }
|
705 |
+
else { alert(smsCampError); }
|
706 |
+
}
|
707 |
+
}); }
|
708 |
+
return false;
|
709 |
+
}
|
710 |
+
|
711 |
+
function testCampaignSmsSend(sendererr,messageerr,mobileerr) {
|
712 |
+
|
713 |
+
var sender = jQuery('#sender_campaign').val();
|
714 |
+
var message =jQuery('#sender_campaign_message').val();
|
715 |
+
var number = jQuery("#sender_campaigntest_number").val();
|
716 |
+
var ajaxSmsCampaignUrl = jQuery('#ajaxSmsCampaignUrl').val();
|
717 |
+
var smsCampError = jQuery("#smsCampError").val();
|
718 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
719 |
|
720 |
+
if(sender == '' || isValid(sender) == false)
|
721 |
+
{
|
722 |
+
alert(sendererr);
|
723 |
+
}
|
724 |
+
else if( message == '')
|
725 |
+
{
|
726 |
+
alert(messageerr);
|
727 |
+
}
|
728 |
+
else if(number == '' || isMobilevalidation(number) == false)
|
729 |
+
{
|
730 |
+
alert(mobileerr);
|
731 |
+
}
|
732 |
+
else {
|
733 |
+
jQuery.ajax({
|
734 |
+
type : "POST",
|
735 |
+
async : false,
|
736 |
+
url : ajaxSmsCampaignUrl,
|
737 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
738 |
+
beforeSend : function() {
|
739 |
+
jQuery('#ajax-busy').show();
|
740 |
+
},
|
741 |
+
success : function(msg) {
|
742 |
+
jQuery('#ajax-busy').hide();
|
743 |
+
if(msg.trim() == 'OK')
|
744 |
+
{ alert(smsCampSuccess); }
|
745 |
+
else { alert(smsCampError); }
|
746 |
+
}
|
747 |
+
});}
|
748 |
+
return false;
|
749 |
+
}
|
750 |
+
|
751 |
function senderOrderSaveValid(sendererr,messageerr)
|
752 |
{
|
753 |
var sender = jQuery('#sender_order').val();
|
754 |
var message =jQuery('#sender_order_message').val();
|
755 |
if(sender == '' || isValid(sender) == false)
|
756 |
+
{
|
757 |
+
alert(sendererr);
|
758 |
+
return false;
|
759 |
+
}
|
760 |
+
else if( message == '')
|
761 |
+
{
|
762 |
+
alert(messageerr);
|
763 |
+
return false;
|
764 |
+
}
|
765 |
}
|
766 |
+
|
767 |
function senderShipmentSaveValid(sendererr,messageerr)
|
768 |
{
|
769 |
var sender = jQuery('#sender_shipment').val();
|
779 |
return false;
|
780 |
}
|
781 |
}
|
782 |
+
|
783 |
function senderCampaignSaveValid(sendererr,messageerr,mobileerr)
|
784 |
{
|
785 |
+
var sender = jQuery('#sender_campaign').val();
|
786 |
+
var message =jQuery('#sender_campaign_message').val();
|
787 |
+
var number = jQuery("#singlechoice").val();
|
788 |
+
var radiovalue = jQuery("input[name=Sendin_Sms_Choice]:checked").val();
|
789 |
+
if(radiovalue == 1)
|
790 |
+
{
|
791 |
+
if(number == '' || isMobilevalidation(number) == false)
|
792 |
+
{
|
793 |
+
alert(mobileerr);
|
794 |
+
return false;
|
795 |
+
}
|
796 |
+
else if(sender == '' || isValid(sender) == false)
|
797 |
+
{
|
798 |
+
alert(sendererr);
|
799 |
+
return false;
|
800 |
+
}
|
801 |
+
else if(message == '')
|
802 |
+
{
|
803 |
+
alert(messageerr);
|
804 |
+
return false;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
else{
|
808 |
+
if(sender == '' || isValid(sender) == false)
|
809 |
+
{
|
810 |
+
alert(sendererr);
|
811 |
+
return false;
|
812 |
+
}
|
813 |
+
else if(message == '')
|
814 |
+
{
|
815 |
+
alert(messageerr);
|
816 |
+
return false;
|
817 |
+
}
|
818 |
+
}
|
819 |
}
|
820 |
|
821 |
function isMobilevalidation(str)
|
822 |
{
|
823 |
return /^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);
|
824 |
+
}
|
825 |
+
|
826 |
function isNormalInteger(str)
|
827 |
{
|
828 |
return /^\+?(0|[1-9]\d*)$/.test(str);
|
829 |
}
|
830 |
+
|
831 |
function isValid(str) {
|
832 |
var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
|
833 |
|
838 |
}
|
839 |
return true;
|
840 |
}
|
841 |
+
|
842 |
function RegexEmail(email)
|
843 |
{
|
844 |
var emailRegexStr = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
845 |
var isvalid = emailRegexStr.test(email);
|
846 |
return isvalid;
|
847 |
}
|
848 |
+
|
849 |
function validate(emailerr,limiter)
|
850 |
{
|
|
|
|
|
851 |
if( document.notify_sms_mail_form.sendin_notify_email.value == "" || RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value) == false )
|
852 |
{
|
853 |
alert(emailerr);
|
861 |
document.notify_sms_mail_form.sendin_notify_value.focus() ;
|
862 |
return false;
|
863 |
}
|
864 |
+
|
865 |
return( true );
|
866 |
+
}
|
867 |
+
|
868 |
function smtpvalidate(emailerr)
|
869 |
+
{
|
870 |
var email = jQuery('#email').val();
|
871 |
if(email == "" || RegexEmail(email) == false )
|
872 |
{
|
874 |
jQuery('#email').focus();
|
875 |
return false;
|
876 |
}
|
877 |
+
}
|
878 |
+
|
879 |
function apikvalidate(apierr)
|
880 |
+
{
|
881 |
+
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
882 |
+
var sendin_api_check = jQuery("input[name=sendin_api_status]:checked").val();
|
883 |
|
884 |
+
if(sendin_apikey_val.trim() == "" && sendin_api_check !=0)
|
885 |
{
|
886 |
+
alert(apierr);
|
887 |
+
jQuery('#sendin_apikey_val').focus();
|
888 |
+
return false;
|
889 |
+
}
|
890 |
+
}
|
|
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(".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())}),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)})});
|