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.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.3.0
- app/code/community/Sendinblue/Sendinblue/Block/Sendinblue.php +98 -0
- app/code/community/Sendinblue/Sendinblue/Helper/Data.php +51 -0
- app/code/community/Sendinblue/Sendinblue/Model/Email.php +38 -0
- app/code/community/Sendinblue/Sendinblue/Model/Email/Template.php +86 -0
- 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 +240 -0
- app/code/community/Sendinblue/Sendinblue/Model/Psmailin.php +1284 -0
- app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php +1635 -0
- app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php +9 -9
- app/code/community/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +528 -0
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php +7 -8
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php +7 -8
- app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php +807 -0
- app/code/{local → community}/Sendinblue/Sendinblue/controllers/IndexController.php +5 -5
- app/code/{local → community}/Sendinblue/Sendinblue/etc/adminhtml.xml +0 -0
- app/code/{local → community}/Sendinblue/Sendinblue/etc/config.xml +321 -325
- app/code/{local/Sendinblue/Sendinblue/sql/sendinblue_setup/install-0.1.0.php → community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-install-0.1.0.php} +0 -0
- app/code/community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php +14 -0
- app/code/local/Sendinblue/Sendinblue/Block/Sendinblue.php +0 -90
- app/code/local/Sendinblue/Sendinblue/Helper/Data.php +0 -54
- app/code/local/Sendinblue/Sendinblue/Model/Email.php +0 -36
- app/code/local/Sendinblue/Sendinblue/Model/Email/Template.php +0 -104
- app/code/local/Sendinblue/Sendinblue/Model/Observer.php +0 -260
- app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php +0 -1072
- app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +0 -520
- app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php +0 -473
- app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php +0 -22
- app/design/adminhtml/default/default/layout/sendinblue.xml +4 -8
- app/design/adminhtml/default/default/template/sendinblue/myform.phtml +549 -360
- app/etc/modules/Sendinblue_Sendinblue.xml +2 -2
- app/locale/en_US/template/email/doubleoptin_temp.html +58 -0
- app/locale/en_US/template/email/sendin_notification.html +3 -3
- app/locale/en_US/template/email/sendinsmtp_conf.html +3 -3
- app/locale/fr_FR/Sendinblue.csv +26 -3
- app/locale/fr_FR/template/email/doubleoptin_temp.html +58 -0
- app/locale/fr_FR/template/email/sendin_notification.html +3 -3
- app/locale/fr_FR/template/email/sendinsmtp_conf.html +3 -3
- package.xml +17 -17
- skin/adminhtml/default/default/sendinblue/css/styles.css +24 -44
- skin/adminhtml/default/default/sendinblue/js/sendinblue.js +434 -375
- skin/adminhtml/default/default/sendinblue/js/sendinblue.min.js +1 -1
app/code/community/Sendinblue/Sendinblue/Block/Sendinblue.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$getEnableStatus = $sendinblueData->getEnableStatus();
|
26 |
+
$getTrackingStatus = $sendinblueData->getTrackingStatus();
|
27 |
+
$getOrderStatus = $sendinblueData->getOrderSmsStatus();
|
28 |
+
$getUserLists = $sendinblueData->getUserlists();
|
29 |
+
$smtpData = $sendinblueData->trackingSmtp();
|
30 |
+
|
31 |
+
$attributesName = $sendinblueData->allAttributesName();
|
32 |
+
$afterArrayMerge = array();
|
33 |
+
|
34 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
35 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
36 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($lastOrderId);
|
37 |
+
$dataDisplay = $order->getBillingAddress()->getData();
|
38 |
+
$orderData = $order->getData();
|
39 |
+
$custmerData = $customer->getData();
|
40 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
41 |
+
|
42 |
+
if($getEnableStatus && $getOrderStatus) {
|
43 |
+
if (!empty($dataDisplay['telephone']) && !empty($dataDisplay['country_id'])) {
|
44 |
+
$countryCode = $sendinblueData->getCountryCode($dataDisplay['country_id']);
|
45 |
+
$dataDisplay['telephone'] = $sendinblueData->checkMobileNumber($dataDisplay['telephone'],$countryCode);
|
46 |
+
}
|
47 |
+
$referenceNumber = $orderData['increment_id'];
|
48 |
+
$orderprice = $orderData['grand_total'];
|
49 |
+
$currencyCode = $orderData['base_currency_code'];
|
50 |
+
if ($localeCode == 'fr_FR') {
|
51 |
+
$orderCreatedDate = date('d/m/Y', strtotime($orderData['created_at']));
|
52 |
+
}
|
53 |
+
else {
|
54 |
+
$orderCreatedDate = date('m/d/Y', strtotime($orderData['created_at']));
|
55 |
+
}
|
56 |
+
|
57 |
+
$totalPay = $orderprice.' '.$currencyCode;
|
58 |
+
$msgbody = $sendinblueData->getSendSmsmOrderMessage();
|
59 |
+
$firstName = str_replace('{first_name}', $dataDisplay['firstname'], $msgbody);
|
60 |
+
$lastName = str_replace('{last_name}', $dataDisplay['lastname']."\r\n", $firstName);
|
61 |
+
$procuctPrice = str_replace('{order_price}', $totalPay, $lastName);
|
62 |
+
$orderDate = str_replace('{order_date}', $orderCreatedDate."\r\n", $procuctPrice);
|
63 |
+
$msgbody = str_replace('{order_reference}', $referenceNumber, $orderDate);
|
64 |
+
|
65 |
+
$sendSmsData = array();
|
66 |
+
$sendSmsData['to'] = $dataDisplay['telephone'];
|
67 |
+
$sendSmsData['from'] = $sendinblueData->getSendSmsOrderSubject();
|
68 |
+
$sendSmsData['text'] = $msgbody;
|
69 |
+
$responce = $sendinblueData->sendSmsApi($sendSmsData);
|
70 |
+
}
|
71 |
+
$allData = array_merge($dataDisplay, $custmerData);
|
72 |
+
$afterArrayMerge = $sendinblueData->mergeMyArray($attributesName, $allData);
|
73 |
+
$client = (!empty($custmerData['firstname'])|| !empty($custmerData['firstname'])) ? 1 : 0 ;
|
74 |
+
|
75 |
+
$afterArrayMerge['CLIENT'] = $client;
|
76 |
+
$email = $custmerData['email']; // for email address
|
77 |
+
$costomerInformation = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
78 |
+
$nlStatus = $costomerInformation->getStatus();
|
79 |
+
|
80 |
+
if ($nlStatus == 1) {
|
81 |
+
$sendinblueData->emailAdd($email, $afterArrayMerge, $nlStatus);
|
82 |
+
}
|
83 |
+
|
84 |
+
if ($getEnableStatus == 1 && $getTrackingStatus == 1 && $nlStatus == 1) {
|
85 |
+
$valueConfig = $sendinblueData->getApiConfigValue();
|
86 |
+
if (isset($valueConfig['data']['date_format']) && $valueConfig['data']['date_format'] == 'dd-mm-yyyy') {
|
87 |
+
$date = date('d-m-Y', strtotime($orderData['created_at']));
|
88 |
+
}
|
89 |
+
else {
|
90 |
+
$date = date('m-d-Y', strtotime($orderData['created_at']));
|
91 |
+
}
|
92 |
+
|
93 |
+
$getUserLists = array($getUserLists);
|
94 |
+
$attributesValues = array("PRENOM" => $custmerData['firstname'], "NOM" => $custmerData['lastname'], "ORDER_ID" => $referenceNumber, "ORDER_DATE" => $date, "ORDER_PRICE" => $orderprice);
|
95 |
+
$sendinblueData->importTransactionalData($email, $attributesValues, $getUserLists);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Helper/Data.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
public function getSMTP()
|
14 |
+
{
|
15 |
+
return Mage::getStoreConfig('sendinblue/smtp/option') == 'smtp';
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getTransport()
|
19 |
+
{
|
20 |
+
if ($this->getSMTP()) {
|
21 |
+
$username = Mage::getStoreConfig('sendinblue/smtp/username');
|
22 |
+
$password = Mage::getStoreConfig('sendinblue/smtp/password');
|
23 |
+
$host = Mage::getStoreConfig('sendinblue/smtp/host');
|
24 |
+
$port = Mage::getStoreConfig('sendinblue/smtp/port');
|
25 |
+
$auth = Mage::getStoreConfig('sendinblue/smtp/authentication');
|
26 |
+
$config = array();
|
27 |
+
$config['username'] = $username;
|
28 |
+
$config['password'] = $password;
|
29 |
+
$config['port'] = $port;
|
30 |
+
$config['ssl'] = null;
|
31 |
+
$config['auth'] = $auth;
|
32 |
+
$transport = new Zend_Mail_Transport_Smtp($host, $config);
|
33 |
+
}
|
34 |
+
else {
|
35 |
+
Mage::log('Disabled, or no matching transport');
|
36 |
+
return null;
|
37 |
+
}
|
38 |
+
Mage::log('Returning transport');
|
39 |
+
return $transport;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function ModuleisEnabled()
|
43 |
+
{
|
44 |
+
return Mage::getStoreConfig('sendinblue/enabled');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function isEnabled()
|
48 |
+
{
|
49 |
+
return Mage::getStoreConfig('sendinblue/smtp/status');
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Email.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Model_Email extends Mage_Core_Model_Email {
|
12 |
+
/**
|
13 |
+
* override send function
|
14 |
+
*/
|
15 |
+
public function send()
|
16 |
+
{
|
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 |
+
Mage::log('SendinblueSMTP is enabled, sending email in Sendinblue_Sendinblue_Model_Sendinblue');
|
21 |
+
$mail = new Zend_Mail();
|
22 |
+
if (strtolower($this->getType()) == 'html') {
|
23 |
+
$mail->setBodyHtml($this->getBody());
|
24 |
+
}
|
25 |
+
else {
|
26 |
+
$mail->setBodyText($this->getBody());
|
27 |
+
}
|
28 |
+
$transport = Mage::helper('sendinblue')->getTransport();
|
29 |
+
$email = Mage::getStoreConfig('contacts/email/recipient_email');
|
30 |
+
$mail->setFrom($this->getFromEmail(), $this->getFromName())
|
31 |
+
->addTo($email, $this->getToName())
|
32 |
+
->setSubject($this->getSubject());
|
33 |
+
Mage::log('About to send email');
|
34 |
+
$mail->send($transport);
|
35 |
+
Mage::log('Finished sending email');
|
36 |
+
return $this;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Email/Template.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
12 |
+
|
13 |
+
public function send($email, $name=null, array $variables = array())
|
14 |
+
{
|
15 |
+
// If it's not enabled, just return the parent result.
|
16 |
+
// If it's not enabled, just return the parent result.
|
17 |
+
if (Mage::helper('sendinblue')->isEnabled()==0 || Mage::helper('sendinblue')->ModuleisEnabled()==0) {
|
18 |
+
return parent::send($email, $name, $variables);
|
19 |
+
}
|
20 |
+
|
21 |
+
if(!$this->isValidForSend()) {
|
22 |
+
Mage::log('SMTP: Email not valid for sending - check template, and smtp enabled/disabled setting');
|
23 |
+
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
$emails = array_values((array)$email);
|
27 |
+
$names = is_array($name) ? $name : (array)$name;
|
28 |
+
$names = array_values($names);
|
29 |
+
|
30 |
+
foreach ($emails as $key => $email) {
|
31 |
+
if (!isset($names[$key])) {
|
32 |
+
$names[$key] = substr($email, 0, strpos($email, '@'));
|
33 |
+
}
|
34 |
+
}
|
35 |
+
$variables['email'] = reset($emails);
|
36 |
+
$variables['name'] = reset($names);
|
37 |
+
$mail = $this->getMail();
|
38 |
+
|
39 |
+
if (true) {
|
40 |
+
$email = Mage::getStoreConfig('contacts/email/recipient_email', $this->getDesignConfig()->getStore());
|
41 |
+
Mage::log("Development mode set to send all emails to contact form recipient: " . $email);
|
42 |
+
}
|
43 |
+
// In Magento core they set the Return-Path here, for the sendmail command.
|
44 |
+
|
45 |
+
foreach ($emails as $key => $email) {
|
46 |
+
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
|
47 |
+
}
|
48 |
+
$this->setUseAbsoluteLinks(true);
|
49 |
+
$text = $this->getProcessedTemplate($variables, true);
|
50 |
+
|
51 |
+
if($this->isPlain()) {
|
52 |
+
$mail->setBodyText($text);
|
53 |
+
}
|
54 |
+
else {
|
55 |
+
$mail->setBodyHTML($text);
|
56 |
+
}
|
57 |
+
|
58 |
+
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
|
59 |
+
$mail->setFrom($this->getSenderEmail(), $this->getSenderName());
|
60 |
+
$transport = Mage::helper('sendinblue')->getTransport();
|
61 |
+
|
62 |
+
try {
|
63 |
+
// adding new Event dispatch in case anyone wants to interrogate an email before being sent
|
64 |
+
// throwing an Exception in the Event Observer will prevent the mail being sent,
|
65 |
+
// and will return false to the calling function
|
66 |
+
Mage::dispatchEvent('sendin_email_after_send', array(
|
67 |
+
'mail' => $mail,
|
68 |
+
'template' => $this->getTemplateId(),
|
69 |
+
'subject' => $this->getProcessedTemplateSubject($variables),
|
70 |
+
));
|
71 |
+
|
72 |
+
Mage::log('About to send email');
|
73 |
+
$mail->send($transport); // Zend_Mail warning..
|
74 |
+
|
75 |
+
Mage::log('Finished sending email');
|
76 |
+
$this->_mail = null;
|
77 |
+
}
|
78 |
+
catch (Exception $exception) {
|
79 |
+
Mage::logException($exception);
|
80 |
+
$responceData = array('result'=>false, 'error'=>$exception->getMessage());
|
81 |
+
return json_encode($responceData);
|
82 |
+
}
|
83 |
+
$responceData = array('result'=>true);
|
84 |
+
return json_encode($responceData);
|
85 |
+
}
|
86 |
+
}
|
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,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
16 |
+
if (isset($requestParameters['subscriber']) && count($requestParameters['subscriber'] > 0)) {
|
17 |
+
$customerEmail = array();
|
18 |
+
$newsLatterSubscriber = Mage::getModel('newsletter/subscriber');
|
19 |
+
foreach ($requestParameters['subscriber'] as $costomerId) {
|
20 |
+
$costomerData = $newsLatterSubscriber->load($costomerId)->toArray();
|
21 |
+
$customerEmail[] = empty($costomerData['subscriber_email']) ? array() : $costomerData['subscriber_email'];
|
22 |
+
}
|
23 |
+
$customerEmails = implode('|', $customerEmail);
|
24 |
+
$emailDeleteResponce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customerEmails);
|
25 |
+
}
|
26 |
+
|
27 |
+
if (isset($emailDeleteResponce['data']['unsubEmails'])){
|
28 |
+
Mage::getModel('core/session')->addSuccess(Mage::helper('sendinblue')->__('Total of '. count($emailDeleteResponce['data']['unsubEmails']) .' record(s) were Unsubscribed'));
|
29 |
+
}
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function adminCustomerDelete($observer)
|
34 |
+
{
|
35 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
36 |
+
if (isset($requestParameters['customer']) && count($requestParameters['customer'] > 0)) {
|
37 |
+
$customerEmail = array();
|
38 |
+
$customerObj = Mage::getModel('customer/customer');
|
39 |
+
foreach ($requestParameters['customer'] as $costomerId) {
|
40 |
+
$costomerData = $customerObj->load($costomerId)->toArray();
|
41 |
+
$customerEmail[] = empty($costomerData['email'])?array():$costomerData['email'];
|
42 |
+
}
|
43 |
+
$customerEmails = implode('|', $customerEmail);
|
44 |
+
$emailDeleteResponce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customerEmails);
|
45 |
+
}
|
46 |
+
|
47 |
+
if (isset($emailDeleteResponce['data']['unsubEmails'])) {
|
48 |
+
Mage::getModel('core/session')->addSuccess(Mage::helper('sendinblue')->__('Total of '. count($emailDeleteResponce['data']['unsubEmails']) .' record(s) were Unsubscribed'));
|
49 |
+
}
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function adminCustomerSubscribe($observer)
|
54 |
+
{
|
55 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
56 |
+
if (isset($requestParameters['customer']) && count($requestParameters['customer'] > 0)) {
|
57 |
+
$customerEmail = array();
|
58 |
+
$customerObj = Mage::getModel('customer/customer');
|
59 |
+
foreach ($requestParameters['customer'] as $costomerId) {
|
60 |
+
$costomerData = $customerObj->load($costomerId)->toArray();
|
61 |
+
$customerEmail[] = empty($costomerData['email'])?array():$costomerData['email'];
|
62 |
+
}
|
63 |
+
$customerEmails = implode('|', $customerEmail);
|
64 |
+
$addEmailResponce = Mage::getModel('sendinblue/sendinblue')->addEmailList($customerEmails);
|
65 |
+
}
|
66 |
+
if (isset($addEmailResponce['code']) && $addEmailResponce['code'] == 'success') {
|
67 |
+
Mage::getModel('core/session')->addSuccess(Mage::helper('sendinblue')->__('Email has been subscribed successfully.'));
|
68 |
+
}
|
69 |
+
return $this;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function subscribeObserver($observer)
|
73 |
+
{
|
74 |
+
$extra = array();
|
75 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
76 |
+
$extra = Mage::getModel('newsletter/subscriber')->loadByEmail($requestParameters['email'])->getData();
|
77 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
78 |
+
$attributesName = $sendinModule->allAttributesName();
|
79 |
+
|
80 |
+
if ($requestParameters['email'] != '') {
|
81 |
+
$newsletterStatus = 0;
|
82 |
+
}
|
83 |
+
|
84 |
+
$client = 0;
|
85 |
+
$mergeArrayResponse = $sendinModule->mergeMyArray($attributesName, $extra);
|
86 |
+
$mergeArrayResponse['CLIENT'] = $client;
|
87 |
+
$emailAddResponce = $sendinModule->emailAdd($requestParameters['email'], $mergeArrayResponse, $newsletterStatus);
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function updateNewObserver($observer)
|
92 |
+
{
|
93 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
94 |
+
$costomerSession = Mage::getSingleton('customer/session')->getCustomer();
|
95 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
96 |
+
$attributesName = $sendinModule->allAttributesName();
|
97 |
+
|
98 |
+
$customerSessionEmail = $costomerSession->getEmail();
|
99 |
+
if (empty($customerSessionEmail)) {
|
100 |
+
$customer = $observer->getCustomer();
|
101 |
+
$customerData = $customer->getData();
|
102 |
+
}
|
103 |
+
else{
|
104 |
+
$customerData = $costomerSession->getData();
|
105 |
+
}
|
106 |
+
|
107 |
+
$email = $customerData['email'];
|
108 |
+
$costomerEntityId = isset($customerData['entity_id'])?$customerData['entity_id']:'';
|
109 |
+
$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',$costomerEntityId);
|
110 |
+
|
111 |
+
$telephone = '';
|
112 |
+
$customerAddress = array();
|
113 |
+
$customerAddressData = array();
|
114 |
+
foreach ($collectionAddress as $customerPhno) {
|
115 |
+
$customerAddress = $customerPhno->getData();
|
116 |
+
if (!empty($customerAddress['telephone'])) {
|
117 |
+
if(!empty($customerAddress['country_id'])) {
|
118 |
+
$countryCode = $sendinModule->getCountryCode($customerAddress['country_id']);
|
119 |
+
$customerAddress['telephone'] = $sendinModule->checkMobileNumber($customerAddress['telephone'], $countryCode);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$customerAddressData = array_merge($customerAddress, $customerData);
|
125 |
+
if (!empty($customerData['firstname']) && !empty($customerData['lastname'])) {
|
126 |
+
$client = 1;
|
127 |
+
}
|
128 |
+
else {
|
129 |
+
$client = 0;
|
130 |
+
}
|
131 |
+
|
132 |
+
$isSubscribed = !empty($customerAddressData['is_subscribed']) ? $customerAddressData['is_subscribed'] : $requestParameters['is_subscribed'];
|
133 |
+
if (!empty($customerData['firstname']) || !empty($customerAddress['telephone']) || !empty($email)) {
|
134 |
+
$costomerData = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
135 |
+
$costomerDataStatus = $costomerData->getStatus();
|
136 |
+
$mergeArrayResponse = $sendinModule->mergeMyArray($attributesName, $customerAddressData);
|
137 |
+
$mergeArrayResponse['CLIENT'] = $client;
|
138 |
+
if (isset($isSubscribed) && $isSubscribed == 1 && empty($costomerDataStatus)) {
|
139 |
+
$responce = $sendinModule->emailAdd($email, $mergeArrayResponse, $isSubscribed);
|
140 |
+
$sendinModule->sendWsTemplateMail($email);
|
141 |
+
}
|
142 |
+
elseif (!empty($costomerDataStatus)) {
|
143 |
+
$responce = $sendinModule->emailAdd($email, $mergeArrayResponse);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if (isset($isSubscribed) && !empty($isSubscribed) && $isSubscribed === 0) {
|
148 |
+
$responce = $sendinModule->emailDelete($email);
|
149 |
+
}
|
150 |
+
return $this;
|
151 |
+
}
|
152 |
+
|
153 |
+
public function syncData()
|
154 |
+
{
|
155 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
156 |
+
return $this;
|
157 |
+
}
|
158 |
+
|
159 |
+
public function updateStatus($observer)
|
160 |
+
{
|
161 |
+
$order = $observer->getEvent()->getOrder();
|
162 |
+
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
|
163 |
+
$history = $order->getShipmentsCollection();
|
164 |
+
$shipmentHistoryData=$history->toarray();
|
165 |
+
if($shipmentHistoryData['totalRecords'] > 0) {
|
166 |
+
$orderId = isset($shipmentHistoryData['items']['0']['order_id']) ? $shipmentHistoryData['items']['0']['order_id'] : '';
|
167 |
+
$shippingaddrid = isset($shipmentHistoryData['items']['0']['shipping_address_id']) ? $shipmentHistoryData['items']['0']['shipping_address_id'] : '';
|
168 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
169 |
+
$_shippingAddress = $_order->getShippingAddress();
|
170 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
171 |
+
$mobileSms = $_shippingAddress->getTelephone();
|
172 |
+
$mobileSms = !empty($mobileSms) ? $mobileSms : '';
|
173 |
+
$countryid = $_shippingAddress->getCountryId();
|
174 |
+
$countryid = !empty($countryid) ? $countryid : '';
|
175 |
+
$codeResource = Mage::getSingleton('core/resource');
|
176 |
+
$tableCountry = $codeResource->getTableName('sendinblue_country_codes');
|
177 |
+
$readDbObject = Mage::getSingleton("core/resource")->getConnection("core_read");
|
178 |
+
$queryCountryCode = $readDbObject->select()
|
179 |
+
->from($tableCountry, array('country_prefix'))
|
180 |
+
->where("iso_code = ?", $countryid);
|
181 |
+
$stmtCountryCode = $readDbObject->query($queryCountryCode);
|
182 |
+
$data = $stmtCountryCode->fetch();
|
183 |
+
$mobile = '';
|
184 |
+
$countryPrefix = $data['country_prefix'];
|
185 |
+
$sendinblueModule = Mage::getModel('sendinblue/sendinblue');
|
186 |
+
if(isset($countryPrefix) && !empty($countryPrefix)){
|
187 |
+
$mobile = $sendinblueModule->checkMobileNumber($mobileSms,$countryPrefix);
|
188 |
+
}
|
189 |
+
$firstname = $_shippingAddress->getFirstname();
|
190 |
+
$firstname = !empty($firstname ) ? $firstname : '';
|
191 |
+
$lastname = $_shippingAddress->getLastname();
|
192 |
+
$lastname = !empty($lastname) ? $lastname : '';
|
193 |
+
$refNum = $_order->getIncrementId();
|
194 |
+
$refNum = !empty($refNum) ? $refNum : '';
|
195 |
+
$orderprice = $_order->getGrandTotal();
|
196 |
+
$orderprice = !empty($orderprice) ? $orderprice:'';
|
197 |
+
$courrencycode = $_order->getBaseCurrencyCode();
|
198 |
+
$courrencycode = !empty($courrencycode) ? $courrencycode:'';
|
199 |
+
$orderdate = $_order->getCreatedAt();
|
200 |
+
$orderdate = !empty($orderdate) ? $orderdate : '';
|
201 |
+
|
202 |
+
$ordDate = ($locale == 'fr_FR') ? date('d/m/Y', strtotime($orderdate)) : date('m/d/Y', strtotime($orderdate));
|
203 |
+
|
204 |
+
$totalPay = $orderprice.' '.$courrencycode;
|
205 |
+
$messageBody = $sendinblueModule->getSendSmsShipingMessage();
|
206 |
+
$fname = str_replace('{first_name}', $firstname, $messageBody);
|
207 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
208 |
+
$procuctPrice = str_replace('{order_price}', $totalPay, $lname);
|
209 |
+
$orderDate = str_replace('{order_date}', $ordDate."\r\n", $procuctPrice);
|
210 |
+
$messageBody = str_replace('{order_reference}', $refNum, $orderDate);
|
211 |
+
|
212 |
+
$smsInformation = array();
|
213 |
+
$smsInformation['to'] = $mobile;
|
214 |
+
$smsInformation['from'] = $sendinblueModule->getSendSmsShipingSubject();
|
215 |
+
$smsInformation['text'] = $messageBody;
|
216 |
+
$sendinblueModule->sendSmsApi($smsInformation);
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
public function subscribedToNewsletter($observer)
|
222 |
+
{
|
223 |
+
$data = $observer->subscriber;
|
224 |
+
$requestParameters = Mage::app()->getRequest()->getParams();
|
225 |
+
if (empty($requestParameters['firstname']) && empty($requestParameters['lastname'])) {
|
226 |
+
$sibObj = Mage::getModel('sendinblue/sendinblue');
|
227 |
+
$subscriberEmail = $data->subscriber_email;
|
228 |
+
|
229 |
+
if($data->subscriber_status == 3) {
|
230 |
+
$sibObj->emailDelete($subscriberEmail);
|
231 |
+
}
|
232 |
+
else if ($data->subscriber_status == 1 && !empty($subscriberEmail)) {
|
233 |
+
$sibObj->emailSubscribe($data->subscriber_email);
|
234 |
+
if( !isset($requestParameters['newsletter'])) {
|
235 |
+
$sibObj->sendWsTemplateMail($data->subscriber_email);
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Psmailin.php
ADDED
@@ -0,0 +1,1284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* 2007-2014 PrestaShop
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@prestashop.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
18 |
+
* versions in the future. If you wish to customize PrestaShop for your
|
19 |
+
* needs please refer to http://www.prestashop.com for more information.
|
20 |
+
*
|
21 |
+
* @author PrestaShop SA <contact@prestashop.com>
|
22 |
+
* @copyright 2007-2014 PrestaShop SA
|
23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
+
* International Registered Trademark & Property of PrestaShop SA
|
25 |
+
*/
|
26 |
+
|
27 |
+
class Sendinblue_Sendinblue_Model_Psmailin
|
28 |
+
{
|
29 |
+
public $api_key;
|
30 |
+
public $base_url;
|
31 |
+
public function __construct($params)
|
32 |
+
{
|
33 |
+
if (!function_exists('curl_init')) {
|
34 |
+
throw new Exception('Mailin requires CURL module');
|
35 |
+
}
|
36 |
+
$this->base_url = "https://api.sendinblue.com/v2.0";
|
37 |
+
$this->api_key = $params['api_key'];
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Do CURL request with authorization
|
43 |
+
*/
|
44 |
+
private function doRequest($resource, $method, $input)
|
45 |
+
{
|
46 |
+
$called_url = $this->base_url."/".$resource;
|
47 |
+
$ch = curl_init($called_url);
|
48 |
+
$auth_header = 'api-key:'.$this->api_key;
|
49 |
+
$content_header = "Content-Type:application/json";
|
50 |
+
$track_header = "sib-plugin:magento-1.2.8";
|
51 |
+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
52 |
+
// Windows only over-ride
|
53 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
54 |
+
}
|
55 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth_header, $content_header, $track_header));
|
56 |
+
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
57 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
58 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
59 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
60 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
|
61 |
+
$data = curl_exec($ch);
|
62 |
+
if (curl_errno($ch)) {
|
63 |
+
echo '<div style="background:#d14836; padding:10px; color:#fff; font-weight:600; position:aboslute;width:100%;top:0;">Curl error: '.curl_error($ch).'</div>';
|
64 |
+
}
|
65 |
+
curl_close($ch);
|
66 |
+
return json_decode($data, true);
|
67 |
+
}
|
68 |
+
|
69 |
+
public function get($resource, $input)
|
70 |
+
{
|
71 |
+
return $this->doRequest($resource, "GET", $input);
|
72 |
+
}
|
73 |
+
public function put($resource, $input)
|
74 |
+
{
|
75 |
+
return $this->doRequest($resource, "PUT", $input);
|
76 |
+
}
|
77 |
+
public function post($resource, $input)
|
78 |
+
{
|
79 |
+
return $this->doRequest($resource, "POST", $input);
|
80 |
+
}
|
81 |
+
public function delete($resource, $input)
|
82 |
+
{
|
83 |
+
return $this->doRequest($resource, "DELETE", $input);
|
84 |
+
}
|
85 |
+
|
86 |
+
/*
|
87 |
+
Get Account.
|
88 |
+
No input required
|
89 |
+
*/
|
90 |
+
public function getAccount()
|
91 |
+
{
|
92 |
+
return $this->get("account", "");
|
93 |
+
}
|
94 |
+
|
95 |
+
/*
|
96 |
+
Get SMTP details.
|
97 |
+
No input required
|
98 |
+
*/
|
99 |
+
public function getSmtpDetails()
|
100 |
+
{
|
101 |
+
return $this->get("account/smtpdetail", "");
|
102 |
+
}
|
103 |
+
|
104 |
+
/*
|
105 |
+
Create Child Account.
|
106 |
+
@param {Array} data contains php array with key value pair.
|
107 |
+
@options data {String} child_email: Email address of Reseller child [Mandatory]
|
108 |
+
@options data {String} password: Password of Reseller child to login [Mandatory]
|
109 |
+
@options data {String} company_org: Name of Reseller child’s company [Mandatory]
|
110 |
+
@options data {String} first_name: First name of Reseller child [Mandatory]
|
111 |
+
@options data {String} last_name: Last name of Reseller child [Mandatory]
|
112 |
+
@options data {Array} credits: Number of email & sms credits respectively, which will be
|
113 |
+
assigned to the Reseller child’s account [Optional]
|
114 |
+
- email_credit {Integer} number of email credits
|
115 |
+
- sms_credit {Integer} Number of sms credts
|
116 |
+
@options data {Array} associate_ip: Associate dedicated IPs to reseller child.
|
117 |
+
You can use commas to separate multiple IPs [Optional]
|
118 |
+
*/
|
119 |
+
public function createChildAccount($data)
|
120 |
+
{
|
121 |
+
return $this->post("account", json_encode($data));
|
122 |
+
}
|
123 |
+
|
124 |
+
/*
|
125 |
+
Update Child Account.
|
126 |
+
@param {Array} data contains php array with key value pair.
|
127 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to
|
128 |
+
be modified [Mandatory]
|
129 |
+
@options data {String} company_org: Name of Reseller child’s company [Optional]
|
130 |
+
@options data {String} first_name: First name of Reseller child [Optional]
|
131 |
+
@options data {String} last_name: Last name of Reseller child [Optional]
|
132 |
+
@options data {String} password: Password of Reseller child to login [Optional]
|
133 |
+
@options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use
|
134 |
+
commas to separate multiple IPs [Optional]
|
135 |
+
@options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can
|
136 |
+
use commas to separate multiple IPs [Optional]
|
137 |
+
*/
|
138 |
+
public function updateChildAccount($data)
|
139 |
+
{
|
140 |
+
return $this->put("account", json_decode($data));
|
141 |
+
}
|
142 |
+
|
143 |
+
/*
|
144 |
+
Delete Child Account.
|
145 |
+
@param {Array} data contains php array with key value pair.
|
146 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to be
|
147 |
+
deleted [Mandatory]
|
148 |
+
*/
|
149 |
+
public function deleteChildAccount($data)
|
150 |
+
{
|
151 |
+
return $this->delete("account/".$data['auth_key'], "");
|
152 |
+
}
|
153 |
+
|
154 |
+
/*
|
155 |
+
Get Reseller child Account.
|
156 |
+
@param {Array} data contains php array with key value pair.
|
157 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child.
|
158 |
+
Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL",
|
159 |
+
"key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
|
160 |
+
*/
|
161 |
+
public function getResellerChild($data)
|
162 |
+
{
|
163 |
+
return $this->post("account/getchildv2", json_encode($data));
|
164 |
+
}
|
165 |
+
|
166 |
+
/*
|
167 |
+
Add/Remove Reseller child's Email/Sms credits.
|
168 |
+
@param {Array} data contains php array with key value pair.
|
169 |
+
@options data {String} auth_key: 16 character authorization key of Reseller child to modify
|
170 |
+
credits [Mandatory]
|
171 |
+
@options data {Array} add_credit: Number of email & sms credits to be added. You can assign
|
172 |
+
either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
|
173 |
+
- email_credit {Integer} number of email credits
|
174 |
+
- sms_credit {Integer} Number of sms credts
|
175 |
+
@options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign
|
176 |
+
either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
|
177 |
+
- email_credit {Integer} number of email credits
|
178 |
+
- sms_credit {Integer} Number of sms credts
|
179 |
+
*/
|
180 |
+
public function addRemoveChildCredits($data)
|
181 |
+
{
|
182 |
+
return $this->post("account/addrmvcredit", json_decode($data));
|
183 |
+
}
|
184 |
+
|
185 |
+
/*
|
186 |
+
Get a particular campaign detail.
|
187 |
+
@param {Array} data contains php array with key value pair.
|
188 |
+
@options data {Integer} id: Unique Id of the campaign [Mandatory]
|
189 |
+
*/
|
190 |
+
public function getCampaignV2($data)
|
191 |
+
{
|
192 |
+
return $this->get("campaign/".$data['id']."/detailsv2", "");
|
193 |
+
}
|
194 |
+
|
195 |
+
/*
|
196 |
+
Get all campaigns detail.
|
197 |
+
@param {Array} data contains php array with key value pair.
|
198 |
+
@options data {String} type: Type of campaign. Possible values – classic, trigger,
|
199 |
+
sms, template ( case sensitive ) [Optional]
|
200 |
+
@options data {String} status: Status of campaign. Possible values – draft, sent, archive
|
201 |
+
, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
|
202 |
+
@options data {Integer} page: Maximum number of records per request is 500, if there are
|
203 |
+
more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
|
204 |
+
@options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
|
205 |
+
*/
|
206 |
+
public function getCampaignsV2($data)
|
207 |
+
{
|
208 |
+
return $this->get("campaign/detailsv2", json_decode($data));
|
209 |
+
}
|
210 |
+
|
211 |
+
/*
|
212 |
+
Create and Schedule your campaigns. It returns the ID of the created campaign.
|
213 |
+
@param {Array} data contains php array with key value pair.
|
214 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
215 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
216 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
217 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
218 |
+
sender exists]
|
219 |
+
@options data {String} name: Name of the campaign [Mandatory]
|
220 |
+
@options data {String} bat: Email address for test mail [Optional]
|
221 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
222 |
+
more than 10 characters [Mandatory: if html_url is empty]
|
223 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
224 |
+
html_content is empty]
|
225 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent
|
226 |
+
[Mandatory: if scheduled_date is not empty]
|
227 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
228 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
229 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
230 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
231 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
232 |
+
sender exists]
|
233 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
234 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to
|
235 |
+
include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact
|
236 |
+
attributes here, these should already exist in SendinBlue account [Optional]
|
237 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
|
238 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
239 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default)
|
240 |
+
& 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be
|
241 |
+
embedded, in the email [Optional]
|
242 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0
|
243 |
+
& 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1
|
244 |
+
means mirror links are activated, in the campaign [Optional]
|
245 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default)
|
246 |
+
& 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to
|
247 |
+
send now [Optional]
|
248 |
+
|
249 |
+
*/
|
250 |
+
public function createCampaign($data)
|
251 |
+
{
|
252 |
+
return $this->post("campaign", json_decode($data));
|
253 |
+
}
|
254 |
+
|
255 |
+
/*
|
256 |
+
Update your campaign.
|
257 |
+
@param {Array} data contains php array with key value pair.
|
258 |
+
@options data {Integer} id: Id of campaign to be modified [Mandatory]
|
259 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
260 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
261 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
262 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
263 |
+
sender exists]
|
264 |
+
@options data {String} name: Name of the campaign [Optional]
|
265 |
+
@options data {String} bat: Email address for test mail [Optional]
|
266 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
267 |
+
more than 10 characters [Optional]
|
268 |
+
@options data {String} html_url: Url which content is the body of content [Optional]
|
269 |
+
@options data {Array} listid These are the lists to which the campaign has been sent
|
270 |
+
[Mandatory: if scheduled_date is not empty]
|
271 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to
|
272 |
+
run[Optional]
|
273 |
+
@options data {String} subject: Subject of the campaign.
|
274 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
275 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
276 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients,
|
277 |
+
if sender exists]
|
278 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
279 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to
|
280 |
+
include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the
|
281 |
+
contact attributes here, these should already exist in SendinBlue account [Optional]
|
282 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the
|
283 |
+
campaign [Optional]
|
284 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
285 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0
|
286 |
+
(default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1
|
287 |
+
means image can be embedded, in the email [Optional]
|
288 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible
|
289 |
+
values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, &
|
290 |
+
mirror_active = 1 means mirror links are activated, in the campaign [Optional]
|
291 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0
|
292 |
+
(default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means
|
293 |
+
campaign ready to send now [Optional]
|
294 |
+
*/
|
295 |
+
public function updateCampaign($data)
|
296 |
+
{
|
297 |
+
$id = $data['id'];
|
298 |
+
unset($data['id']);
|
299 |
+
return $this->put("campaign/".$id, json_decode($data));
|
300 |
+
}
|
301 |
+
|
302 |
+
/*
|
303 |
+
Delete your campaigns.
|
304 |
+
@param {Array} data contains php array with key value pair.
|
305 |
+
@options data {Integer} id: Id of campaign to be deleted [Mandatory]
|
306 |
+
*/
|
307 |
+
public function deleteCampaign($data)
|
308 |
+
{
|
309 |
+
return $this->delete("campaign/".$data['id'], "");
|
310 |
+
}
|
311 |
+
|
312 |
+
/*
|
313 |
+
Send report of Sent and Archived campaign.
|
314 |
+
@param {Array} data contains php array with key value pair.
|
315 |
+
@options data {Integer} id: Id of campaign to send its report [Mandatory]
|
316 |
+
@options data {String} lang: Language of email content. Possible values – fr
|
317 |
+
(default), en, es, it & pt [Optional]
|
318 |
+
@options data {String} email_subject: Message subject [Mandatory]
|
319 |
+
@options data {Array} email_to: Email address of the recipient(s). Example:
|
320 |
+
"test@example.net". You can use commas to separate multiple recipients [Mandatory]
|
321 |
+
@options data {String} email_content_type: Body of the message in text/HTML version.
|
322 |
+
Possible values – text & html [Mandatory]
|
323 |
+
@options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
|
324 |
+
@options data {Array} email_cc: Same as email_to but for Cc [Optional]
|
325 |
+
@options data {String} email_body: Body of the message [Mandatory]
|
326 |
+
*/
|
327 |
+
public function campaignReportEmail($data)
|
328 |
+
{
|
329 |
+
$id = $data['id'];
|
330 |
+
unset($data['id']);
|
331 |
+
return $this->post("campaign/".$id."/report", json_decode($data));
|
332 |
+
}
|
333 |
+
|
334 |
+
/*
|
335 |
+
Export the recipients of a specified campaign.
|
336 |
+
@param {Array} data contains php array with key value pair.
|
337 |
+
@options data {Integer} id: Id of campaign to export its recipients [Mandatory]
|
338 |
+
@options data {String} notify_url: URL that will be called once the export process
|
339 |
+
is finished [Mandatory]
|
340 |
+
@options data {String} type: Type of recipients. Possible values – all, non_clicker,
|
341 |
+
non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
|
342 |
+
*/
|
343 |
+
public function campaignRecipientsExport($data)
|
344 |
+
{
|
345 |
+
$id = $data['id'];
|
346 |
+
unset($data['id']);
|
347 |
+
return $this->post("campaign/".$id."/recipients", json_decode($data));
|
348 |
+
}
|
349 |
+
|
350 |
+
/*
|
351 |
+
Get the Campaign name, subject and share link of the classic type campaigns only which
|
352 |
+
are sent, for those which are not sent and the rest of campaign types like trigger, template
|
353 |
+
& sms, will return an error message of share link not available.
|
354 |
+
@param {Array} data contains php array with key value pair.
|
355 |
+
@options data {Array} camp_ids: Id of campaign to get share link. You can use commas to
|
356 |
+
separate multiple ids [Mandatory]
|
357 |
+
*/
|
358 |
+
|
359 |
+
public function shareCampaign($data)
|
360 |
+
{
|
361 |
+
return $this->post("campaign/sharelinkv2", json_encode($data));
|
362 |
+
}
|
363 |
+
|
364 |
+
/*
|
365 |
+
Send a Test Campaign.
|
366 |
+
@param {Array} data contains php array with key value pair.
|
367 |
+
@options data {Integer} id: Id of the campaign [Mandatory]
|
368 |
+
@options data {Array} emails: Email address of recipient(s) existing in the one of the lists &
|
369 |
+
should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple
|
370 |
+
recipients [Mandatory]
|
371 |
+
*/
|
372 |
+
public function sendBatEmail($data)
|
373 |
+
{
|
374 |
+
$id = $data['id'];
|
375 |
+
unset($data['id']);
|
376 |
+
return $this->post("campaign/".$id."/test", json_encode($data));
|
377 |
+
}
|
378 |
+
|
379 |
+
/*
|
380 |
+
Update the Campaign status.
|
381 |
+
@param {Array} data contains php array with key value pair.
|
382 |
+
@options data {Integer} id: Id of campaign to update its status [Mandatory]
|
383 |
+
@options data {String} status: Types of status. Possible values – suspended,
|
384 |
+
archive, darchive, sent, queued, replicate and replicate_template ( case sensitive )
|
385 |
+
[Mandatory]
|
386 |
+
*/
|
387 |
+
public function updateCampaignStatus($data)
|
388 |
+
{
|
389 |
+
$id = $data['id'];
|
390 |
+
unset($data['id']);
|
391 |
+
return $this->put("campaign/".$id."/updatecampstatus", json_encode($data));
|
392 |
+
}
|
393 |
+
|
394 |
+
/*
|
395 |
+
Create and schedule your Trigger campaigns.
|
396 |
+
@param {Array} data contains php array with key value pair.
|
397 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
398 |
+
@options data {String} from_name: Sender name from which the campaign emails are
|
399 |
+
sent [Mandatory: for Dedicated IP clients, please make sure that the sender details
|
400 |
+
are defined here, and in case of no sender, you can add them also via API & for Shared
|
401 |
+
IP clients, if sender exists]
|
402 |
+
@options data {String} trigger_name: Name of the campaign [Mandatory]
|
403 |
+
@options data {String} bat: Email address for test mail [Optional]
|
404 |
+
@options data {String} html_content: Body of the content. The HTML content field must
|
405 |
+
have more than 10 characters [Mandatory: if html_url is empty]
|
406 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
407 |
+
html_content is empty]
|
408 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent
|
409 |
+
[Mandatory: if scheduled_date is not empty]
|
410 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to
|
411 |
+
run[Optional]
|
412 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
413 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
414 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined
|
415 |
+
here, and in case of no sender, you can add them also via API & for Shared IP clients, if
|
416 |
+
sender exists]
|
417 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
418 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include
|
419 |
+
the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes
|
420 |
+
here, these should already exist in SendinBlue account [Optional]
|
421 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign
|
422 |
+
[Optional]
|
423 |
+
@options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1.
|
424 |
+
recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1
|
425 |
+
means contact can receive the same Trigger campaign several times [Optional]
|
426 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
427 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) &
|
428 |
+
1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded,
|
429 |
+
in the email [Optional]
|
430 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1
|
431 |
+
(default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror
|
432 |
+
links are activated, in the campaign [Optional]
|
433 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
434 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
435 |
+
[Optional]
|
436 |
+
*/
|
437 |
+
public function createTriggerCampaign($data)
|
438 |
+
{
|
439 |
+
return $this->post("campaign", json_encode($data));
|
440 |
+
}
|
441 |
+
|
442 |
+
/*
|
443 |
+
Update and schedule your Trigger campaigns.
|
444 |
+
@param {Array} data contains php array with key value pair.
|
445 |
+
@options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
|
446 |
+
@options data {String} category: Tag name of the campaign [Optional]
|
447 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
448 |
+
[Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here,
|
449 |
+
and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
450 |
+
@options data {String} trigger_name: Name of the campaign [Mandatory]
|
451 |
+
@options data {String} bat Email address for test mail [Optional]
|
452 |
+
@options data {String} html_content: Body of the content. The HTML content field must have more
|
453 |
+
than 10 characters [Mandatory: if html_url is empty]
|
454 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
455 |
+
html_content is empty]
|
456 |
+
@options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory:
|
457 |
+
if scheduled_date is not empty]
|
458 |
+
@options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
|
459 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
460 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory:
|
461 |
+
for Dedicated IP clients, please make sure that the sender details are defined here, and in case of
|
462 |
+
no sender, you can add them also via API & for Shared IP clients, if sender exists]
|
463 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
464 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include the
|
465 |
+
first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here
|
466 |
+
, these should already exist in SendinBlue account [Optional]
|
467 |
+
@options data {Array} exclude_list: These are the lists which must be excluded from the campaign
|
468 |
+
[Optional]
|
469 |
+
@options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1.
|
470 |
+
recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1
|
471 |
+
means contact can receive the same Trigger campaign several times [Optional]
|
472 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
|
473 |
+
@options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) &
|
474 |
+
1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded,
|
475 |
+
in the email [Optional]
|
476 |
+
@options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 &
|
477 |
+
1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror
|
478 |
+
links are activated, in the campaign [Optional]
|
479 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
480 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
481 |
+
[Optional]
|
482 |
+
*/
|
483 |
+
public function updateTriggerCampaign($data)
|
484 |
+
{
|
485 |
+
$id = $data['id'];
|
486 |
+
unset($data['id']);
|
487 |
+
return $this->put("campaign/".$id, json_encode($data));
|
488 |
+
}
|
489 |
+
|
490 |
+
/*
|
491 |
+
Get all folders detail.
|
492 |
+
@param {Array} data contains php array with key value pair.
|
493 |
+
@options data {Integer} page: Maximum number of records per request is 50,
|
494 |
+
if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
|
495 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
496 |
+
*/
|
497 |
+
public function getFolders($data)
|
498 |
+
{
|
499 |
+
return $this->get("folder", json_encode($data));
|
500 |
+
}
|
501 |
+
|
502 |
+
/*
|
503 |
+
Get a particular folder detail.
|
504 |
+
@param {Array} data contains php array with key value pair.
|
505 |
+
@options data {Integer} id: Id of folder to get details [Mandatory]
|
506 |
+
*/
|
507 |
+
public function getFolder($data)
|
508 |
+
{
|
509 |
+
return $this->get("folder/".$data['id'], "");
|
510 |
+
}
|
511 |
+
|
512 |
+
/*
|
513 |
+
Create a new folder.
|
514 |
+
@param {Array} data contains php array with key value pair.
|
515 |
+
@options data {String} name: Desired name of the folder to be created [Mandatory]
|
516 |
+
*/
|
517 |
+
public function createFolder($data)
|
518 |
+
{
|
519 |
+
return $this->post("folder", json_encode($data));
|
520 |
+
}
|
521 |
+
|
522 |
+
/*
|
523 |
+
Delete a specific folder information.
|
524 |
+
@param {Array} data contains php array with key value pair.
|
525 |
+
@options data {Integer} id: Id of folder to be deleted [Mandatory]
|
526 |
+
*/
|
527 |
+
public function deleteFolder($data)
|
528 |
+
{
|
529 |
+
return $this->delete("folder/".$data['id'], "");
|
530 |
+
}
|
531 |
+
|
532 |
+
/*
|
533 |
+
Update an existing folder.
|
534 |
+
@param {Array} data contains php array with key value pair.
|
535 |
+
@options data {Integer} id: Id of folder to be modified [Mandatory]
|
536 |
+
@options data {String} name: Desired name of the folder to be modified [Mandatory]
|
537 |
+
*/
|
538 |
+
public function updateFolder($data)
|
539 |
+
{
|
540 |
+
$id = $data['id'];
|
541 |
+
unset($data['id']);
|
542 |
+
return $this->put("folder/".$id, json_encode($data));
|
543 |
+
}
|
544 |
+
|
545 |
+
/*
|
546 |
+
Get all lists detail.
|
547 |
+
@param {Array} data contains php array with key value pair.
|
548 |
+
@options data {Integer} list_parent: This is the existing folder id & can be used to
|
549 |
+
get all lists belonging to it [Optional]
|
550 |
+
@options data {Integer} page: Maximum number of records per request is 50, if there are
|
551 |
+
more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
|
552 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
553 |
+
*/
|
554 |
+
public function getLists($data)
|
555 |
+
{
|
556 |
+
return $this->get("list", json_encode($data));
|
557 |
+
}
|
558 |
+
|
559 |
+
/*
|
560 |
+
Get a particular list detail.
|
561 |
+
@param {Array} data contains php array with key value pair.
|
562 |
+
@options data {Integer} id: Id of list to get details [Mandatory]
|
563 |
+
*/
|
564 |
+
public function getList($data)
|
565 |
+
{
|
566 |
+
return $this->get("list/".$data['id'], "");
|
567 |
+
}
|
568 |
+
|
569 |
+
/*
|
570 |
+
Create a new list.
|
571 |
+
@param {Array} data contains php array with key value pair.
|
572 |
+
@options data {String} list_name: Desired name of the list to be created [Mandatory]
|
573 |
+
@options data {Integer} list_parent: Folder ID [Mandatory]
|
574 |
+
*/
|
575 |
+
public function createList($data)
|
576 |
+
{
|
577 |
+
return $this->post("list", json_encode($data));
|
578 |
+
}
|
579 |
+
|
580 |
+
/*
|
581 |
+
Update a list.
|
582 |
+
@param {Array} data contains php array with key value pair.
|
583 |
+
@options data {Integer} id: Id of list to be modified [Mandatory]
|
584 |
+
@options data {String} list_name: Desired name of the list to be modified [Optional]
|
585 |
+
@options data {Integer} list_parent: Folder ID [Mandatory]
|
586 |
+
*/
|
587 |
+
public function updateList($data)
|
588 |
+
{
|
589 |
+
$id = $data['id'];
|
590 |
+
unset($data['id']);
|
591 |
+
return $this->put("list/".$id, json_encode($data));
|
592 |
+
}
|
593 |
+
|
594 |
+
/*
|
595 |
+
Delete a specific list.
|
596 |
+
@param {Array} data contains php array with key value pair.
|
597 |
+
@options data {Integer} id: Id of list to be deleted [Mandatory]
|
598 |
+
*/
|
599 |
+
public function deleteList($data)
|
600 |
+
{
|
601 |
+
return $this->delete("list/".$data['id'], "");
|
602 |
+
}
|
603 |
+
|
604 |
+
/*
|
605 |
+
Display details of all users for the given lists.
|
606 |
+
@param {Array} data contains php array with key value pair.
|
607 |
+
@options data {Array} listids: These are the list ids to get their data. The ids found
|
608 |
+
will display records [Mandatory]
|
609 |
+
@options data {String} timestamp: This is date-time filter to fetch modified user records >=
|
610 |
+
this time. Valid format Y-m-d H:i:s. Example: "2015-05-22 14:30:00" [Optional]
|
611 |
+
@options data {Integer} page: Maximum number of records per request is 500, if in your list
|
612 |
+
there are more than 500 users then you can use this parameter to get next 500 results [Optional]
|
613 |
+
@options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
|
614 |
+
*/
|
615 |
+
public function displayListUsers($data)
|
616 |
+
{
|
617 |
+
return $this->post("list/display", json_encode($data));
|
618 |
+
}
|
619 |
+
|
620 |
+
/*
|
621 |
+
Add already existing users in the SendinBlue contacts to the list.
|
622 |
+
@param {Array} data contains php array with key value pair.
|
623 |
+
@options data {Integer} id: Id of list to link users in it [Mandatory]
|
624 |
+
@options data {Array} users: Email address of the already existing user(s) in the
|
625 |
+
SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple
|
626 |
+
users [Mandatory]
|
627 |
+
*/
|
628 |
+
|
629 |
+
public function addUsersList($data)
|
630 |
+
{
|
631 |
+
$id = $data['id'];
|
632 |
+
unset($data['id']);
|
633 |
+
return $this->post("list/".$id."/users", json_encode($data));
|
634 |
+
}
|
635 |
+
|
636 |
+
/*
|
637 |
+
Delete already existing users in the SendinBlue contacts from the list.
|
638 |
+
@param {Array} data contains php array with key value pair.
|
639 |
+
@options data {Integer} id: Id of list to unlink users from it [Mandatory]
|
640 |
+
@options data {Array} users: Email address of the already existing user(s) in the
|
641 |
+
SendinBlue contacts to be modified. Example: "test@example.net". You can use commas
|
642 |
+
to separate multiple users [Mandatory]
|
643 |
+
*/
|
644 |
+
public function deleteUsersList($data)
|
645 |
+
{
|
646 |
+
$id = $data['id'];
|
647 |
+
unset($data['id']);
|
648 |
+
return $this->delete("list/".$id."/delusers", json_encode($data));
|
649 |
+
}
|
650 |
+
|
651 |
+
/*
|
652 |
+
Access all the attributes information under the account.
|
653 |
+
No input required
|
654 |
+
*/
|
655 |
+
public function getAttributes()
|
656 |
+
{
|
657 |
+
return $this->get("attribute", "");
|
658 |
+
}
|
659 |
+
|
660 |
+
/*
|
661 |
+
Access the specific type of attribute information.
|
662 |
+
@param {Array} data contains php array with key value pair.
|
663 |
+
@options data {String} type: Type of attribute. Possible values – normal, transactional,
|
664 |
+
category, calculated & global [Optional]
|
665 |
+
*/
|
666 |
+
public function getAttribute($data)
|
667 |
+
{
|
668 |
+
return $this->get("attribute/".$data['type'], "");
|
669 |
+
}
|
670 |
+
|
671 |
+
/*
|
672 |
+
Create an Attribute.
|
673 |
+
@param {Array} data contains php array with key value pair.
|
674 |
+
@options data {String} type: Type of attribute. Possible values – normal, transactional,
|
675 |
+
category, calculated & global ( case sensitive ) [Mandatory]
|
676 |
+
@options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute
|
677 |
+
to be created in your SendinBlue account. It should be sent as an associative array. Example:
|
678 |
+
array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
|
679 |
+
The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string.
|
680 |
+
Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2",
|
681 |
+
"value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
|
682 |
+
*/
|
683 |
+
public function createAttribute($data)
|
684 |
+
{
|
685 |
+
return $this->post("attribute/", json_encode($data));
|
686 |
+
}
|
687 |
+
|
688 |
+
/*
|
689 |
+
Delete a specific type of attribute information.
|
690 |
+
@param {Array} data contains php array with key value pair.
|
691 |
+
@options data {Integer} type: Type of attribute to be deleted [Mandatory]
|
692 |
+
*/
|
693 |
+
public function deleteAttribute($type, $data)
|
694 |
+
{
|
695 |
+
$type = $data['type'];
|
696 |
+
unset($data['type']);
|
697 |
+
return $this->post("attribute/".$type, json_encode($data));
|
698 |
+
}
|
699 |
+
|
700 |
+
/*
|
701 |
+
Create a new user if an email provided as input, doesn’t exists in the contact list
|
702 |
+
of your SendinBlue account, otherwise it will update the existing user.
|
703 |
+
@param {Array} data contains php array with key value pair.
|
704 |
+
@options data {String} email: Email address of the user to be created in SendinBlue contacts.
|
705 |
+
Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
|
706 |
+
@options data {Array} attributes: The name of attribute present in your SendinBlue account.
|
707 |
+
It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas
|
708 |
+
to separate multiple attributes [Optional]
|
709 |
+
@options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible
|
710 |
+
values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
|
711 |
+
@options data {Array} listid: The list id(s) to be linked from user [Optional]
|
712 |
+
@options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
|
713 |
+
@options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS
|
714 |
+
number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been
|
715 |
+
blacklisted [Optional]
|
716 |
+
*/
|
717 |
+
public function createUpdateUser($data)
|
718 |
+
{
|
719 |
+
return $this->post("user/createdituser", json_encode($data));
|
720 |
+
}
|
721 |
+
|
722 |
+
/*
|
723 |
+
Get Access a specific user Information.
|
724 |
+
@param {Array} data contains php array with key value pair.
|
725 |
+
@options data {String} email: Email address of the already existing user in the SendinBlue
|
726 |
+
contacts [Mandatory]
|
727 |
+
*/
|
728 |
+
public function getUser($data)
|
729 |
+
{
|
730 |
+
return $this->get("user/".$data['email'], "");
|
731 |
+
}
|
732 |
+
|
733 |
+
/*
|
734 |
+
Unlink existing user from all lists.
|
735 |
+
@param {Array} data contains php array with key value pair.
|
736 |
+
@options data {String} email: Email address of the already existing user in the SendinBlue
|
737 |
+
contacts to be unlinked from all lists [Mandatory]
|
738 |
+
*/
|
739 |
+
public function deleteUser($data)
|
740 |
+
{
|
741 |
+
return $this->delete("user/".$data['email'], "");
|
742 |
+
}
|
743 |
+
|
744 |
+
/*
|
745 |
+
Import Users Information.
|
746 |
+
@param {Array} data contains php array with key value pair.
|
747 |
+
@options data {String} url: The URL of the file to be imported. Possible file types – .txt,
|
748 |
+
.csv [Mandatory: if body is empty]
|
749 |
+
@options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;
|
750 |
+
EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘,
|
751 |
+
where \n separates each user data. You can use semicolon to separate multiple attributes
|
752 |
+
[Mandatory: if url is empty]
|
753 |
+
@options data {Array} listids: These are the list ids in which the the users will be imported
|
754 |
+
[Mandatory: if name is empty]
|
755 |
+
@options data {String} notify_url: URL that will be called once the import process is finished
|
756 |
+
[Optional] In notify_url, we are sending the content using POST method
|
757 |
+
@options data {String} name: This is new list name which will be created first & then users will
|
758 |
+
be imported in it [Mandatory: if listids is empty]
|
759 |
+
@options data {Integer} list_parent: This is the existing folder id & can be used with name
|
760 |
+
parameter to make newly created list’s desired parent [Optional]
|
761 |
+
*/
|
762 |
+
public function importUsers($data)
|
763 |
+
{
|
764 |
+
return $this->post("user/import", json_encode($data));
|
765 |
+
}
|
766 |
+
|
767 |
+
/*
|
768 |
+
Export Users Information.
|
769 |
+
@param {Array} data contains php array with key value pair.
|
770 |
+
@options data {String} export_attrib: The name of attribute present in your SendinBlue account.
|
771 |
+
You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
|
772 |
+
@options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}",
|
773 |
+
will export all blacklisted users [Mandatory]
|
774 |
+
@options data {String} notify_url: URL that will be called once the export process is finished
|
775 |
+
[Optional]
|
776 |
+
*/
|
777 |
+
public function exportUsers($data)
|
778 |
+
{
|
779 |
+
return $this->post("user/export", json_encode($data));
|
780 |
+
}
|
781 |
+
|
782 |
+
/*
|
783 |
+
Get all the processes information under the account.
|
784 |
+
@param {Array} data contains php array with key value pair.
|
785 |
+
@options data {Integer} page: Maximum number of records per request is 50, if there are more than 50
|
786 |
+
processes then you can use this parameter to get next 50 results [Mandatory]
|
787 |
+
@options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
|
788 |
+
*/
|
789 |
+
public function getProcesses($data)
|
790 |
+
{
|
791 |
+
return $this->get("process", json_encode($data));
|
792 |
+
}
|
793 |
+
|
794 |
+
/*
|
795 |
+
Get the process information.
|
796 |
+
@param {Array} data contains php array with key value pair.
|
797 |
+
@options data {Integer} id: Id of process to get details [Mandatory]
|
798 |
+
*/
|
799 |
+
public function getProcess($data)
|
800 |
+
{
|
801 |
+
return $this->get("process/".$data['id'], "");
|
802 |
+
}
|
803 |
+
|
804 |
+
/*
|
805 |
+
To retrieve details of all webhooks.
|
806 |
+
@param {Array} data contains php array with key value pair.
|
807 |
+
@options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get
|
808 |
+
Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all
|
809 |
+
webhooks, use $is_plat="" [Optional]
|
810 |
+
*/
|
811 |
+
public function getWebhooks($data)
|
812 |
+
{
|
813 |
+
return $this->get("webhook", json_encode($data));
|
814 |
+
}
|
815 |
+
|
816 |
+
/*
|
817 |
+
To retrieve details of any particular webhook.
|
818 |
+
@param {Array} data contains php array with key value pair.
|
819 |
+
@options data {Integer} id: Id of webhook to get details [Mandatory]
|
820 |
+
*/
|
821 |
+
public function getWebhook($data)
|
822 |
+
{
|
823 |
+
return $this->get("webhook/".$data['id'], "");
|
824 |
+
}
|
825 |
+
|
826 |
+
/*
|
827 |
+
Create a Webhook.
|
828 |
+
@param {Array} data contains php array with key value pair.
|
829 |
+
@options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
830 |
+
@options data {String} description: Webook description [Optional]
|
831 |
+
@options data {Array} events: Set of events. You can use commas to separate multiple events.
|
832 |
+
Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked,
|
833 |
+
spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam,
|
834 |
+
opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
835 |
+
@options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1.
|
836 |
+
Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use
|
837 |
+
$is_plat=1 [Optional]
|
838 |
+
*/
|
839 |
+
public function createWebhook($data)
|
840 |
+
{
|
841 |
+
return $this->post("webhook", json_encode($data));
|
842 |
+
}
|
843 |
+
|
844 |
+
/*
|
845 |
+
Delete a webhook.
|
846 |
+
@param {Array} data contains php array with key value pair.
|
847 |
+
@options data {Integer} id: Id of webhook to be deleted [Mandatory]
|
848 |
+
*/
|
849 |
+
public function deleteWebhook($data)
|
850 |
+
{
|
851 |
+
return $this->delete("webhook/".$data['id'], "");
|
852 |
+
}
|
853 |
+
|
854 |
+
/*
|
855 |
+
Update a webhook.
|
856 |
+
@param {Array} data contains php array with key value pair.
|
857 |
+
@options data {Integer} id: Id of webhook to be modified [Mandatory]
|
858 |
+
@options data {String} url: URL that will be triggered by a webhook [Mandatory]
|
859 |
+
@options data {String} description: Webook description [Optional]
|
860 |
+
@options data {Array} events: Set of events. You can use commas to separate multiple events.
|
861 |
+
Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked,
|
862 |
+
spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam,
|
863 |
+
opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
|
864 |
+
*/
|
865 |
+
public function updateWebhook($data)
|
866 |
+
{
|
867 |
+
$id = $data['id'];
|
868 |
+
unset($data['id']);
|
869 |
+
return $this->put("webhook/".$id, json_encode($data));
|
870 |
+
}
|
871 |
+
|
872 |
+
/*
|
873 |
+
Get Access of created senders information.
|
874 |
+
@param {Array} data contains php array with key value pair.
|
875 |
+
@options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise
|
876 |
+
( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′,
|
877 |
+
to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option=""
|
878 |
+
[Optional]
|
879 |
+
*/
|
880 |
+
public function getSenders($data)
|
881 |
+
{
|
882 |
+
return $this->get("advanced", json_encode($data));
|
883 |
+
}
|
884 |
+
|
885 |
+
/*
|
886 |
+
Create your Senders.
|
887 |
+
@param {Array} data contains php array with key value pair.
|
888 |
+
@options data {String} name: Name of the sender [Mandatory]
|
889 |
+
@options data {String} email: Email address of the sender [Mandatory]
|
890 |
+
@options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain.
|
891 |
+
Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only
|
892 |
+
for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
893 |
+
*/
|
894 |
+
public function createSender($data)
|
895 |
+
{
|
896 |
+
return $this->post("advanced", json_encode($data));
|
897 |
+
}
|
898 |
+
|
899 |
+
/*
|
900 |
+
Update your Senders.
|
901 |
+
@param {Array} data contains php array with key value pair.
|
902 |
+
@options data {Integer} id: Id of sender to be modified [Mandatory]
|
903 |
+
@options data {String} name: Name of the sender [Mandatory]
|
904 |
+
@options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain.
|
905 |
+
Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory:
|
906 |
+
Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
|
907 |
+
*/
|
908 |
+
public function updateSender($data)
|
909 |
+
{
|
910 |
+
$id = $data['id'];
|
911 |
+
unset($data['id']);
|
912 |
+
return $this->put("advanced/".$id, json_encode($data));
|
913 |
+
}
|
914 |
+
|
915 |
+
/*
|
916 |
+
Delete your Sender Information.
|
917 |
+
@param {Array} data contains php array with key value pair.
|
918 |
+
@options data {Integer} id: Id of sender to be deleted [Mandatory]
|
919 |
+
*/
|
920 |
+
public function deleteSender($data)
|
921 |
+
{
|
922 |
+
return $this->delete("advanced/".$data['id'], "");
|
923 |
+
}
|
924 |
+
|
925 |
+
/*
|
926 |
+
Send Transactional Email.
|
927 |
+
@param {Array} data contains php array with key value pair.
|
928 |
+
@options data {Array} to: Email address of the recipient(s). It should be sent as an associative
|
929 |
+
array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients
|
930 |
+
[Mandatory]
|
931 |
+
@options data {String} subject: Message subject [Mandatory]
|
932 |
+
@options data {Array} from Email address for From header. It should be sent as an array. Example: array
|
933 |
+
("from@email.com","from email") [Mandatory]
|
934 |
+
@options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images,
|
935 |
+
use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {}
|
936 |
+
(curly braces) should be same as the filename used in 'inline_image' parameter
|
937 |
+
@options data {String} text: Body of the message. (text version) [Optional]
|
938 |
+
@options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
|
939 |
+
@options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom")
|
940 |
+
[Optional]
|
941 |
+
@options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from
|
942 |
+
email") [Optional]
|
943 |
+
@options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension
|
944 |
+
values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt,
|
945 |
+
tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename &
|
946 |
+
its base64 encoded chunk data as an associative array. Example: array("YourFileName.
|
947 |
+
Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
|
948 |
+
@options data {Array} headers: The headers will be sent along with the mail headers in original email.
|
949 |
+
Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate
|
950 |
+
multiple headers [Optional]
|
951 |
+
@options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk
|
952 |
+
data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData").
|
953 |
+
You can use commas to separate multiple inline images [Optional]
|
954 |
+
*/
|
955 |
+
public function sendEmail($data)
|
956 |
+
{
|
957 |
+
return $this->post("email", json_encode($data));
|
958 |
+
}
|
959 |
+
|
960 |
+
/*
|
961 |
+
Aggregate / date-wise report of the SendinBlue SMTP account.
|
962 |
+
@param {Array} data contains php array with key value pair.
|
963 |
+
@options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals.
|
964 |
+
Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per
|
965 |
+
day/date wise [Optional]
|
966 |
+
@options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD
|
967 |
+
format and should be before the end_date [Optional]
|
968 |
+
@options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD
|
969 |
+
format and should be after the start_date [Optional]
|
970 |
+
@options data {Integer} days: Number of days in the past to include statistics ( Includes today ).
|
971 |
+
It must be an integer greater than 0 [Optional]
|
972 |
+
@options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an
|
973 |
+
existing tag that has statistics [Optional]
|
974 |
+
*/
|
975 |
+
public function getStatistics($data)
|
976 |
+
{
|
977 |
+
return $this->post("statistics", json_encode($data));
|
978 |
+
}
|
979 |
+
|
980 |
+
/*
|
981 |
+
Get Email Event report.
|
982 |
+
@param {Array} data contains php array with key value pair.
|
983 |
+
@options data {Integer} limit: To limit the number of results returned. It should be an integer
|
984 |
+
[Optional]
|
985 |
+
@options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD
|
986 |
+
format and should be before the end_date [Optional]
|
987 |
+
@options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD
|
988 |
+
format and should be after the start_date [Optional]
|
989 |
+
@options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer
|
990 |
+
[Optional]
|
991 |
+
@options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and
|
992 |
+
should be earlier than todays date [Optional]
|
993 |
+
@options data {Integer} days: Number of days in the past (includes today). If specified, must be an
|
994 |
+
integer greater than 0 [Optional]
|
995 |
+
@options data {String} email: Email address to search report for [Optional]
|
996 |
+
*/
|
997 |
+
public function getReport($data)
|
998 |
+
{
|
999 |
+
return $this->post("report", json_encode($data));
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/*
|
1003 |
+
Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
|
1004 |
+
@param {Array} data contains php array with key value pair.
|
1005 |
+
@options data {String} start_date: The start date to get report from. Date must be in
|
1006 |
+
YYYY-MM-DD format and should be before the end_date [Optional]
|
1007 |
+
@options data {String} end_date: The end date to get report till date. Date must be in
|
1008 |
+
YYYY-MM-DD format and should be after the start_date [Optional]
|
1009 |
+
@options data {String} email: Email address to delete its bounces [Optional]
|
1010 |
+
*/
|
1011 |
+
public function deleteBounces($data)
|
1012 |
+
{
|
1013 |
+
return $this->post("bounces", json_encode($data));
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
/*
|
1017 |
+
Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
|
1018 |
+
@param {Array} data contains php array with key value pair.
|
1019 |
+
@options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
|
1020 |
+
@options data {String} to: Email address of the recipient(s). You can use pipe ( | )
|
1021 |
+
to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net"
|
1022 |
+
[Mandatory]
|
1023 |
+
@options data {String} cc: Same as to but for Cc [Optional]
|
1024 |
+
@options data {String} bcc: Same as to but for Bcc [Optional]
|
1025 |
+
@options data {Array} attrv The name of attribute present in your SendinBlue account. It should
|
1026 |
+
be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate
|
1027 |
+
multiple attributes [Optional]
|
1028 |
+
@options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed
|
1029 |
+
from local machine. File must be hosted somewhere [Optional]
|
1030 |
+
@options data {Array} attachment: To send attachment/s generated on the fly you have to pass
|
1031 |
+
your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
|
1032 |
+
*/
|
1033 |
+
public function sendTransactionalTemplate($data)
|
1034 |
+
{
|
1035 |
+
$id = $data['id'];
|
1036 |
+
unset($data['id']);
|
1037 |
+
return $this->put("template/".$id, json_encode($data));
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
/*
|
1041 |
+
Create a Template.
|
1042 |
+
@param {Array} data contains php array with key value pair.
|
1043 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
1044 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1045 |
+
@options data {String} template_name: Name of the Template [Mandatory]
|
1046 |
+
@options data {String} bat: Email address for test mail [Optional]
|
1047 |
+
@options data {String} html_content: Body of the content. The HTML content field must have more
|
1048 |
+
than 10 characters [Mandatory: if html_url is empty]
|
1049 |
+
@options data {String} html_url Url: which content is the body of content [Mandatory: if
|
1050 |
+
html_content is empty]
|
1051 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
1052 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
1053 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1054 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
1055 |
+
@options data {String} to_fieldv This is to personalize the «To» Field. If you want to include
|
1056 |
+
the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes
|
1057 |
+
here, these should already exist in SendinBlue account [Optional]
|
1058 |
+
@options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0
|
1059 |
+
means template is inactive, & status = 1 means template is active [Optional]
|
1060 |
+
@options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1.
|
1061 |
+
attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in
|
1062 |
+
the email [Optional]
|
1063 |
+
*/
|
1064 |
+
public function createTemplate($data)
|
1065 |
+
{
|
1066 |
+
return $this->post("template", json_encode($data));
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
/*
|
1070 |
+
Update a Template.
|
1071 |
+
@param {Array} data contains php array with key value pair.
|
1072 |
+
@options data {Integer} id: Id of Template to be modified [Mandatory]
|
1073 |
+
@options data {String} from_name: Sender name from which the campaign emails are sent
|
1074 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1075 |
+
@options data {String} template_name: Name of the Template [Mandatory]
|
1076 |
+
@options data {String} bat: Email address for test mail [Optional]
|
1077 |
+
@options data {String} html_content: Body of the content. The HTML content field must have
|
1078 |
+
more than 10 characters [Mandatory: if html_url is empty]
|
1079 |
+
@options data {String} html_url: Url which content is the body of content [Mandatory: if
|
1080 |
+
html_content is empty]
|
1081 |
+
@options data {String} subject: Subject of the campaign [Mandatory]
|
1082 |
+
@options data {String} from_email: Sender email from which the campaign emails are sent
|
1083 |
+
[Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
|
1084 |
+
@options data {String} reply_to: The reply to email in the campaign emails [Optional]
|
1085 |
+
@options data {String} to_field: This is to personalize the «To» Field. If you want to include the
|
1086 |
+
first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here,
|
1087 |
+
these should already exist in SendinBlue account [Optional]
|
1088 |
+
@options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0
|
1089 |
+
means template is inactive, & status = 1 means template is active [Optional]
|
1090 |
+
@options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1.
|
1091 |
+
attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the
|
1092 |
+
email [Optional]
|
1093 |
+
*/
|
1094 |
+
public function updateTemplate($data)
|
1095 |
+
{
|
1096 |
+
$id = $data['id'];
|
1097 |
+
unset($data['id']);
|
1098 |
+
return $this->put("template/".$id, json_encode($data));
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
/*
|
1102 |
+
Send a transactional SMS.
|
1103 |
+
@param {Array} data contains php array with key value pair.
|
1104 |
+
@options data {String} to: The mobile number to send SMS to with country code [Mandatory]
|
1105 |
+
@options data {String} from: The name of the sender. The number of characters is limited to 11
|
1106 |
+
(alphanumeric format) [Mandatory]
|
1107 |
+
@options data {String} text: The text of the message. The maximum characters used per SMS is 160,
|
1108 |
+
if used more than that, it will be counted as more than one SMS [Mandatory]
|
1109 |
+
@options data {String} web_url: The web URL that can be called once the message is successfully
|
1110 |
+
delivered [Optional]
|
1111 |
+
@options data {String} tag: The tag that you can associate with the message [Optional]
|
1112 |
+
@options data {String} type: Type of message. Possible values – marketing (default) & transactional.
|
1113 |
+
You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional
|
1114 |
+
type [Optional]
|
1115 |
+
*/
|
1116 |
+
public function sendSms($data)
|
1117 |
+
{
|
1118 |
+
return $this->post("sms", json_encode($data));
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
/*
|
1122 |
+
Create & Schedule your SMS campaigns.
|
1123 |
+
@param {Array} data contains php array with key value pair.
|
1124 |
+
@options data {String} name: Name of the SMS campaign [Mandatory]
|
1125 |
+
@options data {String} sender: This allows you to customize the SMS sender. The number of
|
1126 |
+
characters is limited to 11 ( alphanumeric format ) [Optional]
|
1127 |
+
@options data {String} content: Content of the message. The maximum characters used per SMS is 160,
|
1128 |
+
if used more than that, it will be counted as more than one SMS [Optional]
|
1129 |
+
@options data {String} bat: Mobile number with the country code to send test SMS. The mobile number
|
1130 |
+
defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted
|
1131 |
+
[Optional]
|
1132 |
+
@options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if
|
1133 |
+
scheduled_date is not empty]
|
1134 |
+
@options data {Array} exclude_list: These are the list ids which will be excluded from the SMS
|
1135 |
+
campaign [Optional]
|
1136 |
+
@options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
1137 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
1138 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
1139 |
+
[Optional]
|
1140 |
+
*/
|
1141 |
+
public function createSmsCampaign($data)
|
1142 |
+
{
|
1143 |
+
return $this->post("sms", json_encode($data));
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
/*
|
1147 |
+
Update your SMS campaigns.
|
1148 |
+
@param {Array} data contains php array with key value pair.
|
1149 |
+
@options data {Integer} id: Id of the SMS campaign [Mandatory]
|
1150 |
+
@options data {String} name: Name of the SMS campaign [Optional]
|
1151 |
+
@options data {String} sender: This allows you to customize the SMS sender. The number of characters
|
1152 |
+
is limited to 11 ( alphanumeric format ) [Optional]
|
1153 |
+
@options data {String} content: Content of the message. The maximum characters used per SMS is 160,
|
1154 |
+
if used more than that, it will be counted as more than one SMS [Optional]
|
1155 |
+
@options data {String} bat: Mobile number with the country code to send test SMS. The mobile number
|
1156 |
+
defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted
|
1157 |
+
[Optional]
|
1158 |
+
@options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if
|
1159 |
+
scheduled_date is not empty]
|
1160 |
+
@options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign
|
1161 |
+
[Optional]
|
1162 |
+
@options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
|
1163 |
+
@options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1.
|
1164 |
+
send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now
|
1165 |
+
[Optional]
|
1166 |
+
*/
|
1167 |
+
public function updateSmsCampaign($data)
|
1168 |
+
{
|
1169 |
+
$id = $data['id'];
|
1170 |
+
unset($data['id']);
|
1171 |
+
return $this->put("sms/".$id, json_encode($data));
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
/*
|
1175 |
+
Send a Test SMS.
|
1176 |
+
@param {Array} data contains php array with key value pair.
|
1177 |
+
@options data {Integer} id: Id of the SMS campaign [Mandatory]
|
1178 |
+
@options data {String} to: Mobile number with the country code to send test SMS. The mobile
|
1179 |
+
number defined here should belong to one of your contacts in SendinBlue account and should not be
|
1180 |
+
blacklisted [Mandatory]
|
1181 |
+
*/
|
1182 |
+
public function sendBatSms($data)
|
1183 |
+
{
|
1184 |
+
$id = $data['id'];
|
1185 |
+
unset($data['id']);
|
1186 |
+
return $this->get("sms/".$id, json_encode($data));
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
|
1190 |
+
public function updateMailinParter($data)
|
1191 |
+
{
|
1192 |
+
return $this->put("account/mailin_partner", json_encode($data));
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
/*
|
1196 |
+
Get SMTP details.
|
1197 |
+
*/
|
1198 |
+
public function getPluginConfig()
|
1199 |
+
{
|
1200 |
+
return $this->get("account/plugin_config", "");
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
/*
|
1204 |
+
Get blacklist status of user and other details retrieved.
|
1205 |
+
@param {Array} data contains php array with key value pair.
|
1206 |
+
@options data {String} Emailids: get list of email ids [Mandatory]
|
1207 |
+
*/
|
1208 |
+
public function getUsersBlacklistStatus($data)
|
1209 |
+
{
|
1210 |
+
return $this->post("user/get_blacklist_status",json_encode($data));
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
/*
|
1214 |
+
This api is used to synchronize user status.
|
1215 |
+
*/
|
1216 |
+
public function syncUsersStatus($data)
|
1217 |
+
{
|
1218 |
+
return $this->put("user/sync_status", json_encode($data));
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
/*
|
1222 |
+
Get all folders and it lists data for that user.
|
1223 |
+
*/
|
1224 |
+
public function displayFoldersLists()
|
1225 |
+
{
|
1226 |
+
return $this->get("folder/display_folder_lists", "");
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
/*
|
1230 |
+
Get all lists of data for that user.
|
1231 |
+
*/
|
1232 |
+
public function displayListForPlugin()
|
1233 |
+
{
|
1234 |
+
return $this->get("list/display_list_for_plugin", "");
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
/*
|
1238 |
+
This API is used to update user subscription status.
|
1239 |
+
@param {Array} data contains php array with key value pair.
|
1240 |
+
@options data {string} timezone: Time zone of that user [Mandatory]
|
1241 |
+
@options data {String} user_status: User status that inclue email, status, and Time [Mandatory]
|
1242 |
+
*/
|
1243 |
+
public function updateUserSubscriptionStatus($data)
|
1244 |
+
{
|
1245 |
+
return $this->post("user/update_user_subscription_status", json_encode($data));
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
/*
|
1249 |
+
This is used to get black list data.
|
1250 |
+
@param {Array} data contains php array with key value pair.
|
1251 |
+
@options data {string} listids: List of ids [Mandatory]
|
1252 |
+
*/
|
1253 |
+
public function getListUsersBlacklistStatus($data)
|
1254 |
+
{
|
1255 |
+
return $this->post("list/display_list_users_blacklist_status", json_encode($data));
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
/*
|
1259 |
+
This function is used to unsubscribe a user by email id and list id.
|
1260 |
+
@param {Array} data contains php array with key value pair.
|
1261 |
+
@options data {String} Emails: List of emails
|
1262 |
+
@options data {Integer} Ids: id of lists
|
1263 |
+
*/
|
1264 |
+
public function unSubscribApi($data)
|
1265 |
+
{
|
1266 |
+
return $this->post("user/un_subscrib_api", json_encode($data));
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
/*
|
1270 |
+
This api is used to Add multiple users.
|
1271 |
+
*/
|
1272 |
+
public function addMultipleUser($data)
|
1273 |
+
{
|
1274 |
+
return $this->post("user/add_multiple_users", json_encode($data));
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
/*
|
1278 |
+
This function is used to unsubscribe a user SMS service by email id and list id.
|
1279 |
+
*/
|
1280 |
+
public function userSmsUnsubscribed($data)
|
1281 |
+
{
|
1282 |
+
return $this->post("user/user_sms_unsubscribed", json_encode($data));
|
1283 |
+
}
|
1284 |
+
}
|
app/code/community/Sendinblue/Sendinblue/Model/Sendinblue.php
ADDED
@@ -0,0 +1,1635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 $apiKey;
|
13 |
+
var $smtpStatus;
|
14 |
+
var $errorMessage;
|
15 |
+
var $errorCode;
|
16 |
+
var $listsIds;
|
17 |
+
var $moduleEnable;
|
18 |
+
var $st;
|
19 |
+
public function _construct()
|
20 |
+
{
|
21 |
+
parent::_construct();
|
22 |
+
$this->_init('sendinblue/sendinblue');
|
23 |
+
$this->MIAPI();
|
24 |
+
|
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->moduleEnable = $this->getEnableStatus($scope);
|
33 |
+
$this->apiKey = $this->getApiKey();
|
34 |
+
$valueLanguage = $this->getApiConfigValue();
|
35 |
+
if(isset($valueLanguage['data']['language'])) {
|
36 |
+
$this->userLanguage = $valueLanguage['data']['language'];
|
37 |
+
}
|
38 |
+
|
39 |
+
if (!$this->listsIds) {
|
40 |
+
$this->listsIds = str_replace(',', '|', $this->getUserlists($scope));
|
41 |
+
}
|
42 |
+
|
43 |
+
$params = Mage::app()->getRequest()->getParams();
|
44 |
+
$params = empty($params)?array():$params;
|
45 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != '') {
|
46 |
+
$this->CreateFolderCaseTwo();
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function checkMobileNumber($number, $callPrefix)
|
51 |
+
{
|
52 |
+
$number = preg_replace('/\s+/', '', $number);
|
53 |
+
$charOne = substr($number, 0, 1);
|
54 |
+
$charTwo = substr($number, 0, 2);
|
55 |
+
|
56 |
+
if (preg_match('/^'.$callPrefix.'/', $number)) {
|
57 |
+
return '00'.$number;
|
58 |
+
}
|
59 |
+
|
60 |
+
elseif ($charOne == '0' && $charTwo != '00') {
|
61 |
+
if (preg_match('/^0'.$callPrefix.'/', $number)) {
|
62 |
+
return '00'.substr($number, 1);
|
63 |
+
}
|
64 |
+
else {
|
65 |
+
return '00'.$callPrefix.substr($number, 1);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
elseif ($charTwo == '00') {
|
69 |
+
if (preg_match('/^00'.$callPrefix.'/', $number)) {
|
70 |
+
return $number;
|
71 |
+
}
|
72 |
+
else {
|
73 |
+
return '00'.$callPrefix.substr($number, 2);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
elseif ($charOne == '+') {
|
77 |
+
if (preg_match('/^\+'.$callPrefix.'/', $number)) {
|
78 |
+
return '00'.substr($number, 1);
|
79 |
+
}
|
80 |
+
else {
|
81 |
+
return '00'.$callPrefix.substr($number, 1);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
elseif ($charOne != '0') {
|
85 |
+
return '00'.$callPrefix.$number;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
/**
|
89 |
+
* functions used for getting module status
|
90 |
+
*/
|
91 |
+
public function getEnableStatus()
|
92 |
+
{
|
93 |
+
$status = $this->getGeneralConfig('enabled', Mage::app()->getStore()->getStoreId());
|
94 |
+
if (!$status) {
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
return $status;
|
98 |
+
}
|
99 |
+
/**
|
100 |
+
* functions used for send order sms module status
|
101 |
+
*/
|
102 |
+
public function getOrderSmsStatus()
|
103 |
+
{
|
104 |
+
$status = $this->getGeneralConfig('sms/order', Mage::app()->getStore()->getStoreId());
|
105 |
+
if (!$status) {
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
return $status;
|
109 |
+
}
|
110 |
+
/**
|
111 |
+
* functions used for getting notify sms status
|
112 |
+
*/
|
113 |
+
public function getNotifySmsStatus()
|
114 |
+
{
|
115 |
+
$status = $this->getGeneralConfig('sms/credit', Mage::app()->getStore()->getStoreId());
|
116 |
+
if (!$status) {
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
return $status;
|
120 |
+
}
|
121 |
+
/**
|
122 |
+
* functions used for getting Notify value limit
|
123 |
+
*/
|
124 |
+
public function getNotifyValueStatus()
|
125 |
+
{
|
126 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Value', Mage::app()->getStore()->getStoreId());
|
127 |
+
if (!$status) {
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
return $status;
|
131 |
+
}
|
132 |
+
/**
|
133 |
+
* functions used for getting Notify email limit
|
134 |
+
*/
|
135 |
+
public function getNotifyEmailStatus()
|
136 |
+
{
|
137 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Email', Mage::app()->getStore()->getStoreId());
|
138 |
+
if (!$status) {
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
return $status;
|
142 |
+
}
|
143 |
+
/**
|
144 |
+
* functions used for getting Notify email limit
|
145 |
+
*/
|
146 |
+
public function getNotifyCronStatus()
|
147 |
+
{
|
148 |
+
$status = $this->getGeneralConfig('Sendin_Notify_Cron_Executed', Mage::app()->getStore()->getStoreId());
|
149 |
+
if (!$status) {
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
return $status;
|
153 |
+
}
|
154 |
+
/**
|
155 |
+
* functions used for getting shiping sms status
|
156 |
+
*/
|
157 |
+
public function getShipingSmsStatus()
|
158 |
+
{
|
159 |
+
$status = $this->getGeneralConfig('sms/shiping', Mage::app()->getStore()->getStoreId());
|
160 |
+
if (!$status) {
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
return $status;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* functions used for getting campaign sms status
|
168 |
+
*/
|
169 |
+
public function getCampaignStatus()
|
170 |
+
{
|
171 |
+
$status = $this->getGeneralConfig('sms/campaign', Mage::app()->getStore()->getStoreId());
|
172 |
+
if (!$status) {
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
return $status;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* functions used for getting send sms order subject
|
180 |
+
*/
|
181 |
+
public function getSendSmsOrderSubject()
|
182 |
+
{
|
183 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order', Mage::app()->getStore()->getStoreId());
|
184 |
+
if (!$status) {
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
return $status;
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* functions used for getting order sms message
|
192 |
+
*/
|
193 |
+
public function getSendSmsmOrderMessage()
|
194 |
+
{
|
195 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Order_Message', Mage::app()->getStore()->getStoreId());
|
196 |
+
if (!$status) {
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
return $status;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
*functions used for getting send sms shiping subject
|
204 |
+
*/
|
205 |
+
public function getSendSmsShipingSubject()
|
206 |
+
{
|
207 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment', Mage::app()->getStore()->getStoreId());
|
208 |
+
if (!$status) {
|
209 |
+
return false;
|
210 |
+
}
|
211 |
+
return $status;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
*functions used for getting shiping sms message
|
216 |
+
*/
|
217 |
+
public function getSendSmsShipingMessage()
|
218 |
+
{
|
219 |
+
$status = $this->getGeneralConfig('Sendin_Sender_Shipment_Message', Mage::app()->getStore()->getStoreId());
|
220 |
+
if (!$status) {
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
return $status;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* functions used for get api key
|
228 |
+
*/
|
229 |
+
public function getApiKey()
|
230 |
+
{
|
231 |
+
$apikey = $this->getGeneralConfig('api', Mage::app()->getStore()->getStoreId());
|
232 |
+
if (!$apikey) {
|
233 |
+
return false;
|
234 |
+
}
|
235 |
+
return $apikey;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* functions used for get SMPT password
|
240 |
+
*/
|
241 |
+
public function getSmtpPassword()
|
242 |
+
{
|
243 |
+
$smtpPassword = $this->getSendinSmtpStatus('password', Mage::app()->getStore()->getStoreId());
|
244 |
+
if (!$smtpPassword) {
|
245 |
+
return false;
|
246 |
+
}
|
247 |
+
return $smtpPassword;
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* functions used for get user name
|
252 |
+
*/
|
253 |
+
public function getUserName()
|
254 |
+
{
|
255 |
+
$userName = $this->getSendinSmtpStatus('username', Mage::app()->getStore()->getStoreId());
|
256 |
+
if (!$userName) {
|
257 |
+
return false;
|
258 |
+
}
|
259 |
+
return $userName;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* functions used for getting smtp status
|
264 |
+
*/
|
265 |
+
public function getSmtpStatus()
|
266 |
+
{
|
267 |
+
$status = $this->getSendinSmtpStatus('status', Mage::app()->getStore()->getStoreId());
|
268 |
+
if (!$status) {
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
return $status;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* functions used for getting tracking status
|
276 |
+
*/
|
277 |
+
public function getTrackingStatus()
|
278 |
+
{
|
279 |
+
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
280 |
+
if (!$status) {
|
281 |
+
return false;
|
282 |
+
}
|
283 |
+
return $status;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* functions used for getting tracking status
|
288 |
+
*/
|
289 |
+
public function getTrackingHistoryStatus()
|
290 |
+
{
|
291 |
+
$status = $this->getSendinTrackingHistoryStatus('history', Mage::app()->getStore()->getStoreId());
|
292 |
+
if (!$status) {
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
return $status;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* functions used for getting userlists
|
300 |
+
*/
|
301 |
+
public function getUserlists()
|
302 |
+
{
|
303 |
+
$userlist = $this->getGeneralConfig('list', Mage::app()->getStore()->getStoreId());
|
304 |
+
if (!$userlist) {
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
return $userlist;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* functions used for getting importOldSubscribers status
|
312 |
+
*/
|
313 |
+
public function getImportOldSubsStatus()
|
314 |
+
{
|
315 |
+
$importStatus = $this->getGeneralConfig('importOldUserStatus', Mage::app()->getStore()->getStoreId());
|
316 |
+
if (!$importStatus) {
|
317 |
+
return false;
|
318 |
+
}
|
319 |
+
return $importStatus;
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* functions used for get templateid
|
324 |
+
*/
|
325 |
+
public function getTemplateId()
|
326 |
+
{
|
327 |
+
$templateId = $this->getGeneralConfig('SendinTemplateId', Mage::app()->getStore()->getStoreId());
|
328 |
+
if (!$templateId) {
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
return $templateId;
|
332 |
+
}
|
333 |
+
/**
|
334 |
+
* functions used for get value final email recive.
|
335 |
+
*/
|
336 |
+
public function getFinalTemplate()
|
337 |
+
{
|
338 |
+
$finalTemplate = $this->getGeneralConfig('SendinTemplateFinal', Mage::app()->getStore()->getStoreId());
|
339 |
+
if (!$finalTemplate) {
|
340 |
+
return false;
|
341 |
+
}
|
342 |
+
return $finalTemplate;
|
343 |
+
}
|
344 |
+
/**
|
345 |
+
* functions used for get value subscribe type like doubleoptin and simple.
|
346 |
+
*/
|
347 |
+
public function getSubscribeConfirmType()
|
348 |
+
{
|
349 |
+
$subscribeConfirmType = $this->getGeneralConfig('SendinSubscribeConfirmType', Mage::app()->getStore()->getStoreId());
|
350 |
+
if (!$subscribeConfirmType) {
|
351 |
+
return false;
|
352 |
+
}
|
353 |
+
return $subscribeConfirmType;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* functions used to get Double optin Template Id in case of doubleoptin type selected.
|
358 |
+
*/
|
359 |
+
public function getDoubleoptinTemplateId()
|
360 |
+
{
|
361 |
+
$doubleoptinTemplateId = $this->getGeneralConfig('SendinDoubleoptinTemplateId', Mage::app()->getStore()->getStoreId());
|
362 |
+
if (!$doubleoptinTemplateId) {
|
363 |
+
return false;
|
364 |
+
}
|
365 |
+
return $doubleoptinTemplateId;
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* functions used for get value for redirect url
|
370 |
+
*/
|
371 |
+
public function getOptinRedirectUrlCheck()
|
372 |
+
{
|
373 |
+
$optionRedirectUrlCheck = $this->getGeneralConfig('SendinOptinRedirectUrlCheck', Mage::app()->getStore()->getStoreId());
|
374 |
+
if (!$optionRedirectUrlCheck) {
|
375 |
+
return false;
|
376 |
+
}
|
377 |
+
return $optionRedirectUrlCheck;
|
378 |
+
}
|
379 |
+
/**
|
380 |
+
* functions used for get double optin redirect url after click email link.
|
381 |
+
*/
|
382 |
+
public function getSendinDoubleoptinRedirectUrl()
|
383 |
+
{
|
384 |
+
$sendinDoubleoptinRedirectUrl = $this->getGeneralConfig('SendinDoubleoptinRedirectUrl', Mage::app()->getStore()->getStoreId());
|
385 |
+
if (!$sendinDoubleoptinRedirectUrl) {
|
386 |
+
return false;
|
387 |
+
}
|
388 |
+
return $sendinDoubleoptinRedirectUrl;
|
389 |
+
}
|
390 |
+
/**
|
391 |
+
* functions used for get final confirmation email for double optin functionality.
|
392 |
+
*/
|
393 |
+
public function getSendinFinalConfirmEmail()
|
394 |
+
{
|
395 |
+
$sendinFinalConfirmEmail = $this->getGeneralConfig('SendinFinalConfirmEmail', Mage::app()->getStore()->getStoreId());
|
396 |
+
if (!$sendinFinalConfirmEmail) {
|
397 |
+
return false;
|
398 |
+
}
|
399 |
+
return $sendinFinalConfirmEmail;
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* functions used for get doubleoptin id geting by sendinblue.
|
404 |
+
*/
|
405 |
+
public function getSendinOptinListId()
|
406 |
+
{
|
407 |
+
$sendinOptionListId = $this->getGeneralConfig('SendinOptinListId', Mage::app()->getStore()->getStoreId());
|
408 |
+
if (!$sendinOptionListId) {
|
409 |
+
return false;
|
410 |
+
}
|
411 |
+
return $sendinOptionListId;
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* functions used for getting general config
|
416 |
+
*/
|
417 |
+
public function getGeneralConfig($field, $store = null)
|
418 |
+
{
|
419 |
+
return Mage::getStoreConfig('sendinblue/'.$field, $store);
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* functions used for get sendinsmtp status
|
424 |
+
*/
|
425 |
+
public function getSendinSmtpStatus($field, $store = null)
|
426 |
+
{
|
427 |
+
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
428 |
+
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* functions used for get sendinblue email status
|
432 |
+
*/
|
433 |
+
public function getSyncronizeStatus()
|
434 |
+
{
|
435 |
+
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
436 |
+
}
|
437 |
+
/**
|
438 |
+
* functions used for get sendin tracking status
|
439 |
+
*/
|
440 |
+
public function getSendinTrackingCodeStatus($field, $store = null)
|
441 |
+
{
|
442 |
+
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* functions used for get sendin tracking history status
|
447 |
+
*/
|
448 |
+
public function getSendinTrackingHistoryStatus($field, $store = null)
|
449 |
+
{
|
450 |
+
return Mage::getStoreConfig('sendinblue/improt/'.$field, $store);
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* functions used for module functionality
|
455 |
+
*/
|
456 |
+
public function getLists()
|
457 |
+
{
|
458 |
+
return $this->lists();
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* functions used for email adds
|
463 |
+
*/
|
464 |
+
public function emailAdd($email, $extra, $isSubscribed = '', $listId = '')
|
465 |
+
{
|
466 |
+
$attributesName = $this->allAttributesName();
|
467 |
+
if ($this->moduleEnable == 1 && $this->getSyncronizeStatus())
|
468 |
+
{
|
469 |
+
$apikey = $this->apiKey;
|
470 |
+
if (!$apikey) {
|
471 |
+
return false;
|
472 |
+
}
|
473 |
+
$sendinConfirmType = Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType');
|
474 |
+
if (empty($listId)) {
|
475 |
+
if (isset($sendinConfirmType) && $sendinConfirmType === 'doubleoptin') {
|
476 |
+
$listId = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
477 |
+
}
|
478 |
+
else {
|
479 |
+
$listId = $this->listsIds;
|
480 |
+
}
|
481 |
+
}
|
482 |
+
$userData = array();
|
483 |
+
$userData['email'] = $email;
|
484 |
+
$userData['id'] = '';
|
485 |
+
if ($isSubscribed != '') {
|
486 |
+
$userData['blacklisted'] = 0;
|
487 |
+
}
|
488 |
+
if ($extra != null) {
|
489 |
+
$keyValue = array_keys($attributesName);
|
490 |
+
$attributesName = is_array($keyValue) ? $keyValue : array($keyValue);
|
491 |
+
$attributesValue = is_array($extra) ? $extra : array($extra);
|
492 |
+
$userData['attributes'] = array_combine($attributesName, $attributesValue);
|
493 |
+
}
|
494 |
+
else {
|
495 |
+
$userData['attributes_value'] = $email;
|
496 |
+
}
|
497 |
+
$userData['listid'] = (is_array($listId)) ? $listId : array($listId);
|
498 |
+
$params['api_key'] = $this->apiKey;
|
499 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
500 |
+
return $psmailinObj->createUpdateUser($userData);
|
501 |
+
}
|
502 |
+
else {
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* functions subscribeuser
|
509 |
+
*/
|
510 |
+
public function emailSubscribe($email)
|
511 |
+
{
|
512 |
+
if ($this->moduleEnable == 1 && $this->getSyncronizeStatus()) {
|
513 |
+
$apikey = $this->apiKey;
|
514 |
+
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
515 |
+
$userTimeZone = str_replace('Calcutta', 'Kolkata', $timezone);
|
516 |
+
$dateValue = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
517 |
+
|
518 |
+
if (!$apikey) {
|
519 |
+
return false;
|
520 |
+
}
|
521 |
+
$userData = array();
|
522 |
+
$userData['timezone'] = $userTimeZone;
|
523 |
+
$userData['user_status'] = $email.', '.'1'.', '.$dateValue;
|
524 |
+
$params['api_key'] = $this->apiKey;
|
525 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
526 |
+
return $psmailinObj->updateUserSubscriptionStatus($userData);
|
527 |
+
}
|
528 |
+
else {
|
529 |
+
return false;
|
530 |
+
}
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* functions used for sync data
|
535 |
+
*/
|
536 |
+
public function syncData()
|
537 |
+
{
|
538 |
+
if ($this->moduleEnable == 1 && $this->getSyncronizeStatus()) {
|
539 |
+
$apikey = $this->apiKey;
|
540 |
+
if (!$apikey) {
|
541 |
+
return false;
|
542 |
+
}
|
543 |
+
$listIds = array();
|
544 |
+
$listIds['listids'] = str_replace(',', '|', $this->listsIds);
|
545 |
+
|
546 |
+
$params['api_key'] = $this->apiKey;
|
547 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
548 |
+
$blockUsersLists = $psmailinObj->getListUsersBlacklistStatus($listIds);
|
549 |
+
|
550 |
+
$blockUsers = $blockUsersLists['data'];
|
551 |
+
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()->showCustomerInfo()->toArray();
|
552 |
+
$subScriberData = $collection['items'];
|
553 |
+
$emails = array();
|
554 |
+
$subScriberDataEmail = array();
|
555 |
+
foreach($subScriberData as $s) {
|
556 |
+
$subScriberDataEmail[$s['subscriber_email']] = $s;
|
557 |
+
}
|
558 |
+
|
559 |
+
if (count($blockUsers) > 0) {
|
560 |
+
$newsLetterSubscriber = Mage::getModel('newsletter/subscriber');
|
561 |
+
foreach ($blockUsers as $key => $value) {
|
562 |
+
foreach ($value as $userData) {
|
563 |
+
if(isset($subScriberDataEmail[$userData['email']])) {
|
564 |
+
// on a trouvé le subscriber magento
|
565 |
+
$data = $subScriberDataEmail[$userData['email']];
|
566 |
+
$tempSubStatus = ($data['subscriber_status'] == 3) ? 1 : 0;
|
567 |
+
if ($tempSubStatus != $userData['blacklisted']) {
|
568 |
+
$emails[] = $data['subscriber_email'];
|
569 |
+
$subscribeData['subscriber_id'] = $data['subscriber_id'];
|
570 |
+
$subscribeData['subscriber_status'] = ($userData['blacklisted'] == 1) ? 3 : 1;
|
571 |
+
$costomerData = $newsLetterSubscriber->loadByEmail($data['subscriber_email']);
|
572 |
+
$costomerData->setStatus($subscribeData['subscriber_status']);
|
573 |
+
$costomerData->setIsStatusChanged(true);
|
574 |
+
$costomerData->save();
|
575 |
+
}
|
576 |
+
}
|
577 |
+
}
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
if (count($emails) > 0) {
|
582 |
+
Mage::getModel('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
583 |
+
}
|
584 |
+
else {
|
585 |
+
Mage::getModel('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
586 |
+
}
|
587 |
+
return true;
|
588 |
+
}
|
589 |
+
else {
|
590 |
+
return false;
|
591 |
+
}
|
592 |
+
}
|
593 |
+
|
594 |
+
/**
|
595 |
+
* This method is used for add email list
|
596 |
+
*/
|
597 |
+
public function addEmailList($email, $listId = '')
|
598 |
+
{
|
599 |
+
if ($this->moduleEnable == 1 && $this->getSyncronizeStatus()) {
|
600 |
+
$apikey = $this->apiKey;
|
601 |
+
if (!$apikey) {
|
602 |
+
return false;
|
603 |
+
}
|
604 |
+
$sendinConfirmType = Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType');
|
605 |
+
if (empty($listId)) {
|
606 |
+
if (isset($sendinConfirmType) && $sendinConfirmType === 'doubleoptin') {
|
607 |
+
$listId = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
608 |
+
}
|
609 |
+
else {
|
610 |
+
$listId = $this->listsIds;
|
611 |
+
}
|
612 |
+
}
|
613 |
+
$userData = array();
|
614 |
+
$userData['email'] = $email;
|
615 |
+
$userData['id'] = '';
|
616 |
+
$userData['blacklisted'] = 0;
|
617 |
+
$userData['attributes'] = array();
|
618 |
+
$userData['listid'] = (is_array($listId)) ? $listId : array($listId);
|
619 |
+
$params['api_key'] = $this->apiKey;
|
620 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
621 |
+
return $psmailinObj->createUpdateUser($userData);
|
622 |
+
}
|
623 |
+
else {
|
624 |
+
return false;
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
/**
|
629 |
+
* This method is used used for email unsubscribe
|
630 |
+
*/
|
631 |
+
public function emailDelete($email)
|
632 |
+
{
|
633 |
+
if ($this->moduleEnable == 1 && $this->getSyncronizeStatus()) {
|
634 |
+
$apikey = $this->apiKey;
|
635 |
+
if (!$apikey) {
|
636 |
+
return false;
|
637 |
+
}
|
638 |
+
$userData = array();
|
639 |
+
$userData['email'] = $email;
|
640 |
+
$userData['listid'] = $this->listsIds;
|
641 |
+
$params['api_key'] = $this->apiKey;
|
642 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
643 |
+
return $psmailinObj->unSubscribApi($userData);
|
644 |
+
}
|
645 |
+
else {
|
646 |
+
return false;
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* This method is used used for check api status
|
652 |
+
*/
|
653 |
+
public function checkApikey()
|
654 |
+
{
|
655 |
+
$params['api_key'] = $this->apiKey;
|
656 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin',$params);
|
657 |
+
$keyResponse = $psmailinObj->getAccount();
|
658 |
+
|
659 |
+
if (isset($keyResponse['code']) && $keyResponse['code'] == 'failure' && isset($keyResponse['message']) && $keyResponse['message'] == 'Key Not Found In Database') {
|
660 |
+
return $lists['error'] = $keyResponse['message'];
|
661 |
+
}
|
662 |
+
}
|
663 |
+
|
664 |
+
/**
|
665 |
+
* Fetches all the list of the user from the Sendinblue platform.
|
666 |
+
*/
|
667 |
+
public function lists($filters = array())
|
668 |
+
{
|
669 |
+
$params = array();
|
670 |
+
$params['api_key'] = $this->apiKey;
|
671 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
672 |
+
$response = $psmailinObj->displayListForPlugin();
|
673 |
+
|
674 |
+
if (isset($response['code']) && $response['code'] == 'failure'){
|
675 |
+
$this->errorMessage = $response['message'];
|
676 |
+
$lists['error'] = $response['message'];
|
677 |
+
}
|
678 |
+
else {
|
679 |
+
$i = 0;
|
680 |
+
$lists = array();
|
681 |
+
foreach ($response['data'] as $listData) {
|
682 |
+
$lists[$i]['id'] = $listData['id'];
|
683 |
+
$lists[$i]['name'] = $listData['name'];
|
684 |
+
$i++;
|
685 |
+
}
|
686 |
+
}
|
687 |
+
return $lists;
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* Fetches the list status of the user from the Sendinblue platform.
|
692 |
+
*/
|
693 |
+
public function getUserListStats()
|
694 |
+
{
|
695 |
+
if ($this->moduleEnable == 1) {
|
696 |
+
$params['api_key'] = $this->apiKey;
|
697 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
698 |
+
return $psmailinObj->displayListForPlugin();
|
699 |
+
}
|
700 |
+
else {
|
701 |
+
return Mage::getModel('core/session')->addError('Sendinblue not enabled');
|
702 |
+
}
|
703 |
+
}
|
704 |
+
|
705 |
+
/**
|
706 |
+
* Fetches all folders and all list within each folder of the user's Sendinblue
|
707 |
+
* account and displays them to the user.
|
708 |
+
*/
|
709 |
+
public function checkFolderListDoubleoptin()
|
710 |
+
{
|
711 |
+
$returnData = array();
|
712 |
+
$params['api_key'] = $this->apiKey;
|
713 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
714 |
+
$foldersListResponse = $psmailinObj->displayFoldersLists();
|
715 |
+
if (!empty($foldersListResponse['data'])) {
|
716 |
+
foreach ($foldersListResponse['data'] as $value) {
|
717 |
+
if (strtolower($value['name']) == 'form') {
|
718 |
+
if (!empty($value['lists'])) {
|
719 |
+
foreach ($value['lists'] as $key => $val) {
|
720 |
+
if ($val['name'] == 'Temp - DOUBLE OPTIN') {
|
721 |
+
$returnData['optin_id'] = $key;
|
722 |
+
}
|
723 |
+
}
|
724 |
+
}
|
725 |
+
}
|
726 |
+
}
|
727 |
+
if (count($returnData) > 0) {
|
728 |
+
$return = $returnData;
|
729 |
+
}
|
730 |
+
else {
|
731 |
+
$return = false;
|
732 |
+
}
|
733 |
+
}
|
734 |
+
return $return;
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Create temporary doubleoptin list if not exist in Sendinblue.
|
739 |
+
*/
|
740 |
+
public function createListIdDoubleoptin()
|
741 |
+
{
|
742 |
+
$folderInfomation = array();
|
743 |
+
$folderId = ''; $listId = '';
|
744 |
+
$folderInfomation['name'] = 'FORM';
|
745 |
+
$params['api_key'] = $this->apiKey;
|
746 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
747 |
+
$returnFolderId = $psmailinObj->createFolder($folderInfomation);
|
748 |
+
|
749 |
+
if(isset($returnFolderId['data']['id'])) {
|
750 |
+
$folderId = $returnFolderId['data']['id'];
|
751 |
+
}
|
752 |
+
if (!empty($folderId)) {
|
753 |
+
$listInformation = array();
|
754 |
+
$listInformation['list_name'] = 'Temp - DOUBLE OPTIN';
|
755 |
+
$listInformation['list_parent'] = $folderId;
|
756 |
+
$listIdResponse = $psmailinObj->createList($listInformation);
|
757 |
+
$listId = $listIdResponse['data']['id'];
|
758 |
+
}
|
759 |
+
return $listId;
|
760 |
+
}
|
761 |
+
|
762 |
+
/**
|
763 |
+
* Fetches all folders and all list within each folder of the user's Sendinblue
|
764 |
+
* account and displays them to the user.
|
765 |
+
*/
|
766 |
+
public function checkFolderList()
|
767 |
+
{
|
768 |
+
$params = array();
|
769 |
+
$array = array();
|
770 |
+
$params['api_key'] = $this->apiKey;
|
771 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
772 |
+
$foldersListResponse = $psmailinObj->displayFoldersLists();
|
773 |
+
|
774 |
+
if (!empty($foldersListResponse['data'])) {
|
775 |
+
foreach ($foldersListResponse['data'] as $key => $value) {
|
776 |
+
if (strtolower($value['name']) == 'magento') {
|
777 |
+
$array[] = $key;
|
778 |
+
$array[] = $value['name'];
|
779 |
+
}
|
780 |
+
if (!empty($value['lists'])) {
|
781 |
+
foreach ($value['lists'] as $val) {
|
782 |
+
if (strtolower($val['name']) == 'magento') {
|
783 |
+
$array[] = $val['name'];
|
784 |
+
}
|
785 |
+
}
|
786 |
+
}
|
787 |
+
}
|
788 |
+
}
|
789 |
+
return $array;
|
790 |
+
}
|
791 |
+
|
792 |
+
/**
|
793 |
+
* folder create in Sendinblue after removing from Sendinblue
|
794 |
+
*/
|
795 |
+
public function createFolderCaseTwo()
|
796 |
+
{
|
797 |
+
$apiKey = $this->apiKey;
|
798 |
+
if($apiKey == '') {
|
799 |
+
return false;
|
800 |
+
}
|
801 |
+
$apiKeyResponse = $this->checkApikey(); // check api key is valid or not
|
802 |
+
if($this->moduleEnable != 1 && $apiKey == '' && $apiKeyResponse['error'] != '' && $this->getSyncronizeStatus()) {
|
803 |
+
return false;
|
804 |
+
}
|
805 |
+
$result = $this->checkFolderList();
|
806 |
+
$listName = 'magento';
|
807 |
+
$data = array();
|
808 |
+
$params['api_key'] = $this->apiKey;
|
809 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
810 |
+
$folderId = $result[0];
|
811 |
+
$existList = $result[2];
|
812 |
+
if (empty($result[1])) {
|
813 |
+
$createListParameters = array();
|
814 |
+
$createListParameters['name'] = 'magento';
|
815 |
+
$folderResponse = $psmailinObj->createFolder($data);
|
816 |
+
if(isset($folderResponse['data']['id'])) {
|
817 |
+
$folderId = $folderResponse['data']['id'];
|
818 |
+
}
|
819 |
+
$createListParameters = array();
|
820 |
+
$createListParameters['list_name'] = $listName;
|
821 |
+
$createListParameters['list_parent'] = $folderId; //folder id
|
822 |
+
$listResponse = $psmailinObj->createList($createListParameters);
|
823 |
+
$this->sendAllMailIDToSendin($listResponse['data']['id']);
|
824 |
+
}
|
825 |
+
elseif (empty($existList)) {
|
826 |
+
$createListParameters = array();
|
827 |
+
$createListParameters['list_name'] = $listName;
|
828 |
+
$createListParameters['list_parent'] = $folderId; //folder id
|
829 |
+
$listResponse = $psmailinObj->createList($createListParameters);
|
830 |
+
$this->sendAllMailIDToSendin($listResponse['data']['id']);
|
831 |
+
}
|
832 |
+
}
|
833 |
+
|
834 |
+
/**
|
835 |
+
* folder create in Sendinblue after installing
|
836 |
+
*/
|
837 |
+
public function createFolderName($apiKey)
|
838 |
+
{
|
839 |
+
$this->apiKey = $apiKey;
|
840 |
+
$this->createAttributesName();
|
841 |
+
$folderInformation = $this->checkFolderList();
|
842 |
+
$folderId = '';
|
843 |
+
if (empty($folderInformation[1])) {
|
844 |
+
$folderData = array();
|
845 |
+
$params['api_key'] = $this->apiKey;
|
846 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
847 |
+
$folderData['name'] = 'magento';
|
848 |
+
$responseFolderId = $psmailinObj->createFolder($folderData);
|
849 |
+
if(isset($responseFolderId['data']['id'])) {
|
850 |
+
$folderId = $responseFolderId['data']['id'];
|
851 |
+
}
|
852 |
+
$existList = '';
|
853 |
+
}
|
854 |
+
else {
|
855 |
+
$folderId = $folderInformation[0];
|
856 |
+
$existList = $folderInformation[2];
|
857 |
+
}
|
858 |
+
$this->createNewList($folderId, $existList);
|
859 |
+
$this->partnerMagento();
|
860 |
+
}
|
861 |
+
|
862 |
+
/**
|
863 |
+
* Method is used to add the partner's name in Sendinblue.
|
864 |
+
* In this case its "MAGENTO".
|
865 |
+
*/
|
866 |
+
public function partnerMagento()
|
867 |
+
{
|
868 |
+
$mailinPartnerParameters = array();
|
869 |
+
$params['api_key'] = $this->apiKey;
|
870 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
871 |
+
$mailinPartnerParameters['partner'] = 'MAGENTO';
|
872 |
+
$psmailinObj->updateMailinParter($mailinPartnerParameters);
|
873 |
+
}
|
874 |
+
|
875 |
+
/**
|
876 |
+
* Creates a list by the name "magento" on user's Sendinblue account.
|
877 |
+
*/
|
878 |
+
public function createNewList($response, $existList)
|
879 |
+
{
|
880 |
+
$params['api_key'] = $this->apiKey;
|
881 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
882 |
+
if ($existList != '') {
|
883 |
+
$date = date('dmY');
|
884 |
+
$listName = 'magento_'.$date;
|
885 |
+
}
|
886 |
+
else {
|
887 |
+
$listName = 'magento';
|
888 |
+
}
|
889 |
+
$listData = array();
|
890 |
+
$listData['list_name'] = $listName;
|
891 |
+
$listData['list_parent'] = $response;
|
892 |
+
$listResponse = $psmailinObj->createList($listData);
|
893 |
+
$this->sendAllMailIDToSendin($listResponse['data']['id']);
|
894 |
+
$this->createAttributesName();
|
895 |
+
}
|
896 |
+
|
897 |
+
/**
|
898 |
+
* Fetch attributes and their values
|
899 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
900 |
+
*/
|
901 |
+
public function allAttributesName()
|
902 |
+
{
|
903 |
+
if ($this->userLanguage == 'fr') {
|
904 |
+
$attributesName = array('PRENOM'=>'firstname', 'NOM'=>'lastname', 'MAGENTO_LANG'=>'created_in','CLIENT'=>'client','SMS'=>'telephone','COMPANY'=>'company','CITY'=>'city','COUNTRY_ID'=>'country_id','POSTCODE'=>'postcode','STREET'=>'street','REGION'=>'region','STORE_ID'=>'store_id');
|
905 |
+
}
|
906 |
+
else {
|
907 |
+
$attributesName = array('NAME'=>'firstname', 'SURNAME'=>'lastname', 'MAGENTO_LANG'=>'created_in','CLIENT'=>'client','SMS'=>'telephone','COMPANY'=>'company','CITY'=>'city','COUNTRY_ID'=>'country_id','POSTCODE'=>'postcode','STREET'=>'street','REGION'=>'region','STORE_ID'=>'store_id');
|
908 |
+
}
|
909 |
+
return $attributesName;
|
910 |
+
}
|
911 |
+
|
912 |
+
/**
|
913 |
+
* Fetch attributes name and type
|
914 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
915 |
+
*/
|
916 |
+
public function allAttributesType()
|
917 |
+
{
|
918 |
+
if ($this->userLanguage == 'fr') {
|
919 |
+
$attributesType = array('PRENOM'=>'text', 'NOM'=>'text', 'MAGENTO_LANG'=>'text','CLIENT'=>'number','SMS'=>'text','COMPANY'=>'text','CITY'=>'text','COUNTRY_ID'=>'text','POSTCODE'=>'number','STREET'=>'text','REGION'=>'text','STORE_ID'=>'number');
|
920 |
+
}
|
921 |
+
else {
|
922 |
+
$attributesType = array('NAME'=>'text', 'SURNAME'=>'text', 'MAGENTO_LANG'=>'text','CLIENT'=>'number','SMS'=>'text','COMPANY'=>'text','CITY'=>'text','COUNTRY_ID'=>'text','POSTCODE'=>'number','STREET'=>'text','REGION'=>'text','STORE_ID'=>'number');
|
923 |
+
}
|
924 |
+
return $attributesType;
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Fetch all Transactional Attributes
|
929 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
930 |
+
*/
|
931 |
+
public function allTransactionalAttributes()
|
932 |
+
{
|
933 |
+
$transactionalAttributes = array('ORDER_ID'=>'id', 'ORDER_DATE'=>'date', 'ORDER_PRICE'=>'number');
|
934 |
+
return $transactionalAttributes;
|
935 |
+
}
|
936 |
+
|
937 |
+
/**
|
938 |
+
* Create Normal, Transactional, Calculated and Global attributes and their values
|
939 |
+
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
940 |
+
*/
|
941 |
+
public function createAttributesName()
|
942 |
+
{
|
943 |
+
$normalAttributesData = array();
|
944 |
+
$transactionalAttributesData = array();
|
945 |
+
$params['api_key'] = $this->apiKey;
|
946 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
947 |
+
$noramalAttributes = $this->allAttributesType();
|
948 |
+
$transactionalAttributes = $this->allTransactionalAttributes();
|
949 |
+
|
950 |
+
$normalAttributesData = array(
|
951 |
+
"type" => "normal",
|
952 |
+
"data" => $noramalAttributes
|
953 |
+
);
|
954 |
+
$psmailinObj->createAttribute($normalAttributesData);
|
955 |
+
|
956 |
+
$transactionalAttributesData = array(
|
957 |
+
"type" => "transactional",
|
958 |
+
"data" => $transactionalAttributes
|
959 |
+
);
|
960 |
+
$psmailinObj->createAttribute($transactionalAttributesData);
|
961 |
+
}
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Method is used to send all the subscribers from magento to
|
965 |
+
* Sendinblue for adding / updating purpose.
|
966 |
+
*/
|
967 |
+
public function sendAllMailIDToSendin($list)
|
968 |
+
{
|
969 |
+
$sendinSwitch = Mage::getModel('core/config');
|
970 |
+
$allEmail = $this->getcustomers();
|
971 |
+
if ($allEmail > 0) {
|
972 |
+
$userDataInformation = array();
|
973 |
+
$params['api_key'] = $this->apiKey;
|
974 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
975 |
+
$userDataInformation['key'] = $this->apiKey;
|
976 |
+
$userDataInformation['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
977 |
+
$userDataInformation['listids'] = array($list); // $list;
|
978 |
+
$userDataInformation['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
979 |
+
$responseValue = $psmailinObj->importUsers($userDataInformation);
|
980 |
+
$sendinSwitch->saveConfig('sendinblue/importOldUserStatus', 0, 'default', 0);
|
981 |
+
if (empty($responseValue['data']['process_id'])) {
|
982 |
+
$sendinSwitch->saveConfig('sendinblue/importOldUserStatus', 1);
|
983 |
+
}
|
984 |
+
}
|
985 |
+
$sendinSwitch->saveConfig('sendinblue/list', $list, 'default', 0);
|
986 |
+
}
|
987 |
+
|
988 |
+
/**
|
989 |
+
* Send SMS from Sendin.
|
990 |
+
*/
|
991 |
+
public function sendSmsApi($array)
|
992 |
+
{
|
993 |
+
$smsSendData = array();
|
994 |
+
$smsSendData['to'] = $array['to'];
|
995 |
+
$smsSendData['from'] = $array['from'];
|
996 |
+
$smsSendData['text'] = $array['text'];
|
997 |
+
$params['api_key'] = $this->apiKey;
|
998 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
999 |
+
$sendSmsStatus = $psmailinObj->sendSms($smsSendData);
|
1000 |
+
return $sendSmsStatus['data'];
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
public function sendOrder($mobile)
|
1004 |
+
{
|
1005 |
+
if (isset($mobile)) {
|
1006 |
+
$sendOrderData = array();
|
1007 |
+
$sendOrderData['to'] = $mobile;
|
1008 |
+
$sendOrderData['from'] = $this->getSendSmsOrderSubject();
|
1009 |
+
$sendOrderData['text'] = $this->getSendSmsmOrderMessage();
|
1010 |
+
return $this->sendSmsApi($sendOrderData);
|
1011 |
+
}
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
public function notifySmsEmail()
|
1015 |
+
{
|
1016 |
+
$sendinSwitch = Mage::getModel('core/config');
|
1017 |
+
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->moduleEnable == 1 && $this->getNotifySmsStatus() == 1) {
|
1018 |
+
if($this->getNotifyCronStatus() == 0) {
|
1019 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
1020 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
1021 |
+
$emailTemplateVariables = array();
|
1022 |
+
|
1023 |
+
$emailTemplateVariables['text0'] = '[SendinBlue] Alert: You do not have enough credits SMS';
|
1024 |
+
$senderName = 'SendinBlue';
|
1025 |
+
$senderEmail = 'contact@sendinblue.com';
|
1026 |
+
|
1027 |
+
if ($localeCode == 'fr_FR') {
|
1028 |
+
$emailTemplateVariables['text0'] = ' [SendinBlue] Alerte: Vos crédits SMS seront bientôt épuisés';
|
1029 |
+
$senderName = 'SendinBlue';
|
1030 |
+
$senderEmail = 'contact@sendinblue.com';
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
$email = $this->getNotifyEmailStatus();
|
1034 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('notification_template');
|
1035 |
+
$templateText = $emailTemplate->template_text;
|
1036 |
+
$webSite = Mage::app()->getWebsite()->getName();
|
1037 |
+
$credit = $this->getSmsCredit();
|
1038 |
+
preg_match_all('#{(.*)}#', $templateText, $match);
|
1039 |
+
|
1040 |
+
$tempParams = array(
|
1041 |
+
'{site_name}'=>$webSite,
|
1042 |
+
'{present_credit}'=>$credit
|
1043 |
+
);
|
1044 |
+
foreach($match[0] as $var=>$value){
|
1045 |
+
$templateText = preg_replace('#'.$value.'#',$tempParams[$value],$templateText);
|
1046 |
+
}
|
1047 |
+
$emailTemplate->template_text = $templateText;
|
1048 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
1049 |
+
$emailTemplate->setSenderName($senderName);
|
1050 |
+
$emailTemplate->setSenderEmail($senderEmail);
|
1051 |
+
$emailTemplate->setTemplateSubject($emailTemplateVariables['text0']);
|
1052 |
+
$emailTemplate->send($email, '', $emailTemplateVariables);
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
else {
|
1056 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
1057 |
+
}
|
1058 |
+
Mage::getModel('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
/**
|
1062 |
+
* show SMS credit from Sendinblue.
|
1063 |
+
*/
|
1064 |
+
public function getSmsCredit()
|
1065 |
+
{
|
1066 |
+
$params['api_key'] = $this->apiKey;
|
1067 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1068 |
+
$userCurrentPlanInfo = $psmailinObj->getAccount();
|
1069 |
+
if(isset($userCurrentPlanInfo['data'])) {
|
1070 |
+
foreach($userCurrentPlanInfo['data'] as $planData) {
|
1071 |
+
if(isset($planData['plan_type']) && $planData['plan_type'] == 'SMS') {
|
1072 |
+
return $planData['credits'];
|
1073 |
+
}
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
/**
|
1079 |
+
* Method is used to send test email to the user.
|
1080 |
+
*/
|
1081 |
+
public function sendTestMail($email)
|
1082 |
+
{
|
1083 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
1084 |
+
$emailTemplateVariables = array();
|
1085 |
+
|
1086 |
+
$emailTemplateVariables['text0'] = '[SendinBlue SMTP] test email';
|
1087 |
+
$senderName = 'SendinBlue';
|
1088 |
+
$senderEmail = 'contact@sendinblue.com';
|
1089 |
+
|
1090 |
+
if ($localeCode == 'fr_FR') {
|
1091 |
+
$emailTemplateVariables['text0'] = '[SendinBlue SMTP] e-mail de test';
|
1092 |
+
$senderName = 'SendinBlue';
|
1093 |
+
$senderEmail = 'contact@sendinblue.com';
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
try {
|
1097 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('custom_template');
|
1098 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
1099 |
+
$emailTemplate->setSenderName($senderName);
|
1100 |
+
$emailTemplate->setSenderEmail($senderEmail);
|
1101 |
+
$emailTemplate->setTemplateSubject($emailTemplateVariables['text0']);
|
1102 |
+
return $emailTemplate->send($email, '', $emailTemplateVariables);
|
1103 |
+
}
|
1104 |
+
catch(Exception $e) {
|
1105 |
+
|
1106 |
+
}
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
/**
|
1110 |
+
* This method is used to compare key and value
|
1111 |
+
* return all value in array whose present in array key
|
1112 |
+
*/
|
1113 |
+
public function mergeMyArray($one, $two, $email = "")
|
1114 |
+
{
|
1115 |
+
$emailData = $email ? array('EMAIL'=> $email) : array();
|
1116 |
+
if (count($one) > 0) {
|
1117 |
+
foreach($one as $k => $v) {
|
1118 |
+
$emailData[$k] = isset($two[$v])?str_replace(';',',', $two[$v]):'';
|
1119 |
+
}
|
1120 |
+
}
|
1121 |
+
return $emailData;
|
1122 |
+
}
|
1123 |
+
|
1124 |
+
/**
|
1125 |
+
* This method is used to fetch all users from the default customer table to list
|
1126 |
+
* them in the Sendinblue magento module.
|
1127 |
+
*/
|
1128 |
+
public function getcustomers()
|
1129 |
+
{
|
1130 |
+
$data = array();
|
1131 |
+
$customerAddressData = array();
|
1132 |
+
$attributesName = $this->allAttributesName();
|
1133 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
1134 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1135 |
+
foreach ($collection as $customer) {
|
1136 |
+
$responseByMerge = array();
|
1137 |
+
$customerData = array();
|
1138 |
+
$customerData = $customer->getData();
|
1139 |
+
$email = $customerData['email'];
|
1140 |
+
$customerId = $customerData['entity_id'];
|
1141 |
+
|
1142 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$customerId);
|
1143 |
+
$telephone = '';
|
1144 |
+
$customerAddress = array();
|
1145 |
+
foreach ($collectionAddress as $customerPhno) {
|
1146 |
+
$customerAddress = $customerPhno->getData();
|
1147 |
+
$customerAddress['client'] = $customerId>0?1:0;
|
1148 |
+
}
|
1149 |
+
$customerAddressData[$email] = array_merge($customerData, $customerAddress);
|
1150 |
+
}
|
1151 |
+
$newsLetterData = array();
|
1152 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
1153 |
+
$count = 0;
|
1154 |
+
foreach ( $newsletter->getItems() as $subscriber) {
|
1155 |
+
$subsdata = $subscriber->getData();
|
1156 |
+
$subscriberEmail = $subsdata['subscriber_email'];
|
1157 |
+
|
1158 |
+
if ( !empty($customerAddressData[$subscriberEmail]) ) {
|
1159 |
+
$customerAddressData[$subscriberEmail]['email'] = $subscriberEmail;
|
1160 |
+
$responseByMerge[$count] = $this->mergeMyArray($attributesName, $customerAddressData[$subscriberEmail], $subscriberEmail);
|
1161 |
+
}
|
1162 |
+
else {
|
1163 |
+
$newsLetterData['client'] = $subsdata['customer_id']>0?1:0;
|
1164 |
+
$responseByMerge[$count] = $this->mergeMyArray($attributesName, $newsLetterData, $subscriberEmail);
|
1165 |
+
$responseByMerge[$count]['STORE_ID'] = $subsdata['store_id'];
|
1166 |
+
}
|
1167 |
+
$count++;
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv')) {
|
1171 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
1175 |
+
$keyValue = array_keys($attributesName);
|
1176 |
+
array_splice($keyValue, 0, 0, 'EMAIL');
|
1177 |
+
|
1178 |
+
fwrite($handle, implode(';', $keyValue)."\n");
|
1179 |
+
foreach ($responseByMerge as $newsdata) {
|
1180 |
+
if(!empty($newsdata['COUNTRY_ID']) && !empty($newsdata['SMS'])) {
|
1181 |
+
$countryId = $this->getCountryCode($newsdata['COUNTRY_ID']);
|
1182 |
+
$newsdata['SMS'] = $this->checkMobileNumber($newsdata['SMS'], $countryId);
|
1183 |
+
}
|
1184 |
+
$keyValue = $newsdata;
|
1185 |
+
fwrite($handle, str_replace("\n", "",implode(';', $keyValue))."\n");
|
1186 |
+
}
|
1187 |
+
fclose($handle);
|
1188 |
+
$totalValue = count($responseByMerge);
|
1189 |
+
return $totalValue;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
/**
|
1193 |
+
* This method is used to fetch all users from the default newsletter table to list
|
1194 |
+
* them in the Sendinblue magento module.
|
1195 |
+
*/
|
1196 |
+
public function getNewsletterSubscribe($start, $perPage)
|
1197 |
+
{
|
1198 |
+
$customerAddressData = array();
|
1199 |
+
$attributesName = $this->allAttributesName();
|
1200 |
+
$attributesName['email'] = 'email';
|
1201 |
+
$attributesName['customer_id'] = 'entity_id';
|
1202 |
+
|
1203 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
1204 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1205 |
+
foreach ($collection as $customer) {
|
1206 |
+
$customerData = array();
|
1207 |
+
$customerData = $customer->getData();
|
1208 |
+
$email = $customerData['email'];
|
1209 |
+
$customerId = $customerData['entity_id'];
|
1210 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$customerId);
|
1211 |
+
$telephone = '';
|
1212 |
+
$customerAddress = array();
|
1213 |
+
foreach ($collectionAddress as $customerPhno) {
|
1214 |
+
$customerAddress = $customerPhno->getData();
|
1215 |
+
if (!empty($customerAddress['telephone']) && !empty($customerAddress['country_id'])) {
|
1216 |
+
$countryCode = $this->getCountryCode($customerAddress['country_id']);
|
1217 |
+
$customerAddress['telephone'] = $this->checkMobileNumber($customerAddress['telephone'], $countryCode);
|
1218 |
+
}
|
1219 |
+
$customerAddress['client'] = $customerId>0?1:0;
|
1220 |
+
}
|
1221 |
+
$customerAddressData[$email] = array_merge($customerData, $customerAddress);
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
$newsLetterData = array();
|
1225 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
1226 |
+
$count = 0;
|
1227 |
+
$responseData = array();
|
1228 |
+
foreach ( $newsletter->getItems() as $subscriber) {
|
1229 |
+
$subsdata = $subscriber->getData();
|
1230 |
+
$subscriberEmail = $subsdata['subscriber_email'];
|
1231 |
+
$subscriberStatus = $subsdata['subscriber_status'];
|
1232 |
+
if ( !empty($customerAddressData[$subscriberEmail]) ) {
|
1233 |
+
$responseData[$count] = $this->mergeMyArray($attributesName, $customerAddressData[$subscriberEmail]);
|
1234 |
+
unset($customerAddressData[$subscriberEmail]);
|
1235 |
+
$responseData[$count]['subscriber_status'] = $subscriberStatus;
|
1236 |
+
$responseData[$count]['email'] = $subscriberEmail;
|
1237 |
+
}
|
1238 |
+
else {
|
1239 |
+
$newsLetterData['client'] = $subsdata['customer_id']> 0 ? 1 : 0;
|
1240 |
+
$responseData[$count] = $this->mergeMyArray($attributesName, $newsLetterData);
|
1241 |
+
$responseData[$count]['subscriber_status'] = $subscriberStatus;
|
1242 |
+
$responseData[$count]['email'] = $subscriberEmail;
|
1243 |
+
}
|
1244 |
+
$count++;
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
if (count($customerAddressData) > 0) {
|
1248 |
+
foreach ($customerAddressData as $email => $cVal) {
|
1249 |
+
$responseData[$count] = $this->mergeMyArray($attributesName, $cVal);
|
1250 |
+
$responseData[$count]['subscriber_status'] = 3;
|
1251 |
+
$responseData[$count]['email'] = $email;
|
1252 |
+
$count++;
|
1253 |
+
}
|
1254 |
+
}
|
1255 |
+
return array_slice($responseData, $start, $perPage, true);
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
/**
|
1259 |
+
* This method is used to fetch total count unsubscribe users from the default newsletter table to list
|
1260 |
+
* them in the Sendinblue magento module.
|
1261 |
+
*/
|
1262 |
+
public function getNewsletterUnSubscribeCount()
|
1263 |
+
{
|
1264 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1265 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
1266 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1267 |
+
|
1268 |
+
$readDbObject = Mage::getSingleton("core/resource")->getConnection("core_read");
|
1269 |
+
$queryUnSubscribCounter1 = $readDbObject->select()
|
1270 |
+
->from(
|
1271 |
+
array('CE' => $tableCustomer),
|
1272 |
+
array(''))
|
1273 |
+
->join(array('NS' => $tableNewsletter),
|
1274 |
+
'CE.entity_id=NS.customer_id',
|
1275 |
+
array('totalcoutn' => 'COUNT(*)'))
|
1276 |
+
->where("subscriber_status != 1 or subscriber_status is null");
|
1277 |
+
$stmtUnSubscribCounter1 = $readDbObject->query($queryUnSubscribCounter1);
|
1278 |
+
$unSubscribCounter1 = $stmtUnSubscribCounter1->fetch();
|
1279 |
+
|
1280 |
+
$queryUnSubscribCounter2 = $readDbObject->select()
|
1281 |
+
->from($tableNewsletter,array('totalcoutn' => 'COUNT(*)'))
|
1282 |
+
->where("customer_id = 0 AND subscriber_status = 3");
|
1283 |
+
$stmtUnSubscribCounter2 = $readDbObject->query($queryUnSubscribCounter2);
|
1284 |
+
$unSubscribCounter2 = $stmtUnSubscribCounter2->fetch();
|
1285 |
+
|
1286 |
+
return ($unSubscribCounter1['totalcoutn'] + $unSubscribCounter2['totalcoutn']);
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
/**
|
1290 |
+
* This method is used to fetch total count subscribe users from the default newsletter table to list
|
1291 |
+
* them in the Sendinblue magento module.
|
1292 |
+
*/
|
1293 |
+
public function getNewsletterSubscribeCount()
|
1294 |
+
{
|
1295 |
+
$coreResource = Mage::getSingleton('core/resource');
|
1296 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
1297 |
+
$readDbObject = Mage::getSingleton("core/resource")->getConnection("core_read");
|
1298 |
+
$queryUnSubscribCounter = $readDbObject->select()
|
1299 |
+
->from($tableNewsletter,array('totalvalue' => 'COUNT(*)'))
|
1300 |
+
->where("subscriber_status = 1");
|
1301 |
+
$stmtUnSubscribCounter = $readDbObject->query($queryUnSubscribCounter);
|
1302 |
+
$unSubscribCounter = $stmtUnSubscribCounter->fetch();
|
1303 |
+
return $unSubscribCounter['totalvalue'];
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
/**
|
1307 |
+
* This method is used to check the subscriber's newsletter subscription status in Sendinblue
|
1308 |
+
*/
|
1309 |
+
public function checkUserSendinStatus($result)
|
1310 |
+
{
|
1311 |
+
$userStatus = array();
|
1312 |
+
foreach ($result as $subscriber) {
|
1313 |
+
$userStatus[] = $subscriber['email'];
|
1314 |
+
}
|
1315 |
+
$allUsers = array('users' => $userStatus );
|
1316 |
+
$params['api_key'] = $this->apiKey;
|
1317 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1318 |
+
$usersBlackListData = $psmailinObj->getUsersBlacklistStatus($allUsers);
|
1319 |
+
return $usersBlackListData;
|
1320 |
+
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
/**
|
1324 |
+
* Fetches the SMTP and order tracking details
|
1325 |
+
*/
|
1326 |
+
public function trackingSmtp()
|
1327 |
+
{
|
1328 |
+
$params['api_key'] = $this->apiKey;
|
1329 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1330 |
+
$smtpDetails = $psmailinObj->getSmtpDetails();
|
1331 |
+
return $smtpDetails;
|
1332 |
+
}
|
1333 |
+
|
1334 |
+
public function removeOldEntry()
|
1335 |
+
{
|
1336 |
+
$sendinSwitch = Mage::getModel('core/config');
|
1337 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/status', '');
|
1338 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/authentication', '');
|
1339 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/username', '');
|
1340 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/password', '');
|
1341 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/host', '');
|
1342 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/port', '');
|
1343 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/ssl', '');
|
1344 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/option', '');
|
1345 |
+
$sendinSwitch->saveConfig('sendinblue/tracking/code', '');
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
protected function _uninstallResourceDb($version)
|
1349 |
+
{
|
1350 |
+
Mage::dispatchEvent('module_uninstall', array('resource' => $this->_resourceName));
|
1351 |
+
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1352 |
+
return $this;
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
/**
|
1356 |
+
* This method is used to fetch all subscribe users from the default customer table to list
|
1357 |
+
* them in the Sendinblue magento module.
|
1358 |
+
*/
|
1359 |
+
public function smsCampaignList()
|
1360 |
+
{
|
1361 |
+
$customerAddressData = array();
|
1362 |
+
$attributesName = $this->allAttributesName();
|
1363 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('created_in');
|
1364 |
+
$customerAddressCollection = Mage::getModel('customer/address');
|
1365 |
+
|
1366 |
+
foreach ($collection as $customer) {
|
1367 |
+
$responceData = array();
|
1368 |
+
$customerData = array();
|
1369 |
+
|
1370 |
+
$customerData = $customer->getData();
|
1371 |
+
$email = $customerData['email'];
|
1372 |
+
$customerId = $customerData['entity_id'];
|
1373 |
+
|
1374 |
+
$collectionAddress = $customerAddressCollection->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToSelect('company')->addAttributeToSelect('street')->addAttributeToSelect('postcode')->addAttributeToSelect('region')->addAttributeToSelect('city')->addAttributeToFilter('parent_id',(int)$customerId);
|
1375 |
+
$telephone = '';
|
1376 |
+
$customerAddress = array();
|
1377 |
+
foreach ($collectionAddress as $customerPhno) {
|
1378 |
+
$customerAddress = $customerPhno->getData();
|
1379 |
+
if (!empty($customerAddress['telephone']) && !empty($customerAddress['country_id'])) {
|
1380 |
+
$countryCode = $this->getCountryCode($customerAddress['country_id']);
|
1381 |
+
$customerAddress['telephone'] = $this->checkMobileNumber($customerAddress['telephone'], $countryCode);
|
1382 |
+
}
|
1383 |
+
$customerAddress['client'] = $customerId > 0 ? 1 : 0;
|
1384 |
+
}
|
1385 |
+
$customerAddressData[$email] = array_merge($customerData, $customerAddress);
|
1386 |
+
}
|
1387 |
+
$newsLetterData = array();
|
1388 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
1389 |
+
$count = 0;
|
1390 |
+
|
1391 |
+
foreach ( $newsletter->getItems() as $subscriber) {
|
1392 |
+
$subsdata = $subscriber->getData();
|
1393 |
+
$subscriberEmail = $subsdata['subscriber_email'];
|
1394 |
+
$subscriberStatus = $subsdata['subscriber_status'];
|
1395 |
+
if ( !empty($customerAddressData[$subscriberEmail]) ) {
|
1396 |
+
$customerAddressData[$subscriberEmail]['email'] = $subscriberEmail;
|
1397 |
+
$responceData[$count] = $this->mergeMyArray($attributesName, $customerAddressData[$subscriberEmail]);
|
1398 |
+
$responceData[$count]['EMAIL'] = $subscriberEmail;
|
1399 |
+
$responceData[$count]['subscriber_status'] = $subscriberStatus;
|
1400 |
+
}
|
1401 |
+
else {
|
1402 |
+
$newsLetterData['client'] = $subsdata['customer_id']>0?1:0;
|
1403 |
+
$responceData[$count] = $this->mergeMyArray($attributesName, $newsLetterData);
|
1404 |
+
$responceData[$count]['EMAIL'] = $subscriberEmail;
|
1405 |
+
$responceData[$count]['subscriber_status'] = $subscriberStatus;
|
1406 |
+
$responceData[$count]['STORE_ID'] = $subsdata['store_id'];
|
1407 |
+
}
|
1408 |
+
$count++;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
$i = 0;
|
1412 |
+
$data = array();
|
1413 |
+
foreach($responceData as $result) {
|
1414 |
+
if(!empty($result['SMS'])) {
|
1415 |
+
$data[$i]= $result;
|
1416 |
+
}
|
1417 |
+
$i++;
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
return json_encode($data);
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
/**
|
1424 |
+
* API config value from SendinBlue.
|
1425 |
+
*/
|
1426 |
+
public function getApiConfigValue()
|
1427 |
+
{
|
1428 |
+
$params['api_key'] = $this->apiKey;
|
1429 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1430 |
+
$valueConfig = $psmailinObj->getPluginConfig();
|
1431 |
+
return $valueConfig;
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
/**
|
1435 |
+
* Send template email by sendinblue for newsletter subscriber user .
|
1436 |
+
*/
|
1437 |
+
public function sendWsTemplateMail($to, $templateId = false)
|
1438 |
+
{
|
1439 |
+
$params['api_key'] = $this->apiKey;
|
1440 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1441 |
+
$sendinConfirmType = $this->getSubscribeConfirmType();
|
1442 |
+
$doubleoptinTemplateId = $this->getDoubleoptinTemplateId();
|
1443 |
+
if (empty($sendinConfirmType) || $sendinConfirmType == 'nocon') {
|
1444 |
+
return false;
|
1445 |
+
}
|
1446 |
+
|
1447 |
+
if (!$templateId) {
|
1448 |
+
if ($sendinConfirmType == 'simplemail') {
|
1449 |
+
$templateIdValue = $this->getTemplateId();
|
1450 |
+
$templateId = !empty($templateIdValue) ? $templateIdValue : '';// 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.
|
1451 |
+
|
1452 |
+
$simpleEmailData = array(
|
1453 |
+
"id" => intval($templateId),
|
1454 |
+
"to" => $to,
|
1455 |
+
"cc" => "",
|
1456 |
+
"bcc" => "",
|
1457 |
+
"attr" => "",
|
1458 |
+
//"headers" => array("Content-Type"=> "text/html;charset=iso-8859-1", "X-Mailin-tag"=>$transactional_tags )
|
1459 |
+
);
|
1460 |
+
return $psmailinObj->sendTransactionalTemplate($simpleEmailData);
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
$pathResponce = '';
|
1464 |
+
$emailUser = base64_encode($to);
|
1465 |
+
$pathResponce = Mage::getBaseUrl().'sendinblue/ajax/mailResponce?value='.base64_encode($to);
|
1466 |
+
if ($sendinConfirmType == 'doubleoptin' && $doubleoptinTemplateId == '') {
|
1467 |
+
return $this->defaultDoubleoptinTemp($to, $pathResponce);
|
1468 |
+
}
|
1469 |
+
else if ($sendinConfirmType == 'doubleoptin' && $doubleoptinTemplateId > 0) {
|
1470 |
+
$templateId = $doubleoptinTemplateId;
|
1471 |
+
$senderName = 'SendinBlue';
|
1472 |
+
$senderEmail = 'contact@sendinblue.com';
|
1473 |
+
$doubleOptinRedirectUrlCheck = $this->getOptinRedirectUrlCheck();
|
1474 |
+
$data = array(
|
1475 |
+
'id' => $templateId
|
1476 |
+
);
|
1477 |
+
$response = $psmailinObj->getCampaignV2($data);
|
1478 |
+
|
1479 |
+
if($response['code'] == 'success') {
|
1480 |
+
$htmlContent = $response['data'][0]['html_content'];
|
1481 |
+
if (trim($response['data'][0]['subject']) != '') {
|
1482 |
+
$subject = trim($response['data'][0]['subject']);
|
1483 |
+
}
|
1484 |
+
if (($response['data'][0]['from_name'] != '[DEFAULT_FROM_NAME]') &&
|
1485 |
+
($response['data'][0]['from_email'] != '[DEFAULT_FROM_EMAIL]') &&
|
1486 |
+
($response['data'][0]['from_email'] != '')) {
|
1487 |
+
$senderName = $response['data'][0]['from_name'];
|
1488 |
+
$senderEmail = $response['data'][0]['from_email'];
|
1489 |
+
}
|
1490 |
+
$transactionalTags = $response['data'][0]['campaign_name'];
|
1491 |
+
}
|
1492 |
+
$doubleoptinRedirectUrl = Mage::getBaseUrl();
|
1493 |
+
$sendinFinalConfirmEmail = $this->getSendinFinalConfirmEmail();
|
1494 |
+
$getFinalTemplateId = $this->getFinalTemplate();
|
1495 |
+
|
1496 |
+
if($doubleOptinRedirectUrlCheck == 'yes') {
|
1497 |
+
$sendinDoubleoptinRedirectUrl = $this->getSendinDoubleoptinRedirectUrl();
|
1498 |
+
if(!empty($sendinDoubleoptinRedirectUrl)) {
|
1499 |
+
$doubleoptinRedirectUrl = $sendinDoubleoptinRedirectUrl;
|
1500 |
+
}
|
1501 |
+
}
|
1502 |
+
|
1503 |
+
if($sendinFinalConfirmEmail == 'yes' && $getFinalTemplateId > 0)
|
1504 |
+
{
|
1505 |
+
$doubleoptinRedirectUrl = $pathResponce;
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
$from = array($senderEmail, $senderName);
|
1509 |
+
$htmlContent = str_replace('{title}', $subject, $htmlContent);
|
1510 |
+
$htmlContent = str_replace('https://[DOUBLEOPTIN]', "$doubleoptinRedirectUrl", $htmlContent);
|
1511 |
+
$htmlContent = str_replace('http://[DOUBLEOPTIN]', "$doubleoptinRedirectUrl", $htmlContent);
|
1512 |
+
$htmlContent = str_replace('[DOUBLEOPTIN]', "$doubleoptinRedirectUrl", $htmlContent);
|
1513 |
+
$headers = array("Content-Type"=> "text/html;charset=iso-8859-1", "X-Mailin-tag"=>$transactionalTags );
|
1514 |
+
$sendMailData = array( "to" => array("$to" => ""),
|
1515 |
+
"from" => $from,
|
1516 |
+
"subject" => $subject,
|
1517 |
+
"html" => $htmlContent,
|
1518 |
+
"attachment" => array(),
|
1519 |
+
"headers" => $headers,
|
1520 |
+
);
|
1521 |
+
return $psmailinObj->sendEmail($sendMailData);
|
1522 |
+
}
|
1523 |
+
}
|
1524 |
+
else
|
1525 |
+
{
|
1526 |
+
$reConfirmEmail = array(
|
1527 |
+
"id" => intval($templateId),
|
1528 |
+
"to" => $to,
|
1529 |
+
"cc" => "",
|
1530 |
+
"bcc" => "",
|
1531 |
+
"attr" => "",
|
1532 |
+
//"headers" => array("Content-Type"=> "text/html;charset=iso-8859-1", "X-Mailin-tag"=>$transactional_tags )
|
1533 |
+
);
|
1534 |
+
return $psmailinObj->sendTransactionalTemplate($reConfirmEmail);
|
1535 |
+
}
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
/**
|
1539 |
+
* send double optin template and manage.
|
1540 |
+
*/
|
1541 |
+
public function defaultDoubleoptinTemp($subscriberEmail, $doubleoptinUrl)
|
1542 |
+
{
|
1543 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
1544 |
+
$emailTemplateVariables = array();
|
1545 |
+
|
1546 |
+
$emailTemplateVariables['text0'] = 'Please confirm your subscription';
|
1547 |
+
$senderName = 'SendinBlue';
|
1548 |
+
$senderEmail = 'contact@sendinblue.com';
|
1549 |
+
|
1550 |
+
if ($localeCode == 'fr_FR') {
|
1551 |
+
$emailTemplateVariables['text0'] = 'Confirmez votre inscription';
|
1552 |
+
$senderName = 'SendinBlue';
|
1553 |
+
$senderEmail = 'contact@sendinblue.com';
|
1554 |
+
}
|
1555 |
+
try {
|
1556 |
+
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('doubleoptin_template');
|
1557 |
+
$templateText = $emailTemplate->template_text;
|
1558 |
+
$webSite = Mage::app()->getWebsite()->getName();
|
1559 |
+
preg_match_all('#{(.*)}#', $templateText, $match);
|
1560 |
+
|
1561 |
+
$sendinFinalConfirmEmail = $this->getSendinFinalConfirmEmail();
|
1562 |
+
if($sendinFinalConfirmEmail == 'yes') {
|
1563 |
+
$getFinalTemplateId = $this->getFinalTemplate();
|
1564 |
+
if($getFinalTemplateId <= 0 || empty($getFinalTemplateId)) {
|
1565 |
+
$doubleoptinUrl = $this->getSendinDoubleoptinRedirectUrl();
|
1566 |
+
}
|
1567 |
+
}
|
1568 |
+
else {
|
1569 |
+
$doubleoptinUrl = $this->getSendinDoubleoptinRedirectUrl();
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
$templateData = array(
|
1573 |
+
'{double_optin}'=>$doubleoptinUrl,
|
1574 |
+
'{site_name}'=> $webSite
|
1575 |
+
);
|
1576 |
+
foreach($match[0] as $var=>$value){
|
1577 |
+
$templateText = preg_replace('#'.$value.'#',$templateData[$value],$templateText);
|
1578 |
+
}
|
1579 |
+
$emailTemplate->template_text = $templateText;
|
1580 |
+
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
|
1581 |
+
$emailTemplate->setSenderName($senderName);
|
1582 |
+
$emailTemplate->setSenderEmail($senderEmail);
|
1583 |
+
$emailTemplate->setTemplateSubject($emailTemplateVariables['text0']);
|
1584 |
+
return $emailTemplate->send($subscriberEmail, '', $emailTemplateVariables);
|
1585 |
+
}
|
1586 |
+
catch(Exception $e) {
|
1587 |
+
}
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
/**
|
1591 |
+
* Get all temlpate list id by sendinblue.
|
1592 |
+
*/
|
1593 |
+
public function templateDisplay()
|
1594 |
+
{
|
1595 |
+
$listData = array();
|
1596 |
+
$listData['show'] = 'ALL';
|
1597 |
+
$listData['messageType'] = 'template';
|
1598 |
+
$params['api_key'] = $this->apiKey;
|
1599 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1600 |
+
return $psmailinObj->getCampaignsV2($listData);
|
1601 |
+
}
|
1602 |
+
|
1603 |
+
/**
|
1604 |
+
* Get getCountryCode from sendinblue_country table,
|
1605 |
+
*/
|
1606 |
+
public function getCountryCode($countryids)
|
1607 |
+
{
|
1608 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
1609 |
+
$readDbObject = Mage::getSingleton("core/resource")->getConnection("core_read");
|
1610 |
+
|
1611 |
+
$queryCountryCode = $readDbObject->select()
|
1612 |
+
->from($tableCountry,array('country_prefix'))
|
1613 |
+
->where("iso_code = ?", $countryids);
|
1614 |
+
$stmtCountryCode = $readDbObject->query($queryCountryCode);
|
1615 |
+
$countryPrefixData = $stmtCountryCode->fetch();
|
1616 |
+
|
1617 |
+
$countryPrefix = $countryPrefixData['country_prefix'];
|
1618 |
+
return $countryPrefix;
|
1619 |
+
}
|
1620 |
+
|
1621 |
+
/**
|
1622 |
+
* Import transactional data,
|
1623 |
+
*/
|
1624 |
+
public function importTransactionalData($email, $attributesValues, $getUserList)
|
1625 |
+
{
|
1626 |
+
$userData = array();
|
1627 |
+
$userData['email'] = $email;
|
1628 |
+
$userData['attributes'] = $attributesValues;
|
1629 |
+
$userData['listid'] = (is_array($getUserList)) ? $getUserList : array($getUserList);
|
1630 |
+
$params['api_key'] = $this->apiKey;
|
1631 |
+
|
1632 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin', $params);
|
1633 |
+
return $psmailinObj->createUpdateUser($userData);
|
1634 |
+
}
|
1635 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/Model/Status.php
RENAMED
@@ -10,14 +10,14 @@
|
|
10 |
|
11 |
class Sendinblue_Sendinblue_Model_Status extends Varien_Object
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
}
|
10 |
|
11 |
class Sendinblue_Sendinblue_Model_Status extends Varien_Object
|
12 |
{
|
13 |
+
const STATUS_ENABLED = 1;
|
14 |
+
const STATUS_DISABLED = 2;
|
15 |
|
16 |
+
static public function getOptionArray()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
self::STATUS_ENABLED => Mage::helper('sendinblue')->__('Enabled'),
|
20 |
+
self::STATUS_DISABLED => Mage::helper('sendinblue')->__('Disabled')
|
21 |
+
);
|
22 |
+
}
|
23 |
}
|
app/code/community/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
ADDED
@@ -0,0 +1,528 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
+
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$params = Mage::app()->getRequest()->getParams();
|
16 |
+
if (isset($params['sendin_apikey']) && $params['sendin_apikey'] != ''){
|
17 |
+
$this->CreateFolderCaseTwo();
|
18 |
+
}
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function syncronizepostAction()
|
24 |
+
{
|
25 |
+
$requestParameter = $this->getRequest()->getPost();
|
26 |
+
try {
|
27 |
+
if (empty($requestParameter)){
|
28 |
+
Mage::throwException($this->__('Invalid form data.'));
|
29 |
+
}
|
30 |
+
$sendinSwitch = Mage::getModel('core/config');
|
31 |
+
|
32 |
+
if (isset($requestParameter['syncronizeSubmit'])) {
|
33 |
+
$sendinSwitch->saveConfig('sendinblue/syncronize', $requestParameter['syncronize']);
|
34 |
+
if (!empty($requestParameter['subscribe_confirm_type'])) {
|
35 |
+
$sendinSwitch->saveConfig('sendinblue/SendinSubscribeConfirmType', $requestParameter['subscribe_confirm_type']);
|
36 |
+
$sendinSwitch->saveConfig('sendinblue/SendinTemplateId', $requestParameter['template_simple']);
|
37 |
+
$sendinSwitch->saveConfig('sendinblue/SendinOptinRedirectUrlCheck', $requestParameter['optin_redirect_url_check']);
|
38 |
+
$sendinSwitch->saveConfig('sendinblue/SendinDoubleoptinRedirectUrl', $requestParameter['doubleoptin-redirect-url']);
|
39 |
+
$sendinSwitch->saveConfig('sendinblue/SendinDoubleoptinTemplateId', $requestParameter['doubleoptin_template_id']);
|
40 |
+
$sendinSwitch->saveConfig('sendinblue/SendinFinalConfirmEmail', $requestParameter['final_confirm_email']);
|
41 |
+
$sendinSwitch->saveConfig('sendinblue/SendinTemplateFinal', $requestParameter['template_final']);
|
42 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
43 |
+
if ($requestParameter['subscribe_confirm_type'] === 'doubleoptin') {
|
44 |
+
$responseDoubleOption = $sendinModule->checkFolderListDoubleoptin();
|
45 |
+
if (!empty($responseDoubleOption['optin_id'])) {
|
46 |
+
$sendinSwitch->saveConfig('sendinblue/SendinOptinListId', $responseDoubleOption['optin_id']);
|
47 |
+
}
|
48 |
+
if ($responseDoubleOption === false) {
|
49 |
+
$optinId = $sendinModule->createListIdDoubleoptin();
|
50 |
+
$sendinSwitch->saveConfig('sendinblue/SendinOptinListId', $optinId);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
$message = $this->__('Your setting has been successfully saved');
|
54 |
+
}
|
55 |
+
|
56 |
+
if (!empty($requestParameter['sendin_list'])) {
|
57 |
+
$list = implode('|', $requestParameter['sendin_list']);
|
58 |
+
$sendinSwitch->saveConfig('sendinblue/list', $list);
|
59 |
+
$message = $this->__('Your setting has been successfully saved');
|
60 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
61 |
+
}
|
62 |
+
else {
|
63 |
+
$message = $this->__('Please select a list');
|
64 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
catch (Exception $exception) {
|
69 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
70 |
+
}
|
71 |
+
$this->_redirect('*/*');
|
72 |
+
}
|
73 |
+
|
74 |
+
public function reimportpostAction()
|
75 |
+
{
|
76 |
+
$requestParameter = $this->getRequest()->getPost();
|
77 |
+
try {
|
78 |
+
if (empty($requestParameter)){
|
79 |
+
Mage::throwException($this->__('Invalid form data.'));
|
80 |
+
}
|
81 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
82 |
+
$sendinSwitch = Mage::getModel('core/config');
|
83 |
+
if (!empty($requestParameter['importoldSubmit'])) {
|
84 |
+
$list = $sendinModule->getUserlists();
|
85 |
+
$listId = str_replace('|', ',', $list);
|
86 |
+
$allemail = $sendinModule->getcustomers();
|
87 |
+
if ($allemail > 0) {
|
88 |
+
$userData = array();
|
89 |
+
$userData['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
90 |
+
$userData['listids'] = $listId;
|
91 |
+
$userData['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
92 |
+
$apiDetails['api_key'] = $sendinModule->getApiKey();
|
93 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin',$apiDetails);
|
94 |
+
$responseImportUser = $psmailinObj->importUsers($userData);
|
95 |
+
$sendinSwitch->saveConfig('sendinblue/importOldUserStatus', 0);
|
96 |
+
if (empty($responseImportUser['data']['process_id'])) {
|
97 |
+
$sendinSwitch->saveConfig('sendinblue/importOldUserStatus', 1);
|
98 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
99 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$message = $this->__('Your setting has been successfully saved');
|
103 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
catch (Exception $exception) {
|
109 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
110 |
+
}
|
111 |
+
$this->_redirect('*/*');
|
112 |
+
}
|
113 |
+
|
114 |
+
public function apikeypostAction()
|
115 |
+
{
|
116 |
+
$requestParameter = $this->getRequest()->getPost();
|
117 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
118 |
+
try {
|
119 |
+
if (empty($requestParameter)) {
|
120 |
+
Mage::throwException($this->__('Invalid form data.'));
|
121 |
+
}
|
122 |
+
else if (!empty($requestParameter['sendin_apikey'])) {
|
123 |
+
$sendinSwitch = Mage::getModel('core/config');
|
124 |
+
$apiKeyStatus = $sendinModule->checkApikey();
|
125 |
+
if (empty($apiKeyStatus['error'])) {
|
126 |
+
$getKey = $sendinModule->getApiKey();
|
127 |
+
if ($getKey == '') {
|
128 |
+
$sendinModule->createFolderName($requestParameter['sendin_apikey']);
|
129 |
+
}
|
130 |
+
elseif ($getKey != $requestParameter['sendin_apikey']) {
|
131 |
+
$sendinModule->createFolderName($requestParameter['sendin_apikey']);
|
132 |
+
}
|
133 |
+
|
134 |
+
$sendinSwitch->saveConfig('sendinblue/api', trim($requestParameter['sendin_apikey']));
|
135 |
+
$sendinSwitch->saveConfig('sendinblue/enabled', $requestParameter['sendin_api_status']);
|
136 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
137 |
+
$sendinSwitch->saveConfig('sendinblue/syncronize', 1);
|
138 |
+
$sendinModule->removeOldEntry();
|
139 |
+
if($sendinModule->getImportOldSubsStatus() == 1) {
|
140 |
+
$message = $this->__('Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again');
|
141 |
+
Mage::getModel('core/session')->addError($message);
|
142 |
+
}
|
143 |
+
else {
|
144 |
+
$message = $this->__('Your setting has been successfully saved');
|
145 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
146 |
+
}
|
147 |
+
|
148 |
+
}
|
149 |
+
else if (isset($apiKeyStatus['error'])) {
|
150 |
+
$message = $this->__('You have entered wrong api key');
|
151 |
+
Mage::getModel('core/session')->addError($message);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
catch (Exception $exception) {
|
156 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
157 |
+
}
|
158 |
+
$this->_redirect('*/*');
|
159 |
+
}
|
160 |
+
|
161 |
+
public function sendmailAction()
|
162 |
+
{
|
163 |
+
$requestParameter = $this->getRequest()->getPost();
|
164 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
165 |
+
try {
|
166 |
+
if (empty($requestParameter)) {
|
167 |
+
Mage::throwException($this->__('Invalid form data.'));
|
168 |
+
}
|
169 |
+
else if (!empty($requestParameter['SmtpSubmit'])) {
|
170 |
+
$sendinSwitch = Mage::getModel('core/config');
|
171 |
+
$getKey = $sendinModule->getApiKey();
|
172 |
+
$apiKeyStatus = $sendinModule->checkApikey($getKey);
|
173 |
+
if (empty($apiKeyStatus['error'])) {
|
174 |
+
$smtpResponse = $sendinModule->trackingSmtp(); // get tracking code
|
175 |
+
if (isset($smtpResponse['data']['relay_data']['status']) && $smtpResponse['data']['relay_data']['status'] == 'enabled') {
|
176 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
177 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/username', $smtpResponse['data']['relay_data']['data']['username'], 'default', 0);
|
178 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/password', $smtpResponse['data']['relay_data']['data']['password'], 'default', 0);
|
179 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/host', $smtpResponse['data']['relay_data']['data']['relay'], 'default', 0);
|
180 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/port', $smtpResponse['data']['relay_data']['data']['port'], 'default', 0);
|
181 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
182 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
183 |
+
if ($requestParameter['email']) {
|
184 |
+
$responceSendTestMail = $sendinModule->sendTestMail($requestParameter['email']);
|
185 |
+
$responceSendTestData = json_decode($responceSendTestMail, true);
|
186 |
+
|
187 |
+
if ($responceSendTestData['result'] != true) {
|
188 |
+
$message = $this->__('Mail not sent').' '.$this->__(trim($responceSendTestData['error']));
|
189 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
190 |
+
}
|
191 |
+
else {
|
192 |
+
$message = $this->__('Mail sent!');
|
193 |
+
Mage::getModel('core/session')->addSuccess($message);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
else {
|
197 |
+
$message = $this->__('Mail not sent');
|
198 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
199 |
+
}
|
200 |
+
}
|
201 |
+
else {
|
202 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/status', 0);
|
203 |
+
$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');
|
204 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
elseif (isset($apiKeyStatus['error'])) {
|
208 |
+
$message = $this->__('You have entered wrong api key');
|
209 |
+
Mage::getModel('core/session')->addError($message);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
catch (Exception $exception) {
|
214 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
215 |
+
}
|
216 |
+
$this->_redirect('*/*');
|
217 |
+
}
|
218 |
+
|
219 |
+
public function sendorderAction()
|
220 |
+
{
|
221 |
+
$requestParameter = $this->getRequest()->getPost();
|
222 |
+
try {
|
223 |
+
if (empty($requestParameter)){
|
224 |
+
Mage::throwException($this->__('Invalid form data.'));
|
225 |
+
}
|
226 |
+
$sendinSwitch = Mage::getModel('core/config');
|
227 |
+
if (isset($requestParameter['sender_order_save'])) {
|
228 |
+
$senderOrder = isset($requestParameter['sender_order']) ? $requestParameter['sender_order'] : NULL;
|
229 |
+
$senderOrderMessage = $requestParameter['sender_order_message'];
|
230 |
+
|
231 |
+
if ($senderOrder == '') {
|
232 |
+
$message = $this->__('Please fill the message field');
|
233 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
234 |
+
}
|
235 |
+
else if ($senderOrderMessage == '') {
|
236 |
+
$message = $this->__('Please fill the message field');
|
237 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
238 |
+
}
|
239 |
+
else {
|
240 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Sender_Order', $senderOrder);
|
241 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Sender_Order_Message', $senderOrderMessage);
|
242 |
+
$message = $this->__('Your setting has been successfully saved');
|
243 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
catch (Exception $exception) {
|
248 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
249 |
+
}
|
250 |
+
$this->_redirect('*/*');
|
251 |
+
}
|
252 |
+
|
253 |
+
public function sendshipmentAction()
|
254 |
+
{
|
255 |
+
$requestParameter = $this->getRequest()->getPost();
|
256 |
+
try {
|
257 |
+
if (empty($requestParameter)) {
|
258 |
+
Mage::throwException($this->__('Invalid form data.'));
|
259 |
+
}
|
260 |
+
$sendinSwitch = Mage::getModel('core/config');
|
261 |
+
if (isset($requestParameter['sender_shipment_save'])) {
|
262 |
+
$senderShipment = isset($requestParameter['sender_shipment']) ? $requestParameter['sender_shipment'] : NULL;
|
263 |
+
$senderShipmentMessage = $requestParameter['sender_shipment_message'];
|
264 |
+
|
265 |
+
if ($senderShipment == '') {
|
266 |
+
$message = $this->__('Please fill the sender field');
|
267 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
268 |
+
}
|
269 |
+
else if ($senderShipmentMessage == '') {
|
270 |
+
$message = $this->__('Please fill the message field');
|
271 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
272 |
+
}
|
273 |
+
else {
|
274 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Sender_Shipment', $senderShipment);
|
275 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Sender_Shipment_Message', $senderShipmentMessage);
|
276 |
+
$message = $this->__('Your setting has been successfully saved');
|
277 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
278 |
+
}
|
279 |
+
}
|
280 |
+
}
|
281 |
+
catch (Exception $exception) {
|
282 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
283 |
+
}
|
284 |
+
$this->_redirect('*/*');
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* This method is called when the user test Shipment Sms and hits the submit button.
|
289 |
+
*/
|
290 |
+
|
291 |
+
public function sendordertestAction()
|
292 |
+
{
|
293 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
294 |
+
$requestParameter = $this->getRequest()->getPost();
|
295 |
+
try {
|
296 |
+
if (empty($requestParameter)) {
|
297 |
+
Mage::throwException($this->__('Invalid form data.'));
|
298 |
+
}
|
299 |
+
$sendinSwitch = Mage::getModel('core/config');
|
300 |
+
|
301 |
+
if (isset($requestParameter['sender_order_submit'])) {
|
302 |
+
$smsData = array();
|
303 |
+
$smsData['to'] = $requestParameter['sender_order_number'];
|
304 |
+
$smsData['from'] = $sendinModule->getSendSmsOrderSubject();
|
305 |
+
$smsData['text'] = $sendinModule->getSendSmsmOrderMessage();
|
306 |
+
|
307 |
+
$sendSmsResponce = $sendinModule->sendSmsApi($smsData);
|
308 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
309 |
+
$message = $this->__('Message has been sent successfully');
|
310 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
311 |
+
}
|
312 |
+
else {
|
313 |
+
$message = $this->__('Message has not been sent successfully');
|
314 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
catch (Exception $exception) {
|
319 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
320 |
+
}
|
321 |
+
$this->_redirect('*/*');
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* This method is called when the user test Shipment Sms and hits the submit button.
|
326 |
+
*/
|
327 |
+
|
328 |
+
public function sendshipmenttestAction()
|
329 |
+
{
|
330 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
331 |
+
$requestParameter = $this->getRequest()->getPost();
|
332 |
+
try {
|
333 |
+
if (empty($requestParameter)) {
|
334 |
+
Mage::throwException($this->__('Invalid form data.'));
|
335 |
+
}
|
336 |
+
$sendinSwitch = Mage::getModel('core/config');
|
337 |
+
|
338 |
+
if (isset($requestParameter['sender_shipment_submit'])) {
|
339 |
+
$smsData = array();
|
340 |
+
$smsData['to'] = $requestParameter['sender_shipment_number'];
|
341 |
+
$smsData['from'] = $sendinModule->getSendSmsShipingSubject();
|
342 |
+
$smsData['text'] = $sendinModule->getSendSmsShipingMessage();
|
343 |
+
|
344 |
+
$sendSmsResponce = $sendinModule->sendSmsApi($smsData);
|
345 |
+
|
346 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
347 |
+
$message = $this->__('Message has been sent successfully');
|
348 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
349 |
+
}
|
350 |
+
else {
|
351 |
+
$message = $this->__('Message has not been sent successfully');
|
352 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
catch (Exception $exception) {
|
357 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
358 |
+
}
|
359 |
+
$this->_redirect('*/*');
|
360 |
+
}
|
361 |
+
|
362 |
+
public function sendnotifysmsAction()
|
363 |
+
{
|
364 |
+
$requestParameter = $this->getRequest()->getPost();
|
365 |
+
try {
|
366 |
+
if (empty($requestParameter)) {
|
367 |
+
Mage::throwException($this->__('Invalid form data.'));
|
368 |
+
}
|
369 |
+
$sendinSwitch = Mage::getModel('core/config');
|
370 |
+
|
371 |
+
if (isset($requestParameter['notify_sms_mail'])) {
|
372 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Value', $requestParameter['sendin_notify_value']);
|
373 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Email', $requestParameter['sendin_notify_email']);
|
374 |
+
$sendinSwitch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
375 |
+
$message = $this->__('Your setting has been successfully saved');
|
376 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
377 |
+
}
|
378 |
+
}
|
379 |
+
catch (Exception $exception) {
|
380 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
381 |
+
}
|
382 |
+
$this->_redirect('*/*');
|
383 |
+
}
|
384 |
+
|
385 |
+
public function sendcampaignAction()
|
386 |
+
{
|
387 |
+
$requestParameter = $this->getRequest()->getPost();
|
388 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
389 |
+
$apiDetails['api_key'] = $sendinModule->getApiKey();
|
390 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin',$apiDetails);
|
391 |
+
|
392 |
+
try {
|
393 |
+
if (empty($requestParameter)) {
|
394 |
+
Mage::throwException($this->__('Invalid form data.'));
|
395 |
+
}
|
396 |
+
$sendinSwitch = Mage::getModel('core/config');
|
397 |
+
|
398 |
+
if (isset($requestParameter['sender_campaign_save']) && $requestParameter['Sendin_Sms_Choice'] == 1) {
|
399 |
+
$smsData = array();
|
400 |
+
$smsData['to'] = $requestParameter['singlechoice'];
|
401 |
+
$smsData['from'] = $requestParameter['sender_campaign'];
|
402 |
+
$smsData['text'] = $requestParameter['sender_campaign_message'];
|
403 |
+
|
404 |
+
$sendSmsResponce = $sendinModule->sendSmsApi($smsData);
|
405 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
406 |
+
$message = $this->__('Message has been sent successfully');
|
407 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
408 |
+
}
|
409 |
+
else {
|
410 |
+
$message = $this->__('Message has not been sent successfully');
|
411 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
412 |
+
}
|
413 |
+
}
|
414 |
+
else if(isset($requestParameter['sender_campaign_save']) && $requestParameter['Sendin_Sms_Choice'] == 0) {
|
415 |
+
$smsCredit = $sendinModule->getSmsCredit();
|
416 |
+
$collection = Mage::getModel('customer/customer')
|
417 |
+
->getCollection()
|
418 |
+
->addAttributeToSelect('*')
|
419 |
+
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
420 |
+
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left');
|
421 |
+
|
422 |
+
$results = array();
|
423 |
+
foreach ($collection as $customer) {
|
424 |
+
$results[] = $customer->toArray();
|
425 |
+
}
|
426 |
+
|
427 |
+
foreach ($results as $i => $result) {
|
428 |
+
if(!empty($result['shipping_telephone']) && !empty($result['shipping_country_code'])) {
|
429 |
+
$countryCode = $sendinModule->getCountryCode($result['shipping_country_code']);
|
430 |
+
$number = $sendinModule->checkMobileNumber($result['shipping_telephone'],$countryCode);
|
431 |
+
$firstname = !empty($result['firstname']) ? $result['firstname'] : '';
|
432 |
+
$lastname = !empty($result['lastname']) ? $result['lastname'] : '';
|
433 |
+
$messageBody = !empty($requestParameter['sender_campaign_message'])?$requestParameter['sender_campaign_message']:'';
|
434 |
+
$fname = str_replace('{first_name}', $firstname, $messageBody);
|
435 |
+
$messageBody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
436 |
+
$smsData = array();
|
437 |
+
$smsData['to'] = $number;
|
438 |
+
$smsData['from'] = !empty($requestParameter['sender_campaign'])?$requestParameter['sender_campaign']:'';
|
439 |
+
$smsData['text'] = $messageBody;
|
440 |
+
$sendinModule->sendSmsApi($smsData);
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
if ($smsCredit >= 1) {
|
445 |
+
$message = $this->__('Message has been sent successfully');
|
446 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
447 |
+
}
|
448 |
+
else {
|
449 |
+
$message = $this->__('Message has not been sent successfully');
|
450 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
451 |
+
}
|
452 |
+
}
|
453 |
+
else if(isset($requestParameter['sender_campaign_save']) && $requestParameter['Sendin_Sms_Choice'] == 2) {
|
454 |
+
$smsCredit = $sendinModule->getSmsCredit();
|
455 |
+
$scheduleMonth = $requestParameter['sib_datetimepicker'];
|
456 |
+
$scheduleHour = $requestParameter['hour'];
|
457 |
+
$scheduleMinute = $requestParameter['minute'];
|
458 |
+
if ($scheduleHour < 10) {
|
459 |
+
$scheduleHour = '0'.$scheduleHour;
|
460 |
+
}
|
461 |
+
if ($scheduleMinute < 10) {
|
462 |
+
$scheduleMinute = '0'.$scheduleMinute;
|
463 |
+
}
|
464 |
+
$scheduleTime = $scheduleMonth.' '.$scheduleHour.':'.$scheduleMinute.':00';
|
465 |
+
$currentTime = date('Y-m-d H:i:s', time() + 300);
|
466 |
+
$currentTimeExact = strtotime($currentTime);
|
467 |
+
$scheduleTimeExact = strtotime($scheduleTime);
|
468 |
+
|
469 |
+
if ($scheduleTime != '' || $scheduleTimeExact >= $currentTimeExact)
|
470 |
+
{
|
471 |
+
$campaignName = 'SMS_'.date('Ymd');
|
472 |
+
$key = $sendinModule->getApiKey();
|
473 |
+
if ($key == '') {
|
474 |
+
return false;
|
475 |
+
}
|
476 |
+
$ListId = Mage::getStoreConfig('sendinblue/list');
|
477 |
+
$isoCode = $this->context->language->iso_code;
|
478 |
+
$allemail = $sendinModule->smsCampaignList();
|
479 |
+
|
480 |
+
$userData['attributes'] = $allemail;
|
481 |
+
$userData['listid'] = $ListId;
|
482 |
+
$psmailinObj->addMultipleUser($userData);
|
483 |
+
|
484 |
+
$messageBody = $requestParameter['sender_campaign_message'];
|
485 |
+
$langaugeValue = $sendinModule->getApiConfigValue();
|
486 |
+
if (isset($langaugeValue['data']['language']) && $langaugeValue['data']['language'] == 'fr') {
|
487 |
+
$firstname = '{NOM}';
|
488 |
+
$lastname = '{PRENOM}';
|
489 |
+
}
|
490 |
+
else {
|
491 |
+
$firstname = '{NAME}';
|
492 |
+
$lastname = '{SURNAME}';
|
493 |
+
}
|
494 |
+
|
495 |
+
$fname = str_replace('{first_name}', $firstname, $messageBody);
|
496 |
+
$messageBody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
497 |
+
$smsCampaignData = array();
|
498 |
+
$smsCampaignData['name'] = $campaignName; // mandatory
|
499 |
+
$smsCampaignData['sender'] = $requestParameter['sender_campaign'];
|
500 |
+
$smsCampaignData['content'] = $messageBody;
|
501 |
+
$smsCampaignData['bat_sent'] = '';
|
502 |
+
$smsCampaignData['listid'] = array($ListId); // mandatory if SMS campaign is scheduled
|
503 |
+
$smsCampaignData['exclude_list'] = '';
|
504 |
+
$smsCampaignData['scheduled_date'] = $scheduleTime;
|
505 |
+
$campaignDataRespose = $psmailinObj->createSmsCampaign($smsCampaignData);
|
506 |
+
|
507 |
+
if ($smsCredit >= 1) {
|
508 |
+
$message = $this->__('Message has been sent successfully');
|
509 |
+
Mage::getModel('adminhtml/session')->addSuccess($message);
|
510 |
+
}
|
511 |
+
else {
|
512 |
+
$message = $this->__('Message has not been sent successfully');
|
513 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
514 |
+
}
|
515 |
+
}
|
516 |
+
else {
|
517 |
+
$message = $this->__('Scheduled date may not be prior to the current date');
|
518 |
+
Mage::getModel('adminhtml/session')->addError($message);
|
519 |
+
}
|
520 |
+
}
|
521 |
+
}
|
522 |
+
catch (Exception $exception)
|
523 |
+
{
|
524 |
+
Mage::getModel('adminhtml/session')->addError($exception->getMessage());
|
525 |
+
}
|
526 |
+
$this->_redirect('*/*');
|
527 |
+
}
|
528 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/NotifyController.php
RENAMED
@@ -10,12 +10,11 @@
|
|
10 |
|
11 |
class Sendinblue_Sendinblue_Adminhtml_NotifyController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
21 |
}
|
10 |
|
11 |
class Sendinblue_Sendinblue_Adminhtml_NotifyController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->notifySmsEmail();
|
16 |
+
$messageDisplay = $this->__('The CRON has been well executed.');
|
17 |
+
Mage::getModel('adminhtml/session')->addSuccess($messageDisplay);
|
18 |
+
$this->_redirect("sendinblue/adminhtml_myform/");
|
19 |
+
}
|
|
|
20 |
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/Adminhtml/SyncController.php
RENAMED
@@ -10,12 +10,11 @@
|
|
10 |
|
11 |
class Sendinblue_Sendinblue_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
21 |
}
|
10 |
|
11 |
class Sendinblue_Sendinblue_Adminhtml_SyncController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
16 |
+
$messageDisplay = $this->__('The CRON has been well executed.');
|
17 |
+
Mage::getModel('adminhtml/session')->addSuccess($messageDisplay);
|
18 |
+
$this->_redirect("sendinblue/adminhtml_myform/");
|
19 |
+
}
|
|
|
20 |
}
|
app/code/community/Sendinblue/Sendinblue/controllers/AjaxController.php
ADDED
@@ -0,0 +1,807 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
24 |
+
public function campaignAction()
|
25 |
+
{
|
26 |
+
$postData = $this->getRequest()->getPost();
|
27 |
+
try {
|
28 |
+
if (empty($postData)) {
|
29 |
+
echo Mage::throwException($this->__('Invalid form data.'));
|
30 |
+
}
|
31 |
+
$sendinSwitch = Mage::getModel('core/config');
|
32 |
+
$sendinSwitch->saveConfig('sendinblue/sms/campaign', $postData['campaignSetting']);
|
33 |
+
echo $this->__('Your setting has been successfully saved');
|
34 |
+
}
|
35 |
+
catch (Exception $exception) {
|
36 |
+
echo $this->__($exception->getMessage());
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function orderAction()
|
41 |
+
{
|
42 |
+
$postData = $this->getRequest()->getPost();
|
43 |
+
try {
|
44 |
+
if (empty($postData)) {
|
45 |
+
Mage::throwException($this->__('Invalid form data.'));
|
46 |
+
}
|
47 |
+
$sendinSwitch = Mage::getModel('core/config');
|
48 |
+
$sendinSwitch->saveConfig('sendinblue/sms/order', $postData['orderSetting']);
|
49 |
+
echo $this->__('Your setting has been successfully saved');
|
50 |
+
}
|
51 |
+
catch (Exception $exception) {
|
52 |
+
echo $this->__($exception->getMessage());
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
public function creditAction()
|
57 |
+
{
|
58 |
+
$postData = $this->getRequest()->getPost();
|
59 |
+
try {
|
60 |
+
if (empty($postData)) {
|
61 |
+
Mage::throwException($this->__('Invalid form data.'));
|
62 |
+
}
|
63 |
+
$sendinSwitch = Mage::getModel('core/config');
|
64 |
+
$sendinSwitch->saveConfig('sendinblue/sms/credit', $postData['sms_credit']);
|
65 |
+
echo $this->__('Your setting has been successfully saved');
|
66 |
+
}
|
67 |
+
catch (Exception $exception) {
|
68 |
+
echo $this->__($exception->getMessage());
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
public function shipingAction()
|
73 |
+
{
|
74 |
+
$postData = $this->getRequest()->getPost();
|
75 |
+
try {
|
76 |
+
if (empty($postData)) {
|
77 |
+
Mage::throwException($this->__('Invalid form data.'));
|
78 |
+
}
|
79 |
+
$sendinSwitch = Mage::getModel('core/config');
|
80 |
+
$sendinSwitch->saveConfig('sendinblue/sms/shiping', $postData['shipingSetting']);
|
81 |
+
echo $this->__('Your setting has been successfully saved');
|
82 |
+
}
|
83 |
+
catch (Exception $exception) {
|
84 |
+
echo $this->__($exception->getMessage());
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
public function codepostAction()
|
89 |
+
{
|
90 |
+
$postData = $this->getRequest()->getPost();
|
91 |
+
try {
|
92 |
+
if (empty($postData)) {
|
93 |
+
Mage::throwException($this->__('Invalid form data.'));
|
94 |
+
}
|
95 |
+
$sendinSwitch = Mage::getModel('core/config');
|
96 |
+
$sendinSwitch->saveConfig('sendinblue/tracking/code', $postData['script']);
|
97 |
+
$sendinSwitch->saveConfig('sendinblue/improt/history', $postData['script']);
|
98 |
+
echo $this->__('Your setting has been successfully saved');
|
99 |
+
}
|
100 |
+
catch (Exception $exception) {
|
101 |
+
echo $this->__($exception->getMessage());
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
public function emptySubsUserToSendinblueAction()
|
106 |
+
{
|
107 |
+
$postData = $this->getRequest()->getPost();
|
108 |
+
try {
|
109 |
+
if (empty($postData)) {
|
110 |
+
Mage::throwException($this->__('Invalid form data.'));
|
111 |
+
}
|
112 |
+
if ($postData['proc_success'] != '') {
|
113 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
114 |
+
$keyValue = array();
|
115 |
+
$keyValue[] = '';
|
116 |
+
fputcsv($handle, $keyValue);
|
117 |
+
fclose($handle);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
catch (Exception $exception) {
|
121 |
+
echo $this->__($exception->getMessage());
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
public function mailResponceAction()
|
126 |
+
{
|
127 |
+
$postData = $this->getRequest()->getParams();
|
128 |
+
try {
|
129 |
+
if (empty($postData)) {
|
130 |
+
Mage::throwException($this->__('Invalid form data.'));
|
131 |
+
}
|
132 |
+
$userEmail = base64_decode($postData['value']);
|
133 |
+
if ($userEmail != '') {
|
134 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_email', array('eq' => $userEmail))->load();;
|
135 |
+
foreach ($newsletter->getItems() as $subscriber) {
|
136 |
+
$subScriberData = $subscriber->getData();
|
137 |
+
$subScriberEmail = $subScriberData['subscriber_email'];
|
138 |
+
$subScriberStatus = $subScriberData['subscriber_status'];
|
139 |
+
}
|
140 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
141 |
+
if (!empty($subScriberEmail) && $subScriberStatus == 1) {
|
142 |
+
$listId = $sendinModule->getUserlists();
|
143 |
+
$doubleOptinId = Mage::getStoreConfig('sendinblue/SendinOptinListId');
|
144 |
+
$apiDetails['api_key'] = $sendinModule->getApiKey();
|
145 |
+
$objPsmailin = Mage::getModel('sendinblue/psmailin',$apiDetails);
|
146 |
+
|
147 |
+
$userData = array( "email" => $subScriberEmail,
|
148 |
+
"attributes" => array(),
|
149 |
+
"blacklisted" => 0,
|
150 |
+
"listid" => (is_array($listId)) ? $listId : array($listId),
|
151 |
+
"listid_unlink" => array($doubleOptinId),
|
152 |
+
"blacklisted_sms" => 0
|
153 |
+
);
|
154 |
+
|
155 |
+
$responce = $objPsmailin->createUpdateUser($userData);
|
156 |
+
$finalStatus = Mage::getStoreConfig('sendinblue/SendinFinalConfirmEmail');
|
157 |
+
if ($finalStatus === 'yes') {
|
158 |
+
$finalTemplateId = Mage::getStoreConfig('sendinblue/SendinTemplateFinal');
|
159 |
+
$sendinModule->sendWsTemplateMail($subScriberEmail, $finalTemplateId);
|
160 |
+
}
|
161 |
+
$urlStatus = $sendinModule->getOptinRedirectUrlCheck();
|
162 |
+
|
163 |
+
if ($urlStatus == 'yes') {
|
164 |
+
$urlValue = $sendinModule->getSendinDoubleoptinRedirectUrl();
|
165 |
+
$this->_redirectUrl($urlValue);
|
166 |
+
} else {
|
167 |
+
$configValue = Mage::getStoreConfig('web/secure/base_url');
|
168 |
+
$this->_redirectUrl($configValue);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
catch (Exception $exception) {
|
174 |
+
echo $this->__($exception->getMessage());
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
public function emptyImportOldOrderAction()
|
179 |
+
{
|
180 |
+
$postData = $this->getRequest()->getPost();
|
181 |
+
try {
|
182 |
+
if (empty($postData)) {
|
183 |
+
Mage::throwException($this->__('Invalid form data.'));
|
184 |
+
}
|
185 |
+
|
186 |
+
if ($postData['proc_success'] != '') {
|
187 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
188 |
+
$keyValue = array();
|
189 |
+
$keyValue[] = '';
|
190 |
+
fputcsv($handle, $keyValue);
|
191 |
+
fclose($handle);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
catch (Exception $exception) {
|
195 |
+
echo $this->__($exception->getMessage());
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
public function orderhistoryAction()
|
200 |
+
{
|
201 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
202 |
+
$apiDetails['api_key'] = $sendinModule->getApiKey();
|
203 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin',$apiDetails);
|
204 |
+
|
205 |
+
$postData = $this->getRequest()->getPost();
|
206 |
+
try {
|
207 |
+
if (empty($postData)) {
|
208 |
+
Mage::throwException($this->__('Invalid form data.'));
|
209 |
+
}
|
210 |
+
|
211 |
+
if ($postData['history_status'] == 1) {
|
212 |
+
$value = $sendinModule->trackingSmtp();
|
213 |
+
$dateValue = $sendinModule->getApiConfigValue();
|
214 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv')) {
|
215 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
216 |
+
}
|
217 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
218 |
+
fwrite($handle, 'EMAIL,ORDER_ID,ORDER_PRICE,ORDER_DATE'.PHP_EOL);
|
219 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
220 |
+
|
221 |
+
$salesOrderColection = Mage::getModel('sales/order');
|
222 |
+
foreach ($collection as $customer) {
|
223 |
+
|
224 |
+
$customerId = $customer->getData('entity_id');
|
225 |
+
$email = $customer->getData('email');
|
226 |
+
$totalOrders = $salesOrderColection->getCollection()->addFieldToFilter('customer_id', $customerId);
|
227 |
+
$orderCount = $totalOrders->count();
|
228 |
+
if ($orderCount > 0) {
|
229 |
+
$userData = array();
|
230 |
+
$userData['users'] = array($email);
|
231 |
+
$userStatus = $psmailinObj->getUsersBlacklistStatus($userData);
|
232 |
+
}
|
233 |
+
|
234 |
+
if (isset($userStatus['code']) && $userStatus['code'] == 'success') {
|
235 |
+
foreach($totalOrders as $orderData) {
|
236 |
+
if (isset($dateValue['data']['date_format']) && $dateValue['data']['date_format'] == 'dd-mm-yyyy') {
|
237 |
+
$orderDate = date('d-m-Y', strtotime($orderData['created_at']));
|
238 |
+
}
|
239 |
+
else {
|
240 |
+
$orderDate = date('m-d-Y', strtotime($orderData['created_at']));
|
241 |
+
}
|
242 |
+
$historyData= array();
|
243 |
+
$historyData[] = array($orderData['customer_email'], $orderData['increment_id'], $orderData['grand_total'], $orderDate);
|
244 |
+
foreach ($historyData as $line) {
|
245 |
+
fputcsv($handle, $line);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
fclose($handle);
|
252 |
+
$getUserLists = $sendinModule->getUserlists();
|
253 |
+
$list = str_replace('|', ',', $getUserLists);
|
254 |
+
$list = (preg_match('/^[0-9,]+$/', $list)) ? $list : '';
|
255 |
+
$importData = array();
|
256 |
+
$importData['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportOldOrdersToSendinblue.csv';
|
257 |
+
$importData['listids'] = array($list);
|
258 |
+
$importData['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptyImportOldOrder';
|
259 |
+
/**
|
260 |
+
* List id should be optional
|
261 |
+
*/
|
262 |
+
|
263 |
+
$psmailinObj->importUsers($importData);
|
264 |
+
$sendinSwitch = Mage::getModel('core/config');
|
265 |
+
$sendinSwitch->saveConfig('sendinblue/improt/history', 0);
|
266 |
+
if($postData['langvalue'] == 'fr_FR') {
|
267 |
+
$msg = 'Historique des commandes a été importé avec succès.';
|
268 |
+
}
|
269 |
+
else {
|
270 |
+
$msg = 'Order history has been import successfully';
|
271 |
+
}
|
272 |
+
echo $msg;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
catch (Exception $exception) {
|
276 |
+
echo $this->__($exception->getMessage());
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
public function smtppostAction()
|
281 |
+
{
|
282 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
283 |
+
$postData = $this->getRequest()->getPost();
|
284 |
+
try {
|
285 |
+
if (empty($postData)) {
|
286 |
+
Mage::throwException($this->__('Invalid form data.'));
|
287 |
+
}
|
288 |
+
else {
|
289 |
+
$sendinSwitch = Mage::getModel('core/config');
|
290 |
+
$getKey = $sendinModule->getApiKey();
|
291 |
+
$apiKeyStatus = $sendinModule->checkApikey($getKey);
|
292 |
+
if (empty($apiKeyStatus['error'])) {
|
293 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/status', $postData['smtptest']);
|
294 |
+
$smtpResponse = $sendinModule->trackingSmtp(); // get tracking code
|
295 |
+
if (isset($smtpResponse['data']['relay_data']['status']) && $smtpResponse['data']['relay_data']['status'] == 'enabled') {
|
296 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
297 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/username', $smtpResponse['data']['relay_data']['data']['username'], 'default', 0);
|
298 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/password', $smtpResponse['data']['relay_data']['data']['password'], 'default', 0);
|
299 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/host', $smtpResponse['data']['relay_data']['data']['relay'], 'default', 0);
|
300 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/port', $smtpResponse['data']['relay_data']['data']['port'], 'default', 0);
|
301 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
302 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
303 |
+
echo $this->__('Your setting has been successfully saved');
|
304 |
+
}
|
305 |
+
else {
|
306 |
+
$sendinSwitch->saveConfig('sendinblue/smtp/status', 0);
|
307 |
+
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');
|
308 |
+
}
|
309 |
+
}
|
310 |
+
else if(isset($responce['error'])) {
|
311 |
+
echo $this->__('You have entered wrong api key');
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
catch (Exception $exception) {
|
316 |
+
echo $this->__($exception->getMessage());
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
public function ajaxcontentAction()
|
321 |
+
{
|
322 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
323 |
+
$postData = $this->getRequest()->getPost();
|
324 |
+
|
325 |
+
try {
|
326 |
+
if (empty($postData)) {
|
327 |
+
Mage::throwException($this->__('Invalid form data.'));
|
328 |
+
}
|
329 |
+
else {
|
330 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
331 |
+
if ($localeCode == 'fr_FR') {
|
332 |
+
$title1 = 'Inscrire le contact';
|
333 |
+
$title2 = 'Désinscrire le contact';
|
334 |
+
$title3 = 'Inscrire le sms';
|
335 |
+
$title4 = 'Désinscrire le sms';
|
336 |
+
$first = 'Première page';
|
337 |
+
$last = 'Dernière page';
|
338 |
+
$previous = 'Précédente';
|
339 |
+
$next = 'Suivante';
|
340 |
+
$yes = 'oui';
|
341 |
+
$no = 'non';
|
342 |
+
}
|
343 |
+
else {
|
344 |
+
$title1 = 'Unsubscribe the contact';
|
345 |
+
$title2 = 'Subscribe the contact';
|
346 |
+
$title3 = 'Unsubscribe the sms';
|
347 |
+
$title4 = 'Subscribe the sms';
|
348 |
+
$first = 'First';
|
349 |
+
$last = 'Last';
|
350 |
+
$previous = 'Previous';
|
351 |
+
$next = 'Next';
|
352 |
+
$yes = 'yes';
|
353 |
+
$no = 'no';
|
354 |
+
}
|
355 |
+
|
356 |
+
$page = (int)$postData['page'];
|
357 |
+
$currentPage = $page;
|
358 |
+
$page -= 1;
|
359 |
+
$perPage = 20;
|
360 |
+
$previousButton = true;
|
361 |
+
$nextButton = true;
|
362 |
+
$firstButton = true;
|
363 |
+
$lastButton = true;
|
364 |
+
$start = $page * $perPage;
|
365 |
+
$count = $sendinModule->getNewsletterSubscribeCount() + $sendinModule->getNewsletterUnSubscribeCount();
|
366 |
+
$noOfPaginations = ceil($count / $perPage);
|
367 |
+
if ($currentPage >= 7) {
|
368 |
+
$startLoop = $currentPage - 3;
|
369 |
+
if ($noOfPaginations > $currentPage + 3) {
|
370 |
+
$endLoop = $currentPage + 3;
|
371 |
+
}
|
372 |
+
else if ($currentPage <= $noOfPaginations && $currentPage > $noOfPaginations - 6) {
|
373 |
+
$startLoop = $noOfPaginations - 6;
|
374 |
+
$endLoop = $noOfPaginations;
|
375 |
+
}
|
376 |
+
else {
|
377 |
+
$endLoop = $noOfPaginations;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
else {
|
381 |
+
$startLoop = 1;
|
382 |
+
if ($noOfPaginations > 7) {
|
383 |
+
$endLoop = 7;
|
384 |
+
}
|
385 |
+
else {
|
386 |
+
$endLoop = $noOfPaginations;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
$collection = $sendinModule->getNewsletterSubscribe($start, $perPage);
|
391 |
+
$sendinUserStatus = $sendinModule->checkUserSendinStatus($collection);
|
392 |
+
|
393 |
+
$sendinUserResult = isset($sendinUserStatus['data']) ? $sendinUserStatus['data'] : '';
|
394 |
+
if (count($collection) > 0) {
|
395 |
+
$i = 1;
|
396 |
+
$message = '';
|
397 |
+
$skinUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
|
398 |
+
foreach ($collection as $subscriber) {
|
399 |
+
$email = isset($subscriber['email']) ? $subscriber['email'] : '';
|
400 |
+
$phone = isset($subscriber['SMS']) ? $subscriber['SMS'] : '';
|
401 |
+
|
402 |
+
$client = (!empty($subscriber['customer_id']) > 0) ? $yes : $no ;
|
403 |
+
$showStatus = '';
|
404 |
+
$smsStatus = '';
|
405 |
+
if(isset($sendinUserResult[$email])) {
|
406 |
+
$emailBalanceValue = isset($sendinUserResult[$email]['email_bl']) ? $sendinUserResult[$email]['email_bl'] : '';
|
407 |
+
|
408 |
+
if ($emailBalanceValue === 1 || $sendinUserResult[$email] == null) {
|
409 |
+
$showStatus = 0;
|
410 |
+
}
|
411 |
+
|
412 |
+
if ($emailBalanceValue === 0) {
|
413 |
+
$showStatus = 1;
|
414 |
+
}
|
415 |
+
|
416 |
+
$smsBalance = isset($sendinUserResult[$email]['sms_bl']) ? $sendinUserResult[$email]['sms_bl'] : '';
|
417 |
+
$smsExist = isset($sendinUserResult[$email]['sms_exist']) ? $sendinUserResult[$email]['sms_exist'] : '';
|
418 |
+
$subScriberTelephone = isset($subscriber['SMS']) ? $subscriber['SMS'] : '';
|
419 |
+
|
420 |
+
if ($smsBalance === 1 && $smsExist > 0) {
|
421 |
+
$smsStatus = 0;
|
422 |
+
}
|
423 |
+
else if ($smsBalance === 0 && $smsExist > 0) {
|
424 |
+
$smsStatus = 1;
|
425 |
+
}
|
426 |
+
else if ($smsExist <= 0 && empty($subScriberTelephone)) {
|
427 |
+
$smsStatus = 2;
|
428 |
+
}
|
429 |
+
else if ($smsExist <= 0 && !empty($subScriberTelephone)) {
|
430 |
+
$smsStatus = 3;
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
if ($subscriber['subscriber_status'] != 3) {
|
435 |
+
$imgMagento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
436 |
+
}
|
437 |
+
else {
|
438 |
+
$imgMagento = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
439 |
+
}
|
440 |
+
|
441 |
+
$smsStatus = $smsStatus >= 0 ? $smsStatus : '';
|
442 |
+
|
443 |
+
if ($smsStatus === 1) {
|
444 |
+
$imgSms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif" id="ajax_contact_status_'.$i.'" title="'.$title3.'" >';
|
445 |
+
}
|
446 |
+
else if ($smsStatus === 0) {
|
447 |
+
$imgSms = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif" id="ajax_contact_status_'.$i.'" title="'.$title4.'" >';
|
448 |
+
}
|
449 |
+
else if ($smsStatus === 2 || $smsStatus === '') {
|
450 |
+
$imgSms = '';
|
451 |
+
}
|
452 |
+
else if ($smsStatus === 3) {
|
453 |
+
$imgSms = 'Not synchronized';
|
454 |
+
}
|
455 |
+
|
456 |
+
$showStatus = !empty($showStatus) ? $showStatus : '0';
|
457 |
+
|
458 |
+
if ($showStatus == 1) {
|
459 |
+
$imgSendinBlue = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/enabled.gif" id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
460 |
+
}
|
461 |
+
else {
|
462 |
+
$imgSendinBlue = '<img src="'.$skinUrl.'adminhtml/default/default/sendinblue/images/disabled.gif" id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
463 |
+
}
|
464 |
+
|
465 |
+
$message .= '<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">'.$imgMagento.'</td>
|
466 |
+
<td class="a-left"><a status="'.$showStatus.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
467 |
+
'.$imgSendinBlue.'</a></td><td class="a-left last"><a status="'.$smsStatus.'" email="'.$email.'" class="ajax_sms_subs_href" href="javascript:void(0)">
|
468 |
+
'.$imgSms.'</a></td></tr>';
|
469 |
+
|
470 |
+
$i++;
|
471 |
+
}
|
472 |
+
}
|
473 |
+
$messagePaging = '';
|
474 |
+
$messagePaging .= '<tr><td colspan="7"><div class="pagination"><ul class="pull-left">';
|
475 |
+
|
476 |
+
if ($firstButton && $currentPage > 1) {
|
477 |
+
$messagePaging .= '<li p="1" class="active">'.$first.'</li>';
|
478 |
+
}
|
479 |
+
else if ($firstButton) {
|
480 |
+
$messagePaging .= '<li p="1" class="inactive">'.$first.'</li>';
|
481 |
+
}
|
482 |
+
|
483 |
+
if ($previousButton && $currentPage > 1) {
|
484 |
+
$previousValue = $currentPage - 1;
|
485 |
+
$messagePaging .= '<li p="'.$previousValue.'" class="active">'.$previous.'</li>';
|
486 |
+
}
|
487 |
+
else if ($previousButton) {
|
488 |
+
$messagePaging .= '<li class="inactive">'.$previous.'</li>';
|
489 |
+
}
|
490 |
+
|
491 |
+
for ($i = $startLoop; $i <= $endLoop; $i++) {
|
492 |
+
if ($currentPage == $i) {
|
493 |
+
$messagePaging .= '<li p="'.$i.'" style="color:#fff;background-color:#000000;" class="active">'.$i.'</li>';
|
494 |
+
}
|
495 |
+
else {
|
496 |
+
$messagePaging .= '<li p="'.$i.'" class="active">'.$i.'</li>';
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
if ($nextButton && $currentPage < $noOfPaginations) {
|
501 |
+
$nextValue = $currentPage + 1;
|
502 |
+
$messagePaging .= '<li p="'.$nextValue.'" class="active">'.$next.'</li>';
|
503 |
+
}
|
504 |
+
else if ($nextButton) {
|
505 |
+
$messagePaging .= '<li class="inactive">'.$next.'</li>';
|
506 |
+
}
|
507 |
+
|
508 |
+
if ($lastButton && $currentPage < $noOfPaginations) {
|
509 |
+
$messagePaging .= '<li p="'.$noOfPaginations.'" class="active">'.$last.'</li>';
|
510 |
+
}
|
511 |
+
else if ($lastButton) {
|
512 |
+
$messagePaging .= '<li p="'.$noOfPaginations.'" class="inactive">'.$last.'</li>';
|
513 |
+
}
|
514 |
+
|
515 |
+
if ($count != 0) {
|
516 |
+
echo $message . $messagePaging.'</td></tr>';
|
517 |
+
}
|
518 |
+
}
|
519 |
+
}
|
520 |
+
catch (Exception $exception) {
|
521 |
+
echo $this->__($exception->getMessage());
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
public function ajaxsmssubscribeAction()
|
526 |
+
{
|
527 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
528 |
+
$apiDetails['api_key'] = $sendinModule->getApiKey();
|
529 |
+
$psmailinObj = Mage::getModel('sendinblue/psmailin',$apiDetails);
|
530 |
+
|
531 |
+
$postData = $this->getRequest()->getPost();
|
532 |
+
try {
|
533 |
+
if (empty($postData)) {
|
534 |
+
Mage::throwException($this->__('Invalid form data.'));
|
535 |
+
}
|
536 |
+
$email = $postData['email'];
|
537 |
+
$userData = array();
|
538 |
+
$userData['email'] = $email;
|
539 |
+
$psmailinObj->userSmsUnsubscribed($userData);
|
540 |
+
}
|
541 |
+
catch (Exception $exception) {
|
542 |
+
echo $this->__($exception->getMessage());
|
543 |
+
}
|
544 |
+
}
|
545 |
+
|
546 |
+
public function ajaxupdateAction()
|
547 |
+
{
|
548 |
+
$postData = $this->getRequest()->getPost();
|
549 |
+
$coreResource = Mage::getSingleton('core/resource');
|
550 |
+
$tableCustomer = $coreResource->getTableName('customer/entity');
|
551 |
+
$tableNewsletter = $coreResource->getTableName('newsletter/subscriber');
|
552 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
553 |
+
$attributesName = $sendinModule->allAttributesName();
|
554 |
+
|
555 |
+
$readDbObject = Mage::getSingleton("core/resource")->getConnection("core_read");
|
556 |
+
$writeDbObject = Mage::getSingleton("core/resource")->getConnection("core_write");
|
557 |
+
|
558 |
+
try {
|
559 |
+
if (empty($postData)) {
|
560 |
+
Mage::throwException($this->__('Invalid form data.'));
|
561 |
+
}
|
562 |
+
|
563 |
+
$listId = str_replace(',', '|', $sendinModule->getUserlists());
|
564 |
+
$postEmail = !empty($postData['email']) ? $postData['email'] : '';
|
565 |
+
$postNewsLetter = !empty($postData['newsletter']) ? $postData['newsletter'] : '';
|
566 |
+
$templateSubscribeStatus = ($postNewsLetter == 0) ? 1 : 3;
|
567 |
+
|
568 |
+
$queryCustomerEntity = $readDbObject->select()
|
569 |
+
->from($tableCustomer, array('store_id', 'entity_id'))
|
570 |
+
->where("email = ?", $postEmail);
|
571 |
+
$stmtCustomerEntity = $readDbObject->query($queryCustomerEntity);
|
572 |
+
$customerData = $stmtCustomerEntity->fetch();
|
573 |
+
|
574 |
+
if (!empty($postEmail) && $postNewsLetter == 0) {
|
575 |
+
|
576 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
577 |
+
$emailSubscribeResponce = $sendinModule->emailSubscribe($postEmail);
|
578 |
+
|
579 |
+
$customerAddress = array();
|
580 |
+
if (isset($emailSubscribeResponce['code']) && $emailSubscribeResponce['code'] == 'failure' && $emailSubscribeResponce['message'] == 'User not exists') {
|
581 |
+
if (isset($customerData['entity_id']) != '') {
|
582 |
+
$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)$customerData['entity_id']);
|
583 |
+
$telephone = '';
|
584 |
+
foreach ($collectionAddress as $customerPhno) {
|
585 |
+
$customerAddress = $customerPhno->getData();
|
586 |
+
if (!empty($customerAddress['telephone']) && !empty($customerAddress['country_id'])) {
|
587 |
+
$countryCode = $sendinModule->getCountryCode($customerAddress['country_id']);
|
588 |
+
$customerAddress['telephone'] = $sendinModule->checkMobileNumber($customerAddress['telephone'], $countryCode);
|
589 |
+
}
|
590 |
+
}
|
591 |
+
$customer = Mage::getModel("customer/customer");
|
592 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
593 |
+
$customer->loadByEmail($postEmail); //load customer by email id
|
594 |
+
$customerName = $customer->getData();
|
595 |
+
$userLanguage = isset($customerName['created_in'])?$customerName['created_in'] : '';
|
596 |
+
$customerData = array_merge($customerAddress, $customerName);
|
597 |
+
$resp = $sendinModule->mergeMyArray($attributesName, $customerData);
|
598 |
+
$resp['CLIENT'] = 1;
|
599 |
+
$resp['MAGENTO_LANG'] = $userLanguage;
|
600 |
+
$responce = $sendinModule->emailAdd($postEmail, $resp, $postNewsLetter, $listId);
|
601 |
+
}
|
602 |
+
else {
|
603 |
+
$client = 0;
|
604 |
+
$customerData = array();
|
605 |
+
$subsdata = Mage::getModel('newsletter/subscriber')->loadByEmail($email)->getData();
|
606 |
+
$resp = $sendinModule->mergeMyArray($attributesName, $subsdata);
|
607 |
+
$resp['CLIENT'] = $client;
|
608 |
+
$responce = $sendinModule->emailAdd($postEmail, $resp, $postNewsLetter, $listId);
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
$querySubscriberEmail = $readDbObject->select()
|
613 |
+
->from($tableNewsletter, array('subscriber_email'))
|
614 |
+
->where("subscriber_email = ?", $postEmail);
|
615 |
+
$stmtSubscriberEmail = $readDbObject->query($querySubscriberEmail);
|
616 |
+
$customerDataNews = $stmtSubscriberEmail->fetch();
|
617 |
+
|
618 |
+
if ($customerData['entity_id'] !='' && $customerDataNews['subscriber_email'] == '' ) {
|
619 |
+
$newsLetterData = array(
|
620 |
+
"store_id" => $customerData['store_id'],
|
621 |
+
"customer_id" => $customerData['entity_id'],
|
622 |
+
"subscriber_email" => $postEmail,
|
623 |
+
"subscriber_status" => 1,
|
624 |
+
);
|
625 |
+
$writeDbObject->insert($tableNewsletter, $data);
|
626 |
+
}
|
627 |
+
else {
|
628 |
+
$costomerInformation = Mage::getModel('newsletter/subscriber')->loadByEmail($postEmail);
|
629 |
+
$costomerInformation->setStatus($templateSubscribeStatus);
|
630 |
+
$costomerInformation->setIsStatusChanged(true);
|
631 |
+
$costomerInformation->save();
|
632 |
+
}
|
633 |
+
|
634 |
+
}
|
635 |
+
else{
|
636 |
+
$responce = $sendinModule->emailDelete($postEmail);
|
637 |
+
$costomerInformation = Mage::getModel('newsletter/subscriber')->loadByEmail($postEmail);
|
638 |
+
|
639 |
+
if (!$costomerInformation->getStoreId()) {
|
640 |
+
$costomerInformation->setSubscriberEmail($postEmail);
|
641 |
+
$costomerInformation->setCustomerId($customerData['entity_id']);
|
642 |
+
$costomerInformation->setStoreId($customerData['store_id']);
|
643 |
+
}
|
644 |
+
$costomerInformation->setStatus($templateSubscribeStatus);
|
645 |
+
$costomerInformation->setIsStatusChanged(true);
|
646 |
+
$costomerInformation->save();
|
647 |
+
}
|
648 |
+
}
|
649 |
+
catch (Exception $exception) {
|
650 |
+
echo $this->__($exception->getMessage());
|
651 |
+
}
|
652 |
+
}
|
653 |
+
|
654 |
+
public function ajaxordersmsAction($sender='', $message='', $number='')
|
655 |
+
{
|
656 |
+
$postData = $this->getRequest()->getPost();
|
657 |
+
try {
|
658 |
+
if (empty($postData)) {
|
659 |
+
Mage::throwException($this->__('Invalid form data.'));
|
660 |
+
}
|
661 |
+
$number = $postData['number'];
|
662 |
+
$charone = substr($number, 0, 1);
|
663 |
+
$chartwo = substr($number, 0, 2);
|
664 |
+
if ($charone == '0' && $chartwo == '00') {
|
665 |
+
$number = $number;
|
666 |
+
}
|
667 |
+
|
668 |
+
if (isset($number)) {
|
669 |
+
$adminUserModel = Mage::getModel('admin/user');
|
670 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
671 |
+
$adminData = $userCollection->getData();
|
672 |
+
$firstname = isset($adminData[0]['firstname']) ? $adminData[0]['firstname'] : '';
|
673 |
+
$lastname = isset($adminData[0]['lastname']) ? $admin_data[0]['lastname'] : '';
|
674 |
+
$characters = '1234567890';
|
675 |
+
$referenceNumber = '';
|
676 |
+
for ($i = 0; $i < 9; $i++) {
|
677 |
+
$referenceNumber .= $characters[rand(0, strlen($characters) - 1)];
|
678 |
+
}
|
679 |
+
|
680 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
681 |
+
$orderDateFormat = ($localeCode == 'fr_FR') ? date('d/m/Y') : date('m/d/Y');
|
682 |
+
$orderprice = rand(10, 1000);
|
683 |
+
$totalPay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
684 |
+
$firstName = str_replace('{first_name}', $firstname, $postData['message']);
|
685 |
+
$lastName = str_replace('{last_name}', $lastname."\r\n", $firstName);
|
686 |
+
$procuctPrice = str_replace('{order_price}', $totalPay, $lastName);
|
687 |
+
$orderDate = str_replace('{order_date}', $orderDateFormat."\r\n", $procuctPrice);
|
688 |
+
$msgbody = str_replace('{order_reference}', $referenceNumber, $orderDate);
|
689 |
+
$smsData = array();
|
690 |
+
$smsData['to'] = $number;
|
691 |
+
$smsData['from'] = isset($postData['sender']) ? $postData['sender'] : '';
|
692 |
+
$smsData['text'] = $msgbody;
|
693 |
+
|
694 |
+
$sendSmsResponce = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($smsData);
|
695 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
696 |
+
echo 'OK';
|
697 |
+
}
|
698 |
+
else {
|
699 |
+
echo 'KO';
|
700 |
+
}
|
701 |
+
}
|
702 |
+
}
|
703 |
+
catch (Exception $exception) {
|
704 |
+
echo $this->__($exception->getMessage());
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
public function ajaxordershippedAction($sender='', $message='', $number='')
|
709 |
+
{
|
710 |
+
$postData = $this->getRequest()->getPost();
|
711 |
+
try {
|
712 |
+
if (empty($postData)) {
|
713 |
+
Mage::throwException($this->__('Invalid form data.'));
|
714 |
+
}
|
715 |
+
|
716 |
+
$number = $postData['number'];
|
717 |
+
$charone = substr($number, 0, 1);
|
718 |
+
$chartwo = substr($number, 0, 2);
|
719 |
+
|
720 |
+
if ($charone == '0' && $chartwo == '00') {
|
721 |
+
$number = $number;
|
722 |
+
}
|
723 |
+
|
724 |
+
if (isset($number)) {
|
725 |
+
$adminUserModel = Mage::getModel('admin/user');
|
726 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
727 |
+
$adminData = $userCollection->getData();
|
728 |
+
$firstname = isset($adminData[0]['firstname'])?$adminData[0]['firstname']:'';
|
729 |
+
$lastname = isset($adminData[0]['lastname'])?$adminData[0]['lastname']:'';
|
730 |
+
$characters = '1234567890';
|
731 |
+
$referenceNumber = '';
|
732 |
+
for ($i = 0; $i < 9; $i++) {
|
733 |
+
$referenceNumber .= $characters[rand(0, strlen($characters) - 1)];
|
734 |
+
}
|
735 |
+
|
736 |
+
$localeCode = Mage::app()->getLocale()->getLocaleCode();
|
737 |
+
$orderDateFormat = ($localeCode == 'fr_FR') ? date('d/m/Y') : date('m/d/Y') ;
|
738 |
+
|
739 |
+
$orderprice = rand(10, 1000);
|
740 |
+
$totalPay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
741 |
+
$msgbody = $postData['message'];
|
742 |
+
$firstName = str_replace('{first_name}', $firstname, $msgbody);
|
743 |
+
$lastName = str_replace('{last_name}', $lastname."\r\n", $firstName);
|
744 |
+
$procuctPrice = str_replace('{order_price}', $totalPay, $lastName);
|
745 |
+
$orderDate = str_replace('{order_date}', $orderDateFormat."\r\n", $procuctPrice);
|
746 |
+
$msgbody = str_replace('{order_reference}', $referenceNumber, $orderDate);
|
747 |
+
$smsData = array();
|
748 |
+
$smsData['to'] = $number;
|
749 |
+
$smsData['from'] = !empty($postData['sender'])?$postData['sender']:'';
|
750 |
+
$smsData['text'] = $msgbody;
|
751 |
+
|
752 |
+
$sendSmsResponce = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($smsData);
|
753 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
754 |
+
echo 'OK';
|
755 |
+
}
|
756 |
+
else {
|
757 |
+
echo 'KO';
|
758 |
+
}
|
759 |
+
exit;
|
760 |
+
}
|
761 |
+
|
762 |
+
}
|
763 |
+
catch (Exception $exception) {
|
764 |
+
echo $this->__($exception->getMessage());
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
+
public function ajaxsmscampaignAction($sender='', $message='', $number='')
|
769 |
+
{
|
770 |
+
$postData = $this->getRequest()->getPost();
|
771 |
+
try {
|
772 |
+
if (empty($postData)) {
|
773 |
+
Mage::throwException($this->__('Invalid form data.'));
|
774 |
+
}
|
775 |
+
$number = $postData['number'];
|
776 |
+
$charone = substr($number, 0, 1);
|
777 |
+
$chartwo = substr($number, 0, 2);
|
778 |
+
if ($charone == '0' && $chartwo == '00') {
|
779 |
+
$number = $number;
|
780 |
+
}
|
781 |
+
if (isset($number)) {
|
782 |
+
$adminUserModel = Mage::getModel('admin/user');
|
783 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
784 |
+
$adminData = $userCollection->getData();
|
785 |
+
$firstname = isset($adminData[0]['firstname'])?$adminData[0]['firstname']:'';
|
786 |
+
$lastname = isset($adminData[0]['lastname'])?$adminData[0]['lastname']:'';
|
787 |
+
$msgbody = $postData['message'];
|
788 |
+
$firstName = str_replace('{first_name}', $firstname, $msgbody);
|
789 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $firstName);
|
790 |
+
$smsData = array();
|
791 |
+
$smsData['to'] = $number;
|
792 |
+
$smsData['from'] = !empty($postData['sender'])?$postData['sender']:'';
|
793 |
+
$smsData['text'] = $msgbody;
|
794 |
+
$sendSmsResponce = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($smsData);
|
795 |
+
if (isset($sendSmsResponce['status']) && $sendSmsResponce['status'] == 'OK') {
|
796 |
+
echo 'OK';
|
797 |
+
}
|
798 |
+
else {
|
799 |
+
echo 'KO';
|
800 |
+
}
|
801 |
+
}
|
802 |
+
}
|
803 |
+
catch (Exception $exception) {
|
804 |
+
echo $this->__($exception->getMessage());
|
805 |
+
}
|
806 |
+
}
|
807 |
+
}
|
app/code/{local → community}/Sendinblue/Sendinblue/controllers/IndexController.php
RENAMED
@@ -10,9 +10,9 @@
|
|
10 |
|
11 |
class Sendinblue_Sendinblue_IndexController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
}
|
10 |
|
11 |
class Sendinblue_Sendinblue_IndexController extends Mage_Core_Controller_Front_Action
|
12 |
{
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$this->loadLayout();
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
}
|
app/code/{local → community}/Sendinblue/Sendinblue/etc/adminhtml.xml
RENAMED
File without changes
|
app/code/{local → community}/Sendinblue/Sendinblue/etc/config.xml
RENAMED
@@ -1,325 +1,321 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Sendinblue_Sendinblue>
|
5 |
-
<version>1.
|
6 |
-
<platform>ce</platform>
|
7 |
-
</Sendinblue_Sendinblue>
|
8 |
-
</modules>
|
9 |
-
<adminhtml>
|
10 |
-
<menu>
|
11 |
-
<system>
|
12 |
-
<children>
|
13 |
-
<mails translate="title" module="sendinblue">
|
14 |
-
<title>SendinBlue Settings</title>
|
15 |
-
<action>sendinblue/adminhtml_myform</action>
|
16 |
-
<sort_order>0</sort_order>
|
17 |
-
|
18 |
-
</mails>
|
19 |
-
</children>
|
20 |
-
</system>
|
21 |
-
</menu>
|
22 |
-
<translate></translate>
|
23 |
-
<events>
|
24 |
-
|
25 |
-
<!--use for delete customer (post) -->
|
26 |
-
<controller_action_postdispatch_adminhtml_customer_massDelete>
|
27 |
-
<observers>
|
28 |
-
<sendinblue_admin_customer_massDelete>
|
29 |
-
<type>singleton</type>
|
30 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
31 |
-
<method>adminCustomerDelete</method>
|
32 |
-
</sendinblue_admin_customer_massDelete>
|
33 |
-
</observers>
|
34 |
-
</controller_action_postdispatch_adminhtml_customer_massDelete>
|
35 |
-
|
36 |
-
<!--use for delete newsletter subcriber (post) -->
|
37 |
-
<controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
38 |
-
<observers>
|
39 |
-
<sendinblue_admin_newsletter_massDelete>
|
40 |
-
<type>singleton</type>
|
41 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
42 |
-
<method>adminSubcriberDelete</method>
|
43 |
-
</sendinblue_admin_newsletter_massDelete>
|
44 |
-
</observers>
|
45 |
-
</controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
46 |
-
|
47 |
-
<!--use for subscribe customer (subscribe customer for newsletter from admin) (post) -->
|
48 |
-
<controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
49 |
-
<observers>
|
50 |
-
<sendinblue_admin_customer_massSubscribe>
|
51 |
-
<type>singleton</type>
|
52 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
53 |
-
<method>adminCustomerSubscribe</method>
|
54 |
-
</sendinblue_admin_customer_massSubscribe>
|
55 |
-
</observers>
|
56 |
-
</controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
57 |
-
|
58 |
-
<!--use for unsubscribe customer (post) -->
|
59 |
-
<controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
60 |
-
<observers>
|
61 |
-
<sendinblue_admin_customer_massUnsubscribe>
|
62 |
-
<type>singleton</type>
|
63 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
64 |
-
<method>adminCustomerDelete</method>
|
65 |
-
</sendinblue_admin_customer_massUnsubscribe>
|
66 |
-
</observers>
|
67 |
-
</controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
68 |
-
|
69 |
-
<!--use for unsubscribe newsletter subscriber (post) -->
|
70 |
-
<controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
71 |
-
<observers>
|
72 |
-
<sendinblue_admin_newsletter_massUnsubscribe>
|
73 |
-
<type>singleton</type>
|
74 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
75 |
-
<method>adminSubcriberDelete</method>
|
76 |
-
</sendinblue_admin_newsletter_massUnsubscribe>
|
77 |
-
</observers>
|
78 |
-
</controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
79 |
-
|
80 |
-
|
81 |
-
<sales_order_save_after>
|
82 |
-
<observers>
|
83 |
-
<sendinblue_update_data>
|
84 |
-
<type>singleton</type>
|
85 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
86 |
-
<method>updateStatus</method>
|
87 |
-
</sendinblue_update_data>
|
88 |
-
</observers>
|
89 |
-
</sales_order_save_after>
|
90 |
-
|
91 |
-
</events>
|
92 |
-
<acl>
|
93 |
-
<resources>
|
94 |
-
<all>
|
95 |
-
<title>Allow Everything</title>
|
96 |
-
</all>
|
97 |
-
<admin>
|
98 |
-
<children>
|
99 |
-
<mails>
|
100 |
-
<children>
|
101 |
-
<mails>
|
102 |
-
<title>Sendinblue</title>
|
103 |
-
</mails>
|
104 |
-
</children>
|
105 |
-
</mails>
|
106 |
-
<system>
|
107 |
-
<children>
|
108 |
-
<config>
|
109 |
-
<children>
|
110 |
-
<sendinblue>
|
111 |
-
<title>Sendinblue</title>
|
112 |
-
</sendinblue>
|
113 |
-
</children>
|
114 |
-
</config>
|
115 |
-
</children>
|
116 |
-
</system>
|
117 |
-
</children>
|
118 |
-
<children>
|
119 |
-
<system>
|
120 |
-
<children>
|
121 |
-
<mails translate="title" module="sendinblue">
|
122 |
-
<title>Sendinblue Settings</title>
|
123 |
-
<sort_order>0</sort_order>
|
124 |
-
<action></action>
|
125 |
-
</mails>
|
126 |
-
</children>
|
127 |
-
</system>
|
128 |
-
</children>
|
129 |
-
</admin>
|
130 |
-
</resources>
|
131 |
-
</acl>
|
132 |
-
<translate>
|
133 |
-
<modules>
|
134 |
-
<Sendinblue_Sendinblue>
|
135 |
-
<files>
|
136 |
-
<default>Sendinblue.csv</default>
|
137 |
-
</files>
|
138 |
-
</Sendinblue_Sendinblue>
|
139 |
-
</modules>
|
140 |
-
</translate>
|
141 |
-
|
142 |
-
|
143 |
-
<layout>
|
144 |
-
<updates>
|
145 |
-
<sendinblue_sendinblue>
|
146 |
-
<file>sendinblue.xml</file>
|
147 |
-
</sendinblue_sendinblue>
|
148 |
-
</updates>
|
149 |
-
</layout>
|
150 |
-
|
151 |
-
</adminhtml>
|
152 |
-
<admin>
|
153 |
-
<routers>
|
154 |
-
<sendinblue_admin>
|
155 |
-
<use>admin</use>
|
156 |
-
<args>
|
157 |
-
<module>Sendinblue_Sendinblue</module>
|
158 |
-
<frontName>sendinblue</frontName>
|
159 |
-
</args>
|
160 |
-
</sendinblue_admin>
|
161 |
-
</routers>
|
162 |
-
<children>
|
163 |
-
<system>
|
164 |
-
<children>
|
165 |
-
<mails translate="label" module="sendinblue">
|
166 |
-
<title>Sendinblue Settings</title>
|
167 |
-
<sort_order>40</sort_order>
|
168 |
-
<action>adminhtml/system_config/edit/section/sendinblue</action>
|
169 |
-
</mails>
|
170 |
-
</children>
|
171 |
-
</system>
|
172 |
-
</children>
|
173 |
-
</admin>
|
174 |
-
<global>
|
175 |
-
<events>
|
176 |
-
<newsletter_subscriber_save_commit_after>
|
177 |
-
<observers>
|
178 |
-
<sendinblue_sendinblue_model_observer>
|
179 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
180 |
-
<method>subscribedToNewsletter</method>
|
181 |
-
</sendinblue_sendinblue_model_observer>
|
182 |
-
</observers>
|
183 |
-
</newsletter_subscriber_save_commit_after>
|
184 |
-
<customer_save_after>
|
185 |
-
<observers>
|
186 |
-
<sendinblue_update_data>
|
187 |
-
<type>singleton</type>
|
188 |
-
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
189 |
-
<method>updateNewObserver</method>
|
190 |
-
</sendinblue_update_data>
|
191 |
-
</observers>
|
192 |
-
</customer_save_after>
|
193 |
-
</events>
|
194 |
-
|
195 |
-
<template>
|
196 |
-
<email>
|
197 |
-
<custom_template>
|
198 |
-
<label>Sendinblue custom email module</label>
|
199 |
-
<file>sendinsmtp_conf.html</file>
|
200 |
-
<type>html</type>
|
201 |
-
</custom_template>
|
202 |
-
<notification_template>
|
203 |
-
<label>Sendinblue notification email module</label>
|
204 |
-
<file>sendin_notification.html</file>
|
205 |
-
<type>html</type>
|
206 |
-
</notification_template>
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
</
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
<connection>
|
241 |
-
<use>
|
242 |
-
</connection>
|
243 |
-
</
|
244 |
-
<
|
245 |
-
<connection>
|
246 |
-
<use>
|
247 |
-
</connection>
|
248 |
-
</
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
<
|
257 |
-
<sendinblue>
|
258 |
-
<class>
|
259 |
-
</sendinblue>
|
260 |
-
</
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
<
|
283 |
-
<
|
284 |
-
<
|
285 |
-
<
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
</layout>
|
323 |
-
|
324 |
-
</frontend>
|
325 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sendinblue_Sendinblue>
|
5 |
+
<version>1.3.0</version>
|
6 |
+
<platform>ce</platform>
|
7 |
+
</Sendinblue_Sendinblue>
|
8 |
+
</modules>
|
9 |
+
<adminhtml>
|
10 |
+
<menu>
|
11 |
+
<system>
|
12 |
+
<children>
|
13 |
+
<mails translate="title" module="sendinblue">
|
14 |
+
<title>SendinBlue Settings</title>
|
15 |
+
<action>sendinblue/adminhtml_myform</action>
|
16 |
+
<sort_order>0</sort_order>
|
17 |
+
|
18 |
+
</mails>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</menu>
|
22 |
+
<translate></translate>
|
23 |
+
<events>
|
24 |
+
|
25 |
+
<!--use for delete customer (post) -->
|
26 |
+
<controller_action_postdispatch_adminhtml_customer_massDelete>
|
27 |
+
<observers>
|
28 |
+
<sendinblue_admin_customer_massDelete>
|
29 |
+
<type>singleton</type>
|
30 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
31 |
+
<method>adminCustomerDelete</method>
|
32 |
+
</sendinblue_admin_customer_massDelete>
|
33 |
+
</observers>
|
34 |
+
</controller_action_postdispatch_adminhtml_customer_massDelete>
|
35 |
+
|
36 |
+
<!--use for delete newsletter subcriber (post) -->
|
37 |
+
<controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
38 |
+
<observers>
|
39 |
+
<sendinblue_admin_newsletter_massDelete>
|
40 |
+
<type>singleton</type>
|
41 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
42 |
+
<method>adminSubcriberDelete</method>
|
43 |
+
</sendinblue_admin_newsletter_massDelete>
|
44 |
+
</observers>
|
45 |
+
</controller_action_postdispatch_adminhtml_newsletter_subscriber_massDelete>
|
46 |
+
|
47 |
+
<!--use for subscribe customer (subscribe customer for newsletter from admin) (post) -->
|
48 |
+
<controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
49 |
+
<observers>
|
50 |
+
<sendinblue_admin_customer_massSubscribe>
|
51 |
+
<type>singleton</type>
|
52 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
53 |
+
<method>adminCustomerSubscribe</method>
|
54 |
+
</sendinblue_admin_customer_massSubscribe>
|
55 |
+
</observers>
|
56 |
+
</controller_action_postdispatch_adminhtml_customer_massSubscribe>
|
57 |
+
|
58 |
+
<!--use for unsubscribe customer (post) -->
|
59 |
+
<controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
60 |
+
<observers>
|
61 |
+
<sendinblue_admin_customer_massUnsubscribe>
|
62 |
+
<type>singleton</type>
|
63 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
64 |
+
<method>adminCustomerDelete</method>
|
65 |
+
</sendinblue_admin_customer_massUnsubscribe>
|
66 |
+
</observers>
|
67 |
+
</controller_action_postdispatch_adminhtml_customer_massUnsubscribe>
|
68 |
+
|
69 |
+
<!--use for unsubscribe newsletter subscriber (post) -->
|
70 |
+
<controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
71 |
+
<observers>
|
72 |
+
<sendinblue_admin_newsletter_massUnsubscribe>
|
73 |
+
<type>singleton</type>
|
74 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
75 |
+
<method>adminSubcriberDelete</method>
|
76 |
+
</sendinblue_admin_newsletter_massUnsubscribe>
|
77 |
+
</observers>
|
78 |
+
</controller_action_predispatch_adminhtml_newsletter_subscriber_massUnsubscribe>
|
79 |
+
|
80 |
+
|
81 |
+
<sales_order_save_after>
|
82 |
+
<observers>
|
83 |
+
<sendinblue_update_data>
|
84 |
+
<type>singleton</type>
|
85 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
86 |
+
<method>updateStatus</method>
|
87 |
+
</sendinblue_update_data>
|
88 |
+
</observers>
|
89 |
+
</sales_order_save_after>
|
90 |
+
|
91 |
+
</events>
|
92 |
+
<acl>
|
93 |
+
<resources>
|
94 |
+
<all>
|
95 |
+
<title>Allow Everything</title>
|
96 |
+
</all>
|
97 |
+
<admin>
|
98 |
+
<children>
|
99 |
+
<mails>
|
100 |
+
<children>
|
101 |
+
<mails>
|
102 |
+
<title>Sendinblue</title>
|
103 |
+
</mails>
|
104 |
+
</children>
|
105 |
+
</mails>
|
106 |
+
<system>
|
107 |
+
<children>
|
108 |
+
<config>
|
109 |
+
<children>
|
110 |
+
<sendinblue>
|
111 |
+
<title>Sendinblue</title>
|
112 |
+
</sendinblue>
|
113 |
+
</children>
|
114 |
+
</config>
|
115 |
+
</children>
|
116 |
+
</system>
|
117 |
+
</children>
|
118 |
+
<children>
|
119 |
+
<system>
|
120 |
+
<children>
|
121 |
+
<mails translate="title" module="sendinblue">
|
122 |
+
<title>Sendinblue Settings</title>
|
123 |
+
<sort_order>0</sort_order>
|
124 |
+
<action></action>
|
125 |
+
</mails>
|
126 |
+
</children>
|
127 |
+
</system>
|
128 |
+
</children>
|
129 |
+
</admin>
|
130 |
+
</resources>
|
131 |
+
</acl>
|
132 |
+
<translate>
|
133 |
+
<modules>
|
134 |
+
<Sendinblue_Sendinblue>
|
135 |
+
<files>
|
136 |
+
<default>Sendinblue.csv</default>
|
137 |
+
</files>
|
138 |
+
</Sendinblue_Sendinblue>
|
139 |
+
</modules>
|
140 |
+
</translate>
|
141 |
+
|
142 |
+
|
143 |
+
<layout>
|
144 |
+
<updates>
|
145 |
+
<sendinblue_sendinblue>
|
146 |
+
<file>sendinblue.xml</file>
|
147 |
+
</sendinblue_sendinblue>
|
148 |
+
</updates>
|
149 |
+
</layout>
|
150 |
+
|
151 |
+
</adminhtml>
|
152 |
+
<admin>
|
153 |
+
<routers>
|
154 |
+
<sendinblue_admin>
|
155 |
+
<use>admin</use>
|
156 |
+
<args>
|
157 |
+
<module>Sendinblue_Sendinblue</module>
|
158 |
+
<frontName>sendinblue</frontName>
|
159 |
+
</args>
|
160 |
+
</sendinblue_admin>
|
161 |
+
</routers>
|
162 |
+
<children>
|
163 |
+
<system>
|
164 |
+
<children>
|
165 |
+
<mails translate="label" module="sendinblue">
|
166 |
+
<title>Sendinblue Settings</title>
|
167 |
+
<sort_order>40</sort_order>
|
168 |
+
<action>adminhtml/system_config/edit/section/sendinblue</action>
|
169 |
+
</mails>
|
170 |
+
</children>
|
171 |
+
</system>
|
172 |
+
</children>
|
173 |
+
</admin>
|
174 |
+
<global>
|
175 |
+
<events>
|
176 |
+
<newsletter_subscriber_save_commit_after>
|
177 |
+
<observers>
|
178 |
+
<sendinblue_sendinblue_model_observer>
|
179 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
180 |
+
<method>subscribedToNewsletter</method>
|
181 |
+
</sendinblue_sendinblue_model_observer>
|
182 |
+
</observers>
|
183 |
+
</newsletter_subscriber_save_commit_after>
|
184 |
+
<customer_save_after>
|
185 |
+
<observers>
|
186 |
+
<sendinblue_update_data>
|
187 |
+
<type>singleton</type>
|
188 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
189 |
+
<method>updateNewObserver</method>
|
190 |
+
</sendinblue_update_data>
|
191 |
+
</observers>
|
192 |
+
</customer_save_after>
|
193 |
+
</events>
|
194 |
+
|
195 |
+
<template>
|
196 |
+
<email>
|
197 |
+
<custom_template>
|
198 |
+
<label>Sendinblue custom email module</label>
|
199 |
+
<file>sendinsmtp_conf.html</file>
|
200 |
+
<type>html</type>
|
201 |
+
</custom_template>
|
202 |
+
<notification_template>
|
203 |
+
<label>Sendinblue notification email module</label>
|
204 |
+
<file>sendin_notification.html</file>
|
205 |
+
<type>html</type>
|
206 |
+
</notification_template>
|
207 |
+
<doubleoptin_template>
|
208 |
+
<label>Sendinblue doubleoptin email module</label>
|
209 |
+
<file>doubleoptin_temp.html</file>
|
210 |
+
<type>html</type>
|
211 |
+
</doubleoptin_template>
|
212 |
+
</email>
|
213 |
+
</template>
|
214 |
+
|
215 |
+
<models>
|
216 |
+
<core>
|
217 |
+
<rewrite>
|
218 |
+
<email>Sendinblue_Sendinblue_Model_Email</email>
|
219 |
+
<email_template>Sendinblue_Sendinblue_Model_Email_Template</email_template>
|
220 |
+
</rewrite>
|
221 |
+
</core>
|
222 |
+
<sendinblue>
|
223 |
+
<class>Sendinblue_Sendinblue_Model</class>
|
224 |
+
<resourceModel>sendinblue_mysql4</resourceModel>
|
225 |
+
</sendinblue>
|
226 |
+
<sendinblue_mysql4>
|
227 |
+
<class>Sendinblue_Sendinblue_Model_Mysql4</class>
|
228 |
+
<entities>
|
229 |
+
<sendinblue>
|
230 |
+
<table>sendinblue_country_codes</table>
|
231 |
+
</sendinblue>
|
232 |
+
</entities>
|
233 |
+
</sendinblue_mysql4>
|
234 |
+
</models>
|
235 |
+
<resources>
|
236 |
+
<sendinblue_setup>
|
237 |
+
<setup>
|
238 |
+
<module>Sendinblue_Sendinblue</module>
|
239 |
+
</setup>
|
240 |
+
<connection>
|
241 |
+
<use>core_setup</use>
|
242 |
+
</connection>
|
243 |
+
</sendinblue_setup>
|
244 |
+
<sendinblue_write>
|
245 |
+
<connection>
|
246 |
+
<use>core_write</use>
|
247 |
+
</connection>
|
248 |
+
</sendinblue_write>
|
249 |
+
<sendinblue_read>
|
250 |
+
<connection>
|
251 |
+
<use>core_read</use>
|
252 |
+
</connection>
|
253 |
+
</sendinblue_read>
|
254 |
+
</resources>
|
255 |
+
|
256 |
+
<helpers>
|
257 |
+
<sendinblue>
|
258 |
+
<class>Sendinblue_Sendinblue_Helper</class>
|
259 |
+
</sendinblue>
|
260 |
+
</helpers>
|
261 |
+
<blocks>
|
262 |
+
<sendinblue>
|
263 |
+
<class>Sendinblue_Sendinblue_Block</class>
|
264 |
+
</sendinblue>
|
265 |
+
</blocks>
|
266 |
+
|
267 |
+
</global>
|
268 |
+
<crontab>
|
269 |
+
<jobs>
|
270 |
+
<sendinblue_sendinblue>
|
271 |
+
<schedule>
|
272 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
273 |
+
</schedule>
|
274 |
+
<run>
|
275 |
+
<model>sendinblue/observer::syncData</model>
|
276 |
+
</run>
|
277 |
+
</sendinblue_sendinblue>
|
278 |
+
</jobs>
|
279 |
+
</crontab>
|
280 |
+
<default>
|
281 |
+
<sendinblue>
|
282 |
+
<general>
|
283 |
+
<enabled>0</enabled>
|
284 |
+
<test>0</test>
|
285 |
+
<test_address />
|
286 |
+
</general>
|
287 |
+
<smtp>
|
288 |
+
<host>sendinblue.fr</host>
|
289 |
+
<port />
|
290 |
+
<login />
|
291 |
+
<password />
|
292 |
+
<ssl />
|
293 |
+
</smtp>
|
294 |
+
</sendinblue>
|
295 |
+
</default>
|
296 |
+
<frontend>
|
297 |
+
<events>
|
298 |
+
<!--use when new subcriber add for newsletter-->
|
299 |
+
<controller_action_postdispatch_newsletter_subscriber_new>
|
300 |
+
<observers>
|
301 |
+
<sendinblue_subscribe_new_observer>
|
302 |
+
<type>singleton</type>
|
303 |
+
<class>Sendinblue_Sendinblue_Model_Observer</class>
|
304 |
+
<method>subscribeObserver</method>
|
305 |
+
</sendinblue_subscribe_new_observer>
|
306 |
+
</observers>
|
307 |
+
</controller_action_postdispatch_newsletter_subscriber_new>
|
308 |
+
|
309 |
+
<!--use when new user register check (is_subscribed = 1)-->
|
310 |
+
</events>
|
311 |
+
|
312 |
+
<layout>
|
313 |
+
<updates>
|
314 |
+
<sendinblue_sendinblue>
|
315 |
+
<file>sendinblue.xml</file>
|
316 |
+
</sendinblue_sendinblue>
|
317 |
+
</updates>
|
318 |
+
</layout>
|
319 |
+
|
320 |
+
</frontend>
|
321 |
+
</config>
|
|
|
|
|
|
|
|
app/code/{local/Sendinblue/Sendinblue/sql/sendinblue_setup/install-0.1.0.php → community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-install-0.1.0.php}
RENAMED
File without changes
|
app/code/community/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
+
* @copyright 2013-2014 Sendinblue
|
5 |
+
* URL: https:www.sendinblue.com
|
6 |
+
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
+
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
+
* needs then we can't provide a technical support.
|
9 |
+
**/
|
10 |
+
|
11 |
+
//echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number <br />';
|
12 |
+
//die();
|
13 |
+
|
14 |
+
?>
|
app/code/local/Sendinblue/Sendinblue/Block/Sendinblue.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_Block_Sendinblue extends Mage_Core_Block_Template
|
12 |
-
{
|
13 |
-
public function _prepareLayout()
|
14 |
-
{
|
15 |
-
return parent::_prepareLayout();
|
16 |
-
}
|
17 |
-
public function getPagerHtml()
|
18 |
-
{
|
19 |
-
return $this->getChildHtml('pager');
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function _toHtml()
|
23 |
-
{
|
24 |
-
|
25 |
-
$get_Enable_Status = Mage::getModel('sendinblue/sendinblue')->getEnableStatus();
|
26 |
-
|
27 |
-
$get_Tracking_Status = Mage::getModel('sendinblue/sendinblue')->getTrackingStatus();
|
28 |
-
|
29 |
-
$get_order_status = Mage::getModel('sendinblue/sendinblue')->getOrderSmsStatus();
|
30 |
-
|
31 |
-
$get_User_lists = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
32 |
-
|
33 |
-
|
34 |
-
$value = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp();
|
35 |
-
|
36 |
-
$orders = Mage::getModel('sales/order')->getCollection();
|
37 |
-
|
38 |
-
$order = $orders->getLastItem();
|
39 |
-
$order_Data = $order->getPayment()->getData();
|
40 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
41 |
-
$orderaddress = Mage::getModel('sales/order')->loadByIncrementId($order->increment_id);
|
42 |
-
|
43 |
-
$mobile = $customer->getPrimaryBillingAddress()->getTelephone();
|
44 |
-
$email = $customer->getEmail();// for email address
|
45 |
-
$firstname = $customer->getFirstname();// For first name
|
46 |
-
$lastname= $customer->getLastname();// For last name
|
47 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
48 |
-
$nlStatus = $costomer_data->getStatus();
|
49 |
-
if ($get_Enable_Status == 1 && $get_Tracking_Status == 1 && $nlStatus == 1)
|
50 |
-
{
|
51 |
-
|
52 |
-
$value_config = Mage::getModel('sendinblue/sendinblue')->getApiConfigValue();
|
53 |
-
if ($value_config->date_format == 'dd-mm-yyyy')
|
54 |
-
$date = date('d-m-Y', strtotime($order->created_at));
|
55 |
-
else
|
56 |
-
$date = date('m-d-Y', strtotime($order->created_at));
|
57 |
-
|
58 |
-
$html = '';
|
59 |
-
|
60 |
-
$html .= '<script type="text/javascript">
|
61 |
-
/**Code for NB tracking*/
|
62 |
-
function loadScript(url,callback){var script=document.createElement("script");script.type="text/javascript";if(script.readyState){script.onreadystatechange=function(){
|
63 |
-
if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;callback(url)}}}else{
|
64 |
-
script.onload=function(){callback(url)}}script.src=url;if(document.body){document.body.appendChild(script)}else{
|
65 |
-
document.head.appendChild(script)}}
|
66 |
-
var nbJsURL = (("https:" == document.location.protocol) ? "https://my-tracking-orders.googlecode.com/files" : "http://my-tracking-orders.googlecode.com/files");
|
67 |
-
var nbBaseURL = "http://tracking.mailin.fr/";
|
68 |
-
loadScript(nbJsURL+"/nbv2.js",
|
69 |
-
function(){
|
70 |
-
/*You can put your custom variables here as shown in example.*/
|
71 |
-
try {
|
72 |
-
var nbTracker = nb.getTracker(nbBaseURL , "'.$value->result->tracking_data->site_id.'");
|
73 |
-
var list = ["'.$get_User_lists.'"];
|
74 |
-
var attributes = ["EMAIL","PRENOM","NOM","ORDER_ID","ORDER_DATE","ORDER_PRICE"];
|
75 |
-
var values = ["'.$email.'","'.$firstname.'","'.$lastname.'","'.$order->increment_id.'","'.$date.'","'.$order_Data[amount_ordered].'"];
|
76 |
-
nbTracker.setListData(list);
|
77 |
-
nbTracker.setTrackingData(attributes,values);
|
78 |
-
nbTracker.trackPageView();
|
79 |
-
} catch( err ) {}
|
80 |
-
});
|
81 |
-
|
82 |
-
</script>';
|
83 |
-
|
84 |
-
echo $html;
|
85 |
-
}
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Helper/Data.php
DELETED
@@ -1,54 +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_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
-
{
|
13 |
-
public function getSMTP()
|
14 |
-
{
|
15 |
-
return Mage::getStoreConfig('sendinblue/smtp/option') == 'smtp';
|
16 |
-
}
|
17 |
-
public function getTransport()
|
18 |
-
{
|
19 |
-
if ($this->getSMTP())
|
20 |
-
{
|
21 |
-
$username = Mage::getStoreConfig('sendinblue/smtp/username');
|
22 |
-
$password = Mage::getStoreConfig('sendinblue/smtp/password');
|
23 |
-
$host = Mage::getStoreConfig('sendinblue/smtp/host');
|
24 |
-
$port = Mage::getStoreConfig('sendinblue/smtp/port');
|
25 |
-
$ssl = Mage::getStoreConfig('sendinblue/smtp/ssl');
|
26 |
-
$auth = Mage::getStoreConfig('sendinblue/smtp/authentication');
|
27 |
-
$config = array();
|
28 |
-
$config['username'] = $username;
|
29 |
-
$config['password'] = $password;
|
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
|
39 |
-
{
|
40 |
-
Mage::log('Disabled, or no matching transport');
|
41 |
-
return null;
|
42 |
-
}
|
43 |
-
Mage::log('Returning transport');
|
44 |
-
return $transport;
|
45 |
-
}
|
46 |
-
public function ModuleisEnabled()
|
47 |
-
{
|
48 |
-
return Mage::getStoreConfig('sendinblue/enabled');
|
49 |
-
}
|
50 |
-
public function isEnabled()
|
51 |
-
{
|
52 |
-
return Mage::getStoreConfig('sendinblue/smtp/status');
|
53 |
-
}
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Email.php
DELETED
@@ -1,36 +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_Model_Email extends Mage_Core_Model_Email {
|
12 |
-
/**
|
13 |
-
* override send function
|
14 |
-
*/
|
15 |
-
public function send()
|
16 |
-
{
|
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 |
-
Mage::log('SendinblueSMTP is enabled, sending email in Sendinblue_Sendinblue_Model_Sendinblue');
|
21 |
-
$mail = new Zend_Mail();
|
22 |
-
if (strtolower($this->getType()) == 'html')
|
23 |
-
$mail->setBodyHtml($this->getBody());
|
24 |
-
else
|
25 |
-
$mail->setBodyText($this->getBody());
|
26 |
-
$transport = Mage::helper('sendinblue')->getTransport();
|
27 |
-
$email = Mage::getStoreConfig('contacts/email/recipient_email');
|
28 |
-
$mail->setFrom($this->getFromEmail(), $this->getFromName())
|
29 |
-
->addTo($email, $this->getToName())
|
30 |
-
->setSubject($this->getSubject());
|
31 |
-
Mage::log('About to send email');
|
32 |
-
$mail->send($transport);
|
33 |
-
Mage::log('Finished sending email');
|
34 |
-
return $this;
|
35 |
-
}
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Email/Template.php
DELETED
@@ -1,104 +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_Model_Email_Template extends Mage_Core_Model_Email_Template {
|
12 |
-
|
13 |
-
public function send($email, $name=null, array $variables = array()) {
|
14 |
-
|
15 |
-
// If it's not enabled, just return the parent result.
|
16 |
-
|
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
|
27 |
-
return false;
|
28 |
-
}
|
29 |
-
|
30 |
-
$emails = array_values((array)$email);
|
31 |
-
$names = is_array($name) ? $name : (array)$name;
|
32 |
-
$names = array_values($names);
|
33 |
-
foreach ($emails as $key => $email) {
|
34 |
-
if (!isset($names[$key])) {
|
35 |
-
$names[$key] = substr($email, 0, strpos($email, '@'));
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
$variables['email'] = reset($emails);
|
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 |
-
|
64 |
-
if($this->isPlain()) {
|
65 |
-
$mail->setBodyText($text);
|
66 |
-
} else {
|
67 |
-
$mail->setBodyHTML($text);
|
68 |
-
}
|
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 {
|
77 |
-
|
78 |
-
// adding new Event dispatch in case anyone wants to interrogate an email before being sent
|
79 |
-
// throwing an Exception in the Event Observer will prevent the mail being sent,
|
80 |
-
// and will return false to the calling function
|
81 |
-
Mage::dispatchEvent('sendin_email_after_send', array(
|
82 |
-
'mail' => $mail,
|
83 |
-
'template' => $this->getTemplateId(),
|
84 |
-
'subject' => $this->getProcessedTemplateSubject($variables),
|
85 |
-
));
|
86 |
-
|
87 |
-
Mage::log('About to send email');
|
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 |
-
|
96 |
-
Mage::logException($e);
|
97 |
-
$responceArr = array('result'=>false, 'error'=>$e->getMessage());
|
98 |
-
return json_encode($responceArr);
|
99 |
-
}
|
100 |
-
$responceArr = array('result'=>true);
|
101 |
-
return json_encode($responceArr);
|
102 |
-
|
103 |
-
}
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Observer.php
DELETED
@@ -1,260 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
class Sendinblue_Sendinblue_Model_Observer
|
11 |
-
{
|
12 |
-
protected static $fields = array ();
|
13 |
-
public function adminSubcriberDelete($observer)
|
14 |
-
{
|
15 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
16 |
-
if (isset($params['subscriber']) && count($params['subscriber'] > 0))
|
17 |
-
{
|
18 |
-
$customer_email = array();
|
19 |
-
foreach ($params['subscriber'] as $costomer_id)
|
20 |
-
{
|
21 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->load($costomer_id)->toArray();
|
22 |
-
$customer_email[] = $costomer_data['subscriber_email'];
|
23 |
-
}
|
24 |
-
$customer_emails = implode('|', $customer_email);
|
25 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
26 |
-
}
|
27 |
-
if ($responce->result)
|
28 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
29 |
-
return $this;
|
30 |
-
}
|
31 |
-
public function adminCustomerDelete($observer)
|
32 |
-
{
|
33 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
34 |
-
if (isset($params['customer']) && count($params['customer'] > 0))
|
35 |
-
{
|
36 |
-
$customer_email = array();
|
37 |
-
foreach ($params['customer'] as $costomer_id)
|
38 |
-
{
|
39 |
-
$costomer_data = Mage::getModel('customer/customer')->load($costomer_id)->toArray();
|
40 |
-
$customer_email[] = $costomer_data['email'];
|
41 |
-
}
|
42 |
-
$customer_emails = implode('|', $customer_email);
|
43 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($customer_emails);
|
44 |
-
}
|
45 |
-
if ($responce->result)
|
46 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->unsubEmailsCounts.' record(s) were Unsubscribed');
|
47 |
-
return $this;
|
48 |
-
}
|
49 |
-
public function adminCustomerSubscribe($observer)
|
50 |
-
{
|
51 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
52 |
-
if (isset($params['customer']) && count($params['customer'] > 0))
|
53 |
-
{
|
54 |
-
$customer_email = array();
|
55 |
-
foreach ($params['customer'] as $costomer_id)
|
56 |
-
{
|
57 |
-
$costomer_data = Mage::getModel('customer/customer')->load($costomer_id)->toArray();
|
58 |
-
$customer_email[] = $costomer_data['email'];
|
59 |
-
}
|
60 |
-
$customer_emails = implode('|', $customer_email);
|
61 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->addEmailList($customer_emails);
|
62 |
-
}
|
63 |
-
if ($responce->result)
|
64 |
-
Mage::getSingleton('core/session')->addSuccess('Total of '.$responce->result->infoUpdatedCount.' record(s) were subscribed');
|
65 |
-
return $this;
|
66 |
-
}
|
67 |
-
public function subscribeObserver($observer)
|
68 |
-
{
|
69 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
70 |
-
$client = 0;
|
71 |
-
$extra = ''.'|'.''.'|'.$client.'|'.'';
|
72 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($params['email'], $extra);
|
73 |
-
return $this;
|
74 |
-
}
|
75 |
-
public function updateNewObserver($observer)
|
76 |
-
{
|
77 |
-
$extra = null;
|
78 |
-
$params = (Mage::app()->getRequest()->getParams())? Mage::app()->getRequest()->getParams() : array();
|
79 |
-
|
80 |
-
$cus_session = Mage::getSingleton('customer/session')->getCustomer();
|
81 |
-
$customer = ($cus_session->getEmail())? $cus_session : $observer->getCustomer();
|
82 |
-
$cus_data = $cus_session->getData();
|
83 |
-
$email = (isset($params['email']))? $params['email'] : $customer->getEmail();
|
84 |
-
$cid = $customer->getEntityid();
|
85 |
-
$fname = $customer->getFirstname();
|
86 |
-
$fname = empty($fname)?'':$fname;
|
87 |
-
$lname = $customer->getLastname();
|
88 |
-
$lname = empty($lname)?'':$lname;
|
89 |
-
|
90 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToFilter('parent_id',$cid);
|
91 |
-
$telephone = '';
|
92 |
-
foreach ($collectionAddress as $customerPhno) {
|
93 |
-
$telephone = $customerPhno->getData('telephone');
|
94 |
-
$firstname = $customerPhno->getData('firstname');
|
95 |
-
$lastname = $customerPhno->getData('lastname');
|
96 |
-
|
97 |
-
}
|
98 |
-
$telephone = empty($telephone)?'':$telephone;
|
99 |
-
$firstname = empty($firstname)?'':$firstname;
|
100 |
-
$lastname = empty($lastname)?'':$lastname;
|
101 |
-
|
102 |
-
if ($fname != '' || $lname != '')
|
103 |
-
$client = 1;
|
104 |
-
else
|
105 |
-
$client = 0;
|
106 |
-
|
107 |
-
$is_subscribed = (isset($params['is_subscribed']))? $params['is_subscribed'] : '';
|
108 |
-
|
109 |
-
$is_subscribedupdate = (isset($params['is_subscribed']))? 1 : 0;
|
110 |
-
if ( isset($params['is_subscribed']) == '' ) {
|
111 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
112 |
-
$nlStatus = $costomer_data->getStatus();
|
113 |
-
$is_subscribedupdate = 1;
|
114 |
-
if ($nlStatus == '') {
|
115 |
-
$is_subscribedupdate = 0;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
if ($fname != '' || $lname != '' || $telephone != '' || $email != '')
|
119 |
-
{
|
120 |
-
$extra = $fname.'|'.$lname.'|'.$client.'|'.$telephone;
|
121 |
-
if (isset($is_subscribed) && $is_subscribed == 1)
|
122 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($email, $extra);
|
123 |
-
|
124 |
-
if (isset($is_subscribedupdate) && $is_subscribedupdate == 1) {
|
125 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($email, $extra);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
if (isset($is_subscribed) && $is_subscribed != '' && $is_subscribed === 0) {
|
130 |
-
Mage::getSingleton('core/session')->addSuccess($is_subscribed);
|
131 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($email);
|
132 |
-
}
|
133 |
-
return $this;
|
134 |
-
}
|
135 |
-
public function syncData()
|
136 |
-
{
|
137 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->syncData();
|
138 |
-
return $this;
|
139 |
-
}
|
140 |
-
public function updateStatus($observer)
|
141 |
-
{
|
142 |
-
$order = $observer->getEvent()->getOrder();
|
143 |
-
|
144 |
-
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING)
|
145 |
-
{
|
146 |
-
$history = $order->getShipmentsCollection();
|
147 |
-
$history_array=$history->toarray();
|
148 |
-
$order_id = $history_array['items']['0']['order_id'];
|
149 |
-
$shippingaddrid = $history_array['items']['0']['shipping_address_id'];
|
150 |
-
$_order = Mage::getModel('sales/order')->load($order_id);
|
151 |
-
$_shippingAddress = $_order->getShippingAddress();
|
152 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
153 |
-
$mobile = $_shippingAddress->getTelephone();
|
154 |
-
$countryid = $_shippingAddress->getCountryId();
|
155 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$countryid.'" ';
|
156 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
157 |
-
$data = $connection->fetchRow($sql);
|
158 |
-
|
159 |
-
$mobile = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($mobile,$data['country_prefix']);
|
160 |
-
$firstname = $_shippingAddress->getFirstname();
|
161 |
-
$lastname = $_shippingAddress->getLastname();
|
162 |
-
$ref_num = $_order->getIncrementId();
|
163 |
-
$orderprice = $_order->getGrandTotal();
|
164 |
-
$courrencycode = $_order->getBaseCurrencyCode();
|
165 |
-
$orderdate = $_order->getCreatedAt();
|
166 |
-
if ($locale == 'fr_FR')
|
167 |
-
$ord_date = date('d/m/Y', strtotime($orderdate));
|
168 |
-
else
|
169 |
-
$ord_date = date('m/d/Y', strtotime($orderdate));
|
170 |
-
$total_pay = $orderprice.' '.$courrencycode;
|
171 |
-
$msgbody = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage();
|
172 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
173 |
-
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
174 |
-
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
175 |
-
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
176 |
-
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
177 |
-
|
178 |
-
$arr = array();
|
179 |
-
$arr['to'] = $mobile;
|
180 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingSubject();
|
181 |
-
$arr['text'] = $msgbody;
|
182 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
183 |
-
|
184 |
-
}
|
185 |
-
}
|
186 |
-
public function ordersucess($observer)
|
187 |
-
{
|
188 |
-
$get_Enable_Status = Mage::getModel('sendinblue/sendinblue')->getEnableStatus();
|
189 |
-
$get_order_status = Mage::getModel('sendinblue/sendinblue')->getOrderSmsStatus();
|
190 |
-
$get_User_lists = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
191 |
-
$get_Tracking_Status = Mage::getModel('sendinblue/sendinblue')->getTrackingStatus();
|
192 |
-
$value = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp();
|
193 |
-
|
194 |
-
$orders = Mage::getModel('sales/order')->getCollection();
|
195 |
-
$order = $orders->getLastItem();
|
196 |
-
|
197 |
-
$order_Data = $order->getPayment()->getData();
|
198 |
-
|
199 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
200 |
-
$orderaddress = Mage::getModel('sales/order')->loadByIncrementId($order->increment_id);
|
201 |
-
|
202 |
-
//for order sms send
|
203 |
-
if($get_Enable_Status && $get_order_status)
|
204 |
-
{
|
205 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
206 |
-
$mobile = $orderaddress->getBillingAddress()->getTelephone();
|
207 |
-
$countryid = $orderaddress->getBillingAddress()->getCountryId();
|
208 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$countryid.'" ';
|
209 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
210 |
-
$data = $connection->fetchRow($sql);
|
211 |
-
|
212 |
-
$mobile = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($mobile,$data['country_prefix']);
|
213 |
-
$email = $orderaddress->getBillingAddress()->getEmail();
|
214 |
-
$firstname = $orderaddress->getBillingAddress()->getFirstname();
|
215 |
-
$lastname = $orderaddress->getBillingAddress()->getLastname();
|
216 |
-
$ref_num = $order->getIncrementId();
|
217 |
-
$orderprice = $order->getGrandTotal();
|
218 |
-
$currencycode = $order->getBaseCurrencyCode();
|
219 |
-
$orderdate = $order->getCreatedAt();
|
220 |
-
if ($locale == 'fr_FR')
|
221 |
-
$ord_date = date('d/m/Y', strtotime($orderdate));
|
222 |
-
else
|
223 |
-
$ord_date = date('m/d/Y', strtotime($orderdate));
|
224 |
-
$total_pay = $orderprice.' '.$currencycode;
|
225 |
-
$msgbody = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
226 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
227 |
-
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
228 |
-
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
229 |
-
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
230 |
-
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
231 |
-
|
232 |
-
$arr = array();
|
233 |
-
$arr['to'] = $mobile;
|
234 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
235 |
-
$arr['text'] = $msgbody;
|
236 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
237 |
-
}
|
238 |
-
|
239 |
-
}
|
240 |
-
public function subscribedToNewsletter($observer)
|
241 |
-
{
|
242 |
-
$data = $observer->subscriber;
|
243 |
-
if($data->subscriber_status == 3)
|
244 |
-
Mage::getModel('sendinblue/sendinblue')->emailDelete($data->subscriber_email);
|
245 |
-
else if ($data->subscriber_status == 1)
|
246 |
-
Mage::getModel('sendinblue/sendinblue')->emailSubscribe($data->subscriber_email);
|
247 |
-
|
248 |
-
}
|
249 |
-
public function disableCache(Varien_Event_Observer $observer)
|
250 |
-
{
|
251 |
-
$action = $observer->getEvent()->getControllerAction();
|
252 |
-
|
253 |
-
if ($action instanceof Sendinblue_Sendinblue_Adminhtml_MyformController) { // eg. Mage_Catalog_ProductController
|
254 |
-
$request = $action->getRequest();
|
255 |
-
$cache = Mage::app()->getCacheInstance();
|
256 |
-
Mage::getSingleton('core/session')->addSuccess('Done successfully');
|
257 |
-
$cache->banUse('full_page'); // Tell Magento to 'ban' the use of FPC for this request
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php
DELETED
@@ -1,1072 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
11 |
-
{
|
12 |
-
var $api_url;
|
13 |
-
var $api_key;
|
14 |
-
var $smtp_status;
|
15 |
-
var $error_message;
|
16 |
-
var $error_code;
|
17 |
-
var $lists_ids;
|
18 |
-
var $module_enable;
|
19 |
-
var $st;
|
20 |
-
public function _construct()
|
21 |
-
{
|
22 |
-
parent::_construct();
|
23 |
-
$this->_init('sendinblue/sendinblue');
|
24 |
-
$this->MIAPI();
|
25 |
-
}
|
26 |
-
/**
|
27 |
-
* functions used for set module config
|
28 |
-
*/
|
29 |
-
public function MIAPI()
|
30 |
-
{
|
31 |
-
$scope = ($this->getScope()) ? $this->getScope() : Mage::app()->getStore()->getStoreId();
|
32 |
-
$this->module_enable = $this->getEnableStatus($scope);
|
33 |
-
$this->api_url = 'http://ws.mailin.fr/';
|
34 |
-
$this->api_url2 = 'https://www.sendinblue.com/ws/getamd/';
|
35 |
-
$this->api_key = $this->getApiKey();
|
36 |
-
if (!$this->lists_ids)
|
37 |
-
$this->lists_ids = str_replace(',', '|', $this->getUserlists($scope));
|
38 |
-
$this->CreateFolderCaseTwo();
|
39 |
-
}
|
40 |
-
|
41 |
-
public function checkMobileNumber($number, $call_prefix)
|
42 |
-
{
|
43 |
-
$number = preg_replace('/\s+/', '', $number);
|
44 |
-
$charone = substr($number, 0, 1);
|
45 |
-
$chartwo = substr($number, 0, 2);
|
46 |
-
if ($charone == '0' && $chartwo != '00')
|
47 |
-
return '00'.$call_prefix.substr($number, 1);
|
48 |
-
else if ($chartwo == '00')
|
49 |
-
return $number;
|
50 |
-
else if ($charone == '+')
|
51 |
-
return '00'.substr($number, 1);
|
52 |
-
else if ($charone != '0')
|
53 |
-
return '00'.$call_prefix.$number;
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* functions used for getting module status
|
57 |
-
*/
|
58 |
-
public function getEnableStatus()
|
59 |
-
{
|
60 |
-
$status = $this->getGeneralConfig('enabled', Mage::app()->getStore()->getStoreId());
|
61 |
-
if (!$status)
|
62 |
-
return false;
|
63 |
-
return $status;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* functions used for send order sms module status
|
67 |
-
*/
|
68 |
-
public function getOrderSmsStatus()
|
69 |
-
{
|
70 |
-
$status = $this->getGeneralConfig('sms/order', Mage::app()->getStore()->getStoreId());
|
71 |
-
if (!$status)
|
72 |
-
return false;
|
73 |
-
return $status;
|
74 |
-
}
|
75 |
-
/**
|
76 |
-
* functions used for getting notify sms status
|
77 |
-
*/
|
78 |
-
public function getNotifySmsStatus()
|
79 |
-
{
|
80 |
-
$status = $this->getGeneralConfig('sms/credit', Mage::app()->getStore()->getStoreId());
|
81 |
-
if (!$status)
|
82 |
-
return false;
|
83 |
-
return $status;
|
84 |
-
}
|
85 |
-
/**
|
86 |
-
* functions used for getting Notify value limit
|
87 |
-
*/
|
88 |
-
public function getNotifyValueStatus()
|
89 |
-
{
|
90 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Value', Mage::app()->getStore()->getStoreId());
|
91 |
-
if (!$status)
|
92 |
-
return false;
|
93 |
-
return $status;
|
94 |
-
}
|
95 |
-
/**
|
96 |
-
* functions used for getting Notify email limit
|
97 |
-
*/
|
98 |
-
public function getNotifyEmailStatus()
|
99 |
-
{
|
100 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Email', Mage::app()->getStore()->getStoreId());
|
101 |
-
if (!$status)
|
102 |
-
return false;
|
103 |
-
return $status;
|
104 |
-
}
|
105 |
-
/**
|
106 |
-
* functions used for getting Notify email limit
|
107 |
-
*/
|
108 |
-
public function getNotifyCronStatus()
|
109 |
-
{
|
110 |
-
$status = $this->getGeneralConfig('Sendin_Notify_Cron_Executed', Mage::app()->getStore()->getStoreId());
|
111 |
-
if (!$status)
|
112 |
-
return false;
|
113 |
-
return $status;
|
114 |
-
}
|
115 |
-
/**
|
116 |
-
* functions used for getting shiping sms status
|
117 |
-
*/
|
118 |
-
public function getShipingSmsStatus()
|
119 |
-
{
|
120 |
-
$status = $this->getGeneralConfig('sms/shiping', Mage::app()->getStore()->getStoreId());
|
121 |
-
if (!$status)
|
122 |
-
return false;
|
123 |
-
return $status;
|
124 |
-
}
|
125 |
-
/**
|
126 |
-
* functions used for getting campaign sms status
|
127 |
-
*/
|
128 |
-
public function getCampaignStatus()
|
129 |
-
{
|
130 |
-
$status = $this->getGeneralConfig('sms/campaign', Mage::app()->getStore()->getStoreId());
|
131 |
-
if (!$status)
|
132 |
-
return false;
|
133 |
-
return $status;
|
134 |
-
}
|
135 |
-
/**
|
136 |
-
* functions used for getting send sms order subject
|
137 |
-
*/
|
138 |
-
public function getSendSmsOrderSubject()
|
139 |
-
{
|
140 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Order', Mage::app()->getStore()->getStoreId());
|
141 |
-
if (!$status)
|
142 |
-
return false;
|
143 |
-
return $status;
|
144 |
-
}
|
145 |
-
/**
|
146 |
-
* functions used for getting order sms message
|
147 |
-
*/
|
148 |
-
public function getSendSmsmOrderMessage()
|
149 |
-
{
|
150 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Order_Message', Mage::app()->getStore()->getStoreId());
|
151 |
-
if (!$status)
|
152 |
-
return false;
|
153 |
-
return $status;
|
154 |
-
}
|
155 |
-
/**
|
156 |
-
*functions used for getting send sms shiping subject
|
157 |
-
*/
|
158 |
-
public function getSendSmsShipingSubject()
|
159 |
-
{
|
160 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Shipment', Mage::app()->getStore()->getStoreId());
|
161 |
-
if (!$status)
|
162 |
-
return false;
|
163 |
-
return $status;
|
164 |
-
}
|
165 |
-
/**
|
166 |
-
*functions used for getting shiping sms message
|
167 |
-
*/
|
168 |
-
public function getSendSmsShipingMessage()
|
169 |
-
{
|
170 |
-
$status = $this->getGeneralConfig('Sendin_Sender_Shipment_Message', Mage::app()->getStore()->getStoreId());
|
171 |
-
if (!$status)
|
172 |
-
return false;
|
173 |
-
return $status;
|
174 |
-
}
|
175 |
-
/**
|
176 |
-
* functions used for get api key
|
177 |
-
*/
|
178 |
-
public function getApiKey()
|
179 |
-
{
|
180 |
-
$apikey = $this->getGeneralConfig('api', Mage::app()->getStore()->getStoreId());
|
181 |
-
if (!$apikey)
|
182 |
-
return false;
|
183 |
-
return $apikey;
|
184 |
-
}
|
185 |
-
/**
|
186 |
-
* functions used for getting smtp status
|
187 |
-
*/
|
188 |
-
public function getSmtpStatus()
|
189 |
-
{
|
190 |
-
$status = $this->getSendinSmtpStatus('status', Mage::app()->getStore()->getStoreId());
|
191 |
-
if (!$status)
|
192 |
-
return false;
|
193 |
-
return $status;
|
194 |
-
}
|
195 |
-
/**
|
196 |
-
* functions used for getting tracking status
|
197 |
-
*/
|
198 |
-
public function getTrackingStatus()
|
199 |
-
{
|
200 |
-
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
201 |
-
if (!$status) {
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
return $status;
|
205 |
-
}
|
206 |
-
/**
|
207 |
-
* functions used for getting userlists
|
208 |
-
*/
|
209 |
-
public function getUserlists()
|
210 |
-
{
|
211 |
-
$userlist = $this->getGeneralConfig('list', Mage::app()->getStore()->getStoreId());
|
212 |
-
if (!$userlist)
|
213 |
-
return false;
|
214 |
-
return $userlist;
|
215 |
-
}
|
216 |
-
/**
|
217 |
-
* functions used for getting general config
|
218 |
-
*/
|
219 |
-
public function getGeneralConfig($field, $store = null)
|
220 |
-
{
|
221 |
-
return Mage::getStoreConfig('sendinblue/'.$field, $store);
|
222 |
-
}
|
223 |
-
/**
|
224 |
-
* functions used for get sendinsmtp status
|
225 |
-
*/
|
226 |
-
public function getSendinSmtpStatus($field, $store = null)
|
227 |
-
{
|
228 |
-
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
229 |
-
}
|
230 |
-
public function getSyncronizeStatus()
|
231 |
-
{
|
232 |
-
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
233 |
-
}
|
234 |
-
/**
|
235 |
-
* functions used for get sendin tracking status
|
236 |
-
*/
|
237 |
-
public function getSendinTrackingCodeStatus($field, $store = null)
|
238 |
-
{
|
239 |
-
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
240 |
-
}
|
241 |
-
/**
|
242 |
-
* functions used for module functionality
|
243 |
-
*/
|
244 |
-
public function getLists()
|
245 |
-
{
|
246 |
-
return $this->lists();
|
247 |
-
}
|
248 |
-
/**
|
249 |
-
* functions used for email adds
|
250 |
-
*/
|
251 |
-
public function emailAdd($email, $extra)
|
252 |
-
{
|
253 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
254 |
-
{
|
255 |
-
$apikey = $this->api_key;
|
256 |
-
if (!$apikey)
|
257 |
-
return false;
|
258 |
-
$params = array();
|
259 |
-
$params['email'] = $email;
|
260 |
-
$params['id'] = '';
|
261 |
-
$params['blacklisted'] = '';
|
262 |
-
if ($extra != null)
|
263 |
-
{
|
264 |
-
$params['attributes_name'] = 'PRENOM|NOM|CLIENT|SMS';
|
265 |
-
$params['attributes_value'] = $extra;
|
266 |
-
} else
|
267 |
-
{
|
268 |
-
$params['attributes_value'] = $email;
|
269 |
-
|
270 |
-
}
|
271 |
-
$params['listid'] = $this->lists_ids;
|
272 |
-
return $this->callServer('USERCREADITM', $params);
|
273 |
-
} else
|
274 |
-
return false;
|
275 |
-
}
|
276 |
-
/**
|
277 |
-
* functions subscribeuser
|
278 |
-
*/
|
279 |
-
public function emailSubscribe($email)
|
280 |
-
{
|
281 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
282 |
-
{
|
283 |
-
$apikey = $this->api_key;
|
284 |
-
$timezone = Mage::app()->getStore()->getConfig('general/locale/timezone');
|
285 |
-
$timez = str_replace('Calcutta', 'Kolkata', $timezone);
|
286 |
-
$tm = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
287 |
-
|
288 |
-
if (!$apikey)
|
289 |
-
return false;
|
290 |
-
$data = array();
|
291 |
-
$data['key'] = $apikey;
|
292 |
-
$data['webaction']='UPDATE-USER-SUBSCRIPTION-STATUS';
|
293 |
-
$data['timezone'] = $timez;
|
294 |
-
$data['user_status'] = $email.', '.'1'.', '.$tm;
|
295 |
-
return $this->curlRequest($data);
|
296 |
-
} else
|
297 |
-
return false;
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* functions used for sync data
|
302 |
-
*/
|
303 |
-
public function syncData()
|
304 |
-
{
|
305 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
306 |
-
{
|
307 |
-
$apikey = $this->api_key;
|
308 |
-
if (!$apikey)
|
309 |
-
return false;
|
310 |
-
$params = array();
|
311 |
-
$params['listids'] = str_replace(',', '|', $this->lists_ids);
|
312 |
-
$response = $this->callServer('DISPLAYLISTDATABLACK', $params);
|
313 |
-
$result_arr = $response->result;
|
314 |
-
$collection = Mage::getResourceModel('newsletter/subscriber_collection')->showStoreInfo()->showCustomerInfo()->toArray();
|
315 |
-
$subscriber_data = $collection['items'];
|
316 |
-
if (count($result_arr) > 0)
|
317 |
-
{
|
318 |
-
$emails = array();
|
319 |
-
foreach ($result_arr as $key => $value)
|
320 |
-
{
|
321 |
-
foreach ($value as $user_data)
|
322 |
-
{
|
323 |
-
foreach ($subscriber_data as $data)
|
324 |
-
{
|
325 |
-
$temp_sub_status = ($data['subscriber_status'] == 3) ? 1 : 0;
|
326 |
-
if (($data['subscriber_email'] == $user_data->email) && ($temp_sub_status != $user_data->blacklisted))
|
327 |
-
{
|
328 |
-
$emails[] = $data['subscriber_email'];
|
329 |
-
$subscribe_data['subscriber_id'] = $data['subscriber_id'];
|
330 |
-
$subscribe_data['subscriber_status'] = ($user_data->blacklisted == 1)?3:1;
|
331 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($data['subscriber_email']);
|
332 |
-
$costomer_data->setStatus($subscribe_data['subscriber_status']);
|
333 |
-
$costomer_data->setIsStatusChanged(true);
|
334 |
-
$costomer_data->save();
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
}
|
340 |
-
if (count($emails) > 0)
|
341 |
-
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
342 |
-
else
|
343 |
-
Mage::getSingleton('core/session')->addSuccess(count($emails).Mage::helper('sendinblue')->__(' Total of record(s) have been updated'));
|
344 |
-
return true;
|
345 |
-
}
|
346 |
-
else
|
347 |
-
return false;
|
348 |
-
}
|
349 |
-
/**
|
350 |
-
* This method is used for add email list
|
351 |
-
*/
|
352 |
-
public function addEmailList($email)
|
353 |
-
{
|
354 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
355 |
-
{
|
356 |
-
$apikey = $this->api_key;
|
357 |
-
if (!$apikey)
|
358 |
-
return false;
|
359 |
-
$params = array();
|
360 |
-
$params['email'] = $email;
|
361 |
-
$params['id'] = '';
|
362 |
-
$params['blacklisted'] = '';
|
363 |
-
$params['attributes_name'] = '';
|
364 |
-
$params['attributes_value'] = '';
|
365 |
-
$params['listid'] = $this->lists_ids;
|
366 |
-
return $this->callServer('USERCREADITM', $params);
|
367 |
-
} else
|
368 |
-
return false;
|
369 |
-
}
|
370 |
-
/**
|
371 |
-
* This method is used used for email unsubscribe
|
372 |
-
*/
|
373 |
-
public function emailDelete($email)
|
374 |
-
{
|
375 |
-
if ($this->module_enable == 1 && $this->getSyncronizeStatus())
|
376 |
-
{
|
377 |
-
$apikey = $this->api_key;
|
378 |
-
if (!$apikey)
|
379 |
-
return false;
|
380 |
-
$params = array();
|
381 |
-
$params['email'] = $email;
|
382 |
-
$params['listid'] = $this->lists_ids;
|
383 |
-
return $this->callServer('UNSUBAPI', $params);
|
384 |
-
} else
|
385 |
-
return false;
|
386 |
-
}
|
387 |
-
/**
|
388 |
-
* This method is used used for check api status
|
389 |
-
*/
|
390 |
-
public function checkApikey($api_key)
|
391 |
-
{
|
392 |
-
$params['key'] = $api_key;
|
393 |
-
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
394 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
395 |
-
return $lists['error'] = $response->errorMsg;
|
396 |
-
}
|
397 |
-
/**
|
398 |
-
* functions used for smtp details and order tracking
|
399 |
-
*/
|
400 |
-
public function SmtpDetailsWithTracking()
|
401 |
-
{
|
402 |
-
$params['key'] = $this->api_key;
|
403 |
-
$response = $this->callServer('TRACKINGDATA', $params);
|
404 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
405 |
-
{
|
406 |
-
$tracking['error'] = $response->errorMsg;
|
407 |
-
return $tracking;
|
408 |
-
}
|
409 |
-
return $response;
|
410 |
-
}
|
411 |
-
/**
|
412 |
-
* Fetches all the list of the user from the Sendinblue platform.
|
413 |
-
*/
|
414 |
-
public function lists($filters = array())
|
415 |
-
{
|
416 |
-
$params = array();
|
417 |
-
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
418 |
-
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
419 |
-
{
|
420 |
-
$this->error_message = $response->errorMsg;
|
421 |
-
$lists['error'] = $response->errorMsg;
|
422 |
-
} else
|
423 |
-
{
|
424 |
-
$i = 0;
|
425 |
-
$lists = array();
|
426 |
-
foreach ($response->result as $list_data)
|
427 |
-
{
|
428 |
-
$lists[$i]['id'] = $list_data->id;
|
429 |
-
$lists[$i]['name'] = $list_data->name;
|
430 |
-
$i++;
|
431 |
-
}
|
432 |
-
}
|
433 |
-
return $lists;
|
434 |
-
}
|
435 |
-
/**
|
436 |
-
* Fetches the list status of the user from the Sendinblue platform.
|
437 |
-
*/
|
438 |
-
public function getUserListStats()
|
439 |
-
{
|
440 |
-
if ($this->module_enable == 1)
|
441 |
-
{
|
442 |
-
$params = array();
|
443 |
-
$params['list'] = 'ALL';
|
444 |
-
return $this->callServer('DISPLAYLISTDATA', $params);
|
445 |
-
} else
|
446 |
-
return Mage::getSingleton('core/session')->addError('Sendinblue not enabled');
|
447 |
-
}
|
448 |
-
/**
|
449 |
-
* Fetches all folders and all list within each folder of the user's Sendinblue
|
450 |
-
* account and displays them to the user.
|
451 |
-
*/
|
452 |
-
public function checkFolderList()
|
453 |
-
{
|
454 |
-
$params = array();
|
455 |
-
$array = array();
|
456 |
-
$list_response = $this->callServer('DISPLAY-FOLDERS-LISTS', $params);
|
457 |
-
$list_response = json_encode($list_response);
|
458 |
-
$res = json_decode($list_response, true);
|
459 |
-
if (isset($res) && !empty($res))
|
460 |
-
{
|
461 |
-
foreach ($res as $key => $value)
|
462 |
-
{
|
463 |
-
if (strtolower($value['name']) == 'magento')
|
464 |
-
{
|
465 |
-
$array[] = $key;
|
466 |
-
$array[] = $value['name'];
|
467 |
-
}
|
468 |
-
if (!empty($value['lists']))
|
469 |
-
{
|
470 |
-
foreach ($value['lists'] as $val)
|
471 |
-
{
|
472 |
-
if (strtolower($val['name']) == 'magento')
|
473 |
-
$array[] = $val['name'];
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
477 |
-
}
|
478 |
-
return $array;
|
479 |
-
}
|
480 |
-
/**
|
481 |
-
* folder create in Sendinblue after removing from Sendinblue
|
482 |
-
*/
|
483 |
-
public function createFolderCaseTwo()
|
484 |
-
{
|
485 |
-
$apikey = $this->api_key;
|
486 |
-
if($apikey == '')
|
487 |
-
return false;
|
488 |
-
$response = $this->checkApikey($apikey); // check api key is valid or not
|
489 |
-
if ($this->module_enable != 1 && $apikey == '' && $response['error'] != '' && $this->getSyncronizeStatus())
|
490 |
-
return false;
|
491 |
-
$result = $this->checkFolderList();
|
492 |
-
$list_name = 'magento';
|
493 |
-
$param = array();
|
494 |
-
$data = array();
|
495 |
-
$folder_id = $result[0];
|
496 |
-
$exist_list = $result[2];
|
497 |
-
if (empty($result[1]))
|
498 |
-
{
|
499 |
-
$params = array();
|
500 |
-
$params['foldername'] = 'magento';
|
501 |
-
$response = $this->callServer('ADDFOLDER', $params);
|
502 |
-
$folder_id = $response->folder_id;
|
503 |
-
$params = array();
|
504 |
-
$params['listname'] = $list_name;
|
505 |
-
$params['list_parent'] = $folder_id; //folder id
|
506 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
507 |
-
$this->sendAllMailIDToSendin($list_response);
|
508 |
-
} elseif (empty($exist_list))
|
509 |
-
{
|
510 |
-
$params = array();
|
511 |
-
$params['listname'] = $list_name;
|
512 |
-
$params['list_parent'] = $folder_id; //folder id
|
513 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
514 |
-
$this->sendAllMailIDToSendin($list_response);
|
515 |
-
}
|
516 |
-
}
|
517 |
-
/**
|
518 |
-
* Method is used getambassador Services.
|
519 |
-
*/
|
520 |
-
public function amdRequest($api)
|
521 |
-
{
|
522 |
-
$data['key'] = $api;
|
523 |
-
$data['campaign_id'] = '2147';
|
524 |
-
$data['campaign_short_code'] = 'zHzc';
|
525 |
-
|
526 |
-
return $list_response = $this->curlRequest($data);
|
527 |
-
|
528 |
-
}
|
529 |
-
|
530 |
-
/**
|
531 |
-
* folder create in Sendinblue after installing
|
532 |
-
*/
|
533 |
-
public function createFolderName($api_key)
|
534 |
-
{
|
535 |
-
$this->api_key = $api_key;
|
536 |
-
$this->createAttributesName();
|
537 |
-
$result = $this->checkFolderList();
|
538 |
-
if (empty($result[1]))
|
539 |
-
{
|
540 |
-
$params = array();
|
541 |
-
$params['foldername'] = 'magento';
|
542 |
-
$response = $this->callServer('ADDFOLDER', $params);
|
543 |
-
$folder_id = $response->folder_id;
|
544 |
-
$exist_list = '';
|
545 |
-
} else
|
546 |
-
{
|
547 |
-
$folder_id = $result[0];
|
548 |
-
$exist_list = $result[2];
|
549 |
-
}
|
550 |
-
$this->createNewList($folder_id, $exist_list);
|
551 |
-
$this->partnerMagento();
|
552 |
-
}
|
553 |
-
/**
|
554 |
-
* Method is used to add the partner's name in Sendinblue.
|
555 |
-
* In this case its "MAGENTO".
|
556 |
-
*/
|
557 |
-
public function partnerMagento()
|
558 |
-
{
|
559 |
-
$params = array();
|
560 |
-
$params['partner'] = 'MAGENTO';
|
561 |
-
$this->callServer('MAILIN-PARTNER', $params);
|
562 |
-
}
|
563 |
-
/**
|
564 |
-
* Creates a list by the name "magento" on user's Sendinblue account.
|
565 |
-
*/
|
566 |
-
public function createNewList($response, $exist_list)
|
567 |
-
{
|
568 |
-
if ($exist_list != '')
|
569 |
-
{
|
570 |
-
$date = date('dmY');
|
571 |
-
$list_name = 'magento_'.$date;
|
572 |
-
}
|
573 |
-
else
|
574 |
-
$list_name = 'magento';
|
575 |
-
$params = array();
|
576 |
-
$params['listname'] = $list_name;
|
577 |
-
$params['list_parent'] = $response;
|
578 |
-
$list_response = $this->callServer('NEWLIST', $params);
|
579 |
-
$this->sendAllMailIDToSendin($list_response);
|
580 |
-
$this->createAttributesName();
|
581 |
-
}
|
582 |
-
/**
|
583 |
-
* Create Normal, Transactional, Calculated and Global attributes and their values
|
584 |
-
* on Sendinblue platform. This is necessary for the Prestashop to add subscriber's details.
|
585 |
-
*/
|
586 |
-
public function createAttributesName()
|
587 |
-
{
|
588 |
-
$params = array();
|
589 |
-
$params['normal_attributes'] = 'PRENOM,text|NOM,text|SMS,text|CLIENT,number';
|
590 |
-
$params['transactional_attributes'] = 'ORDER_ID,id|ORDER_DATE,date|ORDER_PRICE,number';
|
591 |
-
$this->callServer('ATTRIBUTES_CREATION', $params);
|
592 |
-
}
|
593 |
-
/**
|
594 |
-
* Method is used to send all the subscribers from magento to
|
595 |
-
* Sendinblue for adding / updating purpose.
|
596 |
-
*/
|
597 |
-
public function sendAllMailIDToSendin($list)
|
598 |
-
{
|
599 |
-
$allemail = $this->getcustomers();
|
600 |
-
$params = array();
|
601 |
-
$params['webaction'] = 'MULTI-USERCREADIT';
|
602 |
-
$params['key'] = $this->api_key;
|
603 |
-
$params['attributes'] = $allemail;
|
604 |
-
$params['listid'] = $list->result;
|
605 |
-
$response = $this->callServer('MULTI-USERCREADIT', $params);
|
606 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
607 |
-
$sendin_switch->saveConfig('sendinblue/list', $list->result, 'default', 0);
|
608 |
-
}
|
609 |
-
/**
|
610 |
-
* Send SMS from Sendin.
|
611 |
-
*/
|
612 |
-
public function sendSmsApi($array)
|
613 |
-
{
|
614 |
-
$params = array();
|
615 |
-
$params['key'] = $this->api_key;
|
616 |
-
$params['to'] = $array['to'];
|
617 |
-
$params['from'] = $array['from'];
|
618 |
-
$params['text'] = $array['text'];
|
619 |
-
return $this->callServer('SENDSMS', $params);
|
620 |
-
}
|
621 |
-
|
622 |
-
public function sendOrder($mobile)
|
623 |
-
{
|
624 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
625 |
-
|
626 |
-
if (isset($mobile))
|
627 |
-
{
|
628 |
-
$arr = array();
|
629 |
-
$arr['to'] = $mobile;
|
630 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
631 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
632 |
-
|
633 |
-
return $result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
634 |
-
}
|
635 |
-
|
636 |
-
}
|
637 |
-
public function notifySmsEmail()
|
638 |
-
{
|
639 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
640 |
-
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->module_enable == 1 && $this->getNotifySmsStatus() == 1)
|
641 |
-
{
|
642 |
-
if($this->getNotifyCronStatus() == 0)
|
643 |
-
{
|
644 |
-
$sendin_switch->saveConfig('Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
645 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
646 |
-
$email_template_variables = array();
|
647 |
-
if ($locale == 'fr_FR')
|
648 |
-
{
|
649 |
-
$email_template_variables['text0'] = ' [SendinBlue] Alerte: Vos crédits SMS seront bientôt épuisés';
|
650 |
-
$sender_name = 'SendinBlue';
|
651 |
-
$sender_email = 'contact@sendinblue.com';
|
652 |
-
}
|
653 |
-
else
|
654 |
-
{
|
655 |
-
$email_template_variables['text0'] = '[SendinBlue] Alert: You do not have enough credits SMS';
|
656 |
-
$sender_name = 'SendinBlue';
|
657 |
-
$sender_email = 'contact@sendinblue.com';
|
658 |
-
}
|
659 |
-
$email = $this->getNotifyEmailStatus();
|
660 |
-
|
661 |
-
$email_template = Mage::getModel('core/email_template')->loadDefault('notification_template');
|
662 |
-
$temp=$email_template->template_text;
|
663 |
-
$web_site = Mage::app()->getWebsite()->getName();
|
664 |
-
$credit = $this->getSmsCredit();
|
665 |
-
preg_match_all('#{(.*)}#', $temp, $match);
|
666 |
-
|
667 |
-
$temp_params = array(
|
668 |
-
'{site_name}'=>$web_site,
|
669 |
-
'{present_credit}'=>$credit
|
670 |
-
|
671 |
-
);
|
672 |
-
foreach($match[0] as $var=>$value){
|
673 |
-
$temp = preg_replace('#'.$value.'#',$temp_params[$value],$temp);
|
674 |
-
}
|
675 |
-
$email_template->template_text = $temp;
|
676 |
-
$email_template->getProcessedTemplate($email_template_variables);
|
677 |
-
$email_template->setSenderName($sender_name);
|
678 |
-
$email_template->setSenderEmail($sender_email);
|
679 |
-
$email_template->setTemplateSubject($email_template_variables['text0']);
|
680 |
-
return $email_template->send($email, '', $email_template_variables);
|
681 |
-
|
682 |
-
}
|
683 |
-
|
684 |
-
|
685 |
-
}
|
686 |
-
else
|
687 |
-
{
|
688 |
-
$sendin_switch->saveConfig('Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
689 |
-
}
|
690 |
-
|
691 |
-
Mage::getSingleton('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
692 |
-
}
|
693 |
-
/**
|
694 |
-
* show SMS credit from Sendinblue.
|
695 |
-
*/
|
696 |
-
public function getSmsCredit()
|
697 |
-
{
|
698 |
-
$params = array();
|
699 |
-
$params['key'] = $this->api_key;
|
700 |
-
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
701 |
-
if ($result['1']->plan_type == 'SMS')
|
702 |
-
return $result['1']->credits;
|
703 |
-
}
|
704 |
-
/**
|
705 |
-
* Method is used to send test email to the user.
|
706 |
-
*/
|
707 |
-
public function sendTestMail($email)
|
708 |
-
{
|
709 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
710 |
-
$email_template_variables = array();
|
711 |
-
if ($locale == 'fr_FR')
|
712 |
-
{
|
713 |
-
$email_template_variables['text0'] = '[SendinBlue SMTP] e-mail de test';
|
714 |
-
$sender_name = 'SendinBlue';
|
715 |
-
$sender_email = 'contact@sendinblue.com';
|
716 |
-
}
|
717 |
-
else
|
718 |
-
{
|
719 |
-
$email_template_variables['text0'] = '[SendinBlue SMTP] test email';
|
720 |
-
$sender_name = 'SendinBlue';
|
721 |
-
$sender_email = 'contact@sendinblue.com';
|
722 |
-
}
|
723 |
-
try {
|
724 |
-
$email_template = Mage::getModel('core/email_template')->loadDefault('custom_template');
|
725 |
-
$email_template->getProcessedTemplate($email_template_variables);
|
726 |
-
$email_template->setSenderName($sender_name);
|
727 |
-
$email_template->setSenderEmail($sender_email);
|
728 |
-
$email_template->setTemplateSubject($email_template_variables['text0']);
|
729 |
-
return $email_template->send($email, '', $email_template_variables);
|
730 |
-
}
|
731 |
-
catch(Exception $e) {
|
732 |
-
|
733 |
-
}
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* This method is used to fetch all users from the default customer table to list
|
738 |
-
* them in the Sendinblue magento module.
|
739 |
-
*/
|
740 |
-
public function getcustomers()
|
741 |
-
{
|
742 |
-
$data = array();
|
743 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
744 |
-
foreach ($collection as $customer)
|
745 |
-
{
|
746 |
-
|
747 |
-
$email = $customer->getData('email');
|
748 |
-
$firstname = $customer->getData('firstname');
|
749 |
-
$lastname = $customer->getData('lastname');
|
750 |
-
$cid = $customer->getData('entity_id');
|
751 |
-
|
752 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
753 |
-
$telephone = '';
|
754 |
-
foreach ($collectionAddress as $customerPhno) {
|
755 |
-
$telephone = $customerPhno->getData('telephone');
|
756 |
-
$country_id = $customerPhno->getData('country_id');
|
757 |
-
}
|
758 |
-
|
759 |
-
$customer_select[$email] = array(
|
760 |
-
'email' => $email,
|
761 |
-
'PRENOM' => $firstname,
|
762 |
-
'NOM' => $lastname,
|
763 |
-
'SMS' => $telephone,
|
764 |
-
'country_id' => $country_id,
|
765 |
-
'CLIENT' => $cid>0?1:0
|
766 |
-
);
|
767 |
-
}
|
768 |
-
|
769 |
-
$newsletterArr = array();
|
770 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
771 |
-
$cnt = 0;
|
772 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
773 |
-
{
|
774 |
-
$customer_id = $subscriber->getCustomerId();;
|
775 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
776 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
777 |
-
|
778 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
779 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
780 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
781 |
-
unset($customer_select[$subscriber_email]);
|
782 |
-
}
|
783 |
-
else {
|
784 |
-
$newsletterArr[$cnt] = array(
|
785 |
-
'email' => $subscriber_email,
|
786 |
-
'PRENOM' => '',
|
787 |
-
'NOM' => '',
|
788 |
-
'SMS' => '',
|
789 |
-
'country_id' => ''
|
790 |
-
);
|
791 |
-
$newsletterArr[$cnt]['CLIENT'] = $customer_id>0?1:0;
|
792 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
793 |
-
}
|
794 |
-
$cnt++;
|
795 |
-
}
|
796 |
-
|
797 |
-
return json_encode($newsletterArr);
|
798 |
-
}
|
799 |
-
/**
|
800 |
-
* This method is used to fetch all users from the default newsletter table to list
|
801 |
-
* them in the Sendinblue magento module.
|
802 |
-
*/
|
803 |
-
public function getNewsletterSubscribe($start, $per_page)
|
804 |
-
{
|
805 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
806 |
-
foreach ($collection as $customer)
|
807 |
-
{
|
808 |
-
|
809 |
-
$email = $customer->getData('email');
|
810 |
-
$firstname = $customer->getData('firstname');
|
811 |
-
$lastname = $customer->getData('lastname');
|
812 |
-
$cid = $customer->getData('entity_id');
|
813 |
-
|
814 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
815 |
-
$telephone = '';
|
816 |
-
foreach ($collectionAddress as $customerPhno) {
|
817 |
-
$telephone = $customerPhno->getData('telephone');
|
818 |
-
$country_id = $customerPhno->getData('country_id');
|
819 |
-
}
|
820 |
-
|
821 |
-
$customer_select[$email] = array(
|
822 |
-
'email' => $email,
|
823 |
-
'firstname' => $firstname,
|
824 |
-
'lastname' => $lastname,
|
825 |
-
'telephone' => $telephone,
|
826 |
-
'country_id' => $country_id,
|
827 |
-
'customer_id' => $cid
|
828 |
-
);
|
829 |
-
}
|
830 |
-
|
831 |
-
$newsletterArr = array();
|
832 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
833 |
-
|
834 |
-
$cnt = 0;
|
835 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
836 |
-
{
|
837 |
-
$customer_id = $subscriber->getCustomerId();;
|
838 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
839 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
840 |
-
|
841 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
842 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
843 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
844 |
-
unset($customer_select[$subscriber_email]);
|
845 |
-
}
|
846 |
-
else {
|
847 |
-
$newsletterArr[$cnt] = array(
|
848 |
-
'email' => $subscriber_email,
|
849 |
-
'firstname' => '',
|
850 |
-
'lastname' => '',
|
851 |
-
'telephone' => '',
|
852 |
-
'country_id' => ''
|
853 |
-
);
|
854 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
855 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
856 |
-
}
|
857 |
-
$cnt++;
|
858 |
-
}
|
859 |
-
|
860 |
-
if ( count($customer_select) > 0 ) {
|
861 |
-
foreach ( $customer_select as $cData ) {
|
862 |
-
$newsletterArr[$cnt] = $cData;
|
863 |
-
$newsletterArr[$cnt]['subscriber_status'] = 3;
|
864 |
-
$cnt++;
|
865 |
-
}
|
866 |
-
}
|
867 |
-
|
868 |
-
return array_slice($newsletterArr, $start, $per_page, true);
|
869 |
-
}
|
870 |
-
/**
|
871 |
-
* This method is used to fetch total count users from the default newsletter table to list
|
872 |
-
* them in the Sendinblue magento module.
|
873 |
-
*/
|
874 |
-
public function getTotalCount()
|
875 |
-
{
|
876 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
877 |
-
foreach ($collection as $customer)
|
878 |
-
{
|
879 |
-
|
880 |
-
$email = $customer->getData('email');
|
881 |
-
$firstname = $customer->getData('firstname');
|
882 |
-
$lastname = $customer->getData('lastname');
|
883 |
-
$cid = $customer->getData('entity_id');
|
884 |
-
|
885 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
886 |
-
$telephone = '';
|
887 |
-
foreach ($collectionAddress as $customerPhno) {
|
888 |
-
$telephone = $customerPhno->getData('telephone');
|
889 |
-
$country_id = $customerPhno->getData('country_id');
|
890 |
-
}
|
891 |
-
|
892 |
-
$customer_select[$email] = array(
|
893 |
-
'email' => $email,
|
894 |
-
'firstname' => $firstname,
|
895 |
-
'lastname' => $lastname,
|
896 |
-
'telephone' => $telephone,
|
897 |
-
'country_id' => $country_id,
|
898 |
-
'customer_id' => $cid
|
899 |
-
);
|
900 |
-
}
|
901 |
-
|
902 |
-
$newsletterArr = array();
|
903 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
904 |
-
|
905 |
-
$cnt = 0;
|
906 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
907 |
-
{
|
908 |
-
$customer_id = $subscriber->getCustomerId();;
|
909 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
910 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
911 |
-
|
912 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
913 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
914 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
915 |
-
unset($customer_select[$subscriber_email]);
|
916 |
-
}
|
917 |
-
else {
|
918 |
-
$newsletterArr[$cnt] = array(
|
919 |
-
'email' => $subscriber_email,
|
920 |
-
'firstname' => '',
|
921 |
-
'lastname' => '',
|
922 |
-
'telephone' => '',
|
923 |
-
'country_id' => ''
|
924 |
-
);
|
925 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
926 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
927 |
-
}
|
928 |
-
$cnt++;
|
929 |
-
}
|
930 |
-
|
931 |
-
if ( count($customer_select) > 0 ) {
|
932 |
-
foreach ( $customer_select as $cData ) {
|
933 |
-
$newsletterArr[$cnt] = $cData;
|
934 |
-
$newsletterArr[$cnt]['subscriber_status'] = 3;
|
935 |
-
$cnt++;
|
936 |
-
}
|
937 |
-
}
|
938 |
-
|
939 |
-
return count($newsletterArr);
|
940 |
-
}
|
941 |
-
/**
|
942 |
-
* This method is used to fetch total count unsubscribe users from the default newsletter table to list
|
943 |
-
* them in the Sendinblue magento module.
|
944 |
-
*/
|
945 |
-
public function getNewsletterUnSubscribeCount()
|
946 |
-
{
|
947 |
-
$sql = 'SELECT count(*) as totalcoutn FROM customer_entity CE
|
948 |
-
LEFT JOIN newsletter_subscriber
|
949 |
-
ON CE.entity_id=newsletter_subscriber.customer_id WHERE subscriber_status != 1 or subscriber_status is null';
|
950 |
-
$unsubs_count1 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
951 |
-
|
952 |
-
$sql = 'SELECT count(*) as totalcoutn FROM newsletter_subscriber WHERE customer_id = 0 AND subscriber_status = 3';
|
953 |
-
$unsubs_count2 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
954 |
-
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
955 |
-
|
956 |
-
}
|
957 |
-
/**
|
958 |
-
* This method is used to fetch total count subscribe users from the default newsletter table to list
|
959 |
-
* them in the Sendinblue magento module.
|
960 |
-
*/
|
961 |
-
public function getNewsletterSubscribeCount()
|
962 |
-
{
|
963 |
-
$sql = 'SELECT count(*) as totalvalue from newsletter_subscriber where subscriber_status = 1';
|
964 |
-
$data = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
965 |
-
return $data['totalvalue'];
|
966 |
-
}
|
967 |
-
/**
|
968 |
-
* This method is used to check the subscriber's newsletter subscription status in Sendinblue
|
969 |
-
*/
|
970 |
-
public function checkUserSendinStatus($result)
|
971 |
-
{
|
972 |
-
$userstatus = array();
|
973 |
-
foreach ($result as $subscriber)
|
974 |
-
$userstatus[] = $subscriber['email'];
|
975 |
-
$email = implode(',', $userstatus);
|
976 |
-
$params = array();
|
977 |
-
$params['key'] = $this->api_key;
|
978 |
-
$params['email'] = $email;
|
979 |
-
$response = $this->callServer('USERS-STATUS', $params);
|
980 |
-
$response = json_encode($response);
|
981 |
-
return json_decode($response, true);
|
982 |
-
}
|
983 |
-
/**
|
984 |
-
* Fetches the SMTP and order tracking details
|
985 |
-
*/
|
986 |
-
public function TrackingSmtp()
|
987 |
-
{
|
988 |
-
$params = array();
|
989 |
-
$params['key'] = $this->api_key;
|
990 |
-
return $this->callServer('TRACKINGDATA', $params);
|
991 |
-
}
|
992 |
-
/**
|
993 |
-
* CURL function to send request to the Sendinblue API server
|
994 |
-
*/
|
995 |
-
public function callServer($method, $params)
|
996 |
-
{
|
997 |
-
$host = $this->api_url;
|
998 |
-
$params['key'] = (isset($params['key']) && !empty($params['key'])) ? $params['key'] : $this->api_key;
|
999 |
-
$params['webaction'] = $method;
|
1000 |
-
$this->error_message = '';
|
1001 |
-
$this->error_code = '';
|
1002 |
-
$response = $this->curlRequest($params);
|
1003 |
-
return json_decode($response);
|
1004 |
-
}
|
1005 |
-
/**
|
1006 |
-
* CURL function to send request to the Sendinblue API server
|
1007 |
-
*/
|
1008 |
-
public function curlRequest($data)
|
1009 |
-
{
|
1010 |
-
$url1 = $this->api_url;
|
1011 |
-
$url2 = $this->api_url2;
|
1012 |
-
if (array_key_exists('campaign_short_code', $data))
|
1013 |
-
$url = $url2; // WS URL
|
1014 |
-
else
|
1015 |
-
$url = $url1; // WS URL
|
1016 |
-
$ch = curl_init();
|
1017 |
-
$ndata = '';
|
1018 |
-
if (is_array($data))
|
1019 |
-
{
|
1020 |
-
foreach ($data as $key => $value)
|
1021 |
-
$ndata .= $key.'='.urlencode($value).'&';
|
1022 |
-
} else
|
1023 |
-
$ndata = $data;
|
1024 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1025 |
-
'Expect:'
|
1026 |
-
));
|
1027 |
-
|
1028 |
-
$ndata = trim($ndata,'&');
|
1029 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1030 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
1031 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1032 |
-
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1033 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1034 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
1035 |
-
$data2 = curl_exec($ch);
|
1036 |
-
curl_close($ch);
|
1037 |
-
return $data2;
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
public function removeOldEntry()
|
1041 |
-
{
|
1042 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
1043 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', '');
|
1044 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', '');
|
1045 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', '');
|
1046 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', '');
|
1047 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', '');
|
1048 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', '');
|
1049 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', '');
|
1050 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', '');
|
1051 |
-
$sendin_switch->saveConfig('sendinblue/tracking/code', '');
|
1052 |
-
}
|
1053 |
-
protected function _uninstallResourceDb($version)
|
1054 |
-
{
|
1055 |
-
Mage::dispatchEvent('module_uninstall', array('resource' => $this->_resourceName));
|
1056 |
-
|
1057 |
-
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1058 |
-
return $this;
|
1059 |
-
}
|
1060 |
-
/**
|
1061 |
-
* API config value from SendinBlue.
|
1062 |
-
*/
|
1063 |
-
public function getApiConfigValue()
|
1064 |
-
{
|
1065 |
-
$data = array();
|
1066 |
-
$data['key'] = $this->api_key;
|
1067 |
-
$data['webaction'] = 'PLUGIN-CONFIG';
|
1068 |
-
$value_config = $this->curlRequest($data);
|
1069 |
-
$result = json_decode($value_config);
|
1070 |
-
return $result;
|
1071 |
-
}
|
1072 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
DELETED
@@ -1,520 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
-
{
|
13 |
-
public function indexAction()
|
14 |
-
{
|
15 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderCaseTwo();
|
16 |
-
$this->loadLayout();
|
17 |
-
$this->renderLayout();
|
18 |
-
|
19 |
-
}
|
20 |
-
public function syncronizepostAction()
|
21 |
-
{
|
22 |
-
$post = $this->getRequest()->getPost();
|
23 |
-
try {
|
24 |
-
if (empty($post))
|
25 |
-
Mage::throwException($this->__('Invalid form data.'));
|
26 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
27 |
-
if (isset($post['syncronizeSubmit']))
|
28 |
-
{
|
29 |
-
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
30 |
-
if (!empty($post['sendin_list']))
|
31 |
-
{
|
32 |
-
$list = implode('|', $post['sendin_list']);
|
33 |
-
$sendin_switch->saveConfig('sendinblue/list', $list);
|
34 |
-
$message = $this->__('Your setting has been successfully saved');
|
35 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
36 |
-
} else
|
37 |
-
{
|
38 |
-
$message = $this->__('Please select a list');
|
39 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
catch (Exception $e)
|
44 |
-
{
|
45 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
46 |
-
}
|
47 |
-
$this->_redirect('*/*');
|
48 |
-
}
|
49 |
-
public function apikeypostAction()
|
50 |
-
{
|
51 |
-
$post = $this->getRequest()->getPost();
|
52 |
-
try {
|
53 |
-
if (empty($post))
|
54 |
-
Mage::throwException($this->__('Invalid form data.'));
|
55 |
-
elseif (isset($post['sendin_apikey']) && !empty($post['sendin_apikey']))
|
56 |
-
{
|
57 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
58 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey(trim($post['sendin_apikey']));
|
59 |
-
if (empty($result['error']))
|
60 |
-
{
|
61 |
-
Mage::getModel('sendinblue/sendinblue')->amdRequest(trim($post['sendin_apikey']));
|
62 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
63 |
-
if ($get_key == '')
|
64 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderName($post['sendin_apikey']);
|
65 |
-
elseif ($get_key != $post['sendin_apikey'])
|
66 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderName($post['sendin_apikey']);
|
67 |
-
|
68 |
-
$sendin_switch->saveConfig('sendinblue/api', trim($post['sendin_apikey']));
|
69 |
-
$sendin_switch->saveConfig('sendinblue/enabled', $post['sendin_api_status']);
|
70 |
-
$sendin_switch->saveConfig('sendinblue/syncronize', 1);
|
71 |
-
Mage::getModel('sendinblue/sendinblue')->removeOldEntry();
|
72 |
-
$message = $this->__('Your setting has been successfully saved');
|
73 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
74 |
-
} else if (isset($result['error']))
|
75 |
-
{
|
76 |
-
$message = $this->__('You have entered wrong api key');
|
77 |
-
Mage::getSingleton('core/session')->addError($message);
|
78 |
-
}
|
79 |
-
}
|
80 |
-
}
|
81 |
-
catch (Exception $e)
|
82 |
-
{
|
83 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
84 |
-
}
|
85 |
-
$this->_redirect('*/*');
|
86 |
-
}
|
87 |
-
public function sendmailAction()
|
88 |
-
{
|
89 |
-
$post = $this->getRequest()->getPost();
|
90 |
-
|
91 |
-
try {
|
92 |
-
if (empty($post))
|
93 |
-
Mage::throwException($this->__('Invalid form data.'));
|
94 |
-
elseif (isset($post['SmtpSubmit']) && !empty($post['SmtpSubmit']))
|
95 |
-
{
|
96 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
97 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
98 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey($get_key);
|
99 |
-
if (empty($result['error']))
|
100 |
-
{
|
101 |
-
$smtp_response = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp(); // get tracking code
|
102 |
-
|
103 |
-
if ($smtp_response->result->relay_data->status == 'enabled')
|
104 |
-
{
|
105 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
106 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
107 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
108 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
109 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
110 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
111 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
112 |
-
if ($post['email'])
|
113 |
-
{
|
114 |
-
$data11 = Mage::getModel('sendinblue/sendinblue')->sendTestMail($post['email']);
|
115 |
-
$resArr = json_decode($data11, true);
|
116 |
-
if ($resArr['result'] != true) {
|
117 |
-
$message = $this->__('Mail not sent').' '.$this->__(trim($resArr['error']));
|
118 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
119 |
-
}
|
120 |
-
else {
|
121 |
-
$message = $this->__('Mail sent!');
|
122 |
-
Mage::getSingleton('core/session')->addSuccess($message);
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
} else
|
127 |
-
{
|
128 |
-
$message = $this->__('Mail not sent');
|
129 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
else
|
133 |
-
{
|
134 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
135 |
-
$message = $this->__('Your SMTP account is not activated and therefore you can not use SendinBlue SMTP. For more informations, Please contact our support to: contact@sendinblue.com');
|
136 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
137 |
-
|
138 |
-
}
|
139 |
-
} elseif (isset($responce['error']))
|
140 |
-
{
|
141 |
-
$message = $this->__('You have entered wrong api key');
|
142 |
-
Mage::getSingleton('core/session')->addError($message);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
146 |
-
catch (Exception $e)
|
147 |
-
{
|
148 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
149 |
-
}
|
150 |
-
$this->_redirect('*/*');
|
151 |
-
}
|
152 |
-
public function sendorderAction()
|
153 |
-
{
|
154 |
-
$post = $this->getRequest()->getPost();
|
155 |
-
try
|
156 |
-
{
|
157 |
-
if (empty($post))
|
158 |
-
Mage::throwException($this->__('Invalid form data.'));
|
159 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
160 |
-
if (isset($post['sender_order_save']))
|
161 |
-
{
|
162 |
-
$sender_order = $post['sender_order'];
|
163 |
-
$sender_order_message = $post['sender_order_message'];
|
164 |
-
|
165 |
-
if (isset($sender_order) && $sender_order == '')
|
166 |
-
{
|
167 |
-
$message = $this->__('Please fill the message field');
|
168 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
169 |
-
}
|
170 |
-
else if ($sender_order_message == '')
|
171 |
-
{
|
172 |
-
$message = $this->__('Please fill the message field');
|
173 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
174 |
-
}
|
175 |
-
else
|
176 |
-
{
|
177 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order', $sender_order);
|
178 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Order_Message', $sender_order_message);
|
179 |
-
$message = $this->__('Your setting has been successfully saved');
|
180 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
181 |
-
}
|
182 |
-
|
183 |
-
}
|
184 |
-
}
|
185 |
-
catch (Exception $e)
|
186 |
-
{
|
187 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
188 |
-
}
|
189 |
-
$this->_redirect('*/*');
|
190 |
-
}
|
191 |
-
public function sendshipmentAction()
|
192 |
-
{
|
193 |
-
$post = $this->getRequest()->getPost();
|
194 |
-
try {
|
195 |
-
if (empty($post))
|
196 |
-
Mage::throwException($this->__('Invalid form data.'));
|
197 |
-
|
198 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
199 |
-
if (isset($post['sender_shipment_save']))
|
200 |
-
{
|
201 |
-
$sender_shipment = $post['sender_shipment'];
|
202 |
-
$sender_shipment_message = $post['sender_shipment_message'];
|
203 |
-
|
204 |
-
if (isset($sender_shipment) && $sender_shipment == '')
|
205 |
-
{
|
206 |
-
$message = $this->__('Please fill the message field');
|
207 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
208 |
-
}
|
209 |
-
else if ($sender_shipment_message == '')
|
210 |
-
{
|
211 |
-
$message = $this->__('Please fill the message field');
|
212 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
213 |
-
}
|
214 |
-
else
|
215 |
-
{
|
216 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment', $sender_shipment);
|
217 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Sender_Shipment_Message', $sender_shipment_message);
|
218 |
-
$message = $this->__('Your setting has been successfully saved');
|
219 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
220 |
-
}
|
221 |
-
|
222 |
-
}
|
223 |
-
}
|
224 |
-
catch (Exception $e)
|
225 |
-
{
|
226 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
227 |
-
}
|
228 |
-
$this->_redirect('*/*');
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* This method is called when the user test Shipment Sms and hits the submit button.
|
233 |
-
*/
|
234 |
-
|
235 |
-
public function sendordertestAction()
|
236 |
-
{
|
237 |
-
$post = $this->getRequest()->getPost();
|
238 |
-
try {
|
239 |
-
if (empty($post))
|
240 |
-
Mage::throwException($this->__('Invalid form data.'));
|
241 |
-
|
242 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
243 |
-
|
244 |
-
if (isset($post['sender_order_submit']))
|
245 |
-
{
|
246 |
-
$arr = array();
|
247 |
-
$arr['to'] = $post['sender_order_number'];
|
248 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsOrderSubject();
|
249 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage();
|
250 |
-
|
251 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
252 |
-
|
253 |
-
if (isset($result->status) && $result->status == 'OK')
|
254 |
-
{
|
255 |
-
$message = $this->__('Message has been sent successfully');
|
256 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
257 |
-
}
|
258 |
-
else
|
259 |
-
{
|
260 |
-
$message = $this->__('Message has not been sent successfully');
|
261 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
262 |
-
}
|
263 |
-
|
264 |
-
}
|
265 |
-
}
|
266 |
-
catch (Exception $e)
|
267 |
-
{
|
268 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
269 |
-
}
|
270 |
-
$this->_redirect('*/*');
|
271 |
-
}
|
272 |
-
|
273 |
-
|
274 |
-
/**
|
275 |
-
* This method is called when the user test Shipment Sms and hits the submit button.
|
276 |
-
*/
|
277 |
-
|
278 |
-
public function sendshipmenttestAction()
|
279 |
-
{
|
280 |
-
$post = $this->getRequest()->getPost();
|
281 |
-
try {
|
282 |
-
if (empty($post))
|
283 |
-
Mage::throwException($this->__('Invalid form data.'));
|
284 |
-
|
285 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
286 |
-
|
287 |
-
if (isset($post['sender_shipment_submit']))
|
288 |
-
{
|
289 |
-
$arr = array();
|
290 |
-
$arr['to'] = $post['sender_shipment_number'];
|
291 |
-
$arr['from'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingSubject();
|
292 |
-
$arr['text'] = Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage();
|
293 |
-
|
294 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
295 |
-
|
296 |
-
if (isset($result->status) && $result->status == 'OK')
|
297 |
-
{
|
298 |
-
$message = $this->__('Message has been sent successfully');
|
299 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
300 |
-
}
|
301 |
-
else
|
302 |
-
{
|
303 |
-
$message = $this->__('Message has not been sent successfully');
|
304 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
305 |
-
}
|
306 |
-
|
307 |
-
}
|
308 |
-
}
|
309 |
-
catch (Exception $e)
|
310 |
-
{
|
311 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
312 |
-
}
|
313 |
-
$this->_redirect('*/*');
|
314 |
-
}
|
315 |
-
|
316 |
-
public function sendnotifysmsAction()
|
317 |
-
{
|
318 |
-
$post = $this->getRequest()->getPost();
|
319 |
-
try {
|
320 |
-
if (empty($post))
|
321 |
-
Mage::throwException($this->__('Invalid form data.'));
|
322 |
-
|
323 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
324 |
-
|
325 |
-
if (isset($post['notify_sms_mail']))
|
326 |
-
{
|
327 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Value', $post['sendin_notify_value']);
|
328 |
-
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Email', $post['sendin_notify_email']);
|
329 |
-
$message = $this->__('Your setting has been successfully saved');
|
330 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
331 |
-
}
|
332 |
-
}
|
333 |
-
catch (Exception $e)
|
334 |
-
{
|
335 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
336 |
-
}
|
337 |
-
$this->_redirect('*/*');
|
338 |
-
|
339 |
-
}
|
340 |
-
|
341 |
-
|
342 |
-
public function sendcampaignAction()
|
343 |
-
{
|
344 |
-
$post = $this->getRequest()->getPost();
|
345 |
-
try {
|
346 |
-
if (empty($post))
|
347 |
-
Mage::throwException($this->__('Invalid form data.'));
|
348 |
-
|
349 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
350 |
-
|
351 |
-
if (isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 1)
|
352 |
-
{
|
353 |
-
$arr = array();
|
354 |
-
$arr['to'] = $post['singlechoice'];
|
355 |
-
$arr['from'] = $post['sender_campaign'];
|
356 |
-
$arr['text'] = $post['sender_campaign_message'];
|
357 |
-
|
358 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
359 |
-
if (isset($result->status) && $result->status == 'OK')
|
360 |
-
{
|
361 |
-
$message = $this->__('Message has been sent successfully');
|
362 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
363 |
-
}
|
364 |
-
else
|
365 |
-
{
|
366 |
-
$message = $this->__('Message has not been sent successfully');
|
367 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
368 |
-
}
|
369 |
-
|
370 |
-
|
371 |
-
}else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 0)
|
372 |
-
{
|
373 |
-
$smscredit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
374 |
-
$collection = Mage::getModel('customer/customer')
|
375 |
-
->getCollection()
|
376 |
-
->addAttributeToSelect('*')
|
377 |
-
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
378 |
-
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left');
|
379 |
-
|
380 |
-
$results = array();
|
381 |
-
foreach ($collection as $customer) {
|
382 |
-
$results[] = $customer->toArray();
|
383 |
-
}
|
384 |
-
|
385 |
-
//$count = count($result);
|
386 |
-
foreach ($results as $i => $result)
|
387 |
-
{
|
388 |
-
|
389 |
-
if(!empty($result['shipping_telephone']))
|
390 |
-
{
|
391 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$result['shipping_country_code'].'" ';
|
392 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
393 |
-
$data = $connection->fetchRow($sql);
|
394 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($result['shipping_telephone'],$data['country_prefix']);
|
395 |
-
$firstname = $result['firstname'];
|
396 |
-
$lastname = $result['lastname'];
|
397 |
-
$msgbody = $post['sender_campaign_message'];
|
398 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
399 |
-
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
400 |
-
$arr = array();
|
401 |
-
$arr['to'] = $number;
|
402 |
-
$arr['from'] = $post['sender_campaign'];
|
403 |
-
$arr['text'] = $msgbody;
|
404 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
405 |
-
}
|
406 |
-
}
|
407 |
-
if ($smscredit >= 1)
|
408 |
-
{
|
409 |
-
$message = $this->__('Message has been sent successfully');
|
410 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
411 |
-
}
|
412 |
-
else
|
413 |
-
{
|
414 |
-
$message = $this->__('Message has not been sent successfully');
|
415 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
416 |
-
}
|
417 |
-
|
418 |
-
}
|
419 |
-
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
420 |
-
{
|
421 |
-
$smscredit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
422 |
-
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
423 |
-
foreach ($collection as $customer)
|
424 |
-
{
|
425 |
-
|
426 |
-
$email = $customer->getData('email');
|
427 |
-
$firstname = $customer->getData('firstname');
|
428 |
-
$lastname = $customer->getData('lastname');
|
429 |
-
$cid = $customer->getData('entity_id');
|
430 |
-
|
431 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
432 |
-
$telephone = '';
|
433 |
-
foreach ($collectionAddress as $customerPhno) {
|
434 |
-
$telephone = $customerPhno->getData('telephone');
|
435 |
-
$country_id = $customerPhno->getData('country_id');
|
436 |
-
}
|
437 |
-
|
438 |
-
$customer_select[$email] = array(
|
439 |
-
'email' => $email,
|
440 |
-
'firstname' => $firstname,
|
441 |
-
'lastname' => $lastname,
|
442 |
-
'telephone' => $telephone,
|
443 |
-
'country_id' => $country_id,
|
444 |
-
'customer_id' => $cid
|
445 |
-
);
|
446 |
-
}
|
447 |
-
|
448 |
-
$newsletterArr = array();
|
449 |
-
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
450 |
-
$cnt = 0;
|
451 |
-
foreach ( $newsletter->getItems() as $subscriber )
|
452 |
-
{
|
453 |
-
$customer_id = $subscriber->getCustomerId();;
|
454 |
-
$subscriber_email = $subscriber->getSubscriberEmail();
|
455 |
-
$subscriber_status = $subscriber->getSubscriberStatus();
|
456 |
-
|
457 |
-
if ( !empty($customer_select[$subscriber_email]) ) {
|
458 |
-
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
459 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
460 |
-
unset($customer_select[$subscriber_email]);
|
461 |
-
}
|
462 |
-
else {
|
463 |
-
$newsletterArr[$cnt] = array(
|
464 |
-
'email' => $subscriber_email,
|
465 |
-
'firstname' => '',
|
466 |
-
'lastname' => '',
|
467 |
-
'telephone' => '',
|
468 |
-
'country_id' => ''
|
469 |
-
);
|
470 |
-
$newsletterArr[$cnt]['customer_id'] = $customer_id;
|
471 |
-
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
472 |
-
}
|
473 |
-
$cnt++;
|
474 |
-
}
|
475 |
-
foreach($newsletterArr as $result)
|
476 |
-
{
|
477 |
-
|
478 |
-
|
479 |
-
if(!empty($result['telephone']))
|
480 |
-
{
|
481 |
-
|
482 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$result['country_id'].'" ';
|
483 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
484 |
-
$data = $connection->fetchRow($sql);
|
485 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($result['telephone'],$data['country_prefix']);
|
486 |
-
$msgbody = $post['sender_campaign_message'];
|
487 |
-
$firstname = $result['firstname'];
|
488 |
-
$lastname = $result['lastname'];
|
489 |
-
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
490 |
-
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
491 |
-
$arr = array();
|
492 |
-
$arr['to'] = $number;
|
493 |
-
$arr['from'] = $post['sender_campaign'];
|
494 |
-
$arr['text'] = $msgbody;
|
495 |
-
Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
496 |
-
|
497 |
-
|
498 |
-
}
|
499 |
-
}
|
500 |
-
if ($smscredit >= 1)
|
501 |
-
{
|
502 |
-
$message = $this->__('Message has been sent successfully');
|
503 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
504 |
-
}
|
505 |
-
else
|
506 |
-
{
|
507 |
-
$message = $this->__('Message has not been sent successfully');
|
508 |
-
Mage::getSingleton('adminhtml/session')->addError($message);
|
509 |
-
}
|
510 |
-
}
|
511 |
-
|
512 |
-
}
|
513 |
-
catch (Exception $e)
|
514 |
-
{
|
515 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
516 |
-
}
|
517 |
-
$this->_redirect('*/*');
|
518 |
-
}
|
519 |
-
|
520 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php
DELETED
@@ -1,473 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Action
|
12 |
-
{
|
13 |
-
public function indexAction()
|
14 |
-
{
|
15 |
-
$this->loadLayout();
|
16 |
-
$this->renderLayout();
|
17 |
-
Mage::getModel('sendinblue/sendinblue')->createFolderCaseTwo();
|
18 |
-
}
|
19 |
-
|
20 |
-
public function campaignAction()
|
21 |
-
{
|
22 |
-
$post = $this->getRequest()->getPost();
|
23 |
-
try {
|
24 |
-
if (empty($post))
|
25 |
-
echo Mage::throwException($this->__('Invalid form data.'));
|
26 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
27 |
-
$sendin_switch->saveConfig('sendinblue/sms/campaign', $post['campaignSetting']);
|
28 |
-
echo $this->__('Your setting has been successfully saved');
|
29 |
-
}
|
30 |
-
catch (Exception $e)
|
31 |
-
{
|
32 |
-
echo $this->__($e->getMessage());
|
33 |
-
}
|
34 |
-
}
|
35 |
-
public function orderAction()
|
36 |
-
{
|
37 |
-
$post = $this->getRequest()->getPost();
|
38 |
-
try {
|
39 |
-
if (empty($post))
|
40 |
-
Mage::throwException($this->__('Invalid form data.'));
|
41 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
42 |
-
$sendin_switch->saveConfig('sendinblue/sms/order', $post['orderSetting']);
|
43 |
-
echo $this->__('Your setting has been successfully saved');
|
44 |
-
}
|
45 |
-
catch (Exception $e)
|
46 |
-
{
|
47 |
-
echo $this->__($e->getMessage());
|
48 |
-
}
|
49 |
-
}
|
50 |
-
public function creditAction()
|
51 |
-
{
|
52 |
-
$post = $this->getRequest()->getPost();
|
53 |
-
try {
|
54 |
-
if (empty($post))
|
55 |
-
Mage::throwException($this->__('Invalid form data.'));
|
56 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
57 |
-
$sendin_switch->saveConfig('sendinblue/sms/credit', $post['sms_credit']);
|
58 |
-
echo $this->__('Your setting has been successfully saved');
|
59 |
-
}
|
60 |
-
catch (Exception $e)
|
61 |
-
{
|
62 |
-
echo $this->__($e->getMessage());
|
63 |
-
}
|
64 |
-
}
|
65 |
-
public function shipingAction()
|
66 |
-
{
|
67 |
-
$post = $this->getRequest()->getPost();
|
68 |
-
try {
|
69 |
-
if (empty($post))
|
70 |
-
Mage::throwException($this->__('Invalid form data.'));
|
71 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
72 |
-
$sendin_switch->saveConfig('sendinblue/sms/shiping', $post['shipingSetting']);
|
73 |
-
echo $this->__('Your setting has been successfully saved');
|
74 |
-
}
|
75 |
-
catch (Exception $e)
|
76 |
-
{
|
77 |
-
echo $this->__($e->getMessage());
|
78 |
-
}
|
79 |
-
}
|
80 |
-
public function codepostAction()
|
81 |
-
{
|
82 |
-
$post = $this->getRequest()->getPost();
|
83 |
-
try {
|
84 |
-
if (empty($post))
|
85 |
-
Mage::throwException($this->__('Invalid form data.'));
|
86 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
87 |
-
$sendin_switch->saveConfig('sendinblue/tracking/code', $post['script']);
|
88 |
-
echo $this->__('Your setting has been successfully saved');
|
89 |
-
}
|
90 |
-
catch (Exception $e)
|
91 |
-
{
|
92 |
-
echo $this->__($e->getMessage());
|
93 |
-
}
|
94 |
-
}
|
95 |
-
public function smtppostAction()
|
96 |
-
{
|
97 |
-
$post = $this->getRequest()->getPost();
|
98 |
-
try {
|
99 |
-
if (empty($post))
|
100 |
-
Mage::throwException($this->__('Invalid form data.'));
|
101 |
-
else
|
102 |
-
{
|
103 |
-
$sendin_switch = new Mage_Core_Model_Config();
|
104 |
-
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
105 |
-
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey($get_key);
|
106 |
-
if (empty($result['error']))
|
107 |
-
{
|
108 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', $post['smtptest']);
|
109 |
-
$smtp_response = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp(); // get tracking code
|
110 |
-
if ($smtp_response->result->relay_data->status == 'enabled')
|
111 |
-
{
|
112 |
-
$sendin_switch->saveConfig('sendinblue/smtp/authentication', 'crammd5', 'default', 0);
|
113 |
-
$sendin_switch->saveConfig('sendinblue/smtp/username', $smtp_response->result->relay_data->data->username, 'default', 0);
|
114 |
-
$sendin_switch->saveConfig('sendinblue/smtp/password', $smtp_response->result->relay_data->data->password, 'default', 0);
|
115 |
-
$sendin_switch->saveConfig('sendinblue/smtp/host', $smtp_response->result->relay_data->data->relay, 'default', 0);
|
116 |
-
$sendin_switch->saveConfig('sendinblue/smtp/port', $smtp_response->result->relay_data->data->port, 'default', 0);
|
117 |
-
$sendin_switch->saveConfig('sendinblue/smtp/ssl', 'null', 'default', 0);
|
118 |
-
$sendin_switch->saveConfig('sendinblue/smtp/option', 'smtp', 'default', 0);
|
119 |
-
echo $this->__('Your setting has been successfully saved');
|
120 |
-
}else
|
121 |
-
{
|
122 |
-
$sendin_switch->saveConfig('sendinblue/smtp/status', 0);
|
123 |
-
echo $this->__('Your SMTP account is not activated and therefore you can\'t use SendinBlue SMTP. For more informations, please contact our support to: contact@sendinblue.com');
|
124 |
-
}
|
125 |
-
}elseif (isset($responce['error']))
|
126 |
-
echo $this->__('You have entered wrong api key');
|
127 |
-
}
|
128 |
-
}
|
129 |
-
catch (Exception $e)
|
130 |
-
{
|
131 |
-
echo $this->__($e->getMessage());
|
132 |
-
}
|
133 |
-
}
|
134 |
-
public function ajaxcontentAction()
|
135 |
-
{
|
136 |
-
$post = $this->getRequest()->getPost();
|
137 |
-
try {
|
138 |
-
if (empty($post))
|
139 |
-
Mage::throwException($this->__('Invalid form data.'));
|
140 |
-
else
|
141 |
-
{
|
142 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
143 |
-
if ($locale == 'fr_FR')
|
144 |
-
{
|
145 |
-
$title1 = 'Inscrire le contact';
|
146 |
-
$title2 = 'Désinscrire le contact';
|
147 |
-
$first = 'Première page';
|
148 |
-
$last = 'Dernière page';
|
149 |
-
$previous = 'Précédente';
|
150 |
-
$next = 'Suivante';
|
151 |
-
$yes = 'oui';
|
152 |
-
$no = 'non';
|
153 |
-
} else
|
154 |
-
{
|
155 |
-
$title1 = 'Unsubscribe the contact';
|
156 |
-
$title2 = 'Subscribe the contact';
|
157 |
-
$first = 'First';
|
158 |
-
$last = 'Last';
|
159 |
-
$previous = 'Previous';
|
160 |
-
$next = 'Next';
|
161 |
-
$yes = 'yes';
|
162 |
-
$no = 'no';
|
163 |
-
}
|
164 |
-
$page = (int)$post['page'];
|
165 |
-
$cur_page = $page;
|
166 |
-
$page -= 1;
|
167 |
-
$per_page = 20;
|
168 |
-
$previous_btn = true;
|
169 |
-
$next_btn = true;
|
170 |
-
$first_btn = true;
|
171 |
-
$last_btn = true;
|
172 |
-
$start = $page * $per_page;
|
173 |
-
$count = Mage::getModel('sendinblue/sendinblue')->getTotalCount();
|
174 |
-
$no_of_paginations = ceil($count / $per_page);
|
175 |
-
if ($cur_page >= 7)
|
176 |
-
{
|
177 |
-
$start_loop = $cur_page - 3;
|
178 |
-
if ($no_of_paginations > $cur_page + 3)
|
179 |
-
$end_loop = $cur_page + 3;
|
180 |
-
else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6)
|
181 |
-
{
|
182 |
-
$start_loop = $no_of_paginations - 6;
|
183 |
-
$end_loop = $no_of_paginations;
|
184 |
-
} else
|
185 |
-
$end_loop = $no_of_paginations;
|
186 |
-
} else
|
187 |
-
{
|
188 |
-
$start_loop = 1;
|
189 |
-
if ($no_of_paginations > 7)
|
190 |
-
$end_loop = 7;
|
191 |
-
else
|
192 |
-
$end_loop = $no_of_paginations;
|
193 |
-
}
|
194 |
-
$collection = Mage::getModel('sendinblue/sendinblue')->getNewsletterSubscribe($start, $per_page);
|
195 |
-
$sendin_status = Mage::getModel('sendinblue/sendinblue')->checkUserSendinStatus($collection);
|
196 |
-
$sendin_result = $sendin_status['result'];
|
197 |
-
if (count($collection) != 0)
|
198 |
-
{
|
199 |
-
$i = 1;
|
200 |
-
$msg = '';
|
201 |
-
foreach ($collection as $subscriber)
|
202 |
-
{
|
203 |
-
$email = $subscriber['email'];
|
204 |
-
$phone = !empty($subscriber['telephone'])?$subscriber['telephone'] : '';
|
205 |
-
$country_id = !empty($subscriber['country_id'])?$subscriber['country_id'] : '';
|
206 |
-
if($phone != '')
|
207 |
-
{
|
208 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$country_id.'" ';
|
209 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
210 |
-
$data = $connection->fetchRow($sql);
|
211 |
-
$phone = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($phone,$data['country_prefix']);
|
212 |
-
}
|
213 |
-
if ($subscriber['customer_id'] != 0)
|
214 |
-
$client = $yes;
|
215 |
-
else
|
216 |
-
$client = $no;
|
217 |
-
if ($sendin_result[$email] === 1 || $sendin_result[$email] === null)
|
218 |
-
$show_status = 0;
|
219 |
-
if ($sendin_result[$email] === 0)
|
220 |
-
$show_status = 1;
|
221 |
-
if ($subscriber['subscriber_status'] != 3)
|
222 |
-
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
223 |
-
else
|
224 |
-
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
225 |
-
if ($show_status)
|
226 |
-
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif"
|
227 |
-
id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
228 |
-
else
|
229 |
-
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif"
|
230 |
-
id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
231 |
-
$msg .= '<tr class="even pointer"><td class="a-left">'.$email.'</td><td class="a-left">'.$client.'</td><td class="a-left">'.$phone.'</td><td class="a-left">'.$img_magento.'</td>
|
232 |
-
<td class="a-left last"><a status="'.$show_status.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
233 |
-
'.$img_sendin.'</a></td></tr>';
|
234 |
-
$i++;
|
235 |
-
}
|
236 |
-
}
|
237 |
-
$msg_paging = '';
|
238 |
-
$msg_paging .= '<tr><td colspan="7"><div class="pagination"><ul class="pull-left">';
|
239 |
-
if ($first_btn && $cur_page > 1)
|
240 |
-
$msg_paging .= '<li p="1" class="active">'.$first.'</li>';
|
241 |
-
else if ($first_btn)
|
242 |
-
$msg_paging .= '<li p="1" class="inactive">'.$first.'</li>';
|
243 |
-
if ($previous_btn && $cur_page > 1)
|
244 |
-
{
|
245 |
-
$pre = $cur_page - 1;
|
246 |
-
$msg_paging .= '<li p="'.$pre.'" class="active">'.$previous.'</li>';
|
247 |
-
} else if ($previous_btn)
|
248 |
-
$msg_paging .= '<li class="inactive">'.$previous.'</li>';
|
249 |
-
for ($i = $start_loop; $i <= $end_loop; $i++)
|
250 |
-
{
|
251 |
-
if ($cur_page == $i)
|
252 |
-
$msg_paging .= '<li p="'.$i.'" style="color:#fff;background-color:#000000;" class="active">'.$i.'</li>';
|
253 |
-
else
|
254 |
-
$msg_paging .= '<li p="'.$i.'" class="active">'.$i.'</li>';
|
255 |
-
}
|
256 |
-
if ($next_btn && $cur_page < $no_of_paginations)
|
257 |
-
{
|
258 |
-
$nex = $cur_page + 1;
|
259 |
-
$msg_paging .= '<li p="'.$nex.'" class="active">'.$next.'</li>';
|
260 |
-
} else if ($next_btn)
|
261 |
-
$msg_paging .= '<li class="inactive">'.$next.'</li>';
|
262 |
-
if ($last_btn && $cur_page < $no_of_paginations)
|
263 |
-
$msg_paging .= '<li p="'.$no_of_paginations.'" class="active">'.$last.'</li>';
|
264 |
-
else if ($last_btn)
|
265 |
-
$msg_paging .= '<li p="'.$no_of_paginations.'" class="inactive">'.$last.'</li>';
|
266 |
-
if ($count != 0)
|
267 |
-
echo $msg.$msg_paging.'</td></tr>';
|
268 |
-
}
|
269 |
-
}catch (Exception $e)
|
270 |
-
{
|
271 |
-
echo $this->__($e->getMessage());
|
272 |
-
}
|
273 |
-
}
|
274 |
-
public function ajaxupdateAction()
|
275 |
-
{
|
276 |
-
$post = $this->getRequest()->getPost();
|
277 |
-
try {
|
278 |
-
if (empty($post))
|
279 |
-
Mage::throwException($this->__('Invalid form data.'));
|
280 |
-
$temp_sub_status = ($post['newsletter'] == 0) ? 1 : 3;
|
281 |
-
if (!empty($post['email']) && $post['newsletter'] == 0)
|
282 |
-
{
|
283 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailSubscribe($post['email']);
|
284 |
-
$responce_data = json_decode($responce);
|
285 |
-
$sql = 'SELECT * from customer_entity where email = "'.$post['email'].'" ';
|
286 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
287 |
-
$custdata = $connection->fetchRow($sql);
|
288 |
-
|
289 |
-
if ($responce_data->errorMsg == 'User not exists')
|
290 |
-
{
|
291 |
-
if ($custdata['entity_id'] != '')
|
292 |
-
{
|
293 |
-
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$custdata['entity_id']);
|
294 |
-
$telephone = '';
|
295 |
-
foreach ($collectionAddress as $customerPhno) {
|
296 |
-
$telephone = $customerPhno->getData('telephone');
|
297 |
-
$country_id = $customerPhno->getData('country_id');
|
298 |
-
|
299 |
-
}
|
300 |
-
|
301 |
-
$customer = Mage::getModel("customer/customer");
|
302 |
-
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
|
303 |
-
$customer->loadByEmail($post['email']); //load customer by email id
|
304 |
-
$customer_name = $customer->getData();
|
305 |
-
|
306 |
-
if (!empty($telephone))
|
307 |
-
{
|
308 |
-
$sql = 'SELECT * FROM sendinblue_country_codes WHERE iso_code = "'.$country_id.'" ';
|
309 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
310 |
-
$data = $connection->fetchRow($sql);
|
311 |
-
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($telephone,$data['country_prefix']);
|
312 |
-
}
|
313 |
-
$client = 1;
|
314 |
-
$telephone = (isset($number))? $number : '';
|
315 |
-
$firstname = (isset($customer_name['firstname']))?$customer_name['firstname'] : '';
|
316 |
-
$lasttname = (isset($customer_name['lastname']))?$customer_name['lastname'] : '';
|
317 |
-
|
318 |
-
$extra = $firstname.'|'.$lasttname.'|'.$client.'|'.$telephone;
|
319 |
-
|
320 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
321 |
-
|
322 |
-
}
|
323 |
-
else
|
324 |
-
{
|
325 |
-
$client = 0;
|
326 |
-
$extra = ''.'|'.''.'|'.$client.'|'.'';
|
327 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
328 |
-
}
|
329 |
-
}
|
330 |
-
$sql = 'SELECT * from newsletter_subscriber where subscriber_email = "'.$post['email'].'" ';
|
331 |
-
$custdatanews = $connection->fetchRow($sql);
|
332 |
-
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
333 |
-
{
|
334 |
-
|
335 |
-
$connection->query("insert into newsletter_subscriber(store_id, customer_id, subscriber_email, subscriber_status)
|
336 |
-
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$custdata['email']."','1')");
|
337 |
-
|
338 |
-
}
|
339 |
-
else
|
340 |
-
{
|
341 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post['email']);
|
342 |
-
$costomer_data->setStatus($temp_sub_status);
|
343 |
-
$costomer_data->setIsStatusChanged(true);
|
344 |
-
$costomer_data->save();
|
345 |
-
}
|
346 |
-
|
347 |
-
}
|
348 |
-
else{
|
349 |
-
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($post['email']);
|
350 |
-
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post['email']);
|
351 |
-
$sql = 'SELECT * from customer_entity where email = "'.$post['email'].'" ';
|
352 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
353 |
-
$custdata = $connection->fetchRow($sql);
|
354 |
-
|
355 |
-
if (!$costomer_data->getStoreId())
|
356 |
-
{
|
357 |
-
$costomer_data->setSubscriberEmail($custdata['email']);
|
358 |
-
$costomer_data->setCustomerId($custdata['entity_id']);
|
359 |
-
$costomer_data->setStoreId($custdata['store_id']);
|
360 |
-
}
|
361 |
-
$costomer_data->setStatus($temp_sub_status);
|
362 |
-
$costomer_data->setIsStatusChanged(true);
|
363 |
-
$costomer_data->save();
|
364 |
-
}
|
365 |
-
}
|
366 |
-
catch (Exception $e)
|
367 |
-
{
|
368 |
-
echo $this->__($e->getMessage());
|
369 |
-
}
|
370 |
-
}
|
371 |
-
|
372 |
-
public function ajaxordersmsAction($sender, $message, $number)
|
373 |
-
{
|
374 |
-
$post = $this->getRequest()->getPost();
|
375 |
-
try {
|
376 |
-
if (empty($post))
|
377 |
-
Mage::throwException($this->__('Invalid form data.'));
|
378 |
-
$number = $post['number'];
|
379 |
-
$charone = substr($number, 0, 1);
|
380 |
-
$chartwo = substr($number, 0, 2);
|
381 |
-
if ($charone == '0' && $chartwo == '00')
|
382 |
-
$number = $number;
|
383 |
-
|
384 |
-
if (isset($number))
|
385 |
-
{
|
386 |
-
$arr = array();
|
387 |
-
$arr['to'] = $number;
|
388 |
-
$arr['from'] = $post['sender'];
|
389 |
-
$arr['text'] = $post['message'];
|
390 |
-
|
391 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
392 |
-
if (isset($result->status) && $result->status == 'OK')
|
393 |
-
echo 'OK';
|
394 |
-
else
|
395 |
-
echo 'KO';
|
396 |
-
}
|
397 |
-
|
398 |
-
}
|
399 |
-
catch (Exception $e)
|
400 |
-
{
|
401 |
-
echo $this->__($e->getMessage());
|
402 |
-
}
|
403 |
-
}
|
404 |
-
|
405 |
-
public function ajaxordershippedAction($sender,$message,$number)
|
406 |
-
{
|
407 |
-
$post = $this->getRequest()->getPost();
|
408 |
-
try {
|
409 |
-
if (empty($post))
|
410 |
-
Mage::throwException($this->__('Invalid form data.'));
|
411 |
-
$number = $post['number'];
|
412 |
-
$charone = substr($number, 0, 1);
|
413 |
-
$chartwo = substr($number, 0, 2);
|
414 |
-
|
415 |
-
if ($charone == '0' && $chartwo == '00')
|
416 |
-
$number = $number;
|
417 |
-
|
418 |
-
|
419 |
-
if (isset($number))
|
420 |
-
{
|
421 |
-
$arr = array();
|
422 |
-
$arr['to'] = $number;
|
423 |
-
$arr['from'] = $post['sender'];
|
424 |
-
$arr['text'] = $post['message'];
|
425 |
-
|
426 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
427 |
-
if (isset($result->status) && $result->status == 'OK')
|
428 |
-
echo 'OK';
|
429 |
-
else
|
430 |
-
echo 'KO';exit;
|
431 |
-
}
|
432 |
-
|
433 |
-
}
|
434 |
-
catch (Exception $e)
|
435 |
-
{
|
436 |
-
echo $this->__($e->getMessage());
|
437 |
-
}
|
438 |
-
}
|
439 |
-
|
440 |
-
public function ajaxsmscampaignAction($sender,$message,$number)
|
441 |
-
{
|
442 |
-
$post = $this->getRequest()->getPost();
|
443 |
-
try {
|
444 |
-
if (empty($post))
|
445 |
-
Mage::throwException($this->__('Invalid form data.'));
|
446 |
-
$number = $post['number'];
|
447 |
-
$charone = substr($number, 0, 1);
|
448 |
-
$chartwo = substr($number, 0, 2);
|
449 |
-
if ($charone == '0' && $chartwo == '00')
|
450 |
-
$number = $number;
|
451 |
-
|
452 |
-
if (isset($number))
|
453 |
-
{
|
454 |
-
$arr = array();
|
455 |
-
$arr['to'] = $number;
|
456 |
-
$arr['from'] = $post['sender'];
|
457 |
-
$arr['text'] = $post['message'];
|
458 |
-
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
459 |
-
$locale = Mage::app()->getLocale()->getLocaleCode();
|
460 |
-
if (isset($result->status) && $result->status == 'OK')
|
461 |
-
echo 'OK';
|
462 |
-
else
|
463 |
-
echo 'KO';
|
464 |
-
}
|
465 |
-
|
466 |
-
}
|
467 |
-
catch (Exception $e)
|
468 |
-
{
|
469 |
-
echo $this->__($e->getMessage());
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @author Sendinblue plateform <contact@sendinblue.com>
|
4 |
-
* @copyright 2013-2014 Sendinblue
|
5 |
-
* URL: https:www.sendinblue.com
|
6 |
-
* Do not edit or add to this file if you wish to upgrade Sendinblue Magento plugin to newer
|
7 |
-
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
8 |
-
* needs then we can't provide a technical support.
|
9 |
-
**/
|
10 |
-
|
11 |
-
//echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number <br />';
|
12 |
-
|
13 |
-
$resource = Mage::getSingleton('core/resource');
|
14 |
-
$writeConnection = $resource->getConnection('core_write');
|
15 |
-
$sql = "SELECT * FROM `core_config_data` WHERE `path` LIKE 'sendinblue/%'";
|
16 |
-
echo $datanum = count($writeConnection->fetchAll($sql));
|
17 |
-
if ($datanum > 0 )
|
18 |
-
{
|
19 |
-
$query = "DELETE FROM `core_config_data` WHERE `path` LIKE 'sendinblue/%'";
|
20 |
-
$writeConnection->query($query);
|
21 |
-
}
|
22 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/sendinblue.xml
CHANGED
@@ -1,16 +1,12 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
<sendinblue_admin_adminhtml_myform_index>
|
|
|
|
|
|
|
|
|
4 |
<reference name="content">
|
5 |
<block type="adminhtml/template" name="sendinblue" template="sendinblue/myform.phtml"/>
|
6 |
</reference>
|
7 |
</sendinblue_admin_adminhtml_myform_index>
|
8 |
-
<!-- Code to add for js and css -->
|
9 |
-
<default>
|
10 |
-
<reference name="head">
|
11 |
-
<action method="addItem"><type>skin_css</type><name>sendinblue/css/styles.css</name><params/></action>
|
12 |
-
<action method="addItem"><type>skin_css</type><name>sendinblue/css/jquery.multiselect.css</name><params/></action>
|
13 |
-
</reference>
|
14 |
-
</default>
|
15 |
-
<!-- [end] -->
|
16 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
<sendinblue_admin_adminhtml_myform_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addItem"><type>skin_css</type><name>sendinblue/css/styles.css</name><params/></action>
|
6 |
+
<action method="addItem"><type>skin_css</type><name>sendinblue/css/jquery.multiselect.css</name><params/></action>
|
7 |
+
</reference>
|
8 |
<reference name="content">
|
9 |
<block type="adminhtml/template" name="sendinblue" template="sendinblue/myform.phtml"/>
|
10 |
</reference>
|
11 |
</sendinblue_admin_adminhtml_myform_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
</layout>
|
app/design/adminhtml/default/default/template/sendinblue/myform.phtml
CHANGED
@@ -8,269 +8,436 @@
|
|
8 |
* needs then we can't provide a technical support.
|
9 |
**/
|
10 |
?>
|
11 |
-
<link rel="stylesheet" type="text/css" href="
|
12 |
<script>
|
13 |
-
|
14 |
-
|
15 |
</script>
|
16 |
-
|
17 |
-
|
18 |
-
<script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/js/jquery.multiselect.min.js"></script>
|
19 |
-
<script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/js/sendinblue.js"></script>
|
20 |
-
<div class="entry-edit">
|
21 |
-
<div class="">
|
22 |
-
<img class="sendin-logo" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/images/<?php echo $this->__('sendinblue.png'); ?>">
|
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 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/images/logo.gif">
|
29 |
-
<?php echo $this->__('SendinBlue'); ?></legend>
|
30 |
-
<div class="contact-details">
|
31 |
-
<h2 style="color:#268CCD;"> <?php echo $this->__('Contact SendinBlue team'); ?></h2>
|
32 |
-
<div style="clear: both;"></div>
|
33 |
-
<p> <?php echo $this->__('Contact us:'); ?>
|
34 |
-
<br><br>Email:<a href="mailto:<?php echo $this->__('contact@sendinblue.com'); ?>" style="color:#268CCD; text-decoration: none;">
|
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>
|
42 |
-
<ul class="listt">
|
43 |
-
<li> <?php echo $this->__('Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)'); ?></li>
|
44 |
-
<li> <?php echo $this->__('Easily create good looking emailings'); ?></li>
|
45 |
-
<li> <?php echo $this->__('Schedule your campaigns'); ?></li>
|
46 |
-
<li> <?php echo $this->__('Track your results and optimize'); ?></li>
|
47 |
-
<li> <?php echo $this->__('Monitor your transactional emails (purchase confirmation, password reset …) with a better deliverability and real-time analytics'); ?></li>
|
48 |
-
</ul>
|
49 |
-
<b><?php echo $this->__('Why should you use SendinBlue ?'); ?></b>
|
50 |
-
<ul class="listt">
|
51 |
-
<li> <?php echo $this->__('Optimized deliverability'); ?></li>
|
52 |
-
<li> <?php echo $this->__('Unbeatable pricing – best value in the industry'); ?></li>
|
53 |
-
<li> <?php echo $this->__('Technical support, by phone or by email'); ?></li>
|
54 |
-
</ul>
|
55 |
-
</div><div style="clear:both;"> </div>
|
56 |
-
</fieldset>
|
57 |
-
</div>
|
58 |
-
<?php
|
59 |
-
$module_status = Mage::getModel('sendinblue/sendinblue')->getEnableStatus()?1:0;
|
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 |
-
<
|
71 |
-
|
72 |
-
|
73 |
-
<
|
74 |
-
<
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
<
|
79 |
-
<
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
<
|
118 |
-
<
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
<legend class="lgend"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></legend>
|
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(Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()==1) { echo "checked"; } ?> name="syncronize" value="1" class="radio_nospaceing hdtab"/> <?php echo $this->__('Yes'); ?>
|
129 |
-
<input type="radio" <?php if(Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()==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>
|
130 |
-
</td>
|
131 |
-
</tr>
|
132 |
-
<tr>
|
133 |
<td colspan="2">
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
<td class="input-ele"><?php
|
139 |
-
$list =
|
140 |
-
|
141 |
-
$selectedlist = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
142 |
if($selectedlist!=NULL){
|
143 |
$list_array = explode('|',$selectedlist);
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
147 |
|
148 |
?>
|
149 |
<select multiple="multiple" name="sendin_list[]" id="select">
|
150 |
<?php foreach($list as $value ){ ?>
|
151 |
-
<option value="<?php echo $value['id']; ?>" <?php if(in_array($value['id'],$list_array)) echo 'selected = "selected"' ?> ><?php echo $value['name']; ?></option>
|
152 |
<?php } ?>
|
153 |
</select>
|
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">
|
161 |
<div class="btnmrgn-right">
|
162 |
<input type="submit" class="btn" name="syncronizeSubmit" value ="<?php echo $this->__('Update'); ?>" /></div>
|
163 |
</td>
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
</td></tr>
|
168 |
</table>
|
169 |
</div>
|
170 |
-
</td>
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
<?php
|
179 |
-
}
|
180 |
-
$module_status = Mage::getModel('sendinblue/sendinblue')->getSmtpStatus();
|
181 |
-
if ($module_status == 0)
|
182 |
-
$style_smtp = 'style="display:none;"';
|
183 |
-
else
|
184 |
-
$style_smtp = '';
|
185 |
|
186 |
-
|
187 |
-
|
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 Mage::getSingleton('core/session')->getFormKey() ?>" />
|
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 Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></legend>
|
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(Mage::getModel('sendinblue/sendinblue')->getSmtpStatus()==1) { echo 'checked'; } ?> name="smtp" value="1" /> <?php echo $this->__('Yes'); ?>
|
201 |
-
<input <?php if(Mage::getModel('sendinblue/sendinblue')->getSmtpStatus()==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>
|
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>
|
212 |
-
|
213 |
-
</table>
|
214 |
-
</fieldset>
|
215 |
-
</div>
|
216 |
-
</form>
|
217 |
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
<div class="sendin_row hidetableblock" <?php echo $style; ?> >
|
241 |
<fieldset class="fields">
|
242 |
-
|
243 |
-
|
244 |
<table width="100%" cellspacing="0" cellpadding="0" class="table hidetableblock form-list">
|
245 |
|
246 |
<tbody>
|
247 |
<tr>
|
248 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
249 |
<span style="margin-bottom:10px; color:#333333;">
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
257 |
<tr>
|
258 |
<td>
|
259 |
<label>
|
260 |
-
|
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. '); ?>
|
@@ -289,23 +456,23 @@ $style_smtp = '';
|
|
289 |
<li><a class="icon_accept" href="#tab2">
|
290 |
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></a></li>
|
291 |
<li><a href="#tab3">
|
292 |
-
|
293 |
-
|
294 |
</ul>
|
295 |
</div>
|
296 |
<div id="tabs_content_container">
|
297 |
<div id="tab1" class="tab_content" style="display: block;">
|
298 |
<div class="wrapper" style="margin-top:15px;">
|
299 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 ">
|
300 |
-
|
301 |
<tr>
|
302 |
<td class="row1 fix_width2" >
|
303 |
<label class="r_label">
|
304 |
-
|
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,26 +483,26 @@ $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">
|
323 |
<label>
|
324 |
-
|
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 +523,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>
|
@@ -382,15 +549,15 @@ $style_smtp = '';
|
|
382 |
<div id="tab2" class="tab_content">
|
383 |
<div class="wrapper" style="margin-top:15px;">
|
384 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3">
|
385 |
-
|
386 |
<tr>
|
387 |
<td class="row1 fix-width2">
|
388 |
<label class="r_label">
|
389 |
-
|
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 +569,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 +584,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 +607,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">
|
@@ -466,103 +633,122 @@ $style_smtp = '';
|
|
466 |
<div id="tab3" class="tab_content">
|
467 |
<div class="wrapper" style="margin-top:15px;">
|
468 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3">
|
469 |
-
|
470 |
<tr>
|
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">
|
480 |
<div class="form_table ">
|
481 |
|
482 |
-
|
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 Mage::getSingleton('core/session')->getFormKey() ?>" />
|
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(Mage::getModel('sendinblue/sendinblue')->getShipingSmsStatus()==1) { echo 'checked'; } ?> />
|
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(Mage::getModel('sendinblue/sendinblue')->getShipingSmsStatus()==0) { echo 'checked'; } ?> />
|
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(Mage::getModel('sendinblue/sendinblue')->getShipingSmsStatus()==0) { echo 'checked'; } ?> />
|
498 |
-
<?php echo $this->__('Only subscribed customers'); ?>
|
499 |
-
</td>
|
500 |
-
</tr>
|
501 |
-
<script>
|
502 |
-
jQuery('#r1_Sendin_Sms_Choice').attr('checked', true);
|
503 |
-
</script>
|
504 |
<tr>
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
542 |
</tr>
|
543 |
-
|
544 |
-
|
545 |
-
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
546 |
-
<tr>
|
547 |
-
<td>
|
548 |
-
<div class="hintmsg"><em><?php echo $this->__('Sending a test SMS will be deducted from your SMS credits.'); ?></em></div>
|
549 |
-
<label><?php echo $this->__('Send a test SMS'); ?></label>
|
550 |
-
<input name="sender_campaigntest_number" id="sender_campaigntest_number" maxlength="17" type="text" value="" class="input_bx" />
|
551 |
-
<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>
|
552 |
-
<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" />
|
553 |
-
<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'); ?>">
|
554 |
-
</td>
|
555 |
-
</tr>
|
556 |
-
</table>
|
557 |
-
</td>
|
558 |
-
</tr>
|
559 |
-
</table>
|
560 |
-
|
561 |
-
</div></span>
|
562 |
</td>
|
563 |
</tr>
|
564 |
</table>
|
565 |
-
</div>
|
566 |
</div>
|
567 |
</div>
|
568 |
</div>
|
@@ -573,45 +759,48 @@ $style_smtp = '';
|
|
573 |
</table>
|
574 |
</fieldset>
|
575 |
</div>
|
576 |
-
<?php if($
|
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
|
587 |
-
<
|
588 |
-
<div
|
589 |
-
<div class="
|
590 |
-
|
591 |
-
<?php echo $this->__('
|
592 |
-
<?php echo
|
593 |
-
<?php echo $
|
594 |
-
<?php echo $this->__('
|
595 |
-
<?php echo $this->__(' For
|
596 |
-
|
597 |
-
<
|
|
|
598 |
|
599 |
-
<table cellspacing="0" id="userGrid_table " class="data userDetails" style='display:none;'>
|
600 |
-
<thead>
|
601 |
-
<tr class="headings">
|
602 |
-
<th class="no-link"><span class="nobr"><?php echo $this->__('Email'); ?></span></th>
|
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 |
-
|
608 |
-
</
|
609 |
-
|
610 |
-
|
611 |
-
</tbody>
|
612 |
-
</table>
|
613 |
-
</div
|
614 |
-
</
|
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'); ?>
|
34 |
+
</legend>
|
35 |
+
<div class="contact-details">
|
36 |
+
<h2 style="color:#268CCD;"> <?php echo $this->__('Contact SendinBlue team'); ?></h2>
|
37 |
+
<div style="clear: both;"></div>
|
38 |
+
<p> <?php echo $this->__('Contact us:'); ?>
|
39 |
+
<br><br>Email:<a href="mailto:<?php echo $this->__('contact@sendinblue.com'); ?>" style="color:#268CCD; text-decoration: none;">
|
40 |
+
<?php echo $this->__('contact@sendinblue.com'); ?></a>
|
41 |
+
<br><?php echo $this->__('Phone : 0899 25 30 61'); ?></p>
|
42 |
+
<p style="padding-top:20px;"><b><?php echo $this->__('For further informations, please visit our website:'); ?></b>
|
43 |
+
<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;">
|
44 |
+
<?php echo $this->__('https://www.sendinblue.com'); ?></a></p>
|
45 |
+
</div>
|
46 |
+
<div>
|
47 |
+
<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>
|
48 |
+
<ul class="listt">
|
49 |
+
<li> <?php echo $this->__('Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)'); ?></li>
|
50 |
+
<li> <?php echo $this->__('Easily create good looking emailings'); ?></li>
|
51 |
+
<li> <?php echo $this->__('Schedule your campaigns'); ?></li>
|
52 |
+
<li> <?php echo $this->__('Track your results and optimize'); ?></li>
|
53 |
+
<li> <?php echo $this->__('Monitor your transactional emails (purchase confirmation, password reset …) with a better deliverability and real-time analytics'); ?></li>
|
54 |
+
</ul>
|
55 |
+
<b><?php echo $this->__('Why should you use SendinBlue ?'); ?></b>
|
56 |
+
<ul class="listt">
|
57 |
+
<li> <?php echo $this->__('Optimized deliverability'); ?></li>
|
58 |
+
<li> <?php echo $this->__('Unbeatable pricing – best value in the industry'); ?></li>
|
59 |
+
<li> <?php echo $this->__('Technical support, by phone or by email'); ?></li>
|
60 |
+
</ul>
|
61 |
+
</div>
|
62 |
+
<div style="clear:both;"> </div>
|
63 |
+
</fieldset>
|
64 |
+
</div>
|
65 |
+
<?php
|
66 |
+
$sendinModule = Mage::getModel('sendinblue/sendinblue');
|
67 |
+
$sendinStatus = $sendinModule->getEnableStatus();
|
68 |
+
$moduleStatus = isset($sendinStatus) ? 1 : 0;
|
69 |
+
$style = ($moduleStatus) ? '' : 'style="display:none;"';
|
70 |
+
$apiKey = $sendinModule->getApiKey();
|
71 |
+
$getSyncronize = $sendinModule->getSyncronizeStatus();
|
72 |
+
$trackStatus = $sendinModule->getTrackingStatus();
|
73 |
+
$trackingHistory = $sendinModule->getTrackingHistoryStatus();
|
74 |
+
$notifySmsStatus = $sendinModule->getNotifySmsStatus();
|
75 |
+
$orderSmsStatus = $sendinModule->getOrderSmsStatus();
|
76 |
+
$campaignStatus = $sendinModule->getCampaignStatus();
|
77 |
+
$shipingSmsStatus = $sendinModule->getShipingSmsStatus();
|
78 |
+
$formKey = Mage::getSingleton('core/session')->getFormKey();
|
79 |
+
?>
|
80 |
+
<div class="sendin_row">
|
81 |
+
<fieldset class="fields">
|
82 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
83 |
+
<?php echo $this->__('Prerequisites'); ?>
|
84 |
+
</legend>
|
85 |
+
<span><?php echo $this->__('- You should have a SendinBlue account. You can create a free account here:'); ?>
|
86 |
+
<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;">
|
87 |
+
<?php echo $this->__('https://www.sendinblue.com'); ?></a><br></span>
|
88 |
+
</fieldset>
|
89 |
+
</div>
|
90 |
|
91 |
+
<div class="sendin_row" >
|
92 |
+
<form id="edit_formapik" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/apikeypost'); ?>">
|
93 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
94 |
+
<input name="skin_url" id ='skin_url' type="hidden" value="<?php echo $skinUrl;?>" />
|
95 |
+
<div class="section-config active">
|
96 |
+
<fieldset class="fields">
|
97 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Settings'); ?></legend>
|
98 |
+
<table cellspacing="0" class="form-list3">
|
99 |
+
<tr>
|
100 |
+
<td class="fix_width2"><label><?php echo $this->__('Activate the SendinBlue module:'); ?></label></td>
|
101 |
+
<td class="input-ele">
|
102 |
+
<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'); ?>
|
103 |
+
<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'); ?>
|
104 |
+
<input type="hidden" name="apistatuskey" id="apistatuskey" value="<?php echo $moduleStatus;?>">
|
105 |
+
</td>
|
106 |
+
</tr>
|
107 |
+
|
108 |
+
<tr <?php echo $style; ?> id="sendin_apikey">
|
109 |
+
<td><label><?php echo $this->__('API Key:'); ?></label></td>
|
110 |
+
<td class="input-ele">
|
111 |
+
<input type="text" name="sendin_apikey" id="sendin_apikey_val" class="input-text" value="<?php echo $apiKey; ?>" />
|
112 |
+
<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/integration')); ?>"> </span>
|
113 |
+
</td>
|
114 |
+
</tr>
|
115 |
+
|
116 |
+
<tr>
|
117 |
+
<td> </td>
|
118 |
+
<td class="a-left">
|
119 |
+
<div class="btnmrgn-right">
|
120 |
+
<input type="submit" class="btn" name="SmtpSubmit" onclick="return apikvalidate('<?php echo $this->__('Please enter your API key') ;?>');" value ="<?php echo $this->__('Update'); ?>" /></div>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
</table>
|
124 |
+
</fieldset>
|
125 |
+
</div>
|
126 |
+
</form>
|
127 |
+
</div>
|
128 |
+
<?php if ($apiKey != '') { ?>
|
129 |
+
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
130 |
+
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/syncronizepost'); ?>">
|
131 |
+
<div class="section-config active">
|
132 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
133 |
+
<fieldset id="my-fieldset" class="fields">
|
134 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></legend>
|
135 |
+
<table cellspacing="0" class="form-list">
|
136 |
+
<tr>
|
137 |
+
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue to manage subscribers'); ?></label></td>
|
138 |
+
<td class="input-ele">
|
139 |
+
<input type="radio" <?php if($getSyncronize == 1) { echo "checked"; } ?> name="syncronize" value="1" class="radio_nospaceing hdtab"/> <?php echo $this->__('Yes'); ?>
|
140 |
+
<input type="radio" <?php if($getSyncronize == 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>
|
141 |
+
</td>
|
142 |
+
</tr>
|
143 |
+
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
<td colspan="2">
|
145 |
+
<div id="hidetabselect" <?php if(!$getSyncronize) {?>style="display:none;"<?php } ?>>
|
146 |
+
<table>
|
147 |
+
<tr>
|
148 |
+
<td><label><?php echo $this->__('Your Lists'); ?></label></td>
|
149 |
<td class="input-ele"><?php
|
150 |
+
$list = $sendinModule->lists();
|
151 |
+
$selectedlist = $sendinModule->getUserlists();
|
|
|
152 |
if($selectedlist!=NULL){
|
153 |
$list_array = explode('|',$selectedlist);
|
154 |
+
}
|
155 |
+
else{
|
156 |
+
$list_array = array();
|
157 |
+
}
|
158 |
|
159 |
?>
|
160 |
<select multiple="multiple" name="sendin_list[]" id="select">
|
161 |
<?php foreach($list as $value ){ ?>
|
162 |
+
<option value="<?php echo $value['id']; ?>" <?php if(in_array($value['id'],$list_array)) echo 'selected = "selected"' ?> ><?php echo $value['name']; ?></option>
|
163 |
<?php } ?>
|
164 |
</select>
|
165 |
<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>
|
166 |
+
</td>
|
167 |
</tr>
|
168 |
+
<!-- double optin functionality -->
|
169 |
<tr>
|
170 |
+
<td></td>
|
171 |
+
<td>
|
172 |
+
<div class="col-md-6 left-wrapper radio_group_option">
|
173 |
+
<div class="form-group manage_subscribe_block">
|
174 |
+
<div>
|
175 |
+
<input type="radio" value="nocon" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'nocon') echo 'checked="checked"'; ?> name="subscribe_confirm_type" id="no_follow_email">
|
176 |
+
<label for="no_follow_email" class="radio-label"> <?php echo $this->__('No confirmation'); ?></label>
|
177 |
+
</div>
|
178 |
+
<div class="clearfix"></div>
|
179 |
+
<div style="display:block;" class="inner_manage_box">
|
180 |
+
<div class="ver_5" id="no-templates"><?php echo $this->__('With this option, contacts are directly added to your list when they enter their email address. No confirmation email is sent.'); ?></div>
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
<div class="form-group manage_subscribe_block">
|
184 |
+
<div class="col-md-10">
|
185 |
+
<input type="radio" value="simplemail" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'simplemail') echo 'checked="checked"'; ?> id="follow_mail" name="subscribe_confirm_type">
|
186 |
+
<label for="follow_mail" class="radio-label"> <?php echo $this->__('Simple confirmation'); ?></label><span title="<?php echo $this->__('This confirmation email is one of your SMTP templates. By default, we have created a Default Template - Single Confirmation. You can create and activate your SMTP templates by clicking here'); ?>" class="toolTip">
|
187 |
+
</span>
|
188 |
+
</div>
|
189 |
+
<div class="inner_manage_box">
|
190 |
+
<div class="clearfix"></div>
|
191 |
+
<div class="ver_5" id="create-templates"> <?php echo $this->__('By selecting this option, contacts are directly added to your list when they enter their email address on the form. A confirmation email will automatically be sent following their subscription.'); ?></div>
|
192 |
+
<div class="clearfix"></div>
|
193 |
+
<div id="mail-templates">
|
194 |
+
<div class="listData ver_5 managesubscribeBlock">
|
195 |
+
<select class="ui-state-default" name="template_simple"><option value=""><?php echo $this->__('Select Template'); ?></option>
|
196 |
+
<?php
|
197 |
+
$templatelist = $sendinModule->templateDisplay();
|
198 |
+
if (!empty($templatelist['data']['campaign_records'])) {
|
199 |
+
foreach ($templatelist['data']['campaign_records'] as $template_data) {
|
200 |
+
if ($template_data['templ_status'] === 'Active' && stristr($template_data['html_content'], 'DOUBLEOPTIN') === false) { ?>
|
201 |
+
|
202 |
+
<option value="<?php echo $template_data['id']; ?>" <?php if($template_data['id'] == Mage::getStoreConfig('sendinblue/SendinTemplateId')) echo 'selected = "selected"'; ?> ><?php echo $template_data['campaign_name']; ?></option>
|
203 |
+
<?php
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
?>
|
208 |
+
</select>
|
209 |
+
<span title="<?php echo $this->__('Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter'); ?>" class="toolTip"></span>
|
210 |
+
</div>
|
211 |
+
</div>
|
212 |
+
<div class="clearfix"></div>
|
213 |
+
<div id="mail-templates-active-state"></div>
|
214 |
+
</div>
|
215 |
+
<div class="clearfix"></div>
|
216 |
+
</div>
|
217 |
+
<div class="clearfix"></div>
|
218 |
+
<div class="form-group manage_subscribe_block">
|
219 |
+
<div class="col-md-10">
|
220 |
+
<input type="radio" value="doubleoptin" <?php if(Mage::getStoreConfig('sendinblue/SendinSubscribeConfirmType') == 'doubleoptin') echo 'checked="checked"'; ?> id="double_optin" name="subscribe_confirm_type">
|
221 |
+
<label for="double_optin" class="radio-label"> <?php echo $this->__('Double opt-in confirmation'); ?></label>
|
222 |
+
<span title="<?php echo $this->__("If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the 'FORM' folder, on the 'Temp - DOUBLE OPT-IN' list. After confirmation, the contact will be saved in the 'Corresponding List' selected below."); ?>" class="toolTip">
|
223 |
+
</span>
|
224 |
+
</div>
|
225 |
+
<div class="inner_manage_box">
|
226 |
+
<div class="clearfix"></div>
|
227 |
+
<!-- Please select a template with the [DOUBLEOPTIN] link -->
|
228 |
+
<div id="create-doubleoptin-templates">
|
229 |
+
<p><?php echo $this->__('Once the form has been completed, your contact will receive an email with a link to confirm their subscription.'); ?></p>
|
230 |
+
<select class="ui-state-default" name="doubleoptin_template_id">
|
231 |
+
<option value=""><?php echo $this->__('Select Template'); ?></option>
|
232 |
+
<?php
|
233 |
+
$templatelist = $sendinModule->templateDisplay();
|
234 |
+
|
235 |
+
if (!empty($templatelist['data']['campaign_records'])) {
|
236 |
+
foreach ($templatelist['data']['campaign_records'] as $template_data) {
|
237 |
+
if ($template_data['templ_status'] === 'Active' && stristr($template_data['html_content'], '[DOUBLEOPTIN]')) {
|
238 |
+
?>
|
239 |
+
<option value="<?php echo $template_data['id']; ?>" <?php if($template_data['id'] == Mage::getStoreConfig('sendinblue/SendinDoubleoptinTemplateId')) echo 'selected = "selected"'; ?> ><?php echo $template_data['campaign_name']; ?></option>
|
240 |
+
<?php
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
?>
|
245 |
+
</select>
|
246 |
+
</div>
|
247 |
+
<!-- Redirect URL after click on the validation email -->
|
248 |
+
<div class="clearfix"></div>
|
249 |
+
<div id="doubleoptin-redirect-url-area" class="form-group clearfix">
|
250 |
+
<input type="checkbox" class="openCollapse" <?php if(Mage::getStoreConfig('sendinblue/SendinOptinRedirectUrlCheck') == 'yes') echo 'checked="checked"'; ?> value="yes" name="optin_redirect_url_check" id="doptin_redirect_span_icon">
|
251 |
+
<a href=""> <?php echo $this->__('Redirect URL after clicking in the validation email'); ?> </a>
|
252 |
+
<!-- <label style="margin-bottom: 5px;"></label> -->
|
253 |
+
|
254 |
+
<div id="mail-doubleoptin-redirect" class="collapse">
|
255 |
+
<p style="width: 90%;text-align: justify;text-justify: inter-word;">
|
256 |
+
<?php echo $this->__('Redirect your contacts to a landing page or to your website once they have clicked on the confirmation link in the email.'); ?></p>
|
257 |
+
<input type="url" style="margin-bottom:10px;width:370px" value="<?php echo Mage::getStoreConfig('sendinblue/SendinDoubleoptinRedirectUrl'); ?>" placeholder="http://your-domain.com" class="form-control" name="doubleoptin-redirect-url" id="doubleoptin-redirect-url">
|
258 |
+
<div class="clearfix"></div>
|
259 |
+
<div class="pull-left" id="doubleoptin-redirect-message"> </div>
|
260 |
+
<div class="clearfix"></div>
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
|
264 |
+
<!-- Send a final confirmation email -->
|
265 |
+
<div class="clearfix"></div>
|
266 |
+
<div id="doubleoptin-final-confirmation-area" class="form-group clearfix">
|
267 |
+
<input type="checkbox" class="openCollapse" <?php if(Mage::getStoreConfig('sendinblue/SendinFinalConfirmEmail') == 'yes') echo 'checked="checked"'; ?> value="yes" name="final_confirm_email" id="doptin_final_confirm_email">
|
268 |
+
<a href="#doubleoptin-final-confirm"> <?php echo $this->__('Send a final confirmation email'); ?> </a>
|
269 |
+
<div id="doubleoptin-final-confirm" class="collapse">
|
270 |
+
<p><?php echo $this->__('Once a contact has clicked in the double opt-in confirmation email, send them a final confirmation email'); ?></p>
|
271 |
+
<div style="text-align: left;" class="listData ver_5 managesubscribeBlock">
|
272 |
+
<select class="ui-state-default" name="template_final">
|
273 |
+
<option value=""><?php echo $this->__('Select Template'); ?></option>
|
274 |
+
<?php
|
275 |
+
$templatelist = $sendinModule->templateDisplay();
|
276 |
+
|
277 |
+
if (!empty($templatelist['data']['campaign_records'])) {
|
278 |
+
foreach ($templatelist['data']['campaign_records'] as $template_data) {
|
279 |
+
if ($template_data['templ_status'] === 'Active' && stristr($template_data['html_content'], 'DOUBLEOPTIN') === false) {
|
280 |
+
?>
|
281 |
+
<option value="<?php echo $template_data['id']; ?>" <?php if($template_data['id'] == Mage::getStoreConfig('sendinblue/SendinTemplateFinal')) echo 'selected = "selected"'; ?> ><?php echo $template_data['campaign_name']; ?></option>
|
282 |
+
<?php
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
?>
|
287 |
+
</select>
|
288 |
+
<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>
|
289 |
+
</div>
|
290 |
+
<div class="clearfix"></div>
|
291 |
+
<div class="pull-left" id="final-mail-templates"></div>
|
292 |
+
<div class="clearfix"></div>
|
293 |
+
</div>
|
294 |
+
<div id="doubleoptin-templates-active-state"> </div>
|
295 |
+
</div>
|
296 |
+
</div>
|
297 |
+
</div>
|
298 |
+
<div class="clearfix"></div>
|
299 |
+
|
300 |
+
</td>
|
301 |
+
</tr>
|
302 |
+
<tr>
|
303 |
<td> </td>
|
304 |
<td class="a-left">
|
305 |
<div class="btnmrgn-right">
|
306 |
<input type="submit" class="btn" name="syncronizeSubmit" value ="<?php echo $this->__('Update'); ?>" /></div>
|
307 |
</td>
|
308 |
+
</tr>
|
309 |
+
</form>
|
310 |
+
|
311 |
+
<?php if($sendinModule->getImportOldSubsStatus()==1){ ?>
|
312 |
+
<form id="reimport_form" name="reimport_form" method="post" action="<?php echo $this->getUrl('*/*/reimportpost'); ?>">
|
313 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
314 |
+
<tr>
|
315 |
+
<td> </td>
|
316 |
+
<td class="a-left">
|
317 |
+
<div class="btnmrgn-right">
|
318 |
+
<input type="submit" class="btn" name="importoldSubmit" value ="<?php echo $this->__('Import Old Subscribers'); ?>" /></div>
|
319 |
+
</td>
|
320 |
+
</tr></form>
|
321 |
+
<?php } ?>
|
322 |
+
<tr><td colspan="2">
|
323 |
+
<?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>
|
324 |
</td></tr>
|
325 |
</table>
|
326 |
</div>
|
327 |
+
</td>
|
328 |
+
</tr>
|
329 |
+
</table>
|
330 |
+
</fieldset>
|
331 |
+
</div>
|
332 |
+
</div>
|
333 |
+
<?php
|
334 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
|
336 |
+
$moduleStatus = $sendinModule->getSmtpStatus();
|
337 |
+
$styleSmtp = ($moduleStatus == 0) ? 'style="display:none;"' : '' ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
|
339 |
+
?>
|
340 |
+
<?php if ($apiKey != '') { ?>
|
341 |
+
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
342 |
+
<form id="edit_formsmtp" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/sendmail'); ?>">
|
343 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
344 |
+
<input name="smtpUrl" type="hidden" id="smtpUrl" value="<?php echo $this->getUrl('sendinblue/ajax/smtppost'); ?>" />
|
345 |
+
<div class="section-config active">
|
346 |
+
<fieldset class="fields">
|
347 |
+
<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>
|
348 |
+
<table cellspacing="0" class="form-list">
|
349 |
+
|
350 |
+
<tr>
|
351 |
+
<td class="fix_width"><label><?php echo $this->__('Activate SendinBlue SMTP for your transactional emails'); ?></label></td>
|
352 |
+
<td class="input-ele">
|
353 |
+
<input type="radio" class = 'smtpStatus radio_nospaceing' <?php if($moduleStatus == 1) { echo 'checked'; } ?> name="smtp" value="1" /> <?php echo $this->__('Yes'); ?>
|
354 |
+
<input <?php if($moduleStatus == 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>
|
355 |
+
</td>
|
356 |
+
<td> </td>
|
357 |
+
</tr>
|
358 |
+
|
359 |
+
<tr <?php echo $styleSmtp; ?> class='smtptest'>
|
360 |
+
<td class="fix_width"><label><?php echo $this->__('Send email test From / To :'); ?></label></td>
|
361 |
+
<td class="input-ele"><input class="input-text input-height" name="email" id="email" value="" size="40"/>
|
362 |
+
<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'); ?>" />
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
+
|
366 |
+
</table>
|
367 |
+
</fieldset>
|
368 |
+
</div>
|
369 |
+
</form>
|
370 |
+
</div>
|
371 |
|
372 |
+
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
373 |
+
<div class="section-config active">
|
374 |
+
<input name="trackingUrl" type="hidden" id="trackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/codepost'); ?>" />
|
375 |
+
<fieldset id="my-fieldset" class="fields">
|
376 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Code tracking'); ?> </legend>
|
377 |
+
<table cellspacing="0" class="form-list">
|
378 |
+
<tr>
|
379 |
+
<td class="fix_width"><label><?php echo $this->__('Do you want to install a tracking code when validating an order'); ?></label>
|
380 |
+
</td>
|
381 |
+
<td class="input-ele">
|
382 |
+
<input type="radio" <?php if($trackStatus == 1) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_nospaceing' value="1" /> <?php echo $this->__('Yes'); ?>
|
383 |
+
<input type="radio" <?php if($trackStatus == 0) { echo 'checked'; } ?> name="Tracking" class='Tracking radio_spaceing2' value="0" /> <?php echo $this->__('No'); ?>
|
384 |
+
<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>
|
385 |
+
</td>
|
386 |
+
</tr>
|
387 |
+
<?php
|
388 |
+
if ($trackStatus == 1 && $trackingHistory == 1)
|
389 |
+
$style_track = '';
|
390 |
+
else
|
391 |
+
$style_track = 'style="display:none;"';
|
392 |
+
if($trackStatus == 1 && $trackingHistory == 1) { ?>
|
393 |
+
<tr <?php echo $style_track; ?> class='ordertracking'>
|
394 |
+
<td> </td>
|
395 |
+
<input type="hidden" name="history_status" value="<?php echo $trackingHistory; ?>" id="history_status">
|
396 |
+
<input name="importordertrackingUrl" type="hidden" id="importordertrackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/orderhistory'); ?>" />
|
397 |
+
<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>
|
398 |
+
</tr>
|
399 |
+
<?php } ?>
|
400 |
+
</table>
|
401 |
+
</fieldset>
|
402 |
+
</div>
|
403 |
+
</div>
|
404 |
|
405 |
<div class="sendin_row hidetableblock" <?php echo $style; ?> >
|
406 |
<fieldset class="fields">
|
407 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif">
|
408 |
+
<?php echo $this->__('Manage SMS'); ?></legend>
|
409 |
<table width="100%" cellspacing="0" cellpadding="0" class="table hidetableblock form-list">
|
410 |
|
411 |
<tbody>
|
412 |
<tr>
|
413 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
414 |
<span style="margin-bottom:10px; color:#333333;">
|
415 |
+
<?php echo $this->__('Currently you have '); ?>
|
416 |
+
<?php $credit = $sendinModule->getSmsCredit();
|
417 |
+
$notify_value = $sendinModule->getNotifyValueStatus();
|
418 |
+
?>
|
419 |
+
<?php if ($credit >= $notify_value){ ?> <strong style="color:#000000;"><?php echo $credit; ?></strong><?php } else {?><strong style="color:#F03D25;"><?php echo $credit; ?></strong><?php } ?>
|
420 |
+
|
421 |
+
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
422 |
+
<a target="_blank" href ="<?php echo $this->__('https://www.sendinblue.com/pricing?utm_source=magento_plugin&utm_medium=plugin&utm_campaign=module_link/#tab-plan-smsplan'); ?>" style="color: #000000; outline: 0 none; text-decoration: none;">
|
423 |
+
<?php echo $this->__('here'); ?></a></span></td></tr>
|
424 |
<tr>
|
425 |
<td>
|
426 |
<label>
|
427 |
+
<?php echo $this->__('You want to be notified by e-mail when you do not have enough credits?'); ?></label>
|
428 |
+
<input name="sms_credit" <?php if($notifySmsStatus == 1) { echo 'checked'; } ?> type="radio" value="1" class="sms_credit radio_nospaceing" style="margin-right:10px;" />
|
429 |
<?php echo $this->__('Yes'); ?>
|
430 |
+
<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;" />
|
431 |
<?php echo $this->__('No'); ?>
|
432 |
<input name="credit" type="hidden" id="credits" value="<?php echo $this->getUrl('sendinblue/ajax/credit'); ?>" />
|
433 |
<div class="hideCredit" id="div_email_test" style="padding-top:20px;">
|
434 |
<form action="<?php echo $this->getUrl('*/*/sendnotifysms'); ?>" method="POST" name="notify_sms_mail_form">
|
435 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
436 |
<p class="form-data"><label><?php echo $this->__('Email'); ?></label>
|
437 |
+
<input name="sendin_notify_email" id="sendin_notify_email" type="text" class="input-text" value="<?php echo $sendinModule->getNotifyEmailStatus(); ?>" size="40" />
|
438 |
</p>
|
439 |
<p class="form-data"> <label><?php echo $this->__('Limit'); ?></label>
|
440 |
+
<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>
|
441 |
</p>
|
442 |
<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>
|
443 |
<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. '); ?>
|
456 |
<li><a class="icon_accept" href="#tab2">
|
457 |
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></a></li>
|
458 |
<li><a href="#tab3">
|
459 |
+
<?php echo $this->__('Send a campaign SMS'); ?>
|
460 |
+
</a></li>
|
461 |
</ul>
|
462 |
</div>
|
463 |
<div id="tabs_content_container">
|
464 |
<div id="tab1" class="tab_content" style="display: block;">
|
465 |
<div class="wrapper" style="margin-top:15px;">
|
466 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 ">
|
467 |
+
<input name="order" type="hidden" id="order" value="<?php echo $this->getUrl('sendinblue/ajax/order'); ?>" />
|
468 |
<tr>
|
469 |
<td class="row1 fix_width2" >
|
470 |
<label class="r_label">
|
471 |
+
<?php echo $this->__('Send SMS after order confirmation'); ?></label>
|
472 |
<div class="radio_bx">
|
473 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 1) { echo 'checked'; } ?> class="sms_order_setting radio_nospaceing" type="radio" value="1" />
|
474 |
<?php echo $this->__('Yes'); ?>
|
475 |
+
<input name="sms_order_setting" <?php if($orderSmsStatus == 0) { echo 'checked'; } ?> class="sms_order_setting radio_spaceing2" type="radio" value="0" />
|
476 |
<?php echo $this->__('No'); ?>
|
477 |
</div>
|
478 |
<div style="clear:both;"></div>
|
483 |
<tr>
|
484 |
<td>
|
485 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendorder'); ?>" name="sender_order_form">
|
486 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
487 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding">
|
488 |
<tr>
|
489 |
<td class="fix_width2" valign="top">
|
490 |
<label>
|
491 |
+
<?php echo $this->__('Sender'); ?></label>
|
492 |
</td>
|
493 |
<td>
|
494 |
+
<input name="sender_order" id="sender_order" type="text" value="<?php echo $sendinModule->getSendSmsOrderSubject(); ?>" class="input_bx" autocomplete="off" />
|
495 |
+
<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>
|
496 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_order_text">11</span></em>
|
497 |
</div>
|
498 |
+
|
499 |
</td>
|
500 |
</tr>
|
501 |
<tr>
|
502 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
503 |
<td>
|
504 |
+
<textarea name="sender_order_message" id="sender_order_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsmOrderMessage(); ?></textarea>
|
505 |
+
<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>
|
506 |
<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>
|
507 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_order_message_text">160</span></div>
|
508 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
523 |
<tr>
|
524 |
<td colspan="2" valign="top" border="0">
|
525 |
<form method="POST" action="<?php echo $this->getUrl('*/*/sendordertest'); ?>" name="sender_order_testForm">
|
526 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
527 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
528 |
<tr>
|
529 |
<td>
|
549 |
<div id="tab2" class="tab_content">
|
550 |
<div class="wrapper" style="margin-top:15px;">
|
551 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3">
|
552 |
+
<input name="shiping" type="hidden" id="shiping" value="<?php echo $this->getUrl('sendinblue/ajax/shiping'); ?>" />
|
553 |
<tr>
|
554 |
<td class="row1 fix-width2">
|
555 |
<label class="r_label">
|
556 |
+
<?php echo $this->__('Send a SMS confirmation for the shipment of the order'); ?></label>
|
557 |
<div class="radio_bx">
|
558 |
+
<input name="sms_shiping_setting" <?php if($shipingSmsStatus==1) { echo 'checked'; } ?> class="sms_shiping_setting radio_nospaceing" type="radio" value="1" />
|
559 |
<?php echo $this->__('Yes'); ?>
|
560 |
+
<input name="sms_shiping_setting" type="radio" value="0" class="sms_shiping_setting radio_spaceing2" <?php if($shipingSmsStatus == 0) { echo 'checked'; } ?>/>
|
561 |
<?php echo $this->__('No'); ?>
|
562 |
</div>
|
563 |
<div style="clear:both;"></div>
|
569 |
<td>
|
570 |
<div class="" style="width:500px;">
|
571 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipment'); ?>" name="sender_shipment_form">
|
572 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
573 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
574 |
<tr>
|
575 |
<td class="fix_width2" valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
576 |
<td>
|
577 |
+
<input name="sender_shipment" maxlength="11" id="sender_shipment" type="text" value="<?php echo $sendinModule->getSendSmsShipingSubject(); ?>" class="input_bx" autocomplete="off" />
|
578 |
+
<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>
|
579 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_shipment_text">11</span></em>
|
580 |
</div>
|
581 |
|
582 |
</td>
|
584 |
<tr>
|
585 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
586 |
<td>
|
587 |
+
<textarea name="sender_shipment_message" id="sender_shipment_message" cols="45" rows="5" class="textarea_bx"><?php echo $sendinModule->getSendSmsShipingMessage(); ?></textarea>
|
588 |
+
<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>
|
589 |
<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>
|
590 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_shipment_message_text">160</span></div>
|
591 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
607 |
<tr>
|
608 |
<td colspan="2" valign="top" border="0">
|
609 |
<form method="post" action="<?php echo $this->getUrl('*/*/sendshipmenttest'); ?>" name="sender_order_testForm">
|
610 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
611 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
612 |
<tr>
|
613 |
<td valign="top" colspan="2">
|
633 |
<div id="tab3" class="tab_content">
|
634 |
<div class="wrapper" style="margin-top:15px;">
|
635 |
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3">
|
636 |
+
<input name="campaign" type="hidden" id="campaign" value="<?php echo $this->getUrl('sendinblue/ajax/campaign'); ?>" />
|
637 |
<tr>
|
638 |
<td class="row1 fix_width2">
|
639 |
<label class="r_label"><?php echo $this->__('Send a campaign SMS'); ?></label>
|
640 |
<div class="radio_bx">
|
641 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 1) { echo 'checked'; } ?> class="sms_campaign_setting radio_nospaceing" type="radio" value="1" />
|
642 |
<?php echo $this->__('Yes'); ?>
|
643 |
+
<input name="sms_campaign_setting" <?php if($campaignStatus == 0) { echo 'checked'; } ?> class="sms_campaign_setting radio_spaceing2" type="radio" value="0" />
|
644 |
<?php echo $this->__('No'); ?>
|
645 |
</div>
|
646 |
<div class="hideCampaign">
|
647 |
<div class="form_table ">
|
648 |
|
649 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
<tr>
|
651 |
+
<td>
|
652 |
+
<form method="post" action="<?php echo $this->getUrl('*/*/sendcampaign'); ?>" name="sender_campaign_form">
|
653 |
+
<input name="form_key" type="hidden" value="<?php echo $formKey; ?>" />
|
654 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-list3 no-padding" >
|
655 |
+
<tr>
|
656 |
+
<td class="fix_width2" valign="top"> <label><?php echo $this->__('To'); ?></label></td>
|
657 |
+
<td>
|
658 |
+
<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'; } ?> />
|
659 |
+
<?php echo $this->__('A single contact'); ?>
|
660 |
+
|
661 |
+
<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'; } ?> />
|
662 |
+
<?php echo $this->__('All my Magento customers'); ?>
|
663 |
+
|
664 |
+
<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'; } ?> />
|
665 |
+
<?php echo $this->__('Only subscribed customers'); ?>
|
666 |
+
</td>
|
667 |
+
</tr>
|
668 |
+
<script>
|
669 |
+
jQuery('#r1_Sendin_Sms_Choice').attr('checked', true);
|
670 |
+
</script>
|
671 |
+
<tr>
|
672 |
+
<td><h4 style="margin-top:0;"><?php echo $this->__('SMS settings'); ?></h4></td>
|
673 |
+
<td> </td>
|
674 |
+
</tr>
|
675 |
+
|
676 |
|
677 |
+
<tr class="singlechoice">
|
678 |
+
<td valign="top"><label><?php echo $this->__('Phone number of the contact'); ?>
|
679 |
+
</label></td>
|
680 |
+
<td>
|
681 |
+
<input name="singlechoice" id="singlechoice" maxlength="17" type="text" value="" class="input_bx" /><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>
|
682 |
+
</td>
|
683 |
+
</tr>
|
684 |
+
|
685 |
+
<tr class='sib_datepicker' style="display:none;">
|
686 |
+
<td valign="top"><label><?php echo $this->__('Schedule your sms campaign'); ?></label></td>
|
687 |
+
<td>
|
688 |
+
<input name="sib_datetimepicker" class="input_bx Datepicker" id="sib_datetimepicker" type="text" value="" autocomplete="off" />
|
689 |
+
<select name="hour">
|
690 |
+
<option value='0'><?php echo $this->__('Hour'); ?></option>
|
691 |
+
<?php for($i=1;$i<=23;$i++){ ?>
|
692 |
+
<option><?php echo $i; ?></option>
|
693 |
+
<?php } ?>
|
694 |
+
</select>
|
695 |
+
<select name="minute">
|
696 |
+
<option value='0'><?php echo $this->__('Minute'); ?></option>
|
697 |
+
<?php for($i=5;$i<=55;$i=$i+5){ ?>
|
698 |
+
<option><?php echo $i; ?></option>
|
699 |
+
<?php } ?>
|
700 |
+
</select>
|
701 |
+
|
702 |
+
</td>
|
703 |
+
</tr>
|
704 |
+
|
705 |
+
<tr>
|
706 |
+
<td valign="top"><label><?php echo $this->__('Sender'); ?></label></td>
|
707 |
+
<td>
|
708 |
+
<input name="sender_campaign" maxlength="11" id="sender_campaign" type="text" value="" class="input_bx" autocomplete="off" />
|
709 |
+
<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>
|
710 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?><span id="sender_campaign_text">11</span></em>
|
711 |
+
</div>
|
712 |
+
|
713 |
+
</td>
|
714 |
+
</tr>
|
715 |
+
<tr>
|
716 |
+
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
717 |
+
<td>
|
718 |
+
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
719 |
+
<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>
|
720 |
+
<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>
|
721 |
+
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
722 |
+
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
723 |
+
</div><br>
|
724 |
+
<div class="hintmsg"><em><?php echo $this->__('If you want to personalize the SMS, you can use the variables below:'); ?></em></div>
|
725 |
+
<div class="hintmsg"><em><?php echo $this->__('- For first name use {first_name}'); ?></em></div>
|
726 |
+
<div class="hintmsg"><em><?php echo $this->__('- For last name use {last_name}'); ?></em></div>
|
727 |
+
<input type="submit" class="button mrgn-right btn" value="<?php echo $this->__('Send the campaign'); ?>" name="sender_campaign_save" onclick="return senderCampaignSaveValid('<?php echo $this->__('Please fill the Sender field'); ?>','<?php echo $this->__('Please fill the Message field'); ?>','<?php echo $this->__('Please enter the valid Mobile Number'); ?>');"">
|
728 |
+
</td>
|
729 |
+
</tr>
|
730 |
+
</table>
|
731 |
+
</form>
|
732 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="form-data">
|
733 |
+
<tr>
|
734 |
+
<td>
|
735 |
+
<div class="hintmsg"><em><?php echo $this->__('Sending a test SMS will be deducted from your SMS credits.'); ?></em></div>
|
736 |
+
<label><?php echo $this->__('Send a test SMS'); ?></label>
|
737 |
+
<input name="sender_campaigntest_number" id="sender_campaigntest_number" maxlength="17" type="text" value="" class="input_bx" />
|
738 |
+
<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>
|
739 |
+
<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" />
|
740 |
+
<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'); ?>">
|
741 |
+
</td>
|
742 |
+
</tr>
|
743 |
+
</table>
|
744 |
+
</td>
|
745 |
</tr>
|
746 |
+
</table>
|
747 |
+
</div></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
</td>
|
749 |
</tr>
|
750 |
</table>
|
751 |
+
</div>
|
752 |
</div>
|
753 |
</div>
|
754 |
</div>
|
759 |
</table>
|
760 |
</fieldset>
|
761 |
</div>
|
762 |
+
<?php if($getSyncronize == 1) { ?>
|
763 |
<div class="sendin_row alldiv" <?php echo $style; ?> >
|
764 |
+
<fieldset id="my-fieldset" class="fields">
|
765 |
+
<legend class="lgend"><img src="<?php echo $skinUrl;?>adminhtml/default/default/sendinblue/images/logo.gif"> <?php echo $this->__('Contacts list'); ?> </legend>
|
766 |
|
767 |
+
<input name="ajaxcontentUrl" type="hidden" id="ajaxcontentUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxcontent'); ?>" />
|
768 |
+
<input name="ajaxUrl" type="hidden" id="ajaxUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxupdate'); ?>" />
|
769 |
+
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
770 |
+
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
771 |
+
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
772 |
+
<input name="ajaxSmsSubscribeUrl" type="hidden" id="ajaxSmsSubscribeUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmssubscribe'); ?>" />
|
773 |
+
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
774 |
+
<div id="userGrid">
|
775 |
+
<div class="grid">
|
776 |
+
<div class="hor-scroll">
|
777 |
+
<?php echo $this->__('You have '); ?> <?php echo $sendinModule->getNewsletterSubscribeCount(); ?>
|
778 |
+
<?php echo $this->__(' contacts subscribed and '); ?>
|
779 |
+
<?php echo $sendinModule->getNewsletterUnSubscribeCount(); ?>
|
780 |
+
<?php echo $this->__(' contacts unsubscribed from Magento.'); ?><span id="Spantextmore" >
|
781 |
+
<?php echo $this->__(' For more details,'); ?></span><span id="Spantextless" style="display: none;" >
|
782 |
+
<?php echo $this->__(' For less details,'); ?></span><b>
|
783 |
+
<a href="javascript:void(0);" id="showUserlist" style="color: #000000; outline: 0 none; text-decoration: none;"><?php echo $this->__('click here'); ?></a></b>
|
784 |
+
<br><br>
|
785 |
|
786 |
+
<table cellspacing="0" id="userGrid_table " class="data userDetails" style='display:none;'>
|
787 |
+
<thead>
|
788 |
+
<tr class="headings">
|
789 |
+
<th class="no-link"><span class="nobr"><?php echo $this->__('Email'); ?></span></th>
|
790 |
+
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
791 |
+
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
792 |
+
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
793 |
+
<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>
|
794 |
+
<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>
|
795 |
+
</tr>
|
796 |
+
</thead>
|
797 |
+
<tbody class='midleft'>
|
798 |
+
</tbody>
|
799 |
+
</table>
|
800 |
+
</div>
|
801 |
+
</div>
|
802 |
+
</div>
|
803 |
+
</fieldset>
|
804 |
+
</div>
|
805 |
<?php }} ?>
|
806 |
+
|
app/etc/modules/Sendinblue_Sendinblue.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
<active>true</active>
|
6 |
-
<codePool>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
9 |
-
</config>
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/doubleoptin_temp.html
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
3 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
4 |
+
<title>{title}</title>
|
5 |
+
</head>
|
6 |
+
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #222;">
|
7 |
+
<div class="moz-forward-container">
|
8 |
+
<br>
|
9 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color:#ffffff">
|
10 |
+
<tbody>
|
11 |
+
<tr style="border-collapse:collapse;">
|
12 |
+
<td align="center" style="border-collapse:collapse;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" width="570">
|
14 |
+
<tbody>
|
15 |
+
<tr>
|
16 |
+
<td height="20" style="line-height:0; font-size:0;"><img width="0" height="0" alt="{shop_name}" src="{shop_logo}"></td>
|
17 |
+
</tr>
|
18 |
+
</tbody>
|
19 |
+
</table>
|
20 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
21 |
+
<tbody>
|
22 |
+
<tr>
|
23 |
+
<td style="line-height:0; font-size:0;" height="20">
|
24 |
+
<div style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
25 |
+
Please confirm your subscription</div>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</tbody>
|
29 |
+
</table>
|
30 |
+
<table cellspacing="0" cellpadding="0" border="0" width="540">
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td align="left">
|
34 |
+
|
35 |
+
<div style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
36 |
+
<br>
|
37 |
+
Do you want to receive newsletters from {site_name} ?<br>
|
38 |
+
<br>
|
39 |
+
<a href="{double_optin}" style="color:#ffffff;display:inline-block;font-family:Arial,sans-serif;width:auto;white-space:nowrap;min-height:32px;margin:5px 5px 0 0;padding:0 22px;text-decoration:none;text-align:center;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:0;border-radius:4px;vertical-align:top;background-color:#3276b1" target="_blank">
|
40 |
+
<span style="display:inline;font-family:Arial,sans-serif;text-decoration:none;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:none;background-color:#3276b1;color:#ffffff">Yes, subscribe me to this list.</span></a>
|
41 |
+
<br>
|
42 |
+
<br>
|
43 |
+
If you received this email by mistake, simply delete it. You will not be subscribed to this list if you don't click the confirmation link above.
|
44 |
+
<br><br>
|
45 |
+
{site_name}</div>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
</tbody>
|
53 |
+
</table>
|
54 |
+
<br>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
|
58 |
+
</body></html>
|
app/locale/en_US/template/email/sendin_notification.html
CHANGED
@@ -123,12 +123,12 @@
|
|
123 |
style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0;
|
125 |
line-height:16px; color:#7e7e7e;">
|
126 |
-
|
127 |
<div
|
128 |
style="font-family:arial,sans-serif;
|
129 |
font-size:12px; margin:0;
|
130 |
line-height:16px; color:#7e7e7e;">
|
131 |
-
|
132 |
<div
|
133 |
style="font-family:arial,sans-serif;
|
134 |
font-size:12px; margin:0;
|
@@ -148,7 +148,7 @@
|
|
148 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
149 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
150 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
151 |
-
©
|
152 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
153 |
This is an automatic message generated by SendinBlue.</div>
|
154 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
123 |
style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0;
|
125 |
line-height:16px; color:#7e7e7e;">
|
126 |
+
59 rue Beaubourg</div>
|
127 |
<div
|
128 |
style="font-family:arial,sans-serif;
|
129 |
font-size:12px; margin:0;
|
130 |
line-height:16px; color:#7e7e7e;">
|
131 |
+
75003 Paris - France</div>
|
132 |
<div
|
133 |
style="font-family:arial,sans-serif;
|
134 |
font-size:12px; margin:0;
|
148 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
149 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
150 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
151 |
+
© 2014-2015 SendinBlue, all rights reserved.</div>
|
152 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
153 |
This is an automatic message generated by SendinBlue.</div>
|
154 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
app/locale/en_US/template/email/sendinsmtp_conf.html
CHANGED
@@ -119,10 +119,10 @@
|
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
-
color:#7e7e7e;">
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
-
color:#7e7e7e;">
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -136,7 +136,7 @@
|
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
139 |
-
©
|
140 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
141 |
This is an automatic message generated by SendinBlue.</div>
|
142 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
139 |
+
© 2014-2015 SendinBlue, all rights reserved.</div>
|
140 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
141 |
This is an automatic message generated by SendinBlue.</div>
|
142 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;">
|
app/locale/fr_FR/Sendinblue.csv
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
"No", "Non"
|
21 |
"API Key:", "Clé API:"
|
22 |
"Validate & Save", "Valider et enregistrer"
|
23 |
-
"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/
|
24 |
"Your lists", "Vos listes"
|
25 |
"Activate SendinBlue to manage subscribers", "Activer SendinBlue pour gérer vos contacts"
|
26 |
"Your Lists", "Vos listes"
|
@@ -71,7 +71,7 @@
|
|
71 |
"Send a campaign SMS", "Envoyer une campagne SMS"
|
72 |
"SMS settings", "Paramètres du SMS"
|
73 |
"Sender", "Expéditeur"
|
74 |
-
"This field allows you to
|
75 |
"Number of characters left: ", "Nombre de caractères restants: "
|
76 |
"Attention line break is counted as a single character.", "Attention, un saut de ligne est compté comme un seul caractère. "
|
77 |
" Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.", "Créer le contenu de vos SMS avec une limite de 160 caractères. Au-delà de 160 caractères, il sera compté comme un second SMS. Ainsi, si vous écrivez un SMS de 240 caractères, il sera compté comme deux SMS."
|
@@ -127,4 +127,27 @@
|
|
127 |
"The phone number should be in this form: 0033663309741 for this France mobile 06 63 30 97 41 (0033 is France prefix)", "Le numéro de téléphone mobile devrait être sous cette forme: 0033663309741 pour le numéro français 06 63 30 97 41 (0033 est l'indicatif de la France)"
|
128 |
"Select option", "Sélectionnez"
|
129 |
"Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.", "Synchronisez les contacts de votre site Magento avec SendinBlue & envoyez facilement tous vos emails & SMS marketing et transactionnels."
|
130 |
-
"With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.", "Avec le module SendinBlue, retrouvez tout ce dont vous avez besoin pour envoyer simplement et efficacement vos campagnes emailing & SMS à vos prospects et clients :"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
"No", "Non"
|
21 |
"API Key:", "Clé API:"
|
22 |
"Validate & Save", "Valider et enregistrer"
|
23 |
+
"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/integration", "Veuillez renseigner votre clé API qui est liée à votre compte SendinBlue. Elle est disponible sur cette page: https://my.sendinblue.com/integration. Si vous ne possédez pas de compte SendinBlue, vous devez créer un compte sur le site https://www.sendinblue.com"
|
24 |
"Your lists", "Vos listes"
|
25 |
"Activate SendinBlue to manage subscribers", "Activer SendinBlue pour gérer vos contacts"
|
26 |
"Your Lists", "Vos listes"
|
71 |
"Send a campaign SMS", "Envoyer une campagne SMS"
|
72 |
"SMS settings", "Paramètres du SMS"
|
73 |
"Sender", "Expéditeur"
|
74 |
+
"This field allows you to customize the SMS sender. The number of characters is limited to 11 alphanumeric characters. You can´t configure your Sender with a phone number.", "Ce champs permet de personnaliser l'expéditeur du SMS. Il ne doit pas contenir plus de 11 caractères. Les caractères spéciaux (é, à ...) ne sont pas acceptés."
|
75 |
"Number of characters left: ", "Nombre de caractères restants: "
|
76 |
"Attention line break is counted as a single character.", "Attention, un saut de ligne est compté comme un seul caractère. "
|
77 |
" Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write SMS of 240 characters, it will be recorded using two SMS.", "Créer le contenu de vos SMS avec une limite de 160 caractères. Au-delà de 160 caractères, il sera compté comme un second SMS. Ainsi, si vous écrivez un SMS de 240 caractères, il sera compté comme deux SMS."
|
127 |
"The phone number should be in this form: 0033663309741 for this France mobile 06 63 30 97 41 (0033 is France prefix)", "Le numéro de téléphone mobile devrait être sous cette forme: 0033663309741 pour le numéro français 06 63 30 97 41 (0033 est l'indicatif de la France)"
|
128 |
"Select option", "Sélectionnez"
|
129 |
"Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.", "Synchronisez les contacts de votre site Magento avec SendinBlue & envoyez facilement tous vos emails & SMS marketing et transactionnels."
|
130 |
+
"With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email & SMS campaigns to your prospects and customers.", "Avec le module SendinBlue, retrouvez tout ce dont vous avez besoin pour envoyer simplement et efficacement vos campagnes emailing & SMS à vos prospects et clients :"
|
131 |
+
"Order history has been import successfully", "Historique des commandes a été importé avec succès."
|
132 |
+
"Import the data of previous orders", "Importer les données des anciennes commandes"
|
133 |
+
"Not synchronized", "non synchronized"
|
134 |
+
"Click on the icon to subscribe / unsubscribe the sms from SendinBlue and Magento.", "Cliquez sur l'icône pour inscrire / désinscrire un sms de SendinBlue et Magento."
|
135 |
+
"SMS SendinBlue Status", "Statut SMS sur Sendinblue"
|
136 |
+
"Select template", "Sélectionnez un template"
|
137 |
+
"Manage email template", "Gestion des templates email"
|
138 |
+
"Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter", "Sélectionnez un template SendinBlue qui sera envoyé pour chaque contact qui s'abonne à votre newsletter"
|
139 |
+
"Old subscribers not imported successfully, please click on Import Old Subscribers button to import them again", "Les anciens abonnés n'ont pas été importé. Merci de bien cliquez à nouveau sur le bouton"
|
140 |
+
"Import Old Subscribers", "Importer les anciens abonnés"
|
141 |
+
"No confirmation", "Aucune confirmation"
|
142 |
+
"With this option, contacts are directly added to your list when they enter their email address. No confirmation email is sent.","Avec cette option, votre contact s'inscrit directement à votre liste en laissant son adresse email. Aucun email de confirmation lui est envoyé."
|
143 |
+
"Simple confirmation", "Confirmation simple"
|
144 |
+
"This confirmation email is one of your SMTP templates. By default, we have created a Default Template - Single Confirmation. You can create and activate your SMTP templates by clicking here", "Cet email de confirmation fait partie de vos templates SMTP. Par défaut, nous en avons créé un 'Default Template - Simple Confirmation'."
|
145 |
+
"Double opt-in confirmation", "Double opt-in confirmation"
|
146 |
+
"If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the "FORM" folder, on the "Temp - DOUBLE OPT-IN" list. After confirmation, the contact will be saved in the "Corresponding List" selected below.", "Si vous choisissez la confirmation Double Opt-in, l'abonné recevra un email l'invitant à confirmer son inscription. Avant la confirmation, le contact est sauvegardé dans le dossier 'FORM', liste 'Temp - DOUBLE OPTIN', après confirmation, le contact est sauvegardé dans la 'Liste correspondante' choisie ci-dessous."
|
147 |
+
"Once the form has been completed, your contact will receive an email with a link to confirm their subscription.", "Lorsque le formulaire est rempli, votre contact recevra un email avec un lien de confirmation d'inscription."
|
148 |
+
"Redirect URL after clicking in the validation email", "URL de redirection après clic dans l'email de validation"
|
149 |
+
"Redirect your contacts to a landing page or to your website once they have clicked on the confirmation link in the email.", "Redirigez votre contact vers une landing page ou votre site après qu'il ait validé le lien de confirmation dans l'email."
|
150 |
+
"Send a final confirmation email", "Envoyer un email de confirmation final"
|
151 |
+
"Once a contact has clicked in the double opt-in confirmation email, send them a final confirmation email", "Lorsqu'un contact a cliqué dans le lien de l'email de confirmation double opt-in, lui envoyer un email final de confirmation"
|
152 |
+
"If you select the Double Opt-in confirmation, subscribers will receive an email inviting them to confirm their subscription.Contact will be saved in the 'FORM' folder, on the 'Temp - DOUBLE OPT-IN' list. After confirmation, the contact will be saved in the 'Corresponding List' selected below.", "Si vous choisissez la confirmation Double Opt-in, l'abonné recevra un email l'invitant à confirmer son inscription. Avant la confirmation, le contact est sauvegardé dans le dossier 'FORM', liste 'Temp - DOUBLE OPTIN', après confirmation, le contact est sauvegardé dans la 'Liste correspondante' choisie ci-dessous."
|
153 |
+
"By selecting this option, contacts are directly added to your list when they enter their email address on the form. A confirmation email will automatically be sent following their subscription.", "En choisissant cette option, votre contact s'inscrira directement à la liste en laissant son adresse email dans le formulaire. Un email de confirmation de son inscription lui sera automatiquement envoyé à la suite de son inscription."
|
app/locale/fr_FR/template/email/doubleoptin_temp.html
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
3 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
4 |
+
<title>{title}</title>
|
5 |
+
</head>
|
6 |
+
<body style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #222;">
|
7 |
+
<div class="moz-forward-container">
|
8 |
+
<br>
|
9 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color:#ffffff">
|
10 |
+
<tbody>
|
11 |
+
<tr style="border-collapse:collapse;">
|
12 |
+
<td align="center" style="border-collapse:collapse;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" width="570">
|
14 |
+
<tbody>
|
15 |
+
<tr>
|
16 |
+
<td height="20" style="line-height:0; font-size:0;"><img width="0" height="0" alt="{shop_name}" src="{shop_logo}"></td>
|
17 |
+
</tr>
|
18 |
+
</tbody>
|
19 |
+
</table>
|
20 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
21 |
+
<tbody>
|
22 |
+
<tr>
|
23 |
+
<td style="line-height:0; font-size:0;" height="20">
|
24 |
+
<div style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
25 |
+
Confirmez votre inscription</div>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
</tbody>
|
29 |
+
</table>
|
30 |
+
<table cellspacing="0" cellpadding="0" border="0" width="540">
|
31 |
+
<tbody>
|
32 |
+
<tr>
|
33 |
+
<td align="left">
|
34 |
+
|
35 |
+
<div style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
36 |
+
<br>
|
37 |
+
Voulez vous recevoir les newsletters de {site_name} ?<br>
|
38 |
+
<br>
|
39 |
+
<a href="{double_optin}" style="color:#ffffff;display:inline-block;font-family:Arial,sans-serif;width:auto;white-space:nowrap;min-height:32px;margin:5px 5px 0 0;padding:0 22px;text-decoration:none;text-align:center;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:0;border-radius:4px;vertical-align:top;background-color:#3276b1" target="_blank">
|
40 |
+
<span style="display:inline;font-family:Arial,sans-serif;text-decoration:none;font-weight:bold;font-style:normal;font-size:15px;line-height:32px;border:none;background-color:#3276b1;color:#ffffff">Oui, je confirme mon inscription</span></a>
|
41 |
+
<br>
|
42 |
+
<br>
|
43 |
+
Si vous recevez cet email par erreur, vous pouvez simplement le supprimer. Vous ne serez pas inscrit à la newsletter si vous ne cliquez pas sur le lien de confirmation ci-dessus.
|
44 |
+
<br><br>
|
45 |
+
{site_name}</div>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
</tbody>
|
53 |
+
</table>
|
54 |
+
<br>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
|
58 |
+
</body></html>
|
app/locale/fr_FR/template/email/sendin_notification.html
CHANGED
@@ -117,10 +117,10 @@
|
|
117 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
118 |
<div style="font-family:arial,sans-serif;
|
119 |
font-size:12px; margin:0; line-height:16px;
|
120 |
-
color:#7e7e7e;">
|
121 |
<div style="font-family:arial,sans-serif;
|
122 |
font-size:12px; margin:0; line-height:16px;
|
123 |
-
color:#7e7e7e;">
|
124 |
<div style="font-family:arial,sans-serif;
|
125 |
font-size:12px; margin:0; line-height:16px;
|
126 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -133,7 +133,7 @@
|
|
133 |
<td align="right" valign="top">
|
134 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
135 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
136 |
-
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> ©
|
137 |
réservés.
|
138 |
</div>
|
139 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
117 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
118 |
<div style="font-family:arial,sans-serif;
|
119 |
font-size:12px; margin:0; line-height:16px;
|
120 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
121 |
<div style="font-family:arial,sans-serif;
|
122 |
font-size:12px; margin:0; line-height:16px;
|
123 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
124 |
<div style="font-family:arial,sans-serif;
|
125 |
font-size:12px; margin:0; line-height:16px;
|
126 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
133 |
<td align="right" valign="top">
|
134 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
135 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
136 |
+
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> © 2014-2015 SendinBlue, tous droits
|
137 |
réservés.
|
138 |
</div>
|
139 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
app/locale/fr_FR/template/email/sendinsmtp_conf.html
CHANGED
@@ -119,10 +119,10 @@
|
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
-
color:#7e7e7e;">
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
-
color:#7e7e7e;">
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
@@ -135,7 +135,7 @@
|
|
135 |
<td align="right" valign="top">
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
-
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> ©
|
139 |
réservés.
|
140 |
</div>
|
141 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
119 |
color:#7e7e7e;"> <strong style="color:#2f8bee;">SendinBlue</strong></div>
|
120 |
<div style="font-family:arial,sans-serif;
|
121 |
font-size:12px; margin:0; line-height:16px;
|
122 |
+
color:#7e7e7e;"> 59 rue Beaubourg</div>
|
123 |
<div style="font-family:arial,sans-serif;
|
124 |
font-size:12px; margin:0; line-height:16px;
|
125 |
+
color:#7e7e7e;"> 75003 Paris - France</div>
|
126 |
<div style="font-family:arial,sans-serif;
|
127 |
font-size:12px; margin:0; line-height:16px;
|
128 |
color:#7e7e7e;"> Tél : 0899 25 30 61</div>
|
135 |
<td align="right" valign="top">
|
136 |
<div style="font-family:arial,sans-serif; font-size:12px; margin:0; line-height:20px; color:#7e7e7e;">
|
137 |
<a href="http://www.facebook.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Facebook" src="https://my.sendinblue.com/public/upload/14406/images/523693143fe88.gif" style="border:none;"> </a> <a href="https://twitter.com/SendinBlue" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Twitter" src="https://my.sendinblue.com/public/upload/14406/images/5236931746c01.gif" style="border:none;"> </a> <a href="http://www.linkedin.com/company/mailin" style="color:#2f8bee; text-decoration:none;" target="_blank"> <img alt="Linkedin" src="https://my.sendinblue.com/public/upload/14406/images/5236931ad253b.gif" style="border:none;"> </a> <a href="http://sendinblue.tumblr.com/" style="color:#2f8bee; text-decoration:none;" target="_blank">Blog</a></div>
|
138 |
+
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> © 2014-2015 SendinBlue, tous droits
|
139 |
réservés.
|
140 |
</div>
|
141 |
<div style="font-family:arial,sans-serif; font-size:10px; margin:0; line-height:14px; color:#7e7e7e;"> Ceci est un message automatique
|
package.xml
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.</summary>
|
10 |
-
<description>With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email and SMS campaigns to your prospects and customers
|
11 |
-
Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)
|
12 |
-
Easily create good looking emailings
|
13 |
-
Schedule your campaigns
|
14 |
-
Track your results and optimize
|
15 |
-
Monitor your transactional emails (purchase confirmation, password reset, etc) with a better deliverability and real-time analytics
|
16 |
-
Why should you use SendinBlue
|
17 |
-
Optimized deliverability
|
18 |
-
Unbeatable pricing
|
19 |
Technical support, by phone or by email</description>
|
20 |
<notes>Synchronize your Magento contacts with SendinBlue platform, send your marketing and transactional emails and SMS</notes>
|
21 |
-
<authors><author><name>
|
22 |
-
<date>2014-
|
23 |
-
<time>10:
|
24 |
-
<contents><target name="
|
25 |
-
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
-
<dependencies><required><php><min>5.0.0</min><max>
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
+
<version>1.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Synchronize your Magento contacts with SendinBlue platform, easily send your marketing and transactional emails and SMS.</summary>
|
10 |
+
<description>With the SendinBlue plugin, you can find everything you need to easily and efficiently send your email and SMS campaigns to your prospects and customers.
|
11 |
+
Synchronize your subscribers with SendinBlue (subscribed and unsubscribed contacts)
|
12 |
+
Easily create good looking emailings
|
13 |
+
Schedule your campaigns
|
14 |
+
Track your results and optimize
|
15 |
+
Monitor your transactional emails (purchase confirmation, password reset, etc) with a better deliverability and real-time analytics
|
16 |
+
Why should you use SendinBlue
|
17 |
+
Optimized deliverability
|
18 |
+
Unbeatable pricing–best value in the industry
|
19 |
Technical support, by phone or by email</description>
|
20 |
<notes>Synchronize your Magento contacts with SendinBlue platform, send your marketing and transactional emails and SMS</notes>
|
21 |
+
<authors><author><name>Sendinblue</name><user>Sendinblue_Team</user><email>contact@sendinblue.com</email></author></authors>
|
22 |
+
<date>2014-03-04</date>
|
23 |
+
<time>10:55:22</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Sendinblue"><dir name="Sendinblue"><dir name="Block"><file name="Sendinblue.php" hash="4b5adae031b714e188d576e306bfd5a1"/></dir><dir name="Helper"><file name="Data.php" hash="0532b48f611c1cc623589d5792e0dbf2"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="6d2d6eac00b7bd6da3ff53d2abe40dd4"/></dir><file name="Email.php" hash="fe07aa2dba951ee117bda2cefebfb875"/><dir name="Mysql4"><dir name="Sendinblue"><file name="Collection.php" hash="d6aff03eda9a6b2ee1c42b8dd50df402"/></dir><file name="Sendinblue.php" hash="c000c1f6a277f7c9a91ad628b02eb001"/></dir><file name="Observer.php" hash="250cc069aa5194652f6503e2cc0f8194"/><file name="Psmailin.php" hash="735ede0b7d71a71e2ce82690937bf678"/><file name="Sendinblue.php" hash="963c473c2f3ca66f23d00de0c4c9292f"/><file name="Status.php" hash="444fe4d099bd23a9d87cdf7e2b2e6cbb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MyformController.php" hash="67dd963b1f003d2b2f25c8b4643d4715"/><file name="NotifyController.php" hash="e3b43db59f8c5b7c8cd54a58a7bc2d1b"/><file name="SyncController.php" hash="352fd0d804701d0228bad7e7b92afb58"/></dir><file name="AjaxController.php" hash="b4914ddac9d4e836ecf53869055a6a82"/><file name="IndexController.php" hash="2cf5287ba31d6960eb28c2cbc03a60ed"/></dir><dir name="etc"><file name="adminhtml.xml" hash="640ba5382a16c749fc56a2a8283682ee"/><file name="config.xml" hash="ba48680b7267a4b2d27f4645792b2393"/></dir><dir name="sql"><dir name="sendinblue_setup"><file name="mysql4-install-0.1.0.php" hash="58bb365dcb29115c66f2fa3f17dcb697"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="b50e876441a247cd5feb2614ff649fd3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="e23253764fbbf0e3a2f1cb5ff65eb318"/></dir><dir name="template"><dir name="sendinblue"><file name="myform.phtml" hash="2a4748e2e456d2b95d9828bf2da90bd8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="61346d8b2b321b10c09a77fef39ec112"/></dir><dir name="template"><dir name="sendinblue"><dir name="account"><file name="edit.phtml" hash="c2b17e90e59e1d13791feded28982330"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendinblue_Sendinblue.xml" hash="1a245999d412c36ea9666b56bfc63e2d"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sendinblue.csv" hash="72507895f18a8c4a80611065790aba56"/></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="fr_FR"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="557ddb7212800b4a99937b2d8956270c"/><file name="sendinsmtp_conf.html" hash="b1c790c78605b2beb4cd38152cd8f0ca"/><file name="doubleoptin_temp.html" hash="ec6aa9880db3cc1227ad87bf0e92f233"/>
|
25 |
+
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/><file name="doubleoptin_temp.html" hash="1653f3195b1ef9e1e971c08df3b5ac04"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
|
28 |
</package>
|
skin/adminhtml/default/default/sendinblue/css/styles.css
CHANGED
@@ -6,6 +6,10 @@
|
|
6 |
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
7 |
* needs then we can't provide a technical support.
|
8 |
*/
|
|
|
|
|
|
|
|
|
9 |
|
10 |
.pagination{width:620px; height:25px; margin:0 auto;}
|
11 |
.pagination ul li{list-style:none; float:left; border:1px solid #000; padding:2px 6px 2px 6px; margin:0 3px 0 3px; font-family:arial; font-size:12px; color:#000; font-weight:bold; background-color:#f2f2f2;}
|
@@ -20,7 +24,7 @@
|
|
20 |
.sendin_row {clear:both; margin-top:40px; width:100%;}
|
21 |
.contact-details {border:1px dashed #666666; float:right; height:205px; margin-left:12px; margin-right:12px; margin-top:10px; padding:8px; width:350px; position: absolute; right: 0;}
|
22 |
fieldset.fields {background-color:#EBEDF4; border:1px solid; margin-bottom:10px; padding:20px 0 10px 10px; position:relative;}
|
23 |
-
fieldset legend {background-color:#EBEDF4; border:1px solid #DFD5C3; display:inline; visibility:visible; float:left; font:bold 13px/13px Arial; margin:0; padding:4px 10px; position:absolute; top:-15px; width:inherit !important; height:auto;}
|
24 |
ul.listt {text-align:justify; margin:8px 0px 8px 0px;list-style:none; padding:0px; width:800px;}
|
25 |
ul.listt li:before{ content:"-"; position:relative; left:-2px;}
|
26 |
ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
@@ -35,9 +39,6 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
35 |
width: 491px;
|
36 |
}
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
.btn {
|
42 |
display: inline-block;
|
43 |
*display: inline;
|
@@ -159,10 +160,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
159 |
.tab_content {
|
160 |
display: none;
|
161 |
}
|
162 |
-
|
163 |
-
width:820px;
|
164 |
-
margin:0px auto;
|
165 |
-
}*/
|
166 |
.wrapper .row1 {
|
167 |
padding:/*10px 12px*/0px;
|
168 |
border:none;
|
@@ -172,9 +170,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
172 |
margin-top:23px;
|
173 |
clear:both;
|
174 |
}
|
175 |
-
|
176 |
-
margin-bottom:12px;
|
177 |
-
}
|
178 |
.r_label {
|
179 |
float:left;
|
180 |
width: auto;
|
@@ -240,28 +236,6 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
240 |
/* padding: 0 4px 0 6px;*/
|
241 |
}
|
242 |
|
243 |
-
/*Form*/
|
244 |
-
/*.table tr td {
|
245 |
-
color: #996633;
|
246 |
-
font-size:12px;
|
247 |
-
}
|
248 |
-
.sendin_row .form-list label{ width:670px; float:left; padding-right:20px; padding-top:0px; text-align:right;}
|
249 |
-
.sendin_row .form-list2 label{ width:385px; padding-right:20px; padding-top:0px;}
|
250 |
-
.sendin_row .form-list3 label{ width:295px; padding-right:20px; padding-top:0px;text-align:left!important;}
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
.label-small{ width:30px!important; text-align:left!important;}
|
255 |
-
.no-padding td{ padding:0px!important;}
|
256 |
-
.clear{ clear:both;}
|
257 |
-
.module_error.error{ padding-top: 8px!important;}
|
258 |
-
.module_error.error p{ display:inline-block;}
|
259 |
-
#content .alert{ width:auto!important;}
|
260 |
-
.tablepadding td{padding:5px 0px;}
|
261 |
-
.btnmrgn-right{
|
262 |
-
margin-top:12px;
|
263 |
-
margin-right:26px;
|
264 |
-
float:right;}*/
|
265 |
.radio_nospaceing{
|
266 |
margin:0px 10px 0px 0px;}
|
267 |
.radio_spaceing {
|
@@ -280,11 +254,7 @@ ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
|
280 |
|
281 |
.mrgin-left{ margin-left:466px;}
|
282 |
/*Design matched style*/
|
283 |
-
|
284 |
-
p {
|
285 |
-
color: #585A69;
|
286 |
-
margin: 0.5em 0;
|
287 |
-
}
|
288 |
|
289 |
.fix_width{width:450px}
|
290 |
.fix_width2{width:350px}
|
@@ -324,9 +294,19 @@ color:#585A69;
|
|
324 |
}
|
325 |
|
326 |
input.input-text, textarea, select { border:1px solid #c8c8c8;}
|
327 |
-
input.input-text{padding:3px 5px;}
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
* versions in the future. If you wish to customize Sendinblue magento plugin for your
|
7 |
* needs then we can't provide a technical support.
|
8 |
*/
|
9 |
+
a {
|
10 |
+
color: #000;
|
11 |
+
text-decoration: underline;
|
12 |
+
}
|
13 |
|
14 |
.pagination{width:620px; height:25px; margin:0 auto;}
|
15 |
.pagination ul li{list-style:none; float:left; border:1px solid #000; padding:2px 6px 2px 6px; margin:0 3px 0 3px; font-family:arial; font-size:12px; color:#000; font-weight:bold; background-color:#f2f2f2;}
|
24 |
.sendin_row {clear:both; margin-top:40px; width:100%;}
|
25 |
.contact-details {border:1px dashed #666666; float:right; height:205px; margin-left:12px; margin-right:12px; margin-top:10px; padding:8px; width:350px; position: absolute; right: 0;}
|
26 |
fieldset.fields {background-color:#EBEDF4; border:1px solid; margin-bottom:10px; padding:20px 0 10px 10px; position:relative;}
|
27 |
+
fieldset legend.lgend {background-color:#EBEDF4; border:1px solid #DFD5C3; display:inline; visibility:visible; float:left; font:bold 13px/13px Arial; margin:0; padding:4px 10px; position:absolute; top:-15px; width:inherit !important; height:auto;}
|
28 |
ul.listt {text-align:justify; margin:8px 0px 8px 0px;list-style:none; padding:0px; width:800px;}
|
29 |
ul.listt li:before{ content:"-"; position:relative; left:-2px;}
|
30 |
ul.listt li{ text-indent:-5px; padding:5px 0px 5px 10px;}
|
39 |
width: 491px;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
42 |
.btn {
|
43 |
display: inline-block;
|
44 |
*display: inline;
|
160 |
.tab_content {
|
161 |
display: none;
|
162 |
}
|
163 |
+
|
|
|
|
|
|
|
164 |
.wrapper .row1 {
|
165 |
padding:/*10px 12px*/0px;
|
166 |
border:none;
|
170 |
margin-top:23px;
|
171 |
clear:both;
|
172 |
}
|
173 |
+
|
|
|
|
|
174 |
.r_label {
|
175 |
float:left;
|
176 |
width: auto;
|
236 |
/* padding: 0 4px 0 6px;*/
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
.radio_nospaceing{
|
240 |
margin:0px 10px 0px 0px;}
|
241 |
.radio_spaceing {
|
254 |
|
255 |
.mrgin-left{ margin-left:466px;}
|
256 |
/*Design matched style*/
|
257 |
+
|
|
|
|
|
|
|
|
|
258 |
|
259 |
.fix_width{width:450px}
|
260 |
.fix_width2{width:350px}
|
294 |
}
|
295 |
|
296 |
input.input-text, textarea, select { border:1px solid #c8c8c8;}
|
297 |
+
/*input.input-text{padding:3px 5px;}*/
|
298 |
+
|
299 |
+
.grid table td a{color: #000000;
|
300 |
+
text-decoration: none;}
|
301 |
+
.inner_manage_box {
|
302 |
+
display: none;
|
303 |
+
}
|
304 |
+
.radio_group_option label{width:auto;}
|
305 |
+
.radio_group_option input[type=radio]{float: left;margin-right: 5px;}
|
306 |
+
.radio_group_option .manage_subscribe_block{margin-bottom: 8px;}
|
307 |
+
.inner_manage_box{margin: 3px 0 0 20px;}
|
308 |
+
.manage_subscribe_block label{padding-right:5px;}
|
309 |
+
.clearfix{clear:both;width:100%;}
|
310 |
+
.tableblock tr td{padding:5px; border-bottom:0px;}
|
311 |
+
|
312 |
+
.manage_subscribe_block label{text-align:left; width: auto;}
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.js
CHANGED
@@ -11,33 +11,60 @@ jQuery.noConflict();
|
|
11 |
jQuery(document)
|
12 |
.ready(
|
13 |
function() {
|
14 |
-
|
15 |
-
|
16 |
var apistatuskey = jQuery('#apistatuskey').val();
|
17 |
-
|
18 |
jQuery("#select").multiselect();
|
19 |
-
|
20 |
jQuery(".sendin_api_status").click(function()
|
21 |
-
{
|
22 |
if (apistatuskey == 1 && jQuery(this).val() == 1)
|
23 |
-
{
|
24 |
-
|
25 |
jQuery("#sendin_apikey").show();
|
26 |
jQuery(".alldiv").show();
|
27 |
jQuery(".hidetableblock").show();
|
28 |
-
|
29 |
-
}
|
30 |
else{
|
31 |
if(jQuery(this).val() == 1)
|
32 |
{
|
33 |
-
|
34 |
}else{
|
35 |
jQuery("#sendin_apikey").hide();
|
36 |
jQuery(".alldiv").hide();
|
37 |
}
|
38 |
-
}
|
39 |
-
|
40 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function loadData(page) {
|
42 |
var ajaxcontentUrl = jQuery("#ajaxcontentUrl").val();
|
43 |
jQuery.ajax({
|
@@ -59,26 +86,19 @@ jQuery(document)
|
|
59 |
});
|
60 |
}
|
61 |
});
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
}
|
66 |
|
67 |
jQuery('.hdtab').click(function(){
|
68 |
-
if(parseInt(jQuery(this).val())) { jQuery('#hidetabselect').css('display','block');}
|
69 |
-
|
70 |
});
|
71 |
-
|
72 |
|
73 |
jQuery('body').on('click',' .pagination li.active',function() {
|
74 |
var page = jQuery(this).attr('p');
|
75 |
jQuery('#pagenumber').val(page);
|
76 |
loadData(page);
|
77 |
-
|
78 |
});
|
79 |
|
80 |
-
|
81 |
-
jQuery('.toolTip').hover(function () {
|
82 |
var title = jQuery(this).attr('title');
|
83 |
var offset = jQuery(this).offset();
|
84 |
|
@@ -95,24 +115,23 @@ jQuery(document)
|
|
95 |
jQuery('#sender_order').mouseover(function () {
|
96 |
var val = jQuery(this).val();
|
97 |
if(isInteger(val) || val == ''){
|
98 |
-
jQuery("#sender_order").attr('maxlength','
|
99 |
-
jQuery('#sender_order_text').text((
|
100 |
|
101 |
}
|
102 |
else{
|
103 |
jQuery("#sender_order").attr('maxlength','11');
|
104 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
105 |
jQuery("#sender_order").val(str7);
|
106 |
-
jQuery('#sender_order_text').text((11 - val.length));
|
107 |
-
|
108 |
-
}
|
109 |
});
|
110 |
|
111 |
jQuery('#sender_order').keyup(function () {
|
112 |
var val = jQuery(this).val();
|
113 |
if(isInteger(val) || val == ''){
|
114 |
-
jQuery("#sender_order").attr('maxlength','
|
115 |
-
jQuery('#sender_order_text').text((
|
116 |
|
117 |
}
|
118 |
else{
|
@@ -124,129 +143,119 @@ jQuery(document)
|
|
124 |
}
|
125 |
});
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
|
129 |
if(jQuery('#sender_order').val() != '')
|
130 |
{
|
131 |
var val = jQuery('#sender_order').val();
|
132 |
if(isInteger(val)){
|
133 |
-
jQuery("#sender_order").attr('maxlength','
|
134 |
-
jQuery('#sender_order_text').text((
|
135 |
|
136 |
}
|
137 |
else{
|
138 |
jQuery("#sender_order").attr('maxlength','11');
|
139 |
-
jQuery('#sender_order_text').text((11 - val.length));
|
140 |
-
|
141 |
}
|
142 |
}
|
143 |
-
|
144 |
jQuery('#sender_order_message').keyup(function () {
|
145 |
-
|
146 |
-
var chars = this.value.length,
|
147 |
messages = Math.ceil(chars / 160),
|
148 |
-
remaining = messages * 160 -
|
149 |
-
if(remaining == 0)
|
150 |
-
{
|
151 |
-
remaining = 160.
|
152 |
-
}
|
153 |
|
154 |
jQuery('#sender_order_message_text').text(remaining);
|
155 |
|
156 |
jQuery('#sender_order_message_text_count').text(messages);
|
157 |
-
|
158 |
});
|
159 |
|
160 |
if(jQuery('#sender_order_message').val() != '')
|
161 |
{
|
162 |
var chars = jQuery('#sender_order_message').val().length,
|
163 |
messages = Math.ceil(chars / 160),
|
164 |
-
remaining = messages * 160 -
|
165 |
|
166 |
jQuery('#sender_order_message_text').text(remaining);
|
167 |
|
168 |
jQuery('#sender_order_message_text_count').text(messages);
|
169 |
}
|
170 |
-
|
171 |
jQuery('#sender_shipment').mouseover(function () {
|
172 |
var val = jQuery(this).val();
|
173 |
|
174 |
if(isInteger(val) || val == ''){
|
175 |
-
jQuery("#sender_shipment").attr('maxlength','
|
176 |
-
jQuery('#sender_shipment_text').text((
|
177 |
-
|
178 |
}
|
179 |
else{
|
180 |
jQuery("#sender_shipment").attr('maxlength','11');
|
181 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
182 |
jQuery("#sender_shipment").val(str7);
|
183 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
184 |
-
|
185 |
}
|
186 |
});
|
187 |
jQuery('#sender_shipment').keyup(function () {
|
188 |
-
var val = jQuery(this).val();
|
189 |
-
|
190 |
if(isInteger(val) || val == ''){
|
191 |
-
jQuery("#sender_shipment").attr('maxlength','
|
192 |
-
jQuery('#sender_shipment_text').text((
|
193 |
-
|
194 |
}
|
195 |
else{
|
196 |
jQuery("#sender_shipment").attr('maxlength','11');
|
197 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
198 |
jQuery("#sender_shipment").val(str7);
|
199 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
200 |
-
|
201 |
}
|
202 |
});
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
204 |
if(jQuery('#sender_shipment').val() != '')
|
205 |
{
|
206 |
var val = jQuery('#sender_shipment').val();
|
207 |
if(isInteger(val)){
|
208 |
-
jQuery("#sender_shipment").attr('maxlength','
|
209 |
-
jQuery('#sender_shipment_text').text((
|
210 |
-
|
211 |
}
|
212 |
else{
|
213 |
jQuery("#sender_shipment").attr('maxlength','11');
|
214 |
-
jQuery('#sender_shipment_text').text((11 - val.length));
|
215 |
-
|
216 |
}
|
217 |
}
|
218 |
-
|
219 |
jQuery('#sender_shipment_message').keyup(function () {
|
220 |
|
221 |
var chars = this.value.length,
|
222 |
messages = Math.ceil(chars / 160),
|
223 |
-
remaining = messages * 160 -
|
224 |
-
if(remaining == 0)
|
225 |
-
{
|
226 |
-
remaining = 160.
|
227 |
-
}
|
228 |
-
jQuery('#sender_shipment_message_text').text(remaining);
|
229 |
|
230 |
-
|
231 |
-
|
232 |
});
|
233 |
-
|
234 |
if(jQuery('#sender_shipment_message').val() != '')
|
235 |
{
|
236 |
var chars = jQuery('#sender_shipment_message').val().length,
|
237 |
messages = Math.ceil(chars / 160),
|
238 |
-
remaining = messages * 160 -
|
239 |
|
240 |
jQuery('#sender_shipment_message_text').text(remaining);
|
241 |
-
|
242 |
jQuery('#sender_shipment_message_text_count').text(messages);
|
243 |
}
|
244 |
-
|
245 |
jQuery('#sender_campaign').mouseover(function () {
|
246 |
var val = jQuery(this).val();
|
247 |
if(isInteger(val) || val == ''){
|
248 |
-
jQuery("#sender_campaign").attr('maxlength','
|
249 |
-
jQuery('#sender_campaign_text').text((
|
250 |
|
251 |
}
|
252 |
else{
|
@@ -261,26 +270,28 @@ jQuery(document)
|
|
261 |
var val = jQuery(this).val();
|
262 |
|
263 |
if(isInteger(val) || val == ''){
|
264 |
-
jQuery("#sender_campaign").attr('maxlength','
|
265 |
-
jQuery('#sender_campaign_text').text((
|
266 |
-
|
267 |
}
|
268 |
else{
|
269 |
jQuery("#sender_campaign").attr('maxlength','11');
|
270 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
271 |
jQuery("#sender_campaign").val(str7);
|
272 |
-
jQuery('#sender_campaign_text').text((11 - val.length));
|
273 |
-
|
274 |
}
|
275 |
});
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
277 |
if(jQuery('#sender_campaign').val() != '')
|
278 |
{
|
279 |
-
var val = jQuery('#sender_campaign').val();
|
280 |
-
|
281 |
if(isInteger(val)){
|
282 |
-
jQuery("#sender_campaign").attr('maxlength','
|
283 |
-
jQuery('#sender_campaign_text').text((
|
284 |
}
|
285 |
else{
|
286 |
jQuery("#sender_campaign").attr('maxlength','11');
|
@@ -293,15 +304,11 @@ jQuery(document)
|
|
293 |
var chars = this.value.length,
|
294 |
messages = Math.ceil(chars / 160),
|
295 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
296 |
-
|
297 |
-
{
|
298 |
-
remaining = 160.
|
299 |
-
}
|
300 |
jQuery('#sender_campaign_message_text').text(remaining);
|
301 |
-
jQuery('#sender_campaign_message_text_count').text(messages);
|
302 |
-
|
303 |
});
|
304 |
-
|
305 |
if(jQuery('#sender_campaign_message').val() != '')
|
306 |
{
|
307 |
var chars = jQuery('#sender_campaign_message').val().length,
|
@@ -309,10 +316,9 @@ jQuery(document)
|
|
309 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
310 |
|
311 |
jQuery('#sender_campaign_message_text').text(remaining);
|
312 |
-
|
313 |
jQuery('#sender_campaign_message_text_count').text(messages);
|
314 |
}
|
315 |
-
|
316 |
jQuery(".sms_order_setting").click(function () {
|
317 |
var orderSetting = jQuery(this).val();
|
318 |
var orderUrl = jQuery("#order").val();
|
@@ -333,13 +339,13 @@ jQuery(document)
|
|
333 |
jQuery(".hideOrder").hide();
|
334 |
}
|
335 |
}
|
336 |
-
});
|
337 |
-
|
338 |
});
|
|
|
339 |
jQuery(".sms_shiping_setting").click(function () {
|
340 |
var shipingSetting = jQuery(this).val();
|
341 |
var shipingUrl = jQuery("#shiping").val();
|
342 |
-
|
343 |
jQuery.ajax({
|
344 |
type: "POST",
|
345 |
async: false,
|
@@ -357,7 +363,6 @@ jQuery(document)
|
|
357 |
}
|
358 |
}
|
359 |
});
|
360 |
-
|
361 |
});
|
362 |
|
363 |
jQuery(".sms_campaign_setting").click(function () {
|
@@ -380,10 +385,9 @@ jQuery(document)
|
|
380 |
jQuery(".hideCampaign").hide();
|
381 |
}
|
382 |
}
|
383 |
-
});
|
384 |
-
|
385 |
});
|
386 |
-
|
387 |
if (jQuery('input:radio[name=sms_order_setting]:checked').val() == 0)
|
388 |
{
|
389 |
jQuery('.hideOrder').hide();
|
@@ -392,7 +396,7 @@ jQuery(document)
|
|
392 |
}
|
393 |
|
394 |
jQuery(".Sendin_Sms_Choice").click(function ()
|
395 |
-
{
|
396 |
if (jQuery(this).val() == 1) {
|
397 |
jQuery(".multiplechoice").hide();
|
398 |
jQuery(".singlechoice").show();
|
@@ -401,6 +405,14 @@ jQuery(document)
|
|
401 |
jQuery(".singlechoice").hide();
|
402 |
}
|
403 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
if (jQuery('input:radio[name=Sendin_Sms_Choice]:checked').val() == 0)
|
406 |
{
|
@@ -418,15 +430,13 @@ jQuery(document)
|
|
418 |
} else {
|
419 |
jQuery(".hideShiping").hide();
|
420 |
}
|
421 |
-
});
|
422 |
-
|
423 |
-
|
424 |
if (jQuery('input:radio[name=sms_credit]:checked').val() == 0)
|
425 |
jQuery(".hideCredit").hide();
|
426 |
else
|
427 |
jQuery(".hideCredit").show();
|
428 |
-
|
429 |
-
|
430 |
jQuery(".sms_credit").click(function (){
|
431 |
|
432 |
var sms_credit = jQuery(this).val();
|
@@ -503,252 +513,296 @@ jQuery(document)
|
|
503 |
return true
|
504 |
}
|
505 |
return false;
|
506 |
-
}
|
507 |
-
|
508 |
-
|
509 |
-
jQuery('#showUserlist').click(function(){
|
510 |
-
|
511 |
-
if(jQuery('.userDetails').is(':hidden'))
|
512 |
-
{
|
513 |
-
loadData(1);
|
514 |
-
jQuery('#Spantextless').show();
|
515 |
-
jQuery('#Spantextmore').hide();
|
516 |
-
}else
|
517 |
-
{
|
518 |
-
jQuery('#Spantextmore').show();
|
519 |
-
jQuery('#Spantextless').hide();
|
520 |
-
}
|
521 |
-
jQuery('.userDetails').slideToggle();
|
522 |
-
});
|
523 |
-
|
524 |
-
var base_url = getBaseURL();
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
var trackingUrl = jQuery("#trackingUrl").val();
|
530 |
-
jQuery.ajax({
|
531 |
-
type : "POST",
|
532 |
-
async : false,
|
533 |
-
url : trackingUrl,
|
534 |
-
data : "script=" + Tracking,
|
535 |
-
beforeSend : function(){
|
536 |
-
jQuery('#ajax-busy').show();
|
537 |
-
},
|
538 |
-
success : function(msg){
|
539 |
-
jQuery('#ajax-busy').hide();
|
540 |
-
}
|
541 |
-
});
|
542 |
-
});
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
jQuery(".smtpStatus").click(function() {
|
548 |
-
|
549 |
-
var smtptest = jQuery(this).val();
|
550 |
-
var smtpUrl = jQuery("#smtpUrl").val();
|
551 |
-
if (smtptest == 0) {
|
552 |
-
jQuery('.smtptest').hide();
|
553 |
-
}
|
554 |
-
if (smtptest == 1) {
|
555 |
-
jQuery('.smtptest').show();
|
556 |
-
}
|
557 |
-
jQuery.ajax({
|
558 |
-
type : "POST",
|
559 |
-
async : false,
|
560 |
-
url : smtpUrl,
|
561 |
-
data : "smtptest=" + smtptest,
|
562 |
-
beforeSend : function() {
|
563 |
-
jQuery('#ajax-busy').show();
|
564 |
-
},
|
565 |
-
success : function(msg) {
|
566 |
-
jQuery('#ajax-busy').hide();
|
567 |
-
}
|
568 |
-
});
|
569 |
-
});
|
570 |
-
|
571 |
-
|
572 |
-
var skin_url = jQuery('#skin_url').val()
|
573 |
-
jQuery('<div id="ajax-busy"/> loading..')
|
574 |
-
.css(
|
575 |
-
{
|
576 |
-
opacity : 0.5,
|
577 |
-
position : 'fixed',
|
578 |
-
top : 0,
|
579 |
-
left : 0,
|
580 |
-
width : '100%',
|
581 |
-
height : jQuery(window).height() + 'px',
|
582 |
-
background : 'white url('+skin_url+'adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center'
|
583 |
-
}).hide().appendTo('body');
|
584 |
-
|
585 |
-
// get site base url
|
586 |
-
function getBaseURL() {
|
587 |
-
var sBase = location.href.substr(0, location.href.lastIndexOf("/") + 1);
|
588 |
-
var sp = sBase.split('/');
|
589 |
-
var lastFolder = sp[ sp.length - 2 ];
|
590 |
-
return sBase.replace(lastFolder+'/', '');
|
591 |
-
}
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
jQuery('body').on('click', '.ajax_contacts_href', function (e) {
|
596 |
-
|
597 |
-
var email = jQuery(this).attr('email');
|
598 |
-
var status = jQuery(this).attr('status');
|
599 |
-
var ajaxUrl = jQuery("#ajaxUrl").val();
|
600 |
-
|
601 |
-
jQuery.ajax({
|
602 |
-
type : "POST",
|
603 |
-
async : false,
|
604 |
-
url : ajaxUrl,
|
605 |
-
data : {"email":email,"newsletter":status},
|
606 |
-
beforeSend : function() {
|
607 |
-
jQuery('#ajax-busy').show();
|
608 |
-
},
|
609 |
-
success : function(msg) {
|
610 |
-
jQuery('#ajax-busy').hide();
|
611 |
-
}
|
612 |
-
});
|
613 |
-
|
614 |
-
var page_no = jQuery('#pagenumber').val();
|
615 |
-
loadData(page_no); // For first time page load
|
616 |
-
|
617 |
-
});
|
618 |
-
|
619 |
-
});
|
620 |
-
|
621 |
-
function testsmssend(sendererr,messageerr,mobileerr) {
|
622 |
-
var sender = jQuery('#sender_order').val();
|
623 |
-
var message =jQuery('#sender_order_message').val();
|
624 |
-
var number = jQuery("#sender_order_number").val();
|
625 |
-
var ajaxOrderSmsUrl = jQuery('#ajaxOrderSmsUrl').val();
|
626 |
-
var smsCampError = jQuery("#smsCampError").val();
|
627 |
-
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
628 |
-
if(sender == '' || isValid(sender) == false)
|
629 |
{
|
630 |
-
|
631 |
-
|
632 |
-
|
|
|
633 |
{
|
634 |
-
|
|
|
635 |
}
|
636 |
-
|
637 |
-
|
638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
639 |
}
|
640 |
-
else {
|
641 |
jQuery.ajax({
|
642 |
type : "POST",
|
643 |
async : false,
|
644 |
-
url :
|
645 |
-
data :
|
646 |
-
beforeSend : function()
|
647 |
jQuery('#ajax-busy').show();
|
648 |
},
|
649 |
-
success : function(msg)
|
650 |
jQuery('#ajax-busy').hide();
|
651 |
-
if(msg.trim() == 'OK')
|
652 |
-
{ alert(smsCampSuccess); }
|
653 |
-
else { alert(smsCampError); }
|
654 |
}
|
655 |
-
});
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
type : "POST",
|
682 |
async : false,
|
683 |
-
url :
|
684 |
-
data : {"
|
685 |
beforeSend : function() {
|
686 |
jQuery('#ajax-busy').show();
|
687 |
},
|
688 |
success : function(msg) {
|
689 |
-
jQuery('#ajax-busy').hide();
|
690 |
-
if(msg.trim() == 'OK')
|
691 |
-
{ alert(smsCampSuccess); }
|
692 |
-
else { alert(smsCampError); }
|
693 |
}
|
694 |
-
});
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
{
|
712 |
-
|
|
|
|
|
|
|
713 |
}
|
714 |
-
|
715 |
-
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
}
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
|
|
|
|
|
|
|
|
|
|
735 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
function senderOrderSaveValid(sendererr,messageerr)
|
738 |
{
|
739 |
var sender = jQuery('#sender_order').val();
|
740 |
var message =jQuery('#sender_order_message').val();
|
741 |
if(sender == '' || isValid(sender) == false)
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
}
|
|
|
752 |
function senderShipmentSaveValid(sendererr,messageerr)
|
753 |
{
|
754 |
var sender = jQuery('#sender_shipment').val();
|
@@ -764,52 +818,55 @@ function senderShipmentSaveValid(sendererr,messageerr)
|
|
764 |
return false;
|
765 |
}
|
766 |
}
|
|
|
767 |
function senderCampaignSaveValid(sendererr,messageerr,mobileerr)
|
768 |
{
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
}
|
804 |
|
805 |
function isMobilevalidation(str)
|
806 |
{
|
807 |
return /^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);
|
808 |
-
}
|
|
|
809 |
function isNormalInteger(str)
|
810 |
{
|
811 |
return /^\+?(0|[1-9]\d*)$/.test(str);
|
812 |
}
|
|
|
813 |
function isValid(str) {
|
814 |
var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
|
815 |
|
@@ -820,16 +877,16 @@ function isValid(str) {
|
|
820 |
}
|
821 |
return true;
|
822 |
}
|
|
|
823 |
function RegexEmail(email)
|
824 |
{
|
825 |
var emailRegexStr = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
826 |
var isvalid = emailRegexStr.test(email);
|
827 |
return isvalid;
|
828 |
}
|
|
|
829 |
function validate(emailerr,limiter)
|
830 |
{
|
831 |
-
|
832 |
-
|
833 |
if( document.notify_sms_mail_form.sendin_notify_email.value == "" || RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value) == false )
|
834 |
{
|
835 |
alert(emailerr);
|
@@ -843,11 +900,12 @@ function validate(emailerr,limiter)
|
|
843 |
document.notify_sms_mail_form.sendin_notify_value.focus() ;
|
844 |
return false;
|
845 |
}
|
846 |
-
|
847 |
return( true );
|
848 |
-
}
|
|
|
849 |
function smtpvalidate(emailerr)
|
850 |
-
|
851 |
var email = jQuery('#email').val();
|
852 |
if(email == "" || RegexEmail(email) == false )
|
853 |
{
|
@@ -855,16 +913,17 @@ function smtpvalidate(emailerr)
|
|
855 |
jQuery('#email').focus();
|
856 |
return false;
|
857 |
}
|
858 |
-
|
|
|
859 |
function apikvalidate(apierr)
|
860 |
-
|
861 |
-
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
|
|
862 |
|
863 |
-
if(sendin_apikey_val.trim() == "")
|
864 |
{
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
}
|
869 |
-
|
870 |
-
}
|
11 |
jQuery(document)
|
12 |
.ready(
|
13 |
function() {
|
|
|
|
|
14 |
var apistatuskey = jQuery('#apistatuskey').val();
|
15 |
+
|
16 |
jQuery("#select").multiselect();
|
17 |
+
|
18 |
jQuery(".sendin_api_status").click(function()
|
19 |
+
{
|
20 |
if (apistatuskey == 1 && jQuery(this).val() == 1)
|
21 |
+
{
|
|
|
22 |
jQuery("#sendin_apikey").show();
|
23 |
jQuery(".alldiv").show();
|
24 |
jQuery(".hidetableblock").show();
|
25 |
+
}
|
|
|
26 |
else{
|
27 |
if(jQuery(this).val() == 1)
|
28 |
{
|
29 |
+
jQuery("#sendin_apikey").show();
|
30 |
}else{
|
31 |
jQuery("#sendin_apikey").hide();
|
32 |
jQuery(".alldiv").hide();
|
33 |
}
|
34 |
+
}
|
|
|
35 |
});
|
36 |
+
|
37 |
+
|
38 |
+
//date picker function
|
39 |
+
jQuery('#sib_datetimepicker').datepicker({ dateFormat: 'yy-mm-dd' });
|
40 |
+
//Double optin function
|
41 |
+
jQuery('.manage_subscribe_block input[name=subscribe_confirm_type]').click(function(){
|
42 |
+
jQuery('.manage_subscribe_block .inner_manage_box').slideUp();
|
43 |
+
jQuery(this).parents('.manage_subscribe_block').find('.inner_manage_box').slideDown();
|
44 |
+
|
45 |
+
});
|
46 |
+
|
47 |
+
jQuery('.openCollapse').each(function(){
|
48 |
+
if(!jQuery(this).is(":checked")){
|
49 |
+
jQuery(this).parent('.form-group').find('.collapse').hide();
|
50 |
+
}
|
51 |
+
});
|
52 |
+
|
53 |
+
jQuery('input[name=subscribe_confirm_type]').each(function(){
|
54 |
+
if(jQuery(this).is(":checked")){
|
55 |
+
jQuery(this).parents('.manage_subscribe_block').find('.inner_manage_box').show();
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
jQuery('.openCollapse').click(function() {
|
60 |
+
|
61 |
+
if (jQuery(this).is(":checked")){
|
62 |
+
jQuery(this).parent('.form-group').find('.collapse').slideDown();
|
63 |
+
} else {
|
64 |
+
jQuery(this).parent('.form-group').find('.collapse').slideUp();
|
65 |
+
}
|
66 |
+
});
|
67 |
+
|
68 |
function loadData(page) {
|
69 |
var ajaxcontentUrl = jQuery("#ajaxcontentUrl").val();
|
70 |
jQuery.ajax({
|
86 |
});
|
87 |
}
|
88 |
});
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
jQuery('.hdtab').click(function(){
|
92 |
+
if(parseInt(jQuery(this).val())) { jQuery('#hidetabselect').css('display','block');}
|
|
|
93 |
});
|
|
|
94 |
|
95 |
jQuery('body').on('click',' .pagination li.active',function() {
|
96 |
var page = jQuery(this).attr('p');
|
97 |
jQuery('#pagenumber').val(page);
|
98 |
loadData(page);
|
|
|
99 |
});
|
100 |
|
101 |
+
jQuery('.toolTip').hover(function () {
|
|
|
102 |
var title = jQuery(this).attr('title');
|
103 |
var offset = jQuery(this).offset();
|
104 |
|
115 |
jQuery('#sender_order').mouseover(function () {
|
116 |
var val = jQuery(this).val();
|
117 |
if(isInteger(val) || val == ''){
|
118 |
+
jQuery("#sender_order").attr('maxlength','11');
|
119 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
120 |
|
121 |
}
|
122 |
else{
|
123 |
jQuery("#sender_order").attr('maxlength','11');
|
124 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
125 |
jQuery("#sender_order").val(str7);
|
126 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
127 |
+
}
|
|
|
128 |
});
|
129 |
|
130 |
jQuery('#sender_order').keyup(function () {
|
131 |
var val = jQuery(this).val();
|
132 |
if(isInteger(val) || val == ''){
|
133 |
+
jQuery("#sender_order").attr('maxlength','11');
|
134 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
135 |
|
136 |
}
|
137 |
else{
|
143 |
}
|
144 |
});
|
145 |
|
146 |
+
jQuery("#sender_order").keydown(function (event) {
|
147 |
+
if (event.keyCode == 32) {
|
148 |
+
event.preventDefault();
|
149 |
+
}
|
150 |
+
});
|
151 |
|
152 |
|
153 |
if(jQuery('#sender_order').val() != '')
|
154 |
{
|
155 |
var val = jQuery('#sender_order').val();
|
156 |
if(isInteger(val)){
|
157 |
+
jQuery("#sender_order").attr('maxlength','11');
|
158 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
159 |
|
160 |
}
|
161 |
else{
|
162 |
jQuery("#sender_order").attr('maxlength','11');
|
163 |
+
jQuery('#sender_order_text').text((11 - val.length));
|
|
|
164 |
}
|
165 |
}
|
166 |
+
|
167 |
jQuery('#sender_order_message').keyup(function () {
|
168 |
+
var chars = this.value.length,
|
|
|
169 |
messages = Math.ceil(chars / 160),
|
170 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
171 |
|
172 |
jQuery('#sender_order_message_text').text(remaining);
|
173 |
|
174 |
jQuery('#sender_order_message_text_count').text(messages);
|
|
|
175 |
});
|
176 |
|
177 |
if(jQuery('#sender_order_message').val() != '')
|
178 |
{
|
179 |
var chars = jQuery('#sender_order_message').val().length,
|
180 |
messages = Math.ceil(chars / 160),
|
181 |
+
remaining = messages * 160 - chars;
|
182 |
|
183 |
jQuery('#sender_order_message_text').text(remaining);
|
184 |
|
185 |
jQuery('#sender_order_message_text_count').text(messages);
|
186 |
}
|
187 |
+
|
188 |
jQuery('#sender_shipment').mouseover(function () {
|
189 |
var val = jQuery(this).val();
|
190 |
|
191 |
if(isInteger(val) || val == ''){
|
192 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
193 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
194 |
}
|
195 |
else{
|
196 |
jQuery("#sender_shipment").attr('maxlength','11');
|
197 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
198 |
jQuery("#sender_shipment").val(str7);
|
199 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
200 |
}
|
201 |
});
|
202 |
jQuery('#sender_shipment').keyup(function () {
|
203 |
+
var val = jQuery(this).val();
|
|
|
204 |
if(isInteger(val) || val == ''){
|
205 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
206 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
207 |
}
|
208 |
else{
|
209 |
jQuery("#sender_shipment").attr('maxlength','11');
|
210 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
211 |
jQuery("#sender_shipment").val(str7);
|
212 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
213 |
}
|
214 |
});
|
215 |
+
jQuery("#sender_shipment").keydown(function (event) {
|
216 |
+
if (event.keyCode == 32) {
|
217 |
+
event.preventDefault();
|
218 |
+
}
|
219 |
+
});
|
220 |
+
|
221 |
if(jQuery('#sender_shipment').val() != '')
|
222 |
{
|
223 |
var val = jQuery('#sender_shipment').val();
|
224 |
if(isInteger(val)){
|
225 |
+
jQuery("#sender_shipment").attr('maxlength','11');
|
226 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
227 |
}
|
228 |
else{
|
229 |
jQuery("#sender_shipment").attr('maxlength','11');
|
230 |
+
jQuery('#sender_shipment_text').text((11 - val.length));
|
|
|
231 |
}
|
232 |
}
|
233 |
+
|
234 |
jQuery('#sender_shipment_message').keyup(function () {
|
235 |
|
236 |
var chars = this.value.length,
|
237 |
messages = Math.ceil(chars / 160),
|
238 |
+
remaining = messages * 160 - chars;
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
+
jQuery('#sender_shipment_message_text').text(remaining);
|
241 |
+
jQuery('#sender_shipment_message_text_count').text(messages);
|
242 |
});
|
243 |
+
|
244 |
if(jQuery('#sender_shipment_message').val() != '')
|
245 |
{
|
246 |
var chars = jQuery('#sender_shipment_message').val().length,
|
247 |
messages = Math.ceil(chars / 160),
|
248 |
+
remaining = messages * 160 - chars;
|
249 |
|
250 |
jQuery('#sender_shipment_message_text').text(remaining);
|
|
|
251 |
jQuery('#sender_shipment_message_text_count').text(messages);
|
252 |
}
|
253 |
+
|
254 |
jQuery('#sender_campaign').mouseover(function () {
|
255 |
var val = jQuery(this).val();
|
256 |
if(isInteger(val) || val == ''){
|
257 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
258 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
259 |
|
260 |
}
|
261 |
else{
|
270 |
var val = jQuery(this).val();
|
271 |
|
272 |
if(isInteger(val) || val == ''){
|
273 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
274 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
275 |
}
|
276 |
else{
|
277 |
jQuery("#sender_campaign").attr('maxlength','11');
|
278 |
var str7 = val.length > 11 ? val.substr(1,11) : val;
|
279 |
jQuery("#sender_campaign").val(str7);
|
280 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
|
|
281 |
}
|
282 |
});
|
283 |
+
jQuery("#sender_campaign").keydown(function (event) {
|
284 |
+
if (event.keyCode == 32) {
|
285 |
+
event.preventDefault();
|
286 |
+
}
|
287 |
+
});
|
288 |
+
|
289 |
if(jQuery('#sender_campaign').val() != '')
|
290 |
{
|
291 |
+
var val = jQuery('#sender_campaign').val();
|
|
|
292 |
if(isInteger(val)){
|
293 |
+
jQuery("#sender_campaign").attr('maxlength','11');
|
294 |
+
jQuery('#sender_campaign_text').text((11 - val.length));
|
295 |
}
|
296 |
else{
|
297 |
jQuery("#sender_campaign").attr('maxlength','11');
|
304 |
var chars = this.value.length,
|
305 |
messages = Math.ceil(chars / 160),
|
306 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
307 |
+
|
|
|
|
|
|
|
308 |
jQuery('#sender_campaign_message_text').text(remaining);
|
309 |
+
jQuery('#sender_campaign_message_text_count').text(messages);
|
|
|
310 |
});
|
311 |
+
|
312 |
if(jQuery('#sender_campaign_message').val() != '')
|
313 |
{
|
314 |
var chars = jQuery('#sender_campaign_message').val().length,
|
316 |
remaining = messages * 160 - (chars % (messages * 160) || messages * 160);
|
317 |
|
318 |
jQuery('#sender_campaign_message_text').text(remaining);
|
|
|
319 |
jQuery('#sender_campaign_message_text_count').text(messages);
|
320 |
}
|
321 |
+
|
322 |
jQuery(".sms_order_setting").click(function () {
|
323 |
var orderSetting = jQuery(this).val();
|
324 |
var orderUrl = jQuery("#order").val();
|
339 |
jQuery(".hideOrder").hide();
|
340 |
}
|
341 |
}
|
342 |
+
});
|
|
|
343 |
});
|
344 |
+
|
345 |
jQuery(".sms_shiping_setting").click(function () {
|
346 |
var shipingSetting = jQuery(this).val();
|
347 |
var shipingUrl = jQuery("#shiping").val();
|
348 |
+
|
349 |
jQuery.ajax({
|
350 |
type: "POST",
|
351 |
async: false,
|
363 |
}
|
364 |
}
|
365 |
});
|
|
|
366 |
});
|
367 |
|
368 |
jQuery(".sms_campaign_setting").click(function () {
|
385 |
jQuery(".hideCampaign").hide();
|
386 |
}
|
387 |
}
|
388 |
+
});
|
|
|
389 |
});
|
390 |
+
|
391 |
if (jQuery('input:radio[name=sms_order_setting]:checked').val() == 0)
|
392 |
{
|
393 |
jQuery('.hideOrder').hide();
|
396 |
}
|
397 |
|
398 |
jQuery(".Sendin_Sms_Choice").click(function ()
|
399 |
+
{
|
400 |
if (jQuery(this).val() == 1) {
|
401 |
jQuery(".multiplechoice").hide();
|
402 |
jQuery(".singlechoice").show();
|
405 |
jQuery(".singlechoice").hide();
|
406 |
}
|
407 |
});
|
408 |
+
jQuery(".Sendin_Sms_Choice").click(function ()
|
409 |
+
{
|
410 |
+
if (jQuery(this).val() == 2) {
|
411 |
+
jQuery(".sib_datepicker").show();
|
412 |
+
} else {
|
413 |
+
jQuery(".sib_datepicker").hide();
|
414 |
+
}
|
415 |
+
});
|
416 |
|
417 |
if (jQuery('input:radio[name=Sendin_Sms_Choice]:checked').val() == 0)
|
418 |
{
|
430 |
} else {
|
431 |
jQuery(".hideShiping").hide();
|
432 |
}
|
433 |
+
});
|
434 |
+
|
|
|
435 |
if (jQuery('input:radio[name=sms_credit]:checked').val() == 0)
|
436 |
jQuery(".hideCredit").hide();
|
437 |
else
|
438 |
jQuery(".hideCredit").show();
|
439 |
+
|
|
|
440 |
jQuery(".sms_credit").click(function (){
|
441 |
|
442 |
var sms_credit = jQuery(this).val();
|
513 |
return true
|
514 |
}
|
515 |
return false;
|
516 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
+
jQuery('#showUserlist').click(function(){
|
519 |
+
|
520 |
+
if(jQuery('.userDetails').is(':hidden'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
{
|
522 |
+
loadData(1);
|
523 |
+
jQuery('#Spantextless').show();
|
524 |
+
jQuery('#Spantextmore').hide();
|
525 |
+
}else
|
526 |
{
|
527 |
+
jQuery('#Spantextmore').show();
|
528 |
+
jQuery('#Spantextless').hide();
|
529 |
}
|
530 |
+
jQuery('.userDetails').slideToggle();
|
531 |
+
});
|
532 |
+
|
533 |
+
var base_url = getBaseURL();
|
534 |
+
|
535 |
+
jQuery(".Tracking").click(function()
|
536 |
+
{
|
537 |
+
var Tracking = jQuery(this).val();
|
538 |
+
var trackingUrl = jQuery("#trackingUrl").val();
|
539 |
+
if (Tracking == 0) {
|
540 |
+
jQuery('.ordertracking').hide();
|
541 |
+
}
|
542 |
+
if (Tracking == 1) {
|
543 |
+
jQuery('.ordertracking').show();
|
544 |
}
|
|
|
545 |
jQuery.ajax({
|
546 |
type : "POST",
|
547 |
async : false,
|
548 |
+
url : trackingUrl,
|
549 |
+
data : "script=" + Tracking,
|
550 |
+
beforeSend : function(){
|
551 |
jQuery('#ajax-busy').show();
|
552 |
},
|
553 |
+
success : function(msg){
|
554 |
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
555 |
}
|
556 |
+
});
|
557 |
+
});
|
558 |
+
|
559 |
+
//for import old order history
|
560 |
+
jQuery(".Trackhistory").click(function()
|
561 |
+
{
|
562 |
+
var history_status = jQuery("#history_status").val();
|
563 |
+
var langvalue = jQuery("#langvalue").val();
|
564 |
+
var ordertrackingUrl = jQuery("#importordertrackingUrl").val();
|
565 |
+
|
566 |
+
jQuery.ajax({
|
567 |
+
type : "POST",
|
568 |
+
async : false,
|
569 |
+
url : ordertrackingUrl,
|
570 |
+
data : {"history_status":history_status,"langvalue":langvalue},
|
571 |
+
beforeSend : function(){
|
572 |
+
jQuery('#ajax-busy').show();
|
573 |
+
},
|
574 |
+
success : function(msg){
|
575 |
+
jQuery('#ajax-busy').hide();
|
576 |
+
jQuery('.ordertracking').hide();
|
577 |
+
alert(msg);
|
578 |
+
}
|
579 |
+
});
|
580 |
+
});
|
581 |
+
|
582 |
+
jQuery(".smtpStatus").click(function() {
|
583 |
+
|
584 |
+
var smtptest = jQuery(this).val();
|
585 |
+
var smtpUrl = jQuery("#smtpUrl").val();
|
586 |
+
if (smtptest == 0) {
|
587 |
+
jQuery('.smtptest').hide();
|
588 |
+
}
|
589 |
+
if (smtptest == 1) {
|
590 |
+
jQuery('.smtptest').show();
|
591 |
+
}
|
592 |
+
jQuery.ajax({
|
593 |
+
type : "POST",
|
594 |
+
async : false,
|
595 |
+
url : smtpUrl,
|
596 |
+
data : "smtptest=" + smtptest,
|
597 |
+
beforeSend : function() {
|
598 |
+
jQuery('#ajax-busy').show();
|
599 |
+
},
|
600 |
+
success : function(msg) {
|
601 |
+
jQuery('#ajax-busy').hide();
|
602 |
+
}
|
603 |
+
});
|
604 |
+
});
|
605 |
+
|
606 |
+
var skin_url = jQuery('#skin_url').val()
|
607 |
+
jQuery('<div id="ajax-busy"/> loading..')
|
608 |
+
.css(
|
609 |
+
{
|
610 |
+
opacity : 0.5,
|
611 |
+
position : 'fixed',
|
612 |
+
top : 0,
|
613 |
+
left : 0,
|
614 |
+
width : '100%',
|
615 |
+
height : jQuery(window).height() + 'px',
|
616 |
+
background : 'white url('+skin_url+'adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center'
|
617 |
+
}).hide().appendTo('body');
|
618 |
+
|
619 |
+
// get site base url
|
620 |
+
function getBaseURL() {
|
621 |
+
var sBase = location.href.substr(0, location.href.lastIndexOf("/") + 1);
|
622 |
+
var sp = sBase.split('/');
|
623 |
+
var lastFolder = sp[ sp.length - 2 ];
|
624 |
+
return sBase.replace(lastFolder+'/', '');
|
625 |
+
}
|
626 |
+
|
627 |
+
jQuery('body').on('click', '.ajax_contacts_href', function (e) {
|
628 |
+
var email = jQuery(this).attr('email');
|
629 |
+
var status = jQuery(this).attr('status');
|
630 |
+
var ajaxUrl = jQuery("#ajaxUrl").val();
|
631 |
+
|
632 |
+
jQuery.ajax({
|
633 |
type : "POST",
|
634 |
async : false,
|
635 |
+
url : ajaxUrl,
|
636 |
+
data : {"email":email,"newsletter":status},
|
637 |
beforeSend : function() {
|
638 |
jQuery('#ajax-busy').show();
|
639 |
},
|
640 |
success : function(msg) {
|
641 |
+
jQuery('#ajax-busy').hide();
|
|
|
|
|
|
|
642 |
}
|
643 |
+
});
|
644 |
+
|
645 |
+
var page_no = jQuery('#pagenumber').val();
|
646 |
+
loadData(page_no); // For first time page load
|
647 |
+
});
|
648 |
+
|
649 |
+
jQuery('body').on('click', '.ajax_sms_subs_href', function (e) {
|
650 |
+
|
651 |
+
var email = jQuery(this).attr('email');
|
652 |
+
var status = jQuery(this).attr('status');
|
653 |
+
var ajaxSmsUrl = jQuery("#ajaxSmsSubscribeUrl").val();
|
654 |
+
|
655 |
+
jQuery.ajax({
|
656 |
+
type : "POST",
|
657 |
+
async : false,
|
658 |
+
url : ajaxSmsUrl,
|
659 |
+
data : {"email":email,"sms":status},
|
660 |
+
beforeSend : function() {
|
661 |
+
jQuery('#ajax-busy').show();
|
662 |
+
},
|
663 |
+
success : function(msg) {
|
664 |
+
jQuery('#ajax-busy').hide();
|
665 |
}
|
666 |
+
});
|
667 |
+
|
668 |
+
var page_no = jQuery('#pagenumber').val();
|
669 |
+
loadData(page_no); // For first time page load
|
670 |
+
|
671 |
+
});
|
672 |
+
});
|
673 |
+
|
674 |
+
function testsmssend(sendererr,messageerr,mobileerr) {
|
675 |
+
var sender = jQuery('#sender_order').val();
|
676 |
+
var message =jQuery('#sender_order_message').val();
|
677 |
+
var number = jQuery("#sender_order_number").val();
|
678 |
+
var ajaxOrderSmsUrl = jQuery('#ajaxOrderSmsUrl').val();
|
679 |
+
var smsCampError = jQuery("#smsCampError").val();
|
680 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
681 |
+
if(sender == '' || isValid(sender) == false)
|
682 |
+
{
|
683 |
+
alert(sendererr);
|
684 |
+
}
|
685 |
+
else if( message == '')
|
686 |
+
{
|
687 |
+
alert(messageerr);
|
688 |
+
}
|
689 |
+
else if(number == '')
|
690 |
+
{
|
691 |
+
alert(mobileerr);
|
692 |
+
}
|
693 |
+
else {
|
694 |
+
jQuery.ajax({
|
695 |
+
type : "POST",
|
696 |
+
async : false,
|
697 |
+
url : ajaxOrderSmsUrl,
|
698 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
699 |
+
beforeSend : function() {
|
700 |
+
jQuery('#ajax-busy').show();
|
701 |
+
},
|
702 |
+
success : function(msg) {
|
703 |
+
jQuery('#ajax-busy').hide();
|
704 |
+
if(msg.trim() == 'OK')
|
705 |
+
{ alert(smsCampSuccess); }
|
706 |
+
else { alert(smsCampError); }
|
707 |
}
|
708 |
+
});}
|
709 |
+
return false;
|
710 |
+
}
|
711 |
+
|
712 |
+
function testShippedSmsSend(sendererr,messageerr,mobileerr) {
|
713 |
+
var sender = jQuery('#sender_shipment').val();
|
714 |
+
var message =jQuery('#sender_shipment_message').val();
|
715 |
+
var number = jQuery("#sender_shipment_number").val();
|
716 |
+
var ajaxOrderShippedUrl = jQuery('#ajaxOrderShippedUrl').val();
|
717 |
+
var smsCampError = jQuery("#smsCampError").val();
|
718 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
719 |
+
if(sender == '' || isValid(sender) == false)
|
720 |
+
{
|
721 |
+
alert(sendererr);
|
722 |
+
}
|
723 |
+
else if( message == '')
|
724 |
+
{
|
725 |
+
alert(messageerr);
|
726 |
+
}
|
727 |
+
else if(number == '')
|
728 |
+
{
|
729 |
+
alert(mobileerr);
|
730 |
}
|
731 |
+
else {
|
732 |
+
jQuery.ajax({
|
733 |
+
type : "POST",
|
734 |
+
async : false,
|
735 |
+
url : ajaxOrderShippedUrl,
|
736 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
737 |
+
beforeSend : function() {
|
738 |
+
jQuery('#ajax-busy').show();
|
739 |
+
},
|
740 |
+
success : function(msg) {
|
741 |
+
jQuery('#ajax-busy').hide();
|
742 |
+
if(msg.trim() == 'OK')
|
743 |
+
{ alert(smsCampSuccess); }
|
744 |
+
else { alert(smsCampError); }
|
745 |
+
}
|
746 |
+
}); }
|
747 |
+
return false;
|
748 |
+
}
|
749 |
+
|
750 |
+
function testCampaignSmsSend(sendererr,messageerr,mobileerr) {
|
751 |
+
|
752 |
+
var sender = jQuery('#sender_campaign').val();
|
753 |
+
var message =jQuery('#sender_campaign_message').val();
|
754 |
+
var number = jQuery("#sender_campaigntest_number").val();
|
755 |
+
var ajaxSmsCampaignUrl = jQuery('#ajaxSmsCampaignUrl').val();
|
756 |
+
var smsCampError = jQuery("#smsCampError").val();
|
757 |
+
var smsCampSuccess = jQuery("#smsCampSuccess").val();
|
758 |
|
759 |
+
if(sender == '' || isValid(sender) == false)
|
760 |
+
{
|
761 |
+
alert(sendererr);
|
762 |
+
}
|
763 |
+
else if( message == '')
|
764 |
+
{
|
765 |
+
alert(messageerr);
|
766 |
+
}
|
767 |
+
else if(number == '' || isMobilevalidation(number) == false)
|
768 |
+
{
|
769 |
+
alert(mobileerr);
|
770 |
+
}
|
771 |
+
else {
|
772 |
+
jQuery.ajax({
|
773 |
+
type : "POST",
|
774 |
+
async : false,
|
775 |
+
url : ajaxSmsCampaignUrl,
|
776 |
+
data : {"sender":sender,"message":message,"number":number} ,
|
777 |
+
beforeSend : function() {
|
778 |
+
jQuery('#ajax-busy').show();
|
779 |
+
},
|
780 |
+
success : function(msg) {
|
781 |
+
jQuery('#ajax-busy').hide();
|
782 |
+
if(msg.trim() == 'OK')
|
783 |
+
{ alert(smsCampSuccess); }
|
784 |
+
else { alert(smsCampError); }
|
785 |
+
}
|
786 |
+
});}
|
787 |
+
return false;
|
788 |
+
}
|
789 |
+
|
790 |
function senderOrderSaveValid(sendererr,messageerr)
|
791 |
{
|
792 |
var sender = jQuery('#sender_order').val();
|
793 |
var message =jQuery('#sender_order_message').val();
|
794 |
if(sender == '' || isValid(sender) == false)
|
795 |
+
{
|
796 |
+
alert(sendererr);
|
797 |
+
return false;
|
798 |
+
}
|
799 |
+
else if( message == '')
|
800 |
+
{
|
801 |
+
alert(messageerr);
|
802 |
+
return false;
|
803 |
+
}
|
804 |
}
|
805 |
+
|
806 |
function senderShipmentSaveValid(sendererr,messageerr)
|
807 |
{
|
808 |
var sender = jQuery('#sender_shipment').val();
|
818 |
return false;
|
819 |
}
|
820 |
}
|
821 |
+
|
822 |
function senderCampaignSaveValid(sendererr,messageerr,mobileerr)
|
823 |
{
|
824 |
+
var sender = jQuery('#sender_campaign').val();
|
825 |
+
var message =jQuery('#sender_campaign_message').val();
|
826 |
+
var number = jQuery("#singlechoice").val();
|
827 |
+
var radiovalue = jQuery("input[name=Sendin_Sms_Choice]:checked").val();
|
828 |
+
if(radiovalue == 1)
|
829 |
+
{
|
830 |
+
if(number == '' || isMobilevalidation(number) == false)
|
831 |
+
{
|
832 |
+
alert(mobileerr);
|
833 |
+
return false;
|
834 |
+
}
|
835 |
+
else if(sender == '' || isValid(sender) == false)
|
836 |
+
{
|
837 |
+
alert(sendererr);
|
838 |
+
return false;
|
839 |
+
}
|
840 |
+
else if(message == '')
|
841 |
+
{
|
842 |
+
alert(messageerr);
|
843 |
+
return false;
|
844 |
+
}
|
845 |
+
}
|
846 |
+
else{
|
847 |
+
if(sender == '' || isValid(sender) == false)
|
848 |
+
{
|
849 |
+
alert(sendererr);
|
850 |
+
return false;
|
851 |
+
}
|
852 |
+
else if(message == '')
|
853 |
+
{
|
854 |
+
alert(messageerr);
|
855 |
+
return false;
|
856 |
+
}
|
857 |
+
}
|
858 |
}
|
859 |
|
860 |
function isMobilevalidation(str)
|
861 |
{
|
862 |
return /^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);
|
863 |
+
}
|
864 |
+
|
865 |
function isNormalInteger(str)
|
866 |
{
|
867 |
return /^\+?(0|[1-9]\d*)$/.test(str);
|
868 |
}
|
869 |
+
|
870 |
function isValid(str) {
|
871 |
var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
|
872 |
|
877 |
}
|
878 |
return true;
|
879 |
}
|
880 |
+
|
881 |
function RegexEmail(email)
|
882 |
{
|
883 |
var emailRegexStr = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
884 |
var isvalid = emailRegexStr.test(email);
|
885 |
return isvalid;
|
886 |
}
|
887 |
+
|
888 |
function validate(emailerr,limiter)
|
889 |
{
|
|
|
|
|
890 |
if( document.notify_sms_mail_form.sendin_notify_email.value == "" || RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value) == false )
|
891 |
{
|
892 |
alert(emailerr);
|
900 |
document.notify_sms_mail_form.sendin_notify_value.focus() ;
|
901 |
return false;
|
902 |
}
|
903 |
+
|
904 |
return( true );
|
905 |
+
}
|
906 |
+
|
907 |
function smtpvalidate(emailerr)
|
908 |
+
{
|
909 |
var email = jQuery('#email').val();
|
910 |
if(email == "" || RegexEmail(email) == false )
|
911 |
{
|
913 |
jQuery('#email').focus();
|
914 |
return false;
|
915 |
}
|
916 |
+
}
|
917 |
+
|
918 |
function apikvalidate(apierr)
|
919 |
+
{
|
920 |
+
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
921 |
+
var sendin_api_check = jQuery("input[name=sendin_api_status]:checked").val();
|
922 |
|
923 |
+
if(sendin_apikey_val.trim() == "" && sendin_api_check !=0)
|
924 |
{
|
925 |
+
alert(apierr);
|
926 |
+
jQuery('#sendin_apikey_val').focus();
|
927 |
+
return false;
|
928 |
+
}
|
929 |
+
}
|
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.min.js
CHANGED
@@ -7,4 +7,4 @@
|
|
7 |
* needs then we can't provide a technical support.
|
8 |
**/
|
9 |
|
10 |
-
jQuery.noConflict();jQuery(document).ready(function(){var apistatuskey=jQuery("#apistatuskey").val();jQuery("#select").multiselect();jQuery(".sendin_api_status").click(function(){if(apistatuskey==1&&jQuery(this).val()==1){jQuery("#sendin_apikey").show();jQuery(".alldiv").show();jQuery(".hidetableblock").show();}else{if(jQuery(this).val()==1){jQuery("#sendin_apikey").show();}else{jQuery("#sendin_apikey").hide();jQuery(".alldiv").hide();}}});function loadData(page){var ajaxcontentUrl=jQuery("#ajaxcontentUrl").val();jQuery.ajax({type:"POST",async:false,url:ajaxcontentUrl,data:"page="+page,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();jQuery(".midleft").html(msg);jQuery(".midleft").ajaxComplete(function(event,request,settings){jQuery(".midleft").html(msg);});}});}jQuery(".hdtab").click(function(){if(parseInt(jQuery(this).val())){jQuery("#hidetabselect").css("display","block");}});jQuery("body").on("click"," .pagination li.active",function(){var page=jQuery(this).attr("p");jQuery("#pagenumber").val(page);loadData(page);});jQuery(".toolTip").hover(function(){var title=jQuery(this).attr("title");var offset=jQuery(this).offset();jQuery("body").append('<div id="tipkk" style="top:'+offset.top+"px; left:"+offset.left+'px; ">'+title+"</div>");var tipContentHeight=jQuery("#tipkk").height()+25;jQuery("#tipkk").css("top",(offset.top-tipContentHeight)+"px");},function(){jQuery("#tipkk").remove();});jQuery("#sender_order").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_order").val(str7);jQuery("#sender_order_text").text((11-val.length));}});jQuery("#sender_order").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_order").val(str7);jQuery("#sender_order_text").text((11-val.length));}});if(jQuery("#sender_order").val()!=""){var val=jQuery("#sender_order").val();if(isInteger(val)){jQuery("#sender_order").attr("maxlength","17");jQuery("#sender_order_text").text((17-val.length));}else{jQuery("#sender_order").attr("maxlength","11");jQuery("#sender_order_text").text((11-val.length));}}jQuery("#sender_order_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_order_message_text").text(remaining);jQuery("#sender_order_message_text_count").text(messages);});if(jQuery("#sender_order_message").val()!=""){var chars=jQuery("#sender_order_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_order_message_text").text(remaining);jQuery("#sender_order_message_text_count").text(messages);}jQuery("#sender_shipment").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_shipment").val(str7);jQuery("#sender_shipment_text").text((11-val.length));}});jQuery("#sender_shipment").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_shipment").val(str7);jQuery("#sender_shipment_text").text((11-val.length));}});if(jQuery("#sender_shipment").val()!=""){var val=jQuery("#sender_shipment").val();if(isInteger(val)){jQuery("#sender_shipment").attr("maxlength","17");jQuery("#sender_shipment_text").text((17-val.length));}else{jQuery("#sender_shipment").attr("maxlength","11");jQuery("#sender_shipment_text").text((11-val.length));}}jQuery("#sender_shipment_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_shipment_message_text").text(remaining);jQuery("#sender_shipment_message_text_count").text(messages);});if(jQuery("#sender_shipment_message").val()!=""){var chars=jQuery("#sender_shipment_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_shipment_message_text").text(remaining);jQuery("#sender_shipment_message_text_count").text(messages);}jQuery("#sender_campaign").mouseover(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_campaign").val(str7);jQuery("#sender_campaign_text").text((11-val.length));}});jQuery("#sender_campaign").keyup(function(){var val=jQuery(this).val();if(isInteger(val)||val==""){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");var str7=val.length>11?val.substr(1,11):val;jQuery("#sender_campaign").val(str7);jQuery("#sender_campaign_text").text((11-val.length));}});if(jQuery("#sender_campaign").val()!=""){var val=jQuery("#sender_campaign").val();if(isInteger(val)){jQuery("#sender_campaign").attr("maxlength","17");jQuery("#sender_campaign_text").text((17-val.length));}else{jQuery("#sender_campaign").attr("maxlength","11");jQuery("#sender_campaign_text").text((11-val.length));}}jQuery("#sender_campaign_message").keyup(function(){var chars=this.value.length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);if(remaining==0){remaining=160;}jQuery("#sender_campaign_message_text").text(remaining);jQuery("#sender_campaign_message_text_count").text(messages);});if(jQuery("#sender_campaign_message").val()!=""){var chars=jQuery("#sender_campaign_message").val().length,messages=Math.ceil(chars/160),remaining=messages*160-(chars%(messages*160)||messages*160);jQuery("#sender_campaign_message_text").text(remaining);jQuery("#sender_campaign_message_text_count").text(messages);}jQuery(".sms_order_setting").click(function(){var orderSetting=jQuery(this).val();var orderUrl=jQuery("#order").val();jQuery.ajax({type:"POST",async:false,url:orderUrl,data:"orderSetting="+orderSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(orderSetting==1){jQuery(".hideOrder").show();}else{jQuery(".hideOrder").hide();}}});});jQuery(".sms_shiping_setting").click(function(){var shipingSetting=jQuery(this).val();var shipingUrl=jQuery("#shiping").val();jQuery.ajax({type:"POST",async:false,url:shipingUrl,data:"shipingSetting="+shipingSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(shipingSetting==1){jQuery(".hideShiping").show();}else{jQuery(".hideShiping").hide();}}});});jQuery(".sms_campaign_setting").click(function(){var campaignSetting=jQuery(this).val();var campaignUrl=jQuery("#campaign").val();jQuery.ajax({type:"POST",async:false,url:campaignUrl,data:"campaignSetting="+campaignSetting,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(campaignSetting==1){jQuery(".hideCampaign").show();}else{jQuery(".hideCampaign").hide();}}});});if(jQuery("input:radio[name=sms_order_setting]:checked").val()==0){jQuery(".hideOrder").hide();}else{jQuery(".hideOrder").show();}jQuery(".Sendin_Sms_Choice").click(function(){if(jQuery(this).val()==1){jQuery(".multiplechoice").hide();jQuery(".singlechoice").show();}else{jQuery(".multiplechoice").show();jQuery(".singlechoice").hide();}});if(jQuery("input:radio[name=Sendin_Sms_Choice]:checked").val()==0){jQuery(".multiplechoice").show();jQuery(".singlechoice").hide();}else{jQuery(".singlechoice").show();jQuery(".multiplechoice").hide();}jQuery(".sms_shiping_setting").click(function(){if(jQuery(this).val()==1){jQuery(".hideShiping").show();}else{jQuery(".hideShiping").hide();}});if(jQuery("input:radio[name=sms_credit]:checked").val()==0){jQuery(".hideCredit").hide();}else{jQuery(".hideCredit").show();}jQuery(".sms_credit").click(function(){var sms_credit=jQuery(this).val();var creditUrl=jQuery("#credits").val();var type="sms_credit";jQuery.ajax({type:"POST",async:false,url:creditUrl,data:"sms_credit="+sms_credit,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(sms_credit==1){jQuery(".hideCredit").show();}else{jQuery(".hideCredit").hide();}}});});if(jQuery("input:radio[name=sms_shiping_setting]:checked").val()==0){jQuery(".hideShiping").hide();}else{jQuery(".hideShiping").show();}jQuery(".sms_campaign_setting").click(function(){if(jQuery(this).val()==1){jQuery(".hideCampaign").show();}else{jQuery(".hideCampaign").hide();}});if(jQuery("input:radio[name=sms_campaign_setting]:checked").val()==0){jQuery(".hideCampaign").hide();}else{jQuery(".hideCampaign").show();}jQuery("#selectSmsList").multiselect({header:false,checkall:false});jQuery("#tabs li").click(function(){jQuery("#tabs li").removeClass("active");jQuery(this).addClass("active");jQuery(".tab_content").hide();var selected_tab=jQuery(this).find("a").attr("href");jQuery(selected_tab).fadeIn();return false;});function isInteger(val){var numberRegex=/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;if(numberRegex.test(val)){return true;}return false;}jQuery("#showUserlist").click(function(){if(jQuery(".userDetails").is(":hidden")){loadData(1);jQuery("#Spantextless").show();jQuery("#Spantextmore").hide();}else{jQuery("#Spantextmore").show();jQuery("#Spantextless").hide();}jQuery(".userDetails").slideToggle();});var base_url=getBaseURL();jQuery(".Tracking").click(function(){var Tracking=jQuery(this).val();var trackingUrl=jQuery("#trackingUrl").val();jQuery.ajax({type:"POST",async:false,url:trackingUrl,data:"script="+Tracking,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});});jQuery(".smtpStatus").click(function(){var smtptest=jQuery(this).val();var smtpUrl=jQuery("#smtpUrl").val();if(smtptest==0){jQuery(".smtptest").hide();}if(smtptest==1){jQuery(".smtptest").show();}jQuery.ajax({type:"POST",async:false,url:smtpUrl,data:"smtptest="+smtptest,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});});var skin_url=jQuery("#skin_url").val();jQuery('<div id="ajax-busy"/> loading..').css({opacity:0.5,position:"fixed",top:0,left:0,width:"100%",height:jQuery(window).height()+"px",background:"white url("+skin_url+"adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center"}).hide().appendTo("body");function getBaseURL(){var sBase=location.href.substr(0,location.href.lastIndexOf("/")+1);var sp=sBase.split("/");var lastFolder=sp[sp.length-2];return sBase.replace(lastFolder+"/","");}jQuery("body").on("click",".ajax_contacts_href",function(e){var email=jQuery(this).attr("email");var status=jQuery(this).attr("status");var ajaxUrl=jQuery("#ajaxUrl").val();jQuery.ajax({type:"POST",async:false,url:ajaxUrl,data:{email:email,newsletter:status},beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();}});var page_no=jQuery("#pagenumber").val();loadData(page_no);});});function testsmssend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_order").val();var message=jQuery("#sender_order_message").val();var number=jQuery("#sender_order_number").val();var ajaxOrderSmsUrl=jQuery("#ajaxOrderSmsUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxOrderSmsUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function testShippedSmsSend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_shipment").val();var message=jQuery("#sender_shipment_message").val();var number=jQuery("#sender_shipment_number").val();var ajaxOrderShippedUrl=jQuery("#ajaxOrderShippedUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxOrderShippedUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function testCampaignSmsSend(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_campaign").val();var message=jQuery("#sender_campaign_message").val();var number=jQuery("#sender_campaigntest_number").val();var ajaxSmsCampaignUrl=jQuery("#ajaxSmsCampaignUrl").val();var smsCampError=jQuery("#smsCampError").val();var smsCampSuccess=jQuery("#smsCampSuccess").val();if(sender==""||isValid(sender)==false){alert(sendererr);}else{if(message==""){alert(messageerr);}else{if(number==""||isMobilevalidation(number)==false){alert(mobileerr);}else{jQuery.ajax({type:"POST",async:false,url:ajaxSmsCampaignUrl,data:"sender="+sender+"&message="+message+"&number="+number,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();if(msg.trim()=="OK"){alert(smsCampSuccess);}else{alert(smsCampError);}}});}}}return false;}function senderOrderSaveValid(sendererr,messageerr){var sender=jQuery("#sender_order").val();var message=jQuery("#sender_order_message").val();if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}function senderShipmentSaveValid(sendererr,messageerr){var sender=jQuery("#sender_shipment").val();var message=jQuery("#sender_shipment_message").val();if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}function senderCampaignSaveValid(sendererr,messageerr,mobileerr){var sender=jQuery("#sender_campaign").val();var message=jQuery("#sender_campaign_message").val();var number=jQuery("#singlechoice").val();var radiovalue=jQuery("input[name=Sendin_Sms_Choice]:checked").val();if(radiovalue==1){if(number==""||isMobilevalidation(number)==false){alert(mobileerr);return false;}else{if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}}else{if(sender==""||isValid(sender)==false){alert(sendererr);return false;}else{if(message==""){alert(messageerr);return false;}}}}function isMobilevalidation(str){return/^(?:\+|00)[1-9][0-9]{5,15}$/.test(str);}function isNormalInteger(str){return/^\+?(0|[1-9]\d*)$/.test(str);}function isValid(str){var iChars="~`!#$%^&*+=-[]\\';,/{}|\":<>?";for(var i=0;i<str.length;i++){if(iChars.indexOf(str.charAt(i))!=-1){return false;}}return true;}function RegexEmail(email){var emailRegexStr=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;var isvalid=emailRegexStr.test(email);return isvalid;}function validate(emailerr,limiter){if(document.notify_sms_mail_form.sendin_notify_email.value==""||RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value)==false){alert(emailerr);document.notify_sms_mail_form.sendin_notify_email.focus();return false;}if(document.notify_sms_mail_form.sendin_notify_value.value==""||isNormalInteger(document.notify_sms_mail_form.sendin_notify_value.value)==false){alert(limiter);document.notify_sms_mail_form.sendin_notify_value.focus();return false;}return(true);}function smtpvalidate(emailerr){var email=jQuery("#email").val();if(email==""||RegexEmail(email)==false){alert(emailerr);jQuery("#email").focus();return false;}}function apikvalidate(apierr){var sendin_apikey_val=jQuery("#sendin_apikey_val").val();if(sendin_apikey_val.trim()==""){alert(apierr);jQuery("#sendin_apikey_val").focus();return false;}}
|
7 |
* needs then we can't provide a technical support.
|
8 |
**/
|
9 |
|
10 |
+
function testsmssend(e,r,t){var a=jQuery("#sender_order").val(),n=jQuery("#sender_order_message").val(),s=jQuery("#sender_order_number").val(),i=jQuery("#ajaxOrderSmsUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function testShippedSmsSend(e,r,t){var a=jQuery("#sender_shipment").val(),n=jQuery("#sender_shipment_message").val(),s=jQuery("#sender_shipment_number").val(),i=jQuery("#ajaxOrderShippedUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function testCampaignSmsSend(e,r,t){var a=jQuery("#sender_campaign").val(),n=jQuery("#sender_campaign_message").val(),s=jQuery("#sender_campaigntest_number").val(),i=jQuery("#ajaxSmsCampaignUrl").val(),u=jQuery("#smsCampError").val(),y=jQuery("#smsCampSuccess").val();return""==a||0==isValid(a)?alert(e):""==n?alert(r):""==s||0==isMobilevalidation(s)?alert(t):jQuery.ajax({type:"POST",async:!1,url:i,data:{sender:a,message:n,number:s},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),alert("OK"==e.trim()?y:u)}}),!1}function senderOrderSaveValid(e,r){var t=jQuery("#sender_order").val(),a=jQuery("#sender_order_message").val();return""==t||0==isValid(t)?(alert(e),!1):""==a?(alert(r),!1):void 0}function senderShipmentSaveValid(e,r){var t=jQuery("#sender_shipment").val(),a=jQuery("#sender_shipment_message").val();return""==t||0==isValid(t)?(alert(e),!1):""==a?(alert(r),!1):void 0}function senderCampaignSaveValid(e,r,t){var a=jQuery("#sender_campaign").val(),n=jQuery("#sender_campaign_message").val(),s=jQuery("#singlechoice").val(),i=jQuery("input[name=Sendin_Sms_Choice]:checked").val();if(1==i){if(""==s||0==isMobilevalidation(s))return alert(t),!1;if(""==a||0==isValid(a))return alert(e),!1;if(""==n)return alert(r),!1}else{if(""==a||0==isValid(a))return alert(e),!1;if(""==n)return alert(r),!1}}function isMobilevalidation(e){return/^(?:\+|00)[1-9][0-9]{5,15}$/.test(e)}function isNormalInteger(e){return/^\+?(0|[1-9]\d*)$/.test(e)}function isValid(e){for(var r="~`!#$%^&*+=-[]\\';,/{}|\":<>?",t=0;t<e.length;t++)if(-1!=r.indexOf(e.charAt(t)))return!1;return!0}function RegexEmail(e){var r=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,t=r.test(e);return t}function validate(e,r){return""==document.notify_sms_mail_form.sendin_notify_email.value||0==RegexEmail(document.notify_sms_mail_form.sendin_notify_email.value)?(alert(e),document.notify_sms_mail_form.sendin_notify_email.focus(),!1):""==document.notify_sms_mail_form.sendin_notify_value.value||0==isNormalInteger(document.notify_sms_mail_form.sendin_notify_value.value)?(alert(r),document.notify_sms_mail_form.sendin_notify_value.focus(),!1):!0}function smtpvalidate(e){var r=jQuery("#email").val();return""==r||0==RegexEmail(r)?(alert(e),jQuery("#email").focus(),!1):void 0}function apikvalidate(e){var r=jQuery("#sendin_apikey_val").val(),t=jQuery("input[name=sendin_api_status]:checked").val();return""==r.trim()&&0!=t?(alert(e),jQuery("#sendin_apikey_val").focus(),!1):void 0}jQuery.noConflict(),jQuery(document).ready(function(){function e(e){var r=jQuery("#ajaxcontentUrl").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"page="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),jQuery(".midleft").html(e),jQuery(".midleft").ajaxComplete(function(r,t,a){jQuery(".midleft").html(e)})}})}function r(e){var r=/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;return r.test(e)?!0:!1}function t(){var e=location.href.substr(0,location.href.lastIndexOf("/")+1),r=e.split("/"),t=r[r.length-2];return e.replace(t+"/","")}var a=jQuery("#apistatuskey").val();if(jQuery("#select").multiselect(),jQuery(".sendin_api_status").click(function(){1==a&&1==jQuery(this).val()?(jQuery("#sendin_apikey").show(),jQuery(".alldiv").show(),jQuery(".hidetableblock").show()):1==jQuery(this).val()?jQuery("#sendin_apikey").show():(jQuery("#sendin_apikey").hide(),jQuery(".alldiv").hide())}),jQuery("#sib_datetimepicker").datepicker({dateFormat:"yy-mm-dd"}),jQuery(".manage_subscribe_block input[name=subscribe_confirm_type]").click(function(){jQuery(".manage_subscribe_block .inner_manage_box").slideUp(),jQuery(this).parents(".manage_subscribe_block").find(".inner_manage_box").slideDown()}),jQuery(".openCollapse").each(function(){jQuery(this).is(":checked")||jQuery(this).parent(".form-group").find(".collapse").hide()}),jQuery("input[name=subscribe_confirm_type]").each(function(){jQuery(this).is(":checked")&&jQuery(this).parents(".manage_subscribe_block").find(".inner_manage_box").show()}),jQuery(".openCollapse").click(function(){jQuery(this).is(":checked")?jQuery(this).parent(".form-group").find(".collapse").slideDown():jQuery(this).parent(".form-group").find(".collapse").slideUp()}),jQuery(".hdtab").click(function(){parseInt(jQuery(this).val())&&jQuery("#hidetabselect").css("display","block")}),jQuery("body").on("click"," .pagination li.active",function(){var r=jQuery(this).attr("p");jQuery("#pagenumber").val(r),e(r)}),jQuery(".toolTip").hover(function(){var e=jQuery(this).attr("title"),r=jQuery(this).offset();jQuery("body").append('<div id="tipkk" style="top:'+r.top+"px; left:"+r.left+'px; ">'+e+"</div>");var t=jQuery("#tipkk").height()+25;jQuery("#tipkk").css("top",r.top-t+"px")},function(){jQuery("#tipkk").remove()}),jQuery("#sender_order").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-e.length);else{jQuery("#sender_order").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_order").val(t),jQuery("#sender_order_text").text(11-e.length)}}),jQuery("#sender_order").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-e.length);else{jQuery("#sender_order").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_order").val(t),jQuery("#sender_order_text").text(11-e.length)}}),jQuery("#sender_order").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_order").val()){var n=jQuery("#sender_order").val();r(n)?(jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-n.length)):(jQuery("#sender_order").attr("maxlength","11"),jQuery("#sender_order_text").text(11-n.length))}if(jQuery("#sender_order_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-e;jQuery("#sender_order_message_text").text(t),jQuery("#sender_order_message_text_count").text(r)}),""!=jQuery("#sender_order_message").val()){var s=jQuery("#sender_order_message").val().length,i=Math.ceil(s/160),u=160*i-s;jQuery("#sender_order_message_text").text(u),jQuery("#sender_order_message_text_count").text(i)}if(jQuery("#sender_shipment").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-e.length);else{jQuery("#sender_shipment").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_shipment").val(t),jQuery("#sender_shipment_text").text(11-e.length)}}),jQuery("#sender_shipment").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-e.length);else{jQuery("#sender_shipment").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_shipment").val(t),jQuery("#sender_shipment_text").text(11-e.length)}}),jQuery("#sender_shipment").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_shipment").val()){var n=jQuery("#sender_shipment").val();r(n)?(jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-n.length)):(jQuery("#sender_shipment").attr("maxlength","11"),jQuery("#sender_shipment_text").text(11-n.length))}if(jQuery("#sender_shipment_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-e;jQuery("#sender_shipment_message_text").text(t),jQuery("#sender_shipment_message_text_count").text(r)}),""!=jQuery("#sender_shipment_message").val()){var s=jQuery("#sender_shipment_message").val().length,i=Math.ceil(s/160),u=160*i-s;jQuery("#sender_shipment_message_text").text(u),jQuery("#sender_shipment_message_text_count").text(i)}if(jQuery("#sender_campaign").mouseover(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-e.length);else{jQuery("#sender_campaign").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_campaign").val(t),jQuery("#sender_campaign_text").text(11-e.length)}}),jQuery("#sender_campaign").keyup(function(){var e=jQuery(this).val();if(r(e)||""==e)jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-e.length);else{jQuery("#sender_campaign").attr("maxlength","11");var t=e.length>11?e.substr(1,11):e;jQuery("#sender_campaign").val(t),jQuery("#sender_campaign_text").text(11-e.length)}}),jQuery("#sender_campaign").keydown(function(e){32==e.keyCode&&e.preventDefault()}),""!=jQuery("#sender_campaign").val()){var n=jQuery("#sender_campaign").val();r(n)?(jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-n.length)):(jQuery("#sender_campaign").attr("maxlength","11"),jQuery("#sender_campaign_text").text(11-n.length))}if(jQuery("#sender_campaign_message").keyup(function(){var e=this.value.length,r=Math.ceil(e/160),t=160*r-(e%(160*r)||160*r);jQuery("#sender_campaign_message_text").text(t),jQuery("#sender_campaign_message_text_count").text(r)}),""!=jQuery("#sender_campaign_message").val()){var s=jQuery("#sender_campaign_message").val().length,i=Math.ceil(s/160),u=160*i-(s%(160*i)||160*i);jQuery("#sender_campaign_message_text").text(u),jQuery("#sender_campaign_message_text_count").text(i)}jQuery(".sms_order_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#order").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"orderSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideOrder").show():jQuery(".hideOrder").hide()}})}),jQuery(".sms_shiping_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#shiping").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"shipingSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}})}),jQuery(".sms_campaign_setting").click(function(){var e=jQuery(this).val(),r=jQuery("#campaign").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"campaignSetting="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide()}})}),0==jQuery("input:radio[name=sms_order_setting]:checked").val()?jQuery(".hideOrder").hide():jQuery(".hideOrder").show(),jQuery(".Sendin_Sms_Choice").click(function(){1==jQuery(this).val()?(jQuery(".multiplechoice").hide(),jQuery(".singlechoice").show()):(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide())}),jQuery(".Sendin_Sms_Choice").click(function(){2==jQuery(this).val()?jQuery(".sib_datepicker").show():jQuery(".sib_datepicker").hide()}),0==jQuery("input:radio[name=Sendin_Sms_Choice]:checked").val()?(jQuery(".multiplechoice").show(),jQuery(".singlechoice").hide()):(jQuery(".singlechoice").show(),jQuery(".multiplechoice").hide()),jQuery(".sms_shiping_setting").click(function(){1==jQuery(this).val()?jQuery(".hideShiping").show():jQuery(".hideShiping").hide()}),0==jQuery("input:radio[name=sms_credit]:checked").val()?jQuery(".hideCredit").hide():jQuery(".hideCredit").show(),jQuery(".sms_credit").click(function(){var e=jQuery(this).val(),r=jQuery("#credits").val();jQuery.ajax({type:"POST",async:!1,url:r,data:"sms_credit="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(r){jQuery("#ajax-busy").hide(),1==e?jQuery(".hideCredit").show():jQuery(".hideCredit").hide()}})}),0==jQuery("input:radio[name=sms_shiping_setting]:checked").val()?jQuery(".hideShiping").hide():jQuery(".hideShiping").show(),jQuery(".sms_campaign_setting").click(function(){1==jQuery(this).val()?jQuery(".hideCampaign").show():jQuery(".hideCampaign").hide()}),0==jQuery("input:radio[name=sms_campaign_setting]:checked").val()?jQuery(".hideCampaign").hide():jQuery(".hideCampaign").show(),jQuery("#selectSmsList").multiselect({header:!1,checkall:!1}),jQuery("#tabs li").click(function(){jQuery("#tabs li").removeClass("active"),jQuery(this).addClass("active"),jQuery(".tab_content").hide();var e=jQuery(this).find("a").attr("href");return jQuery(e).fadeIn(),!1}),jQuery("#showUserlist").click(function(){jQuery(".userDetails").is(":hidden")?(e(1),jQuery("#Spantextless").show(),jQuery("#Spantextmore").hide()):(jQuery("#Spantextmore").show(),jQuery("#Spantextless").hide()),jQuery(".userDetails").slideToggle()});t();jQuery(".Tracking").click(function(){var e=jQuery(this).val(),r=jQuery("#trackingUrl").val();0==e&&jQuery(".ordertracking").hide(),1==e&&jQuery(".ordertracking").show(),jQuery.ajax({type:"POST",async:!1,url:r,data:"script="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}})}),jQuery(".Trackhistory").click(function(){var e=jQuery("#history_status").val(),r=jQuery("#langvalue").val(),t=jQuery("#importordertrackingUrl").val();jQuery.ajax({type:"POST",async:!1,url:t,data:{history_status:e,langvalue:r},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide(),jQuery(".ordertracking").hide(),alert(e)}})}),jQuery(".smtpStatus").click(function(){var e=jQuery(this).val(),r=jQuery("#smtpUrl").val();0==e&&jQuery(".smtptest").hide(),1==e&&jQuery(".smtptest").show(),jQuery.ajax({type:"POST",async:!1,url:r,data:"smtptest="+e,beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}})});var y=jQuery("#skin_url").val();jQuery('<div id="ajax-busy"/> loading..').css({opacity:.5,position:"fixed",top:0,left:0,width:"100%",height:jQuery(window).height()+"px",background:"white url("+y+"adminhtml/default/default/sendinblue/images/loader.gif) no-repeat center"}).hide().appendTo("body"),jQuery("body").on("click",".ajax_contacts_href",function(r){var t=jQuery(this).attr("email"),a=jQuery(this).attr("status"),n=jQuery("#ajaxUrl").val();jQuery.ajax({type:"POST",async:!1,url:n,data:{email:t,newsletter:a},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}});var s=jQuery("#pagenumber").val();e(s)}),jQuery("body").on("click",".ajax_sms_subs_href",function(r){var t=jQuery(this).attr("email"),a=jQuery(this).attr("status"),n=jQuery("#ajaxSmsSubscribeUrl").val();jQuery.ajax({type:"POST",async:!1,url:n,data:{email:t,sms:a},beforeSend:function(){jQuery("#ajax-busy").show()},success:function(e){jQuery("#ajax-busy").hide()}});var s=jQuery("#pagenumber").val();e(s)})});
|