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.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.4
- app/code/local/Sendinblue/Sendinblue/Model/Observer.php +17 -19
- app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php +427 -133
- app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php +80 -93
- app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php +257 -34
- app/code/local/Sendinblue/Sendinblue/etc/config.xml +1 -1
- app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/{install-0.1.0.php → mysql4-install-0.1.0.php} +0 -0
- app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php +3 -2
- app/design/adminhtml/default/default/template/sendinblue/myform.phtml +38 -7
- app/locale/fr_FR/Sendinblue.csv +9 -1
- package.xml +15 -15
- skin/adminhtml/default/default/sendinblue/js/sendinblue.js +71 -1
- skin/adminhtml/default/default/sendinblue/js/sendinblue.min.js +1 -1
app/code/local/Sendinblue/Sendinblue/Model/Observer.php
CHANGED
@@ -80,7 +80,7 @@ class Sendinblue_Sendinblue_Model_Observer
|
|
80 |
$cus_session = Mage::getSingleton('customer/session')->getCustomer();
|
81 |
$customer = ($cus_session->getEmail())? $cus_session : $observer->getCustomer();
|
82 |
$cus_data = $cus_session->getData();
|
83 |
-
|
84 |
$cid = $customer->getEntityid();
|
85 |
$fname = $customer->getFirstname();
|
86 |
$fname = empty($fname)?'':$fname;
|
@@ -106,29 +106,22 @@ class Sendinblue_Sendinblue_Model_Observer
|
|
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 |
-
|
122 |
-
|
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($
|
132 |
}
|
133 |
return $this;
|
134 |
}
|
@@ -152,7 +145,8 @@ class Sendinblue_Sendinblue_Model_Observer
|
|
152 |
$locale = Mage::app()->getLocale()->getLocaleCode();
|
153 |
$mobile = $_shippingAddress->getTelephone();
|
154 |
$countryid = $_shippingAddress->getCountryId();
|
155 |
-
$
|
|
|
156 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
157 |
$data = $connection->fetchRow($sql);
|
158 |
|
@@ -205,7 +199,8 @@ class Sendinblue_Sendinblue_Model_Observer
|
|
205 |
$locale = Mage::app()->getLocale()->getLocaleCode();
|
206 |
$mobile = $orderaddress->getBillingAddress()->getTelephone();
|
207 |
$countryid = $orderaddress->getBillingAddress()->getCountryId();
|
208 |
-
$
|
|
|
209 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
210 |
$data = $connection->fetchRow($sql);
|
211 |
|
@@ -239,12 +234,15 @@ class Sendinblue_Sendinblue_Model_Observer
|
|
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 |
{
|
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;
|
106 |
|
107 |
$is_subscribed = (isset($params['is_subscribed']))? $params['is_subscribed'] : '';
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
if ($fname != '' || $lname != '' || $telephone != '' || $email != '')
|
110 |
{
|
111 |
+
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
112 |
+
$nlStatus = $costomer_data->getStatus();
|
113 |
+
|
114 |
$extra = $fname.'|'.$lname.'|'.$client.'|'.$telephone;
|
115 |
+
if (isset($is_subscribed) && $is_subscribed == 1 && empty($nlStatus))
|
116 |
+
{
|
|
|
|
|
117 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($email, $extra);
|
118 |
+
Mage::getModel('sendinblue/sendinblue')->sendWsTemplateMail($email);
|
119 |
}
|
120 |
}
|
121 |
|
122 |
if (isset($is_subscribed) && $is_subscribed != '' && $is_subscribed === 0) {
|
123 |
Mage::getSingleton('core/session')->addSuccess($is_subscribed);
|
124 |
+
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($params);
|
125 |
}
|
126 |
return $this;
|
127 |
}
|
145 |
$locale = Mage::app()->getLocale()->getLocaleCode();
|
146 |
$mobile = $_shippingAddress->getTelephone();
|
147 |
$countryid = $_shippingAddress->getCountryId();
|
148 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
149 |
+
$sql = 'SELECT * FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'" ';
|
150 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
151 |
$data = $connection->fetchRow($sql);
|
152 |
|
199 |
$locale = Mage::app()->getLocale()->getLocaleCode();
|
200 |
$mobile = $orderaddress->getBillingAddress()->getTelephone();
|
201 |
$countryid = $orderaddress->getBillingAddress()->getCountryId();
|
202 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
203 |
+
$sql = 'SELECT * FROM '.$tableCountry.' WHERE iso_code = "'.$countryid.'" ';
|
204 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
205 |
$data = $connection->fetchRow($sql);
|
206 |
|
234 |
}
|
235 |
public function subscribedToNewsletter($observer)
|
236 |
{
|
237 |
+
$data = $observer->subscriber;
|
238 |
+
|
239 |
if($data->subscriber_status == 3)
|
240 |
Mage::getModel('sendinblue/sendinblue')->emailDelete($data->subscriber_email);
|
241 |
else if ($data->subscriber_status == 1)
|
242 |
+
{
|
243 |
Mage::getModel('sendinblue/sendinblue')->emailSubscribe($data->subscriber_email);
|
244 |
+
Mage::getModel('sendinblue/sendinblue')->sendWsTemplateMail($data->subscriber_email);
|
245 |
+
}
|
246 |
}
|
247 |
public function disableCache(Varien_Event_Observer $observer)
|
248 |
{
|
app/code/local/Sendinblue/Sendinblue/Model/Sendinblue.php
CHANGED
@@ -31,7 +31,6 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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));
|
@@ -40,17 +39,36 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
40 |
|
41 |
public function checkMobileNumber($number, $call_prefix)
|
42 |
{
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
/**
|
56 |
* functions used for getting module status
|
@@ -183,6 +201,16 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
183 |
return $apikey;
|
184 |
}
|
185 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
* functions used for getting smtp status
|
187 |
*/
|
188 |
public function getSmtpStatus()
|
@@ -197,7 +225,18 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
197 |
*/
|
198 |
public function getTrackingStatus()
|
199 |
{
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
if (!$status) {
|
202 |
return false;
|
203 |
}
|
@@ -214,6 +253,16 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
214 |
return $userlist;
|
215 |
}
|
216 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
* functions used for getting general config
|
218 |
*/
|
219 |
public function getGeneralConfig($field, $store = null)
|
@@ -227,7 +276,7 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
227 |
{
|
228 |
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
229 |
}
|
230 |
-
|
231 |
{
|
232 |
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
233 |
}
|
@@ -238,6 +287,13 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
238 |
{
|
239 |
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
240 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
/**
|
242 |
* functions used for module functionality
|
243 |
*/
|
@@ -261,7 +317,12 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
261 |
$params['blacklisted'] = '';
|
262 |
if ($extra != null)
|
263 |
{
|
264 |
-
$
|
|
|
|
|
|
|
|
|
|
|
265 |
$params['attributes_value'] = $extra;
|
266 |
} else
|
267 |
{
|
@@ -392,7 +453,9 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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
|
@@ -498,8 +561,8 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
498 |
{
|
499 |
$params = array();
|
500 |
$params['foldername'] = 'magento';
|
501 |
-
$
|
502 |
-
$folder_id = $
|
503 |
$params = array();
|
504 |
$params['listname'] = $list_name;
|
505 |
$params['list_parent'] = $folder_id; //folder id
|
@@ -514,18 +577,6 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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
|
@@ -539,8 +590,8 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
539 |
{
|
540 |
$params = array();
|
541 |
$params['foldername'] = 'magento';
|
542 |
-
$
|
543 |
-
$folder_id = $
|
544 |
$exist_list = '';
|
545 |
} else
|
546 |
{
|
@@ -571,7 +622,7 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
571 |
$list_name = 'magento_'.$date;
|
572 |
}
|
573 |
else
|
574 |
-
|
575 |
$params = array();
|
576 |
$params['listname'] = $list_name;
|
577 |
$params['list_parent'] = $response;
|
@@ -585,8 +636,13 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
585 |
*/
|
586 |
public function createAttributesName()
|
587 |
{
|
|
|
588 |
$params = array();
|
589 |
-
$
|
|
|
|
|
|
|
|
|
590 |
$params['transactional_attributes'] = 'ORDER_ID,id|ORDER_DATE,date|ORDER_PRICE,number';
|
591 |
$this->callServer('ATTRIBUTES_CREATION', $params);
|
592 |
}
|
@@ -594,18 +650,20 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
594 |
* Method is used to send all the subscribers from magento to
|
595 |
* Sendinblue for adding / updating purpose.
|
596 |
*/
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
$
|
606 |
-
|
607 |
-
|
608 |
-
|
|
|
|
|
609 |
/**
|
610 |
* Send SMS from Sendin.
|
611 |
*/
|
@@ -619,7 +677,7 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
619 |
return $this->callServer('SENDSMS', $params);
|
620 |
}
|
621 |
|
622 |
-
|
623 |
{
|
624 |
$sendin_switch = new Mage_Core_Model_Config();
|
625 |
|
@@ -637,11 +695,12 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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')
|
@@ -685,7 +744,7 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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'));
|
@@ -698,8 +757,16 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
698 |
$params = array();
|
699 |
$params['key'] = $this->api_key;
|
700 |
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
701 |
-
|
702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
}
|
704 |
/**
|
705 |
* Method is used to send test email to the user.
|
@@ -739,62 +806,113 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
$customer_select[$email] = array(
|
760 |
'email' => $email,
|
761 |
-
'
|
762 |
-
'
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
}
|
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 |
* This method is used to fetch all users from the default newsletter table to list
|
@@ -802,26 +920,23 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
802 |
*/
|
803 |
public function getNewsletterSubscribe($start, $per_page)
|
804 |
{
|
805 |
-
|
|
|
806 |
foreach ($collection as $customer)
|
807 |
{
|
808 |
|
809 |
-
|
810 |
-
$
|
811 |
-
$lastname = $customer->getData('lastname');
|
812 |
-
$cid = $customer->getData('entity_id');
|
813 |
|
814 |
-
|
815 |
-
|
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
|
@@ -846,8 +961,6 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
846 |
else {
|
847 |
$newsletterArr[$cnt] = array(
|
848 |
'email' => $subscriber_email,
|
849 |
-
'firstname' => '',
|
850 |
-
'lastname' => '',
|
851 |
'telephone' => '',
|
852 |
'country_id' => ''
|
853 |
);
|
@@ -944,12 +1057,14 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
944 |
*/
|
945 |
public function getNewsletterUnSubscribeCount()
|
946 |
{
|
947 |
-
$
|
948 |
-
|
949 |
-
|
|
|
|
|
950 |
$unsubs_count1 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
951 |
|
952 |
-
$sql = 'SELECT count(*) as totalcoutn FROM
|
953 |
$unsubs_count2 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
954 |
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
955 |
|
@@ -960,7 +1075,8 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
960 |
*/
|
961 |
public function getNewsletterSubscribeCount()
|
962 |
{
|
963 |
-
$
|
|
|
964 |
$data = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
965 |
return $data['totalvalue'];
|
966 |
}
|
@@ -976,7 +1092,7 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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 |
}
|
@@ -1007,14 +1123,41 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
1007 |
*/
|
1008 |
public function curlRequest($data)
|
1009 |
{
|
1010 |
-
|
1011 |
-
$
|
1012 |
-
|
1013 |
-
$
|
1014 |
-
|
1015 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1016 |
$ch = curl_init();
|
1017 |
$ndata = '';
|
|
|
1018 |
if (is_array($data))
|
1019 |
{
|
1020 |
foreach ($data as $key => $value)
|
@@ -1030,10 +1173,11 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
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 |
|
@@ -1057,16 +1201,166 @@ class Sendinblue_Sendinblue_Model_Sendinblue extends Mage_Core_Model_Abstract
|
|
1057 |
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1058 |
return $this;
|
1059 |
}
|
1060 |
-
|
1061 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1062 |
*/
|
1063 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1064 |
{
|
1065 |
$data = array();
|
1066 |
$data['key'] = $this->api_key;
|
1067 |
-
$data['webaction'] = '
|
1068 |
-
$
|
1069 |
-
$
|
1070 |
-
return $
|
1071 |
-
|
1072 |
-
}
|
|
31 |
$scope = ($this->getScope()) ? $this->getScope() : Mage::app()->getStore()->getStoreId();
|
32 |
$this->module_enable = $this->getEnableStatus($scope);
|
33 |
$this->api_url = 'http://ws.mailin.fr/';
|
|
|
34 |
$this->api_key = $this->getApiKey();
|
35 |
if (!$this->lists_ids)
|
36 |
$this->lists_ids = str_replace(',', '|', $this->getUserlists($scope));
|
39 |
|
40 |
public function checkMobileNumber($number, $call_prefix)
|
41 |
{
|
42 |
+
$number = preg_replace('/\s+/', '', $number);
|
43 |
+
$charone = substr($number, 0, 1);
|
44 |
+
$chartwo = substr($number, 0, 2);
|
45 |
+
|
46 |
+
if (preg_match('/^'.$call_prefix.'/', $number))
|
47 |
+
return '00'.$number;
|
48 |
+
|
49 |
+
else if ($charone == '0' && $chartwo != '00')
|
50 |
+
{
|
51 |
+
if (preg_match('/^0'.$call_prefix.'/', $number))
|
52 |
+
return '00'.substr($number, 1);
|
53 |
+
else
|
54 |
+
return '00'.$call_prefix.substr($number, 1);
|
55 |
+
}
|
56 |
+
elseif ($chartwo == '00')
|
57 |
+
{
|
58 |
+
if (preg_match('/^00'.$call_prefix.'/', $number))
|
59 |
+
return $number;
|
60 |
+
else
|
61 |
+
return '00'.$call_prefix.substr($number, 2);
|
62 |
+
}
|
63 |
+
elseif ($charone == '+')
|
64 |
+
{
|
65 |
+
if (preg_match('/^\+'.$call_prefix.'/', $number))
|
66 |
+
return '00'.substr($number, 1);
|
67 |
+
else
|
68 |
+
return '00'.$call_prefix.substr($number, 1);
|
69 |
+
}
|
70 |
+
elseif ($charone != '0')
|
71 |
+
return '00'.$call_prefix.$number;
|
72 |
}
|
73 |
/**
|
74 |
* functions used for getting module status
|
201 |
return $apikey;
|
202 |
}
|
203 |
/**
|
204 |
+
* functions used for get user name
|
205 |
+
*/
|
206 |
+
public function getUserName()
|
207 |
+
{
|
208 |
+
$userName = $this->getSendinSmtpStatus('username', Mage::app()->getStore()->getStoreId());
|
209 |
+
if (!$userName)
|
210 |
+
return false;
|
211 |
+
return $userName;
|
212 |
+
}
|
213 |
+
/**
|
214 |
* functions used for getting smtp status
|
215 |
*/
|
216 |
public function getSmtpStatus()
|
225 |
*/
|
226 |
public function getTrackingStatus()
|
227 |
{
|
228 |
+
$status = $this->getSendinTrackingCodeStatus('code', Mage::app()->getStore()->getStoreId());
|
229 |
+
if (!$status) {
|
230 |
+
return false;
|
231 |
+
}
|
232 |
+
return $status;
|
233 |
+
}
|
234 |
+
/**
|
235 |
+
* functions used for getting tracking status
|
236 |
+
*/
|
237 |
+
public function getTrackingHistoryStatus()
|
238 |
+
{
|
239 |
+
$status = $this->getSendinTrackingHistoryStatus('history', Mage::app()->getStore()->getStoreId());
|
240 |
if (!$status) {
|
241 |
return false;
|
242 |
}
|
253 |
return $userlist;
|
254 |
}
|
255 |
/**
|
256 |
+
* functions used for get templateid
|
257 |
+
*/
|
258 |
+
public function getTemplateId()
|
259 |
+
{
|
260 |
+
$TemplateId = $this->getGeneralConfig('Sendin_Template_Id', Mage::app()->getStore()->getStoreId());
|
261 |
+
if (!$TemplateId)
|
262 |
+
return false;
|
263 |
+
return $TemplateId;
|
264 |
+
}
|
265 |
+
/**
|
266 |
* functions used for getting general config
|
267 |
*/
|
268 |
public function getGeneralConfig($field, $store = null)
|
276 |
{
|
277 |
return Mage::getStoreConfig('sendinblue/smtp/'.$field, $store);
|
278 |
}
|
279 |
+
public function getSyncronizeStatus()
|
280 |
{
|
281 |
return $this->getGeneralConfig('syncronize', Mage::app()->getStore()->getStoreId());
|
282 |
}
|
287 |
{
|
288 |
return Mage::getStoreConfig('sendinblue/tracking/'.$field, $store);
|
289 |
}
|
290 |
+
/**
|
291 |
+
* functions used for get sendin tracking history status
|
292 |
+
*/
|
293 |
+
public function getSendinTrackingHistoryStatus($field, $store = null)
|
294 |
+
{
|
295 |
+
return Mage::getStoreConfig('sendinblue/improt/'.$field, $store);
|
296 |
+
}
|
297 |
/**
|
298 |
* functions used for module functionality
|
299 |
*/
|
317 |
$params['blacklisted'] = '';
|
318 |
if ($extra != null)
|
319 |
{
|
320 |
+
$value_langauge = $this->getApiConfigValue();
|
321 |
+
if ($value_langauge->language == 'fr')
|
322 |
+
$params['attributes_name'] = 'PRENOM|NOM|CLIENT|SMS';
|
323 |
+
else
|
324 |
+
$params['attributes_name'] = 'NAME|SURNAME|CLIENT|SMS';
|
325 |
+
|
326 |
$params['attributes_value'] = $extra;
|
327 |
} else
|
328 |
{
|
453 |
$params['key'] = $api_key;
|
454 |
$response = $this->callServer('DISPLAYLISTDATA', $params);
|
455 |
if (isset($response->errorMsg) && !empty($response->errorMsg))
|
456 |
+
return $lists['error'] = $response->errorMsg;
|
457 |
+
|
458 |
+
|
459 |
}
|
460 |
/**
|
461 |
* functions used for smtp details and order tracking
|
561 |
{
|
562 |
$params = array();
|
563 |
$params['foldername'] = 'magento';
|
564 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
565 |
+
$folder_id = $res->folder_id;
|
566 |
$params = array();
|
567 |
$params['listname'] = $list_name;
|
568 |
$params['list_parent'] = $folder_id; //folder id
|
577 |
$this->sendAllMailIDToSendin($list_response);
|
578 |
}
|
579 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
/**
|
582 |
* folder create in Sendinblue after installing
|
590 |
{
|
591 |
$params = array();
|
592 |
$params['foldername'] = 'magento';
|
593 |
+
$res = $this->callServer('ADDFOLDER', $params);
|
594 |
+
$folder_id = $res->folder_id;
|
595 |
$exist_list = '';
|
596 |
} else
|
597 |
{
|
622 |
$list_name = 'magento_'.$date;
|
623 |
}
|
624 |
else
|
625 |
+
$list_name = 'magento';
|
626 |
$params = array();
|
627 |
$params['listname'] = $list_name;
|
628 |
$params['list_parent'] = $response;
|
636 |
*/
|
637 |
public function createAttributesName()
|
638 |
{
|
639 |
+
$value_langauge = $this->getApiConfigValue();
|
640 |
$params = array();
|
641 |
+
if ($value_langauge->language == 'fr')
|
642 |
+
$params['normal_attributes'] = 'PRENOM,text|NOM,text|SMS,text|CLIENT,number';
|
643 |
+
else
|
644 |
+
$params['normal_attributes'] = 'NAME,text|SURNAME,text|SMS,text|CLIENT,number';
|
645 |
+
|
646 |
$params['transactional_attributes'] = 'ORDER_ID,id|ORDER_DATE,date|ORDER_PRICE,number';
|
647 |
$this->callServer('ATTRIBUTES_CREATION', $params);
|
648 |
}
|
650 |
* Method is used to send all the subscribers from magento to
|
651 |
* Sendinblue for adding / updating purpose.
|
652 |
*/
|
653 |
+
public function sendAllMailIDToSendin($list)
|
654 |
+
{
|
655 |
+
$allemail = $this->getcustomers();
|
656 |
+
$params = array();
|
657 |
+
$params['webaction'] = 'IMPORTUSERS';
|
658 |
+
$params['key'] = $this->api_key;
|
659 |
+
$params['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportSubUsersToSendinblue.csv';
|
660 |
+
$params['listids'] = $list->result;
|
661 |
+
$params['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptySubsUserToSendinblue';
|
662 |
+
$this->curlRequestAsyc($params);
|
663 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
664 |
+
$sendin_switch->saveConfig('sendinblue/list', $list->result, 'default', 0);
|
665 |
+
|
666 |
+
}
|
667 |
/**
|
668 |
* Send SMS from Sendin.
|
669 |
*/
|
677 |
return $this->callServer('SENDSMS', $params);
|
678 |
}
|
679 |
|
680 |
+
public function sendOrder($mobile)
|
681 |
{
|
682 |
$sendin_switch = new Mage_Core_Model_Config();
|
683 |
|
695 |
public function notifySmsEmail()
|
696 |
{
|
697 |
$sendin_switch = new Mage_Core_Model_Config();
|
698 |
+
|
699 |
if($this->getSmsCredit() < $this->getNotifyValueStatus() && $this->module_enable == 1 && $this->getNotifySmsStatus() == 1)
|
700 |
{
|
701 |
if($this->getNotifyCronStatus() == 0)
|
702 |
+
{
|
703 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 1, 'default', 0);
|
704 |
$locale = Mage::app()->getLocale()->getLocaleCode();
|
705 |
$email_template_variables = array();
|
706 |
if ($locale == 'fr_FR')
|
744 |
}
|
745 |
else
|
746 |
{
|
747 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Notify_Cron_Executed', 0, 'default', 0);
|
748 |
}
|
749 |
|
750 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('sendinblue')->__('Notification mail has been sent'));
|
757 |
$params = array();
|
758 |
$params['key'] = $this->api_key;
|
759 |
$result = $this->callServer('USER-CURRENT-PLAN', $params);
|
760 |
+
|
761 |
+
foreach($result as $val)
|
762 |
+
{
|
763 |
+
if(is_object($val)){
|
764 |
+
if($val->plan_type=='SMS')
|
765 |
+
{
|
766 |
+
return $val->credits;
|
767 |
+
}
|
768 |
+
}
|
769 |
+
}
|
770 |
}
|
771 |
/**
|
772 |
* Method is used to send test email to the user.
|
806 |
*/
|
807 |
public function getcustomers()
|
808 |
{
|
809 |
+
$value_langauge = $this->getApiConfigValue();
|
810 |
$data = array();
|
811 |
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
812 |
foreach ($collection as $customer)
|
813 |
{
|
814 |
|
815 |
+
$email = $customer->getData('email');
|
816 |
+
$firstname = $customer->getData('firstname');
|
817 |
+
$lastname = $customer->getData('lastname');
|
818 |
+
$cid = $customer->getData('entity_id');
|
819 |
+
|
820 |
+
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
821 |
+
$telephone = '';
|
822 |
+
foreach ($collectionAddress as $customerPhno) {
|
823 |
+
$telephone = $customerPhno->getData('telephone');
|
824 |
+
$country_id = $customerPhno->getData('country_id');
|
825 |
+
}
|
826 |
+
$customer_select[$email] = array(
|
|
|
827 |
'email' => $email,
|
828 |
+
'NAME' => $firstname,
|
829 |
+
'SURNAME' => $lastname,
|
830 |
+
'SMS' => $telephone,
|
831 |
+
'country_id' => $country_id,
|
832 |
+
'CLIENT' => $cid>0?1:0
|
833 |
+
);
|
834 |
}
|
835 |
|
836 |
+
$newsletterArr = array();
|
837 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->addFieldToFilter('subscriber_status', array('eq' => 1))->load();
|
838 |
+
$cnt = 0;
|
839 |
+
foreach ( $newsletter->getItems() as $subscriber )
|
840 |
+
{
|
841 |
+
$customer_id = $subscriber->getCustomerId();;
|
842 |
+
$subscriber_email = $subscriber->getSubscriberEmail();
|
843 |
+
$subscriber_status = $subscriber->getSubscriberStatus();
|
844 |
+
|
845 |
+
if ( !empty($customer_select[$subscriber_email]) ) {
|
846 |
+
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
847 |
+
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
848 |
+
unset($customer_select[$subscriber_email]);
|
849 |
+
}
|
850 |
+
else {
|
851 |
+
$newsletterArr[$cnt] = array(
|
852 |
+
'email' => $subscriber_email,
|
853 |
+
'NAME' => '',
|
854 |
+
'SURNAME' => '',
|
855 |
+
'SMS' => '',
|
856 |
+
'country_id' => ''
|
857 |
+
);
|
858 |
+
$newsletterArr[$cnt]['CLIENT'] = $customer_id>0?1:0;
|
859 |
+
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
860 |
+
}
|
861 |
+
$cnt++;
|
862 |
+
}
|
863 |
+
|
864 |
|
865 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
866 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
867 |
+
if ($value_langauge->language == 'fr')
|
868 |
+
{
|
869 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
870 |
+
$key_value[] = 'EMAIL,PRENOM,NOM,SMS,CLIENT';
|
871 |
+
fputcsv($handle, $key_value);
|
872 |
+
}
|
873 |
+
else {
|
874 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
875 |
+
$key_value[] = 'EMAIL,NAME,SURNAME,SMS,CLIENT';
|
876 |
+
fputcsv($handle, $key_value);
|
877 |
+
|
878 |
+
}
|
879 |
+
|
880 |
+
foreach ($newsletterArr as $newsdata)
|
881 |
+
{
|
882 |
+
if(!empty($newsdata['country_id']))
|
883 |
+
{
|
884 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
885 |
+
$sql = 'SELECT country_prefix FROM '.$tableCountry.' WHERE iso_code = "'.$newsdata['country_id'].'"';
|
886 |
+
$country_id = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
887 |
+
}
|
888 |
+
if(!empty($newsdata['SMS']))
|
889 |
+
$phone_number = $this->checkMobileNumber($newsdata['SMS'], $country_id['country_prefix']);
|
890 |
+
else
|
891 |
+
$phone_number = '';
|
892 |
+
|
893 |
+
if ($value_langauge->language == 'fr')
|
894 |
+
{
|
895 |
+
$key_value = array(
|
896 |
+
'email' => $newsdata['email'],
|
897 |
+
'PRENOM' => $newsdata['NAME']?$newsdata['NAME']:'',
|
898 |
+
'NOM' => $newsdata['SURNAME']?$newsdata['SURNAME']:'',
|
899 |
+
'SMS' => $phone_number?$phone_number:'',
|
900 |
+
'CLIENT' => $newsdata['CLIENT']
|
901 |
+
);
|
902 |
+
}
|
903 |
+
else {
|
904 |
+
$key_value = array(
|
905 |
+
'email' => $newsdata['email'],
|
906 |
+
'NAME' => $newsdata['NAME']?$newsdata['NAME']:'',
|
907 |
+
'SURNAME' => $newsdata['SURNAME']?$newsdata['SURNAME']:'',
|
908 |
+
'SMS' => $phone_number?$phone_number:'',
|
909 |
+
'CLIENT' => $newsdata['CLIENT']
|
910 |
+
);
|
911 |
+
}
|
912 |
+
|
913 |
+
fputcsv($handle, $key_value);
|
914 |
+
|
915 |
+
} fclose($handle);
|
916 |
}
|
917 |
/**
|
918 |
* This method is used to fetch all users from the default newsletter table to list
|
920 |
*/
|
921 |
public function getNewsletterSubscribe($start, $per_page)
|
922 |
{
|
923 |
+
|
924 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
925 |
foreach ($collection as $customer)
|
926 |
{
|
927 |
|
928 |
+
$email = $customer->getData('email');
|
929 |
+
$cid = $customer->getData('entity_id');
|
|
|
|
|
930 |
|
931 |
+
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
932 |
+
$telephone = '';
|
933 |
foreach ($collectionAddress as $customerPhno) {
|
934 |
$telephone = $customerPhno->getData('telephone');
|
935 |
$country_id = $customerPhno->getData('country_id');
|
936 |
}
|
937 |
|
938 |
$customer_select[$email] = array(
|
939 |
+
'email' => $email,
|
|
|
|
|
940 |
'telephone' => $telephone,
|
941 |
'country_id' => $country_id,
|
942 |
'customer_id' => $cid
|
961 |
else {
|
962 |
$newsletterArr[$cnt] = array(
|
963 |
'email' => $subscriber_email,
|
|
|
|
|
964 |
'telephone' => '',
|
965 |
'country_id' => ''
|
966 |
);
|
1057 |
*/
|
1058 |
public function getNewsletterUnSubscribeCount()
|
1059 |
{
|
1060 |
+
$tableCustomer = Mage::getSingleton('core/resource')->getTableName('customer/entity');
|
1061 |
+
$tableNewsletter = Mage::getSingleton('core/resource')->getTableName('newsletter/subscriber');
|
1062 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableCustomer.' CE
|
1063 |
+
LEFT JOIN '.$tableNewsletter.' NS
|
1064 |
+
ON CE.entity_id=NS.customer_id WHERE subscriber_status != 1 or subscriber_status is null';
|
1065 |
$unsubs_count1 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
1066 |
|
1067 |
+
$sql = 'SELECT count(*) as totalcoutn FROM '.$tableNewsletter.' WHERE customer_id = 0 AND subscriber_status = 3';
|
1068 |
$unsubs_count2 = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
1069 |
return ($unsubs_count1['totalcoutn'] + $unsubs_count2['totalcoutn']);
|
1070 |
|
1075 |
*/
|
1076 |
public function getNewsletterSubscribeCount()
|
1077 |
{
|
1078 |
+
$tableNewsletter = Mage::getSingleton('core/resource')->getTableName('newsletter/subscriber');
|
1079 |
+
$sql = 'SELECT count(*) as totalvalue from '.$tableNewsletter.' where subscriber_status = 1';
|
1080 |
$data = Mage::getSingleton('core/resource') ->getConnection('core_read')->fetchRow($sql);
|
1081 |
return $data['totalvalue'];
|
1082 |
}
|
1092 |
$params = array();
|
1093 |
$params['key'] = $this->api_key;
|
1094 |
$params['email'] = $email;
|
1095 |
+
$response = $this->callServer('USERS-STATUS-BLACKLIST', $params);
|
1096 |
$response = json_encode($response);
|
1097 |
return json_decode($response, true);
|
1098 |
}
|
1123 |
*/
|
1124 |
public function curlRequest($data)
|
1125 |
{
|
1126 |
+
|
1127 |
+
$url = $this->api_url; // WS URL
|
1128 |
+
$ch = curl_init();
|
1129 |
+
$ndata = '';
|
1130 |
+
$data['source'] = 'Magento';
|
1131 |
+
if (is_array($data))
|
1132 |
+
{
|
1133 |
+
foreach ($data as $key => $value)
|
1134 |
+
$ndata .= $key.'='.urlencode($value).'&';
|
1135 |
+
} else
|
1136 |
+
$ndata = $data;
|
1137 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
1138 |
+
'Expect:'
|
1139 |
+
));
|
1140 |
+
|
1141 |
+
$ndata = trim($ndata,'&');
|
1142 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1143 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
1144 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1145 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1146 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1147 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1148 |
+
$data2 = curl_exec($ch);
|
1149 |
+
curl_close($ch);
|
1150 |
+
return $data2;
|
1151 |
+
}
|
1152 |
+
/**
|
1153 |
+
* CURL function to send request to the Sendinblue API server
|
1154 |
+
*/
|
1155 |
+
public function curlRequestAsyc($data)
|
1156 |
+
{
|
1157 |
+
$url = $this->api_url; // WS URL
|
1158 |
$ch = curl_init();
|
1159 |
$ndata = '';
|
1160 |
+
$data['source'] = 'Magento';
|
1161 |
if (is_array($data))
|
1162 |
{
|
1163 |
foreach ($data as $key => $value)
|
1173 |
curl_setopt($ch, CURLOPT_POST, 1);
|
1174 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $ndata);
|
1175 |
curl_setopt($ch, CURLOPT_HEADER, 0);
|
1176 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
|
1177 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1178 |
curl_setopt($ch, CURLOPT_URL, $url);
|
1179 |
$data2 = curl_exec($ch);
|
1180 |
+
curl_close($ch);
|
1181 |
return $data2;
|
1182 |
}
|
1183 |
|
1201 |
$this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, '');
|
1202 |
return $this;
|
1203 |
}
|
1204 |
+
/**
|
1205 |
+
* This method is used to fetch all subscribe users from the default customer table to list
|
1206 |
+
* them in the Sendinblue magento module.
|
1207 |
+
*/
|
1208 |
+
public function smsCampaignList()
|
1209 |
+
{
|
1210 |
+
$value_langauge = $this->getApiConfigValue();
|
1211 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
|
1212 |
+
foreach ($collection as $customer)
|
1213 |
+
{
|
1214 |
+
|
1215 |
+
$email = $customer->getData('email');
|
1216 |
+
$firstname = $customer->getData('firstname');
|
1217 |
+
$lastname = $customer->getData('lastname');
|
1218 |
+
$cid = $customer->getData('entity_id');
|
1219 |
+
|
1220 |
+
$collectionAddress = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->addAttributeToSelect('country_id')->addAttributeToFilter('parent_id',(int)$cid);
|
1221 |
+
$telephone = '';
|
1222 |
+
foreach ($collectionAddress as $customerPhno) {
|
1223 |
+
$telephone = $customerPhno->getData('telephone');
|
1224 |
+
$country_id = $customerPhno->getData('country_id');
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
if ($value_langauge->language == 'fr')
|
1228 |
+
{
|
1229 |
+
$customer_select[$email] = array(
|
1230 |
+
'email' => $email,
|
1231 |
+
'PRENOM' => $firstname,
|
1232 |
+
'NOM' => $lastname,
|
1233 |
+
'SMS' => $telephone,
|
1234 |
+
'country_id' => $country_id,
|
1235 |
+
'CLIENT' => $cid>0?1:0
|
1236 |
+
);
|
1237 |
+
}
|
1238 |
+
else {
|
1239 |
+
$customer_select[$email] = array(
|
1240 |
+
'email' => $email,
|
1241 |
+
'NAME' => $firstname,
|
1242 |
+
'SURNAME' => $lastname,
|
1243 |
+
'SMS' => $telephone,
|
1244 |
+
'country_id' => $country_id,
|
1245 |
+
'CLIENT' => $cid>0?1:0
|
1246 |
+
);
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
$newsletterArr = array();
|
1251 |
+
$newsletter = Mage::getResourceModel('newsletter/subscriber_collection')->load();
|
1252 |
+
$cnt = 0;
|
1253 |
+
foreach ( $newsletter->getItems() as $subscriber )
|
1254 |
+
{
|
1255 |
+
$customer_id = $subscriber->getCustomerId();;
|
1256 |
+
$subscriber_email = $subscriber->getSubscriberEmail();
|
1257 |
+
$subscriber_status = $subscriber->getSubscriberStatus();
|
1258 |
+
|
1259 |
+
if ( !empty($customer_select[$subscriber_email]) ) {
|
1260 |
+
$newsletterArr[$cnt] = $customer_select[$subscriber_email];
|
1261 |
+
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
1262 |
+
unset($customer_select[$subscriber_email]);
|
1263 |
+
}
|
1264 |
+
else {
|
1265 |
+
if ($value_langauge->language == 'fr')
|
1266 |
+
{
|
1267 |
+
$newsletterArr[$cnt] = array(
|
1268 |
+
'email' => $subscriber_email,
|
1269 |
+
'PRENOM' => '',
|
1270 |
+
'NOM' => '',
|
1271 |
+
'SMS' => '',
|
1272 |
+
'country_id' => ''
|
1273 |
+
);
|
1274 |
+
$newsletterArr[$cnt]['CLIENT'] = $customer_id>0?1:0;
|
1275 |
+
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
1276 |
+
}
|
1277 |
+
else
|
1278 |
+
{
|
1279 |
+
$newsletterArr[$cnt] = array(
|
1280 |
+
'email' => $subscriber_email,
|
1281 |
+
'NAME' => '',
|
1282 |
+
'SURNAME' => '',
|
1283 |
+
'SMS' => '',
|
1284 |
+
'country_id' => ''
|
1285 |
+
);
|
1286 |
+
$newsletterArr[$cnt]['CLIENT'] = $customer_id>0?1:0;
|
1287 |
+
$newsletterArr[$cnt]['subscriber_status'] = $subscriber_status;
|
1288 |
+
}
|
1289 |
+
}
|
1290 |
+
$cnt++;
|
1291 |
+
}
|
1292 |
+
$i = 0;
|
1293 |
+
$data = array();
|
1294 |
+
foreach($newsletterArr as $result)
|
1295 |
+
{
|
1296 |
+
|
1297 |
+
if(!empty($result['SMS']))
|
1298 |
+
{
|
1299 |
+
$data[$i]= $result;
|
1300 |
+
}
|
1301 |
+
$i++;
|
1302 |
+
}
|
1303 |
+
return json_encode($data);
|
1304 |
+
}
|
1305 |
+
/**
|
1306 |
+
* API config value from SendinBlue.
|
1307 |
+
*/
|
1308 |
+
public function getApiConfigValue()
|
1309 |
+
{
|
1310 |
+
$data = array();
|
1311 |
+
$data['key'] = $this->api_key;
|
1312 |
+
$data['webaction'] = 'PLUGIN-CONFIG';
|
1313 |
+
$value_config = $this->curlRequest($data);
|
1314 |
+
$result = json_decode($value_config);
|
1315 |
+
return $result;
|
1316 |
+
}
|
1317 |
+
/**
|
1318 |
+
* Send template email by sendinblue for newsletter subscriber user .
|
1319 |
*/
|
1320 |
+
public function sendWsTemplateMail($to)
|
1321 |
+
{
|
1322 |
+
$mail_url = "http://mysmtp.mailin.fr/ws/template/"; //Curl url
|
1323 |
+
|
1324 |
+
$key = $this->api_key;
|
1325 |
+
$user = $this->getUserName();
|
1326 |
+
|
1327 |
+
$to = str_replace('+', '%2B', $to);
|
1328 |
+
$temp_id_value = $this->getTemplateId();
|
1329 |
+
$templateid = !empty($temp_id_value) ? $temp_id_value : ''; // should be the campaign id of template created on mailin. Please remember this template should be active than only it will be sent, otherwise it will return error.
|
1330 |
+
|
1331 |
+
$post_data = "to=$to&key=$key&user=$user&templateid=$templateid";
|
1332 |
+
|
1333 |
+
$ch = curl_init();
|
1334 |
+
|
1335 |
+
curl_setopt ($ch, CURLOPT_POST, 1);
|
1336 |
+
|
1337 |
+
curl_setopt ($ch, CURLOPT_URL, $mail_url);
|
1338 |
+
|
1339 |
+
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
|
1340 |
+
|
1341 |
+
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
|
1342 |
+
|
1343 |
+
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
|
1344 |
+
|
1345 |
+
$return_data = curl_exec ($ch);
|
1346 |
+
|
1347 |
+
curl_close ($ch);
|
1348 |
+
|
1349 |
+
$res = json_decode($return_data, true);
|
1350 |
+
return $res;
|
1351 |
+
|
1352 |
+
}
|
1353 |
+
/**
|
1354 |
+
* Get all temlpate list id by sendinblue.
|
1355 |
+
*/
|
1356 |
+
public function templateDisplay()
|
1357 |
{
|
1358 |
$data = array();
|
1359 |
$data['key'] = $this->api_key;
|
1360 |
+
$data['webaction'] = 'CAMPAIGNDETAIL';
|
1361 |
+
$data['show'] = 'ALL';
|
1362 |
+
$data['messageType'] = 'template';
|
1363 |
+
return json_decode($this->curlRequest($data));
|
1364 |
+
|
1365 |
+
}
|
1366 |
+
}
|
app/code/local/Sendinblue/Sendinblue/controllers/Adminhtml/MyformController.php
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
12 |
{
|
13 |
public function indexAction()
|
14 |
-
{
|
15 |
-
|
16 |
$this->loadLayout();
|
17 |
$this->renderLayout();
|
18 |
|
@@ -27,6 +27,13 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
27 |
if (isset($post['syncronizeSubmit']))
|
28 |
{
|
29 |
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
if (!empty($post['sendin_list']))
|
31 |
{
|
32 |
$list = implode('|', $post['sendin_list']);
|
@@ -38,6 +45,7 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
38 |
$message = $this->__('Please select a list');
|
39 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
40 |
}
|
|
|
41 |
}
|
42 |
}
|
43 |
catch (Exception $e)
|
@@ -58,7 +66,6 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
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']);
|
@@ -388,7 +395,8 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
388 |
|
389 |
if(!empty($result['shipping_telephone']))
|
390 |
{
|
391 |
-
$
|
|
|
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']);
|
@@ -418,95 +426,74 @@ class Sendinblue_Sendinblue_Adminhtml_MyformController extends Mage_Adminhtml_Co
|
|
418 |
}
|
419 |
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
420 |
{
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
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 |
}
|
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 |
|
27 |
if (isset($post['syncronizeSubmit']))
|
28 |
{
|
29 |
$sendin_switch->saveConfig('sendinblue/syncronize', $post['syncronize']);
|
30 |
+
if (!empty($post['template']))
|
31 |
+
{
|
32 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
33 |
+
$sendin_switch->saveConfig('sendinblue/Sendin_Template_Id', $post['template']);
|
34 |
+
$message = $this->__('Your setting has been successfully saved');
|
35 |
+
}
|
36 |
+
|
37 |
if (!empty($post['sendin_list']))
|
38 |
{
|
39 |
$list = implode('|', $post['sendin_list']);
|
45 |
$message = $this->__('Please select a list');
|
46 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
47 |
}
|
48 |
+
|
49 |
}
|
50 |
}
|
51 |
catch (Exception $e)
|
66 |
$result = Mage::getModel('sendinblue/sendinblue')->checkApikey(trim($post['sendin_apikey']));
|
67 |
if (empty($result['error']))
|
68 |
{
|
|
|
69 |
$get_key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
70 |
if ($get_key == '')
|
71 |
Mage::getModel('sendinblue/sendinblue')->createFolderName($post['sendin_apikey']);
|
395 |
|
396 |
if(!empty($result['shipping_telephone']))
|
397 |
{
|
398 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
399 |
+
$sql = 'SELECT * FROM '.$tableCountry.' WHERE iso_code = "'.$result['shipping_country_code'].'" ';
|
400 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
401 |
$data = $connection->fetchRow($sql);
|
402 |
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($result['shipping_telephone'],$data['country_prefix']);
|
426 |
}
|
427 |
else if(isset($post['sender_campaign_save']) && $post['Sendin_Sms_Choice'] == 2)
|
428 |
{
|
429 |
+
$smscredit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
430 |
+
|
431 |
+
$camp_name = 'SMS_'.date('Ymd');
|
432 |
+
$key = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
433 |
+
if ($key == '')
|
434 |
+
return false;
|
435 |
+
$param['key'] = $key;
|
436 |
+
$param['listname'] = $camp_name;
|
437 |
+
$param['webaction'] = 'NEWLIST';
|
438 |
+
$param['list_parent'] = '1';
|
439 |
+
//folder id
|
440 |
+
$list_response = Mage::getModel('sendinblue/sendinblue')->curlRequest($param);
|
441 |
+
$res = json_decode($list_response);
|
442 |
+
$list_id = $res->result;
|
443 |
+
// import old user to SendinBlue
|
444 |
+
|
445 |
+
$iso_code = $this->context->language->iso_code;
|
446 |
+
$allemail = Mage::getModel('sendinblue/sendinblue')->smsCampaignList();
|
447 |
+
|
448 |
+
$data['webaction'] = 'MULTI-USERCREADIT';
|
449 |
+
$data['key'] = $key;
|
450 |
+
$data['attributes'] = $allemail;
|
451 |
+
$data['listid'] = $list_id;
|
452 |
+
// List id should be optional
|
453 |
+
|
454 |
+
$data_responce = Mage::getModel('sendinblue/sendinblue')->curlRequest($data);
|
455 |
+
|
456 |
+
$msgbody = $post['sender_campaign_message'];
|
457 |
+
$value_langauge = Mage::getModel('sendinblue/sendinblue')->getApiConfigValue();
|
458 |
+
if ($value_langauge->language == 'fr')
|
459 |
+
{
|
460 |
+
$firstname = '{NOM}';
|
461 |
+
$lastname = '{PRENOM}';
|
462 |
+
}
|
463 |
+
else
|
464 |
+
{
|
465 |
+
$firstname = '{NAME}';
|
466 |
+
$lastname = '{SURNAME}';
|
467 |
+
}
|
468 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
469 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
470 |
+
$arr = array();
|
471 |
+
$sender_campaign = $post['sender_campaign'];
|
472 |
+
$content = $msgbody;
|
473 |
+
//Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
474 |
+
$arr['key'] = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
475 |
+
$arr['webaction'] = 'SMSCAMPCREADIT';
|
476 |
+
$arr['camp_name'] = $camp_name; // mandatory
|
477 |
+
$arr['sender'] = $sender_campaign;
|
478 |
+
$arr['content'] = $content;
|
479 |
+
$arr['bat_sent'] = '';
|
480 |
+
$arr['listids'] = $list_id; // mandatory if SMS campaign is scheduled
|
481 |
+
$arr['exclude_list'] = '';
|
482 |
+
$arr['schedule'] = date('Y-m-d H:i:s', time() + 300);
|
483 |
+
|
484 |
+
$data_camp = Mage::getModel('sendinblue/sendinblue')->curlRequest($arr);
|
485 |
+
|
486 |
+
|
487 |
+
if ($smscredit >= 1)
|
488 |
+
{
|
489 |
+
$message = $this->__('Message has been sent successfully');
|
490 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
491 |
+
}
|
492 |
+
else
|
493 |
+
{
|
494 |
+
$message = $this->__('Message has not been sent successfully');
|
495 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
496 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
|
499 |
}
|
app/code/local/Sendinblue/Sendinblue/controllers/AjaxController.php
CHANGED
@@ -85,12 +85,135 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
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 |
{
|
@@ -144,6 +267,8 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
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';
|
@@ -154,6 +279,8 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
154 |
{
|
155 |
$title1 = 'Unsubscribe the contact';
|
156 |
$title2 = 'Subscribe the contact';
|
|
|
|
|
157 |
$first = 'First';
|
158 |
$last = 'Last';
|
159 |
$previous = 'Previous';
|
@@ -205,7 +332,8 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
205 |
$country_id = !empty($subscriber['country_id'])?$subscriber['country_id'] : '';
|
206 |
if($phone != '')
|
207 |
{
|
208 |
-
$
|
|
|
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']);
|
@@ -214,14 +342,32 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
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.'" >';
|
@@ -229,8 +375,9 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
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
|
233 |
-
'.$img_sendin.'</a></td
|
|
|
234 |
$i++;
|
235 |
}
|
236 |
}
|
@@ -271,9 +418,31 @@ class Sendinblue_Sendinblue_AjaxController extends Mage_Core_Controller_Front_Ac
|
|
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.'));
|
@@ -281,8 +450,8 @@ public function ajaxupdateAction()
|
|
281 |
if (!empty($post['email']) && $post['newsletter'] == 0)
|
282 |
{
|
283 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailSubscribe($post['email']);
|
284 |
-
|
285 |
-
$sql = 'SELECT * from
|
286 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
287 |
$custdata = $connection->fetchRow($sql);
|
288 |
|
@@ -305,7 +474,8 @@ public function ajaxupdateAction()
|
|
305 |
|
306 |
if (!empty($telephone))
|
307 |
{
|
308 |
-
$
|
|
|
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']);
|
@@ -327,12 +497,12 @@ public function ajaxupdateAction()
|
|
327 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
328 |
}
|
329 |
}
|
330 |
-
$sql = 'SELECT * from
|
331 |
$custdatanews = $connection->fetchRow($sql);
|
332 |
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
333 |
-
|
334 |
|
335 |
-
$connection->query("insert into
|
336 |
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$custdata['email']."','1')");
|
337 |
|
338 |
}
|
@@ -343,12 +513,12 @@ public function ajaxupdateAction()
|
|
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
|
352 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
353 |
$custdata = $connection->fetchRow($sql);
|
354 |
|
@@ -383,16 +553,39 @@ public function ajaxupdateAction()
|
|
383 |
|
384 |
if (isset($number))
|
385 |
{
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
}
|
397 |
|
398 |
}
|
@@ -418,12 +611,35 @@ public function ajaxupdateAction()
|
|
418 |
|
419 |
if (isset($number))
|
420 |
{
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
if (isset($result->status) && $result->status == 'OK')
|
428 |
echo 'OK';
|
429 |
else
|
@@ -451,12 +667,19 @@ public function ajaxupdateAction()
|
|
451 |
|
452 |
if (isset($number))
|
453 |
{
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
if (isset($result->status) && $result->status == 'OK')
|
461 |
echo 'OK';
|
462 |
else
|
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 |
+
$sendin_switch->saveConfig('sendinblue/improt/history', $post['script']);
|
89 |
echo $this->__('Your setting has been successfully saved');
|
90 |
}
|
91 |
catch (Exception $e)
|
92 |
{
|
93 |
echo $this->__($e->getMessage());
|
94 |
}
|
95 |
+
}
|
96 |
+
public function emptySubsUserToSendinblueAction()
|
97 |
+
{
|
98 |
+
$post = $this->getRequest()->getPost();
|
99 |
+
try {
|
100 |
+
if (empty($post))
|
101 |
+
Mage::throwException($this->__('Invalid form data.'));
|
102 |
+
if ($post['proc_success'] != '')
|
103 |
+
{
|
104 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportSubUsersToSendinblue.csv', 'w+');
|
105 |
+
$key_value = array();
|
106 |
+
$key_value[] = '';
|
107 |
+
fputcsv($handle, $key_value);
|
108 |
+
fclose($handle);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
catch (Exception $e)
|
112 |
+
{
|
113 |
+
echo $this->__($e->getMessage());
|
114 |
+
}
|
115 |
+
}
|
116 |
+
public function emptyImportOldOrderAction()
|
117 |
+
{
|
118 |
+
$post = $this->getRequest()->getPost();
|
119 |
+
try {
|
120 |
+
if (empty($post))
|
121 |
+
Mage::throwException($this->__('Invalid form data.'));
|
122 |
+
if ($post['proc_success'] != '')
|
123 |
+
{
|
124 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
125 |
+
$key_value = array();
|
126 |
+
$key_value[] = '';
|
127 |
+
fputcsv($handle, $key_value);
|
128 |
+
fclose($handle);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
catch (Exception $e)
|
132 |
+
{
|
133 |
+
echo $this->__($e->getMessage());
|
134 |
+
}
|
135 |
+
}
|
136 |
+
public function orderhistoryAction()
|
137 |
+
{
|
138 |
+
$post = $this->getRequest()->getPost();
|
139 |
+
try {
|
140 |
+
if (empty($post))
|
141 |
+
Mage::throwException($this->__('Invalid form data.'));
|
142 |
+
|
143 |
+
if ($post['history_status'] == 1)
|
144 |
+
{
|
145 |
+
$value = Mage::getModel('sendinblue/sendinblue')->TrackingSmtp();
|
146 |
+
$date_value = Mage::getModel('sendinblue/sendinblue')->getApiConfigValue();
|
147 |
+
if (!is_dir(Mage::getBaseDir('media').'/sendinblue_csv'))
|
148 |
+
mkdir(Mage::getBaseDir('media').'/sendinblue_csv', 0777, true);
|
149 |
+
|
150 |
+
$handle = fopen(Mage::getBaseDir('media').'/sendinblue_csv/ImportOldOrdersToSendinblue.csv', 'w+');
|
151 |
+
|
152 |
+
fwrite($handle, 'EMAIL,ORDER_ID,ORDER_PRICE,ORDER_DATE'.PHP_EOL);
|
153 |
+
|
154 |
+
|
155 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('email');
|
156 |
+
foreach ($collection as $customer)
|
157 |
+
{
|
158 |
+
$cid = $customer->getData('entity_id');
|
159 |
+
$email = $customer->getData('email');
|
160 |
+
$total_orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $cid);
|
161 |
+
$orderCnt = $total_orders->count();
|
162 |
+
if ($orderCnt > 0)
|
163 |
+
{
|
164 |
+
$data = array();
|
165 |
+
$data['key'] = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
166 |
+
$data['webaction'] = 'USERS-STATUS';
|
167 |
+
$data['email'] = $email;
|
168 |
+
$curl_responce = Mage::getModel('sendinblue/sendinblue')->curlRequest($data);
|
169 |
+
$user_status = json_decode($curl_responce);
|
170 |
+
}
|
171 |
+
if ($user_status->result != '')
|
172 |
+
{
|
173 |
+
foreach($total_orders as $order_data)
|
174 |
+
{
|
175 |
+
if ($date_value->date_format == 'dd-mm-yyyy')
|
176 |
+
$date = date('d-m-Y', strtotime($order_data['created_at']));
|
177 |
+
else
|
178 |
+
$date = date('m-d-Y', strtotime($order_data['created_at']));
|
179 |
+
$history_data= array();
|
180 |
+
$history_data[] = array($order_data['customer_email'],$order_data['increment_id'],$order_data['grand_total'],$date);
|
181 |
+
foreach ($history_data as $line)
|
182 |
+
fputcsv($handle, $line);
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
fclose($handle);
|
188 |
+
|
189 |
+
$get_User_lists = Mage::getModel('sendinblue/sendinblue')->getUserlists();
|
190 |
+
$list = str_replace('|', ',', $get_User_lists);
|
191 |
+
if (preg_match('/^[0-9,]+$/', $list))
|
192 |
+
$list = $list;
|
193 |
+
else
|
194 |
+
$list = '';
|
195 |
+
|
196 |
+
$import_data = array();
|
197 |
+
$import_data['webaction'] = 'IMPORTUSERS';
|
198 |
+
$import_data['key'] = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
199 |
+
$import_data['url'] = Mage::getBaseUrl('media').'sendinblue_csv/ImportOldOrdersToSendinblue.csv';
|
200 |
+
$import_data['listids'] = $list;
|
201 |
+
$import_data['notify_url'] = Mage::getBaseUrl().'sendinblue/ajax/emptyImportOldOrder';
|
202 |
+
/**
|
203 |
+
* List id should be optional
|
204 |
+
*/
|
205 |
+
Mage::getModel('sendinblue/sendinblue')->curlRequestAsyc($import_data);
|
206 |
+
|
207 |
+
|
208 |
+
$sendin_switch = new Mage_Core_Model_Config();
|
209 |
+
$sendin_switch->saveConfig('sendinblue/improt/history', 0);
|
210 |
+
echo $this->__('Order history has been import successfully');
|
211 |
+
}
|
212 |
+
}
|
213 |
+
catch (Exception $e)
|
214 |
+
{
|
215 |
+
echo $this->__($e->getMessage());
|
216 |
+
}
|
217 |
}
|
218 |
public function smtppostAction()
|
219 |
{
|
267 |
{
|
268 |
$title1 = 'Inscrire le contact';
|
269 |
$title2 = 'Désinscrire le contact';
|
270 |
+
$title3 = 'Inscrire le sms';
|
271 |
+
$title4 = 'Désinscrire le sms';
|
272 |
$first = 'Première page';
|
273 |
$last = 'Dernière page';
|
274 |
$previous = 'Précédente';
|
279 |
{
|
280 |
$title1 = 'Unsubscribe the contact';
|
281 |
$title2 = 'Subscribe the contact';
|
282 |
+
$title3 = 'Unsubscribe the sms';
|
283 |
+
$title4 = 'Subscribe the sms';
|
284 |
$first = 'First';
|
285 |
$last = 'Last';
|
286 |
$previous = 'Previous';
|
332 |
$country_id = !empty($subscriber['country_id'])?$subscriber['country_id'] : '';
|
333 |
if($phone != '')
|
334 |
{
|
335 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
336 |
+
$sql = 'SELECT * FROM '.$tableCountry.' WHERE iso_code = "'.$country_id.'" ';
|
337 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
338 |
$data = $connection->fetchRow($sql);
|
339 |
$phone = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($phone,$data['country_prefix']);
|
342 |
$client = $yes;
|
343 |
else
|
344 |
$client = $no;
|
345 |
+
if ($sendin_result[$email]['email_bl'] === 1 || $sendin_result[$email] === null)
|
346 |
$show_status = 0;
|
347 |
+
if ($sendin_result[$email]['email_bl'] === 0)
|
348 |
$show_status = 1;
|
349 |
+
if ($sendin_result[$email]['sms_bl'] === 1 && $sendin_result[$email]['sms_exist'] != '')
|
350 |
+
$sms_status = 0;
|
351 |
+
if ($sendin_result[$email]['sms_bl'] === 0 && $sendin_result[$email]['sms_exist'] != '')
|
352 |
+
$sms_status = 1;
|
353 |
+
if ($sendin_result[$email]['sms_exist'] == '')
|
354 |
+
$sms_status = 2;
|
355 |
+
if ($sendin_result[$email]['sms_exist'] == '' && $subscriber['telephone'] != '')
|
356 |
+
$sms_status = 3;
|
357 |
if ($subscriber['subscriber_status'] != 3)
|
358 |
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif" >';
|
359 |
else
|
360 |
$img_magento = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif" >';
|
361 |
+
if ($sms_status == 1)
|
362 |
+
$img_sms = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif"
|
363 |
+
id="ajax_contact_status_'.$i.'" title="'.$title3.'" >';
|
364 |
+
else if ($sms_status == 0)
|
365 |
+
$img_sms = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif"
|
366 |
+
id="ajax_contact_status_'.$i.'" title="'.$title4.'" >';
|
367 |
+
else if ($sms_status == 2 || $sms_status == '')
|
368 |
+
$img_sms = '';
|
369 |
+
else if ($sms_status == 3)
|
370 |
+
$img_sms = 'Not synchronized';
|
371 |
if ($show_status)
|
372 |
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/enabled.gif"
|
373 |
id="ajax_contact_status_'.$i.'" title="'.$title1.'" >';
|
375 |
$img_sendin = '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'adminhtml/default/default/sendinblue/images/disabled.gif"
|
376 |
id="ajax_contact_status_'.$i.'" title="'.$title2.'" >';
|
377 |
$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>
|
378 |
+
<td class="a-left"><a status="'.$show_status.'" email="'.$email.'" class="ajax_contacts_href" href="javascript:void(0)">
|
379 |
+
'.$img_sendin.'</a></td><td class="a-left last"><a status="'.$sms_status.'" email="'.$email.'" class="ajax_sms_subs_href" href="javascript:void(0)">
|
380 |
+
'.$img_sms.'</a></td></tr>';
|
381 |
$i++;
|
382 |
}
|
383 |
}
|
418 |
echo $this->__($e->getMessage());
|
419 |
}
|
420 |
}
|
421 |
+
function ajaxsmssubscribeAction()
|
422 |
+
{
|
423 |
+
$post = $this->getRequest()->getPost();
|
424 |
+
try {
|
425 |
+
if (empty($post))
|
426 |
+
Mage::throwException($this->__('Invalid form data.'));
|
427 |
+
$email = $post['email'];
|
428 |
+
//$sms = $post['sms'];
|
429 |
+
$data = array();
|
430 |
+
$data['key'] = Mage::getModel('sendinblue/sendinblue')->getApiKey();
|
431 |
+
$data['webaction'] = 'USERUNSUBSCRIBEDSMS';
|
432 |
+
$data['email'] = $email;
|
433 |
+
Mage::getModel('sendinblue/sendinblue')->curlRequest($data);
|
434 |
+
|
435 |
+
}
|
436 |
+
catch (Exception $e)
|
437 |
+
{
|
438 |
+
echo $this->__($e->getMessage());
|
439 |
+
}
|
440 |
+
}
|
441 |
public function ajaxupdateAction()
|
442 |
{
|
443 |
$post = $this->getRequest()->getPost();
|
444 |
+
$tableCustomer = Mage::getSingleton('core/resource')->getTableName('customer/entity');
|
445 |
+
$tableNewsletter = Mage::getSingleton('core/resource')->getTableName('newsletter/subscriber');
|
446 |
try {
|
447 |
if (empty($post))
|
448 |
Mage::throwException($this->__('Invalid form data.'));
|
450 |
if (!empty($post['email']) && $post['newsletter'] == 0)
|
451 |
{
|
452 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailSubscribe($post['email']);
|
453 |
+
$responce_data = json_decode($responce);
|
454 |
+
$sql = 'SELECT * from '.$tableCustomer.' where email = "'.$post['email'].'" ';
|
455 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
456 |
$custdata = $connection->fetchRow($sql);
|
457 |
|
474 |
|
475 |
if (!empty($telephone))
|
476 |
{
|
477 |
+
$tableCountry = Mage::getSingleton('core/resource')->getTableName('sendinblue_country_codes');
|
478 |
+
$sql = 'SELECT * FROM '.$tableCountry.' WHERE iso_code = "'.$country_id.'" ';
|
479 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
480 |
$data = $connection->fetchRow($sql);
|
481 |
$number = Mage::getModel('sendinblue/sendinblue')->checkMobileNumber($telephone,$data['country_prefix']);
|
497 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailAdd($post['email'], $extra);
|
498 |
}
|
499 |
}
|
500 |
+
$sql = 'SELECT * from '.$tableNewsletter.' where subscriber_email = "'.$post['email'].'" ';
|
501 |
$custdatanews = $connection->fetchRow($sql);
|
502 |
if ($custdata['entity_id'] !='' && $custdatanews['subscriber_email'] == '' )
|
503 |
+
{
|
504 |
|
505 |
+
$connection->query("insert into ".$tableNewsletter."(store_id, customer_id, subscriber_email, subscriber_status)
|
506 |
values('".$custdata['store_id']."','".$custdata['entity_id']."','".$custdata['email']."','1')");
|
507 |
|
508 |
}
|
513 |
$costomer_data->setIsStatusChanged(true);
|
514 |
$costomer_data->save();
|
515 |
}
|
516 |
+
|
517 |
}
|
518 |
else{
|
519 |
$responce = Mage::getModel('sendinblue/sendinblue')->emailDelete($post['email']);
|
520 |
$costomer_data = Mage::getModel('newsletter/subscriber')->loadByEmail($post['email']);
|
521 |
+
$sql = 'SELECT * from '.$tableCustomer.' where email = "'.$post['email'].'" ';
|
522 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
523 |
$custdata = $connection->fetchRow($sql);
|
524 |
|
553 |
|
554 |
if (isset($number))
|
555 |
{
|
556 |
+
$adminUserModel = Mage::getModel('admin/user');
|
557 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
558 |
+
$admin_data = $userCollection->getData();
|
559 |
+
$firstname = $admin_data[0]['firstname'];
|
560 |
+
$lastname = $admin_data[0]['lastname'];
|
561 |
+
$characters = '1234567890';
|
562 |
+
$ref_num = '';
|
563 |
+
for ($i = 0; $i < 9; $i++)
|
564 |
+
$ref_num .= $characters[rand(0, strlen($characters) - 1)];
|
565 |
+
|
566 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
567 |
+
if ($locale == 'fr_FR')
|
568 |
+
$ord_date = date('d/m/Y');
|
569 |
+
else
|
570 |
+
$ord_date = date('m/d/Y');
|
571 |
+
$orderprice = rand(10, 1000);
|
572 |
+
$total_pay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
573 |
+
$msgbody = $post['message'];
|
574 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
575 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
576 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
577 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
578 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
579 |
+
$arr = array();
|
580 |
+
$arr['to'] = $number;
|
581 |
+
$arr['from'] = $post['sender'];
|
582 |
+
$arr['text'] = $msgbody;
|
583 |
|
584 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
585 |
+
if (isset($result->status) && $result->status == 'OK')
|
586 |
+
echo 'OK';
|
587 |
+
else
|
588 |
+
echo 'KO';
|
589 |
}
|
590 |
|
591 |
}
|
611 |
|
612 |
if (isset($number))
|
613 |
{
|
614 |
+
$adminUserModel = Mage::getModel('admin/user');
|
615 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
616 |
+
$admin_data = $userCollection->getData();
|
617 |
+
$firstname = $admin_data[0]['firstname'];
|
618 |
+
$lastname = $admin_data[0]['lastname'];
|
619 |
+
$characters = '1234567890';
|
620 |
+
$ref_num = '';
|
621 |
+
for ($i = 0; $i < 9; $i++)
|
622 |
+
$ref_num .= $characters[rand(0, strlen($characters) - 1)];
|
623 |
+
|
624 |
+
$locale = Mage::app()->getLocale()->getLocaleCode();
|
625 |
+
if ($locale == 'fr_FR')
|
626 |
+
$ord_date = date('d/m/Y');
|
627 |
+
else
|
628 |
+
$ord_date = date('m/d/Y');
|
629 |
+
$orderprice = rand(10, 1000);
|
630 |
+
$total_pay = $orderprice.'.00'.' '.Mage::app()->getStore()-> getCurrentCurrencyCode();
|
631 |
+
$msgbody = $post['message'];
|
632 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
633 |
+
$lname = str_replace('{last_name}', $lastname."\r\n", $fname);
|
634 |
+
$procuct_price = str_replace('{order_price}', $total_pay, $lname);
|
635 |
+
$order_date = str_replace('{order_date}', $ord_date."\r\n", $procuct_price);
|
636 |
+
$msgbody = str_replace('{order_reference}', $ref_num, $order_date);
|
637 |
+
$arr = array();
|
638 |
+
$arr['to'] = $number;
|
639 |
+
$arr['from'] = $post['sender'];
|
640 |
+
$arr['text'] = $msgbody;
|
641 |
+
|
642 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
643 |
if (isset($result->status) && $result->status == 'OK')
|
644 |
echo 'OK';
|
645 |
else
|
667 |
|
668 |
if (isset($number))
|
669 |
{
|
670 |
+
$adminUserModel = Mage::getModel('admin/user');
|
671 |
+
$userCollection = $adminUserModel->getCollection()->load();
|
672 |
+
$admin_data = $userCollection->getData();
|
673 |
+
$firstname = $admin_data[0]['firstname'];
|
674 |
+
$lastname = $admin_data[0]['lastname'];
|
675 |
+
$msgbody = $post['message'];
|
676 |
+
$fname = str_replace('{first_name}', $firstname, $msgbody);
|
677 |
+
$msgbody = str_replace('{last_name}', $lastname."\r\n", $fname);
|
678 |
+
$arr = array();
|
679 |
+
$arr['to'] = $number;
|
680 |
+
$arr['from'] = $post['sender'];
|
681 |
+
$arr['text'] = $msgbody;
|
682 |
+
$result = Mage::getModel('sendinblue/sendinblue')->sendSmsApi($arr);
|
683 |
if (isset($result->status) && $result->status == 'OK')
|
684 |
echo 'OK';
|
685 |
else
|
app/code/local/Sendinblue/Sendinblue/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
-
<version>1.1.
|
6 |
<platform>ce</platform>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sendinblue_Sendinblue>
|
5 |
+
<version>1.1.4</version>
|
6 |
<platform>ce</platform>
|
7 |
</Sendinblue_Sendinblue>
|
8 |
</modules>
|
app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/{install-0.1.0.php → mysql4-install-0.1.0.php}
RENAMED
File without changes
|
app/code/local/Sendinblue/Sendinblue/sql/sendinblue_setup/mysql4-upgrade-0.1.0-0.2.0.php
CHANGED
@@ -11,12 +11,13 @@
|
|
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
|
16 |
echo $datanum = count($writeConnection->fetchAll($sql));
|
17 |
if ($datanum > 0 )
|
18 |
{
|
19 |
-
$query = "DELETE FROM
|
20 |
$writeConnection->query($query);
|
21 |
}
|
22 |
?>
|
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 |
+
$tableName = $resource->getTableName('core/config_data');
|
15 |
$writeConnection = $resource->getConnection('core_write');
|
16 |
+
$sql = "SELECT * FROM ".$tableName." WHERE `path` LIKE 'sendinblue/%'";
|
17 |
echo $datanum = count($writeConnection->fetchAll($sql));
|
18 |
if ($datanum > 0 )
|
19 |
{
|
20 |
+
$query = "DELETE FROM ".$tableName." WHERE `path` LIKE 'sendinblue/%'";
|
21 |
$writeConnection->query($query);
|
22 |
}
|
23 |
?>
|
app/design/adminhtml/default/default/template/sendinblue/myform.phtml
CHANGED
@@ -154,7 +154,21 @@ $get_syncronize = Mage::getModel('sendinblue/sendinblue')->getSyncronizeStatus()
|
|
154 |
<span title="<?php echo $this->__('Select the contact list where you want to save the contacts of your site Magento. By default, we have created a list Magento in your SendinBlue account and we have selected it'); ?>" class="toolTip"> </span>
|
155 |
</td>
|
156 |
</tr>
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
<tr>
|
159 |
<td> </td>
|
160 |
<td class="a-left">
|
@@ -232,6 +246,19 @@ $style_smtp = '';
|
|
232 |
<span title="<?php echo $this->__('This feature will allow you to transfer all your customers orders from Magento into SendinBlue to implement your email marketing strategy.'); ?>" class="toolTip"> </span>
|
233 |
</td>
|
234 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
</table>
|
236 |
</fieldset>
|
237 |
</div>
|
@@ -248,8 +275,10 @@ $style_smtp = '';
|
|
248 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
249 |
<span style="margin-bottom:10px; color:#333333;">
|
250 |
<?php echo $this->__('Currently you have '); ?>
|
251 |
-
<?php $credit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
252 |
-
|
|
|
|
|
253 |
|
254 |
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
255 |
<a target="_blank" href ="<?php echo $this->__('https://www.sendinblue.com/pricing'); ?>" style="color: #000000; outline: 0 none; text-decoration: none;">
|
@@ -335,7 +364,7 @@ $style_smtp = '';
|
|
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 Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage(); ?></textarea>
|
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>
|
@@ -418,7 +447,7 @@ $style_smtp = '';
|
|
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 Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage(); ?></textarea>
|
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>
|
@@ -529,7 +558,7 @@ $style_smtp = '';
|
|
529 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
530 |
<td>
|
531 |
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
532 |
-
<span class="toolTip" style="float:left; margin-top: 85px;" title="<?php echo $this->__(' Create the content of your SMS with the limit of 160-character.Beyond 160 characters, it will be counted as a second SMS. Thus, if you write
|
533 |
<span style="float:left; line-height:16px; margin-bottom:15px; width:470px; clear:both;"><?php echo $this->__('Number of SMS used: '); ?><span id="sender_campaign_message_text_count">0</span>
|
534 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
535 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
@@ -583,6 +612,7 @@ $style_smtp = '';
|
|
583 |
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
584 |
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
585 |
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
|
|
586 |
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
587 |
<div id="userGrid">
|
588 |
<div class="grid">
|
@@ -603,7 +633,8 @@ $style_smtp = '';
|
|
603 |
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
604 |
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
605 |
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
606 |
-
<th class="no-link
|
|
|
607 |
</tr>
|
608 |
</thead>
|
609 |
<tbody class='midleft'>
|
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 |
+
<tr>
|
158 |
+
<td><label><?php echo $this->__('Manage email template'); ?></label></td>
|
159 |
+
<td> <select name="template" id="template" style="width: 230.833px;" class ="ui-widget ui-state-default ui-corner-all">
|
160 |
+
<option value=""><?php echo $this->__('Select template'); ?></option>
|
161 |
+
<?php $templatelist = Mage::getModel('sendinblue/sendinblue')->templateDisplay();
|
162 |
+
if (!empty($templatelist->result->campaign_records))
|
163 |
+
{
|
164 |
+
foreach ($templatelist->result->campaign_records as $template_data)
|
165 |
+
{ ?>
|
166 |
+
<option value="<?php echo $template_data->id; ?>" <?php if($template_data->id == Mage::getModel('sendinblue/sendinblue')->getTemplateId()) echo 'selected = "selected"' ?> ><?php echo $template_data->campaign_name; ?></option>
|
167 |
+
<?php }} ?>
|
168 |
+
</select>
|
169 |
+
|
170 |
+
<span title="<?php echo $this->__('Select a SendinBlue template that will be sent personalized for each contact that subscribes to your newsletter'); ?>" class="toolTip"> </span></td>
|
171 |
+
</tr>
|
172 |
<tr>
|
173 |
<td> </td>
|
174 |
<td class="a-left">
|
246 |
<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>
|
247 |
</td>
|
248 |
</tr>
|
249 |
+
<?php //echo Mage::getModel('sendinblue/sendinblue')->getTrackingStatus();die;
|
250 |
+
if (Mage::getModel('sendinblue/sendinblue')->getTrackingStatus()==1 && Mage::getModel('sendinblue/sendinblue')->getTrackingHistoryStatus()==1)
|
251 |
+
$style_track = '';
|
252 |
+
else
|
253 |
+
$style_track = 'style="display:none;"';
|
254 |
+
if(Mage::getModel('sendinblue/sendinblue')->getTrackingStatus()==1 && Mage::getModel('sendinblue/sendinblue')->getTrackingHistoryStatus()==1) { ?>
|
255 |
+
<tr <?php echo $style_track; ?> class='ordertracking'>
|
256 |
+
<td> </td>
|
257 |
+
<input type="hidden" name="history_status" value="<?php echo Mage::getModel('sendinblue/sendinblue')->getTrackingHistoryStatus(); ?>" id="history_status">
|
258 |
+
<input name="importordertrackingUrl" type="hidden" id="importordertrackingUrl" value="<?php echo $this->getUrl('sendinblue/ajax/orderhistory'); ?>" />
|
259 |
+
<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>
|
260 |
+
</tr>
|
261 |
+
<?php } ?>
|
262 |
</table>
|
263 |
</fieldset>
|
264 |
</div>
|
275 |
<td class="row1" colspan="2" style="border:none; padding-top:10px;">
|
276 |
<span style="margin-bottom:10px; color:#333333;">
|
277 |
<?php echo $this->__('Currently you have '); ?>
|
278 |
+
<?php $credit = Mage::getModel('sendinblue/sendinblue')->getSmsCredit();
|
279 |
+
$notify_value = Mage::getModel('sendinblue/sendinblue')->getNotifyValueStatus();
|
280 |
+
?>
|
281 |
+
<?php if ($credit >= $notify_value){ ?> <strong style="color:#000000;"><?php echo $credit; ?></strong><?php } else {?><strong style="color:#F03D25;"><?php echo $credit; ?></strong><?php } ?>
|
282 |
|
283 |
<?php echo $this->__(' credits sms. To buy more credits, please click'); ?>
|
284 |
<a target="_blank" href ="<?php echo $this->__('https://www.sendinblue.com/pricing'); ?>" style="color: #000000; outline: 0 none; text-decoration: none;">
|
364 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
365 |
<td>
|
366 |
<textarea name="sender_order_message" id="sender_order_message" cols="45" rows="5" class="textarea_bx"><?php echo Mage::getModel('sendinblue/sendinblue')->getSendSmsmOrderMessage(); ?></textarea>
|
367 |
+
<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>
|
368 |
<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>
|
369 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_order_message_text">160</span></div>
|
370 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
447 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
448 |
<td>
|
449 |
<textarea name="sender_shipment_message" id="sender_shipment_message" cols="45" rows="5" class="textarea_bx"><?php echo Mage::getModel('sendinblue/sendinblue')->getSendSmsShipingMessage(); ?></textarea>
|
450 |
+
<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>
|
451 |
<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>
|
452 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_shipment_message_text">160</span></div>
|
453 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
558 |
<td valign="top"><label><?php echo $this->__('Message'); ?></label></td>
|
559 |
<td>
|
560 |
<textarea name="sender_campaign_message" id="sender_campaign_message" cols="45" rows="5" class="textarea_bx"></textarea>
|
561 |
+
<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>
|
562 |
<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>
|
563 |
<div class="hintmsg"><em><?php echo $this->__('Number of characters left: '); ?></em><span id="sender_campaign_message_text">160</span></div>
|
564 |
<div class="hintmsg"><em><?php echo $this->__('Attention line break is counted as a single character.'); ?></em>
|
612 |
<input name="ajaxOrderSmsUrl" type="hidden" id="ajaxOrderSmsUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordersms'); ?>" />
|
613 |
<input name="ajaxOrderShippedUrl" type="hidden" id="ajaxOrderShippedUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxordershipped'); ?>" />
|
614 |
<input name="ajaxSmsCampaignUrl" type="hidden" id="ajaxSmsCampaignUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmscampaign'); ?>" />
|
615 |
+
<input name="ajaxSmsSubscribeUrl" type="hidden" id="ajaxSmsSubscribeUrl" value="<?php echo $this->getUrl('sendinblue/ajax/ajaxsmssubscribe'); ?>" />
|
616 |
<input type="hidden" name="pagenumber" id="pagenumber" value="1" />
|
617 |
<div id="userGrid">
|
618 |
<div class="grid">
|
633 |
<th class="no-link"><span class="nobr"><?php echo $this->__('clients'); ?></span></th>
|
634 |
<th class="no-link"><span class="nobr"><?php echo $this->__('SMS'); ?></span></th>
|
635 |
<th class="no-link"><span class="nobr"><?php echo $this->__('Newsletter Magento Status'); ?></span></th>
|
636 |
+
<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>
|
637 |
+
<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>
|
638 |
</tr>
|
639 |
</thead>
|
640 |
<tbody class='midleft'>
|
app/locale/fr_FR/Sendinblue.csv
CHANGED
@@ -127,4 +127,12 @@
|
|
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 :"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"
|
package.xml
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
-
<version>1.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="magelocal"><dir name="Sendinblue"><dir name="Sendinblue"><dir name="Block"><file name="Sendinblue.php" hash="4b5adae031b714e188d576e306bfd5a1"/></dir><dir name="Helper"><file name="Data.php" hash="0532b48f611c1cc623589d5792e0dbf2"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="6d2d6eac00b7bd6da3ff53d2abe40dd4"/></dir><file name="Email.php" hash="fe07aa2dba951ee117bda2cefebfb875"/><dir name="Mysql4"><dir name="Sendinblue"><file name="Collection.php" hash="d6aff03eda9a6b2ee1c42b8dd50df402"/></dir><file name="Sendinblue.php" hash="c000c1f6a277f7c9a91ad628b02eb001"/></dir><file name="Observer.php" hash="250cc069aa5194652f6503e2cc0f8194"/><file name="Sendinblue.php" hash="963c473c2f3ca66f23d00de0c4c9292f"/><file name="Status.php" hash="444fe4d099bd23a9d87cdf7e2b2e6cbb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MyformController.php" hash="67dd963b1f003d2b2f25c8b4643d4715"/><file name="NotifyController.php" hash="e3b43db59f8c5b7c8cd54a58a7bc2d1b"/><file name="SyncController.php" hash="352fd0d804701d0228bad7e7b92afb58"/></dir><file name="AjaxController.php" hash="b4914ddac9d4e836ecf53869055a6a82"/><file name="IndexController.php" hash="2cf5287ba31d6960eb28c2cbc03a60ed"/></dir><dir name="etc"><file name="adminhtml.xml" hash="640ba5382a16c749fc56a2a8283682ee"/><file name="config.xml" hash="ba48680b7267a4b2d27f4645792b2393"/></dir><dir name="sql"><dir name="sendinblue_setup"><file name="install-0.1.0.php" hash="58bb365dcb29115c66f2fa3f17dcb697"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="b50e876441a247cd5feb2614ff649fd3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="e23253764fbbf0e3a2f1cb5ff65eb318"/></dir><dir name="template"><dir name="sendinblue"><file name="myform.phtml" hash="2a4748e2e456d2b95d9828bf2da90bd8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="61346d8b2b321b10c09a77fef39ec112"/></dir><dir name="template"><dir name="sendinblue"><dir name="account"><file name="edit.phtml" hash="c2b17e90e59e1d13791feded28982330"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendinblue_Sendinblue.xml" hash="1a245999d412c36ea9666b56bfc63e2d"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sendinblue.csv" hash="72507895f18a8c4a80611065790aba56"/></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="fr_FR"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="557ddb7212800b4a99937b2d8956270c"/><file name="sendinsmtp_conf.html" hash="b1c790c78605b2beb4cd38152cd8f0ca"/>
|
25 |
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sendinblue</name>
|
4 |
+
<version>1.1.4</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="magelocal"><dir name="Sendinblue"><dir name="Sendinblue"><dir name="Block"><file name="Sendinblue.php" hash="4b5adae031b714e188d576e306bfd5a1"/></dir><dir name="Helper"><file name="Data.php" hash="0532b48f611c1cc623589d5792e0dbf2"/></dir><dir name="Model"><dir name="Email"><file name="Template.php" hash="6d2d6eac00b7bd6da3ff53d2abe40dd4"/></dir><file name="Email.php" hash="fe07aa2dba951ee117bda2cefebfb875"/><dir name="Mysql4"><dir name="Sendinblue"><file name="Collection.php" hash="d6aff03eda9a6b2ee1c42b8dd50df402"/></dir><file name="Sendinblue.php" hash="c000c1f6a277f7c9a91ad628b02eb001"/></dir><file name="Observer.php" hash="250cc069aa5194652f6503e2cc0f8194"/><file name="Sendinblue.php" hash="963c473c2f3ca66f23d00de0c4c9292f"/><file name="Status.php" hash="444fe4d099bd23a9d87cdf7e2b2e6cbb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MyformController.php" hash="67dd963b1f003d2b2f25c8b4643d4715"/><file name="NotifyController.php" hash="e3b43db59f8c5b7c8cd54a58a7bc2d1b"/><file name="SyncController.php" hash="352fd0d804701d0228bad7e7b92afb58"/></dir><file name="AjaxController.php" hash="b4914ddac9d4e836ecf53869055a6a82"/><file name="IndexController.php" hash="2cf5287ba31d6960eb28c2cbc03a60ed"/></dir><dir name="etc"><file name="adminhtml.xml" hash="640ba5382a16c749fc56a2a8283682ee"/><file name="config.xml" hash="ba48680b7267a4b2d27f4645792b2393"/></dir><dir name="sql"><dir name="sendinblue_setup"><file name="mysql4-install-0.1.0.php" hash="58bb365dcb29115c66f2fa3f17dcb697"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="b50e876441a247cd5feb2614ff649fd3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="e23253764fbbf0e3a2f1cb5ff65eb318"/></dir><dir name="template"><dir name="sendinblue"><file name="myform.phtml" hash="2a4748e2e456d2b95d9828bf2da90bd8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sendinblue.xml" hash="61346d8b2b321b10c09a77fef39ec112"/></dir><dir name="template"><dir name="sendinblue"><dir name="account"><file name="edit.phtml" hash="c2b17e90e59e1d13791feded28982330"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sendinblue_Sendinblue.xml" hash="1a245999d412c36ea9666b56bfc63e2d"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sendinblue.csv" hash="72507895f18a8c4a80611065790aba56"/></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="fr_FR"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="557ddb7212800b4a99937b2d8956270c"/><file name="sendinsmtp_conf.html" hash="b1c790c78605b2beb4cd38152cd8f0ca"/>
|
25 |
</dir></dir></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="sendin_notification.html" hash="de646d23657f68387d32683d14ea215a"/><file name="sendinsmtp_conf.html" hash="a35979191ec11cd5cbebc0efece1c472"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sendinblue"><dir name="css"><file name="jquery-ui.css" hash="3f3d39116de928eb9c3cc33004efae77"/><file name="jquery.multiselect.css" hash="b2ecda55b895b485e49baa5759cc61fe"/><file name="styles.css" hash="61f4da300d2b59cc4d22af19d6abc742"/></dir><dir name="images"><file name="close.png" hash="223ea7c82841be9da96aec80bd68b7f5"/><file name="disabled.gif" hash="21ff0e6ba24381e63789116139180cf0"/><file name="enabled.gif" hash="0db2c4f24c0f0c3f7958a05181af897a"/><file name="help.gif" hash="19002f53dd724465717c27f0399c0a90"/><file name="index.php" hash="507d846db3efc2563672c8f60ac080f4"/><file name="loader.gif" hash="394bafc3cc4dfb3a0ee48c1f54669539"/><file name="loading_anim.gif" hash="b494fceca79586281a29c9462b09c85a"/><file name="logo.gif" hash="b13ce89934c4aa2aeb76d75896efe40f"/><file name="logo.png" hash="76ecf5757c096639a3b27ed5fc470d48"/><file name="sendinblue.png" hash="4bb823a9290b79546cc99d57de304db9"/><file name="ui-icons_ef8c08_256x240.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/><file name="ui-icons_ef8c08_256x240.png.png" hash="47fc08e06aba0b7ac0a6d3b9f92894cb"/></dir><dir name="js"><file name="index.php" hash="36aa6e5d248b48fd910a4dfa1987ca56"/><file name="jquery-1.9.1.min.js" hash="397754ba49e9e0cf4e7c190da78dda05"/><file name="jquery-ui.min.js" hash="3e6acb1e6426ef90d2e786a006a4ea28"/><file name="jquery.multiselect.js" hash="9851bb7a2509099e28ee789fc864570e"/><file name="jquery.multiselect.min.js" hash="efb34f759712b9da1172c3a2efe8ef6b"/><file name="sendinblue.js" hash="e5d8ac61766af444255eb9226a0cb344"/><file name="sendinblue.min.js" hash="60a1241bec9edc538c360ac459890927"/></dir></dir></dir></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
skin/adminhtml/default/default/sendinblue/js/sendinblue.js
CHANGED
@@ -124,6 +124,11 @@ jQuery(document)
|
|
124 |
}
|
125 |
});
|
126 |
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
|
129 |
if(jQuery('#sender_order').val() != '')
|
@@ -200,6 +205,11 @@ jQuery(document)
|
|
200 |
|
201 |
}
|
202 |
});
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
if(jQuery('#sender_shipment').val() != '')
|
205 |
{
|
@@ -273,6 +283,11 @@ jQuery(document)
|
|
273 |
|
274 |
}
|
275 |
});
|
|
|
|
|
|
|
|
|
|
|
276 |
|
277 |
if(jQuery('#sender_campaign').val() != '')
|
278 |
{
|
@@ -527,6 +542,12 @@ jQuery(document)
|
|
527 |
{
|
528 |
var Tracking = jQuery(this).val();
|
529 |
var trackingUrl = jQuery("#trackingUrl").val();
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
jQuery.ajax({
|
531 |
type : "POST",
|
532 |
async : false,
|
@@ -540,6 +561,27 @@ jQuery(document)
|
|
540 |
}
|
541 |
});
|
542 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
|
544 |
|
545 |
|
@@ -616,6 +658,32 @@ jQuery(document)
|
|
616 |
|
617 |
});
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
});
|
620 |
|
621 |
function testsmssend(sendererr,messageerr,mobileerr) {
|
@@ -859,8 +927,10 @@ function smtpvalidate(emailerr)
|
|
859 |
function apikvalidate(apierr)
|
860 |
{
|
861 |
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
|
|
|
|
862 |
|
863 |
-
if(sendin_apikey_val.trim() == "")
|
864 |
{
|
865 |
alert(apierr);
|
866 |
jQuery('#sendin_apikey_val').focus();
|
124 |
}
|
125 |
});
|
126 |
|
127 |
+
jQuery("#sender_order").keydown(function (event) {
|
128 |
+
if (event.keyCode == 32) {
|
129 |
+
event.preventDefault();
|
130 |
+
}
|
131 |
+
});
|
132 |
|
133 |
|
134 |
if(jQuery('#sender_order').val() != '')
|
205 |
|
206 |
}
|
207 |
});
|
208 |
+
jQuery("#sender_shipment").keydown(function (event) {
|
209 |
+
if (event.keyCode == 32) {
|
210 |
+
event.preventDefault();
|
211 |
+
}
|
212 |
+
});
|
213 |
|
214 |
if(jQuery('#sender_shipment').val() != '')
|
215 |
{
|
283 |
|
284 |
}
|
285 |
});
|
286 |
+
jQuery("#sender_campaign").keydown(function (event) {
|
287 |
+
if (event.keyCode == 32) {
|
288 |
+
event.preventDefault();
|
289 |
+
}
|
290 |
+
});
|
291 |
|
292 |
if(jQuery('#sender_campaign').val() != '')
|
293 |
{
|
542 |
{
|
543 |
var Tracking = jQuery(this).val();
|
544 |
var trackingUrl = jQuery("#trackingUrl").val();
|
545 |
+
if (Tracking == 0) {
|
546 |
+
jQuery('.ordertracking').hide();
|
547 |
+
}
|
548 |
+
if (Tracking == 1) {
|
549 |
+
jQuery('.ordertracking').show();
|
550 |
+
}
|
551 |
jQuery.ajax({
|
552 |
type : "POST",
|
553 |
async : false,
|
561 |
}
|
562 |
});
|
563 |
});
|
564 |
+
//for import old order history
|
565 |
+
jQuery(".Trackhistory").click(function()
|
566 |
+
{
|
567 |
+
var history_status = jQuery("#history_status").val();
|
568 |
+
var ordertrackingUrl = jQuery("#importordertrackingUrl").val();
|
569 |
+
|
570 |
+
jQuery.ajax({
|
571 |
+
type : "POST",
|
572 |
+
async : false,
|
573 |
+
url : ordertrackingUrl,
|
574 |
+
data : "history_status=" + history_status,
|
575 |
+
beforeSend : function(){
|
576 |
+
jQuery('#ajax-busy').show();
|
577 |
+
},
|
578 |
+
success : function(msg){
|
579 |
+
jQuery('#ajax-busy').hide();
|
580 |
+
jQuery('.ordertracking').hide();
|
581 |
+
alert(msg);
|
582 |
+
}
|
583 |
+
});
|
584 |
+
});
|
585 |
|
586 |
|
587 |
|
658 |
|
659 |
});
|
660 |
|
661 |
+
|
662 |
+
|
663 |
+
jQuery('body').on('click', '.ajax_sms_subs_href', function (e) {
|
664 |
+
|
665 |
+
var email = jQuery(this).attr('email');
|
666 |
+
var status = jQuery(this).attr('status');
|
667 |
+
var ajaxSmsUrl = jQuery("#ajaxSmsSubscribeUrl").val();
|
668 |
+
|
669 |
+
jQuery.ajax({
|
670 |
+
type : "POST",
|
671 |
+
async : false,
|
672 |
+
url : ajaxSmsUrl,
|
673 |
+
data : {"email":email,"sms":status},
|
674 |
+
beforeSend : function() {
|
675 |
+
jQuery('#ajax-busy').show();
|
676 |
+
},
|
677 |
+
success : function(msg) {
|
678 |
+
jQuery('#ajax-busy').hide();
|
679 |
+
}
|
680 |
+
});
|
681 |
+
|
682 |
+
var page_no = jQuery('#pagenumber').val();
|
683 |
+
loadData(page_no); // For first time page load
|
684 |
+
|
685 |
+
});
|
686 |
+
|
687 |
});
|
688 |
|
689 |
function testsmssend(sendererr,messageerr,mobileerr) {
|
927 |
function apikvalidate(apierr)
|
928 |
{
|
929 |
var sendin_apikey_val = jQuery('#sendin_apikey_val').val();
|
930 |
+
var sendin_api_check = jQuery("input[name=sendin_api_status]:checked").val();
|
931 |
+
|
932 |
|
933 |
+
if(sendin_apikey_val.trim() == "" && sendin_api_check !=0)
|
934 |
{
|
935 |
alert(apierr);
|
936 |
jQuery('#sendin_apikey_val').focus();
|
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 |
+
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;}}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));}});jQuery("#sender_order").keydown(function(event){if(event.keyCode==32){event.preventDefault();}});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));}});jQuery("#sender_shipment").keydown(function(event){if(event.keyCode==32){event.preventDefault();}});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));}});jQuery("#sender_campaign").keydown(function(event){if(event.keyCode==32){event.preventDefault();}});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();if(Tracking==0){jQuery(".ordertracking").hide();}if(Tracking==1){jQuery(".ordertracking").show();}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(".Trackhistory").click(function(){var history_status=jQuery("#history_status").val();var ordertrackingUrl=jQuery("#importordertrackingUrl").val();jQuery.ajax({type:"POST",async:false,url:ordertrackingUrl,data:"history_status="+history_status,beforeSend:function(){jQuery("#ajax-busy").show();},success:function(msg){jQuery("#ajax-busy").hide();jQuery(".ordertracking").hide();alert(msg);}});});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);});jQuery("body").on("click",".ajax_sms_subs_href",function(e){var email=jQuery(this).attr("email");var status=jQuery(this).attr("status");var ajaxSmsUrl=jQuery("#ajaxSmsSubscribeUrl").val();jQuery.ajax({type:"POST",async:false,url:ajaxSmsUrl,data:{email:email,sms: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();var sendin_api_check=jQuery("input[name=sendin_api_status]:checked").val();if(sendin_apikey_val.trim()==""&&sendin_api_check!=0){alert(apierr);jQuery("#sendin_apikey_val").focus();return false;}}
|