Version Notes
Product recommendation and dynamic content for connector.
Download this release
Release Info
Developer | Calin Diacon |
Extension | dotmailermagento |
Version | 1.5.1 |
Comparing to | |
See all releases |
Version 1.5.1
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php +18 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php +104 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php +13 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php +46 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php +12 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php +23 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessageone.php +41 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php +23 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php +23 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php +73 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php +43 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php +53 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Couponinfo.php +18 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Crosssell.php +20 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Lostbasket.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Mostviewed.php +18 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Productpush.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php +20 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Related.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Upsell.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Block/Basket.php +43 -0
- app/code/local/Dotdigitalgroup/Email/Block/Coupon.php +48 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php +20 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php +20 -0
- app/code/local/Dotdigitalgroup/Email/Block/Products.php +53 -0
- app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php +182 -0
- app/code/local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php +298 -0
- app/code/local/Dotdigitalgroup/Email/Helper/Data.php +96 -0
- app/code/local/Dotdigitalgroup/Email/Helper/File.php +159 -0
- app/code/local/Dotdigitalgroup/Email/Helper/Recommended.php +191 -0
- app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php +40 -0
- app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php +729 -0
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Account.php +218 -0
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Customer.php +286 -0
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Order.php +118 -0
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php +75 -0
- app/code/local/Dotdigitalgroup/Email/Model/Connector/Wishlist.php +86 -0
- app/code/local/Dotdigitalgroup/Email/Model/Cron.php +58 -0
- app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php +480 -0
- app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php +85 -0
- app/code/local/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php +100 -0
- app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php +90 -0
- app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php +228 -0
- app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Model/Observer.php +189 -0
- app/code/local/Dotdigitalgroup/Email/Model/Order.php +33 -0
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php +96 -0
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Quote.php +289 -0
- app/code/local/Dotdigitalgroup/Email/Model/Sales/Sms.php +70 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php +50 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php +54 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php +12 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php +30 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php +30 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php +35 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php +12 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displaytype.php +13 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Gridview.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php +21 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php +19 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php +16 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php +30 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php +40 -0
- app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php +13 -0
- app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php +18 -0
- app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php +125 -0
- app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php +133 -0
- app/code/local/Dotdigitalgroup/Email/etc/adminhtml.xml +43 -0
- app/code/local/Dotdigitalgroup/Email/etc/config.xml +289 -0
- app/code/local/Dotdigitalgroup/Email/etc/system.xml +1610 -0
- app/code/local/Dotdigitalgroup/Email/sql/connector_setup/mysql4-install-0.1.0.php +53 -0
- app/code/local/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.1.1-1.1.2.php +9 -0
- app/code/local/Varien/Data/Collection.php +818 -0
- app/design/frontend/base/default/layout/connector.xml +37 -0
- app/design/frontend/base/default/template/connector/basket.phtml +63 -0
- app/design/frontend/base/default/template/connector/coupon.phtml +6 -0
- app/design/frontend/base/default/template/connector/price.phtml +428 -0
- app/design/frontend/base/default/template/connector/roi_code.phtml +23 -0
- app/design/frontend/base/default/template/connector/tracking_code.phtml +4 -0
- app/design/frontend/base/default/template/page/blank.phtml +1 -0
- app/design/frontend/base/default/template/page/connector/products.phtml +37 -0
- app/etc/modules/Dotdigitalgroup_Email.xml +9 -0
- package.xml +18 -0
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Bestsellers.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Bestsellers extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$code = Mage::helper('connector')->getPasscode();
|
9 |
+
$order = Mage::helper('connector')->getLastOrderNo();
|
10 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
11 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
12 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/bestsellers';
|
13 |
+
$element->setData('value', $text);
|
14 |
+
$element->setData('disabled', 'disabled');
|
15 |
+
return parent::_getElementHtml($element);
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Gridlist.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Gridlist extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
// Get the default HTML for this option
|
8 |
+
$html = parent::_getElementHtml($element);
|
9 |
+
|
10 |
+
|
11 |
+
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
12 |
+
|
13 |
+
$jQuery .='
|
14 |
+
<script type="text/javascript">
|
15 |
+
jQuery.noConflict();
|
16 |
+
jQuery(document).ready(function() {
|
17 |
+
var gridOptions = {
|
18 |
+
"4" : "4",
|
19 |
+
"8" : "8",
|
20 |
+
"12" : "12",
|
21 |
+
"16" : "16",
|
22 |
+
"20" : "20",
|
23 |
+
"24" : "24",
|
24 |
+
"28" : "28",
|
25 |
+
"32" : "32"
|
26 |
+
|
27 |
+
};
|
28 |
+
var listOptions = {
|
29 |
+
"2" : "2",
|
30 |
+
"4" : "4",
|
31 |
+
"6" : "6",
|
32 |
+
"8" : "8"
|
33 |
+
}
|
34 |
+
|
35 |
+
jQuery("#dynamic_content_products_related_display_type").change(function(){
|
36 |
+
|
37 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
38 |
+
var display_mode = jQuery(this).val();
|
39 |
+
changeOptions(display_type, display_mode);
|
40 |
+
|
41 |
+
|
42 |
+
});
|
43 |
+
|
44 |
+
jQuery("#dynamic_content_products_upsell_display_type").change(function(){
|
45 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
46 |
+
var display_mode = jQuery(this).val();
|
47 |
+
changeOptions(display_type, display_mode);
|
48 |
+
|
49 |
+
});
|
50 |
+
jQuery("#dynamic_content_products_crosssell_display_type").change(function(){
|
51 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
52 |
+
var display_mode = jQuery(this).val();
|
53 |
+
changeOptions(display_type, display_mode);
|
54 |
+
});
|
55 |
+
jQuery("#dynamic_content_products_best_display_type").change(function(){
|
56 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
57 |
+
var display_mode = jQuery(this).val();
|
58 |
+
changeOptions(display_type, display_mode);
|
59 |
+
});
|
60 |
+
jQuery("#dynamic_content_products_most_viewed_display_type").change(function(){
|
61 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
62 |
+
var display_mode = jQuery(this).val();
|
63 |
+
changeOptions(display_type, display_mode);
|
64 |
+
});
|
65 |
+
jQuery("#dynamic_content_manual_product_search_display_type").change(function(){
|
66 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
67 |
+
var display_mode = jQuery(this).val();
|
68 |
+
changeOptions(display_type, display_mode);
|
69 |
+
});
|
70 |
+
jQuery("#dynamic_content_products_recently_viewed_display_type").change(function(){
|
71 |
+
var display_type = jQuery(this).closest("tr").next().find("select");
|
72 |
+
var display_mode = jQuery(this).val();
|
73 |
+
changeOptions(display_type, display_mode);
|
74 |
+
});
|
75 |
+
|
76 |
+
function changeOptions(display_type, display_mode){
|
77 |
+
if(display_mode == "list"){
|
78 |
+
display_type.empty();
|
79 |
+
|
80 |
+
jQuery.each(listOptions, function(key, value) {
|
81 |
+
display_type.append(jQuery("<option></option>")
|
82 |
+
.attr("value", value).text(key));
|
83 |
+
});
|
84 |
+
|
85 |
+
}
|
86 |
+
if(display_mode == "grid"){
|
87 |
+
display_type.empty();
|
88 |
+
jQuery.each(gridOptions, function(key, value) {
|
89 |
+
display_type.append(jQuery("<option></option>")
|
90 |
+
.attr("value", value).text(key));
|
91 |
+
});
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
});
|
96 |
+
</script>';
|
97 |
+
|
98 |
+
$html .= $jQuery;
|
99 |
+
|
100 |
+
return $html;
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Insertvariable.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Insertvariable extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function _getElementHtml($element){
|
6 |
+
|
7 |
+
$element->setData('onclick', 'templateControl.openVariableChooser();return false;');
|
8 |
+
|
9 |
+
|
10 |
+
return parent::_getElementHtml($element);
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Messagedefault.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Messagedefault extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
+
|
9 |
+
|
10 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
+
|
12 |
+
$element->setData('after_element_html', "
|
13 |
+
|
14 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
+
|
17 |
+
<script type='text/javascript'>
|
18 |
+
|
19 |
+
function addText(text){
|
20 |
+
$('sms_section_sms_message_one_message').value += text;
|
21 |
+
}
|
22 |
+
|
23 |
+
function injectText(element,value){
|
24 |
+
var element_dom=document.getElementById(element);
|
25 |
+
if(document.selection){
|
26 |
+
element_dom.focus();
|
27 |
+
sel=document.selection.createRange();
|
28 |
+
sel.text=value;
|
29 |
+
return;
|
30 |
+
}if(element_dom.selectionStart||element_dom.selectionStart=='0'){
|
31 |
+
var t_start=element_dom.selectionStart;
|
32 |
+
var t_end=element_dom.selectionEnd;
|
33 |
+
var val_start=element_dom.value.substring(0,t_start);
|
34 |
+
var val_end=element_dom.value.substring(t_end,element_dom.value.length);
|
35 |
+
element_dom.value=val_start+value+val_end;
|
36 |
+
}else{
|
37 |
+
element_dom.value+=value;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
</script>
|
41 |
+
");
|
42 |
+
return parent::_getElementHtml($element);
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Password.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Password extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
6 |
+
|
7 |
+
$element->setData('onchange', "apiValidation(this.form, this)");
|
8 |
+
|
9 |
+
return parent::_getElementHtml($element);
|
10 |
+
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagefour.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagefour extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
+
|
9 |
+
|
10 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
+
|
12 |
+
$element->setData('after_element_html', "
|
13 |
+
|
14 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_four_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
+
|
17 |
+
|
18 |
+
");
|
19 |
+
return parent::_getElementHtml($element);
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessageone.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessageone extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
+
|
9 |
+
|
10 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
+
|
12 |
+
$element->setData('after_element_html', "
|
13 |
+
|
14 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_one_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
+
|
17 |
+
<script type='text/javascript'>
|
18 |
+
function injectText(element,value){
|
19 |
+
var element_dom=document.getElementById(element);
|
20 |
+
if(document.selection){
|
21 |
+
element_dom.focus();
|
22 |
+
sel=document.selection.createRange();
|
23 |
+
sel.text=value;
|
24 |
+
return;
|
25 |
+
}if(element_dom.selectionStart||element_dom.selectionStart=='0'){
|
26 |
+
var t_start=element_dom.selectionStart;
|
27 |
+
var t_end=element_dom.selectionEnd;
|
28 |
+
var val_start=element_dom.value.substring(0,t_start);
|
29 |
+
var val_end=element_dom.value.substring(t_end,element_dom.value.length);
|
30 |
+
element_dom.value=val_start+value+val_end;
|
31 |
+
}else{
|
32 |
+
element_dom.value+=value;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
</script>
|
36 |
+
");
|
37 |
+
return parent::_getElementHtml($element);
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagethree.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagethree extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
+
|
9 |
+
|
10 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
+
|
12 |
+
$element->setData('after_element_html', "
|
13 |
+
|
14 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_three_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
+
|
17 |
+
|
18 |
+
");
|
19 |
+
return parent::_getElementHtml($element);
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Smsmessagetwo.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Smsmessagetwo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
const DEFAULT_TEXT = 'Default SMS Text';
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract$element){
|
8 |
+
|
9 |
+
|
10 |
+
$element->setData('placeholder', self::DEFAULT_TEXT);
|
11 |
+
|
12 |
+
$element->setData('after_element_html', "
|
13 |
+
|
14 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var order_number}}');return false;\">Insert Order Number</a>
|
15 |
+
<a href='#' onclick=\"injectText('sms_section_sms_message_two_message', '{{var customer_name}}');return false;\">Insert Customer Name</a>
|
16 |
+
|
17 |
+
|
18 |
+
");
|
19 |
+
return parent::_getElementHtml($element);
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Validator.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Validator extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
8 |
+
{
|
9 |
+
|
10 |
+
// Get the default HTML for this option
|
11 |
+
$html = parent::_getElementHtml($element);
|
12 |
+
|
13 |
+
// Set up additional JavaScript for our validation using jQuery.
|
14 |
+
|
15 |
+
$jquery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
16 |
+
|
17 |
+
$html .=$jquery;
|
18 |
+
|
19 |
+
$javaScript = "
|
20 |
+
<script type=\"text/javascript\">
|
21 |
+
|
22 |
+
jQuery.noConflict();
|
23 |
+
|
24 |
+
jQuery(document).ready(function() {
|
25 |
+
// Handler for .ready() called.
|
26 |
+
|
27 |
+
// Hide our validation block
|
28 |
+
jQuery('#row_connector_data_field_settings_customer_data_validator').hide();
|
29 |
+
|
30 |
+
// Add listener for changing select box
|
31 |
+
jQuery('#connector_data_field_settings_customer_data select').on('change', function() {
|
32 |
+
|
33 |
+
var currentSelection = jQuery(this).val();
|
34 |
+
var currentDropdownId = jQuery(this).attr('id');
|
35 |
+
|
36 |
+
// foreach of the select fields on our mapping page:
|
37 |
+
jQuery('select').each(function(){
|
38 |
+
var thisId = jQuery(this).attr('id');
|
39 |
+
if (thisId != currentDropdownId) {
|
40 |
+
|
41 |
+
var currentLabel = jQuery('label[for=\\'' + thisId + '\\']').text();
|
42 |
+
var thisVal = jQuery(this).val();
|
43 |
+
|
44 |
+
switch (thisVal) {
|
45 |
+
case '0':
|
46 |
+
// ignore DO NOT MAP fields
|
47 |
+
break;
|
48 |
+
case currentSelection:
|
49 |
+
// warning, that field is already mapped somewhere else - reset that value to 'Do not map''
|
50 |
+
alert('Warning! You have overwritten: '+currentLabel);
|
51 |
+
jQuery(this).val(0);
|
52 |
+
break;
|
53 |
+
default:
|
54 |
+
break;
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
});
|
61 |
+
|
62 |
+
});
|
63 |
+
|
64 |
+
});
|
65 |
+
|
66 |
+
|
67 |
+
</script>";
|
68 |
+
|
69 |
+
$html .= $javaScript;
|
70 |
+
return $html;
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Waitingfield.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Waitingfield extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
// Get the default HTML for this option
|
9 |
+
$html = parent::_getElementHtml($element);
|
10 |
+
|
11 |
+
$html .= sprintf('<div id="loadingmask" style="position: fixed;">
|
12 |
+
<div class="loader" id="loading-mask-loader">
|
13 |
+
<img src="%sskin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="%s"/>%s', preg_replace('/index.php\//', '', $this->getBaseUrl()), $this->__('Loading...'), $this->__('Loading...'))
|
14 |
+
. '<div id="loading-mask"></div></div>';
|
15 |
+
|
16 |
+
$jQuery = '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>';
|
17 |
+
|
18 |
+
$jQuery .='
|
19 |
+
<script type="text/javascript">
|
20 |
+
jQuery.noConflict();
|
21 |
+
jQuery(document).ready(function() {
|
22 |
+
//hide the load image field
|
23 |
+
jQuery("#row_connector_api_settings_api_credentials_validator .scope-label").hide();
|
24 |
+
var loadingmask = jQuery("#loadingmask");
|
25 |
+
loadingmask.hide();
|
26 |
+
loadingmask.css({top : "50\%", left: "50\%"})
|
27 |
+
|
28 |
+
jQuery("button").click(function(){
|
29 |
+
|
30 |
+
jQuery("body").css({"background-color": "black", "opacity": "0.4"});
|
31 |
+
|
32 |
+
loadingmask.show();
|
33 |
+
loadingmask.css({"display": "block", "opacity" : "1"});
|
34 |
+
})
|
35 |
+
});
|
36 |
+
</script>';
|
37 |
+
|
38 |
+
$html .= $jQuery;
|
39 |
+
|
40 |
+
return $html;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Config/Wrapper.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Config_Wrapper extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$element->setData('onchange', "apiValidation(this.form, this);");
|
9 |
+
|
10 |
+
$element->setData('after_element_html', "
|
11 |
+
<script>
|
12 |
+
document.observe('dom:loaded', function(){
|
13 |
+
apiValidation();
|
14 |
+
|
15 |
+
});
|
16 |
+
function apiValidation(form, element) {
|
17 |
+
var api_user = $('connector_api_settings_api_credentials_username');
|
18 |
+
var api_password = $('connector_api_settings_api_credentials_password');
|
19 |
+
|
20 |
+
var reloadurl = '{$this->getUrl('connector/debug/ajaxvalidation')}';
|
21 |
+
|
22 |
+
new Ajax.Request(reloadurl, {
|
23 |
+
method: 'post',
|
24 |
+
parameters: {'api_user' : api_user.value, 'api_password' : api_password.value},
|
25 |
+
onComplete: function(transport) {
|
26 |
+
Element.hide('loadingmask');
|
27 |
+
if(transport.responseText == '\"Valid\"'){
|
28 |
+
api_user.setStyle({
|
29 |
+
fontWeight: 'bold',
|
30 |
+
color: 'green' ,
|
31 |
+
background: 'transparent url(\"" . $this->getSkinUrl('images/success_msg_icon.gif') . "\") no-repeat right center'
|
32 |
+
})
|
33 |
+
}else{
|
34 |
+
api_user.setStyle({
|
35 |
+
fontWeight: 'bold',
|
36 |
+
color: 'red',
|
37 |
+
background: 'transparent url(\"" . $this->getSkinUrl('images/error_msg_icon.gif') . "\") no-repeat right center'
|
38 |
+
});
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
42 |
+
});
|
43 |
+
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
</script>
|
48 |
+
");
|
49 |
+
|
50 |
+
return parent::_getElementHtml($element);
|
51 |
+
|
52 |
+
}
|
53 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Couponinfo.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Couponinfo extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$code = Mage::helper('connector')->getPasscode();
|
9 |
+
if(!strlen($code))
|
10 |
+
$code = '[PLEASE SET UP A PASSCODE]';
|
11 |
+
$text = $baseUr . 'connector/email/coupon/id/[INSERT ID HERE]/code/'. $code;
|
12 |
+
|
13 |
+
$element->setData('value', $text);
|
14 |
+
$element->setData('disabled', 'disabled');
|
15 |
+
return parent::_getElementHtml($element);
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Crosssell.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Crosssell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$helper = Mage::helper('connector');
|
9 |
+
$code = $helper->getPasscode();
|
10 |
+
$order = $helper->getLastOrderNo();
|
11 |
+
|
12 |
+
if(!strlen($code) && !strlen($order)) $code = '[PLEASE SET UP A PASSCODE]';
|
13 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
14 |
+
|
15 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/crosssell';
|
16 |
+
$element->setData('value', $text);
|
17 |
+
$element->setData('disabled', 'disabled');
|
18 |
+
return parent::_getElementHtml($element);
|
19 |
+
}
|
20 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Lostbasket.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Lostbasket extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
7 |
+
{
|
8 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
9 |
+
$code = Mage::helper('connector')->getPasscode();
|
10 |
+
if(!strlen($code))
|
11 |
+
$code = '[PLEASE SET UP A PASSCODE]';
|
12 |
+
$text = $baseUr . 'connector/email/basket/email/@EMAIL@/code/'. $code;
|
13 |
+
|
14 |
+
$element->setData('value', $text);
|
15 |
+
$element->setData('disabled', 'disabled');
|
16 |
+
return parent::_getElementHtml($element);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Mostviewed.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Mostviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$code = Mage::helper('connector')->getPasscode();
|
9 |
+
$order = Mage::helper('connector')->getLastOrderNo();
|
10 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
11 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
12 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/mostviewed';
|
13 |
+
$element->setData('value', $text);
|
14 |
+
$element->setData('disabled', 'disabled');
|
15 |
+
return parent::_getElementHtml($element);
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Productpush.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Productpush extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$helper = Mage::helper('connector');
|
9 |
+
$code = $helper->getPasscode();
|
10 |
+
$order = $helper->getLastOrderNo();
|
11 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/productpush';
|
14 |
+
$element->setData('value', $text);
|
15 |
+
$element->setData('disabled', 'disabled');
|
16 |
+
return parent::_getElementHtml($element);
|
17 |
+
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Recentlyviewed.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Recentlyviewed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
7 |
+
$helper = Mage::helper('connector');
|
8 |
+
$code = $helper->getPasscode();
|
9 |
+
|
10 |
+
$customerId = $helper->getMappedCustomerId();
|
11 |
+
|
12 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
13 |
+
if(!$customerId) $customerId = '[PLEASE MAP THE CUSTOMER ID]';
|
14 |
+
$text = $baseUr . 'connector/email/products/customer/@' . $customerId . '@/code/' . $code . '/mode/recentlyviewed';
|
15 |
+
$element->setData('value', $text);
|
16 |
+
$element->setData('disabled', 'disabled');
|
17 |
+
return parent::_getElementHtml($element);
|
18 |
+
|
19 |
+
}
|
20 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Related.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Related extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
8 |
+
$helper = Mage::helper('connector');
|
9 |
+
$code = $helper->getPasscode();
|
10 |
+
$order = $helper->getLastOrderNo();
|
11 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/related';
|
14 |
+
$element->setData('value', $text);
|
15 |
+
|
16 |
+
return parent::_getElementHtml($element);
|
17 |
+
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Adminhtml/System/Upsell.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Block_Adminhtml_System_Upsell extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
5 |
+
{
|
6 |
+
$baseUr = preg_replace('/index.php\//', '', Mage::getBaseUrl());
|
7 |
+
$helper = Mage::helper('connector');
|
8 |
+
$code = $helper->getPasscode();
|
9 |
+
$order = $helper->getLastOrderNo();
|
10 |
+
|
11 |
+
if(!strlen($code)) $code = '[PLEASE SET UP A PASSCODE]';
|
12 |
+
if(!$order) $order = '[PLEASE MAP THE LAST ORDER NO]';
|
13 |
+
|
14 |
+
$text = $baseUr . 'connector/email/products/order/@' . $order . '@/code/' . $code . '/mode/upsell';
|
15 |
+
$element->setData('value', $text);
|
16 |
+
|
17 |
+
return parent::_getElementHtml($element);
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Basket.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Basket extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
protected $_quote;
|
6 |
+
|
7 |
+
public function getBasketItems()
|
8 |
+
{
|
9 |
+
$params = $this->getRequest()->getParams();
|
10 |
+
|
11 |
+
if(!isset($params['email']) && !isset($params['code']))
|
12 |
+
exit();
|
13 |
+
Mage::helper('connector')->auth($params['code']);
|
14 |
+
|
15 |
+
$email = $params['email'];
|
16 |
+
|
17 |
+
$customer = Mage::getModel('customer/customer');
|
18 |
+
$customer->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($email);
|
19 |
+
|
20 |
+
//last active guest basket
|
21 |
+
$quoteModel = Mage::getResourceModel('sales/quote_collection')
|
22 |
+
->addFieldToFilter('is_active',1)
|
23 |
+
->addFieldToFilter('items_count', array('gt' => 0))
|
24 |
+
->addFieldToFilter('customer_email', $email)
|
25 |
+
->setOrder('updated_at' , 'DESC')
|
26 |
+
->setPageSize(1)
|
27 |
+
;
|
28 |
+
|
29 |
+
$quoteModel = $quoteModel->getFirstItem();
|
30 |
+
$this->_quote = $quoteModel;
|
31 |
+
|
32 |
+
$store_id = $quoteModel->getStoreId();
|
33 |
+
Mage::app()->setCurrentStore($store_id);
|
34 |
+
|
35 |
+
return $quoteModel->getAllItems();;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getGrandTotal()
|
39 |
+
{
|
40 |
+
return $this->_quote->getGrandTotal();
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Coupon.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Coupon extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
public function generateCoupon()
|
6 |
+
{
|
7 |
+
$params = $this->getRequest()->getParams();
|
8 |
+
if(!isset($params['id']) || !isset($params['code']))
|
9 |
+
exit();
|
10 |
+
//coupon rule id
|
11 |
+
$couponCodeId = $params['id'];
|
12 |
+
$authCode = $params['code'];
|
13 |
+
|
14 |
+
//authenticate
|
15 |
+
Mage::helper('connector')->auth($authCode);
|
16 |
+
|
17 |
+
if($couponCodeId){
|
18 |
+
|
19 |
+
$rule = Mage::getModel('salesrule/rule')->load($couponCodeId);
|
20 |
+
$generator = Mage::getModel('salesrule/coupon_massgenerator');
|
21 |
+
|
22 |
+
$generator->setFormat( Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC );
|
23 |
+
$generator->setRuleId($couponCodeId);
|
24 |
+
$generator->setUsesPerCoupon(1);
|
25 |
+
$generator->setDash( 3 );
|
26 |
+
$generator->setLength( 9);
|
27 |
+
$generator->setPrefix( '' );
|
28 |
+
$generator->setSuffix( '' );
|
29 |
+
|
30 |
+
//set the generation settings
|
31 |
+
$rule->setCouponCodeGenerator($generator);
|
32 |
+
$rule->setCouponType( Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO );
|
33 |
+
|
34 |
+
//generate the coupon
|
35 |
+
$coupon = $rule->acquireCoupon();
|
36 |
+
$couponCode = $coupon->getCode();
|
37 |
+
|
38 |
+
//save the type of coupon
|
39 |
+
$couponModel = Mage::getModel('salesrule/coupon')->loadByCode($couponCode);
|
40 |
+
$couponModel->setType(Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON);
|
41 |
+
$couponModel->save();
|
42 |
+
|
43 |
+
return $couponCode;
|
44 |
+
}
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Countcontacts.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Countcontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Check Customers Now'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/countcontacts");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Deletecontacts.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Deletecontacts extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__("Delete ID's Now"));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/deletecontactsid");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcecustomersync.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Forcecustomersync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Sync Customer Data Now'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcecustomersync");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcelostbasketsync.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Forcelostbasketsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Sync Lost Baskets Now'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcelostbasketsync");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Forcesuppressedsync.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Forcesuppressedsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Sync Suppressed Data Now'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/forcesuppressed");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Initialsync.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Initialsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
6 |
+
$this->setElement($element);
|
7 |
+
return $this->_getAddRowButtonHtml($this->__('Run Initialisation Synchronization'));
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _getAddRowButtonHtml($title) {
|
11 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/initialSync");
|
12 |
+
|
13 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
14 |
+
->setType('button')
|
15 |
+
->setLabel($this->__($title))
|
16 |
+
->setOnClick("window.location.href='" . $url . "'")
|
17 |
+
->toHtml();
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Rescuenow.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Rescuenow extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Send Lost Basket Campaigns Now'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/rescuenow");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Testcredentials.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Testcredentials extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
7 |
+
$this->setElement($element);
|
8 |
+
return $this->_getAddRowButtonHtml($this->__('Test Credentials'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAddRowButtonHtml($title) {
|
12 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/testcredentials");
|
13 |
+
|
14 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
15 |
+
->setType('button')
|
16 |
+
->setLabel($this->__($title))
|
17 |
+
->setOnClick("window.location.href='" . $url . "'")
|
18 |
+
->toHtml();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Debug/Transactionalsync.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Debug_Transactionalsync extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
6 |
+
$this->setElement($element);
|
7 |
+
return $this->_getAddRowButtonHtml($this->__('Run Baskets/Orders Synchronization'));
|
8 |
+
}
|
9 |
+
|
10 |
+
protected function _getAddRowButtonHtml($title) {
|
11 |
+
$url = Mage::helper('adminhtml')->getUrl("connector/debug/transactionalSync");
|
12 |
+
|
13 |
+
return $this->getLayout()->createBlock('adminhtml/widget_button')
|
14 |
+
->setType('button')
|
15 |
+
->setLabel($this->__($title))
|
16 |
+
->setOnClick("window.location.href='" . $url . "'")
|
17 |
+
->toHtml();
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Block/Products.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Block_Products extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* get the products to display for table
|
7 |
+
*/
|
8 |
+
public function getRecommendedProducts()
|
9 |
+
{
|
10 |
+
//get all params
|
11 |
+
$params = $this->getRequest()->getParams();
|
12 |
+
$productsToDisplay = array();
|
13 |
+
|
14 |
+
if(isset($params['customer'])){
|
15 |
+
$productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended();
|
16 |
+
$productsToDisplay = $productRecommended->getProducts();
|
17 |
+
$orderId = false;
|
18 |
+
|
19 |
+
}else{
|
20 |
+
|
21 |
+
$orderId = $params['order'];
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
if($orderId){
|
27 |
+
$orderModel = Mage::getModel('sales/order')->load($orderId);
|
28 |
+
if($orderModel->getId()){
|
29 |
+
//order products
|
30 |
+
$productRecommended = new Dotdigitalgroup_Email_Model_Dynamic_Recommended($orderModel);
|
31 |
+
|
32 |
+
//get the order items recommendations
|
33 |
+
$productsToDisplay = $productRecommended->getProducts();
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return $productsToDisplay;
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
public function getPriceHtml($product)
|
42 |
+
{
|
43 |
+
$this->setTemplate('connector/price.phtml');
|
44 |
+
$this->setProduct($product);
|
45 |
+
return $this->toHtml();
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getMode()
|
49 |
+
{
|
50 |
+
return Mage::helper('connector/recommended')->getMode();
|
51 |
+
|
52 |
+
}
|
53 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Helper/Api/DotNetExample.php
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* mag17.
|
4 |
+
*
|
5 |
+
* User: chrisroseuk
|
6 |
+
* Date: 19/04/2013
|
7 |
+
* Time: 17:10
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*
|
12 |
+
*
|
13 |
+
* using System;
|
14 |
+
using System.Collections.Generic;
|
15 |
+
using System.IO;
|
16 |
+
using System.Net;
|
17 |
+
using System.Text;
|
18 |
+
using System.Threading;
|
19 |
+
using Newtonsoft.Json;
|
20 |
+
|
21 |
+
namespace Email.ImportContacts
|
22 |
+
{
|
23 |
+
class Program
|
24 |
+
{
|
25 |
+
private const string UserName = "";
|
26 |
+
private const string Password = "";
|
27 |
+
private const int AddressBookId = 1188372; //Your address book here
|
28 |
+
|
29 |
+
static void Main(string[] args)
|
30 |
+
{
|
31 |
+
AppDomain.CurrentDomain.UnhandledException += PrintUnhandledException;
|
32 |
+
|
33 |
+
ApiContactImport contactImport = ImportContactsFromFile();
|
34 |
+
ApiContactImport contactImportResult = WaitUntilImportFinishes(contactImport);
|
35 |
+
PrintContactImport(contactImportResult);
|
36 |
+
|
37 |
+
Dictionary<String, String> contactImportReport = GetContactImportReport(contactImportResult.Id);
|
38 |
+
PrintContactImportReport(contactImportReport);
|
39 |
+
|
40 |
+
String csvReport = GetContactImportFaults(contactImportResult.Id);
|
41 |
+
PrintCsvReport(csvReport);
|
42 |
+
}
|
43 |
+
|
44 |
+
private static String GetContactImportFaults(Guid importId)
|
45 |
+
{
|
46 |
+
string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report-faults", importId);
|
47 |
+
HttpWebRequest request = CreateRequest(url);
|
48 |
+
String result = ReadResultAsString(request);
|
49 |
+
return result;
|
50 |
+
}
|
51 |
+
|
52 |
+
private static void PrintCsvReport(string csvReport)
|
53 |
+
{
|
54 |
+
Console.WriteLine();
|
55 |
+
Console.WriteLine(csvReport);
|
56 |
+
}
|
57 |
+
|
58 |
+
private static Dictionary<string, string> GetContactImportReport(Guid importId)
|
59 |
+
{
|
60 |
+
string url = String.Format("https://apiconnector.com/v2/contacts/import/{0}/report", importId);
|
61 |
+
HttpWebRequest request = CreateRequest(url);
|
62 |
+
Dictionary<string, string> result = ReadResult<Dictionary<string, string>>(request);
|
63 |
+
return result;
|
64 |
+
}
|
65 |
+
|
66 |
+
private static ApiContactImport WaitUntilImportFinishes(ApiContactImport importResult)
|
67 |
+
{
|
68 |
+
ApiContactImport result = importResult;
|
69 |
+
|
70 |
+
while (result.Status == ApiContactImportStatuses.NotFinished)
|
71 |
+
{
|
72 |
+
Thread.Sleep(TimeSpan.FromSeconds(10));
|
73 |
+
|
74 |
+
HttpWebRequest request = CreateRequest("https://apiconnector.com/v2/contacts/import/" + importResult.Id);
|
75 |
+
result = ReadResult<ApiContactImport>(request);
|
76 |
+
}
|
77 |
+
|
78 |
+
return result;
|
79 |
+
}
|
80 |
+
|
81 |
+
private static ApiContactImport ImportContactsFromFile()
|
82 |
+
{
|
83 |
+
string url = String.Format("https://apiconnector.com/v2/address-books/{0}/contacts/import", AddressBookId);
|
84 |
+
HttpWebRequest request = CreateRequest(url);
|
85 |
+
request.Method = "POST";
|
86 |
+
|
87 |
+
AddContactsToRequest(request);
|
88 |
+
|
89 |
+
ApiContactImport result = ReadResult<ApiContactImport>(request);
|
90 |
+
return result;
|
91 |
+
}
|
92 |
+
|
93 |
+
private static void AddContactsToRequest(HttpWebRequest request)
|
94 |
+
{
|
95 |
+
String boundary = Guid.NewGuid().ToString("N");
|
96 |
+
request.ContentType = String.Format(@"multipart/form-data; boundary=""{0}""", boundary);
|
97 |
+
|
98 |
+
using (BinaryWriter writer = new BinaryWriter(request.GetRequestStream()))
|
99 |
+
{
|
100 |
+
writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n"));
|
101 |
+
|
102 |
+
const string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
|
103 |
+
string header = string.Format(headerTemplate, "Contacts", "Contacts.csv");
|
104 |
+
|
105 |
+
byte[] headerbytes = Encoding.UTF8.GetBytes(header);
|
106 |
+
writer.Write(headerbytes);
|
107 |
+
|
108 |
+
byte[] contacts = File.ReadAllBytes("Contacts.csv");
|
109 |
+
writer.Write(contacts);
|
110 |
+
|
111 |
+
writer.Write(Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n"));
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
private static HttpWebRequest CreateRequest(string url)
|
116 |
+
{
|
117 |
+
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
118 |
+
String base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(UserName + ":" + Password));
|
119 |
+
request.Headers.Add("Authorization", "Basic " + base64);
|
120 |
+
|
121 |
+
return request;
|
122 |
+
}
|
123 |
+
|
124 |
+
private static void PrintContactImport(ApiContactImport importResult)
|
125 |
+
{
|
126 |
+
Console.WriteLine("Import Id = {0}", importResult.Id);
|
127 |
+
Console.WriteLine("Import Status = {0}", importResult.Status);
|
128 |
+
}
|
129 |
+
|
130 |
+
private static void PrintContactImportReport(Dictionary<String, String> contactImportReport)
|
131 |
+
{
|
132 |
+
Console.WriteLine();
|
133 |
+
foreach (KeyValuePair<string, string> pair in contactImportReport)
|
134 |
+
{
|
135 |
+
Console.WriteLine("{0,-20} = {1}", pair.Key, pair.Value);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
private static String ReadResultAsString(WebRequest request)
|
140 |
+
{
|
141 |
+
String result;
|
142 |
+
|
143 |
+
using (WebResponse response = request.GetResponse())
|
144 |
+
{
|
145 |
+
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
146 |
+
{
|
147 |
+
result = reader.ReadToEnd();
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
return result;
|
152 |
+
}
|
153 |
+
|
154 |
+
private static TResult ReadResult<TResult>(WebRequest request)
|
155 |
+
{
|
156 |
+
TResult result;
|
157 |
+
|
158 |
+
using (WebResponse response = request.GetResponse())
|
159 |
+
{
|
160 |
+
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
161 |
+
{
|
162 |
+
JsonSerializer serializer = new JsonSerializer();
|
163 |
+
using (JsonTextReader jsonReader = new JsonTextReader(reader))
|
164 |
+
{
|
165 |
+
result = serializer.Deserialize<TResult>(jsonReader);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
return result;
|
171 |
+
}
|
172 |
+
|
173 |
+
private static void PrintUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
174 |
+
{
|
175 |
+
Console.WriteLine(e.ExceptionObject);
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
*
|
180 |
+
*
|
181 |
+
*
|
182 |
+
*/
|
app/code/local/Dotdigitalgroup/Email/Helper/Api/Restrequest.php
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Api_Restrequest extends Dotdigitalgroup_Email_Helper_Data
|
4 |
+
{
|
5 |
+
protected $url;
|
6 |
+
protected $verb;
|
7 |
+
protected $requestBody;
|
8 |
+
protected $requestLength;
|
9 |
+
protected $username;
|
10 |
+
protected $password;
|
11 |
+
protected $acceptType;
|
12 |
+
protected $responseBody;
|
13 |
+
protected $responseInfo;
|
14 |
+
|
15 |
+
public function __construct() // ($url = null, $verb = 'GET', $requestBody = null)
|
16 |
+
{
|
17 |
+
$this->url = null; //$url;
|
18 |
+
$this->verb = null; //$verb;
|
19 |
+
$this->requestBody = null; //$requestBody;
|
20 |
+
$this->requestLength = 0;
|
21 |
+
$this->username = Mage::getStoreConfig('connector_api_settings/api_credentials/username');
|
22 |
+
$this->password = Mage::getStoreConfig('connector_api_settings/api_credentials/password');
|
23 |
+
$this->acceptType = 'application/json';
|
24 |
+
$this->responseBody = null;
|
25 |
+
$this->responseInfo = null;
|
26 |
+
|
27 |
+
if ($this->requestBody !== null)
|
28 |
+
{
|
29 |
+
$this->buildPostBody();
|
30 |
+
}
|
31 |
+
|
32 |
+
//parent::__construct();
|
33 |
+
}
|
34 |
+
|
35 |
+
private function prettyPrint( $json )
|
36 |
+
{
|
37 |
+
$result = '';
|
38 |
+
$level = 0;
|
39 |
+
$prev_char = '';
|
40 |
+
$in_quotes = false;
|
41 |
+
$ends_line_level = NULL;
|
42 |
+
$json_length = strlen( $json );
|
43 |
+
|
44 |
+
for( $i = 0; $i < $json_length; $i++ ) {
|
45 |
+
$char = $json[$i];
|
46 |
+
$new_line_level = NULL;
|
47 |
+
$post = "";
|
48 |
+
if( $ends_line_level !== NULL ) {
|
49 |
+
$new_line_level = $ends_line_level;
|
50 |
+
$ends_line_level = NULL;
|
51 |
+
}
|
52 |
+
if( $char === '"' && $prev_char != '\\' ) {
|
53 |
+
$in_quotes = !$in_quotes;
|
54 |
+
} else if( ! $in_quotes ) {
|
55 |
+
switch( $char ) {
|
56 |
+
case '}': case ']':
|
57 |
+
$level--;
|
58 |
+
$ends_line_level = NULL;
|
59 |
+
$new_line_level = $level;
|
60 |
+
break;
|
61 |
+
|
62 |
+
case '{': case '[':
|
63 |
+
$level++;
|
64 |
+
case ',':
|
65 |
+
$ends_line_level = $level;
|
66 |
+
break;
|
67 |
+
|
68 |
+
case ':':
|
69 |
+
$post = " ";
|
70 |
+
break;
|
71 |
+
|
72 |
+
case " ": case "\t": case "\n": case "\r":
|
73 |
+
$char = "";
|
74 |
+
$ends_line_level = $new_line_level;
|
75 |
+
$new_line_level = NULL;
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
if( $new_line_level !== NULL ) {
|
80 |
+
$result .= "\n".str_repeat( "\t", $new_line_level );
|
81 |
+
}
|
82 |
+
$result .= $char.$post;
|
83 |
+
$prev_char = $char;
|
84 |
+
}
|
85 |
+
|
86 |
+
return $result;
|
87 |
+
}
|
88 |
+
|
89 |
+
// returns the object as JSON
|
90 |
+
public function toJSON($pretty=false){
|
91 |
+
|
92 |
+
if (!$pretty) {
|
93 |
+
return json_encode($this->expose());
|
94 |
+
}
|
95 |
+
else {
|
96 |
+
return $this->prettyPrint(json_encode($this->expose()));
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
// exposes the class as an array of objects
|
101 |
+
public function expose() {
|
102 |
+
|
103 |
+
return get_object_vars($this);
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
public function flush ()
|
109 |
+
{
|
110 |
+
$this->requestBody = null;
|
111 |
+
$this->requestLength = 0;
|
112 |
+
$this->verb = 'GET';
|
113 |
+
$this->responseBody = null;
|
114 |
+
$this->responseInfo = null;
|
115 |
+
}
|
116 |
+
|
117 |
+
public function execute ()
|
118 |
+
{
|
119 |
+
$ch = curl_init();
|
120 |
+
$this->setAuth($ch);
|
121 |
+
|
122 |
+
try
|
123 |
+
{
|
124 |
+
switch (strtoupper($this->verb))
|
125 |
+
{
|
126 |
+
case 'GET':
|
127 |
+
$this->executeGet($ch);
|
128 |
+
break;
|
129 |
+
case 'POST':
|
130 |
+
$this->executePost($ch);
|
131 |
+
break;
|
132 |
+
case 'PUT':
|
133 |
+
$this->executePut($ch);
|
134 |
+
break;
|
135 |
+
case 'DELETE':
|
136 |
+
$this->executeDelete($ch);
|
137 |
+
break;
|
138 |
+
default:
|
139 |
+
throw new InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.');
|
140 |
+
}
|
141 |
+
}
|
142 |
+
catch (InvalidArgumentException $e)
|
143 |
+
{
|
144 |
+
curl_close($ch);
|
145 |
+
throw $e;
|
146 |
+
}
|
147 |
+
catch (Exception $e)
|
148 |
+
{
|
149 |
+
curl_close($ch);
|
150 |
+
throw $e;
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
public function buildPostBody($data = null)
|
156 |
+
{
|
157 |
+
$data = ($data !== null)? $data : $this->requestBody;
|
158 |
+
|
159 |
+
if (!is_array($data)){
|
160 |
+
throw new InvalidArgumentException('Invalid data input for postBody. Array expected');
|
161 |
+
}
|
162 |
+
|
163 |
+
$data = http_build_query($data, '', '&');
|
164 |
+
$this->requestBody = $data;
|
165 |
+
}
|
166 |
+
|
167 |
+
protected function executeGet ($ch)
|
168 |
+
{
|
169 |
+
$this->doExecute($ch);
|
170 |
+
}
|
171 |
+
|
172 |
+
protected function executePost ($ch)
|
173 |
+
{
|
174 |
+
if (!is_string($this->requestBody))
|
175 |
+
{
|
176 |
+
$this->buildPostBody();
|
177 |
+
}
|
178 |
+
|
179 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->requestBody);
|
180 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
181 |
+
|
182 |
+
$this->doExecute($ch);
|
183 |
+
}
|
184 |
+
|
185 |
+
protected function executePut($ch)
|
186 |
+
{
|
187 |
+
if (!is_string($this->requestBody)){
|
188 |
+
$this->buildPostBody();
|
189 |
+
}
|
190 |
+
|
191 |
+
$this->requestLength = strlen($this->requestBody);
|
192 |
+
|
193 |
+
$fh = fopen('php://memory', 'rw');
|
194 |
+
fwrite($fh, $this->requestBody);
|
195 |
+
rewind($fh);
|
196 |
+
|
197 |
+
curl_setopt($ch, CURLOPT_INFILE, $fh);
|
198 |
+
curl_setopt($ch, CURLOPT_INFILESIZE, $this->requestLength);
|
199 |
+
curl_setopt($ch, CURLOPT_PUT, true);
|
200 |
+
|
201 |
+
$this->doExecute($ch);
|
202 |
+
|
203 |
+
fclose($fh);
|
204 |
+
}
|
205 |
+
|
206 |
+
protected function executeDelete ($ch)
|
207 |
+
{
|
208 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
|
209 |
+
|
210 |
+
$this->doExecute($ch);
|
211 |
+
}
|
212 |
+
|
213 |
+
protected function doExecute (&$curlHandle)
|
214 |
+
{
|
215 |
+
$this->setCurlOpts($curlHandle);
|
216 |
+
$this->responseBody = curl_exec($curlHandle);
|
217 |
+
$this->responseInfo = curl_getinfo($curlHandle);
|
218 |
+
|
219 |
+
curl_close($curlHandle);
|
220 |
+
}
|
221 |
+
|
222 |
+
protected function setCurlOpts (&$curlHandle)
|
223 |
+
{
|
224 |
+
curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
|
225 |
+
curl_setopt($curlHandle, CURLOPT_URL, $this->url);
|
226 |
+
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
|
227 |
+
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array ('Accept: ' . $this->acceptType ,'Content-Type: application/json'));
|
228 |
+
}
|
229 |
+
|
230 |
+
protected function setAuth (&$curlHandle)
|
231 |
+
{
|
232 |
+
if ($this->username !== null && $this->password !== null)
|
233 |
+
{
|
234 |
+
curl_setopt($curlHandle, CURLAUTH_BASIC, CURLAUTH_DIGEST);
|
235 |
+
curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
public function getAcceptType ()
|
240 |
+
{
|
241 |
+
return $this->acceptType;
|
242 |
+
}
|
243 |
+
|
244 |
+
public function setAcceptType ($acceptType)
|
245 |
+
{
|
246 |
+
$this->acceptType = $acceptType;
|
247 |
+
}
|
248 |
+
|
249 |
+
public function getPassword ()
|
250 |
+
{
|
251 |
+
return $this->password;
|
252 |
+
}
|
253 |
+
|
254 |
+
public function setPassword ($password)
|
255 |
+
{
|
256 |
+
$this->password = $password;
|
257 |
+
}
|
258 |
+
|
259 |
+
public function getResponseBody ()
|
260 |
+
{
|
261 |
+
return $this->responseBody;
|
262 |
+
}
|
263 |
+
|
264 |
+
public function getResponseInfo ()
|
265 |
+
{
|
266 |
+
return $this->responseInfo;
|
267 |
+
}
|
268 |
+
|
269 |
+
public function getUrl ()
|
270 |
+
{
|
271 |
+
return $this->url;
|
272 |
+
}
|
273 |
+
|
274 |
+
public function setUrl ($url)
|
275 |
+
{
|
276 |
+
$this->url = $url;
|
277 |
+
}
|
278 |
+
|
279 |
+
public function getUsername ()
|
280 |
+
{
|
281 |
+
return $this->username;
|
282 |
+
}
|
283 |
+
|
284 |
+
public function setUsername ($username)
|
285 |
+
{
|
286 |
+
$this->username = $username;
|
287 |
+
}
|
288 |
+
|
289 |
+
public function getVerb ()
|
290 |
+
{
|
291 |
+
return $this->verb;
|
292 |
+
}
|
293 |
+
|
294 |
+
public function setVerb ($verb)
|
295 |
+
{
|
296 |
+
$this->verb = $verb;
|
297 |
+
}
|
298 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Helper/Data.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* empty helper to keep admin from breaking
|
4 |
+
*/
|
5 |
+
class Dotdigitalgroup_Email_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
+
{
|
7 |
+
const XML_PATH_PASSCODE = 'connector_advanced_settings/external/passcode';
|
8 |
+
const XML_PATH_LAST_ORDER_NO = 'connector_data_field_settings/customer_data/last_order_no';
|
9 |
+
const XML_PATH_MAPPING_CUSTOMER_ID = 'connector_data_field_settings/customer_data/customer_id';
|
10 |
+
const XML_PATH_ENABLED_LOGS = 'connector_advanced_settings/admin/debug';
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* return the time scheldule for the cronjob
|
15 |
+
* @param $code
|
16 |
+
* @return mixed
|
17 |
+
*/
|
18 |
+
public function getSchelduledAtCronjob($code)
|
19 |
+
{
|
20 |
+
/* @var $collection Mage_Cron_Model_Resource_Schedule_Collection */
|
21 |
+
$collection = Mage::getModel('cron/schedule')->getCollection();
|
22 |
+
$collection->addFieldToFilter('job_code', $code)
|
23 |
+
->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_PENDING)
|
24 |
+
->addOrder('scheduled_at', Varien_Data_Collection_Db::SORT_ORDER_DESC)
|
25 |
+
->getSelect()->limit(1);
|
26 |
+
$schedule = $collection->getFirstItem();
|
27 |
+
|
28 |
+
$scheduleAt = $schedule->getData('scheduled_at');
|
29 |
+
|
30 |
+
return $scheduleAt;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function auth($authRequest)
|
34 |
+
{
|
35 |
+
if($authRequest == Mage::getStoreConfig(self::XML_PATH_PASSCODE)){
|
36 |
+
return true;
|
37 |
+
}
|
38 |
+
|
39 |
+
if($this->isEnabledLogs())
|
40 |
+
$this->log('authenication failed : ' . $authRequest , null, 'auth.log');
|
41 |
+
exit();
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getMappedCustomerId()
|
45 |
+
{
|
46 |
+
return Mage::getStoreConfig(self::XML_PATH_MAPPING_CUSTOMER_ID);
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getPasscode()
|
50 |
+
{
|
51 |
+
return Mage::getStoreConfig(self::XML_PATH_PASSCODE);
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getLastOrderNo()
|
55 |
+
{
|
56 |
+
return Mage::getStoreConfig(self::XML_PATH_LAST_ORDER_NO);
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
public function log($data, $level = Zend_Log::DEBUG, $filename = 'api.log')
|
61 |
+
{
|
62 |
+
if($this->isEnabledLogs()){
|
63 |
+
$filename = 'connector_' . $filename;
|
64 |
+
|
65 |
+
Mage::log($data, $level, $filename, $force = true);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
public function isEnabledLogs()
|
70 |
+
{
|
71 |
+
return (bool) Mage::getStoreConfig(self::XML_PATH_ENABLED_LOGS);
|
72 |
+
}
|
73 |
+
|
74 |
+
public function isOrderTransactionalEnabled()
|
75 |
+
{
|
76 |
+
return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
|
77 |
+
}
|
78 |
+
|
79 |
+
public function isCustomerSyncEnabled()
|
80 |
+
{
|
81 |
+
return (bool) Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE);
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getConnectorVersion()
|
85 |
+
{
|
86 |
+
|
87 |
+
$modules = (array) Mage::getConfig()->getNode('modules')->children();
|
88 |
+
|
89 |
+
if(isset($modules['Dotdigitalgroup_Email'])){
|
90 |
+
|
91 |
+
$moduleName = $modules['Dotdigitalgroup_Email'];
|
92 |
+
return $moduleName->version;
|
93 |
+
}
|
94 |
+
return '';
|
95 |
+
}
|
96 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Helper/File.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
empty helper to keep admin from breaking
|
4 |
+
*/
|
5 |
+
class Dotdigitalgroup_Email_Helper_File extends Dotdigitalgroup_Email_Helper_Data
|
6 |
+
{
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Location of files we are building
|
10 |
+
*/
|
11 |
+
|
12 |
+
private $_output_folder; // set in _construct
|
13 |
+
private $_output_archive_folder; // set in _construct
|
14 |
+
|
15 |
+
private $delimiter; // set in _construct
|
16 |
+
private $enclosure; // set in _construct
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
|
20 |
+
$this->_output_folder = Mage::getBaseDir('var') . DS . 'export' . DS . 'email';
|
21 |
+
$this->_output_archive_folder = $this->_output_folder . DS . 'archive';
|
22 |
+
|
23 |
+
$this->delimiter = ','; // tab character
|
24 |
+
$this->enclosure = '"';
|
25 |
+
} // end
|
26 |
+
|
27 |
+
|
28 |
+
public function getOutputFolder() {
|
29 |
+
$this->pathExists($this->_output_folder);
|
30 |
+
return $this->_output_folder;
|
31 |
+
} // end
|
32 |
+
|
33 |
+
public function getArchiveFolder() {
|
34 |
+
$this->pathExists($this->_output_archive_folder);
|
35 |
+
return $this->_output_archive_folder;
|
36 |
+
} // end
|
37 |
+
|
38 |
+
/* Return the full filepath */
|
39 |
+
public function getFilePath($filename) {
|
40 |
+
return $this->getOutputFolder() . DS . $filename;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function archiveCSV($filename) {
|
44 |
+
|
45 |
+
$this->moveFile($this->getOutputFolder(), $this->getArchiveFolder(), $filename);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Moves the output file from one folder to the next
|
50 |
+
*
|
51 |
+
* @param string $source_folder
|
52 |
+
* @param string $dest_folder
|
53 |
+
*/
|
54 |
+
public function moveFile($source_folder, $dest_folder, $filename ){
|
55 |
+
|
56 |
+
// generate the full file paths
|
57 |
+
$source_filepath = $source_folder . DS . $filename;
|
58 |
+
$dest_filepath = $dest_folder . DS . $filename;
|
59 |
+
|
60 |
+
// rename the file
|
61 |
+
rename($source_filepath, $dest_filepath);
|
62 |
+
|
63 |
+
} // end
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Output an array to the output file FORCING Quotes around all fields
|
68 |
+
* @param $filepath
|
69 |
+
* @param $csv
|
70 |
+
*/
|
71 |
+
public function outputForceQuotesCSV($filepath, $csv) {
|
72 |
+
|
73 |
+
$fqCsv = $this->arrayToCsv($csv,chr(9),'"',true,false);
|
74 |
+
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
75 |
+
$fp = fopen($filepath, "a");
|
76 |
+
|
77 |
+
// for some reason passing the preset delimiter/enclosure variables results in error
|
78 |
+
if (fwrite($fp, $fqCsv) == 0 ) //$this->delimiter $this->enclosure
|
79 |
+
{
|
80 |
+
Mage::throwException('Problem writing CSV file');
|
81 |
+
}
|
82 |
+
fclose($fp);
|
83 |
+
|
84 |
+
} // end
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Output an array to the output file
|
89 |
+
* @param $filepath
|
90 |
+
* @param $csv
|
91 |
+
*/
|
92 |
+
public function outputCSV($filepath, $csv) {
|
93 |
+
|
94 |
+
// Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
|
95 |
+
$handle = fopen($filepath, "a");
|
96 |
+
|
97 |
+
// for some reason passing the preset delimiter/enclosure variables results in error
|
98 |
+
if (fputcsv($handle, $csv, ',', '"') == 0 ) //$this->delimiter $this->enclosure
|
99 |
+
{
|
100 |
+
Mage::throwException('Problem writing CSV file');
|
101 |
+
}
|
102 |
+
|
103 |
+
fclose($handle);
|
104 |
+
|
105 |
+
} // end
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* If the path does not exist then create it
|
110 |
+
* @param string $path
|
111 |
+
*/
|
112 |
+
public function pathExists($path) {
|
113 |
+
if (!is_dir( $path ) ) {
|
114 |
+
mkdir($path, 0777, true);
|
115 |
+
} // end
|
116 |
+
|
117 |
+
return;
|
118 |
+
|
119 |
+
} // end
|
120 |
+
|
121 |
+
|
122 |
+
protected function arrayToCsv( array &$fields, $delimiter, $enclosure, $encloseAll = false, $nullToMysqlNull = false ) {
|
123 |
+
$delimiter_esc = preg_quote($delimiter, '/');
|
124 |
+
$enclosure_esc = preg_quote($enclosure, '/');
|
125 |
+
|
126 |
+
$output = array();
|
127 |
+
foreach ( $fields as $field ) {
|
128 |
+
if ($field === null && $nullToMysqlNull) {
|
129 |
+
$output[] = 'NULL';
|
130 |
+
continue;
|
131 |
+
}
|
132 |
+
|
133 |
+
// Enclose fields containing $delimiter, $enclosure or whitespace
|
134 |
+
if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) ) {
|
135 |
+
$output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure;
|
136 |
+
}
|
137 |
+
else {
|
138 |
+
$output[] = $field;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
return implode( $delimiter, $output )."\n";
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Delete file or directory
|
147 |
+
* @param $path
|
148 |
+
* @return bool
|
149 |
+
*/
|
150 |
+
public function deleteDir($path)
|
151 |
+
{
|
152 |
+
$class_func = array(__CLASS__, __FUNCTION__);
|
153 |
+
return is_file($path) ?
|
154 |
+
@unlink($path) :
|
155 |
+
array_map($class_func, glob($path.'/*')) == @rmdir($path);
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Helper/Recommended.php
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Helper_Recommended extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_RELATED_PRODUCTS_TYPE = 'dynamic_content/products/related_display_type';
|
6 |
+
const XML_PATH_UPSELL_PRODUCTS_TYPE = 'dynamic_content/products/upsell_display_type';
|
7 |
+
const XML_PATH_CROSSSELL_PRODUCTS_TYPE = 'dynamic_content/products/crosssell_display_type';
|
8 |
+
const XML_PATH_BESTSELLER_PRODUCT_TYPE = 'dynamic_content/products/best_display_type';
|
9 |
+
const XML_PATH_MOSTVIEWED_PRODUCT_TYPE = 'dynamic_content/products/most_viewed_display_type';
|
10 |
+
const XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE = 'dynamic_content/products/recently_viewed_display_type';
|
11 |
+
const XML_PATH_PRODUCTPUSH_TYPE = 'dynamic_content/manual_product_search/display_type';
|
12 |
+
|
13 |
+
|
14 |
+
const XML_PATH_RELATED_PRODUCTS_ITEMS = 'dynamic_content/products/related_items_to_display';
|
15 |
+
const XML_PATH_UPSELL_PRODUCTS_ITEMS = 'dynamic_content/products/upsell_items_to_display';
|
16 |
+
const XML_PATH_CROSSSELL_PRODUCTS_ITEMS = 'dynamic_content/products/crosssell_items_to_display';
|
17 |
+
const XML_PATH_BESTSELLER_PRODUCT_ITEMS = 'dynamic_content/products/best_items_to_display';
|
18 |
+
const XML_PATH_MOSTVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/most_viewed_items_to_display';
|
19 |
+
const XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS = 'dynamic_content/products/recently_viewed_items_to_display';
|
20 |
+
const XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS = 'dynamic_content/manual_product_search/items_to_display';
|
21 |
+
|
22 |
+
|
23 |
+
const XML_PATH_BESTSELLER_TIME_PERIOD = 'dynamic_content/products/best_time_period';
|
24 |
+
const XML_PATH_MOSTVIEWED_TIME_PERIOD = 'dynamic_content/products/most_viewed_time_period';
|
25 |
+
|
26 |
+
const XML_PATH_FALLBACK_PRODUCTS_ITEMS = 'dynamic_content/fallback_products/product_list';
|
27 |
+
|
28 |
+
const XML_PATH_PRODUCTPUSH_ITEMS = 'dynamic_content/manual_product_search/products_push_list';
|
29 |
+
|
30 |
+
public $periods = array('week', 'month', 'year');
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* product recommendation type
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Dispay mode
|
41 |
+
* @return mixed|string grid:list
|
42 |
+
*/
|
43 |
+
public function getMode()
|
44 |
+
{
|
45 |
+
$mode = Mage::app()->getRequest()->getParam('mode');
|
46 |
+
$type = '';
|
47 |
+
if($mode){
|
48 |
+
switch($mode){
|
49 |
+
case 'related':
|
50 |
+
$type = $this->getRelatedProductsType();
|
51 |
+
break;
|
52 |
+
case 'upsell':
|
53 |
+
$type = $this->getUpsellProductsType();
|
54 |
+
break;
|
55 |
+
case 'crosssell':
|
56 |
+
$type = $this->getCrosssellProductsType();
|
57 |
+
break;
|
58 |
+
case 'bestsellers':
|
59 |
+
$type = $this->getBestSellerProductsType();
|
60 |
+
break;
|
61 |
+
case 'mostviewed':
|
62 |
+
$type = $this->getMostViewedProductsType();
|
63 |
+
break;
|
64 |
+
case 'recentlyviewed':
|
65 |
+
$type = $this->getRecentlyviewedProductsType();
|
66 |
+
break;
|
67 |
+
case 'productpush':
|
68 |
+
$type = $this->getProductpushProductsType();
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
return $type;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getRelatedProductsType($storeId = 0)
|
76 |
+
{
|
77 |
+
return Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_TYPE, $storeId);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function getUpsellProductsType($storeId = 0)
|
81 |
+
{
|
82 |
+
return Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_TYPE, $storeId);
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getCrosssellProductsType($storeId = 0)
|
87 |
+
{
|
88 |
+
return Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_TYPE, $storeId);
|
89 |
+
}
|
90 |
+
|
91 |
+
public function getBestSellerProductsType($storeId = 0)
|
92 |
+
{
|
93 |
+
return Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_TYPE, $storeId);
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getMostViewedProductsType($storeId = 0)
|
97 |
+
{
|
98 |
+
return Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_TYPE, $storeId);
|
99 |
+
}
|
100 |
+
|
101 |
+
public function getRecentlyviewedProductsType($storeId = 0)
|
102 |
+
{
|
103 |
+
return Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_TYPE, $storeId);
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getProductpushProductsType($storeId = 0)
|
107 |
+
{
|
108 |
+
return Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_TYPE, $storeId);
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Limit of products displayed
|
115 |
+
* @return int|mixed
|
116 |
+
*/
|
117 |
+
public function getLimit()
|
118 |
+
{
|
119 |
+
$mode = Mage::registry('mode');
|
120 |
+
$limit = 0;
|
121 |
+
if($mode){
|
122 |
+
switch($mode){
|
123 |
+
case 'related':
|
124 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_RELATED_PRODUCTS_ITEMS);
|
125 |
+
break;
|
126 |
+
case 'upsell':
|
127 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_UPSELL_PRODUCTS_ITEMS);
|
128 |
+
break;
|
129 |
+
case 'crosssell':
|
130 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_CROSSSELL_PRODUCTS_ITEMS);
|
131 |
+
break;
|
132 |
+
case 'bestsellers':
|
133 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_PRODUCT_ITEMS);
|
134 |
+
break;
|
135 |
+
case 'mostviewed':
|
136 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_PRODUCT_ITEMS);
|
137 |
+
break;
|
138 |
+
case 'recentlyviewed':
|
139 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_RECENTLYVIEWED_PRODUCT_ITEMS);
|
140 |
+
break;
|
141 |
+
case 'productpush':
|
142 |
+
$limit = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_DISPLAY_ITEMS);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
return $limit;
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getFallbackIds(){
|
150 |
+
$fallbackIds = Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS);
|
151 |
+
if($fallbackIds)
|
152 |
+
return explode(',', Mage::getStoreConfig(self::XML_PATH_FALLBACK_PRODUCTS_ITEMS));
|
153 |
+
return array();
|
154 |
+
}
|
155 |
+
|
156 |
+
public function getTimeFromConfig($config)
|
157 |
+
{
|
158 |
+
$now = new Zend_Date();
|
159 |
+
$period = '';
|
160 |
+
if($config == 'mostviewed')
|
161 |
+
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
162 |
+
elseif($config == 'bestsellers')
|
163 |
+
$period = Mage::getStoreConfig(self::XML_PATH_BESTSELLER_TIME_PERIOD);
|
164 |
+
elseif($config == 'recentlyviewed')
|
165 |
+
$period = Mage::getStoreConfig(self::XML_PATH_MOSTVIEWED_TIME_PERIOD);
|
166 |
+
|
167 |
+
if($period == 'week'){
|
168 |
+
$sub = Zend_Date::WEEK;
|
169 |
+
}elseif($period == 'month'){
|
170 |
+
$sub = Zend_Date::MONTH;
|
171 |
+
}elseif($period == 'year'){
|
172 |
+
$sub = Zend_Date::YEAR;
|
173 |
+
}
|
174 |
+
|
175 |
+
if(isset($sub)){
|
176 |
+
$period = $now->sub(1, $sub);
|
177 |
+
|
178 |
+
return $period->tostring(Zend_Date::ISO_8601);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
public function getProductPushIds($storeId = 0)
|
183 |
+
{
|
184 |
+
$productIds = Mage::getStoreConfig(self::XML_PATH_PRODUCTPUSH_ITEMS, $storeId);
|
185 |
+
|
186 |
+
return explode(',', $productIds);
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Account/Test.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Account_Test extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
const TEST_API_USERNAME = 'apiuser-2c692ba1bbd2@apiconnector.com';
|
6 |
+
const TEST_API_PASSWORD = 'Magento2013';
|
7 |
+
const TEST_API_CAMPAIGN = '2643928';
|
8 |
+
const TEST_CONTACT_ID = '13';
|
9 |
+
const TEST_CONTACT_EMAIL = 'ben.staveley@dotmailer.co.uk';
|
10 |
+
|
11 |
+
public function test($api_user = null, $api_password = null)
|
12 |
+
{
|
13 |
+
if($api_user && $api_password){
|
14 |
+
$this->_api_user = $api_user;
|
15 |
+
$this->_api_password = $api_password;
|
16 |
+
}
|
17 |
+
$response = array('errors' => 0, 'message' => '');
|
18 |
+
$result = $this->testAccount();
|
19 |
+
if(!$result){
|
20 |
+
$response['errors'] = true;
|
21 |
+
$response['message'] = 'Invalid API Credentials.';
|
22 |
+
}
|
23 |
+
$this->sendInstallConfirmation();
|
24 |
+
|
25 |
+
return $response;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function sendInstallConfirmation()
|
29 |
+
{
|
30 |
+
$this->_api_user = self::TEST_API_USERNAME;
|
31 |
+
$this->_api_password = self::TEST_API_PASSWORD;
|
32 |
+
$testEmail = self::TEST_CONTACT_EMAIL;
|
33 |
+
$contactId = self::TEST_CONTACT_ID;
|
34 |
+
$campaignId = self::TEST_API_CAMPAIGN;
|
35 |
+
|
36 |
+
// send initial info
|
37 |
+
$this->sendIntallInfo($testEmail, $contactId, $campaignId);
|
38 |
+
|
39 |
+
}
|
40 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Api/Rest.php
ADDED
@@ -0,0 +1,729 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Api_Rest extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
const REST_WAIT_UPLOAD_TIME = 5;
|
6 |
+
//rest api data
|
7 |
+
const REST_ACCOUNT_INFO = 'https://apiconnector.com/v2/account-info';
|
8 |
+
const REST_CONTACTS = 'https://apiconnector.com/v2/contacts/';
|
9 |
+
const REST_CONTACTS_IMPORT = 'https://apiconnector.com/v2/contacts/import/';
|
10 |
+
const REST_ADDRESS_BOOKS = 'https://apiconnector.com/v2/address-books';
|
11 |
+
const REST_DATA_FILEDS = 'https://apiconnector.com/v2/data-fields';
|
12 |
+
const REST_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/import/';
|
13 |
+
const REST_SINGLE_TRANSACTIONAL_DATA_IMPORT = 'https://apiconnector.com/v2/contacts/transactional-data/';
|
14 |
+
const REST_CAMPAIGN_SEND = 'https://apiconnector.com/v2/campaigns/send';
|
15 |
+
const REST_CONTACTS_SUPPRESSED_SINCE = 'https://apiconnector.com/v2/contacts/suppressed-since/';
|
16 |
+
const REST_DATA_FIELDS_CAMPAIGNS = 'https://apiconnector.com/v2/campaigns';
|
17 |
+
const REST_SMS_MESSAGE_SEND_TO = 'https://apiconnector.com/v2/sms-messages/send-to/';
|
18 |
+
//rest error responces
|
19 |
+
const REST_CONTACT_NOT_FOUND = 'Error: ERROR_CONTACT_NOT_FOUND';
|
20 |
+
const REST_STATUS_IMPORT_REPORT_NOT_FOUND = 'Import is not processed yet or completed with error. ERROR_IMPORT_REPORT_NOT_FOUND';
|
21 |
+
const REST_STATUS_REPORT_NOTFINISHED = 'NotFinished';
|
22 |
+
const REST_TRANSACTIONAL_DATA_NOT_EXISTS = 'Error: ERROR_TRANSACTIONAL_DATA_DOES_NOT_EXIST';
|
23 |
+
const REST_API_USAGE_EXCEEDED = 'Your account has generated excess API activity and is being temporarily capped. Please contact support. ERROR_APIUSAGE_EXCEEDED';
|
24 |
+
|
25 |
+
protected $_api_user;
|
26 |
+
protected $_api_password;
|
27 |
+
protected $_customers_file_slug = 'customer_sync';
|
28 |
+
protected $_subscribers_file_slug = 'subscriber_sync';
|
29 |
+
protected $_api_helper;
|
30 |
+
protected $_subscribers_address_book_id;
|
31 |
+
protected $_customers_address_book_id;
|
32 |
+
protected $_filename;
|
33 |
+
protected $_subscribers_filename;
|
34 |
+
protected $_customers_filename;
|
35 |
+
protected $_limit = 10;
|
36 |
+
protected $_address_book_id;
|
37 |
+
public $fileHelper; /** @var Dotdigitalgroup_Email_Helper_File */
|
38 |
+
protected $_helper;
|
39 |
+
public $result = array('error' => false, 'message' => '');
|
40 |
+
protected $_log_filename = 'api.log';
|
41 |
+
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
// connect to default
|
45 |
+
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
46 |
+
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
47 |
+
$this->_helper = Mage::helper('connector');
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Deletes all contacts from a given address book.
|
52 |
+
* @param $addressBooks
|
53 |
+
* @return mixed
|
54 |
+
*/
|
55 |
+
protected function deleteAddressBookContacts($addressBooks) {
|
56 |
+
|
57 |
+
foreach ($addressBooks as $addressBookId) {
|
58 |
+
|
59 |
+
// skip if contact Id is null otherwise the API will delete ALL contacts from the address book!!!
|
60 |
+
if ($addressBookId==null) continue;
|
61 |
+
$ch = curl_init("https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/");
|
62 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
63 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
64 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
65 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
66 |
+
|
67 |
+
// delete the contact from the address book
|
68 |
+
$result = curl_exec($ch);
|
69 |
+
$result = json_decode($result);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
|
76 |
+
* Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
|
77 |
+
* The ID of returned object can be used to query import progress.
|
78 |
+
* @param $filename
|
79 |
+
* @param $addressBookId
|
80 |
+
* @return mixed
|
81 |
+
*/
|
82 |
+
protected function postAddressBookContactsImport($filename, $addressBookId)
|
83 |
+
{
|
84 |
+
// ...the API request
|
85 |
+
$uploadUrl = "https://apiconnector.com/v2/address-books/{$addressBookId}/contacts/import";
|
86 |
+
$ch = curl_init($uploadUrl);
|
87 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
88 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
89 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, array (
|
90 |
+
'file' => '@'.$this->fileHelper->getFilePath($filename)
|
91 |
+
));
|
92 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
93 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
94 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
95 |
+
'Content-Type: multipart/form-data')
|
96 |
+
);
|
97 |
+
// send contacts to address book
|
98 |
+
$result = curl_exec($ch);
|
99 |
+
$result = json_decode($result);
|
100 |
+
|
101 |
+
return $result;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Adds a contact to a given address book.
|
106 |
+
* @param $addressBookId
|
107 |
+
* @param $contactAPI
|
108 |
+
* @return mixed
|
109 |
+
*/
|
110 |
+
public function postAddressBookContacts($addressBookId, $contactAPI)
|
111 |
+
{
|
112 |
+
$data_string = json_encode($contactAPI);
|
113 |
+
$url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts';
|
114 |
+
$ch = curl_init($url);
|
115 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
116 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
117 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
118 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
119 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
120 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
121 |
+
'Content-Type: application/json',
|
122 |
+
'Content-Length: ' . strlen($data_string))
|
123 |
+
);
|
124 |
+
|
125 |
+
// send campaign
|
126 |
+
$result = curl_exec($ch);
|
127 |
+
$result = json_decode($result);
|
128 |
+
|
129 |
+
return $result;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Deletes all contacts from a given address book.
|
134 |
+
* @param $addressBookId
|
135 |
+
* @param $contactId
|
136 |
+
*/
|
137 |
+
public function deleteAddressBookContact($addressBookId, $contactId)
|
138 |
+
{
|
139 |
+
$url = self::REST_ADDRESS_BOOKS . '/' . $addressBookId . '/contacts/' . $contactId;
|
140 |
+
$ch = curl_init($url);
|
141 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
142 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
143 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
144 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
145 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
146 |
+
'Content-Type: application/json'
|
147 |
+
));
|
148 |
+
$result = curl_exec($ch);
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Gets a report with statistics about what was successfully imported, and what was unable to be imported.
|
153 |
+
* @param $importId
|
154 |
+
* @return mixed
|
155 |
+
*/
|
156 |
+
public function getContactsImportReport($importId)
|
157 |
+
{
|
158 |
+
$reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
|
159 |
+
$ch = curl_init($reportUrl);
|
160 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
161 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
162 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
163 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
164 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
165 |
+
'Content-Type: application/json')
|
166 |
+
);
|
167 |
+
// get the report
|
168 |
+
$result = curl_exec($ch);
|
169 |
+
$result = json_decode($result);
|
170 |
+
return $result;
|
171 |
+
}
|
172 |
+
|
173 |
+
public function getContacts($skip = 0, $limit = 1000)
|
174 |
+
{
|
175 |
+
$allContactsUrl = self::REST_CONTACTS . '?select=' . $limit . '&skip=' . $skip;
|
176 |
+
$ch = curl_init($allContactsUrl);
|
177 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
178 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
179 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
180 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
181 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
182 |
+
'Content-Type: application/json'
|
183 |
+
));
|
184 |
+
$data = curl_exec($ch);
|
185 |
+
$result = json_decode($data);
|
186 |
+
|
187 |
+
return $result;
|
188 |
+
}
|
189 |
+
|
190 |
+
public function getContactByEmail($email)
|
191 |
+
{
|
192 |
+
$contactInfoUrl = self::REST_CONTACTS . $email;
|
193 |
+
$ch = curl_init($contactInfoUrl);
|
194 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
195 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
196 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
197 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
198 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
199 |
+
'Content-Type: application/json'
|
200 |
+
));
|
201 |
+
|
202 |
+
$data = curl_exec($ch);
|
203 |
+
$result = json_decode($data);
|
204 |
+
|
205 |
+
return $result;
|
206 |
+
}
|
207 |
+
public function getContactById($contactId)
|
208 |
+
{
|
209 |
+
$contactInfoUrl = self::REST_CONTACTS . $contactId;
|
210 |
+
$ch = curl_init($contactInfoUrl);
|
211 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
212 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
213 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
214 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
215 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
216 |
+
'Content-Type: application/json'
|
217 |
+
));
|
218 |
+
|
219 |
+
$data = curl_exec($ch);
|
220 |
+
$result = json_decode($data);
|
221 |
+
|
222 |
+
return $result;
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Creates an address book.
|
227 |
+
* @return mixed
|
228 |
+
*/
|
229 |
+
public function postAddressBooks()
|
230 |
+
{
|
231 |
+
$contactInfoUrl = self::REST_ADDRESS_BOOKS;
|
232 |
+
$ch = curl_init($contactInfoUrl);
|
233 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
234 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
235 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
236 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
237 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
238 |
+
'Content-Type: application/json'
|
239 |
+
));
|
240 |
+
$data = curl_exec($ch);
|
241 |
+
$result = json_decode($data);
|
242 |
+
return $result;
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Creates a campaign.
|
247 |
+
* @return mixed
|
248 |
+
*/
|
249 |
+
protected function postCampaigns(){
|
250 |
+
$contactInfoUrl = self::REST_DATA_FIELDS_CAMPAIGNS;
|
251 |
+
$ch = curl_init($contactInfoUrl);
|
252 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
|
253 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
254 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
255 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
256 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
257 |
+
'Content-Type: application/json'
|
258 |
+
));
|
259 |
+
$data = curl_exec($ch);
|
260 |
+
$result = json_decode($data);
|
261 |
+
return $result;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Creates a data field within the account.
|
266 |
+
* @return mixed
|
267 |
+
*/
|
268 |
+
protected function postDataFields() {
|
269 |
+
$contactInfoUrl = self::REST_DATA_FILEDS;
|
270 |
+
$ch_contact = curl_init($contactInfoUrl);
|
271 |
+
curl_setopt($ch_contact, CURLOPT_CUSTOMREQUEST, 'GET');
|
272 |
+
curl_setopt($ch_contact, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
273 |
+
curl_setopt($ch_contact, CURLOPT_RETURNTRANSFER, true);
|
274 |
+
curl_setopt($ch_contact, CURLOPT_SSL_VERIFYPEER, false);
|
275 |
+
curl_setopt($ch_contact, CURLOPT_HTTPHEADER, array(
|
276 |
+
'Content-Type: application/json'
|
277 |
+
));
|
278 |
+
$data = curl_exec($ch_contact);
|
279 |
+
$result = json_decode($data);
|
280 |
+
return $result;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
|
285 |
+
* Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
|
286 |
+
* The ID of returned object can be used to query import progress.
|
287 |
+
* @param bool $waitFinished
|
288 |
+
* @return mixed
|
289 |
+
*/
|
290 |
+
private function postContactsImport($waitFinished = false){
|
291 |
+
$importUrl = self::REST_CONTACTS_IMPORT;
|
292 |
+
$ch = curl_init($importUrl);
|
293 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
294 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
295 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, array (
|
296 |
+
'file' => '@'.$this->getFilePath($this->_filename)
|
297 |
+
));
|
298 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
299 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
300 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
301 |
+
'Content-Type: multipart/form-data')
|
302 |
+
);
|
303 |
+
$result = curl_exec($ch);
|
304 |
+
$result = json_decode($result);
|
305 |
+
|
306 |
+
if($waitFinished)
|
307 |
+
$this->waitFinishedImport($result->id);
|
308 |
+
return $result;
|
309 |
+
}
|
310 |
+
public function updateContact($contactId, $data)
|
311 |
+
{
|
312 |
+
$data_string = json_encode($data);
|
313 |
+
$contactInfoUrl = self::REST_CONTACTS . $contactId;
|
314 |
+
$ch = curl_init($contactInfoUrl);
|
315 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
|
316 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
317 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
318 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
319 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
320 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
321 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
322 |
+
'Content-Type: application/json',
|
323 |
+
'Content-Length: ' . strlen($data_string))
|
324 |
+
);
|
325 |
+
$data = curl_exec($ch);
|
326 |
+
$result = json_decode($data);
|
327 |
+
return $result;
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Send connector campaings
|
332 |
+
* @param $campaignId
|
333 |
+
* @param $contacts
|
334 |
+
* @return mixed
|
335 |
+
*/
|
336 |
+
public function sendCampaign($campaignId, $contacts)
|
337 |
+
{
|
338 |
+
$data = array(
|
339 |
+
'username' => $this->_api_user,
|
340 |
+
'password' => $this->_api_password,
|
341 |
+
"campaignId" => $campaignId,
|
342 |
+
"ContactIds" => $contacts
|
343 |
+
);
|
344 |
+
|
345 |
+
$this->_helper->log($data, null, $this->_log_filename);
|
346 |
+
$data_string = json_encode($data);
|
347 |
+
$campaignUrl = self::REST_CAMPAIGN_SEND;
|
348 |
+
$ch = curl_init($campaignUrl);
|
349 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
350 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
351 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
352 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
353 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
354 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
355 |
+
'Content-Type: application/json',
|
356 |
+
'Content-Length: ' . strlen($data_string))
|
357 |
+
);
|
358 |
+
|
359 |
+
// send campaign
|
360 |
+
$result = curl_exec($ch);
|
361 |
+
$result = json_decode($result);
|
362 |
+
$this->_helper->log($result, null, $this->_log_filename);
|
363 |
+
|
364 |
+
return $result;
|
365 |
+
}
|
366 |
+
private function waitFinishedImport($importId){
|
367 |
+
|
368 |
+
do{
|
369 |
+
// wait until do the report status call
|
370 |
+
sleep(self::REST_WAIT_UPLOAD_TIME);
|
371 |
+
// ...the API request
|
372 |
+
// Create a GET request
|
373 |
+
|
374 |
+
$reportUrl = self::REST_CONTACTS_IMPORT . "{$importId}/report";
|
375 |
+
$ch = curl_init($reportUrl);
|
376 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
377 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
378 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
379 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
380 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
381 |
+
'Content-Type: application/json')
|
382 |
+
);
|
383 |
+
|
384 |
+
// get the report
|
385 |
+
$result = curl_exec($ch);
|
386 |
+
$result = json_decode($result);
|
387 |
+
|
388 |
+
}while(isset($result->message) && $result->message == self::REST_STATUS_REPORT_NOTFINISHED);
|
389 |
+
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* create new connector contact
|
394 |
+
* @param $email
|
395 |
+
* @return mixed
|
396 |
+
*/
|
397 |
+
public function createNewContact($email)
|
398 |
+
{
|
399 |
+
$data = array(
|
400 |
+
'Email' => $email,
|
401 |
+
'EmailType' => 'Html'
|
402 |
+
);
|
403 |
+
$data_string = json_encode($data);
|
404 |
+
$ch = curl_init(self::REST_CONTACTS);
|
405 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
406 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
407 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
408 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
409 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
410 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
411 |
+
'Content-Type: application/json',
|
412 |
+
'Content-Length: ' . strlen($data_string))
|
413 |
+
);
|
414 |
+
$result = curl_exec($ch);
|
415 |
+
$result = json_decode($result);
|
416 |
+
|
417 |
+
return $result;
|
418 |
+
}
|
419 |
+
|
420 |
+
public function sendIntallInfo($testEmail, $contactId, $campaignId)
|
421 |
+
{
|
422 |
+
$numProducts = Mage::getModel('catalog/product')->getCollection()->getSize();
|
423 |
+
$numCustomers = Mage::getModel('customer/customer')->getCollection()->getSize();
|
424 |
+
|
425 |
+
$data = array(
|
426 |
+
'Email' => $testEmail,
|
427 |
+
'EmailType' => 'Html',
|
428 |
+
'DataFields' => array(
|
429 |
+
array(
|
430 |
+
'Key' => 'INSTALLCUSTOMERS',
|
431 |
+
'Value' => (string)$numCustomers),
|
432 |
+
array(
|
433 |
+
'Key' => 'INSTALLPRODUCTS',
|
434 |
+
'Value' => (string)$numProducts),
|
435 |
+
array(
|
436 |
+
'Key' => 'INSTALLURL',
|
437 |
+
'Value' => Mage::getBaseUrl()),
|
438 |
+
array(
|
439 |
+
'Key' => 'INSTALLAPI',
|
440 |
+
'Value' => implode(',' , $this->getWebsiteAccounts())),
|
441 |
+
array(
|
442 |
+
'Key' => 'PHPMEMORY',
|
443 |
+
'Value' => ini_get('memory_limit') . ', V=' . Mage::helper('connector')->getConnectorVersion()
|
444 |
+
)
|
445 |
+
)
|
446 |
+
);
|
447 |
+
|
448 |
+
$this->updateContact($contactId, $data);
|
449 |
+
$this->sendCampaign($campaignId, array($contactId));
|
450 |
+
|
451 |
+
return ;
|
452 |
+
}
|
453 |
+
private function getWebsiteAccounts()
|
454 |
+
{
|
455 |
+
$accounts = array();
|
456 |
+
$websites = Mage::app()->getWebsites();
|
457 |
+
foreach ($websites as $website) {
|
458 |
+
$websiteId = $website->getWebsiteId();
|
459 |
+
$websiteModel = Mage::app()->getWebsite($websiteId);
|
460 |
+
$apiUsername = $websiteModel->getConfig('connector_api_settings/api_credentials/username');
|
461 |
+
if(! in_array($apiUsername, $accounts))
|
462 |
+
$accounts[] = $apiUsername;
|
463 |
+
}
|
464 |
+
return $accounts;
|
465 |
+
}
|
466 |
+
|
467 |
+
protected function getSuppressedSince($dateString)
|
468 |
+
{
|
469 |
+
$suppressedUrl = self::REST_CONTACTS_SUPPRESSED_SINCE . $dateString;
|
470 |
+
$ch = curl_init($suppressedUrl);
|
471 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
472 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
473 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
474 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
475 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
476 |
+
'Content-Type: application/json'
|
477 |
+
));
|
478 |
+
|
479 |
+
// get the list of suppressed contacts
|
480 |
+
$data = curl_exec($ch);
|
481 |
+
$data = json_decode($data);
|
482 |
+
|
483 |
+
return $data;
|
484 |
+
|
485 |
+
}
|
486 |
+
public function sendMultiTransactionalData($ordersData, $collectionName = 'Order')
|
487 |
+
{
|
488 |
+
$orders = array();
|
489 |
+
foreach ($ordersData as $order) {
|
490 |
+
if(isset($order->connector_id)){
|
491 |
+
$orders[] = array(
|
492 |
+
'Key' => $order->id,
|
493 |
+
'ContactIdentifier' => $order->connector_id,
|
494 |
+
'Json' => json_encode($order->expose())
|
495 |
+
);
|
496 |
+
}
|
497 |
+
}
|
498 |
+
|
499 |
+
$data_string = json_encode($orders);
|
500 |
+
$transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
|
501 |
+
|
502 |
+
$ch = curl_init($transactionalUrl);
|
503 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
504 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
505 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
506 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
507 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
508 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
509 |
+
'Content-Type: application/json',
|
510 |
+
'Content-Length: ' . strlen($data_string))
|
511 |
+
);
|
512 |
+
|
513 |
+
// send contacts to connector
|
514 |
+
$result = curl_exec($ch);
|
515 |
+
$result = json_decode($result);
|
516 |
+
|
517 |
+
return $result;
|
518 |
+
}
|
519 |
+
protected function sendTransactionalData($quoteData, $collectionName = 'Basket')
|
520 |
+
{
|
521 |
+
// check if the transactional data is already set
|
522 |
+
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $quoteData->id ;
|
523 |
+
$ch = curl_init($transactionalUrl);
|
524 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
525 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
526 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
527 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
528 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
529 |
+
'Content-Type: application/json'
|
530 |
+
));
|
531 |
+
$result = curl_exec($ch);
|
532 |
+
$result = json_decode($result);
|
533 |
+
|
534 |
+
if(isset($result->message) && $result->message == self::REST_TRANSACTIONAL_DATA_NOT_EXISTS)
|
535 |
+
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName ;
|
536 |
+
else
|
537 |
+
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $result->key ;
|
538 |
+
|
539 |
+
|
540 |
+
$data = array(
|
541 |
+
'Key' => $quoteData->id,
|
542 |
+
'ContactIdentifier' => $quoteData->connector_id,
|
543 |
+
'Json' => json_encode($quoteData->expose())
|
544 |
+
);
|
545 |
+
|
546 |
+
|
547 |
+
$data_string = json_encode($data);
|
548 |
+
|
549 |
+
$ch = curl_init($transactionalUrl);
|
550 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
551 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
552 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
553 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
554 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
555 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
556 |
+
'Content-Type: application/json',
|
557 |
+
'Content-Length: ' . strlen($data_string))
|
558 |
+
);
|
559 |
+
|
560 |
+
// send contacts to connector
|
561 |
+
$result = curl_exec($ch);
|
562 |
+
$result = json_decode($result);
|
563 |
+
|
564 |
+
return $result;
|
565 |
+
}
|
566 |
+
|
567 |
+
public function sendOrderTransactionalData($order, $collectionName = 'Order', $key = '')
|
568 |
+
{
|
569 |
+
$data = array(
|
570 |
+
'Key' => $order->id,
|
571 |
+
'ContactIdentifier' => $order->connector_id,
|
572 |
+
'Json' => json_encode($order->expose())
|
573 |
+
);
|
574 |
+
|
575 |
+
|
576 |
+
$data_string = json_encode($data);
|
577 |
+
|
578 |
+
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
|
579 |
+
|
580 |
+
$ch = curl_init($transactionalUrl);
|
581 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
582 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
583 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
584 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
585 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
586 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
587 |
+
'Content-Type: application/json',
|
588 |
+
'Content-Length: ' . strlen($data_string))
|
589 |
+
);
|
590 |
+
|
591 |
+
// send contacts to connector
|
592 |
+
$result = curl_exec($ch);
|
593 |
+
$result = json_decode($result);
|
594 |
+
|
595 |
+
if(! isset($result->message)){
|
596 |
+
$this->removeTransactionalData($order->connector_id, 'Basket');
|
597 |
+
}
|
598 |
+
|
599 |
+
return $result;
|
600 |
+
}
|
601 |
+
public function deleteContactsTransactionalData($collectionName = 'Order', $key = '')
|
602 |
+
{
|
603 |
+
|
604 |
+
$transactionalUrl = self::REST_SINGLE_TRANSACTIONAL_DATA_IMPORT . $collectionName . '/' . $key;
|
605 |
+
|
606 |
+
$ch = curl_init($transactionalUrl);
|
607 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
608 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
609 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
610 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
611 |
+
|
612 |
+
// send contacts to connector
|
613 |
+
$result = curl_exec($ch);
|
614 |
+
$result = json_decode($result);
|
615 |
+
|
616 |
+
|
617 |
+
return $result;
|
618 |
+
}
|
619 |
+
|
620 |
+
public function removeTransactionalData($contactId, $collectionName)
|
621 |
+
{
|
622 |
+
$transactionalUrl = 'https://apiconnector.com/v2/contacts/' . $contactId . '/transactional-data/' . $collectionName ;
|
623 |
+
$ch = curl_init($transactionalUrl);
|
624 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
625 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
626 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
627 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
628 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
629 |
+
'Content-Type: application/json'
|
630 |
+
));
|
631 |
+
$result = curl_exec($ch);
|
632 |
+
|
633 |
+
}
|
634 |
+
|
635 |
+
public function testAccount()
|
636 |
+
{
|
637 |
+
$url = self::REST_ACCOUNT_INFO;
|
638 |
+
$ch = curl_init($url);
|
639 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
640 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
641 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
642 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
643 |
+
$result = curl_exec($ch);
|
644 |
+
$result = json_decode($result);
|
645 |
+
if(isset($result->message)){
|
646 |
+
return false;
|
647 |
+
}
|
648 |
+
|
649 |
+
return true;
|
650 |
+
}
|
651 |
+
|
652 |
+
public function getAddressBookContacts($bookId, $skip = 0)
|
653 |
+
{
|
654 |
+
/**
|
655 |
+
* https://apiconnector.com/v2/address-books/{addressBookId}/contacts?withFullData={withFullData}&select={select}&skip={skip}
|
656 |
+
*/
|
657 |
+
$url = self::REST_ADDRESS_BOOKS . '/' . $bookId . '/contacts' . '?skip=' . $skip;
|
658 |
+
|
659 |
+
$ch = curl_init($url);
|
660 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
661 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
662 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
663 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
664 |
+
$result = curl_exec($ch);
|
665 |
+
$result = json_decode($result);
|
666 |
+
return $result;
|
667 |
+
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Send a single SMS message.
|
672 |
+
* @param $number
|
673 |
+
* @param $message
|
674 |
+
* @return mixed
|
675 |
+
*/
|
676 |
+
public function postSmsMessagesSendTo($telephoneNumber, $message)
|
677 |
+
{
|
678 |
+
$data = array('Message' => $message);
|
679 |
+
$data_string = json_encode($data);
|
680 |
+
$ch = curl_init(self::REST_SMS_MESSAGE_SEND_TO . $telephoneNumber);
|
681 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
682 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
683 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
684 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
685 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
686 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
687 |
+
'Content-Type: application/json',
|
688 |
+
'Content-Length: ' . strlen($data_string))
|
689 |
+
);
|
690 |
+
$result = curl_exec($ch);
|
691 |
+
$result = json_decode($result);
|
692 |
+
return $result;
|
693 |
+
}
|
694 |
+
|
695 |
+
public function postContactsTransactionalDataImport($collectionName, $data = array())
|
696 |
+
{
|
697 |
+
$import = array();
|
698 |
+
|
699 |
+
foreach ($data as $one) {
|
700 |
+
|
701 |
+
$import[] = array(
|
702 |
+
'Key' => $one->getId(),
|
703 |
+
'ContactIdentifier' => $one->getCustomerId(),
|
704 |
+
'Json' => json_encode($one->expose())
|
705 |
+
);
|
706 |
+
}
|
707 |
+
|
708 |
+
$data_string = json_encode($import);
|
709 |
+
|
710 |
+
$transactionalUrl = self::REST_TRANSACTIONAL_DATA_IMPORT . $collectionName;
|
711 |
+
|
712 |
+
$ch = curl_init($transactionalUrl);
|
713 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
714 |
+
curl_setopt($ch, CURLOPT_USERPWD, $this->_api_user . ':' . $this->_api_password);
|
715 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
716 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
717 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
718 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
719 |
+
'Content-Type: application/json',
|
720 |
+
'Content-Length: ' . strlen($data_string))
|
721 |
+
);
|
722 |
+
|
723 |
+
// send contacts to connector
|
724 |
+
$result = curl_exec($ch);
|
725 |
+
$result = json_decode($result);
|
726 |
+
|
727 |
+
return $result;
|
728 |
+
}
|
729 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Connector/Account.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Account
|
4 |
+
{
|
5 |
+
private $_api_username;
|
6 |
+
private $_api_password;
|
7 |
+
private $_limit;
|
8 |
+
private $_contactBookId;
|
9 |
+
private $_subscriberBookId;
|
10 |
+
private $_websites = array();
|
11 |
+
private $_csv_headers;
|
12 |
+
private $_customers_filename;
|
13 |
+
private $_subscribers_filename;
|
14 |
+
private $_mapping_hash;
|
15 |
+
private $_contacts = array();
|
16 |
+
private $_orders = array();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param mixed $api_password
|
20 |
+
*/
|
21 |
+
public function setApiPassword($api_password)
|
22 |
+
{
|
23 |
+
$this->_api_password = $api_password;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @return mixed
|
28 |
+
*/
|
29 |
+
public function getApiPassword()
|
30 |
+
{
|
31 |
+
return $this->_api_password;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param mixed $api_username
|
36 |
+
*/
|
37 |
+
public function setApiUsername($api_username)
|
38 |
+
{
|
39 |
+
$this->_api_username = $api_username;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
public function getApiUsername()
|
46 |
+
{
|
47 |
+
return $this->_api_username;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @param string $contactBookId
|
52 |
+
*/
|
53 |
+
public function setContactBookId($contactBookId)
|
54 |
+
{
|
55 |
+
$this->_contactBookId[$contactBookId] = $contactBookId;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @return array
|
60 |
+
*/
|
61 |
+
public function getContactBookIds()
|
62 |
+
{
|
63 |
+
return $this->_contactBookId;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param array $contacts
|
68 |
+
*/
|
69 |
+
public function setContacts($contacts)
|
70 |
+
{
|
71 |
+
// if(!empty($this->_contacts)){
|
72 |
+
// $this->_contacts += $contacts;
|
73 |
+
// }else{
|
74 |
+
|
75 |
+
$this->_contacts[] = $contacts;
|
76 |
+
//}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @return array
|
81 |
+
*/
|
82 |
+
public function getContacts()
|
83 |
+
{
|
84 |
+
return $this->_contacts;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @param mixed $customers_filename
|
89 |
+
*/
|
90 |
+
public function setCustomersFilename($customers_filename)
|
91 |
+
{
|
92 |
+
$this->_customers_filename = $customers_filename;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @return mixed
|
97 |
+
*/
|
98 |
+
public function getCustomersFilename()
|
99 |
+
{
|
100 |
+
return $this->_customers_filename;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @param mixed $limit
|
105 |
+
*/
|
106 |
+
public function setLimit($limit)
|
107 |
+
{
|
108 |
+
$this->_limit = $limit;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @return mixed
|
113 |
+
*/
|
114 |
+
public function getLimit()
|
115 |
+
{
|
116 |
+
return $this->_limit;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* @param mixed $mapping_hash
|
121 |
+
*/
|
122 |
+
public function setMappingHash($mapping_hash)
|
123 |
+
{
|
124 |
+
$this->_mapping_hash = $mapping_hash;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @return mixed
|
129 |
+
*/
|
130 |
+
public function getMappingHash()
|
131 |
+
{
|
132 |
+
return $this->_mapping_hash;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @param array $orders
|
137 |
+
*/
|
138 |
+
public function setOrders($orders)
|
139 |
+
{
|
140 |
+
foreach ($orders as $order) {
|
141 |
+
|
142 |
+
$this->_orders[$order->id] = $order;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @return array
|
148 |
+
*/
|
149 |
+
public function getOrders()
|
150 |
+
{
|
151 |
+
return $this->_orders;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* @param string $subscriberBookId
|
156 |
+
*/
|
157 |
+
public function setSubscriberBookId($subscriberBookId)
|
158 |
+
{
|
159 |
+
$this->_subscriberBookId[$subscriberBookId] = $subscriberBookId;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @return array
|
164 |
+
*/
|
165 |
+
public function getSubscriberBookIds()
|
166 |
+
{
|
167 |
+
return $this->_subscriberBookId;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param mixed $subscribers_filename
|
172 |
+
*/
|
173 |
+
public function setSubscribersFilename($subscribers_filename)
|
174 |
+
{
|
175 |
+
$this->_subscribers_filename = $subscribers_filename;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @return mixed
|
180 |
+
*/
|
181 |
+
public function getSubscribersFilename()
|
182 |
+
{
|
183 |
+
return $this->_subscribers_filename;
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* @param mixed $csv_headers
|
188 |
+
*/
|
189 |
+
public function setCsvHeaders($csv_headers)
|
190 |
+
{
|
191 |
+
$this->_csv_headers = $csv_headers;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @return mixed
|
196 |
+
*/
|
197 |
+
public function getCsvHeaders()
|
198 |
+
{
|
199 |
+
return $this->_csv_headers;
|
200 |
+
}
|
201 |
+
/**
|
202 |
+
* @param mixed $websites
|
203 |
+
*/
|
204 |
+
public function setWebsites($websites)
|
205 |
+
{
|
206 |
+
$this->_websites[] = $websites;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* @return mixed
|
211 |
+
*/
|
212 |
+
public function getWebsites()
|
213 |
+
{
|
214 |
+
return $this->_websites;
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Connector/Customer.php
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Customer{
|
4 |
+
|
5 |
+
// Unique identifier for Dotmail: Email
|
6 |
+
private $_email;
|
7 |
+
|
8 |
+
// Customer Info Data
|
9 |
+
private $_firstname;
|
10 |
+
private $_lastname;
|
11 |
+
private $_dob;
|
12 |
+
private $_gender;
|
13 |
+
private $_title;
|
14 |
+
private $_website_created_on;
|
15 |
+
private $_store_created_on;
|
16 |
+
private $_account_created;
|
17 |
+
private $_last_logged_in;
|
18 |
+
private $_customer_group;
|
19 |
+
// Customer Address Data
|
20 |
+
private $_billing_address_1;
|
21 |
+
private $_billing_address_2;
|
22 |
+
private $_billing_city;
|
23 |
+
private $_billing_country;
|
24 |
+
private $_billing_postcode;
|
25 |
+
private $_billing_telephone;
|
26 |
+
private $_delivery_address_1;
|
27 |
+
private $_delivery_address_2;
|
28 |
+
private $_delivery_city;
|
29 |
+
private $_delivery_country;
|
30 |
+
private $_delivery_postcode;
|
31 |
+
private $_delivery_telephone;
|
32 |
+
// Customer Sales Data
|
33 |
+
private $_total_orders;
|
34 |
+
private $_average_order_value;
|
35 |
+
private $_total_spend;
|
36 |
+
private $_last_order;
|
37 |
+
private $_last_order_no;
|
38 |
+
// Newletter subscriber?
|
39 |
+
private $_is_subscribed_to_newsletter;
|
40 |
+
private $_dotmailer_contact_id;
|
41 |
+
private $_customer_id;
|
42 |
+
|
43 |
+
/**
|
44 |
+
'firstname',
|
45 |
+
'lastname',
|
46 |
+
'dob',
|
47 |
+
'gender',
|
48 |
+
'title',
|
49 |
+
'website_created_on',
|
50 |
+
'store_created_on',
|
51 |
+
'account_created',
|
52 |
+
'last_logged_in',
|
53 |
+
'customer_group',
|
54 |
+
'billing_address_1',
|
55 |
+
'billing_address_2',
|
56 |
+
'billing_city',
|
57 |
+
'billing_country',
|
58 |
+
'billing_postcode',
|
59 |
+
'billing_telephone',
|
60 |
+
'delivery_address_1',
|
61 |
+
'delivery_address_2',
|
62 |
+
'delivery_city',
|
63 |
+
'delivery_country',
|
64 |
+
'delivery_postcode',
|
65 |
+
'delivery_telephone',
|
66 |
+
'total_orders',
|
67 |
+
'average_order_value',
|
68 |
+
'total_spend',
|
69 |
+
'last_order',
|
70 |
+
'last_order_no'
|
71 |
+
*
|
72 |
+
*/
|
73 |
+
|
74 |
+
public function getEmail()
|
75 |
+
{
|
76 |
+
return $this->_email;
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
public function setDotmailerContactId($dotmailer_contact_id)
|
81 |
+
{
|
82 |
+
$this->_dotmailer_contact_id = $dotmailer_contact_id;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getDotmailerContactId()
|
86 |
+
{
|
87 |
+
return $this->_dotmailer_contact_id;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function isSubscribed()
|
91 |
+
{
|
92 |
+
return $this->_is_subscribed_to_newsletter;
|
93 |
+
}
|
94 |
+
|
95 |
+
private $_mapping_hash;
|
96 |
+
|
97 |
+
|
98 |
+
// class constructor - takes
|
99 |
+
public function __construct(Mage_Customer_Model_Customer $customer, $mapping_hash){
|
100 |
+
|
101 |
+
$this->_mapping_hash = $mapping_hash;
|
102 |
+
|
103 |
+
// map each attribute from the $customer parameter (collection item) to the corresponding scoped variable in this class
|
104 |
+
$this->id = $customer->getId();
|
105 |
+
$this->_email = $customer->getEmail();
|
106 |
+
$this->_firstname = $customer->getFirstname();
|
107 |
+
$this->_lastname = $customer->getLastname();
|
108 |
+
$this->_dob = $customer->getDob();
|
109 |
+
$this->_gender = $this->getCustomerGender($customer->getGender());
|
110 |
+
$this->_title = $customer->getPrefix();
|
111 |
+
|
112 |
+
$this->_website_created_on = $this->getWebsiteName($customer->getWebsiteId());
|
113 |
+
$this->_store_created_on = $this->getStoreName($customer->getStoreId());
|
114 |
+
$this->_account_created = $customer->getCreatedAt();
|
115 |
+
$this->_last_logged_in = $customer->getLastLoggedIn();
|
116 |
+
$this->_customer_group = $this->getCustomerGroup($customer->getGroupId());
|
117 |
+
$this->_billing_address_1 = $this->getStreet($customer->getBillingStreet(), 1);
|
118 |
+
$this->_billing_address_2 = $this->getStreet($customer->getBillingStreet(), 2);
|
119 |
+
|
120 |
+
$this->_billing_city = $customer->getBillingCity();
|
121 |
+
$this->_billing_country = $customer->getBillingCountryCode();
|
122 |
+
$this->_billing_postcode = $customer->getBillingPostcode();
|
123 |
+
$this->_billing_telephone = $customer->getBillingTelephone();
|
124 |
+
|
125 |
+
$this->_delivery_address_1 = $this->getStreet($customer->getShippingStreet(), 1);
|
126 |
+
$this->_delivery_address_2 = $this->getStreet($customer->getShippingStreet(), 2);
|
127 |
+
|
128 |
+
$this->_delivery_city = $customer->getShippingCity();
|
129 |
+
$this->_delivery_country = $customer->getShippingCountryCode();
|
130 |
+
$this->_delivery_postcode = $customer->getShippingPostcode();
|
131 |
+
$this->_delivery_telephone = $customer->getShippingTelephone();
|
132 |
+
|
133 |
+
$this->_total_orders = $customer->getTotalOrders();
|
134 |
+
$this->_average_order_value = $customer->getAverageOrderValue();
|
135 |
+
$this->_total_spend = $customer->getTotalSpend();
|
136 |
+
|
137 |
+
$lastOrder = new Zend_Date($customer->getLastPurchase());
|
138 |
+
//$this->_last_order = $lastOrder->toString(Zend_Date::ISO_8601);
|
139 |
+
$this->_last_order = $customer->getLastPurchase();
|
140 |
+
$this->_last_order_no = $customer->getLastOrderNo();
|
141 |
+
|
142 |
+
$this->_is_subscribed_to_newsletter = ($customer->getSubscriberStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)? true : false;
|
143 |
+
$this->_dotmailer_contact_id = $customer->getDotmailerContactId();
|
144 |
+
$this->_customer_id = $customer->getId();
|
145 |
+
}
|
146 |
+
|
147 |
+
public function toCSVArray() {
|
148 |
+
|
149 |
+
// no iterating, just create an array()
|
150 |
+
|
151 |
+
$result = array();
|
152 |
+
|
153 |
+
// Email is the only required field in the CSV upload
|
154 |
+
$result[] = $this->_email;
|
155 |
+
|
156 |
+
if ($this->_mapping_hash[0]!="0") $result[] = $this->_firstname;
|
157 |
+
if ($this->_mapping_hash[1]!="0") $result[] = $this->_lastname;
|
158 |
+
if ($this->_mapping_hash[2]!="0") $result[] = $this->_dob;
|
159 |
+
if ($this->_mapping_hash[3]!="0") $result[] = $this->_gender;
|
160 |
+
if ($this->_mapping_hash[4]!="0") $result[] = $this->_title;
|
161 |
+
|
162 |
+
if ($this->_mapping_hash[5]!="0") $result[] = $this->_website_created_on;
|
163 |
+
if ($this->_mapping_hash[6]!="0") $result[] = $this->_store_created_on;
|
164 |
+
if ($this->_mapping_hash[7]!="0") $result[] = $this->_account_created;
|
165 |
+
if ($this->_mapping_hash[8]!="0") $result[] = $this->_last_logged_in;
|
166 |
+
if ($this->_mapping_hash[9]!="0") $result[] = $this->_customer_group;
|
167 |
+
|
168 |
+
if ($this->_mapping_hash[10]!="0") $result[] = $this->_billing_address_1;
|
169 |
+
if ($this->_mapping_hash[11]!="0") $result[] = $this->_billing_address_2;
|
170 |
+
if ($this->_mapping_hash[12]!="0") $result[] = $this->_billing_city;
|
171 |
+
if ($this->_mapping_hash[13]!="0") $result[] = $this->_billing_country;
|
172 |
+
if ($this->_mapping_hash[14]!="0") $result[] = $this->_billing_postcode;
|
173 |
+
if ($this->_mapping_hash[15]!="0") $result[] = $this->_billing_telephone;
|
174 |
+
|
175 |
+
if ($this->_mapping_hash[16]!="0") $result[] = $this->_delivery_address_1;
|
176 |
+
if ($this->_mapping_hash[17]!="0") $result[] = $this->_delivery_address_2;
|
177 |
+
if ($this->_mapping_hash[18]!="0") $result[] = $this->_delivery_city;
|
178 |
+
if ($this->_mapping_hash[19]!="0") $result[] = $this->_delivery_country;
|
179 |
+
if ($this->_mapping_hash[20]!="0") $result[] = $this->_delivery_postcode;
|
180 |
+
if ($this->_mapping_hash[21]!="0") $result[] = $this->_delivery_telephone;
|
181 |
+
|
182 |
+
if ($this->_mapping_hash[22]!="0") $result[] = $this->_total_orders;
|
183 |
+
if ($this->_mapping_hash[23]!="0") $result[] = $this->_average_order_value;
|
184 |
+
if ($this->_mapping_hash[24]!="0") $result[] = $this->_total_spend;
|
185 |
+
if ($this->_mapping_hash[25]!="0") $result[] = $this->_last_order;
|
186 |
+
if ($this->_mapping_hash[26]!="0") $result[] = $this->_last_order_no;
|
187 |
+
if ($this->_mapping_hash[27]!="0") $result[] = $this->_customer_id;
|
188 |
+
|
189 |
+
$result[] = 'Html';
|
190 |
+
|
191 |
+
return $result;
|
192 |
+
|
193 |
+
}
|
194 |
+
|
195 |
+
// returns the object as JSON
|
196 |
+
public function toJSON(){
|
197 |
+
|
198 |
+
return json_encode($this->expose());
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
// exposes the class as an array of objects
|
203 |
+
public function expose() {
|
204 |
+
|
205 |
+
return get_object_vars($this);
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* return the gender text label
|
211 |
+
* @param $genderId customer option id
|
212 |
+
* @return string
|
213 |
+
*/
|
214 |
+
public function getCustomerGender($genderId)
|
215 |
+
{
|
216 |
+
if(is_numeric($genderId)){
|
217 |
+
$gender = Mage::getResourceModel('customer/customer')
|
218 |
+
->getAttribute('gender')
|
219 |
+
->getSource()
|
220 |
+
->getOptionText($genderId)
|
221 |
+
;
|
222 |
+
return $gender;
|
223 |
+
}
|
224 |
+
|
225 |
+
return '';
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* get the street name by line number
|
230 |
+
* @param $street
|
231 |
+
* @param $line
|
232 |
+
* @return string
|
233 |
+
*/
|
234 |
+
public function getStreet($street, $line)
|
235 |
+
{
|
236 |
+
$street = explode("\n", $street);
|
237 |
+
if($line == 1){
|
238 |
+
return $street[0];
|
239 |
+
}
|
240 |
+
if(isset($street[$line -1])){
|
241 |
+
|
242 |
+
return $street[$line - 1];
|
243 |
+
}else{
|
244 |
+
|
245 |
+
return '';
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* get website name
|
251 |
+
* @param $websiteId
|
252 |
+
* @return null|string
|
253 |
+
*/
|
254 |
+
public function getWebsiteName($websiteId)
|
255 |
+
{
|
256 |
+
$website = Mage::app()->getWebsite($websiteId);
|
257 |
+
if($website)
|
258 |
+
return $website->getName();
|
259 |
+
|
260 |
+
return '';
|
261 |
+
}
|
262 |
+
|
263 |
+
public function getStoreName($storeId)
|
264 |
+
{
|
265 |
+
$store = Mage::app()->getStore($storeId);
|
266 |
+
if($store)
|
267 |
+
return $store->getName();
|
268 |
+
|
269 |
+
return '';
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* get the group name
|
274 |
+
* @param $groupId
|
275 |
+
* @return string
|
276 |
+
*/
|
277 |
+
public function getCustomerGroup($groupId)
|
278 |
+
{
|
279 |
+
$group = Mage::getModel('customer/group')->load($groupId);
|
280 |
+
if($group){
|
281 |
+
return $group->getCode();
|
282 |
+
}
|
283 |
+
return '';
|
284 |
+
}
|
285 |
+
|
286 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Connector/Order.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Order
|
4 |
+
{
|
5 |
+
public $id;
|
6 |
+
public $connector_id;
|
7 |
+
public $customer_id;
|
8 |
+
protected $store_name;
|
9 |
+
protected $purchase_date;
|
10 |
+
protected $delivery_address;
|
11 |
+
protected $billing_address;
|
12 |
+
protected $products = array();
|
13 |
+
protected $order_subtotal;
|
14 |
+
protected $discount_ammount;
|
15 |
+
protected $order_total;
|
16 |
+
public $quote_id;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* set the order information
|
20 |
+
* @param Mage_Sales_Model_Order $orderData
|
21 |
+
*/
|
22 |
+
public function __construct(Mage_Sales_Model_Order $orderData)
|
23 |
+
{
|
24 |
+
$this->id = $orderData->getIncrementId();
|
25 |
+
$this->store_name = $orderData->getStoreName();
|
26 |
+
|
27 |
+
$created_at = new Zend_Date($orderData->getCreatedAt(), Zend_Date::ISO_8601);
|
28 |
+
$this->purchase_date = $created_at->toString(Zend_Date::ISO_8601);
|
29 |
+
$this->customer_id = $orderData->getCustomerId();
|
30 |
+
|
31 |
+
$customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
|
32 |
+
if(!$customerModel->getDotmailerContactId()){
|
33 |
+
Mage::helper('connector')->log('dotmailer id not found : ' . $customerModel->getDotmailerContactId() . ' ' . $this->customer_id . ' ' . $this->id);
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
$this->connector_id = $customerModel->getDotmailerContactId();
|
39 |
+
$this->quote_id = $orderData->getQuoteId();
|
40 |
+
|
41 |
+
/**
|
42 |
+
* billing and shipping address
|
43 |
+
*/
|
44 |
+
$deliveryData = $orderData->getShippingAddress()->getData();
|
45 |
+
$this->delivery_address = array(
|
46 |
+
'delivery_address_1' => $this->getStreet($deliveryData['street'], 1),
|
47 |
+
'delivery_address_2' => $this->getStreet($deliveryData['street'], 2),
|
48 |
+
'delivery_city' => $deliveryData['city'],
|
49 |
+
'delivery_country' => $deliveryData['country_id'],
|
50 |
+
'delivery_postcode' => $deliveryData['postcode']
|
51 |
+
);
|
52 |
+
$billingData = $orderData->getBillingAddress()->getData();
|
53 |
+
$this->billing_address = array(
|
54 |
+
'billing_address_1' => $this->getStreet($billingData['street'], 1),
|
55 |
+
'billing_address_2' => $this->getStreet($billingData['street'], 2),
|
56 |
+
'billing_city' => $billingData['city'],
|
57 |
+
'billing_country' => $billingData['country_id'],
|
58 |
+
'billing_postcode' => $billingData['postcode'],
|
59 |
+
);
|
60 |
+
//order products information
|
61 |
+
$products = $orderData->getAllItems();
|
62 |
+
$categories = array();
|
63 |
+
foreach ($products as $productItem) {
|
64 |
+
// product model
|
65 |
+
$product = $productItem->getProduct();
|
66 |
+
if($product){
|
67 |
+
// category names
|
68 |
+
$categoryCollection = $product->getCategoryCollection()
|
69 |
+
->addAttributeToSelect('name');
|
70 |
+
|
71 |
+
foreach ($categoryCollection as $cat) {
|
72 |
+
$categories[] = $cat->getName();
|
73 |
+
}
|
74 |
+
$categoryNames = implode(',', $categories);
|
75 |
+
}
|
76 |
+
|
77 |
+
$this->products[] = array(
|
78 |
+
'name' => $productItem->getName(),
|
79 |
+
'sku' => $productItem->getSku(),
|
80 |
+
'category' => $categoryNames,
|
81 |
+
'qty' => (int)number_format($productItem->getData('qty_ordered'), 2),
|
82 |
+
'price' => (float)number_format($productItem->getPrice(), 2),
|
83 |
+
);
|
84 |
+
}
|
85 |
+
$this->order_subtotal = (float)number_format($orderData->getData('subtotal'), 2);
|
86 |
+
$this->discount_ammount = (float)number_format($orderData->getData('discount_amount'), 2);
|
87 |
+
$orderTotal = abs($orderData->getData('grand_total') - $orderData->getTotalRefunded());
|
88 |
+
$this->order_total = (float)number_format($orderTotal, 2);
|
89 |
+
|
90 |
+
}
|
91 |
+
/**
|
92 |
+
* get the street name by line number
|
93 |
+
* @param $street
|
94 |
+
* @param $line
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
private function getStreet($street, $line)
|
98 |
+
{
|
99 |
+
$street = explode("\n", $street);
|
100 |
+
if($line == 1){
|
101 |
+
return $street[0];
|
102 |
+
}
|
103 |
+
if(isset($street[$line -1])){
|
104 |
+
|
105 |
+
return $street[$line - 1];
|
106 |
+
}else{
|
107 |
+
|
108 |
+
return '';
|
109 |
+
}
|
110 |
+
}
|
111 |
+
// exposes the class as an array of objects
|
112 |
+
public function expose() {
|
113 |
+
|
114 |
+
return get_object_vars($this);
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Connector/Quote.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Quote
|
4 |
+
{
|
5 |
+
|
6 |
+
public $id;
|
7 |
+
public $connector_id;
|
8 |
+
public $customer_id;
|
9 |
+
protected $store_name;
|
10 |
+
protected $create_date;
|
11 |
+
protected $update_date;
|
12 |
+
protected $delivery_address;
|
13 |
+
protected $billing_address;
|
14 |
+
protected $products = array();
|
15 |
+
protected $order_subtotal;
|
16 |
+
protected $order_total;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* set the quote information
|
20 |
+
* @param Mage_Sales_Model_Quote $quote
|
21 |
+
*/
|
22 |
+
public function __construct(Mage_Sales_Model_Quote $quote)
|
23 |
+
{
|
24 |
+
$this->id = $quote->getId();
|
25 |
+
$this->customer_id = $quote->getCustomerId();
|
26 |
+
$customerModel = Mage::getModel('customer/customer')->load($this->customer_id);
|
27 |
+
$this->connector_id = $customerModel->getData('dotmailer_contact_id');
|
28 |
+
|
29 |
+
$this->store_name = $this->getStoreName($quote->getStoreId());
|
30 |
+
$this->order_subtotal = (float)number_format($quote->getSubtotal(), 2);
|
31 |
+
$this->order_total = (float)number_format($quote->getGrandTotal(), 2);
|
32 |
+
|
33 |
+
$created_at = new Zend_Date($quote->getCreatedAt(), Zend_Date::ISO_8601);
|
34 |
+
$updated_at = new Zend_Date($quote->getUpdatedAt(), Zend_Date::ISO_8601);
|
35 |
+
$this->create_date = $created_at->toString(Zend_Date::ISO_8601);
|
36 |
+
$this->update_date = $updated_at->toString(Zend_Date::ISO_8601);
|
37 |
+
|
38 |
+
$items = $quote->getAllVisibleItems();
|
39 |
+
foreach ($items as $product) {
|
40 |
+
$this->products[] = array(
|
41 |
+
'name' => $product->getName(),
|
42 |
+
'sku' => $product->getSku(),
|
43 |
+
'category' => $this->getCategory($product),
|
44 |
+
'qty' => (float)number_format($product->getQty(), 2),
|
45 |
+
'price' => (float)number_format($product->getPrice(), 2)
|
46 |
+
);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
private function getStoreName($storeId)
|
50 |
+
{
|
51 |
+
$storeModel = Mage::getModel('core/store')->load($storeId);
|
52 |
+
return $storeModel->getName();
|
53 |
+
}
|
54 |
+
private function getCategory($product)
|
55 |
+
{
|
56 |
+
$product = Mage::getModel('catalog/product')->load($product->getProductId());
|
57 |
+
$categories = $product->getCategoryCollection()
|
58 |
+
->addAttributeToSelect('name');
|
59 |
+
$categoryNames = array();
|
60 |
+
foreach ($categories as $cat) {
|
61 |
+
$categoryNames[] = $cat->getName();
|
62 |
+
}
|
63 |
+
|
64 |
+
$categoryNames = implode(',', $categoryNames);
|
65 |
+
return $categoryNames;
|
66 |
+
|
67 |
+
}
|
68 |
+
// exposes the class as an array of objects
|
69 |
+
public function expose() {
|
70 |
+
|
71 |
+
return get_object_vars($this);
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Connector/Wishlist.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Connector_Wishlist
|
4 |
+
{
|
5 |
+
protected $id;
|
6 |
+
protected $customer_id;
|
7 |
+
protected $connector_id;
|
8 |
+
|
9 |
+
public $name;
|
10 |
+
|
11 |
+
public $items = array();
|
12 |
+
|
13 |
+
protected $total_wishlist_value;
|
14 |
+
|
15 |
+
public function __construct($customer){
|
16 |
+
|
17 |
+
$this->setConnectorId($customer->getDotmailerContactId());
|
18 |
+
$this->setCustomerId($customer->id);
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @param mixed $connector_id
|
23 |
+
*/
|
24 |
+
public function setConnectorId($connector_id)
|
25 |
+
{
|
26 |
+
$this->connector_id = $connector_id;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return mixed
|
31 |
+
*/
|
32 |
+
public function getConnectorId()
|
33 |
+
{
|
34 |
+
return $this->connector_id;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param mixed $customer_id
|
40 |
+
*/
|
41 |
+
public function setCustomerId($customer_id)
|
42 |
+
{
|
43 |
+
$this->customer_id = $customer_id;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return mixed
|
49 |
+
*/
|
50 |
+
public function getCustomerId()
|
51 |
+
{
|
52 |
+
return $this->customer_id;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param mixed $id
|
57 |
+
*/
|
58 |
+
public function setId($id)
|
59 |
+
{
|
60 |
+
$this->id = $id;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @return mixed
|
65 |
+
*/
|
66 |
+
public function getId()
|
67 |
+
{
|
68 |
+
return $this->id;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function setItem($item)
|
72 |
+
{
|
73 |
+
$this->items[] = $item->expose();
|
74 |
+
|
75 |
+
$this->total_wishlist_value += $item->getTotalValueOfProduct();
|
76 |
+
}
|
77 |
+
|
78 |
+
public function expose() {
|
79 |
+
|
80 |
+
return get_object_vars($this);
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Cron.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Model_Cron
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* CRON FOR CUSTOMER SYNC
|
6 |
+
*/
|
7 |
+
public function customersync()
|
8 |
+
{
|
9 |
+
if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SYNC_ENABLE))
|
10 |
+
Mage::getModel('connector/customer_customer')->sync();
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* CRON FOR LOST BASKET
|
16 |
+
*/
|
17 |
+
public function lostbasketssync()
|
18 |
+
{
|
19 |
+
//look for lost baskets
|
20 |
+
Mage::getModel('connector/sales_quote')->proccessCampaigns();
|
21 |
+
$helper = Mage::helper('connector');
|
22 |
+
if($helper->isOrderTransactionalEnabled()){
|
23 |
+
//send transactional data and mark as imported
|
24 |
+
Mage::getModel('connector/sales_order')->sync();
|
25 |
+
}
|
26 |
+
if($helper->isCustomerSyncEnabled()){
|
27 |
+
//check for customer that have no connector id
|
28 |
+
$numUpdated = Mage::getModel('connector/customer_customer')->syncContacts();
|
29 |
+
Mage::helper('connector')->log('SYNC CONTACTS : '. $numUpdated);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* CRON FOR SUPRESSED CONTACTS
|
35 |
+
*/
|
36 |
+
public function suppressedsync()
|
37 |
+
{
|
38 |
+
if(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMER_SUPPRESSED_ENABLE)){
|
39 |
+
//check suppressed contacts from connector
|
40 |
+
Mage::getModel('connector/customer_suppressed')->unsubscribe();
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* CLEAN ARHIVED FOLDERS
|
47 |
+
*/
|
48 |
+
|
49 |
+
public function cleaning()
|
50 |
+
{
|
51 |
+
$helper = Mage::helper('connector/file');
|
52 |
+
$archivedFolder = $helper->getArchiveFolder();
|
53 |
+
$result = $helper->deleteDir($archivedFolder);
|
54 |
+
Mage::helper('connector')->log('Cleaning cronjob result : ' . $result, null, 'api.log');
|
55 |
+
return $result;
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Customer/Customer.php
ADDED
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Customer extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
// xml configuration
|
6 |
+
const XML_PATH_CONNECTOR_API_USERNAME = 'connector_api_settings/api_credentials/username';
|
7 |
+
const XML_PATH_CONNECTOR_API_PASSWORD = 'connector_api_settings/api_credentials/password';
|
8 |
+
const XML_PATH_CUSTOMER_SYNC_ENABLE = 'connector_sync_settings/sync_customer_schedule/enabled';
|
9 |
+
const XML_PATH_CUSTOMER_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/contact';
|
10 |
+
const XML_PATH_CUSTOMER_SUPPRESSED_ENABLE = 'connector_sync_settings/sync_suppressed_schedule/enabled';
|
11 |
+
const XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/customers';
|
12 |
+
const XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL = 'connector_sync_settings/sync_suppressed_schedule/frequency';
|
13 |
+
const XML_PATH_GUEST_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/guest';
|
14 |
+
const XML_PATH_CUSTOMER_WISHLIST_ENABLED = 'connector_sync_settings/transactional_data/wishlist_enabled';
|
15 |
+
|
16 |
+
const FORCE_CUSTOMERS_YEARS = '10';
|
17 |
+
|
18 |
+
protected $_customers_address_book_id;
|
19 |
+
protected $_customers = array();
|
20 |
+
protected $_mapping_hash;
|
21 |
+
protected $_website; // website model
|
22 |
+
private $countSubscribers = 0;
|
23 |
+
private $countCustomers = 0;
|
24 |
+
|
25 |
+
protected $accounts = array();// api accounts
|
26 |
+
protected $wishlists = array();// wishlists
|
27 |
+
protected $_proccessing;
|
28 |
+
protected $_websiteId;
|
29 |
+
public $apiLimit = 450;
|
30 |
+
|
31 |
+
public function sync()
|
32 |
+
{
|
33 |
+
/** @var Dotdigitalgroup_Email_Helper_Data $helper */
|
34 |
+
$helper = Mage::helper('connector');
|
35 |
+
$helper->log('Start customer sync..', null, $this->_log_filename);
|
36 |
+
$result = array('error' => false, 'message' => "Done.");
|
37 |
+
|
38 |
+
// check for default settings to use memory limit
|
39 |
+
if(Mage::getStoreConfig('connector_advanced_settings/admin/memory_limit'))
|
40 |
+
$this->allowResourceFullExecution();
|
41 |
+
|
42 |
+
// get all websites
|
43 |
+
foreach(Mage::app()->getWebsites() as $website){
|
44 |
+
|
45 |
+
// skip any actions if sync disabled
|
46 |
+
if(! $website->getConfig(self::XML_PATH_CUSTOMER_SYNC_ENABLE))
|
47 |
+
continue;
|
48 |
+
//API credentials
|
49 |
+
$this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
|
50 |
+
$this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
|
51 |
+
|
52 |
+
if(strlen($this->_api_user) > 10 && strlen($this->_api_password)){
|
53 |
+
|
54 |
+
$result = $this->exportCustomersForWebsite($website);
|
55 |
+
if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
|
56 |
+
$this->exportWishlistsForWebsite($website);
|
57 |
+
}
|
58 |
+
}else{
|
59 |
+
$result['error'] = true;
|
60 |
+
$message = 'The Credentials For Website :' . $website->getCode() . ' is not set!';
|
61 |
+
$result['message'] = $message;
|
62 |
+
$helper->log($message, null, $this->_log_filename);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
//set result check
|
66 |
+
if($this->countCustomers != 0){
|
67 |
+
|
68 |
+
$message = 'Total Exported : ' . $this->countCustomers . ' Customers, ' . $this->countSubscribers . ' Subscribers.';
|
69 |
+
|
70 |
+
$result['message'] = $message;
|
71 |
+
$helper->log($message, null, $this->_log_filename);
|
72 |
+
}else{
|
73 |
+
$result['error'] = true;
|
74 |
+
$message = 'Check the logs for more information, the number of updated customers is : 0.';
|
75 |
+
$result['message'] = $message;
|
76 |
+
}
|
77 |
+
|
78 |
+
$helper->log('Customer sync end!', null, $this->_log_filename);
|
79 |
+
return $result;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Get the customer for the website
|
84 |
+
* @param bool $websiteId
|
85 |
+
* @return mixed
|
86 |
+
*/
|
87 |
+
public function getContactsCustomers($websiteId = false)
|
88 |
+
{
|
89 |
+
/** @var Mage_Customer_Model_Customer $customerCollection */
|
90 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
91 |
+
->addAttributeToSelect('dotmailer_contact_id')
|
92 |
+
->addAttributeToFilter('dotmailer_contact_id', array('notnull' => true), 'left')
|
93 |
+
;
|
94 |
+
if($websiteId !== false)
|
95 |
+
$customerCollection->addAttributeToFilter('website_id', $websiteId);
|
96 |
+
|
97 |
+
return $customerCollection;
|
98 |
+
}
|
99 |
+
|
100 |
+
private function countNumOfContacts($contacts)
|
101 |
+
{
|
102 |
+
$total = 0;
|
103 |
+
// Get contacts number with contact id
|
104 |
+
foreach ($contacts as $contact) {
|
105 |
+
if($contact->getDotmailerContactId())
|
106 |
+
$total++;
|
107 |
+
}
|
108 |
+
unset($contacts);
|
109 |
+
return $total;
|
110 |
+
}
|
111 |
+
|
112 |
+
public function syncContacts()
|
113 |
+
{
|
114 |
+
$updated = 0;
|
115 |
+
/**
|
116 |
+
* Customers at website level
|
117 |
+
*/
|
118 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
119 |
+
$websiteId = $website->getId();
|
120 |
+
$missingContacts = $this->getMissingContacts($websiteId, $this->apiLimit);
|
121 |
+
Mage::helper('connector')->log('API LIMIT : ' . $this->apiLimit, null, 'api.log');
|
122 |
+
Mage::helper('connector')->log($missingContacts->count(), null, 'api.log');
|
123 |
+
if(count($missingContacts) == 0)
|
124 |
+
continue;
|
125 |
+
//save customer and trigger the obsever
|
126 |
+
foreach($missingContacts as $customer){
|
127 |
+
try{
|
128 |
+
$customer->save();
|
129 |
+
$updated++;
|
130 |
+
//limit the number of updated contacts
|
131 |
+
if($this->apiLimit == $updated){
|
132 |
+
return $updated;
|
133 |
+
}
|
134 |
+
}catch (Exception $e){
|
135 |
+
Mage::logException($e);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
return $updated;
|
140 |
+
}
|
141 |
+
public function getMissingContacts($websiteId = null, $limit = 200)
|
142 |
+
{
|
143 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
144 |
+
->addAttributeToSelect('dotmailer_contact_id')
|
145 |
+
->addAttributeToFilter('dotmailer_contact_id', array('null' => true), 'left')
|
146 |
+
->setPageSize($limit)
|
147 |
+
;
|
148 |
+
if($websiteId !== null)
|
149 |
+
$customerCollection->addAttributeToFilter('website_id', $websiteId);
|
150 |
+
|
151 |
+
return $customerCollection;
|
152 |
+
}
|
153 |
+
public function getTotalNumberCustomers()
|
154 |
+
{
|
155 |
+
$customers = Mage::getModel('customer/customer')->getCollection();
|
156 |
+
$totalCustomers = $customers->getSize();
|
157 |
+
|
158 |
+
return $totalCustomers;
|
159 |
+
}
|
160 |
+
|
161 |
+
public function countSkipContacts($contacts = false, $websiteId)
|
162 |
+
{
|
163 |
+
if($contacts)
|
164 |
+
$numContactIds = $this->countNumOfContacts($contacts);
|
165 |
+
else
|
166 |
+
$numContactIds = count($this->getContactsCustomers($websiteId));
|
167 |
+
|
168 |
+
|
169 |
+
return $numContactIds;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @param Mage_Core_Model_Website $website
|
174 |
+
* @return $this
|
175 |
+
*/
|
176 |
+
public function exportCustomersForWebsite(Mage_Core_Model_Website $website)
|
177 |
+
{
|
178 |
+
$websiteCode = $website->getCode();
|
179 |
+
$websiteId = $website->getId();
|
180 |
+
$customer_filename = $websiteCode . '_' . $this->_customers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
|
181 |
+
$subscriber_filename = $websiteCode . '_' . $this->_subscribers_file_slug . '_' . date('d-M-Y_hms') . '.csv';
|
182 |
+
$helper = Mage::helper('connector');
|
183 |
+
|
184 |
+
$helper->log('customer filename : ' . $customer_filename . ', subscriber filename : ' . $subscriber_filename, null, $this->_log_filename);
|
185 |
+
|
186 |
+
$pageNum = 1;
|
187 |
+
$pageSize = $website->getConfig('connector_advanced_settings/admin/batch_size');
|
188 |
+
if($pageSize == '') $pageSize = 5000;
|
189 |
+
$this->fileHelper = Mage::helper('connector/file');
|
190 |
+
|
191 |
+
do{
|
192 |
+
$time_start = microtime(true);
|
193 |
+
|
194 |
+
$currentBatch = $this->getCustomersToExport($pageSize, $pageNum, $this->getMappingHash($website), $website->getId());
|
195 |
+
$condition = count($currentBatch);
|
196 |
+
//write the csv headers
|
197 |
+
if($pageNum == 1 && count($currentBatch)){
|
198 |
+
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $this->getCsvHeaderArray($website));
|
199 |
+
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array('Email', 'emailType'));
|
200 |
+
}
|
201 |
+
foreach ($currentBatch as $customer) {
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Send wishlist as transactional data
|
205 |
+
*/
|
206 |
+
if($website->getConfig(self::XML_PATH_CUSTOMER_WISHLIST_ENABLED)){
|
207 |
+
$this->setWishlists($customer, $website);
|
208 |
+
}
|
209 |
+
// check if customer is subscribed
|
210 |
+
if($customer->isSubscribed()){
|
211 |
+
// save data for subscribers
|
212 |
+
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($customer->getEmail(), 'Html'));
|
213 |
+
$this->countSubscribers++;
|
214 |
+
}
|
215 |
+
|
216 |
+
// save data for csutomers
|
217 |
+
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($customer_filename), $customer->toCSVArray());
|
218 |
+
$this->countCustomers++;
|
219 |
+
}
|
220 |
+
$time_end = microtime(true);
|
221 |
+
$time_in_seconds = $time_end - $time_start;
|
222 |
+
|
223 |
+
$helper->log('-----------------------------------------------execution time :' . gmdate("H:i:s", $time_in_seconds), null, $this->_log_filename);
|
224 |
+
$pageNum++;
|
225 |
+
unset($currentBatch);
|
226 |
+
|
227 |
+
}while( $condition == $pageSize );
|
228 |
+
|
229 |
+
$storeIds = Mage::getModel('core/website')->load($websiteId)
|
230 |
+
->getStoreIds();
|
231 |
+
$subscriberModel = new Dotdigitalgroup_Email_Model_Newsletter_Subscriber();
|
232 |
+
$subscribersNotCustomers = $subscriberModel->getSubscribersNotCustomers($storeIds);
|
233 |
+
|
234 |
+
foreach ($subscribersNotCustomers as $one) {
|
235 |
+
$this->fileHelper->outputCSV($this->fileHelper->getFilePath($subscriber_filename), array($one->getSubscriberEmail()));
|
236 |
+
$this->countSubscribers++;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Save customers and subscribers to address books
|
241 |
+
*/
|
242 |
+
$this->postAddressBookContactsImport($customer_filename, $website->getConfig(self::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID));
|
243 |
+
$this->postAddressBookContactsImport($subscriber_filename, $website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID));
|
244 |
+
|
245 |
+
//If successful, archive the CSV file and Log something in the Magento Log - success/failure
|
246 |
+
if(file_exists($this->fileHelper->getFilePath($customer_filename)) && file_exists($this->fileHelper->getFilePath($subscriber_filename))){
|
247 |
+
$this->fileHelper->archiveCSV($customer_filename);
|
248 |
+
$this->fileHelper->archiveCSV($subscriber_filename);
|
249 |
+
}
|
250 |
+
return $this;
|
251 |
+
|
252 |
+
}
|
253 |
+
|
254 |
+
private function exportWishlistsForWebsite(Mage_Core_Model_Website $website){
|
255 |
+
|
256 |
+
$this->_api_user = $website->getConfig(self::XML_PATH_CONNECTOR_API_USERNAME);
|
257 |
+
$this->_api_password = $website->getConfig(self::XML_PATH_CONNECTOR_API_PASSWORD);
|
258 |
+
//wishlists for the website key
|
259 |
+
if(isset($this->wishlists[$website->getId()])){
|
260 |
+
|
261 |
+
//send wishlists as transactional data
|
262 |
+
$wishlists = $this->wishlists[$website->getId()];
|
263 |
+
|
264 |
+
$this->postContactsTransactionalDataImport($collectionName = 'Wishlist', $wishlists);
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
public function getCustomersToExport($pageSize = 0, $pageNum = 1, $mappingHash, $websiteId)
|
269 |
+
{
|
270 |
+
// the filtering and aggregation of all the customer data here
|
271 |
+
$customers = array();
|
272 |
+
$helper = Mage::helper('connector');
|
273 |
+
|
274 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection()
|
275 |
+
->addAttributeToSelect('email')
|
276 |
+
->addAttributeToSelect('firstname')
|
277 |
+
->addAttributeToSelect('lastname')
|
278 |
+
->addAttributeToSelect('dob')
|
279 |
+
->addAttributeToSelect('gender')
|
280 |
+
->addAttributeToSelect('prefix')
|
281 |
+
->addAttributeToSelect('website_id')
|
282 |
+
->addAttributeToSelect('store_id')
|
283 |
+
->addAttributeToSelect('created_at')
|
284 |
+
->addAttributeToSelect('last_logged_in')
|
285 |
+
->addAttributeToSelect('group_id')
|
286 |
+
->addAttributeToSelect('dob')
|
287 |
+
->addAttributeToSelect('dotmailer_contact_id')
|
288 |
+
|
289 |
+
->addAttributeToFilter('website_id', $websiteId)
|
290 |
+
|
291 |
+
->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
|
292 |
+
->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
|
293 |
+
->joinAttribute('billing_country_code', 'customer_address/country_id', 'default_billing', null, 'left')
|
294 |
+
->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
|
295 |
+
->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
|
296 |
+
->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
|
297 |
+
->joinAttribute('shipping_street', 'customer_address/street', 'default_shipping', null, 'left')
|
298 |
+
->joinAttribute('shipping_city', 'customer_address/city', 'default_shipping', null, 'left')
|
299 |
+
->joinAttribute('shipping_country_code', 'customer_address/country_id', 'default_shipping', null, 'left')
|
300 |
+
->joinAttribute('shipping_postcode', 'customer_address/postcode', 'default_shipping', null, 'left')
|
301 |
+
->joinAttribute('shipping_telephone', 'customer_address/telephone', 'default_shipping', null, 'left')
|
302 |
+
->joinAttribute('shipping_region', 'customer_address/region', 'default_shipping', null, 'left')
|
303 |
+
->joinTable('newsletter/subscriber','subscriber_email=email',array('subscriber_status' => 'subscriber_status'), null, 'left')
|
304 |
+
|
305 |
+
;
|
306 |
+
if( $pageSize ){
|
307 |
+
$customerCollection->setPage($pageNum, $pageSize);
|
308 |
+
}
|
309 |
+
|
310 |
+
$customer_log = Mage::getSingleton('core/resource')->getTableName('log_customer');
|
311 |
+
$sales_flat_order_grid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
|
312 |
+
$sales_flat_order = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
313 |
+
|
314 |
+
// get the last login from the log_customer table
|
315 |
+
$customerCollection->getSelect()->columns(array('last_logged_in' => new Zend_Db_Expr ("(SELECT login_at
|
316 |
+
FROM $customer_log
|
317 |
+
WHERE customer_id =e.entity_id
|
318 |
+
ORDER BY log_id DESC
|
319 |
+
LIMIT 1)")));
|
320 |
+
|
321 |
+
// customer order information
|
322 |
+
$alias = 'subselect';
|
323 |
+
$subselect = Mage::getModel('Varien_Db_Select',
|
324 |
+
Mage::getSingleton('core/resource')->getConnection('core_read')
|
325 |
+
)->from($sales_flat_order_grid, array(
|
326 |
+
'customer_id as s_customer_id',
|
327 |
+
'sum(grand_total) as total_spend',
|
328 |
+
'count(*) as total_orders',
|
329 |
+
'avg(grand_total) as average_order_value',
|
330 |
+
)
|
331 |
+
)->group('customer_id')
|
332 |
+
;
|
333 |
+
$customerCollection->getSelect()->columns(array(
|
334 |
+
'last_purchase' => new Zend_Db_Expr("(SELECT created_at
|
335 |
+
FROM $sales_flat_order
|
336 |
+
WHERE customer_id =e.entity_id
|
337 |
+
ORDER BY created_at DESC
|
338 |
+
LIMIT 1)"),
|
339 |
+
'last_order_no' => new Zend_Db_Expr("(SELECT entity_id
|
340 |
+
FROM $sales_flat_order
|
341 |
+
WHERE customer_id =e.entity_id
|
342 |
+
ORDER BY created_at DESC
|
343 |
+
LIMIT 1)")
|
344 |
+
));
|
345 |
+
|
346 |
+
$customerCollection->getSelect()
|
347 |
+
->joinLeft(array($alias => $subselect),
|
348 |
+
"{$alias}.s_customer_id = e.entity_id");
|
349 |
+
|
350 |
+
|
351 |
+
|
352 |
+
$time = microtime(true);
|
353 |
+
// create a customer object for each item in our collection
|
354 |
+
foreach ($customerCollection as $item) {
|
355 |
+
|
356 |
+
$customers[] = new Dotdigitalgroup_Email_Model_Connector_Customer($item, $mappingHash);
|
357 |
+
}
|
358 |
+
|
359 |
+
unset($customerCollection);
|
360 |
+
$end_time = microtime(true);
|
361 |
+
$end = $end_time - $time;
|
362 |
+
|
363 |
+
|
364 |
+
$helper->log($pageSize . ': page' . $pageNum . ' for website: ' . $websiteId, null, $this->_log_filename);
|
365 |
+
$helper->log('created dotmailer customers from collection: ' . gmdate("H:i:s", $end), null, $this->_log_filename);
|
366 |
+
|
367 |
+
return $customers;
|
368 |
+
}
|
369 |
+
|
370 |
+
protected function allowResourceFullExecution() {
|
371 |
+
|
372 |
+
/* it may be needed to set maximum execution time of the script to longer,
|
373 |
+
* like 60 minutes than usual */
|
374 |
+
set_time_limit ( 7200 );
|
375 |
+
|
376 |
+
/* and memory to 512 megabytes */
|
377 |
+
ini_set ( 'memory_limit', '512M' );
|
378 |
+
|
379 |
+
return $this;
|
380 |
+
}
|
381 |
+
function convert($size)
|
382 |
+
{
|
383 |
+
$unit=array('b','kb','mb','gb','tb','pb');
|
384 |
+
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
|
385 |
+
}
|
386 |
+
|
387 |
+
/**
|
388 |
+
* Create an array of columns we have chosen to map in our System->Config
|
389 |
+
* @param Mage_Core_Model_Website $website
|
390 |
+
* @return array
|
391 |
+
*/
|
392 |
+
public function getCsvHeaderArray(Mage_Core_Model_Website $website) {
|
393 |
+
|
394 |
+
$result = array();
|
395 |
+
|
396 |
+
$result[] = 'Email';
|
397 |
+
|
398 |
+
foreach ($this->getMappingHash($website) as $header) {
|
399 |
+
if ($header != "0") $result[] = $header;
|
400 |
+
}
|
401 |
+
$result[] = 'emailType';
|
402 |
+
|
403 |
+
return $result;
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Gets the datafield mapping hash from the system config
|
408 |
+
* @param Mage_Core_Model_Website $website
|
409 |
+
* @return array
|
410 |
+
*/
|
411 |
+
protected function getMappingHash(Mage_Core_Model_Website $website){
|
412 |
+
|
413 |
+
|
414 |
+
$customer_fields = array(
|
415 |
+
'customer_data/firstname',
|
416 |
+
'customer_data/lastname',
|
417 |
+
'customer_data/dob',
|
418 |
+
'customer_data/gender',
|
419 |
+
'customer_data/title',
|
420 |
+
'customer_data/website_created_on',
|
421 |
+
'customer_data/store_created_on',
|
422 |
+
'customer_data/account_created',
|
423 |
+
'customer_data/last_logged_in',
|
424 |
+
'customer_data/customer_group',
|
425 |
+
'customer_data/billing_address_1',
|
426 |
+
'customer_data/billing_address_2',
|
427 |
+
'customer_data/billing_city',
|
428 |
+
'customer_data/billing_country',
|
429 |
+
'customer_data/billing_postcode',
|
430 |
+
'customer_data/billing_telephone',
|
431 |
+
'customer_data/delivery_address_1',
|
432 |
+
'customer_data/delivery_address_2',
|
433 |
+
'customer_data/delivery_city',
|
434 |
+
'customer_data/delivery_country',
|
435 |
+
'customer_data/delivery_postcode',
|
436 |
+
'customer_data/delivery_telephone',
|
437 |
+
'customer_data/total_orders',
|
438 |
+
'customer_data/average_order_value',
|
439 |
+
'customer_data/total_spend',
|
440 |
+
'customer_data/last_order',
|
441 |
+
'customer_data/last_order_no',
|
442 |
+
'customer_data/customer_id'
|
443 |
+
);
|
444 |
+
|
445 |
+
$result = array();
|
446 |
+
|
447 |
+
foreach ($customer_fields as $field) {
|
448 |
+
|
449 |
+
$result[] = $website->getConfig('connector_data_field_settings/' . $field);
|
450 |
+
|
451 |
+
}
|
452 |
+
return $result;
|
453 |
+
}
|
454 |
+
|
455 |
+
public function setWishlists($customer, $website)
|
456 |
+
{
|
457 |
+
$customerId = $customer->id;
|
458 |
+
$wishList = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId);
|
459 |
+
|
460 |
+
/** @var $connectorWishlist */
|
461 |
+
$connectorWishlist = new Dotdigitalgroup_Email_Model_Connector_Wishlist($customer);
|
462 |
+
$connectorWishlist->setId($wishList->getId());
|
463 |
+
|
464 |
+
$wishListItemCollection = $wishList->getItemCollection();
|
465 |
+
|
466 |
+
if (count($wishListItemCollection)) {
|
467 |
+
foreach ($wishListItemCollection as $item) {
|
468 |
+
/* @var $product Mage_Catalog_Model_Product */
|
469 |
+
$product = $item->getProduct();
|
470 |
+
$connectorItem = new Dotdigitalgroup_Email_Model_Customer_Wishlist_Item($product);
|
471 |
+
$connectorItem->setQty($item->getQty());
|
472 |
+
$connectorItem->setPrice($product);
|
473 |
+
$connectorWishlist->setItem($connectorItem);//store for wishlists
|
474 |
+
}
|
475 |
+
//set wishlists for later use
|
476 |
+
$this->wishlists[$website->getId()][] = $connectorWishlist;
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Customer/Suppressed.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Suppressed extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
|
6 |
+
private $suppressedContacts = array();
|
7 |
+
|
8 |
+
public function unsubscribe($force = false)
|
9 |
+
{
|
10 |
+
// result of sync
|
11 |
+
$result = array('errors' => false, 'message' => '', 'customers');
|
12 |
+
$result['customers'] = 0;
|
13 |
+
$date = new Zend_Date();
|
14 |
+
|
15 |
+
/**
|
16 |
+
* 1. calculate from frequency
|
17 |
+
*/
|
18 |
+
if(! $force){
|
19 |
+
$frequency = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_SUPPRESSED_INTERVAL);
|
20 |
+
// get the frequency of sinse date
|
21 |
+
switch($frequency){
|
22 |
+
case('H'):
|
23 |
+
$date = $date->subHour(1);
|
24 |
+
break;
|
25 |
+
case('D'):
|
26 |
+
$date = $date->subDay(1);
|
27 |
+
break;
|
28 |
+
case('W'):
|
29 |
+
$date = $date->subWeek(1);
|
30 |
+
break;
|
31 |
+
case('M'):
|
32 |
+
$date = $date->subMonth(1);
|
33 |
+
break;
|
34 |
+
}
|
35 |
+
}else{
|
36 |
+
|
37 |
+
// force sync all customers
|
38 |
+
$date = $date->subYear(Dotdigitalgroup_Email_Model_Customer_Customer::FORCE_CUSTOMERS_YEARS);
|
39 |
+
}
|
40 |
+
|
41 |
+
// datetime format string
|
42 |
+
$dateString = $date->toString(Zend_Date::W3C);
|
43 |
+
/**
|
44 |
+
* Sync all suppressed for each store
|
45 |
+
*/
|
46 |
+
foreach (Mage::app()->getWebsites(true) as $website) {
|
47 |
+
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
48 |
+
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
49 |
+
$contacts = $this->getSuppressedSince($dateString);
|
50 |
+
if(! empty($contacts)){
|
51 |
+
foreach ($contacts as $suppressed){
|
52 |
+
$contactEmail = false;
|
53 |
+
if(isset($suppressed->suppressedContact)){
|
54 |
+
|
55 |
+
$contactEmail = $suppressed->suppressedContact->email;
|
56 |
+
$contactId = $suppressed->suppressedContact->id;
|
57 |
+
}
|
58 |
+
|
59 |
+
if($contactEmail){
|
60 |
+
try{
|
61 |
+
/**
|
62 |
+
* 3. Unsubscribe customer
|
63 |
+
*/
|
64 |
+
$newsletterModel = Mage::getModel('newsletter/subscriber')->loadByEmail($contactEmail);
|
65 |
+
if($newsletterModel->getStatus() == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED){
|
66 |
+
$unsubscribe = $newsletterModel->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED);
|
67 |
+
$unsubscribe->save();
|
68 |
+
// remove from subscriber address-book
|
69 |
+
$this->deleteAddressBookContact($website->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID), $contactId);
|
70 |
+
$this->suppressedContacts[$newsletterModel->getSubscriberEmail()] = $newsletterModel->getSubscriberEmail();
|
71 |
+
}
|
72 |
+
}catch (Exception $e){
|
73 |
+
$result['errors'] = true;
|
74 |
+
$result['message'] = 'Error Saving Customer!';
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
$result['customers'] = count($this->suppressedContacts);
|
81 |
+
|
82 |
+
return $result;
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Customer/Wishlist/Item.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Customer_Wishlist_Item
|
4 |
+
{
|
5 |
+
protected $name;
|
6 |
+
protected $sku;
|
7 |
+
protected $price;
|
8 |
+
protected $qty;
|
9 |
+
protected $total_value_of_product;
|
10 |
+
|
11 |
+
public function __construct($product)
|
12 |
+
{
|
13 |
+
$this->setSku($product->getSku());
|
14 |
+
$this->setName($product->getName());
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @param mixed $name
|
19 |
+
*/
|
20 |
+
public function setName($name)
|
21 |
+
{
|
22 |
+
$this->name = $name;
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @return mixed
|
27 |
+
*/
|
28 |
+
public function getName()
|
29 |
+
{
|
30 |
+
return $this->name;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param mixed $qty
|
35 |
+
*/
|
36 |
+
public function setQty($qty)
|
37 |
+
{
|
38 |
+
$this->qty = (int)$qty;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return mixed
|
43 |
+
*/
|
44 |
+
public function getQty()
|
45 |
+
{
|
46 |
+
return $this->qty;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return mixed
|
51 |
+
*/
|
52 |
+
public function getTotalValueOfProduct()
|
53 |
+
{
|
54 |
+
return $this->total_value_of_product;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param mixed $price
|
59 |
+
*/
|
60 |
+
public function setPrice($product)
|
61 |
+
{
|
62 |
+
$this->price = $product->getFinalPrice();
|
63 |
+
$total = $this->price * $this->qty;
|
64 |
+
|
65 |
+
$this->total_value_of_product = number_format($total, 2);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @return mixed
|
70 |
+
*/
|
71 |
+
public function getPrice()
|
72 |
+
{
|
73 |
+
return $this->price;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @param mixed $sku
|
78 |
+
*/
|
79 |
+
public function setSku($sku)
|
80 |
+
{
|
81 |
+
$this->sku = $sku;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @return mixed
|
86 |
+
*/
|
87 |
+
public function getSku()
|
88 |
+
{
|
89 |
+
return $this->sku;
|
90 |
+
}
|
91 |
+
public function expose() {
|
92 |
+
|
93 |
+
return get_object_vars($this);
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Product/Mapper.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected $_max_per_child;
|
6 |
+
|
7 |
+
protected $_num_order_items;
|
8 |
+
|
9 |
+
protected $_helper;
|
10 |
+
|
11 |
+
public $_products = array();
|
12 |
+
|
13 |
+
public $filename = 'mapper.log';
|
14 |
+
|
15 |
+
public function __construct($num_order_items)
|
16 |
+
{
|
17 |
+
$this->_helper = Mage::helper('connector');
|
18 |
+
$items_to_display = Mage::helper('connector/recommended')->getLimit();
|
19 |
+
if($num_order_items < $items_to_display)
|
20 |
+
$this->_max_per_child = number_format($items_to_display / $num_order_items);
|
21 |
+
$this->_helper->log('max items per child : ' . $this->_max_per_child . ', items to display : ' . $items_to_display . ', number of order items : ' . $num_order_items, null, $this->filename);
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Set the products with parent limit
|
27 |
+
* @param $products
|
28 |
+
*/
|
29 |
+
public function setProducts($products)
|
30 |
+
{
|
31 |
+
$count = 0;
|
32 |
+
foreach ($products as $product) {
|
33 |
+
if($count < $this->_max_per_child)
|
34 |
+
$this->setProduct($product);
|
35 |
+
$count++;
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
public function setProduct(Mage_Catalog_Model_Product $product)
|
40 |
+
{
|
41 |
+
$productId = $product->getEntityId();
|
42 |
+
|
43 |
+
if(!isset($this->_products[$productId])){
|
44 |
+
$this->_products[$productId] = $product;
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
return false;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function countProducts()
|
51 |
+
{
|
52 |
+
return count($this->_products);
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getProducts()
|
56 |
+
{
|
57 |
+
return $this->_products;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getFallbackProducts($limit)
|
61 |
+
{
|
62 |
+
$count = 0;
|
63 |
+
$fallbackIds = Mage::helper('connector/recommended')->getFallbackIds();
|
64 |
+
$this->_helper->log('fallback products from helper : '. count($fallbackIds), null, $this->filename);
|
65 |
+
|
66 |
+
if(!empty($fallbackIds)){
|
67 |
+
foreach ($fallbackIds as $id) {
|
68 |
+
/** @var Mage_Catalog_Model_Product $product */
|
69 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
70 |
+
|
71 |
+
if($product->getEntityId()){
|
72 |
+
|
73 |
+
$result = $this->setProduct($product);
|
74 |
+
if($result)
|
75 |
+
$count++;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
$this->_helper->log('result for products ' . $this->countProducts() . ', count : ' . $count . ', limit : ' . $limit, null, $this->filename);
|
80 |
+
|
81 |
+
if($count == $limit){
|
82 |
+
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Dynamic/Recommended.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Dynamic_Recommended extends Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper
|
4 |
+
{
|
5 |
+
protected $_result_limit;
|
6 |
+
|
7 |
+
protected $_storeId;//order store id
|
8 |
+
|
9 |
+
protected $_order_items = 0;//order product items
|
10 |
+
|
11 |
+
protected $_num_order_items;//number of items from order
|
12 |
+
|
13 |
+
protected $_productMapper;
|
14 |
+
|
15 |
+
protected $_is_log_enabled;
|
16 |
+
|
17 |
+
protected $_helper;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param $orderModel
|
21 |
+
*/
|
22 |
+
public function __construct(Mage_Sales_Model_Order $orderModel = null)
|
23 |
+
{
|
24 |
+
if($orderModel){
|
25 |
+
$this->_storeId = $orderModel->getStoreId();
|
26 |
+
$this->_order_items = $orderModel->getAllItems();
|
27 |
+
}
|
28 |
+
$this->_num_order_items = count($this->_order_items);
|
29 |
+
$this->_productMapper = new Dotdigitalgroup_Email_Model_Dynamic_Product_Mapper($this->_num_order_items);
|
30 |
+
$this->_helper = Mage::helper('connector/recommended');
|
31 |
+
$this->_result_limit = $this->_helper->getLimit();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Get the recommended products
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getProducts()
|
39 |
+
{
|
40 |
+
$mode = Mage::registry('mode');
|
41 |
+
if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
|
42 |
+
|
43 |
+
//set the order items
|
44 |
+
$this->setOrderItems();
|
45 |
+
}else{
|
46 |
+
//set products directly without looking for order items
|
47 |
+
$this->setRecommendedProduct();
|
48 |
+
}
|
49 |
+
|
50 |
+
return $this->_productMapper->getProducts();
|
51 |
+
}
|
52 |
+
|
53 |
+
public function setOrderItems()
|
54 |
+
{
|
55 |
+
foreach ($this->_order_items as $item) {
|
56 |
+
$productId = $item->getProductId();
|
57 |
+
/** @var Mage_Catalog_Model_Product $product */
|
58 |
+
$product = Mage::getModel('catalog/product')->load($productId);//make sure the product is loaded
|
59 |
+
|
60 |
+
$this->setRecommendedProduct($product);
|
61 |
+
}
|
62 |
+
|
63 |
+
if($this->_productMapper->countProducts() < $this->_result_limit){
|
64 |
+
$limit = $this->_result_limit - $this->_productMapper->countProducts();
|
65 |
+
$this->_productMapper->getFallbackProducts($limit);
|
66 |
+
}
|
67 |
+
|
68 |
+
return $this->_productMapper->getProducts();
|
69 |
+
}
|
70 |
+
|
71 |
+
public function setRecommendedProduct(Mage_Catalog_Model_Product $productModel = null)
|
72 |
+
{
|
73 |
+
//array of products to display
|
74 |
+
$products = array();
|
75 |
+
|
76 |
+
$mode = Mage::registry('mode');
|
77 |
+
switch($mode){
|
78 |
+
case 'related':
|
79 |
+
$products = $productModel->getRelatedProducts();
|
80 |
+
break;
|
81 |
+
case 'upsell':
|
82 |
+
$products = $productModel->getUpSellProducts();
|
83 |
+
break;
|
84 |
+
case 'crosssell':
|
85 |
+
$products = $productModel->getCrossSellProducts();
|
86 |
+
break;
|
87 |
+
case 'bestsellers':
|
88 |
+
$products = $this->getBestSellersProducts();
|
89 |
+
break;
|
90 |
+
case 'mostviewed':
|
91 |
+
$products = $this->getMostViewedProducts();
|
92 |
+
break;
|
93 |
+
case 'recentlyviewed':
|
94 |
+
$products = $this->getRecentlyViewedProducts();
|
95 |
+
break;
|
96 |
+
case 'productpush':
|
97 |
+
$products = $this->getPushProducts();
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
if($mode == 'related' || $mode == 'upsell' || $mode == 'crosssell'){
|
101 |
+
|
102 |
+
$this->_productMapper->setProducts($products, $this->_result_limit);
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
Mage::helper('connector')->log('number of all recommended products : ' . $this->_productMapper->countProducts() . ', max : ' . $this->_result_limit, null, $this->filename);
|
107 |
+
|
108 |
+
}
|
109 |
+
public function getNumberOfOrderItems()
|
110 |
+
{
|
111 |
+
return $this->_order_items;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Best Selling products
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
public function getBestSellersProducts()
|
119 |
+
{
|
120 |
+
$limit = $this->_helper->getLimit();
|
121 |
+
$from = $this->_helper->getTimeFromConfig($config = 'bestsellers');
|
122 |
+
$to = new Zend_Date();
|
123 |
+
$to = $to->toString(Zend_Date::ISO_8601);
|
124 |
+
|
125 |
+
$productCollection = Mage::getResourceModel('reports/product_collection')
|
126 |
+
->addOrderedQty($from, $to)
|
127 |
+
->addAttributeToSelect('*')
|
128 |
+
->addAttributeToSelect(array('name', 'price', 'small_image')) //edit to suit tastes
|
129 |
+
->setOrder('ordered_qty', 'desc') //best sellers on top
|
130 |
+
->setPageSize($limit);
|
131 |
+
|
132 |
+
$productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
133 |
+
$productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
134 |
+
|
135 |
+
foreach ($productCollection as $_product) {
|
136 |
+
$this->_productMapper->setProduct($_product);
|
137 |
+
}
|
138 |
+
|
139 |
+
return array();
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Most viwed products
|
144 |
+
* @return array
|
145 |
+
*/
|
146 |
+
public function getMostViewedProducts()
|
147 |
+
{
|
148 |
+
$limit = $this->_helper->getLimit();
|
149 |
+
$from = $this->_helper->getTimeFromConfig($config = 'mostviewed');
|
150 |
+
|
151 |
+
$to = new Zend_Date();
|
152 |
+
$to = $to->toString(Zend_Date::ISO_8601);
|
153 |
+
$productCollection = Mage::getResourceModel('reports/product_collection')
|
154 |
+
->addViewsCount()
|
155 |
+
->addViewsCount($from, $to)
|
156 |
+
->setPageSize($limit);
|
157 |
+
|
158 |
+
$productCollection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
159 |
+
$productCollection->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
160 |
+
|
161 |
+
foreach ($productCollection as $_product) {
|
162 |
+
$this->_productMapper->setProduct($_product);
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
return $this->_productMapper->getProducts();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Recently viewed products
|
171 |
+
* @return $this
|
172 |
+
*/
|
173 |
+
public function getRecentlyViewedProducts()
|
174 |
+
{
|
175 |
+
$customerId = Mage::registry('customer');
|
176 |
+
$helper = Mage::helper('connector');
|
177 |
+
$helper->log('recentlyviewed customer : ' . $customerId, null, $this->filename);
|
178 |
+
if($customerId){
|
179 |
+
|
180 |
+
$limit = $this->_helper->getLimit();
|
181 |
+
|
182 |
+
//login customer to receive the recent products
|
183 |
+
$session = Mage::getSingleton('customer/session');
|
184 |
+
$session->loginById($customerId);
|
185 |
+
|
186 |
+
/** @var Mage_Reports_Block_Product_Viewed $collection */
|
187 |
+
$collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed');
|
188 |
+
$items = $collection->getItemsCollection()
|
189 |
+
->setPageSize($limit)
|
190 |
+
;
|
191 |
+
|
192 |
+
|
193 |
+
foreach ($items as $product) {
|
194 |
+
$this->_productMapper->setProduct($product);
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
return $this->_productMapper->getProducts();
|
199 |
+
}else{
|
200 |
+
|
201 |
+
$helper->log('Get recently viewd products, customer id not found : ' . $customerId, null, $this->filename);
|
202 |
+
}
|
203 |
+
|
204 |
+
return null;
|
205 |
+
}
|
206 |
+
|
207 |
+
public function getPushProducts()
|
208 |
+
{
|
209 |
+
$productIds = $this->_helper->getProductPushIds();
|
210 |
+
|
211 |
+
Mage::helper('connector')->log('proudcts push ids : ' . implode(',', $productIds), null, $this->filename);
|
212 |
+
|
213 |
+
|
214 |
+
$productCollection = Mage::getModel('catalog/product')->getCollection()
|
215 |
+
->addAttributeToFilter('entity_id', array('in' => $productIds))
|
216 |
+
->setPageSize(Mage::helper('connector/recommended')->getLimit())
|
217 |
+
;
|
218 |
+
|
219 |
+
foreach ($productCollection as $_product) {
|
220 |
+
$this->_productMapper->setProduct($_product);
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
return $this->_productMapper->getProducts();
|
225 |
+
}
|
226 |
+
|
227 |
+
|
228 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Newsletter/Subscriber.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Newsletter_Subscriber extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
const XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID = 'connector_data_field_settings/address_book/subscribers';
|
6 |
+
|
7 |
+
// select subscribers that are not registred as customers
|
8 |
+
public function getSubscribersNotCustomers($storeIds = array())
|
9 |
+
{
|
10 |
+
$newsletterCollection = Mage::getModel('newsletter/subscriber')->getCollection()
|
11 |
+
->addFieldToFilter('main_table.customer_id', array('eq' => 0))
|
12 |
+
->addFieldToFilter('subscriber_status', array('eq' => Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED))
|
13 |
+
->addStoreFilter($storeIds)
|
14 |
+
;
|
15 |
+
|
16 |
+
return $newsletterCollection;
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Observer.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Observer extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Create new contact or update info also check for email change
|
7 |
+
* event: customer_save_before
|
8 |
+
* @param Varien_Event_Observer $observer
|
9 |
+
* @return $this
|
10 |
+
*/
|
11 |
+
public function handleCustomerSaveBefore(Varien_Event_Observer $observer)
|
12 |
+
{
|
13 |
+
// skip update customer for first time sync
|
14 |
+
if(! Mage::registry('first_time_sync')){
|
15 |
+
|
16 |
+
/* @var $customer Mage_Customer_Model_Customer */
|
17 |
+
$customer = $observer->getEvent()->getCustomer();
|
18 |
+
$email = $customer->getEmail();
|
19 |
+
$websiteId = $customer->getWebsiteId();
|
20 |
+
$subscribed = $customer->getIsSubscribed();
|
21 |
+
|
22 |
+
$this->_api_user = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
23 |
+
$this->_api_password = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
24 |
+
$subscribersAddressBook = Mage::app()->getWebsite($websiteId)->getConfig(Dotdigitalgroup_Email_Model_Newsletter_Subscriber::XML_PATH_SUBSCRIBERS_ADDRESS_BOOK_ID);
|
25 |
+
|
26 |
+
if($customer->getData('dotmailer_contact_id')){
|
27 |
+
$dotmailerId = $customer->getData('dotmailer_contact_id');
|
28 |
+
//get contact infrmation by id
|
29 |
+
$response = $this->getContactById($dotmailerId);
|
30 |
+
|
31 |
+
//check for matching email
|
32 |
+
if(isset($response->email)){
|
33 |
+
if($email != $response->email){
|
34 |
+
$data = array(
|
35 |
+
'Email' => $email,
|
36 |
+
'EmailType' => 'Html'
|
37 |
+
);
|
38 |
+
//update the contact with same id - different email
|
39 |
+
$this->updateContact($dotmailerId, $data);
|
40 |
+
}
|
41 |
+
|
42 |
+
if(!$subscribed && $response->status == 'Subscribed'){
|
43 |
+
$this->deleteAddressBookContact($subscribersAddressBook, $response->id);
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}else{
|
47 |
+
//get contact info by email
|
48 |
+
$response = $this->getContactByEmail($email);
|
49 |
+
//create new contact and add to address books
|
50 |
+
if(isset($response->message) && $response->message == Dotdigitalgroup_Email_Model_Api_Rest::REST_CONTACT_NOT_FOUND){
|
51 |
+
$contactApi = $this->createNewContact($email);
|
52 |
+
$this->postAddressBookContacts(Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CUSTOMERS_ADDRESS_BOOK_ID), $contactApi);
|
53 |
+
|
54 |
+
if($subscribed){
|
55 |
+
$this->postAddressBookContacts($subscribersAddressBook, $contactApi);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
if(isset($response->id))
|
61 |
+
$customer->setData('dotmailer_contact_id', $response->id);//set the id from contact info
|
62 |
+
}
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
/**
|
66 |
+
* event: sales_order_save_after
|
67 |
+
* @param Varien_Event_Observer $observer
|
68 |
+
* @return $this
|
69 |
+
*/
|
70 |
+
public function handleSalesOrderSaveAfter(Varien_Event_Observer $observer)
|
71 |
+
{
|
72 |
+
$order = $observer->getEvent()->getOrder();
|
73 |
+
$storeId = $order->getStoreId();
|
74 |
+
$customerId = $order->getCustomerId();
|
75 |
+
|
76 |
+
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
77 |
+
|
78 |
+
|
79 |
+
if(!$customerModel->getData('dotmailer_contact_id'))
|
80 |
+
$customerModel->save();
|
81 |
+
|
82 |
+
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
83 |
+
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
84 |
+
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
85 |
+
|
86 |
+
// store scope enabled
|
87 |
+
if($is_enabled){
|
88 |
+
$dotmailer = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
89 |
+
$this->sendOrderTransactionalData($dotmailer, 'Order');
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
return $this;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* event: quote_save_after
|
98 |
+
* @param Varien_Event_Observer $observer
|
99 |
+
* @return $this
|
100 |
+
*/
|
101 |
+
public function handleSalesQuoteSaveAfter(Varien_Event_Observer $observer)
|
102 |
+
{
|
103 |
+
$quote = $observer->getQuote();
|
104 |
+
$customerIsNotGuest = $quote->getCustomerId();
|
105 |
+
$storeId = $quote->getStoreId();
|
106 |
+
|
107 |
+
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
108 |
+
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
109 |
+
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
110 |
+
|
111 |
+
// save quotes that are active
|
112 |
+
if($customerIsNotGuest && $is_enabled && $quote->getIsActive()){
|
113 |
+
$dotmailer = new Dotdigitalgroup_Email_Model_Connector_Quote($quote);
|
114 |
+
$this->sendTransactionalData($dotmailer, 'Basket');
|
115 |
+
}
|
116 |
+
|
117 |
+
return $this;
|
118 |
+
}
|
119 |
+
|
120 |
+
public function handleSalesOrderStatusChange(Varien_Event_Observer $observer)
|
121 |
+
{
|
122 |
+
$order = $observer->getEvent()->getOrder();
|
123 |
+
$status = $order->getStatus();
|
124 |
+
|
125 |
+
/**
|
126 |
+
* SMS functinality
|
127 |
+
*/
|
128 |
+
$smsStatusOne = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_ONE_STATUS);
|
129 |
+
$smsStatusTwo = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_TWO_STATUS);
|
130 |
+
$smsStatusThree = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_THREE_STATUS);
|
131 |
+
$smsStatusFour = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Sms::XML_PATH_SMS_MESSAGE_FOUR_STATUS);
|
132 |
+
$smsModel = new Dotdigitalgroup_Email_Model_Sales_Sms();
|
133 |
+
|
134 |
+
switch($status){
|
135 |
+
case $smsStatusOne:
|
136 |
+
$smsModel->sendMessage($order, 'ONE');
|
137 |
+
break;
|
138 |
+
case $smsStatusTwo:
|
139 |
+
$smsModel->sendMessage($order, 'TWO');
|
140 |
+
break;
|
141 |
+
case $smsStatusThree:
|
142 |
+
$smsModel->sendMessage($order, 'THREE');
|
143 |
+
break;
|
144 |
+
case $smsStatusFour:
|
145 |
+
$smsModel->sendMessage($order, 'FOUR');
|
146 |
+
break;
|
147 |
+
}
|
148 |
+
|
149 |
+
return $this;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function handleSalesOrderRefund(Varien_Event_Observer $observer)
|
153 |
+
{
|
154 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
155 |
+
$storeId = $creditmemo->getStoreId();
|
156 |
+
|
157 |
+
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
158 |
+
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
159 |
+
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
160 |
+
$order = $creditmemo->getOrder();
|
161 |
+
|
162 |
+
// store scope enabled
|
163 |
+
if($is_enabled){
|
164 |
+
$connectorOrder = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
165 |
+
$result = $this->sendOrderTransactionalData($connectorOrder, 'Order', $order->getIncrementId());
|
166 |
+
$this->_helper->log($result, null, $this->_log_filename);
|
167 |
+
|
168 |
+
}
|
169 |
+
|
170 |
+
return $this;
|
171 |
+
}
|
172 |
+
public function hangleSalesOrderCancel(Varien_Event_Observer $observer)
|
173 |
+
{
|
174 |
+
$order = $observer->getEvent()->getOrder();
|
175 |
+
$storeId = $order->getStoreId();
|
176 |
+
$key = $order->getIncrementId();
|
177 |
+
|
178 |
+
$this->_api_user = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME, $storeId);
|
179 |
+
$this->_api_password = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD, $storeId);
|
180 |
+
$is_enabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Model_Sales_Order::XML_PATH_TRANSACTIONAL_DATA_ENABLED, $storeId);
|
181 |
+
|
182 |
+
if($is_enabled)
|
183 |
+
$this->deleteContactsTransactionalData('Order', $key);
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
return $this;
|
188 |
+
}
|
189 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Order.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Order extends Mage_Sales_Model_Order
|
4 |
+
{
|
5 |
+
protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
|
6 |
+
{
|
7 |
+
// dispatch an event before we attempt to do anything
|
8 |
+
Mage::dispatchEvent('sales_order_status_before', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
|
9 |
+
|
10 |
+
// attempt to set the specified state
|
11 |
+
if ($shouldProtectState) {
|
12 |
+
if ($this->isStateProtected($state)) {
|
13 |
+
Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
|
14 |
+
}
|
15 |
+
}
|
16 |
+
$this->setData('state', $state);
|
17 |
+
|
18 |
+
// add status history
|
19 |
+
if ($status) {
|
20 |
+
if ($status === true) {
|
21 |
+
$status = $this->getConfig()->getStateDefaultStatus($state);
|
22 |
+
}
|
23 |
+
$this->setStatus($status);
|
24 |
+
$history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
|
25 |
+
$history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
|
26 |
+
}
|
27 |
+
|
28 |
+
// dispatch an event after status has changed
|
29 |
+
Mage::dispatchEvent('sales_order_status_after', array('order' => $this, 'state' => $state, 'status' => $status, 'comment' => $comment, 'isCustomerNotified' => $isCustomerNotified, 'shouldProtectState' => $shouldProtectState));
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Sales/Order.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Order extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
const XML_PATH_TRANSACTIONAL_DATA_ENABLED = 'connector_sync_settings/transactional_data/order_enabled';
|
6 |
+
const XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT = 'connector_advanced_settings/sync_limits/orders';
|
7 |
+
|
8 |
+
protected $accounts = array();
|
9 |
+
|
10 |
+
/**
|
11 |
+
* initial sync the transactional data
|
12 |
+
* @return array
|
13 |
+
*/
|
14 |
+
public function sync()
|
15 |
+
{
|
16 |
+
// Initialise a return hash containing results of our sync attempt
|
17 |
+
$this->_searchAccounts();
|
18 |
+
|
19 |
+
foreach ($this->accounts as $account){
|
20 |
+
if(count($account->getOrders())){
|
21 |
+
$this->sendMultiTransactionalData($account->getOrders(), 'Order');
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
unset($this->accounts[$account->getApiUsername()]);
|
26 |
+
}
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
*Search the configuration data per website
|
32 |
+
*/
|
33 |
+
private function _searchAccounts()
|
34 |
+
{
|
35 |
+
foreach (Mage::app()->getWebsites() as $website){
|
36 |
+
$enabled = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_ENABLED);
|
37 |
+
|
38 |
+
if(!$enabled)
|
39 |
+
continue;
|
40 |
+
|
41 |
+
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
42 |
+
$limit = $website->getConfig(self::XML_PATH_TRANSACTIONAL_DATA_SYNC_LIMIT);
|
43 |
+
|
44 |
+
if(!isset($this->accounts[$this->_api_user])){
|
45 |
+
$account = new Dotdigitalgroup_Email_Model_Connector_Account();
|
46 |
+
$account->setApiUsername($this->_api_user);
|
47 |
+
$account->setApiPassword($this->_api_password);
|
48 |
+
$this->accounts[$this->_api_user] = $account;
|
49 |
+
}
|
50 |
+
$this->accounts[$this->_api_user]->setOrders($this->getConnectorOrders($limit));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* get all connector orders data
|
56 |
+
* @param $limit
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function getConnectorOrders($limit = 100)
|
60 |
+
{
|
61 |
+
$orders = $customers = array();
|
62 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection()
|
63 |
+
->addAttributeToFilter('dotmailer_order_imported', array('null' => true), 'left')
|
64 |
+
->setPageSize($limit);
|
65 |
+
|
66 |
+
$this->_helper->log('GET CONNECTOR ORDERS ' . $orderCollection->count() . ' limit ' . $limit, null, $this->_log_filename);
|
67 |
+
|
68 |
+
//mark as imported for customers with contact id
|
69 |
+
foreach ($orderCollection as $order) {
|
70 |
+
try {
|
71 |
+
$customerEmail = $order->getCustomerEmail();
|
72 |
+
$storeId = $order->getStoreId();
|
73 |
+
$this->setStoreId(Mage::app()->getStore(true)->getId());
|
74 |
+
$websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();
|
75 |
+
|
76 |
+
$customerModel = Mage::getModel('customer/customer')->setWebsiteId($websiteId)
|
77 |
+
->loadByEmail($customerEmail);
|
78 |
+
|
79 |
+
if($customerModel){
|
80 |
+
$contactId = $customerModel->getData('dotmailer_contact_id');
|
81 |
+
if($contactId){
|
82 |
+
$orders[] = new Dotdigitalgroup_Email_Model_Connector_Order($order);
|
83 |
+
$order->setData('dotmailer_order_imported', 1);
|
84 |
+
$order->save();
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}catch(Exception $e){
|
88 |
+
|
89 |
+
|
90 |
+
$this->_helper->log($order->getIncrementId(), null, $this->_log_filename);
|
91 |
+
$this->_helper->log($e->getMessage(), null, $this->_log_filename);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
return $orders;
|
95 |
+
}
|
96 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Sales/Quote.php
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Quote extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
//xml path configuration
|
6 |
+
const XML_PATH_LOSTBASKET_1_ENABLED = 'lostbaskets/customers/enabled_1';
|
7 |
+
const XML_PATH_LOSTBASKET_2_ENABLED = 'lostbaskets/customers/enabled_2';
|
8 |
+
const XML_PATH_LOSTBASKET_3_ENABLED = 'lostbaskets/customers/enabled_3';
|
9 |
+
|
10 |
+
const XML_PATH_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/customers/send_after_1';
|
11 |
+
const XML_PATH_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/customers/send_after_2';
|
12 |
+
const XML_PATH_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/customers/send_after_3';
|
13 |
+
|
14 |
+
const XML_PATH_TRIGGER_1_CAMPAIGN = 'lost_basket_settings/customers/campaign_1';
|
15 |
+
const XML_PATH_TRIGGER_2_CAMPAIGN = 'lost_basket_settings/customers/campaign_2';
|
16 |
+
const XML_PATH_TRIGGER_3_CAMPAIGN = 'lost_basket_settings/customers/campaign_3';
|
17 |
+
|
18 |
+
const XML_PATH_GUEST_LOSTBASKET_1_ENABLED = 'lostbaskets/guests/enabled_1';
|
19 |
+
const XML_PATH_GUEST_LOSTBASKET_2_ENABLED = 'lostbaskets/guests/enabled_2';
|
20 |
+
const XML_PATH_GUEST_LOSTBASKET_3_ENABLED = 'lostbaskets/guests/enabled_3';
|
21 |
+
|
22 |
+
const XML_PATH_GUEST_LOSTBASKET_1_INTERVAL = 'lost_basket_settings/guests/send_after_1';
|
23 |
+
const XML_PATH_GUEST_LOSTBASKET_2_INTERVAL = 'lost_basket_settings/guests/send_after_2';
|
24 |
+
const XML_PATH_GUEST_LOSTBASKET_3_INTERVAL = 'lost_basket_settings/guests/send_after_3';
|
25 |
+
|
26 |
+
const XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN = 'lost_basket_settings/guests/campaign_1';
|
27 |
+
const XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN = 'lost_basket_settings/guests/campaign_2';
|
28 |
+
const XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN = 'lost_basket_settings/guests/campaign_3';
|
29 |
+
|
30 |
+
const XML_PATH_TEST_LOSTBASKET_EMAIL = 'lost_basket_settings/test/email';
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* send the lost baskets to campains
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function proccessCampaigns()
|
38 |
+
{
|
39 |
+
foreach (Mage::app()->getStores(true) as $store){
|
40 |
+
|
41 |
+
//skip any action if all lost basket campaings are disabled
|
42 |
+
if(!$store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED) && !$store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED) &&
|
43 |
+
!$store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED) &&
|
44 |
+
!$store->getconfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED) && !$store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)
|
45 |
+
)continue;
|
46 |
+
|
47 |
+
// set credentials for every store
|
48 |
+
$storeId = $store->getId();
|
49 |
+
$this->_api_user = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
50 |
+
$this->_api_password = $store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Customers campaings
|
54 |
+
*/
|
55 |
+
|
56 |
+
//first campign
|
57 |
+
if($store->getConfig(self::XML_PATH_LOSTBASKET_1_ENABLED)){
|
58 |
+
|
59 |
+
$contacts = array();
|
60 |
+
$from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_LOSTBASKET_1_INTERVAL));
|
61 |
+
$to = clone($from);
|
62 |
+
$from->sub('5', Zend_Date::MINUTE);
|
63 |
+
// lost baskets
|
64 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
65 |
+
if(count($quoteCollection)){
|
66 |
+
|
67 |
+
// get collection contacts id
|
68 |
+
foreach ($quoteCollection as $quote) {
|
69 |
+
$customerId = $quote->getCustomerId();
|
70 |
+
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
71 |
+
|
72 |
+
if($dotmailerContactId)
|
73 |
+
$contacts[] = $dotmailerContactId;
|
74 |
+
}
|
75 |
+
//check for empty contacts to avoid mass emails
|
76 |
+
if(!empty($contacts))
|
77 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
//second campaign
|
82 |
+
if($store->getConfig(self::XML_PATH_LOSTBASKET_2_ENABLED)){
|
83 |
+
$contacts = array();
|
84 |
+
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_2_INTERVAL));
|
85 |
+
$to = clone($from);
|
86 |
+
$from->sub('5', Zend_Date::MINUTE);
|
87 |
+
// lost baskets
|
88 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
89 |
+
if(count($quoteCollection)){
|
90 |
+
// get collection contacts id
|
91 |
+
foreach ($quoteCollection as $quote) {
|
92 |
+
$customerId = $quote->getCustomerId();
|
93 |
+
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
94 |
+
if($dotmailerContactId)
|
95 |
+
$contacts[] = $dotmailerContactId;
|
96 |
+
}
|
97 |
+
if(!empty($contacts))
|
98 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_2_CAMPAIGN), $contacts);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
//third campign
|
103 |
+
if($store->getConfig(self::XML_PATH_LOSTBASKET_3_ENABLED)){
|
104 |
+
$contacts = array();
|
105 |
+
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_LOSTBASKET_3_INTERVAL));
|
106 |
+
$to = clone($from);
|
107 |
+
$from->sub('5', Zend_Date::MINUTE);
|
108 |
+
// lost baskets
|
109 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'));
|
110 |
+
if(count($quoteCollection)){
|
111 |
+
// get collection contacts id
|
112 |
+
foreach ($quoteCollection as $quote) {
|
113 |
+
$customerId = $quote->getCustomerId();
|
114 |
+
$dotmailerContactId = $this->_getContactIdByCustomerId($customerId);
|
115 |
+
if($dotmailerContactId)
|
116 |
+
$contacts[] = $dotmailerContactId;
|
117 |
+
}
|
118 |
+
if(!empty($contacts))
|
119 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_TRIGGER_3_CAMPAIGN), $contacts);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
/**
|
123 |
+
* Guests campaings
|
124 |
+
*/
|
125 |
+
//first guest campaign
|
126 |
+
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_ENABLED))
|
127 |
+
{
|
128 |
+
$contacts = array();
|
129 |
+
$from = Zend_Date::now()->subMinute($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_INTERVAL));
|
130 |
+
$to = clone($from);
|
131 |
+
$from->sub('5', Zend_Date::MINUTE);
|
132 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
133 |
+
if(count($quoteCollection)){
|
134 |
+
// get collection contacts id
|
135 |
+
foreach ($quoteCollection as $quote) {
|
136 |
+
$email = $quote->getCustomerEmail();
|
137 |
+
//check if the customer exists
|
138 |
+
$response = $this->getContactByEmail($email);
|
139 |
+
|
140 |
+
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
141 |
+
//create new contact before sending campaign
|
142 |
+
$contactAPI = $this->createNewContact($email);
|
143 |
+
if(!isset($contactAPI->message))
|
144 |
+
$response = $this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
145 |
+
}
|
146 |
+
$contacts[] = $response->id;
|
147 |
+
}
|
148 |
+
if(!empty($contacts))
|
149 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_1_CAMPAIGN), $contacts);
|
150 |
+
}
|
151 |
+
}
|
152 |
+
// second guest campaign
|
153 |
+
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_ENABLED))
|
154 |
+
{
|
155 |
+
$contacts = array();
|
156 |
+
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_INTERVAL));
|
157 |
+
$to = clone($from);
|
158 |
+
$from->sub('5', Zend_Date::MINUTE);
|
159 |
+
// lost baskets
|
160 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
161 |
+
if(count($quoteCollection)){
|
162 |
+
// get collection contacts id
|
163 |
+
foreach ($quoteCollection as $quote) {
|
164 |
+
$email = $quote->getCustomerEmail();
|
165 |
+
//check if the customer exists
|
166 |
+
$response = $this->getContactByEmail($email);
|
167 |
+
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
168 |
+
//create new contact before sending campaign
|
169 |
+
$contactAPI = $this->createNewContact($email);
|
170 |
+
if(!isset($contactAPI->message))
|
171 |
+
$this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
172 |
+
}
|
173 |
+
$contacts[] = $response->id;
|
174 |
+
}
|
175 |
+
if(!empty($contacts))
|
176 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_2_CAMPAIGN), $contacts);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
//third guest campaign
|
180 |
+
if($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_ENABLED)){
|
181 |
+
$contacts = array();
|
182 |
+
$from = Zend_Date::now()->subHour($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_INTERVAL));
|
183 |
+
$to = clone($from);
|
184 |
+
$from->sub('5', Zend_Date::MINUTE);
|
185 |
+
|
186 |
+
// lost baskets
|
187 |
+
$quoteCollection = $this->_getStoreQuotes($storeId, $from->toString('YYYY-MM-dd HH:mm:ss'), $to->toString('YYYY-MM-dd HH:mm:ss'), true);
|
188 |
+
if(count($quoteCollection)){
|
189 |
+
// get collection contacts id
|
190 |
+
foreach ($quoteCollection as $quote) {
|
191 |
+
$email = $quote->getCustomerEmail();
|
192 |
+
//check if the customer exists
|
193 |
+
$response = $this->getContactByEmail($email);
|
194 |
+
|
195 |
+
if(isset($response->message) && $response->message == self::REST_CONTACT_NOT_FOUND){
|
196 |
+
//create new contact before sending campaign
|
197 |
+
$contactAPI = $this->createNewContact($email);
|
198 |
+
if(!isset($contactAPI->message))
|
199 |
+
$this->postAddressBookContacts($store->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_GUEST_ADDRESS_BOOK_ID), $contactAPI);
|
200 |
+
}
|
201 |
+
$contacts[] = $response->id;
|
202 |
+
}
|
203 |
+
if(!empty($contacts))
|
204 |
+
$this->sendCampaign($store->getConfig(self::XML_PATH_GUEST_LOSTBASKET_3_CAMPAIGN), $contacts);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @param $storeId
|
213 |
+
* @param null $from
|
214 |
+
* @param null $to
|
215 |
+
* @param bool $guest
|
216 |
+
* @return Varien_Data_Collection_Db
|
217 |
+
*/
|
218 |
+
private function _getStoreQuotes($storeId, $from = null, $to = null, $guest = false){
|
219 |
+
|
220 |
+
$salesCollection = Mage::getResourceModel('sales/quote_collection')
|
221 |
+
->addFieldToFilter('is_active',1)
|
222 |
+
->addFieldToFilter('items_count', array('gt' => 0))
|
223 |
+
->addFieldToFilter('customer_email', array('neq' => ''))
|
224 |
+
->addFieldToFilter('store_id', $storeId)
|
225 |
+
->addFieldToFilter('updated_at',array(
|
226 |
+
'from' => $from,
|
227 |
+
'to' => $to,
|
228 |
+
'date' => true)
|
229 |
+
);
|
230 |
+
if($guest)
|
231 |
+
$salesCollection->addFieldToFilter('checkout_method' , Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
|
232 |
+
|
233 |
+
return $salesCollection->load();
|
234 |
+
}
|
235 |
+
|
236 |
+
private function _getContactIdByCustomerId($customerId)
|
237 |
+
{
|
238 |
+
$customerModel = Mage::getModel('customer/customer')->load($customerId);
|
239 |
+
|
240 |
+
if($customerModel){
|
241 |
+
return $customerModel->getData('dotmailer_contact_id');
|
242 |
+
}
|
243 |
+
return false;
|
244 |
+
|
245 |
+
}
|
246 |
+
public function forceProccess()
|
247 |
+
{
|
248 |
+
$result = array('errors' => false, 'message' => '');
|
249 |
+
$contacts = array();
|
250 |
+
$customerEmail = Mage::getStoreConfig(self::XML_PATH_TEST_LOSTBASKET_EMAIL);
|
251 |
+
|
252 |
+
|
253 |
+
$salesCollection = Mage::getResourceModel('sales/quote_collection')
|
254 |
+
->addFieldToFilter('is_active',1)
|
255 |
+
->addFieldToFilter('items_count', array('gt' => 0))
|
256 |
+
->addFieldToFilter('customer_id', array('neq' => ''))
|
257 |
+
->addFieldToFilter('customer_email', $customerEmail)
|
258 |
+
|
259 |
+
//->addFieldToFilter('store_id', $storeId)
|
260 |
+
;
|
261 |
+
$salesCollection->getSelect()->order("updated_at desc");
|
262 |
+
|
263 |
+
|
264 |
+
$quote = $salesCollection->getFirstItem();
|
265 |
+
|
266 |
+
if($quote){
|
267 |
+
|
268 |
+
$contactId = $this->_getContactIdByCustomerId($quote->getCustomerId());
|
269 |
+
|
270 |
+
if($contactId)
|
271 |
+
$contacts[] = $contactId;
|
272 |
+
|
273 |
+
if(!empty($contacts)){
|
274 |
+
|
275 |
+
$responce = $this->sendCampaign(Mage::getStoreConfig(self::XML_PATH_TRIGGER_1_CAMPAIGN), $contacts);
|
276 |
+
if(isset($responce->message)){
|
277 |
+
$result['errors'] = true;
|
278 |
+
$result['message'] = $responce->message;
|
279 |
+
}else{
|
280 |
+
|
281 |
+
$result['message'] = 'First Test Campaign Sent ';
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
return $result;
|
286 |
+
|
287 |
+
}
|
288 |
+
|
289 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/Sales/Sms.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_Sales_Sms extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
const XML_PATH_SMS_MESSAGE_ONE_STATUS = 'sms_section/sms_message_one/order_status';
|
6 |
+
const XML_PATH_SMS_MESSAGE_TWO_STATUS = 'sms_section/sms_message_two/order_status';
|
7 |
+
const XML_PATH_SMS_MESSAGE_THREE_STATUS = 'sms_section/sms_message_three/order_status';
|
8 |
+
const XML_PATH_SMS_MESSAGE_FOUR_STATUS = 'sms_section/sms_message_four/order_status';
|
9 |
+
|
10 |
+
const XML_PATH_SMS_MESSAGE_ONE = 'sms_section/sms_message_one/message';
|
11 |
+
const XML_PATH_SMS_MESSAGE_TWO = 'sms_section/sms_message_two/message';
|
12 |
+
const XML_PATH_SMS_MESSAGE_THREE = 'sms_section/sms_message_three/message';
|
13 |
+
const XML_PATH_SMS_MESSAGE_FOUR = 'sms_section/sms_message_four/message';
|
14 |
+
|
15 |
+
public $_available = array('/customer_name/', '/order_number/', '/{{var /', '/}}/');
|
16 |
+
|
17 |
+
public function sendMessage($order, $number)
|
18 |
+
{
|
19 |
+
$storeId = $order->getStoreId();
|
20 |
+
$billing = $order->getBillingAddress();
|
21 |
+
$customerTelephone = $billing->getTelephone();
|
22 |
+
|
23 |
+
$message = Mage::getStoreConfig(constant('self::XML_PATH_SMS_MESSAGE_' . $number), $storeId);
|
24 |
+
|
25 |
+
$message = $this->_processVariables($order, $message);
|
26 |
+
|
27 |
+
|
28 |
+
$pattern = "/^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/";
|
29 |
+
|
30 |
+
$match = preg_match($pattern, $customerTelephone);
|
31 |
+
$this->_helper->log('sms number to send : ' . $customerTelephone, null, $this->_log_filename);
|
32 |
+
|
33 |
+
if ($match != false) {
|
34 |
+
$telephoneNumber = preg_replace('/\A(0){1}+/', '+44', $customerTelephone);
|
35 |
+
Mage::helper('connector')->log($telephoneNumber, null, 'api.log');
|
36 |
+
$this->postSmsMessagesSendTo($telephoneNumber, $message);
|
37 |
+
} else {
|
38 |
+
|
39 |
+
$this->_helper->log('telephone number not valid ' . $customerTelephone, null, $this->_log_filename);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @param $order
|
45 |
+
* @param $message
|
46 |
+
* @return mixed
|
47 |
+
*/
|
48 |
+
protected function _processVariables($order, $message)
|
49 |
+
{
|
50 |
+
$helper = Mage::helper('connector');
|
51 |
+
if(preg_match('/{{var/', $message)){
|
52 |
+
|
53 |
+
$firstname = $order->getCustomerFirstname();
|
54 |
+
|
55 |
+
$replacemant = array();
|
56 |
+
$replacemant[] = $firstname;
|
57 |
+
$replacemant[] = $order->getIncrementId();
|
58 |
+
$replacemant[] = '';
|
59 |
+
$replacemant[] = '';
|
60 |
+
|
61 |
+
$message = preg_replace($this->_available, $replacemant, $message);
|
62 |
+
|
63 |
+
$helper->log($message, null, $this->_log_filename);
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
return $message;
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Customer.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Customer extends Mage_Core_Model_Config_Data
|
4 |
+
{
|
5 |
+
const CRON_STRING_PATH = 'connector_sync_settings/sync_customer_schedule/cronschedule';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Cron settings after save
|
9 |
+
*
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
protected function _afterSave()
|
13 |
+
{
|
14 |
+
|
15 |
+
$enabled = $this->getData('groups/sync_customer_schedule/fields/enabled/value');
|
16 |
+
$time = $this->getData('groups/sync_customer_schedule/fields/time/value');
|
17 |
+
$frequency = $this->getData('groups/sync_customer_schedule/fields/frequency/value');
|
18 |
+
|
19 |
+
$frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
|
20 |
+
$frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
|
21 |
+
$frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
|
22 |
+
$frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
|
23 |
+
|
24 |
+
if ($enabled) {
|
25 |
+
$cronDayOfWeek = date('N');
|
26 |
+
$cronExprArray = array(
|
27 |
+
($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
|
28 |
+
($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
|
29 |
+
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
30 |
+
'*', # Month of the Year
|
31 |
+
($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
|
32 |
+
);
|
33 |
+
$cronExprString = join(' ', $cronExprArray);
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$cronExprString = '';
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
// store config $cronExprString
|
41 |
+
Mage::getModel('core/config_data')
|
42 |
+
->load(self::CRON_STRING_PATH, 'path')
|
43 |
+
->setValue($cronExprString)
|
44 |
+
->setPath(self::CRON_STRING_PATH)
|
45 |
+
->save();
|
46 |
+
}catch (Exception $e) {
|
47 |
+
Mage::throwException('Unable to save the cron expression.');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Backend/Syncschedule/Suppressed.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Backend_Syncschedule_Suppressed extends Mage_Core_Model_Config_Data
|
4 |
+
{
|
5 |
+
const CRON_STRING_PATH = 'connector_sync_settings/sync_suppressed_schedule/cronschedulesupp';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Cron settings after save
|
9 |
+
*
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
protected function _afterSave()
|
13 |
+
{
|
14 |
+
|
15 |
+
$enabled = $this->getData('groups/sync_suppressed_schedule/fields/enabled/value');
|
16 |
+
$time = $this->getData('groups/sync_suppressed_schedule/fields/time/value');
|
17 |
+
$frequency = $this->getData('groups/sync_suppressed_schedule/fields/frequency/value');
|
18 |
+
|
19 |
+
$frequencyHourly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_HOURLY;
|
20 |
+
$frequencyDaily = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_DAILY;
|
21 |
+
$frequencyWeekly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_WEEKLY;
|
22 |
+
$frequencyMonthly = Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency::CRON_MONTHLY;
|
23 |
+
|
24 |
+
if ($enabled) {
|
25 |
+
$cronDayOfWeek = date('N');
|
26 |
+
$cronExprArray = array(
|
27 |
+
($frequency == $frequencyHourly) ? intval($time[1]) : '*', # Minute
|
28 |
+
($frequency == $frequencyDaily) ? intval($time[0]) : '*', # Hour
|
29 |
+
($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
|
30 |
+
'*', # Month of the Year
|
31 |
+
($frequency == $frequencyWeekly) ? $cronDayOfWeek : '*', # Day of the Week
|
32 |
+
);
|
33 |
+
$cronExprString = join(' ', $cronExprArray);
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$cronExprString = '';
|
37 |
+
}
|
38 |
+
|
39 |
+
try {
|
40 |
+
// store config $cronExprString
|
41 |
+
|
42 |
+
|
43 |
+
Mage::getModel('core/config_data')
|
44 |
+
->load(self::CRON_STRING_PATH, 'path')
|
45 |
+
->setValue($cronExprString)
|
46 |
+
->setPath(self::CRON_STRING_PATH)
|
47 |
+
->save();
|
48 |
+
|
49 |
+
}
|
50 |
+
catch (Exception $e) {
|
51 |
+
Mage::throwException('Unable to save the cron expression.');
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Activebasket.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Activebasket
|
4 |
+
{
|
5 |
+
function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => '0', 'label' => Mage::helper('connector')->__('Success Page')),
|
9 |
+
array('value' => '1', 'label' => Mage::helper('connector')->__('Complete Order'))
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Addressbooks.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Addressbooks extends Dotdigitalgroup_Email_Model_Api_Rest
|
4 |
+
{
|
5 |
+
// Returns the account's datafields
|
6 |
+
public function toOptionArray()
|
7 |
+
{
|
8 |
+
$fields = array();
|
9 |
+
//load the configuration for website select in admin
|
10 |
+
$websiteName = Mage::app()->getRequest()->getParam('website');
|
11 |
+
if(! empty($websiteName)){
|
12 |
+
$websites = Mage::getModel('core/website')->getCollection()
|
13 |
+
->addFieldToFilter('code', $websiteName);
|
14 |
+
$website = $websites->getFirstItem();
|
15 |
+
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
16 |
+
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
17 |
+
}
|
18 |
+
$addressBooks = $this->postAddressBooks();
|
19 |
+
|
20 |
+
//set up fields with book id and label
|
21 |
+
foreach ($addressBooks as $book){
|
22 |
+
|
23 |
+
if(isset($book->id))
|
24 |
+
$fields[] = array('value' => $book->id, 'label' => $book->name);
|
25 |
+
}
|
26 |
+
|
27 |
+
return $fields;
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Campaigns.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Date: 15/04/2013
|
4 |
+
* Time: 13:46
|
5 |
+
*/
|
6 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Campaigns extends Dotdigitalgroup_Email_Model_Api_Rest
|
7 |
+
{
|
8 |
+
|
9 |
+
// Returns the account's datafields
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$fields = array();
|
13 |
+
$websiteName = Mage::app()->getRequest()->getParam('website');
|
14 |
+
if(! empty($websiteName)){
|
15 |
+
$websites = Mage::getModel('core/website')->getCollection()
|
16 |
+
->addFieldToFilter('code', $websiteName);
|
17 |
+
$website = $websites->getFirstItem();
|
18 |
+
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
19 |
+
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
20 |
+
}
|
21 |
+
$campaigns = $this->postCampaigns();
|
22 |
+
foreach ($campaigns as $one){
|
23 |
+
if(isset($one->id))
|
24 |
+
$fields[] = array('value' => $one->id, 'label' => $one->name);
|
25 |
+
}
|
26 |
+
|
27 |
+
return $fields;
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Datafields.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Date: 15/04/2013
|
4 |
+
* Time: 13:46
|
5 |
+
*/
|
6 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Datafields extends Dotdigitalgroup_Email_Model_Api_Rest
|
7 |
+
{
|
8 |
+
|
9 |
+
// Returns the account's datafields
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
$fields = array();
|
13 |
+
//load the configuration for website select in admin
|
14 |
+
$websiteName = Mage::app()->getRequest()->getParam('website');
|
15 |
+
if(! empty($websiteName)){
|
16 |
+
$websites = Mage::getModel('core/website')->getCollection()
|
17 |
+
->addFieldToFilter('code', $websiteName);
|
18 |
+
$website = $websites->getFirstItem();
|
19 |
+
$this->_api_user = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_USERNAME);
|
20 |
+
$this->_api_password = $website->getConfig(Dotdigitalgroup_Email_Model_Customer_Customer::XML_PATH_CONNECTOR_API_PASSWORD);
|
21 |
+
}
|
22 |
+
|
23 |
+
// Add a "Do Not Map" Option
|
24 |
+
$fields[] = array('value' => 0, 'label' => 'Do Not Map');
|
25 |
+
|
26 |
+
$datafileds = $this->postDataFields();
|
27 |
+
foreach ($datafileds as $datafield) {
|
28 |
+
if(isset($datafield->name))
|
29 |
+
$fields[] = array('value' => $datafield->name, 'label' => $datafield->name);
|
30 |
+
}
|
31 |
+
|
32 |
+
return $fields;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displayifnot.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Displayifnot
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'best-sellers', 'label' => Mage::helper('connector')->__('Best Sellers')),
|
9 |
+
array('value' => 'most-viewed', 'label' => Mage::helper('connector')->__('Most Viewed'))
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Displaytype.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Displaytype
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'grid', 'label' => Mage::helper('connector')->__('Grid')),
|
9 |
+
array('value' => 'list', 'label' => Mage::helper('connector')->__('List'))
|
10 |
+
);
|
11 |
+
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Gridview.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Gridview
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => '2', 'label' => '2'),
|
9 |
+
array('value' => '4', 'label' => '4'),
|
10 |
+
array('value' => '6', 'label' => '6'),
|
11 |
+
array('value' => '8', 'label' => '8'),
|
12 |
+
array('value' => '12', 'label' => '12'),
|
13 |
+
array('value' => '16', 'label' => '16'),
|
14 |
+
array('value' => '20', 'label' => '20'),
|
15 |
+
array('value' => '24', 'label' => '24'),
|
16 |
+
array('value' => '28', 'label' => '28'),
|
17 |
+
array('value' => '32', 'label' => '32'),
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Lostbasket.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Lostbasket
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* lost basket hour options
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value' => "15", 'label' => Mage::helper('connector')->__('15 Minutes')),
|
13 |
+
array('value' => "20", 'label' => Mage::helper('connector')->__('20 Minutes')),
|
14 |
+
array('value' => "25", 'label' => Mage::helper('connector')->__('25 Minutes')),
|
15 |
+
array('value' => "30", 'label' => Mage::helper('connector')->__('30 Minutes')),
|
16 |
+
array('value' => "40", 'label' => Mage::helper('connector')->__('40 Minutes')),
|
17 |
+
array('value' => "50", 'label' => Mage::helper('connector')->__('50 Minutes')),
|
18 |
+
array('value' => "60", 'label' => Mage::helper('connector')->__('60 Minutes')),
|
19 |
+
);
|
20 |
+
}
|
21 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderlimit.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Orderlimit
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @return array
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value' => '50', 'label' => '50'),
|
12 |
+
array('value' => '100', 'label' => '100'),
|
13 |
+
array('value' => '200', 'label' => '200'),
|
14 |
+
array('value' => '300', 'label' => '300'),
|
15 |
+
array('value' => '400', 'label' => '400'),
|
16 |
+
array('value' => '500', 'label' => '500'),
|
17 |
+
);
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Orderstatus.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Orderstatus
|
4 |
+
{
|
5 |
+
public function toOptionArray(){
|
6 |
+
|
7 |
+
$statusCollection = Mage::getModel('sales/order_status')->getCollection();
|
8 |
+
$statuses = array();
|
9 |
+
|
10 |
+
foreach ($statusCollection as $one) {
|
11 |
+
$statuses[] = array('value' => $one->getStatus(), 'label' => Mage::helper('connector')->__($one->getLabel()));
|
12 |
+
}
|
13 |
+
|
14 |
+
return $statuses;
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Sendcampain.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_SendCampain
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* send to campain options hours
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value'=>1 , 'label'=>Mage::helper('adminhtml')->__('1 Hour')),
|
13 |
+
array('value'=>2 , 'label'=>Mage::helper('adminhtml')->__('2 Hours')),
|
14 |
+
array('value'=>3 , 'label'=>Mage::helper('adminhtml')->__('3 Hours')),
|
15 |
+
array('value'=>4 , 'label'=>Mage::helper('adminhtml')->__('4 Hours')),
|
16 |
+
array('value'=>5 , 'label'=>Mage::helper('adminhtml')->__('5 Hours')),
|
17 |
+
array('value'=>6 , 'label'=>Mage::helper('adminhtml')->__('6 Hours')),
|
18 |
+
array('value'=>12 , 'label'=>Mage::helper('adminhtml')->__('12 Hours')),
|
19 |
+
array('value'=>36 , 'label'=>Mage::helper('adminhtml')->__('36 Hours')),
|
20 |
+
array('value'=>48 , 'label'=>Mage::helper('adminhtml')->__('48 Hours')),
|
21 |
+
array('value'=>60 , 'label'=>Mage::helper('adminhtml')->__('60 Hours')),
|
22 |
+
array('value'=>72 , 'label'=>Mage::helper('adminhtml')->__('72 Hours')),
|
23 |
+
array('value'=>84 , 'label'=>Mage::helper('adminhtml')->__('84 Hours')),
|
24 |
+
array('value'=>96 , 'label'=>Mage::helper('adminhtml')->__('96 Hours')),
|
25 |
+
array('value'=>108 , 'label'=>Mage::helper('adminhtml')->__('108 Hours')),
|
26 |
+
array('value'=>120 , 'label'=>Mage::helper('adminhtml')->__('120 Hours')),
|
27 |
+
);
|
28 |
+
|
29 |
+
}
|
30 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Syncfrequency.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Syncfrequency
|
4 |
+
{
|
5 |
+
|
6 |
+
protected static $_options;
|
7 |
+
|
8 |
+
const CRON_HOURLY = 'H';
|
9 |
+
const CRON_DAILY = 'D';
|
10 |
+
const CRON_WEEKLY = 'W';
|
11 |
+
const CRON_MONTHLY = 'M';
|
12 |
+
|
13 |
+
public function toOptionArray()
|
14 |
+
{
|
15 |
+
if (!self::$_options) {
|
16 |
+
self::$_options = array(
|
17 |
+
array(
|
18 |
+
'label' => Mage::helper('cron')->__('Hourly'),
|
19 |
+
'value' => self::CRON_HOURLY,
|
20 |
+
),
|
21 |
+
array(
|
22 |
+
'label' => Mage::helper('cron')->__('Daily'),
|
23 |
+
'value' => self::CRON_DAILY,
|
24 |
+
),
|
25 |
+
array(
|
26 |
+
'label' => Mage::helper('cron')->__('Weekly'),
|
27 |
+
'value' => self::CRON_WEEKLY,
|
28 |
+
),
|
29 |
+
array(
|
30 |
+
'label' => Mage::helper('cron')->__('Monthly'),
|
31 |
+
'value' => self::CRON_MONTHLY,
|
32 |
+
),
|
33 |
+
);
|
34 |
+
}
|
35 |
+
return self::$_options;
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Model/System/Config/Source/Timeperiod.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Model_System_Config_Source_Timeperiod
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'week', 'label' => Mage::helper('connector')->__('Week')),
|
9 |
+
array('value' => 'month', 'label' => Mage::helper('connector')->__('Month')),
|
10 |
+
array('value' => 'year', 'label' => Mage::helper('connector')->__('Year'))
|
11 |
+
);
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Dotdigitalgroup/Email/Test/Model/Product.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Dotdigitalgroup_Email_Test_Model_Product extends EcomDev_PHPUnit_Test_Case
|
3 |
+
{
|
4 |
+
|
5 |
+
public function testIfTheAnswerToTheUniverseIs42()
|
6 |
+
{
|
7 |
+
|
8 |
+
$productModel = Mage::getModel('catalog/product')->load(39);
|
9 |
+
|
10 |
+
|
11 |
+
$price = $productModel->getPrice();
|
12 |
+
|
13 |
+
$this->assertEquals('20', $price);
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Dotdigitalgroup/Email/controllers/Adminhtml/DebugController.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_Adminhtml_DebugController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function forcecustomersyncAction()
|
7 |
+
{
|
8 |
+
$result = Mage::getModel('connector/customer_customer')->sync();
|
9 |
+
|
10 |
+
if ($result['error']) {
|
11 |
+
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
12 |
+
}else {
|
13 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
|
14 |
+
}
|
15 |
+
$this->_redirectReferer();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function forcelostbasketsyncAction()
|
19 |
+
{
|
20 |
+
|
21 |
+
$result = Mage::getModel('connector/sales_quote')->forceProccess();
|
22 |
+
|
23 |
+
if ($result['errors'])
|
24 |
+
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
25 |
+
else
|
26 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($result['message']);
|
27 |
+
|
28 |
+
$this->_redirectReferer();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function forcesuppressedAction()
|
32 |
+
{
|
33 |
+
// forse sync
|
34 |
+
$result = Mage::getModel('connector/customer_suppressed')->unsubscribe(true);
|
35 |
+
|
36 |
+
if($result['errors']){
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($result['message']);
|
38 |
+
}else{
|
39 |
+
|
40 |
+
if($result['customers'] > 0)
|
41 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Customers Unsubscribed : ' . $result['customers']);
|
42 |
+
else
|
43 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('Done.');
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->_redirectReferer();
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testCredentialsAction()
|
50 |
+
{
|
51 |
+
/**
|
52 |
+
* Test account API
|
53 |
+
*/
|
54 |
+
$testResult = Mage::getModel('connector/account_test')->test();
|
55 |
+
|
56 |
+
if($testResult['errors']){
|
57 |
+
Mage::getSingleton('adminhtml/session')->addError($testResult['message']);
|
58 |
+
}else{
|
59 |
+
Mage::getSingleton('adminhtml/session')->addSuccess('API Credentials Valid.');
|
60 |
+
}
|
61 |
+
$this->_redirectReferer();
|
62 |
+
}
|
63 |
+
public function transactionalSyncAction()
|
64 |
+
{
|
65 |
+
|
66 |
+
Mage::register('force_transactional', true);
|
67 |
+
$initialSync = Mage::getModel('connector/sales_order')->sync();
|
68 |
+
|
69 |
+
if ($initialSync['errors'])
|
70 |
+
Mage::getSingleton('adminhtml/session')->addError($initialSync['message']);
|
71 |
+
else
|
72 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($initialSync['message']);
|
73 |
+
|
74 |
+
$this->_redirectReferer();
|
75 |
+
}
|
76 |
+
public function deletecontactsidAction()
|
77 |
+
{
|
78 |
+
Mage::register('first_time_sync', true);
|
79 |
+
$customerModel = new Dotdigitalgroup_Email_Model_Customer_Customer();
|
80 |
+
$customers = $customerModel->getContactsCustomers();
|
81 |
+
$numUpdated = 0;
|
82 |
+
if($customers->getSize()){
|
83 |
+
foreach ($customers as $one){
|
84 |
+
try{
|
85 |
+
$customer = Mage::getModel('customer/customer')->load($one->getId());
|
86 |
+
$customer->setData('dotmailer_contact_id', null);
|
87 |
+
$customer->save();
|
88 |
+
}catch(Exception $e){
|
89 |
+
Mage::helper('connector')->log($e->getMessage(), null, 'api.log');
|
90 |
+
}
|
91 |
+
$numUpdated++;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
Mage::unregister('first_time_sync');
|
95 |
+
if($numUpdated);
|
96 |
+
Mage::getModel('adminhtml/session')->addSuccess('Number Of Contacts Id Removed :'. $numUpdated);
|
97 |
+
$this->_redirectReferer();
|
98 |
+
}
|
99 |
+
|
100 |
+
public function countcontactsAction()
|
101 |
+
{
|
102 |
+
$customer = new Dotdigitalgroup_Email_Model_Customer_Customer();
|
103 |
+
$contacts = $customer->getContactsCustomers();
|
104 |
+
$total = $customer->getTotalNumberCustomers();
|
105 |
+
$numMissing = $contacts->getSize();
|
106 |
+
|
107 |
+
Mage::getModel('adminhtml/session')->addSuccess('Customers No: ' . $total . ', With Contact Id No: ' . $numMissing);
|
108 |
+
$this->_redirectReferer();
|
109 |
+
}
|
110 |
+
|
111 |
+
public function ajaxvalidationAction()
|
112 |
+
{
|
113 |
+
$result = 'Validation failed!';
|
114 |
+
$api_user = $this->getRequest()->getParam('api_user');
|
115 |
+
$api_password = $this->getRequest()->getParam('api_password');
|
116 |
+
$testResult = Mage::getModel('connector/account_test')->test($api_user, $api_password);
|
117 |
+
if($testResult['errors'] == false){
|
118 |
+
$result = 'Valid';
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
}
|
app/code/local/Dotdigitalgroup/Email/controllers/EmailController.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dotdigitalgroup_Email_EmailController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
//Get current layout state
|
8 |
+
$this->loadLayout();
|
9 |
+
|
10 |
+
$this->renderLayout();
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Params
|
16 |
+
* code - security check
|
17 |
+
* order - order id
|
18 |
+
* products type :
|
19 |
+
* 1.related
|
20 |
+
* 2.upsell
|
21 |
+
* 3.cross sell
|
22 |
+
* 4.best sellers
|
23 |
+
* 5.most viewed
|
24 |
+
* 6.recently viewed
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
public function productsAction()
|
28 |
+
{
|
29 |
+
//get all params
|
30 |
+
$params = $this->getRequest()->getParams();
|
31 |
+
|
32 |
+
if(!isset($params['code']) || !isset($params['mode'])){
|
33 |
+
|
34 |
+
exit();
|
35 |
+
}
|
36 |
+
//authenticate before proceed
|
37 |
+
Mage::helper('connector')->auth($params['code']);
|
38 |
+
Mage::register('mode', $params['mode']);
|
39 |
+
if(isset($params['customer']))
|
40 |
+
Mage::register('customer', $params['customer']);
|
41 |
+
$this->loadLayout();
|
42 |
+
$this->renderLayout();
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
public function couponAction()
|
47 |
+
{
|
48 |
+
$this->loadLayout();
|
49 |
+
$this->renderLayout();
|
50 |
+
}
|
51 |
+
public function basketAction()
|
52 |
+
{
|
53 |
+
$this->loadLayout();
|
54 |
+
$this->renderLayout();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function logAction()
|
58 |
+
{
|
59 |
+
//@todo allow from these Ips
|
60 |
+
$allowedIps = array(
|
61 |
+
|
62 |
+
);
|
63 |
+
|
64 |
+
//file name param
|
65 |
+
$file = $this->getRequest()->getParam('file');
|
66 |
+
$fileName = $file . '.log';
|
67 |
+
$filePath = Mage::getBaseDir('log') . DIRECTORY_SEPARATOR . $fileName;
|
68 |
+
|
69 |
+
$this->_prepareDownloadResponse($fileName, array(
|
70 |
+
'type' => 'filename',
|
71 |
+
'value' => $filePath
|
72 |
+
));
|
73 |
+
exit();
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
public function resetimportedorderdataAction()
|
78 |
+
{
|
79 |
+
$orderCollection = Mage::getResourceModel('sales/order_collection');
|
80 |
+
foreach ($orderCollection as $one) {
|
81 |
+
|
82 |
+
try{
|
83 |
+
|
84 |
+
$one->setData('dotmailer_order_imported', null);
|
85 |
+
$one->save();
|
86 |
+
}catch(Exception $e){
|
87 |
+
Mage::logException($e);
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
public function saveMissingIdCustomerAction()
|
94 |
+
{
|
95 |
+
$customer = Mage::getModel('connector/customer_customer')->getMissingContacts();
|
96 |
+
$helper = Mage::helper('connector');
|
97 |
+
$helper->log('number of miss ids : ' . count($customer));
|
98 |
+
foreach ($customer as $one) {
|
99 |
+
try{
|
100 |
+
$helper->log($one->getEmail());
|
101 |
+
$one->save();
|
102 |
+
}catch(Exception $e){
|
103 |
+
$helper->log($e->getMessage());
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
public function importAllTransactionalDataAction()
|
112 |
+
{
|
113 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection();
|
114 |
+
$helper = Mage::helper('connector');
|
115 |
+
$helper->log('import all transactional data : ' . $orderCollection->getSize());
|
116 |
+
foreach($orderCollection as $one){
|
117 |
+
|
118 |
+
$order = Mage::getModel('connector/connector_order', $one);
|
119 |
+
if($order->connector_id)
|
120 |
+
$orders[] = $order;
|
121 |
+
}
|
122 |
+
$helper->log('orders created : ' . count($orders));
|
123 |
+
$rest = Mage::getModel('connector/api_rest');
|
124 |
+
|
125 |
+
try{
|
126 |
+
$result = $rest->sendMultiTransactionalData($orders, 'Order');
|
127 |
+
$helper->log($result);
|
128 |
+
}catch(Exception $e){
|
129 |
+
$helper->log($e->getMessage());
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
}
|
app/code/local/Dotdigitalgroup/Email/etc/adminhtml.xml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<connector_api_settings translate="title">
|
12 |
+
<title><![CDATA[API Credentials]]></title>
|
13 |
+
</connector_api_settings>
|
14 |
+
<connector_sync_settings translate="title">
|
15 |
+
<title><![CDATA[Sync Settings]]></title>
|
16 |
+
</connector_sync_settings>
|
17 |
+
<connector_data_field_settings translate="title">
|
18 |
+
<title><![CDATA[Data Field Mapping]]></title>
|
19 |
+
</connector_data_field_settings>
|
20 |
+
<connector_roi_page_tracking_settings translate="title">
|
21 |
+
<title><![CDATA[ROI & Tracking]]></title>
|
22 |
+
</connector_roi_page_tracking_settings>
|
23 |
+
<lost_basket_settings translate="title">
|
24 |
+
<title><![CDATA[Lost Baskets]]></title>
|
25 |
+
</lost_basket_settings>
|
26 |
+
<sms_section translate="title">
|
27 |
+
<title><![CDATA[SMS Section]]></title>
|
28 |
+
</sms_section>
|
29 |
+
<dynamic_content translate="label">
|
30 |
+
<title><![CDATA[Dynamic Content]]></title>
|
31 |
+
</dynamic_content>
|
32 |
+
<connector_advanced_settings translate="title">
|
33 |
+
<title><![CDATA[Advanced Settings]]></title>
|
34 |
+
</connector_advanced_settings>
|
35 |
+
</children>
|
36 |
+
</config>
|
37 |
+
</children>
|
38 |
+
</system>
|
39 |
+
</children>
|
40 |
+
</admin>
|
41 |
+
</resources>
|
42 |
+
</acl>
|
43 |
+
</config>
|
app/code/local/Dotdigitalgroup/Email/etc/config.xml
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
|
4 |
+
<modules>
|
5 |
+
<Dotdigitalgroup_Email>
|
6 |
+
<version>1.5.1</version>
|
7 |
+
</Dotdigitalgroup_Email>
|
8 |
+
</modules>
|
9 |
+
<frontend>
|
10 |
+
<routers>
|
11 |
+
<connector>
|
12 |
+
<use>standard</use>
|
13 |
+
<args>
|
14 |
+
<module>Dotdigitalgroup_Email</module>
|
15 |
+
<frontName>connector</frontName>
|
16 |
+
</args>
|
17 |
+
</connector>
|
18 |
+
</routers>
|
19 |
+
<layout>
|
20 |
+
<updates>
|
21 |
+
<connector>
|
22 |
+
<file>connector.xml</file>
|
23 |
+
</connector>
|
24 |
+
</updates>
|
25 |
+
</layout>
|
26 |
+
</frontend>
|
27 |
+
<global>
|
28 |
+
<models>
|
29 |
+
<connector>
|
30 |
+
<class>Dotdigitalgroup_Email_Model</class>
|
31 |
+
</connector>
|
32 |
+
<sales>
|
33 |
+
<rewrite>
|
34 |
+
<order>Dotdigitalgroup_Email_Model_Order</order>
|
35 |
+
</rewrite>
|
36 |
+
</sales>
|
37 |
+
</models>
|
38 |
+
<helpers>
|
39 |
+
<connector>
|
40 |
+
<class>Dotdigitalgroup_Email_Helper</class>
|
41 |
+
</connector>
|
42 |
+
</helpers>
|
43 |
+
<blocks>
|
44 |
+
<connector>
|
45 |
+
<class>Dotdigitalgroup_Email_Block</class>
|
46 |
+
</connector>
|
47 |
+
</blocks>
|
48 |
+
|
49 |
+
<resources>
|
50 |
+
<connector_setup>
|
51 |
+
<setup>
|
52 |
+
<module>Dotdigitalgroup_Email</module>
|
53 |
+
<class>Mage_Sales_Model_Mysql4_Setup</class>
|
54 |
+
</setup>
|
55 |
+
<connection>
|
56 |
+
<use>core_setup</use>
|
57 |
+
</connection>
|
58 |
+
</connector_setup>
|
59 |
+
<customer_write>
|
60 |
+
<connection>
|
61 |
+
<use>core_write</use>
|
62 |
+
</connection>
|
63 |
+
</customer_write>
|
64 |
+
<customer_read>
|
65 |
+
<connection>
|
66 |
+
<use>core_read</use>
|
67 |
+
</connection>
|
68 |
+
</customer_read>
|
69 |
+
</resources>
|
70 |
+
<events>
|
71 |
+
<customer_save_before>
|
72 |
+
<observers>
|
73 |
+
<contactid>
|
74 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
75 |
+
<method>handleCustomerSaveBefore</method>
|
76 |
+
</contactid>
|
77 |
+
</observers>
|
78 |
+
</customer_save_before>
|
79 |
+
<sales_order_save_after>
|
80 |
+
<observers>
|
81 |
+
<connector_checkout_type_onepage_save_order_after>
|
82 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
83 |
+
<method>handleSalesOrderSaveAfter</method>
|
84 |
+
</connector_checkout_type_onepage_save_order_after>
|
85 |
+
</observers>
|
86 |
+
</sales_order_save_after>
|
87 |
+
<sales_quote_save_after>
|
88 |
+
<observers>
|
89 |
+
<connector_quote_save_after>
|
90 |
+
<type>singleton</type>
|
91 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
92 |
+
<method>handleSalesQuoteSaveAfter</method>
|
93 |
+
</connector_quote_save_after>
|
94 |
+
</observers>
|
95 |
+
</sales_quote_save_after>
|
96 |
+
<sales_order_creditmemo_save_after>
|
97 |
+
<observers>
|
98 |
+
<connector_sales_order_payment_refund>
|
99 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
100 |
+
<method>handleSalesOrderRefund</method>
|
101 |
+
</connector_sales_order_payment_refund>
|
102 |
+
</observers>
|
103 |
+
</sales_order_creditmemo_save_after>
|
104 |
+
<order_cancel_after>
|
105 |
+
<observers>
|
106 |
+
<connector_sales_order_cancel>
|
107 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
108 |
+
<method>hangleSalesOrderCancel</method>
|
109 |
+
</connector_sales_order_cancel>
|
110 |
+
</observers>
|
111 |
+
</order_cancel_after>
|
112 |
+
|
113 |
+
<sales_order_status_after>
|
114 |
+
<observers>
|
115 |
+
<connector_sales_order_status_change>
|
116 |
+
<class>Dotdigitalgroup_Email_Model_Observer</class>
|
117 |
+
<method>handleSalesOrderStatusChange</method>
|
118 |
+
</connector_sales_order_status_change>
|
119 |
+
</observers>
|
120 |
+
</sales_order_status_after>
|
121 |
+
</events>
|
122 |
+
</global>
|
123 |
+
|
124 |
+
<adminhtml>
|
125 |
+
<layout>
|
126 |
+
<updates>
|
127 |
+
<connector>
|
128 |
+
<file>connector.xml</file>
|
129 |
+
</connector>
|
130 |
+
</updates>
|
131 |
+
</layout>
|
132 |
+
</adminhtml>
|
133 |
+
|
134 |
+
|
135 |
+
<admin>
|
136 |
+
<routers>
|
137 |
+
<connector>
|
138 |
+
<use>admin</use>
|
139 |
+
<args>
|
140 |
+
<modules>
|
141 |
+
<connector before="Mage_Adminhtml">Dotdigitalgroup_Email_Adminhtml</connector>
|
142 |
+
</modules>
|
143 |
+
<module>Dotdigitalgroup_Email_Adminhtml</module>
|
144 |
+
<frontName>connector</frontName>
|
145 |
+
</args>
|
146 |
+
</connector>
|
147 |
+
</routers>
|
148 |
+
</admin>
|
149 |
+
|
150 |
+
<crontab>
|
151 |
+
<jobs>
|
152 |
+
<dotdigitalgroup_email_customer_sync>
|
153 |
+
<run><model>connector/cron::customersync</model></run>
|
154 |
+
<schedule>
|
155 |
+
<config_path>connector_sync_settings/sync_customer_schedule/cronschedule</config_path>
|
156 |
+
</schedule>
|
157 |
+
</dotdigitalgroup_email_customer_sync>
|
158 |
+
<dotdigitalgroup_email_lostbaskets_sync>
|
159 |
+
<run><model>connector/cron::lostbasketssync</model></run>
|
160 |
+
<schedule>
|
161 |
+
<cron_expr>*/5 * * * *</cron_expr>
|
162 |
+
</schedule>
|
163 |
+
</dotdigitalgroup_email_lostbaskets_sync>
|
164 |
+
<dotdigitalgroup_email_suppressed_sync>
|
165 |
+
<run><model>connector/cron::suppressedsync</model></run>
|
166 |
+
<schedule>
|
167 |
+
<config_path>connector_sync_settings/sync_suppressed_schedule/cronschedulesupp</config_path>
|
168 |
+
</schedule>
|
169 |
+
</dotdigitalgroup_email_suppressed_sync>
|
170 |
+
<dotdigitalgroup_email_cleaner>
|
171 |
+
<run><model>connector/cron::cleaning</model></run>
|
172 |
+
<schedule>
|
173 |
+
<cron_expr>0 0 1 * * </cron_expr>
|
174 |
+
</schedule>
|
175 |
+
</dotdigitalgroup_email_cleaner>
|
176 |
+
</jobs>
|
177 |
+
</crontab>
|
178 |
+
<default>
|
179 |
+
<connector_api_settings>
|
180 |
+
<api_credentials>
|
181 |
+
<username></username>
|
182 |
+
<password></password>
|
183 |
+
</api_credentials>
|
184 |
+
</connector_api_settings>
|
185 |
+
<connector_sync_settings>
|
186 |
+
<sync_customer_schedule>
|
187 |
+
<enabled>0</enabled>
|
188 |
+
<cronschedule></cronschedule>
|
189 |
+
</sync_customer_schedule>
|
190 |
+
<sync_suppressed_schedule>
|
191 |
+
<enabled>0</enabled>
|
192 |
+
<cronschedulesupp></cronschedulesupp>
|
193 |
+
</sync_suppressed_schedule>
|
194 |
+
<transactional_data>
|
195 |
+
<enabled>0</enabled>
|
196 |
+
</transactional_data>
|
197 |
+
</connector_sync_settings>
|
198 |
+
<connector_data_field_settings>
|
199 |
+
<customer_data>
|
200 |
+
<firstname></firstname>
|
201 |
+
<lastname></lastname>
|
202 |
+
<dob></dob>
|
203 |
+
<gender></gender>
|
204 |
+
<website_created_on></website_created_on>
|
205 |
+
<store_created_on></store_created_on>
|
206 |
+
<account_created></account_created>
|
207 |
+
<last_logged_in></last_logged_in>
|
208 |
+
<customer_group></customer_group>
|
209 |
+
</customer_data>
|
210 |
+
<customer_address>
|
211 |
+
<billing_address_1></billing_address_1>
|
212 |
+
<billing_address_2></billing_address_2>
|
213 |
+
<billing_city></billing_city>
|
214 |
+
<billing_country></billing_country>
|
215 |
+
<billing_postcode></billing_postcode>
|
216 |
+
<billing_telephone></billing_telephone>
|
217 |
+
<delivery_address_1></delivery_address_1>
|
218 |
+
<delivery_address_2></delivery_address_2>
|
219 |
+
<delivery_city></delivery_city>
|
220 |
+
<delivery_country></delivery_country>
|
221 |
+
<delivery_postcode></delivery_postcode>
|
222 |
+
<delivery_telephone></delivery_telephone>
|
223 |
+
</customer_address>
|
224 |
+
<customer_sales>
|
225 |
+
<total_orders></total_orders>
|
226 |
+
<average_order_value></average_order_value>
|
227 |
+
<total_spend></total_spend>
|
228 |
+
</customer_sales>
|
229 |
+
</connector_data_field_settings>
|
230 |
+
|
231 |
+
<connector_roi_page_tracking_settings>
|
232 |
+
<page_tracking>
|
233 |
+
<enabled></enabled>
|
234 |
+
</page_tracking>
|
235 |
+
<roi_tracking>
|
236 |
+
<enabled></enabled>
|
237 |
+
</roi_tracking>
|
238 |
+
</connector_roi_page_tracking_settings>
|
239 |
+
<connector_newsletter_subscription_settings>
|
240 |
+
<customers_subscription_management>
|
241 |
+
<default></default>
|
242 |
+
</customers_subscription_management>
|
243 |
+
<subscribers_subscription_management>
|
244 |
+
<default></default>
|
245 |
+
</subscribers_subscription_management>
|
246 |
+
</connector_newsletter_subscription_settings>
|
247 |
+
<lost_basket_settings>
|
248 |
+
<customers>
|
249 |
+
<enabled_1></enabled_1>
|
250 |
+
<send_after_1></send_after_1>
|
251 |
+
<campaign_1></campaign_1>
|
252 |
+
<enabled_2></enabled_2>
|
253 |
+
<send_after_2></send_after_2>
|
254 |
+
<campaign_2></campaign_2>
|
255 |
+
<enabled_3></enabled_3>
|
256 |
+
<send_after_3></send_after_3>
|
257 |
+
<campaign_3></campaign_3>
|
258 |
+
</customers>
|
259 |
+
<guests>
|
260 |
+
<enabled_1></enabled_1>
|
261 |
+
<send_after_1></send_after_1>
|
262 |
+
<campaign_1></campaign_1>
|
263 |
+
<enabled_2></enabled_2>
|
264 |
+
<send_after_2></send_after_2>
|
265 |
+
<campaign_2></campaign_2>
|
266 |
+
<enabled_3></enabled_3>
|
267 |
+
<send_after_3></send_after_3>
|
268 |
+
<campaign_3></campaign_3>
|
269 |
+
</guests>
|
270 |
+
</lost_basket_settings>
|
271 |
+
<connector_advanced_settings>
|
272 |
+
<sync_limits>
|
273 |
+
<contact>500</contact>
|
274 |
+
<orders>500</orders>
|
275 |
+
</sync_limits>
|
276 |
+
<admin>
|
277 |
+
<memory_limit></memory_limit>
|
278 |
+
<batch_size>5000</batch_size>
|
279 |
+
</admin>
|
280 |
+
</connector_advanced_settings>
|
281 |
+
</default>
|
282 |
+
<phpunit>
|
283 |
+
<suite>
|
284 |
+
<modules>
|
285 |
+
<Dotdigitalgroup_Email />
|
286 |
+
</modules>
|
287 |
+
</suite>
|
288 |
+
</phpunit>
|
289 |
+
</config>
|
app/code/local/Dotdigitalgroup/Email/etc/system.xml
ADDED
@@ -0,0 +1,1610 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<connector translate="label">
|
5 |
+
<label>EMAIL</label>
|
6 |
+
<sort_order>1000</sort_order>
|
7 |
+
</connector>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<connector_api_settings translate="label">
|
11 |
+
<label><![CDATA[API Credentials]]></label>
|
12 |
+
<tab>connector</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>0</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<api_credentials>
|
20 |
+
<label>API Settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<expanded>1</expanded>
|
27 |
+
<fields>
|
28 |
+
<username>
|
29 |
+
<label>API Username</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<frontend_model>connector/adminhtml_system_config_wrapper</frontend_model>
|
32 |
+
<sort_order>10</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>0</show_in_store>
|
36 |
+
<validate>validate-length minimum-length-36</validate>
|
37 |
+
</username>
|
38 |
+
<password>
|
39 |
+
<label>API Password</label>
|
40 |
+
<frontend_type>password</frontend_type>
|
41 |
+
<frontend_model>connector/adminhtml_system_config_password</frontend_model>
|
42 |
+
<sort_order>20</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</password>
|
47 |
+
<initialsync translate="label">
|
48 |
+
<label>Test API Credentials</label>
|
49 |
+
<frontend_model>connector/debug_testcredentials</frontend_model>
|
50 |
+
<sort_order>30</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>0</show_in_store>
|
54 |
+
<comment>*Please save your settings before clicking here! Use this button to test the account.</comment>
|
55 |
+
</initialsync>
|
56 |
+
<validator>
|
57 |
+
<label></label>
|
58 |
+
<frontend_type>hidden</frontend_type>
|
59 |
+
<frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
|
60 |
+
<sort_order>50</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
<can_be_empty>1</can_be_empty>
|
65 |
+
</validator>
|
66 |
+
</fields>
|
67 |
+
</api_credentials>
|
68 |
+
</groups>
|
69 |
+
</connector_api_settings>
|
70 |
+
<connector_sync_settings translate="label">
|
71 |
+
<!-- you can put anything inbetween the CDATA tags (including image tags) -->
|
72 |
+
<label><![CDATA[Sync Settings]]></label>
|
73 |
+
<!-- this relates to the value in tab -->
|
74 |
+
<tab>connector</tab>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>3000</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>0</show_in_store>
|
80 |
+
<groups>
|
81 |
+
<sync_customer_schedule>
|
82 |
+
<label>Customer Data and Subscribers Sync Schedule</label>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>10</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>0</show_in_store>
|
88 |
+
<expanded>1</expanded>
|
89 |
+
<fields>
|
90 |
+
<enabled translate="label">
|
91 |
+
<label>Enabled</label>
|
92 |
+
<frontend_type>select</frontend_type>
|
93 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
94 |
+
<sort_order>10</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</enabled>
|
99 |
+
<time translate="label">
|
100 |
+
<label>Start Time</label>
|
101 |
+
<frontend_type>time</frontend_type>
|
102 |
+
<backend_model>connector/system_config_backend_syncschedule_customer</backend_model>
|
103 |
+
<sort_order>20</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>0</show_in_website>
|
106 |
+
<show_in_store>0</show_in_store>
|
107 |
+
<depends><enabled>1</enabled></depends>
|
108 |
+
</time>
|
109 |
+
<frequency translate="label">
|
110 |
+
<label>Frequency</label>
|
111 |
+
<frontend_type>select</frontend_type>
|
112 |
+
<source_model>connector/system_config_source_syncfrequency</source_model>
|
113 |
+
<backend_model>connector/system_config_backend_syncschedule_customer</backend_model>
|
114 |
+
<sort_order>30</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>0</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
<comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
|
119 |
+
<depends><enabled>1</enabled></depends>
|
120 |
+
</frequency>
|
121 |
+
<force_sync translate="label">
|
122 |
+
<label></label>
|
123 |
+
<frontend_model>connector/debug_forcecustomersync</frontend_model>
|
124 |
+
<sort_order>50</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>0</show_in_website>
|
127 |
+
<show_in_store>0</show_in_store>
|
128 |
+
<comment>Use this button force the data synchronization to run now</comment>
|
129 |
+
</force_sync>
|
130 |
+
<validator>
|
131 |
+
<label></label>
|
132 |
+
<frontend_type>hidden</frontend_type>
|
133 |
+
<frontend_model>connector/adminhtml_system_config_waitingfield</frontend_model>
|
134 |
+
<sort_order>60</sort_order>
|
135 |
+
<show_in_default>1</show_in_default>
|
136 |
+
<show_in_website>0</show_in_website>
|
137 |
+
<show_in_store>0</show_in_store>
|
138 |
+
<can_be_empty>1</can_be_empty>
|
139 |
+
</validator>
|
140 |
+
</fields>
|
141 |
+
</sync_customer_schedule>
|
142 |
+
<sync_suppressed_schedule>
|
143 |
+
<label>Suppressed Data Sync Schedule</label>
|
144 |
+
<frontend_type>text</frontend_type>
|
145 |
+
<sort_order>20</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>0</show_in_store>
|
149 |
+
<expanded>1</expanded>
|
150 |
+
<fields>
|
151 |
+
<enabled translate="label">
|
152 |
+
<label>Enabled</label>
|
153 |
+
<frontend_type>select</frontend_type>
|
154 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
155 |
+
<sort_order>2</sort_order>
|
156 |
+
<show_in_default>1</show_in_default>
|
157 |
+
<show_in_website>1</show_in_website>
|
158 |
+
<show_in_store>0</show_in_store>
|
159 |
+
</enabled>
|
160 |
+
<time translate="label">
|
161 |
+
<label>Start Time</label>
|
162 |
+
<frontend_type>time</frontend_type>
|
163 |
+
<backend_model>connector/system_config_backend_syncschedule_suppressed</backend_model>
|
164 |
+
<sort_order>3</sort_order>
|
165 |
+
<show_in_default>1</show_in_default>
|
166 |
+
<show_in_website>0</show_in_website>
|
167 |
+
<show_in_store>0</show_in_store>
|
168 |
+
<depends><enabled>1</enabled></depends>
|
169 |
+
</time>
|
170 |
+
<frequency translate="label">
|
171 |
+
<label>Frequency</label>
|
172 |
+
<frontend_type>select</frontend_type>
|
173 |
+
<source_model>connector/system_config_source_syncfrequency</source_model>
|
174 |
+
<backend_model>connector/system_config_backend_syncschedule_suppressed</backend_model>
|
175 |
+
<sort_order>4</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>0</show_in_website>
|
178 |
+
<show_in_store>0</show_in_store>
|
179 |
+
<comment>Note: For Weekly and Monthly frequency, the day of the week/month will be today</comment>
|
180 |
+
<depends><enabled>1</enabled></depends>
|
181 |
+
</frequency>
|
182 |
+
<force_sync translate="label">
|
183 |
+
<label></label>
|
184 |
+
<frontend_model>connector/debug_forcesuppressedsync</frontend_model>
|
185 |
+
<sort_order>20</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>0</show_in_website>
|
188 |
+
<show_in_store>0</show_in_store>
|
189 |
+
<comment>Use this button force the suppressed data synchronization to run now</comment>
|
190 |
+
</force_sync>
|
191 |
+
</fields>
|
192 |
+
</sync_suppressed_schedule>
|
193 |
+
<transactional_data translate="label">
|
194 |
+
<label><![CDATA[ Transactional data settings]]></label>
|
195 |
+
<frontend_type>text</frontend_type>
|
196 |
+
<sort_order>30</sort_order>
|
197 |
+
<show_in_default>1</show_in_default>
|
198 |
+
<show_in_website>1</show_in_website>
|
199 |
+
<show_in_store>0</show_in_store>
|
200 |
+
<fields>
|
201 |
+
<order_info_title translate="label">
|
202 |
+
<label>Order/Basket Information</label>
|
203 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
204 |
+
<sort_order>10</sort_order>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>0</show_in_store>
|
208 |
+
</order_info_title>
|
209 |
+
<order_enabled translate="label">
|
210 |
+
<label>Enabled</label>
|
211 |
+
<frontend_type>select</frontend_type>
|
212 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
213 |
+
<sort_order>20</sort_order>
|
214 |
+
<show_in_default>1</show_in_default>
|
215 |
+
<show_in_website>1</show_in_website>
|
216 |
+
<show_in_store>0</show_in_store>
|
217 |
+
</order_enabled>
|
218 |
+
<wishlist_tile translate="label">
|
219 |
+
<label>Wish List Information</label>
|
220 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
221 |
+
<sort_order>30</sort_order>
|
222 |
+
<show_in_default>1</show_in_default>
|
223 |
+
<show_in_website>1</show_in_website>
|
224 |
+
<show_in_store>0</show_in_store>
|
225 |
+
</wishlist_tile>
|
226 |
+
<wishlist_enabled translate="label">
|
227 |
+
<label>Enabled</label>
|
228 |
+
<frontend_type>select</frontend_type>
|
229 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
230 |
+
<sort_order>40</sort_order>
|
231 |
+
<show_in_default>1</show_in_default>
|
232 |
+
<show_in_website>1</show_in_website>
|
233 |
+
<show_in_store>0</show_in_store>
|
234 |
+
</wishlist_enabled>
|
235 |
+
</fields>
|
236 |
+
</transactional_data>
|
237 |
+
</groups>
|
238 |
+
</connector_sync_settings>
|
239 |
+
<connector_data_field_settings translate="label">
|
240 |
+
<label><![CDATA[Data Mapping]]></label>
|
241 |
+
<tab>connector</tab>
|
242 |
+
<frontend_type>text</frontend_type>
|
243 |
+
<sort_order>2000</sort_order>
|
244 |
+
<show_in_default>1</show_in_default>
|
245 |
+
<show_in_website>1</show_in_website>
|
246 |
+
<show_in_store>0</show_in_store>
|
247 |
+
<groups>
|
248 |
+
<customer_data>
|
249 |
+
<label>Data Field Mapping</label>
|
250 |
+
<frontend_type>text</frontend_type>
|
251 |
+
<sort_order>20</sort_order>
|
252 |
+
<show_in_default>1</show_in_default>
|
253 |
+
<show_in_website>1</show_in_website>
|
254 |
+
<show_in_store>0</show_in_store>
|
255 |
+
<expanded>1</expanded>
|
256 |
+
<fields>
|
257 |
+
<customer_title translate="label">
|
258 |
+
<label>Customer Information</label>
|
259 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
260 |
+
<sort_order>10</sort_order>
|
261 |
+
<show_in_default>1</show_in_default>
|
262 |
+
<show_in_website>1</show_in_website>
|
263 |
+
<show_in_store>0</show_in_store>
|
264 |
+
</customer_title>
|
265 |
+
|
266 |
+
<customer_id translate="label">
|
267 |
+
<label>Customer ID</label>
|
268 |
+
<frontend_type>select</frontend_type>
|
269 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
270 |
+
<sort_order>20</sort_order>
|
271 |
+
<show_in_default>1</show_in_default>
|
272 |
+
<show_in_website>1</show_in_website>
|
273 |
+
<show_in_store>0</show_in_store>
|
274 |
+
<comment>Please map the customer id, if you want to use the dynamic content.</comment>
|
275 |
+
</customer_id>
|
276 |
+
<title>
|
277 |
+
<label>Title</label>
|
278 |
+
<frontend_type>select</frontend_type>
|
279 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
280 |
+
<sort_order>30</sort_order>
|
281 |
+
<show_in_default>1</show_in_default>
|
282 |
+
<show_in_website>1</show_in_website>
|
283 |
+
<show_in_store>0</show_in_store>
|
284 |
+
</title>
|
285 |
+
|
286 |
+
<firstname>
|
287 |
+
<label>First Name</label>
|
288 |
+
<frontend_type>select</frontend_type>
|
289 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
290 |
+
<sort_order>40</sort_order>
|
291 |
+
<show_in_default>1</show_in_default>
|
292 |
+
<show_in_website>1</show_in_website>
|
293 |
+
<show_in_store>0</show_in_store>
|
294 |
+
</firstname>
|
295 |
+
<lastname>
|
296 |
+
<label>Last Name</label>
|
297 |
+
<frontend_type>select</frontend_type>
|
298 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
299 |
+
<sort_order>50</sort_order>
|
300 |
+
<show_in_default>1</show_in_default>
|
301 |
+
<show_in_website>1</show_in_website>
|
302 |
+
<show_in_store>0</show_in_store>
|
303 |
+
</lastname>
|
304 |
+
<dob>
|
305 |
+
<label>D.O.B.</label>
|
306 |
+
<frontend_type>select</frontend_type>
|
307 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
308 |
+
<sort_order>60</sort_order>
|
309 |
+
<show_in_default>1</show_in_default>
|
310 |
+
<show_in_website>1</show_in_website>
|
311 |
+
<show_in_store>0</show_in_store>
|
312 |
+
</dob>
|
313 |
+
<gender>
|
314 |
+
<label>Gender</label>
|
315 |
+
<frontend_type>select</frontend_type>
|
316 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
317 |
+
<sort_order>70</sort_order>
|
318 |
+
<show_in_default>1</show_in_default>
|
319 |
+
<show_in_website>1</show_in_website>
|
320 |
+
<show_in_store>0</show_in_store>
|
321 |
+
</gender>
|
322 |
+
<website_created_on>
|
323 |
+
<label>Website Created On</label>
|
324 |
+
<frontend_type>select</frontend_type>
|
325 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
326 |
+
<sort_order>80</sort_order>
|
327 |
+
<show_in_default>1</show_in_default>
|
328 |
+
<show_in_website>1</show_in_website>
|
329 |
+
<show_in_store>0</show_in_store>
|
330 |
+
</website_created_on>
|
331 |
+
<store_created_on>
|
332 |
+
<label>Store Created On</label>
|
333 |
+
<frontend_type>select</frontend_type>
|
334 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
335 |
+
<sort_order>90</sort_order>
|
336 |
+
<show_in_default>1</show_in_default>
|
337 |
+
<show_in_website>1</show_in_website>
|
338 |
+
<show_in_store>0</show_in_store>
|
339 |
+
</store_created_on>
|
340 |
+
<account_created>
|
341 |
+
<label>Account Created Date</label>
|
342 |
+
<frontend_type>select</frontend_type>
|
343 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
344 |
+
<sort_order>100</sort_order>
|
345 |
+
<show_in_default>1</show_in_default>
|
346 |
+
<show_in_website>1</show_in_website>
|
347 |
+
<show_in_store>0</show_in_store>
|
348 |
+
</account_created>
|
349 |
+
<last_logged_in>
|
350 |
+
<label>Last Logged In Date</label>
|
351 |
+
<frontend_type>select</frontend_type>
|
352 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
353 |
+
<sort_order>110</sort_order>
|
354 |
+
<show_in_default>1</show_in_default>
|
355 |
+
<show_in_website>1</show_in_website>
|
356 |
+
<show_in_store>0</show_in_store>
|
357 |
+
</last_logged_in>
|
358 |
+
<customer_group>
|
359 |
+
<label>Customer Group</label>
|
360 |
+
<frontend_type>select</frontend_type>
|
361 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
362 |
+
<sort_order>120</sort_order>
|
363 |
+
<show_in_default>1</show_in_default>
|
364 |
+
<show_in_website>1</show_in_website>
|
365 |
+
<show_in_store>0</show_in_store>
|
366 |
+
</customer_group>
|
367 |
+
<address_title translate="label">
|
368 |
+
<label>Address Information</label>
|
369 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
370 |
+
<sort_order>130</sort_order>
|
371 |
+
<show_in_default>1</show_in_default>
|
372 |
+
<show_in_website>1</show_in_website>
|
373 |
+
<show_in_store>0</show_in_store>
|
374 |
+
</address_title>
|
375 |
+
<billing_address_1>
|
376 |
+
<label>Billing Address Line 1</label>
|
377 |
+
<frontend_type>select</frontend_type>
|
378 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
379 |
+
<sort_order>140</sort_order>
|
380 |
+
<show_in_default>1</show_in_default>
|
381 |
+
<show_in_website>1</show_in_website>
|
382 |
+
<show_in_store>0</show_in_store>
|
383 |
+
</billing_address_1>
|
384 |
+
<billing_address_2>
|
385 |
+
<label>Billing Address Line 2</label>
|
386 |
+
<frontend_type>select</frontend_type>
|
387 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
388 |
+
<sort_order>150</sort_order>
|
389 |
+
<show_in_default>1</show_in_default>
|
390 |
+
<show_in_website>1</show_in_website>
|
391 |
+
<show_in_store>0</show_in_store>
|
392 |
+
</billing_address_2>
|
393 |
+
<billing_city>
|
394 |
+
<label>Billing City</label>
|
395 |
+
<frontend_type>select</frontend_type>
|
396 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
397 |
+
<sort_order>160</sort_order>
|
398 |
+
<show_in_default>1</show_in_default>
|
399 |
+
<show_in_website>1</show_in_website>
|
400 |
+
<show_in_store>0</show_in_store>
|
401 |
+
</billing_city>
|
402 |
+
<billing_country>
|
403 |
+
<label>Billing Country</label>
|
404 |
+
<frontend_type>select</frontend_type>
|
405 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
406 |
+
<sort_order>170</sort_order>
|
407 |
+
<show_in_default>1</show_in_default>
|
408 |
+
<show_in_website>1</show_in_website>
|
409 |
+
<show_in_store>0</show_in_store>
|
410 |
+
</billing_country>
|
411 |
+
<billing_postcode>
|
412 |
+
<label>Billing Zip/Postcode</label>
|
413 |
+
<frontend_type>select</frontend_type>
|
414 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
415 |
+
<sort_order>180</sort_order>
|
416 |
+
<show_in_default>1</show_in_default>
|
417 |
+
<show_in_website>1</show_in_website>
|
418 |
+
<show_in_store>0</show_in_store>
|
419 |
+
</billing_postcode>
|
420 |
+
<billing_telephone>
|
421 |
+
<label>Billing Telephone</label>
|
422 |
+
<frontend_type>select</frontend_type>
|
423 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
424 |
+
<sort_order>190</sort_order>
|
425 |
+
<show_in_default>1</show_in_default>
|
426 |
+
<show_in_website>1</show_in_website>
|
427 |
+
<show_in_store>0</show_in_store>
|
428 |
+
</billing_telephone>
|
429 |
+
<delivery_address_1>
|
430 |
+
<label>Delivery Address Line 1</label>
|
431 |
+
<frontend_type>select</frontend_type>
|
432 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
433 |
+
<sort_order>200</sort_order>
|
434 |
+
<show_in_default>1</show_in_default>
|
435 |
+
<show_in_website>1</show_in_website>
|
436 |
+
<show_in_store>0</show_in_store>
|
437 |
+
</delivery_address_1>
|
438 |
+
<delivery_address_2>
|
439 |
+
<label>Delivery Address Line 2</label>
|
440 |
+
<frontend_type>select</frontend_type>
|
441 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
442 |
+
<sort_order>210</sort_order>
|
443 |
+
<show_in_default>1</show_in_default>
|
444 |
+
<show_in_website>1</show_in_website>
|
445 |
+
<show_in_store>0</show_in_store>
|
446 |
+
</delivery_address_2>
|
447 |
+
<delivery_city>
|
448 |
+
<label>Delivery City</label>
|
449 |
+
<frontend_type>select</frontend_type>
|
450 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
451 |
+
<sort_order>220</sort_order>
|
452 |
+
<show_in_default>1</show_in_default>
|
453 |
+
<show_in_website>1</show_in_website>
|
454 |
+
<show_in_store>0</show_in_store>
|
455 |
+
</delivery_city>
|
456 |
+
<delivery_country>
|
457 |
+
<label>Delivery Country</label>
|
458 |
+
<frontend_type>select</frontend_type>
|
459 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
460 |
+
<sort_order>230</sort_order>
|
461 |
+
<show_in_default>1</show_in_default>
|
462 |
+
<show_in_website>1</show_in_website>
|
463 |
+
<show_in_store>0</show_in_store>
|
464 |
+
</delivery_country>
|
465 |
+
<delivery_postcode>
|
466 |
+
<label>Delivery Zip/Postcode</label>
|
467 |
+
<frontend_type>select</frontend_type>
|
468 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
469 |
+
<sort_order>240</sort_order>
|
470 |
+
<show_in_default>1</show_in_default>
|
471 |
+
<show_in_website>1</show_in_website>
|
472 |
+
<show_in_store>0</show_in_store>
|
473 |
+
</delivery_postcode>
|
474 |
+
<delivery_telephone>
|
475 |
+
<label>Delivery Telephone</label>
|
476 |
+
<frontend_type>select</frontend_type>
|
477 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
478 |
+
<sort_order>250</sort_order>
|
479 |
+
<show_in_default>1</show_in_default>
|
480 |
+
<show_in_website>1</show_in_website>
|
481 |
+
<show_in_store>0</show_in_store>
|
482 |
+
</delivery_telephone>
|
483 |
+
<sales_title translate="label">
|
484 |
+
<label>Sales Information</label>
|
485 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
486 |
+
<sort_order>260</sort_order>
|
487 |
+
<show_in_default>1</show_in_default>
|
488 |
+
<show_in_website>1</show_in_website>
|
489 |
+
<show_in_store>0</show_in_store>
|
490 |
+
</sales_title>
|
491 |
+
<total_orders>
|
492 |
+
<label>Total Number of Orders</label>
|
493 |
+
<frontend_type>select</frontend_type>
|
494 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
495 |
+
<sort_order>270</sort_order>
|
496 |
+
<show_in_default>1</show_in_default>
|
497 |
+
<show_in_website>1</show_in_website>
|
498 |
+
<show_in_store>0</show_in_store>
|
499 |
+
</total_orders>
|
500 |
+
<average_order_value>
|
501 |
+
<label>Average Order Value</label>
|
502 |
+
<frontend_type>select</frontend_type>
|
503 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
504 |
+
<sort_order>280</sort_order>
|
505 |
+
<show_in_default>1</show_in_default>
|
506 |
+
<show_in_website>1</show_in_website>
|
507 |
+
<show_in_store>0</show_in_store>
|
508 |
+
</average_order_value>
|
509 |
+
<total_spend>
|
510 |
+
<label>Total Spend</label>
|
511 |
+
<frontend_type>select</frontend_type>
|
512 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
513 |
+
<sort_order>290</sort_order>
|
514 |
+
<show_in_default>1</show_in_default>
|
515 |
+
<show_in_website>1</show_in_website>
|
516 |
+
<show_in_store>0</show_in_store>
|
517 |
+
</total_spend>
|
518 |
+
<last_order translate="label">
|
519 |
+
<label>Last Purchase Date</label>
|
520 |
+
<frontend_type>select</frontend_type>
|
521 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
522 |
+
<sort_order>300</sort_order>
|
523 |
+
<show_in_default>1</show_in_default>
|
524 |
+
<show_in_website>1</show_in_website>
|
525 |
+
<show_in_store>0</show_in_store>
|
526 |
+
</last_order>
|
527 |
+
<last_order_no translate="label">
|
528 |
+
<label>Last Order No</label>
|
529 |
+
<frontend_type>select</frontend_type>
|
530 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
531 |
+
<sort_order>310</sort_order>
|
532 |
+
<show_in_default>1</show_in_default>
|
533 |
+
<show_in_website>1</show_in_website>
|
534 |
+
<show_in_store>0</show_in_store>
|
535 |
+
</last_order_no>
|
536 |
+
<validator>
|
537 |
+
<label>Validation Block</label>
|
538 |
+
<frontend_type>select</frontend_type>
|
539 |
+
<source_model>connector/system_config_source_datafields</source_model>
|
540 |
+
<frontend_model>connector/adminhtml_system_config_validator</frontend_model>
|
541 |
+
<sort_order>320</sort_order>
|
542 |
+
<show_in_default>1</show_in_default>
|
543 |
+
<show_in_website>1</show_in_website>
|
544 |
+
<show_in_store>0</show_in_store>
|
545 |
+
<can_be_empty>1</can_be_empty>
|
546 |
+
<expanded>1</expanded>
|
547 |
+
</validator>
|
548 |
+
</fields>
|
549 |
+
</customer_data>
|
550 |
+
<address_book translate="label">
|
551 |
+
<label>Address Book Mapping</label>
|
552 |
+
<sort_order>10</sort_order>
|
553 |
+
<show_in_default>1</show_in_default>
|
554 |
+
<show_in_website>1</show_in_website>
|
555 |
+
<show_in_store>0</show_in_store>
|
556 |
+
<expanded>1</expanded>
|
557 |
+
<fields>
|
558 |
+
<customers>
|
559 |
+
<label>Add Customers to</label>
|
560 |
+
<frontend_type>select</frontend_type>
|
561 |
+
<source_model>connector/system_config_source_addressbooks</source_model>
|
562 |
+
<sort_order>10</sort_order>
|
563 |
+
<show_in_default>1</show_in_default>
|
564 |
+
<show_in_website>1</show_in_website>
|
565 |
+
<show_in_store>0</show_in_store>
|
566 |
+
</customers>
|
567 |
+
<subscribers>
|
568 |
+
<label>Add Subscribers to</label>
|
569 |
+
<frontend_type>select</frontend_type>
|
570 |
+
<source_model>connector/system_config_source_addressbooks</source_model>
|
571 |
+
<sort_order>20</sort_order>
|
572 |
+
<show_in_default>1</show_in_default>
|
573 |
+
<show_in_website>1</show_in_website>
|
574 |
+
<show_in_store>0</show_in_store>
|
575 |
+
</subscribers>
|
576 |
+
<guest>
|
577 |
+
<label>Add Guests to</label>
|
578 |
+
<frontend_type>select</frontend_type>
|
579 |
+
<source_model>connector/system_config_source_addressbooks</source_model>
|
580 |
+
<sort_order>30</sort_order>
|
581 |
+
<show_in_default>1</show_in_default>
|
582 |
+
<show_in_website>1</show_in_website>
|
583 |
+
<show_in_store>0</show_in_store>
|
584 |
+
</guest>
|
585 |
+
</fields>
|
586 |
+
</address_book>
|
587 |
+
</groups>
|
588 |
+
</connector_data_field_settings>
|
589 |
+
<connector_roi_page_tracking_settings translate="label">
|
590 |
+
<label><![CDATA[ROI & Tracking]]></label>
|
591 |
+
<tab>connector</tab>
|
592 |
+
<frontend_type>text</frontend_type>
|
593 |
+
<sort_order>4000</sort_order>
|
594 |
+
<show_in_default>1</show_in_default>
|
595 |
+
<show_in_website>1</show_in_website>
|
596 |
+
<show_in_store>0</show_in_store>
|
597 |
+
<groups>
|
598 |
+
<page_tracking>
|
599 |
+
<label>Page Tracking</label>
|
600 |
+
<frontend_type>text</frontend_type>
|
601 |
+
<sort_order>10</sort_order>
|
602 |
+
<show_in_default>1</show_in_default>
|
603 |
+
<show_in_website>1</show_in_website>
|
604 |
+
<show_in_store>0</show_in_store>
|
605 |
+
<expanded>1</expanded>
|
606 |
+
<fields>
|
607 |
+
<enabled translate="label">
|
608 |
+
<label>Enabled</label>
|
609 |
+
<frontend_type>select</frontend_type>
|
610 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
611 |
+
<sort_order>10</sort_order>
|
612 |
+
<show_in_default>1</show_in_default>
|
613 |
+
<show_in_website>1</show_in_website>
|
614 |
+
<show_in_store>0</show_in_store>
|
615 |
+
</enabled>
|
616 |
+
</fields>
|
617 |
+
</page_tracking>
|
618 |
+
<roi_tracking>
|
619 |
+
<label>ROI Tracking</label>
|
620 |
+
<frontend_type>text</frontend_type>
|
621 |
+
<sort_order>20</sort_order>
|
622 |
+
<show_in_default>1</show_in_default>
|
623 |
+
<show_in_website>1</show_in_website>
|
624 |
+
<show_in_store>0</show_in_store>
|
625 |
+
<expanded>1</expanded>
|
626 |
+
<fields>
|
627 |
+
<enabled translate="label">
|
628 |
+
<label>Enabled</label>
|
629 |
+
<frontend_type>select</frontend_type>
|
630 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
631 |
+
<sort_order>10</sort_order>
|
632 |
+
<show_in_default>1</show_in_default>
|
633 |
+
<show_in_website>1</show_in_website>
|
634 |
+
<show_in_store>0</show_in_store>
|
635 |
+
</enabled>
|
636 |
+
</fields>
|
637 |
+
</roi_tracking>
|
638 |
+
</groups>
|
639 |
+
</connector_roi_page_tracking_settings>
|
640 |
+
<lost_basket_settings translate="label">
|
641 |
+
<label><![CDATA[Lost Baskets]]></label>
|
642 |
+
<tab>connector</tab>
|
643 |
+
<frontend_type>text</frontend_type>
|
644 |
+
<sort_order>6000</sort_order>
|
645 |
+
<show_in_default>1</show_in_default>
|
646 |
+
<show_in_website>1</show_in_website>
|
647 |
+
<show_in_store>1</show_in_store>
|
648 |
+
<groups>
|
649 |
+
<active>
|
650 |
+
<label>Lost Baskets Settings</label>
|
651 |
+
<frontend_type>text</frontend_type>
|
652 |
+
<sort_order>100</sort_order>
|
653 |
+
<show_in_default>0</show_in_default>
|
654 |
+
<show_in_website>0</show_in_website>
|
655 |
+
<show_in_store>0</show_in_store>
|
656 |
+
<fields>
|
657 |
+
<active translate="label">
|
658 |
+
<label>Consider Order complete for lost baskets</label>
|
659 |
+
<frontend_type>select</frontend_type>
|
660 |
+
<source_model>connector/system_config_source_activebasket</source_model>
|
661 |
+
<sort_order>10</sort_order>
|
662 |
+
<show_in_default>1</show_in_default>
|
663 |
+
<show_in_website>1</show_in_website>
|
664 |
+
<show_in_store>0</show_in_store>
|
665 |
+
</active>
|
666 |
+
</fields>
|
667 |
+
</active>
|
668 |
+
<customers>
|
669 |
+
<label>Customers</label>
|
670 |
+
<frontend_type>text</frontend_type>
|
671 |
+
<sort_order>10</sort_order>
|
672 |
+
<show_in_default>1</show_in_default>
|
673 |
+
<show_in_website>1</show_in_website>
|
674 |
+
<show_in_store>1</show_in_store>
|
675 |
+
<expanded>1</expanded>
|
676 |
+
<fields>
|
677 |
+
<heading_1 translate="label">
|
678 |
+
<label>Lost basket 1</label>
|
679 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
680 |
+
<sort_order>10</sort_order>
|
681 |
+
<show_in_default>1</show_in_default>
|
682 |
+
<show_in_website>1</show_in_website>
|
683 |
+
<show_in_store>1</show_in_store>
|
684 |
+
</heading_1>
|
685 |
+
<enabled_1 translate="label">
|
686 |
+
<label>Enabled/Disabled</label>
|
687 |
+
<frontend_type>select</frontend_type>
|
688 |
+
<config_path>lostbaskets/customers/enabled_1</config_path>
|
689 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
690 |
+
<sort_order>20</sort_order>
|
691 |
+
<show_in_default>1</show_in_default>
|
692 |
+
<show_in_website>1</show_in_website>
|
693 |
+
<show_in_store>1</show_in_store>
|
694 |
+
</enabled_1>
|
695 |
+
<send_after_1>
|
696 |
+
<label>Send after (min)</label>
|
697 |
+
<frontend_type>select</frontend_type>
|
698 |
+
<source_model>connector/system_config_source_lostbasket</source_model>
|
699 |
+
<sort_order>30</sort_order>
|
700 |
+
<show_in_default>1</show_in_default>
|
701 |
+
<show_in_website>1</show_in_website>
|
702 |
+
<show_in_store>1</show_in_store>
|
703 |
+
</send_after_1>
|
704 |
+
<campaign_1>
|
705 |
+
<label>Campaign To Send</label>
|
706 |
+
<frontend_type>select</frontend_type>
|
707 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
708 |
+
<sort_order>40</sort_order>
|
709 |
+
<show_in_default>1</show_in_default>
|
710 |
+
<show_in_website>1</show_in_website>
|
711 |
+
<show_in_store>1</show_in_store>
|
712 |
+
</campaign_1>
|
713 |
+
<heading_2 translate="label">
|
714 |
+
<label>Lost basket 2</label>
|
715 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
716 |
+
<sort_order>50</sort_order>
|
717 |
+
<show_in_default>1</show_in_default>
|
718 |
+
<show_in_website>1</show_in_website>
|
719 |
+
<show_in_store>1</show_in_store>
|
720 |
+
</heading_2>
|
721 |
+
<enabled_2 translate="label">
|
722 |
+
<label>Enabled/Disabled</label>
|
723 |
+
<frontend_type>select</frontend_type>
|
724 |
+
<config_path>lostbaskets/customers/enabled_2</config_path>
|
725 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
726 |
+
<sort_order>60</sort_order>
|
727 |
+
<show_in_default>1</show_in_default>
|
728 |
+
<show_in_website>1</show_in_website>
|
729 |
+
<show_in_store>1</show_in_store>
|
730 |
+
</enabled_2>
|
731 |
+
<send_after_2>
|
732 |
+
<label>Send after (hrs)</label>
|
733 |
+
<frontend_type>select</frontend_type>
|
734 |
+
<source_model>connector/system_config_source_sendcampain</source_model>
|
735 |
+
<sort_order>70</sort_order>
|
736 |
+
<show_in_default>1</show_in_default>
|
737 |
+
<show_in_website>1</show_in_website>
|
738 |
+
<show_in_store>1</show_in_store>
|
739 |
+
</send_after_2>
|
740 |
+
<campaign_2>
|
741 |
+
<label>Campaign to send</label>
|
742 |
+
<frontend_type>select</frontend_type>
|
743 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
744 |
+
<sort_order>80</sort_order>
|
745 |
+
<show_in_default>1</show_in_default>
|
746 |
+
<show_in_website>1</show_in_website>
|
747 |
+
<show_in_store>1</show_in_store>
|
748 |
+
</campaign_2>
|
749 |
+
<heading_3 translate="label">
|
750 |
+
<label>Lost basket 3 </label>
|
751 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
752 |
+
<sort_order>90</sort_order>
|
753 |
+
<show_in_default>1</show_in_default>
|
754 |
+
<show_in_website>1</show_in_website>
|
755 |
+
<show_in_store>1</show_in_store>
|
756 |
+
</heading_3>
|
757 |
+
<enabled_3 translate="label">
|
758 |
+
<label>Enabled/Disabled</label>
|
759 |
+
<frontend_type>select</frontend_type>
|
760 |
+
<config_path>lostbaskets/customers/enabled_3</config_path>
|
761 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
762 |
+
<sort_order>100</sort_order>
|
763 |
+
<show_in_default>1</show_in_default>
|
764 |
+
<show_in_website>1</show_in_website>
|
765 |
+
<show_in_store>1</show_in_store>
|
766 |
+
</enabled_3>
|
767 |
+
<send_after_3>
|
768 |
+
<label>Send after (hrs)</label>
|
769 |
+
<frontend_type>select</frontend_type>
|
770 |
+
<source_model>connector/system_config_source_sendcampain</source_model>
|
771 |
+
<sort_order>110</sort_order>
|
772 |
+
<show_in_default>1</show_in_default>
|
773 |
+
<show_in_website>1</show_in_website>
|
774 |
+
<show_in_store>1</show_in_store>
|
775 |
+
</send_after_3>
|
776 |
+
<campaign_3>
|
777 |
+
<label>Campaign to send</label>
|
778 |
+
<frontend_type>select</frontend_type>
|
779 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
780 |
+
<sort_order>120</sort_order>
|
781 |
+
<show_in_default>1</show_in_default>
|
782 |
+
<show_in_website>1</show_in_website>
|
783 |
+
<show_in_store>1</show_in_store>
|
784 |
+
</campaign_3>
|
785 |
+
</fields>
|
786 |
+
</customers>
|
787 |
+
<guests>
|
788 |
+
<label>Guests</label>
|
789 |
+
<frontend_type>text</frontend_type>
|
790 |
+
<sort_order>20</sort_order>
|
791 |
+
<show_in_default>1</show_in_default>
|
792 |
+
<show_in_website>1</show_in_website>
|
793 |
+
<show_in_store>1</show_in_store>
|
794 |
+
<fields>
|
795 |
+
<heading_1 translate="label">
|
796 |
+
<label>Lost basket 1</label>
|
797 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
798 |
+
<sort_order>10</sort_order>
|
799 |
+
<show_in_default>1</show_in_default>
|
800 |
+
<show_in_website>1</show_in_website>
|
801 |
+
<show_in_store>1</show_in_store>
|
802 |
+
</heading_1>
|
803 |
+
<enabled_1 translate="label">
|
804 |
+
<label>Enabled/Disabled</label>
|
805 |
+
<frontend_type>select</frontend_type>
|
806 |
+
<config_path>lostbaskets/guests/enabled_1</config_path>
|
807 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
808 |
+
<sort_order>20</sort_order>
|
809 |
+
<show_in_default>1</show_in_default>
|
810 |
+
<show_in_website>1</show_in_website>
|
811 |
+
<show_in_store>1</show_in_store>
|
812 |
+
</enabled_1>
|
813 |
+
<send_after_1>
|
814 |
+
<label>Send after (min)</label>
|
815 |
+
<frontend_type>select</frontend_type>
|
816 |
+
<source_model>connector/system_config_source_lostbasket</source_model>
|
817 |
+
<sort_order>30</sort_order>
|
818 |
+
<show_in_default>1</show_in_default>
|
819 |
+
<show_in_website>1</show_in_website>
|
820 |
+
<show_in_store>1</show_in_store>
|
821 |
+
</send_after_1>
|
822 |
+
<campaign_1>
|
823 |
+
<label>Campaign To Send</label>
|
824 |
+
<frontend_type>select</frontend_type>
|
825 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
826 |
+
<sort_order>40</sort_order>
|
827 |
+
<show_in_default>1</show_in_default>
|
828 |
+
<show_in_website>1</show_in_website>
|
829 |
+
<show_in_store>1</show_in_store>
|
830 |
+
</campaign_1>
|
831 |
+
|
832 |
+
<heading_2 translate="label">
|
833 |
+
<label>Lost basket 2</label>
|
834 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
835 |
+
<sort_order>50</sort_order>
|
836 |
+
<show_in_default>1</show_in_default>
|
837 |
+
<show_in_website>1</show_in_website>
|
838 |
+
<show_in_store>1</show_in_store>
|
839 |
+
</heading_2>
|
840 |
+
<enabled_2 translate="label">
|
841 |
+
<label>Enabled/Disabled</label>
|
842 |
+
<frontend_type>select</frontend_type>
|
843 |
+
<config_path>lostbaskets/guests/enabled_2</config_path>
|
844 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
845 |
+
<sort_order>60</sort_order>
|
846 |
+
<show_in_default>1</show_in_default>
|
847 |
+
<show_in_website>1</show_in_website>
|
848 |
+
<show_in_store>1</show_in_store>
|
849 |
+
</enabled_2>
|
850 |
+
<send_after_2>
|
851 |
+
<label>Send after (hrs)</label>
|
852 |
+
<frontend_type>select</frontend_type>
|
853 |
+
<source_model>connector/system_config_source_sendcampain</source_model>
|
854 |
+
<sort_order>70</sort_order>
|
855 |
+
<show_in_default>1</show_in_default>
|
856 |
+
<show_in_website>1</show_in_website>
|
857 |
+
<show_in_store>1</show_in_store>
|
858 |
+
</send_after_2>
|
859 |
+
<campaign_2>
|
860 |
+
<label>Campaign to send</label>
|
861 |
+
<frontend_type>select</frontend_type>
|
862 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
863 |
+
<sort_order>80</sort_order>
|
864 |
+
<show_in_default>1</show_in_default>
|
865 |
+
<show_in_website>1</show_in_website>
|
866 |
+
<show_in_store>1</show_in_store>
|
867 |
+
</campaign_2>
|
868 |
+
|
869 |
+
<heading_3 translate="label">
|
870 |
+
<label>Lost basket 3 </label>
|
871 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
872 |
+
<sort_order>90</sort_order>
|
873 |
+
<show_in_default>1</show_in_default>
|
874 |
+
<show_in_website>1</show_in_website>
|
875 |
+
<show_in_store>1</show_in_store>
|
876 |
+
</heading_3>
|
877 |
+
<enabled_3 translate="label">
|
878 |
+
<label>Enabled/Disabled</label>
|
879 |
+
<frontend_type>select</frontend_type>
|
880 |
+
<config_path>lostbaskets/guests/enabled_3</config_path>
|
881 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
882 |
+
<sort_order>100</sort_order>
|
883 |
+
<show_in_default>1</show_in_default>
|
884 |
+
<show_in_website>1</show_in_website>
|
885 |
+
<show_in_store>1</show_in_store>
|
886 |
+
</enabled_3>
|
887 |
+
<send_after_3>
|
888 |
+
<label>Send after (hrs)</label>
|
889 |
+
<frontend_type>select</frontend_type>
|
890 |
+
<source_model>connector/system_config_source_sendcampain</source_model>
|
891 |
+
<sort_order>110</sort_order>
|
892 |
+
<show_in_default>1</show_in_default>
|
893 |
+
<show_in_website>1</show_in_website>
|
894 |
+
<show_in_store>1</show_in_store>
|
895 |
+
</send_after_3>
|
896 |
+
<campaign_3>
|
897 |
+
<label>Campaign to send</label>
|
898 |
+
<frontend_type>select</frontend_type>
|
899 |
+
<source_model>connector/system_config_source_campaigns</source_model>
|
900 |
+
<sort_order>120</sort_order>
|
901 |
+
<show_in_default>1</show_in_default>
|
902 |
+
<show_in_website>1</show_in_website>
|
903 |
+
<show_in_store>1</show_in_store>
|
904 |
+
</campaign_3>
|
905 |
+
</fields>
|
906 |
+
</guests>
|
907 |
+
<test>
|
908 |
+
<label>Test</label>
|
909 |
+
<frontend_type>text</frontend_type>
|
910 |
+
<sort_order>30</sort_order>
|
911 |
+
<show_in_default>1</show_in_default>
|
912 |
+
<show_in_website>1</show_in_website>
|
913 |
+
<show_in_store>1</show_in_store>
|
914 |
+
<fields>
|
915 |
+
<email translate="label">
|
916 |
+
<label>Test Email</label>
|
917 |
+
<frontend_type>text</frontend_type>
|
918 |
+
<sort_order>10</sort_order>
|
919 |
+
<show_in_default>1</show_in_default>
|
920 |
+
<show_in_website>1</show_in_website>
|
921 |
+
<show_in_store>0</show_in_store>
|
922 |
+
<comment>Enter the email for customer to test lost basket, with the first lost basket campaign.</comment>
|
923 |
+
</email>
|
924 |
+
<force_test translate="label">
|
925 |
+
<label></label>
|
926 |
+
<frontend_model>connector/debug_forcelostbasketsync</frontend_model>
|
927 |
+
<sort_order>50</sort_order>
|
928 |
+
<show_in_default>1</show_in_default>
|
929 |
+
<show_in_website>0</show_in_website>
|
930 |
+
<show_in_store>0</show_in_store>
|
931 |
+
<comment>Use this button force the data synchronization to run now</comment>
|
932 |
+
</force_test>
|
933 |
+
</fields>
|
934 |
+
</test>
|
935 |
+
</groups>
|
936 |
+
</lost_basket_settings>
|
937 |
+
<sms_section translate="label">
|
938 |
+
<label><![CDATA[SMS]]></label>
|
939 |
+
<tab>connector</tab>
|
940 |
+
<frontend_type>text</frontend_type>
|
941 |
+
<sort_order>7000</sort_order>
|
942 |
+
<show_in_default>1</show_in_default>
|
943 |
+
<show_in_website>1</show_in_website>
|
944 |
+
<show_in_store>1</show_in_store>
|
945 |
+
<groups>
|
946 |
+
<sms_message_one translate="label">
|
947 |
+
<label>SMS Message 1</label>
|
948 |
+
<frontend_type>text</frontend_type>
|
949 |
+
<sort_order>10</sort_order>
|
950 |
+
<show_in_default>1</show_in_default>
|
951 |
+
<show_in_website>1</show_in_website>
|
952 |
+
<show_in_store>1</show_in_store>
|
953 |
+
<fields>
|
954 |
+
<enabled translate="label">
|
955 |
+
<label>Enabled</label>
|
956 |
+
<frontend_type>select</frontend_type>
|
957 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
958 |
+
<sort_order>10</sort_order>
|
959 |
+
<show_in_default>1</show_in_default>
|
960 |
+
<show_in_website>1</show_in_website>
|
961 |
+
<show_in_store>1</show_in_store>
|
962 |
+
</enabled>
|
963 |
+
<order_status translate="label">
|
964 |
+
<label>Order Status</label>
|
965 |
+
<sort_order>20</sort_order>
|
966 |
+
<frontend_type>select</frontend_type>
|
967 |
+
<source_model>connector/system_config_source_orderstatus</source_model>
|
968 |
+
<show_in_default>1</show_in_default>
|
969 |
+
<show_in_website>1</show_in_website>
|
970 |
+
<show_in_store>1</show_in_store>
|
971 |
+
</order_status>
|
972 |
+
<message translate="label">
|
973 |
+
<label>Message</label>
|
974 |
+
<frontend_type>textarea</frontend_type>
|
975 |
+
<frontend_model>connector/adminhtml_system_config_smsmessageone</frontend_model>
|
976 |
+
<sort_order>30</sort_order>
|
977 |
+
<show_in_default>1</show_in_default>
|
978 |
+
<show_in_website>1</show_in_website>
|
979 |
+
<show_in_store>1</show_in_store>
|
980 |
+
<validate>validate-length maximum-length-110</validate>
|
981 |
+
</message>
|
982 |
+
</fields>
|
983 |
+
|
984 |
+
</sms_message_one>
|
985 |
+
<sms_message_two translate="label">
|
986 |
+
<label>SMS Message 2</label>
|
987 |
+
<frontend_type>text</frontend_type>
|
988 |
+
<sort_order>20</sort_order>
|
989 |
+
<show_in_default>1</show_in_default>
|
990 |
+
<show_in_website>1</show_in_website>
|
991 |
+
<show_in_store>1</show_in_store>
|
992 |
+
<fields>
|
993 |
+
<enabled translate="label">
|
994 |
+
<label>Enabled</label>
|
995 |
+
<frontend_type>select</frontend_type>
|
996 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
997 |
+
<sort_order>10</sort_order>
|
998 |
+
<show_in_default>1</show_in_default>
|
999 |
+
<show_in_website>1</show_in_website>
|
1000 |
+
<show_in_store>1</show_in_store>
|
1001 |
+
</enabled>
|
1002 |
+
<order_status translate="label">
|
1003 |
+
<label>Order Status</label>
|
1004 |
+
<sort_order>20</sort_order>
|
1005 |
+
<frontend_type>select</frontend_type>
|
1006 |
+
<source_model>connector/system_config_source_orderstatus</source_model>
|
1007 |
+
<show_in_default>1</show_in_default>
|
1008 |
+
<show_in_website>1</show_in_website>
|
1009 |
+
<show_in_store>1</show_in_store>
|
1010 |
+
</order_status>
|
1011 |
+
<message translate="label">
|
1012 |
+
<label>Message</label>
|
1013 |
+
<frontend_type>textarea</frontend_type>
|
1014 |
+
<frontend_model>connector/adminhtml_system_config_smsmessagetwo</frontend_model>
|
1015 |
+
<sort_order>30</sort_order>
|
1016 |
+
<show_in_default>1</show_in_default>
|
1017 |
+
<show_in_website>1</show_in_website>
|
1018 |
+
<show_in_store>1</show_in_store>
|
1019 |
+
<validate>validate-length maximum-length-110</validate>
|
1020 |
+
</message>
|
1021 |
+
</fields>
|
1022 |
+
|
1023 |
+
</sms_message_two>
|
1024 |
+
<sms_message_three translate="label">
|
1025 |
+
<label>SMS Message 3</label>
|
1026 |
+
<frontend_type>text</frontend_type>
|
1027 |
+
<sort_order>30</sort_order>
|
1028 |
+
<show_in_default>1</show_in_default>
|
1029 |
+
<show_in_website>1</show_in_website>
|
1030 |
+
<show_in_store>1</show_in_store>
|
1031 |
+
<fields>
|
1032 |
+
<enabled translate="label">
|
1033 |
+
<label>Enabled</label>
|
1034 |
+
<frontend_type>select</frontend_type>
|
1035 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1036 |
+
<sort_order>10</sort_order>
|
1037 |
+
<show_in_default>1</show_in_default>
|
1038 |
+
<show_in_website>1</show_in_website>
|
1039 |
+
<show_in_store>1</show_in_store>
|
1040 |
+
</enabled>
|
1041 |
+
<order_status translate="label">
|
1042 |
+
<label>Order Status</label>
|
1043 |
+
<sort_order>20</sort_order>
|
1044 |
+
<frontend_type>select</frontend_type>
|
1045 |
+
<source_model>connector/system_config_source_orderstatus</source_model>
|
1046 |
+
<show_in_default>1</show_in_default>
|
1047 |
+
<show_in_website>1</show_in_website>
|
1048 |
+
<show_in_store>1</show_in_store>
|
1049 |
+
</order_status>
|
1050 |
+
<message translate="label">
|
1051 |
+
<label>Message</label>
|
1052 |
+
<frontend_type>textarea</frontend_type>
|
1053 |
+
<frontend_model>connector/adminhtml_system_config_smsmessagethree</frontend_model>
|
1054 |
+
<sort_order>30</sort_order>
|
1055 |
+
<show_in_default>1</show_in_default>
|
1056 |
+
<show_in_website>1</show_in_website>
|
1057 |
+
<show_in_store>1</show_in_store>
|
1058 |
+
<validate>validate-length maximum-length-110</validate>
|
1059 |
+
</message>
|
1060 |
+
</fields>
|
1061 |
+
</sms_message_three>
|
1062 |
+
<sms_message_four translate="label">
|
1063 |
+
<label>SMS Message 4</label>
|
1064 |
+
<frontend_type>text</frontend_type>
|
1065 |
+
<sort_order>40</sort_order>
|
1066 |
+
<show_in_default>1</show_in_default>
|
1067 |
+
<show_in_website>1</show_in_website>
|
1068 |
+
<show_in_store>1</show_in_store>
|
1069 |
+
<fields>
|
1070 |
+
<enabled translate="label">
|
1071 |
+
<label>Enabled</label>
|
1072 |
+
<frontend_type>select</frontend_type>
|
1073 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1074 |
+
<sort_order>10</sort_order>
|
1075 |
+
<show_in_default>1</show_in_default>
|
1076 |
+
<show_in_website>1</show_in_website>
|
1077 |
+
<show_in_store>1</show_in_store>
|
1078 |
+
</enabled>
|
1079 |
+
<order_status translate="label">
|
1080 |
+
<label>Order Status</label>
|
1081 |
+
<sort_order>20</sort_order>
|
1082 |
+
<frontend_type>select</frontend_type>
|
1083 |
+
<source_model>connector/system_config_source_orderstatus</source_model>
|
1084 |
+
<show_in_default>1</show_in_default>
|
1085 |
+
<show_in_website>1</show_in_website>
|
1086 |
+
<show_in_store>1</show_in_store>
|
1087 |
+
</order_status>
|
1088 |
+
<message translate="label">
|
1089 |
+
<label>Message</label>
|
1090 |
+
<frontend_type>textarea</frontend_type>
|
1091 |
+
<frontend_model>connector/adminhtml_system_config_smsmessagefour</frontend_model>
|
1092 |
+
<sort_order>30</sort_order>
|
1093 |
+
<show_in_default>1</show_in_default>
|
1094 |
+
<show_in_website>1</show_in_website>
|
1095 |
+
<show_in_store>1</show_in_store>
|
1096 |
+
<validate>validate-length maximum-length-110</validate>
|
1097 |
+
</message>
|
1098 |
+
</fields>
|
1099 |
+
|
1100 |
+
</sms_message_four>
|
1101 |
+
</groups>
|
1102 |
+
</sms_section>
|
1103 |
+
<dynamic_content translate="label">
|
1104 |
+
<label><![CDATA[Dynamic Content]]></label>
|
1105 |
+
<tab>connector</tab>
|
1106 |
+
<frontend_type>text</frontend_type>
|
1107 |
+
<sort_order>8000</sort_order>
|
1108 |
+
<show_in_default>1</show_in_default>
|
1109 |
+
<show_in_website>1</show_in_website>
|
1110 |
+
<show_in_store>0</show_in_store>
|
1111 |
+
<groups>
|
1112 |
+
<products translate="label">
|
1113 |
+
<label>Dynamic Products</label>
|
1114 |
+
<frontend_type>text</frontend_type>
|
1115 |
+
<sort_order>10</sort_order>
|
1116 |
+
<show_in_default>1</show_in_default>
|
1117 |
+
<show_in_website>1</show_in_website>
|
1118 |
+
<show_in_store>0</show_in_store>
|
1119 |
+
<expanded>1</expanded>
|
1120 |
+
<fields>
|
1121 |
+
<related translate="label">
|
1122 |
+
<label>Related Products</label>
|
1123 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1124 |
+
<sort_order>10</sort_order>
|
1125 |
+
<show_in_default>1</show_in_default>
|
1126 |
+
<show_in_website>1</show_in_website>
|
1127 |
+
<show_in_store>0</show_in_store>
|
1128 |
+
</related>
|
1129 |
+
<related_display_type translate="label">
|
1130 |
+
<label>Display Type</label>
|
1131 |
+
<frontend_type>select</frontend_type>
|
1132 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1133 |
+
<sort_order>20</sort_order>
|
1134 |
+
<show_in_default>1</show_in_default>
|
1135 |
+
<show_in_website>1</show_in_website>
|
1136 |
+
<show_in_store>0</show_in_store>
|
1137 |
+
</related_display_type>
|
1138 |
+
<related_items_to_display translate="label">
|
1139 |
+
<label>Items To Display</label>
|
1140 |
+
<frontend_type>select</frontend_type>
|
1141 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1142 |
+
<sort_order>30</sort_order>
|
1143 |
+
<show_in_website>1</show_in_website>
|
1144 |
+
<show_in_default>1</show_in_default>
|
1145 |
+
<show_in_store>0</show_in_store>
|
1146 |
+
</related_items_to_display>
|
1147 |
+
|
1148 |
+
<upsell translate="label">
|
1149 |
+
<label>Up Sell Products</label>
|
1150 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1151 |
+
<sort_order>40</sort_order>
|
1152 |
+
<show_in_default>1</show_in_default>
|
1153 |
+
<show_in_website>1</show_in_website>
|
1154 |
+
<show_in_store>0</show_in_store>
|
1155 |
+
</upsell>
|
1156 |
+
<upsell_display_type translate="label">
|
1157 |
+
<label>Display Type</label>
|
1158 |
+
<frontend_type>select</frontend_type>
|
1159 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1160 |
+
<sort_order>50</sort_order>
|
1161 |
+
<show_in_default>1</show_in_default>
|
1162 |
+
<show_in_website>1</show_in_website>
|
1163 |
+
<show_in_store>0</show_in_store>
|
1164 |
+
</upsell_display_type>
|
1165 |
+
<upsell_items_to_display translate="label">
|
1166 |
+
<label>Items To Display</label>
|
1167 |
+
<frontend_type>select</frontend_type>
|
1168 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1169 |
+
<sort_order>60</sort_order>
|
1170 |
+
<show_in_website>1</show_in_website>
|
1171 |
+
<show_in_default>1</show_in_default>
|
1172 |
+
<show_in_store>0</show_in_store>
|
1173 |
+
</upsell_items_to_display>
|
1174 |
+
|
1175 |
+
<crosssell translate="label">
|
1176 |
+
<label>Cross Sell Products</label>
|
1177 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1178 |
+
<sort_order>70</sort_order>
|
1179 |
+
<show_in_default>1</show_in_default>
|
1180 |
+
<show_in_website>1</show_in_website>
|
1181 |
+
<show_in_store>0</show_in_store>
|
1182 |
+
</crosssell>
|
1183 |
+
<crosssell_display_type translate="label">
|
1184 |
+
<label>Display Type</label>
|
1185 |
+
<frontend_type>select</frontend_type>
|
1186 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1187 |
+
<sort_order>80</sort_order>
|
1188 |
+
<show_in_default>1</show_in_default>
|
1189 |
+
<show_in_website>1</show_in_website>
|
1190 |
+
<show_in_store>0</show_in_store>
|
1191 |
+
</crosssell_display_type>
|
1192 |
+
<crosssell_items_to_display translate="label">
|
1193 |
+
<label>Items To Display</label>
|
1194 |
+
<frontend_type>select</frontend_type>
|
1195 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1196 |
+
<sort_order>90</sort_order>
|
1197 |
+
<show_in_website>1</show_in_website>
|
1198 |
+
<show_in_default>1</show_in_default>
|
1199 |
+
<show_in_store>0</show_in_store>
|
1200 |
+
</crosssell_items_to_display>
|
1201 |
+
|
1202 |
+
<best translate="label">
|
1203 |
+
<label>Best Sellers</label>
|
1204 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1205 |
+
<sort_order>100</sort_order>
|
1206 |
+
<show_in_default>1</show_in_default>
|
1207 |
+
<show_in_website>1</show_in_website>
|
1208 |
+
<show_in_store>0</show_in_store>
|
1209 |
+
</best>
|
1210 |
+
<best_display_type translate="label">
|
1211 |
+
<label>Display Type</label>
|
1212 |
+
<frontend_type>select</frontend_type>
|
1213 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1214 |
+
<sort_order>110</sort_order>
|
1215 |
+
<show_in_default>1</show_in_default>
|
1216 |
+
<show_in_website>1</show_in_website>
|
1217 |
+
<show_in_store>0</show_in_store>
|
1218 |
+
</best_display_type>
|
1219 |
+
<best_items_to_display translate="label">
|
1220 |
+
<label>Items To Display</label>
|
1221 |
+
<frontend_type>select</frontend_type>
|
1222 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1223 |
+
<sort_order>120</sort_order>
|
1224 |
+
<show_in_website>1</show_in_website>
|
1225 |
+
<show_in_default>1</show_in_default>
|
1226 |
+
<show_in_store>0</show_in_store>
|
1227 |
+
</best_items_to_display>
|
1228 |
+
<best_time_period translate="label">
|
1229 |
+
<label>Time Period</label>
|
1230 |
+
<frontend_type>select</frontend_type>
|
1231 |
+
<source_model>connector/system_config_source_timeperiod</source_model>
|
1232 |
+
<sort_order>130</sort_order>
|
1233 |
+
<show_in_default>1</show_in_default>
|
1234 |
+
<show_in_website>1</show_in_website>
|
1235 |
+
<show_in_store>0</show_in_store>
|
1236 |
+
</best_time_period>
|
1237 |
+
|
1238 |
+
<most_viewed translate="label">
|
1239 |
+
<label>Most Viewed</label>
|
1240 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1241 |
+
<sort_order>140</sort_order>
|
1242 |
+
<show_in_default>1</show_in_default>
|
1243 |
+
<show_in_website>1</show_in_website>
|
1244 |
+
<show_in_store>0</show_in_store>
|
1245 |
+
</most_viewed>
|
1246 |
+
<most_viewed_display_type translate="label">
|
1247 |
+
<label>Display Type</label>
|
1248 |
+
<frontend_type>select</frontend_type>
|
1249 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1250 |
+
<sort_order>150</sort_order>
|
1251 |
+
<show_in_default>1</show_in_default>
|
1252 |
+
<show_in_website>1</show_in_website>
|
1253 |
+
<show_in_store>0</show_in_store>
|
1254 |
+
</most_viewed_display_type>
|
1255 |
+
<most_viewed_items_to_display translate="label">
|
1256 |
+
<label>Items To Display</label>
|
1257 |
+
<frontend_type>select</frontend_type>
|
1258 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1259 |
+
<sort_order>160</sort_order>
|
1260 |
+
<show_in_website>1</show_in_website>
|
1261 |
+
<show_in_default>1</show_in_default>
|
1262 |
+
<show_in_store>0</show_in_store>
|
1263 |
+
</most_viewed_items_to_display>
|
1264 |
+
<most_viewed_time_period translate="label">
|
1265 |
+
<label>Time Period</label>
|
1266 |
+
<frontend_type>select</frontend_type>
|
1267 |
+
<source_model>connector/system_config_source_timeperiod</source_model>
|
1268 |
+
<sort_order>170</sort_order>
|
1269 |
+
<show_in_default>1</show_in_default>
|
1270 |
+
<show_in_website>1</show_in_website>
|
1271 |
+
<show_in_store>0</show_in_store>
|
1272 |
+
</most_viewed_time_period>
|
1273 |
+
|
1274 |
+
<recently_viewed translate="label">
|
1275 |
+
<label>Recently Viewed</label>
|
1276 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1277 |
+
<sort_order>180</sort_order>
|
1278 |
+
<show_in_default>1</show_in_default>
|
1279 |
+
<show_in_website>1</show_in_website>
|
1280 |
+
<show_in_store>0</show_in_store>
|
1281 |
+
</recently_viewed>
|
1282 |
+
<recently_viewed_display_type translate="label">
|
1283 |
+
<label>Display Type</label>
|
1284 |
+
<frontend_type>select</frontend_type>
|
1285 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1286 |
+
<sort_order>190</sort_order>
|
1287 |
+
<show_in_default>1</show_in_default>
|
1288 |
+
<show_in_website>1</show_in_website>
|
1289 |
+
<show_in_store>0</show_in_store>
|
1290 |
+
</recently_viewed_display_type>
|
1291 |
+
<recently_viewed_items_to_display translate="label">
|
1292 |
+
<label>items To Display</label>
|
1293 |
+
<frontend_type>select</frontend_type>
|
1294 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1295 |
+
<sort_order>200</sort_order>
|
1296 |
+
<show_in_default>1</show_in_default>
|
1297 |
+
<show_in_website>1</show_in_website>
|
1298 |
+
<show_in_store>0</show_in_store>
|
1299 |
+
</recently_viewed_items_to_display>
|
1300 |
+
|
1301 |
+
<validator>
|
1302 |
+
<label></label>
|
1303 |
+
<frontend_type>hidden</frontend_type>
|
1304 |
+
<frontend_model>connector/adminhtml_system_config_gridlist</frontend_model>
|
1305 |
+
<sort_order>210</sort_order>
|
1306 |
+
<show_in_default>1</show_in_default>
|
1307 |
+
<show_in_website>1</show_in_website>
|
1308 |
+
<show_in_store>0</show_in_store>
|
1309 |
+
<can_be_empty>1</can_be_empty>
|
1310 |
+
</validator>
|
1311 |
+
</fields>
|
1312 |
+
|
1313 |
+
</products>
|
1314 |
+
<manual_product_search translate="label">
|
1315 |
+
<label>Manual Product Push</label>
|
1316 |
+
<frontend_type>text</frontend_type>
|
1317 |
+
<sort_order>20</sort_order>
|
1318 |
+
<show_in_default>1</show_in_default>
|
1319 |
+
<show_in_website>1</show_in_website>
|
1320 |
+
<show_in_store>0</show_in_store>
|
1321 |
+
<expanded>1</expanded>
|
1322 |
+
<fields>
|
1323 |
+
<settings tranlate="label">
|
1324 |
+
<label>Settings</label>
|
1325 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1326 |
+
<sort_order>10</sort_order>
|
1327 |
+
<show_in_default>1</show_in_default>
|
1328 |
+
<show_in_website>1</show_in_website>
|
1329 |
+
<show_in_store>0</show_in_store>
|
1330 |
+
</settings>
|
1331 |
+
<display_type translate="label">
|
1332 |
+
<label>Display Type</label>
|
1333 |
+
<frontend_type>select</frontend_type>
|
1334 |
+
<source_model>connector/system_config_source_displaytype</source_model>
|
1335 |
+
<sort_order>50</sort_order>
|
1336 |
+
<show_in_default>1</show_in_default>
|
1337 |
+
<show_in_website>1</show_in_website>
|
1338 |
+
<show_in_store>0</show_in_store>
|
1339 |
+
</display_type>
|
1340 |
+
<items_to_display translate="label">
|
1341 |
+
<label>Items To Display</label>
|
1342 |
+
<frontend_type>select</frontend_type>
|
1343 |
+
<source_model>connector/system_config_source_gridview</source_model>
|
1344 |
+
<sort_order>60</sort_order>
|
1345 |
+
<show_in_website>1</show_in_website>
|
1346 |
+
<show_in_default>1</show_in_default>
|
1347 |
+
<show_in_store>0</show_in_store>
|
1348 |
+
</items_to_display>
|
1349 |
+
<products_push translate="label">
|
1350 |
+
<label>Products</label>
|
1351 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1352 |
+
<sort_order>80</sort_order>
|
1353 |
+
<show_in_default>1</show_in_default>
|
1354 |
+
<show_in_website>1</show_in_website>
|
1355 |
+
<show_in_store>0</show_in_store>
|
1356 |
+
</products_push>
|
1357 |
+
<products_push_items translate="label">
|
1358 |
+
<label>Products</label>
|
1359 |
+
<frontend_type>text</frontend_type>
|
1360 |
+
<sort_order>90</sort_order>
|
1361 |
+
<show_in_default>1</show_in_default>
|
1362 |
+
<show_in_website>1</show_in_website>
|
1363 |
+
<show_in_store>0</show_in_store>
|
1364 |
+
<comment><![CDATA[Comma Separated Product Id's]]></comment>
|
1365 |
+
</products_push_items>
|
1366 |
+
</fields>
|
1367 |
+
</manual_product_search>
|
1368 |
+
<fallback_products translate="label">
|
1369 |
+
<label>Fallback Products</label>
|
1370 |
+
<frontend_type>text</frontend_type>
|
1371 |
+
<sort_order>30</sort_order>
|
1372 |
+
<show_in_default>1</show_in_default>
|
1373 |
+
<show_in_website>1</show_in_website>
|
1374 |
+
<show_in_store>0</show_in_store>
|
1375 |
+
<fields>
|
1376 |
+
<product_list translate="label">
|
1377 |
+
<label>Products</label>
|
1378 |
+
<frontend_type>text</frontend_type>
|
1379 |
+
<sort_order>10</sort_order>
|
1380 |
+
<show_in_default>1</show_in_default>
|
1381 |
+
<show_in_website>1</show_in_website>
|
1382 |
+
<show_in_store>0</show_in_store>
|
1383 |
+
<comment><![CDATA[Comma Separated Product Id's]]></comment>
|
1384 |
+
</product_list>
|
1385 |
+
</fields>
|
1386 |
+
</fallback_products>
|
1387 |
+
</groups>
|
1388 |
+
</dynamic_content>
|
1389 |
+
<connector_advanced_settings translate="label">
|
1390 |
+
<label><![CDATA[Advanced Settings]]></label>
|
1391 |
+
<tab>connector</tab>
|
1392 |
+
<frontend_type>text</frontend_type>
|
1393 |
+
<sort_order>9000</sort_order>
|
1394 |
+
<show_in_default>1</show_in_default>
|
1395 |
+
<show_in_website>1</show_in_website>
|
1396 |
+
<show_in_store>1</show_in_store>
|
1397 |
+
<groups>
|
1398 |
+
<sync_limits>
|
1399 |
+
<label>Transactional Sync Limit</label>
|
1400 |
+
<frontend_type>text</frontend_type>
|
1401 |
+
<sort_order>10</sort_order>
|
1402 |
+
<show_in_default>1</show_in_default>
|
1403 |
+
<show_in_website>1</show_in_website>
|
1404 |
+
<show_in_store>0</show_in_store>
|
1405 |
+
<fields>
|
1406 |
+
<orders translate="label">
|
1407 |
+
<label>Historical import limit</label>
|
1408 |
+
<frontend_type>select</frontend_type>
|
1409 |
+
<source_model>connector/system_config_source_orderlimit</source_model>
|
1410 |
+
<sort_order>40</sort_order>
|
1411 |
+
<show_in_default>1</show_in_default>
|
1412 |
+
<show_in_website>1</show_in_website>
|
1413 |
+
<show_in_store>0</show_in_store>
|
1414 |
+
</orders>
|
1415 |
+
</fields>
|
1416 |
+
</sync_limits>
|
1417 |
+
<external translate="label">
|
1418 |
+
<label><![CDATA[External Dynamic Content]]></label>
|
1419 |
+
<frontend_type>text</frontend_type>
|
1420 |
+
<sort_order>20</sort_order>
|
1421 |
+
<show_in_default>1</show_in_default>
|
1422 |
+
<show_in_website>1</show_in_website>
|
1423 |
+
<show_in_store>0</show_in_store>
|
1424 |
+
<fields>
|
1425 |
+
<passcode translate="label">
|
1426 |
+
<label>Passcode</label>
|
1427 |
+
<frontend_type>text</frontend_type>
|
1428 |
+
<sort_order>10</sort_order>
|
1429 |
+
<show_in_default>1</show_in_default>
|
1430 |
+
<show_in_website>1</show_in_website>
|
1431 |
+
<show_in_store>0</show_in_store>
|
1432 |
+
<comment><![CDATA[Recommended: Set a passcode so that basket contents and coupon codes can only be viewed if the following passcode is sent with the request.]]></comment>
|
1433 |
+
</passcode>
|
1434 |
+
<lost_basket_title translate="label">
|
1435 |
+
<label>Lost Baskets</label>
|
1436 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1437 |
+
<sort_order>20</sort_order>
|
1438 |
+
<show_in_default>1</show_in_default>
|
1439 |
+
<show_in_website>1</show_in_website>
|
1440 |
+
<show_in_store>0</show_in_store>
|
1441 |
+
</lost_basket_title>
|
1442 |
+
|
1443 |
+
<lost_basket_url translate="label">
|
1444 |
+
<label>Baskets Content URL</label>
|
1445 |
+
<frontend_type>label</frontend_type>
|
1446 |
+
<frontend_model>connector/adminhtml_system_lostbasket</frontend_model>
|
1447 |
+
<sort_order>30</sort_order>
|
1448 |
+
<show_in_default>1</show_in_default>
|
1449 |
+
<show_in_website>1</show_in_website>
|
1450 |
+
<show_in_store>0</show_in_store>
|
1451 |
+
</lost_basket_url>
|
1452 |
+
<coupon_code_title title="label">
|
1453 |
+
<label>Coupon Codes</label>
|
1454 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1455 |
+
<sort_order>40</sort_order>
|
1456 |
+
<show_in_website>1</show_in_website>
|
1457 |
+
<show_in_default>1</show_in_default>
|
1458 |
+
<show_in_store>0</show_in_store>
|
1459 |
+
</coupon_code_title>
|
1460 |
+
<coupon_code_url translate="label">
|
1461 |
+
<label>Coupon Codes URL</label>
|
1462 |
+
<frontend_type>label</frontend_type>
|
1463 |
+
<frontend_model>connector/adminhtml_system_couponinfo</frontend_model>
|
1464 |
+
<sort_order>50</sort_order>
|
1465 |
+
<show_in_default>1</show_in_default>
|
1466 |
+
<show_in_website>1</show_in_website>
|
1467 |
+
<show_in_store>0</show_in_store>
|
1468 |
+
</coupon_code_url>
|
1469 |
+
|
1470 |
+
<dynamic_content_url translate="label">
|
1471 |
+
<label>Dynamic Content</label>
|
1472 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1473 |
+
<sort_order>60</sort_order>
|
1474 |
+
<show_in_default>1</show_in_default>
|
1475 |
+
<show_in_website>1</show_in_website>
|
1476 |
+
<show_in_store>0</show_in_store>
|
1477 |
+
</dynamic_content_url>
|
1478 |
+
<related_products_url translate="label">
|
1479 |
+
<label>Related Products URL</label>
|
1480 |
+
<frontend_type>label</frontend_type>
|
1481 |
+
<frontend_model>connector/adminhtml_system_related</frontend_model>
|
1482 |
+
<sort_order>70</sort_order>
|
1483 |
+
<show_in_default>1</show_in_default>
|
1484 |
+
<show_in_website>1</show_in_website>
|
1485 |
+
<show_in_store>0</show_in_store>
|
1486 |
+
</related_products_url>
|
1487 |
+
<upsell_products_url translate="label">
|
1488 |
+
<label>Up Sell Products URL</label>
|
1489 |
+
<frontend_type>label</frontend_type>
|
1490 |
+
<frontend_model>connector/adminhtml_system_upsell</frontend_model>
|
1491 |
+
<sort_order>80</sort_order>
|
1492 |
+
<show_in_default>1</show_in_default>
|
1493 |
+
<show_in_website>1</show_in_website>
|
1494 |
+
<show_in_store>0</show_in_store>
|
1495 |
+
</upsell_products_url>
|
1496 |
+
<crosssell_products_url translate="label">
|
1497 |
+
<label>Cross Sell Products URL</label>
|
1498 |
+
<frontend_type>label</frontend_type>
|
1499 |
+
<frontend_model>connector/adminhtml_system_crosssell</frontend_model>
|
1500 |
+
<sort_order>90</sort_order>
|
1501 |
+
<show_in_default>1</show_in_default>
|
1502 |
+
<show_in_website>1</show_in_website>
|
1503 |
+
<show_in_store>0</show_in_store>
|
1504 |
+
</crosssell_products_url>
|
1505 |
+
|
1506 |
+
<best_sellers_url translate="label">
|
1507 |
+
<label>Best Sellers URL</label>
|
1508 |
+
<frontend_type>label</frontend_type>
|
1509 |
+
<frontend_model>connector/adminhtml_system_bestsellers</frontend_model>
|
1510 |
+
<sort_order>100</sort_order>
|
1511 |
+
<show_in_default>1</show_in_default>
|
1512 |
+
<show_in_website>1</show_in_website>
|
1513 |
+
<show_in_store>0</show_in_store>
|
1514 |
+
</best_sellers_url>
|
1515 |
+
<most_viewed_url translate="label">
|
1516 |
+
<label>Most Viewed URL</label>
|
1517 |
+
<frontend_type>label</frontend_type>
|
1518 |
+
<frontend_model>connector/adminhtml_system_mostviewed</frontend_model>
|
1519 |
+
<sort_order>110</sort_order>
|
1520 |
+
<show_in_default>1</show_in_default>
|
1521 |
+
<show_in_website>1</show_in_website>
|
1522 |
+
<show_in_store>0</show_in_store>
|
1523 |
+
</most_viewed_url>
|
1524 |
+
<product_push_url translate="label">
|
1525 |
+
<label>Product Push URL</label>
|
1526 |
+
<frontend_type>label</frontend_type>
|
1527 |
+
<frontend_model>connector/adminhtml_system_productpush</frontend_model>
|
1528 |
+
<sort_order>120</sort_order>
|
1529 |
+
<show_in_default>1</show_in_default>
|
1530 |
+
<show_in_website>1</show_in_website>
|
1531 |
+
<show_in_store>0</show_in_store>
|
1532 |
+
</product_push_url>
|
1533 |
+
<recently_viewed_url translate="label">
|
1534 |
+
<label>Recently Viewed</label>
|
1535 |
+
<frontend_type>label</frontend_type>
|
1536 |
+
<frontend_model>connector/adminhtml_system_recentlyviewed</frontend_model>
|
1537 |
+
<sort_order>130</sort_order>
|
1538 |
+
<show_in_default>1</show_in_default>
|
1539 |
+
<show_in_website>1</show_in_website>
|
1540 |
+
<show_in_store>0</show_in_store>
|
1541 |
+
</recently_viewed_url>
|
1542 |
+
</fields>
|
1543 |
+
</external>
|
1544 |
+
<admin translate="label">
|
1545 |
+
<label>Admin</label>
|
1546 |
+
<frontend_type>text</frontend_type>
|
1547 |
+
<sort_order>30</sort_order>
|
1548 |
+
<show_in_default>1</show_in_default>
|
1549 |
+
<show_in_default>1</show_in_default>
|
1550 |
+
<show_in_store>0</show_in_store>
|
1551 |
+
<fields>
|
1552 |
+
<admin_title translate="label">
|
1553 |
+
<label>Contacts ID's</label>
|
1554 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
1555 |
+
<sort_order>10</sort_order>
|
1556 |
+
<show_in_default>1</show_in_default>
|
1557 |
+
<show_in_website>1</show_in_website>
|
1558 |
+
<show_in_store>0</show_in_store>
|
1559 |
+
</admin_title>
|
1560 |
+
<count_customers translate="label">
|
1561 |
+
<label>Count Customers with ID</label>
|
1562 |
+
<frontend_model>connector/debug_countcontacts</frontend_model>
|
1563 |
+
<sort_order>20</sort_order>
|
1564 |
+
<show_in_default>1</show_in_default>
|
1565 |
+
<show_in_website>1</show_in_website>
|
1566 |
+
<show_in_store>0</show_in_store>
|
1567 |
+
</count_customers>
|
1568 |
+
<delete_contact translate="label">
|
1569 |
+
<label>Delete All Contact ID's</label>
|
1570 |
+
<frontend_model>connector/debug_deletecontacts</frontend_model>
|
1571 |
+
<sort_order>30</sort_order>
|
1572 |
+
<show_in_default>1</show_in_default>
|
1573 |
+
<show_in_website>1</show_in_website>
|
1574 |
+
<show_in_store>0</show_in_store>
|
1575 |
+
</delete_contact>
|
1576 |
+
<memory_limit translate="label">
|
1577 |
+
<label>Memory Limit</label>
|
1578 |
+
<frontend_type>select</frontend_type>
|
1579 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1580 |
+
<show_in_default>1</show_in_default>
|
1581 |
+
<show_in_website>0</show_in_website>
|
1582 |
+
<show_in_store>0</show_in_store>
|
1583 |
+
<sort_order>40</sort_order>
|
1584 |
+
<comment>Set to NO to use system default memory.</comment>
|
1585 |
+
</memory_limit>
|
1586 |
+
<batch_size translate="label">
|
1587 |
+
<label>Customer Sync Batch Size</label>
|
1588 |
+
<frontend_type>text</frontend_type>
|
1589 |
+
<show_in_default>1</show_in_default>
|
1590 |
+
<show_in_website>1</show_in_website>
|
1591 |
+
<show_in_store>0</show_in_store>
|
1592 |
+
<sort_order>50</sort_order>
|
1593 |
+
<comment>Set the limit size for customers loaded in memory.</comment>
|
1594 |
+
</batch_size>
|
1595 |
+
<debug translate="label">
|
1596 |
+
<label>Debug Mode</label>
|
1597 |
+
<frontend_type>select</frontend_type>
|
1598 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1599 |
+
<sort_order>50</sort_order>
|
1600 |
+
<show_in_default>1</show_in_default>
|
1601 |
+
<show_in_website>1</show_in_website>
|
1602 |
+
<show_in_store>1</show_in_store>
|
1603 |
+
<comment>Set to YES to allow creating log files</comment>
|
1604 |
+
</debug>
|
1605 |
+
</fields>
|
1606 |
+
</admin>
|
1607 |
+
</groups>
|
1608 |
+
</connector_advanced_settings>
|
1609 |
+
</sections>
|
1610 |
+
</config>
|
app/code/local/Dotdigitalgroup/Email/sql/connector_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* mag17.
|
4 |
+
*
|
5 |
+
* User: chrisroseuk
|
6 |
+
* Date: 30/04/2013
|
7 |
+
* Time: 14:17
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
$installer->startSetup();
|
13 |
+
|
14 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
15 |
+
|
16 |
+
$entityTypeId = $setup->getEntityTypeId('customer');
|
17 |
+
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
|
18 |
+
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
|
19 |
+
|
20 |
+
$setup->addAttribute('customer', 'dotmailer_contact_id', array(
|
21 |
+
'input' => 'text',
|
22 |
+
'type' => 'int',
|
23 |
+
'label' => 'Connector Contact ID',
|
24 |
+
'visible' => 1,
|
25 |
+
'required' => 0,
|
26 |
+
'user_defined' => 0,
|
27 |
+
));
|
28 |
+
|
29 |
+
$setup->addAttributeToGroup(
|
30 |
+
$entityTypeId,
|
31 |
+
$attributeSetId,
|
32 |
+
$attributeGroupId,
|
33 |
+
'dotmailer_contact_id',
|
34 |
+
'999' //sort_order
|
35 |
+
);
|
36 |
+
|
37 |
+
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'dotmailer_contact_id');
|
38 |
+
$oAttribute->setData('used_in_forms', array('adminhtml_customer'));
|
39 |
+
$oAttribute->save();
|
40 |
+
|
41 |
+
$adminData = array();
|
42 |
+
$adminData[] = array(
|
43 |
+
'severity' => 4,
|
44 |
+
'date_added' => gmdate('Y-m-d H:i:s', time()),
|
45 |
+
'title' => 'Email Connector was installed. Remmenber to enable cronjob to make it working.',
|
46 |
+
'description' => 'Connector synchronization is based on the cronjob please make sure this is setup before running through configuration.',
|
47 |
+
'url' => ''
|
48 |
+
);
|
49 |
+
|
50 |
+
Mage::getModel('adminnotification/inbox')->parse($adminData);
|
51 |
+
|
52 |
+
|
53 |
+
$setup->endSetup();
|
app/code/local/Dotdigitalgroup/Email/sql/connector_setup/mysql4-upgrade-1.1.1-1.1.2.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
|
7 |
+
$installer->addAttribute("order", "dotmailer_order_imported", array("type"=>"int"));
|
8 |
+
|
9 |
+
$installer->endSetup();
|
app/code/local/Varien/Data/Collection.php
ADDED
@@ -0,0 +1,818 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Varien
|
22 |
+
* @package Varien_Data
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Data collection
|
29 |
+
*
|
30 |
+
* @category Varien
|
31 |
+
* @package Varien_Data
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Varien_Data_Collection implements IteratorAggregate, Countable
|
35 |
+
{
|
36 |
+
const SORT_ORDER_ASC = 'ASC';
|
37 |
+
const SORT_ORDER_DESC = 'DESC';
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Collection items
|
41 |
+
*
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected $_items = array();
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Item object class name
|
48 |
+
*
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
protected $_itemObjectClass = 'Varien_Object';
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Order configuration
|
55 |
+
*
|
56 |
+
* @var array
|
57 |
+
*/
|
58 |
+
protected $_orders = array();
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Filters configuration
|
62 |
+
*
|
63 |
+
* @var array
|
64 |
+
*/
|
65 |
+
protected $_filters = array();
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Filter rendered flag
|
69 |
+
*
|
70 |
+
* @var bool
|
71 |
+
*/
|
72 |
+
protected $_isFiltersRendered = false;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Current page number for items pager
|
76 |
+
*
|
77 |
+
* @var int
|
78 |
+
*/
|
79 |
+
protected $_curPage = 1;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Pager page size
|
83 |
+
*
|
84 |
+
* if page size is false, then we works with all items
|
85 |
+
*
|
86 |
+
* @var int | false
|
87 |
+
*/
|
88 |
+
protected $_pageSize = false;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Total items number
|
92 |
+
*
|
93 |
+
* @var int
|
94 |
+
*/
|
95 |
+
protected $_totalRecords;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Loading state flag
|
99 |
+
*
|
100 |
+
* @var bool
|
101 |
+
*/
|
102 |
+
protected $_isCollectionLoaded;
|
103 |
+
|
104 |
+
protected $_cacheKey;
|
105 |
+
|
106 |
+
protected $_cacheTags = array();
|
107 |
+
|
108 |
+
protected $_cacheLifetime = 86400;
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Additional collection flags
|
112 |
+
*
|
113 |
+
* @var array
|
114 |
+
*/
|
115 |
+
protected $_flags = array();
|
116 |
+
|
117 |
+
public function __construct()
|
118 |
+
{
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Add collection filter
|
124 |
+
*
|
125 |
+
* @param string $field
|
126 |
+
* @param string $value
|
127 |
+
* @param string $type and|or|string
|
128 |
+
*/
|
129 |
+
public function addFilter($field, $value, $type = 'and')
|
130 |
+
{
|
131 |
+
$filter = new Varien_Object(); // implements ArrayAccess
|
132 |
+
$filter['field'] = $field;
|
133 |
+
$filter['value'] = $value;
|
134 |
+
$filter['type'] = strtolower($type);
|
135 |
+
|
136 |
+
$this->_filters[] = $filter;
|
137 |
+
$this->_isFiltersRendered = false;
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Search for a filter by specified field
|
143 |
+
*
|
144 |
+
* Multiple filters can be matched if an array is specified:
|
145 |
+
* - 'foo' -- get the first filter with field name 'foo'
|
146 |
+
* - array('foo') -- get all filters with field name 'foo'
|
147 |
+
* - array('foo', 'bar') -- get all filters with field name 'foo' or 'bar'
|
148 |
+
* - array() -- get all filters
|
149 |
+
*
|
150 |
+
* @param string|array $field
|
151 |
+
* @return Varien_Object|array|null
|
152 |
+
*/
|
153 |
+
public function getFilter($field)
|
154 |
+
{
|
155 |
+
if (is_array($field)) {
|
156 |
+
// empty array: get all filters
|
157 |
+
if (empty($field)) {
|
158 |
+
return $this->_filters;
|
159 |
+
}
|
160 |
+
// non-empty array: collect all filters that match specified field names
|
161 |
+
$result = array();
|
162 |
+
foreach ($this->_filters as $filter) {
|
163 |
+
if (in_array($filter['field'], $field)) {
|
164 |
+
$result[] = $filter;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
return $result;
|
168 |
+
}
|
169 |
+
|
170 |
+
// get a first filter by specified name
|
171 |
+
foreach ($this->_filters as $filter) {
|
172 |
+
if ($filter['field'] === $field) {
|
173 |
+
return $filter;
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Retrieve collection loading status
|
180 |
+
*
|
181 |
+
* @return bool
|
182 |
+
*/
|
183 |
+
public function isLoaded()
|
184 |
+
{
|
185 |
+
return $this->_isCollectionLoaded;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Set collection loading status flag
|
190 |
+
*
|
191 |
+
* @param unknown_type $flag
|
192 |
+
* @return unknown
|
193 |
+
*/
|
194 |
+
protected function _setIsLoaded($flag = true)
|
195 |
+
{
|
196 |
+
$this->_isCollectionLoaded = $flag;
|
197 |
+
return $this;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Get current collection page
|
202 |
+
*
|
203 |
+
* @param int $displacement
|
204 |
+
* @return int
|
205 |
+
*/
|
206 |
+
public function getCurPage($displacement = 0)
|
207 |
+
{
|
208 |
+
if ($this->_curPage + $displacement < 1) {
|
209 |
+
return 1;
|
210 |
+
}
|
211 |
+
elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
|
212 |
+
return $this->getLastPageNumber();
|
213 |
+
} else {
|
214 |
+
return $this->_curPage + $displacement;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Retrieve collection last page number
|
220 |
+
*
|
221 |
+
* @return int
|
222 |
+
*/
|
223 |
+
public function getLastPageNumber()
|
224 |
+
{
|
225 |
+
$collectionSize = (int) $this->getSize();
|
226 |
+
if (0 === $collectionSize) {
|
227 |
+
return 1;
|
228 |
+
}
|
229 |
+
elseif($this->_pageSize) {
|
230 |
+
return ceil($collectionSize/$this->_pageSize);
|
231 |
+
}
|
232 |
+
else{
|
233 |
+
return 1;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Retrieve collection page size
|
239 |
+
*
|
240 |
+
* @return int
|
241 |
+
*/
|
242 |
+
public function getPageSize()
|
243 |
+
{
|
244 |
+
return $this->_pageSize;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Retrieve collection all items count
|
249 |
+
*
|
250 |
+
* @return int
|
251 |
+
*/
|
252 |
+
public function getSize()
|
253 |
+
{
|
254 |
+
$this->load();
|
255 |
+
if (is_null($this->_totalRecords)) {
|
256 |
+
$this->_totalRecords = count($this->getItems());
|
257 |
+
}
|
258 |
+
return intval($this->_totalRecords);
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Retrieve collection first item
|
263 |
+
*
|
264 |
+
* @return Varien_Object
|
265 |
+
*/
|
266 |
+
public function getFirstItem()
|
267 |
+
{
|
268 |
+
$this->load();
|
269 |
+
|
270 |
+
if (count($this->_items)) {
|
271 |
+
reset($this->_items);
|
272 |
+
return current($this->_items);
|
273 |
+
}
|
274 |
+
|
275 |
+
return new $this->_itemObjectClass();
|
276 |
+
}
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Retrieve collection last item
|
280 |
+
*
|
281 |
+
* @return Varien_Object
|
282 |
+
*/
|
283 |
+
public function getLastItem()
|
284 |
+
{
|
285 |
+
$this->load();
|
286 |
+
|
287 |
+
if (count($this->_items)) {
|
288 |
+
return end($this->_items);
|
289 |
+
}
|
290 |
+
|
291 |
+
return new $this->_itemObjectClass();
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Retrieve collection items
|
296 |
+
*
|
297 |
+
* @return array
|
298 |
+
*/
|
299 |
+
public function getItems()
|
300 |
+
{
|
301 |
+
$this->load();
|
302 |
+
return $this->_items;
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Retrieve field values from all items
|
307 |
+
*
|
308 |
+
* @param string $colName
|
309 |
+
* @return array
|
310 |
+
*/
|
311 |
+
public function getColumnValues($colName)
|
312 |
+
{
|
313 |
+
$this->load();
|
314 |
+
|
315 |
+
$col = array();
|
316 |
+
foreach ($this->getItems() as $item) {
|
317 |
+
$col[] = $item->getData($colName);
|
318 |
+
}
|
319 |
+
return $col;
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Search all items by field value
|
324 |
+
*
|
325 |
+
* @param string $column
|
326 |
+
* @param mixed $value
|
327 |
+
* @return array
|
328 |
+
*/
|
329 |
+
public function getItemsByColumnValue($column, $value)
|
330 |
+
{
|
331 |
+
$this->load();
|
332 |
+
|
333 |
+
$res = array();
|
334 |
+
foreach ($this as $item) {
|
335 |
+
if ($item->getData($column)==$value) {
|
336 |
+
$res[] = $item;
|
337 |
+
}
|
338 |
+
}
|
339 |
+
return $res;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Search first item by field value
|
344 |
+
*
|
345 |
+
* @param string $column
|
346 |
+
* @param mixed $value
|
347 |
+
* @return Varien_Object || null
|
348 |
+
*/
|
349 |
+
public function getItemByColumnValue($column, $value)
|
350 |
+
{
|
351 |
+
$this->load();
|
352 |
+
|
353 |
+
foreach ($this as $item) {
|
354 |
+
if ($item->getData($column)==$value) {
|
355 |
+
return $item;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
return null;
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Adding item to item array
|
363 |
+
*
|
364 |
+
* @param Varien_Object $item
|
365 |
+
* @return Varien_Data_Collection
|
366 |
+
*/
|
367 |
+
public function addItem(Varien_Object $item)
|
368 |
+
{
|
369 |
+
$itemId = $this->_getItemId($item);
|
370 |
+
|
371 |
+
if (!is_null($itemId)) {
|
372 |
+
if (isset($this->_items[$itemId])) {
|
373 |
+
//throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
|
374 |
+
}
|
375 |
+
$this->_items[$itemId] = $item;
|
376 |
+
} else {
|
377 |
+
$this->_addItem($item);
|
378 |
+
}
|
379 |
+
return $this;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Add item that has no id to collection
|
384 |
+
*
|
385 |
+
* @param Varien_Object $item
|
386 |
+
* @return Varien_Data_Collection
|
387 |
+
*/
|
388 |
+
protected function _addItem($item)
|
389 |
+
{
|
390 |
+
$this->_items[] = $item;
|
391 |
+
return $this;
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Retrieve item id
|
396 |
+
*
|
397 |
+
* @param Varien_Object $item
|
398 |
+
* @return mixed
|
399 |
+
*/
|
400 |
+
protected function _getItemId(Varien_Object $item)
|
401 |
+
{
|
402 |
+
return $item->getId();
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Retrieve ids of all tems
|
407 |
+
*
|
408 |
+
* @return array
|
409 |
+
*/
|
410 |
+
public function getAllIds()
|
411 |
+
{
|
412 |
+
$ids = array();
|
413 |
+
foreach ($this->getItems() as $item) {
|
414 |
+
$ids[] = $this->_getItemId($item);
|
415 |
+
}
|
416 |
+
return $ids;
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Remove item from collection by item key
|
421 |
+
*
|
422 |
+
* @param mixed $key
|
423 |
+
* @return Varien_Data_Collection
|
424 |
+
*/
|
425 |
+
public function removeItemByKey($key)
|
426 |
+
{
|
427 |
+
if (isset($this->_items[$key])) {
|
428 |
+
unset($this->_items[$key]);
|
429 |
+
}
|
430 |
+
return $this;
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Clear collection
|
435 |
+
*
|
436 |
+
* @return Varien_Data_Collection
|
437 |
+
*/
|
438 |
+
public function clear()
|
439 |
+
{
|
440 |
+
$this->_setIsLoaded(false);
|
441 |
+
$this->_items = array();
|
442 |
+
return $this;
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Walk through the collection and run model method or external callback
|
447 |
+
* with optional arguments
|
448 |
+
*
|
449 |
+
* Returns array with results of callback for each item
|
450 |
+
*
|
451 |
+
* @param string $method
|
452 |
+
* @param array $args
|
453 |
+
* @return array
|
454 |
+
*/
|
455 |
+
public function walk($callback, array $args=array())
|
456 |
+
{
|
457 |
+
$results = array();
|
458 |
+
$useItemCallback = is_string($callback) && strpos($callback, '::')===false;
|
459 |
+
foreach ($this->getItems() as $id=>$item) {
|
460 |
+
if ($useItemCallback) {
|
461 |
+
$cb = array($item, $callback);
|
462 |
+
} else {
|
463 |
+
$cb = $callback;
|
464 |
+
array_unshift($args, $item);
|
465 |
+
}
|
466 |
+
$results[$id] = call_user_func_array($cb, $args);
|
467 |
+
}
|
468 |
+
return $results;
|
469 |
+
}
|
470 |
+
|
471 |
+
public function each($obj_method, $args=array())
|
472 |
+
{
|
473 |
+
foreach ($args->_items as $k => $item) {
|
474 |
+
$args->_items[$k] = call_user_func($obj_method, $item);
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Setting data for all collection items
|
480 |
+
*
|
481 |
+
* @param mixed $key
|
482 |
+
* @param mixed $value
|
483 |
+
* @return Varien_Data_Collection
|
484 |
+
*/
|
485 |
+
public function setDataToAll($key, $value=null)
|
486 |
+
{
|
487 |
+
if (is_array($key)) {
|
488 |
+
foreach ($key as $k=>$v) {
|
489 |
+
$this->setDataToAll($k, $v);
|
490 |
+
}
|
491 |
+
return $this;
|
492 |
+
}
|
493 |
+
foreach ($this->getItems() as $item) {
|
494 |
+
$item->setData($key, $value);
|
495 |
+
}
|
496 |
+
return $this;
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Set current page
|
501 |
+
*
|
502 |
+
* @param int $page
|
503 |
+
* @return Varien_Data_Collection
|
504 |
+
*/
|
505 |
+
public function setCurPage($page)
|
506 |
+
{
|
507 |
+
$this->_curPage = $page;
|
508 |
+
return $this;
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Set collection page size
|
513 |
+
*
|
514 |
+
* @param int $size
|
515 |
+
* @return Varien_Data_Collection
|
516 |
+
*/
|
517 |
+
public function setPageSize($size)
|
518 |
+
{
|
519 |
+
$this->_pageSize = $size;
|
520 |
+
return $this;
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Set select order
|
525 |
+
*
|
526 |
+
* @param string $field
|
527 |
+
* @param string $direction
|
528 |
+
* @return Varien_Data_Collection
|
529 |
+
*/
|
530 |
+
public function setOrder($field, $direction = self::SORT_ORDER_DESC)
|
531 |
+
{
|
532 |
+
$this->_orders[$field] = $direction;
|
533 |
+
return $this;
|
534 |
+
}
|
535 |
+
|
536 |
+
/**
|
537 |
+
* Set collection item class name
|
538 |
+
*
|
539 |
+
* @param string $className
|
540 |
+
* @return Varien_Data_Collection
|
541 |
+
*/
|
542 |
+
function setItemObjectClass($className)
|
543 |
+
{
|
544 |
+
$className = Mage::getConfig()->getModelClassName($className);
|
545 |
+
/**
|
546 |
+
* is_subclass_of($className, 'Varien_Object') - Segmentation fault in php 5.2.3
|
547 |
+
*/
|
548 |
+
/*if (!is_subclass_of($className, 'Varien_Object')) {
|
549 |
+
throw new Exception($className.' does not extends from Varien_Object');
|
550 |
+
}*/
|
551 |
+
$this->_itemObjectClass = $className;
|
552 |
+
return $this;
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Retrieve collection empty item
|
557 |
+
*
|
558 |
+
* @return Varien_Object
|
559 |
+
*/
|
560 |
+
public function getNewEmptyItem()
|
561 |
+
{
|
562 |
+
return new $this->_itemObjectClass();
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Render sql select conditions
|
567 |
+
*
|
568 |
+
* @return Varien_Data_Collection
|
569 |
+
*/
|
570 |
+
protected function _renderFilters()
|
571 |
+
{
|
572 |
+
return $this;
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Render sql select orders
|
577 |
+
*
|
578 |
+
* @return Varien_Data_Collection
|
579 |
+
*/
|
580 |
+
protected function _renderOrders()
|
581 |
+
{
|
582 |
+
return $this;
|
583 |
+
}
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Render sql select limit
|
587 |
+
*
|
588 |
+
* @return Varien_Data_Collection
|
589 |
+
*/
|
590 |
+
protected function _renderLimit()
|
591 |
+
{
|
592 |
+
return $this;
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
* Set select distinct
|
597 |
+
*
|
598 |
+
* @param bool $flag
|
599 |
+
*/
|
600 |
+
public function distinct($flag)
|
601 |
+
{
|
602 |
+
return $this;
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Load data
|
607 |
+
*
|
608 |
+
* @return Varien_Data_Collection
|
609 |
+
*/
|
610 |
+
public function loadData($printQuery = false, $logQuery = false)
|
611 |
+
{
|
612 |
+
return $this;
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* Load data
|
617 |
+
*
|
618 |
+
* @return Varien_Data_Collection
|
619 |
+
*/
|
620 |
+
public function load($printQuery = false, $logQuery = false)
|
621 |
+
{
|
622 |
+
return $this->loadData($printQuery, $logQuery);
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Convert collection to XML
|
627 |
+
*
|
628 |
+
* @return string
|
629 |
+
*/
|
630 |
+
public function toXml()
|
631 |
+
{
|
632 |
+
$xml = '<?xml version="1.0" encoding="UTF-8"?>
|
633 |
+
<collection>
|
634 |
+
<totalRecords>'.$this->_totalRecords.'</totalRecords>
|
635 |
+
<items>';
|
636 |
+
|
637 |
+
foreach ($this as $item) {
|
638 |
+
$xml.=$item->toXml();
|
639 |
+
}
|
640 |
+
$xml.= '</items>
|
641 |
+
</collection>';
|
642 |
+
return $xml;
|
643 |
+
}
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Convert collection to array
|
647 |
+
*
|
648 |
+
* @return array
|
649 |
+
*/
|
650 |
+
public function toArray($arrRequiredFields = array())
|
651 |
+
{
|
652 |
+
$arrItems = array();
|
653 |
+
$arrItems['totalRecords'] = $this->getSize();
|
654 |
+
|
655 |
+
$arrItems['items'] = array();
|
656 |
+
foreach ($this as $item) {
|
657 |
+
$arrItems['items'][] = $item->toArray($arrRequiredFields);
|
658 |
+
}
|
659 |
+
return $arrItems;
|
660 |
+
}
|
661 |
+
|
662 |
+
/**
|
663 |
+
* Convert items array to array for select options
|
664 |
+
*
|
665 |
+
* return items array
|
666 |
+
* array(
|
667 |
+
* $index => array(
|
668 |
+
* 'value' => mixed
|
669 |
+
* 'label' => mixed
|
670 |
+
* )
|
671 |
+
* )
|
672 |
+
*
|
673 |
+
* @param string $valueField
|
674 |
+
* @param string $labelField
|
675 |
+
* @return array
|
676 |
+
*/
|
677 |
+
protected function _toOptionArray($valueField='id', $labelField='name', $additional=array())
|
678 |
+
{
|
679 |
+
$res = array();
|
680 |
+
$additional['value'] = $valueField;
|
681 |
+
$additional['label'] = $labelField;
|
682 |
+
|
683 |
+
foreach ($this as $item) {
|
684 |
+
foreach ($additional as $code => $field) {
|
685 |
+
$data[$code] = $item->getData($field);
|
686 |
+
}
|
687 |
+
$res[] = $data;
|
688 |
+
}
|
689 |
+
return $res;
|
690 |
+
}
|
691 |
+
|
692 |
+
public function toOptionArray()
|
693 |
+
{
|
694 |
+
return $this->_toOptionArray();
|
695 |
+
}
|
696 |
+
|
697 |
+
public function toOptionHash()
|
698 |
+
{
|
699 |
+
return $this->_toOptionHash();
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Convert items array to hash for select options
|
704 |
+
*
|
705 |
+
* return items hash
|
706 |
+
* array($value => $label)
|
707 |
+
*
|
708 |
+
* @param string $valueField
|
709 |
+
* @param string $labelField
|
710 |
+
* @return array
|
711 |
+
*/
|
712 |
+
protected function _toOptionHash($valueField='id', $labelField='name')
|
713 |
+
{
|
714 |
+
$res = array();
|
715 |
+
foreach ($this as $item) {
|
716 |
+
$res[$item->getData($valueField)] = $item->getData($labelField);
|
717 |
+
}
|
718 |
+
return $res;
|
719 |
+
}
|
720 |
+
|
721 |
+
/**
|
722 |
+
* Retrieve item by id
|
723 |
+
*
|
724 |
+
* @param mixed $idValue
|
725 |
+
* @return Varien_Object
|
726 |
+
*/
|
727 |
+
public function getItemById($idValue)
|
728 |
+
{
|
729 |
+
$this->load();
|
730 |
+
if (isset($this->_items[$idValue])) {
|
731 |
+
return $this->_items[$idValue];
|
732 |
+
}
|
733 |
+
return null;
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Implementation of IteratorAggregate::getIterator()
|
738 |
+
*/
|
739 |
+
public function getIterator()
|
740 |
+
{
|
741 |
+
$this->load();
|
742 |
+
return new ArrayIterator($this->_items);
|
743 |
+
}
|
744 |
+
|
745 |
+
/**
|
746 |
+
* Retireve count of collection loaded items
|
747 |
+
*
|
748 |
+
* @return int
|
749 |
+
*/
|
750 |
+
public function count()
|
751 |
+
{
|
752 |
+
$this->load();
|
753 |
+
|
754 |
+
return count($this->_items);
|
755 |
+
}
|
756 |
+
|
757 |
+
public function setCacheKey($key)
|
758 |
+
{
|
759 |
+
$this->_cacheKey = $key;
|
760 |
+
return $this;
|
761 |
+
}
|
762 |
+
|
763 |
+
public function getCacheKey()
|
764 |
+
{
|
765 |
+
return $this->_cacheKey;
|
766 |
+
}
|
767 |
+
|
768 |
+
public function setCacheTags($tags)
|
769 |
+
{
|
770 |
+
$this->_cacheTags = $tags;
|
771 |
+
return $this;
|
772 |
+
}
|
773 |
+
|
774 |
+
public function getCacheTags()
|
775 |
+
{
|
776 |
+
return $this->_cacheTags;
|
777 |
+
}
|
778 |
+
|
779 |
+
public function getCacheLifetime()
|
780 |
+
{
|
781 |
+
return $this->_cacheLifetime;
|
782 |
+
}
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Retrieve Flag
|
786 |
+
*
|
787 |
+
* @param string $flag
|
788 |
+
* @return mixed
|
789 |
+
*/
|
790 |
+
public function getFlag($flag)
|
791 |
+
{
|
792 |
+
return isset($this->_flags[$flag]) ? $this->_flags[$flag] : null;
|
793 |
+
}
|
794 |
+
|
795 |
+
/**
|
796 |
+
* Set Flag
|
797 |
+
*
|
798 |
+
* @param string $flag
|
799 |
+
* @param mixed $value
|
800 |
+
* @return Varien_Data_Collection
|
801 |
+
*/
|
802 |
+
public function setFlag($flag, $value = null)
|
803 |
+
{
|
804 |
+
$this->_flags[$flag] = $value;
|
805 |
+
return $this;
|
806 |
+
}
|
807 |
+
|
808 |
+
/**
|
809 |
+
* Has Flag
|
810 |
+
*
|
811 |
+
* @param string $flag
|
812 |
+
* @return bool
|
813 |
+
*/
|
814 |
+
public function hasFlag($flag)
|
815 |
+
{
|
816 |
+
return array_key_exists($flag, $this->_flags);
|
817 |
+
}
|
818 |
+
}
|
app/design/frontend/base/default/layout/connector.xml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<default>
|
4 |
+
<reference name="head">
|
5 |
+
<block type="core/template" name="checkout.tag" as="connector.tag" template="connector/tracking_code.phtml"/>
|
6 |
+
</reference>
|
7 |
+
</default>
|
8 |
+
<checkout_onepage_success>
|
9 |
+
<reference name="content">
|
10 |
+
<block type="checkout/onepage_success" name="checkout.roi" as="connector.roi" template="connector/roi_code.phtml"/>
|
11 |
+
</reference>
|
12 |
+
</checkout_onepage_success>
|
13 |
+
<connector_email_products>
|
14 |
+
<reference name="root">
|
15 |
+
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
16 |
+
</reference>
|
17 |
+
<reference name="content">
|
18 |
+
<block type="connector/products" name="email.products" as="email.products" template="page/connector/products.phtml"/>
|
19 |
+
</reference>
|
20 |
+
</connector_email_products>
|
21 |
+
<connector_email_coupon>
|
22 |
+
<reference name="root">
|
23 |
+
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
24 |
+
</reference>
|
25 |
+
<reference name="content">
|
26 |
+
<block type="connector/coupon" name="email.coupon" as="email.coupon" template="connector/coupon.phtml"/>
|
27 |
+
</reference>
|
28 |
+
</connector_email_coupon>
|
29 |
+
<connector_email_basket>
|
30 |
+
<reference name="root">
|
31 |
+
<action method="setTemplate"><template>page/blank.phtml</template></action>
|
32 |
+
</reference>
|
33 |
+
<reference name="content">
|
34 |
+
<block type="connector/basket" name="email.basket" as="email.basket" template="connector/basket.phtml"/>
|
35 |
+
</reference>
|
36 |
+
</connector_email_basket>
|
37 |
+
</layout>
|
app/design/frontend/base/default/template/connector/basket.phtml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$items = $this->getBasketItems();
|
4 |
+
$helper = Mage::helper('core');
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
9 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
10 |
+
<head>
|
11 |
+
|
12 |
+
<title>Basket</title>
|
13 |
+
|
14 |
+
</head>
|
15 |
+
<body class="csv" style="background:#fff; font: 12px/1.5em Arial, Helvetica, sans-serif;">
|
16 |
+
|
17 |
+
<table style ='float:left; width:600px; border: 1px solid #cbd3d4; font-family:arial; border-collapse: collapse; font-size:12; padding: 5px;' class='data'>
|
18 |
+
<tr>
|
19 |
+
<th style="border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Image</th>
|
20 |
+
<th style="border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Description</th>
|
21 |
+
<th style="border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Quantity</th>
|
22 |
+
<th style="border-bottom: 1px solid #cbd3d4;">Total</th>
|
23 |
+
</tr>
|
24 |
+
|
25 |
+
<?php foreach($items as $one):?>
|
26 |
+
<?php
|
27 |
+
if($one->getParentItemId() != null)
|
28 |
+
continue;
|
29 |
+
$_product = Mage::getModel('catalog/product')->load($one->getProductId());
|
30 |
+
|
31 |
+
$name = $_product->getName();
|
32 |
+
$stock = $_product->getStockItem()->getIsInStock();
|
33 |
+
$inStock = ($stock)? 'In Stock' : 'Out of stock';
|
34 |
+
$img = $_product->getImageUrl();
|
35 |
+
$total = $helper->currency($one->getBaseRowTotalInclTax());
|
36 |
+
$productUrl = Mage::getBaseUrl() . $_product->getUrlPath();
|
37 |
+
$grandTotal = $helper->currency($this->getGrandTotal());
|
38 |
+
|
39 |
+
?>
|
40 |
+
<tr>
|
41 |
+
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">
|
42 |
+
<img alt="" src="<?php echo $img;?>" width="85" align="absmiddle" border="0" height="85">
|
43 |
+
</td>
|
44 |
+
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;">Product Name : <a href="<?php echo $productUrl;?>"><?php echo $name . '</a></br>'. $inStock;?></td>
|
45 |
+
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4; border-right: 1px solid #cbd3d4;"><?php echo (int)$one->getQty();?></td>
|
46 |
+
<td style="padding: 1px; border-bottom: 1px solid #cbd3d4;"><?php echo $total;?></td>
|
47 |
+
</tr>
|
48 |
+
|
49 |
+
<?php endforeach;?>
|
50 |
+
<tr>
|
51 |
+
<td style="padding: 1px; border-right: 1px solid #cbd3d4;"></td>
|
52 |
+
<td style="padding: 1px; border-right: 1px solid #cbd3d4;"></td>
|
53 |
+
|
54 |
+
<td style="padding: 1px; border-right: 1px solid #cbd3d4;">Order Total</td>
|
55 |
+
<td style="padding: 1px;">
|
56 |
+
<?php echo $grandTotal;?>
|
57 |
+
</td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
</table>
|
61 |
+
|
62 |
+
|
63 |
+
</body>
|
app/design/frontend/base/default/template/connector/coupon.phtml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$coupon = $this->generateCoupon();
|
4 |
+
if($coupon)
|
5 |
+
echo $coupon;
|
6 |
+
|
app/design/frontend/base/default/template/connector/price.phtml
ADDED
@@ -0,0 +1,428 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<?php
|
29 |
+
/**
|
30 |
+
* Template for displaying product price in different places (products grid, product view page etc)
|
31 |
+
*
|
32 |
+
* @see Mage_Catalog_Block_Product_Abstract
|
33 |
+
*/
|
34 |
+
?>
|
35 |
+
<?php
|
36 |
+
$_coreHelper = $this->helper('core');
|
37 |
+
$_weeeHelper = $this->helper('weee');
|
38 |
+
$_taxHelper = $this->helper('tax');
|
39 |
+
/* @var $_coreHelper Mage_Core_Helper_Data */
|
40 |
+
/* @var $_weeeHelper Mage_Weee_Helper_Data */
|
41 |
+
/* @var $_taxHelper Mage_Tax_Helper_Data */
|
42 |
+
|
43 |
+
$_product = $this->getProduct();
|
44 |
+
$_storeId = $_product->getStoreId();
|
45 |
+
$_id = $_product->getId();
|
46 |
+
$_weeeSeparator = '';
|
47 |
+
$_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
|
48 |
+
$_minimalPriceValue = $_product->getMinimalPrice();
|
49 |
+
$_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax);
|
50 |
+
?>
|
51 |
+
|
52 |
+
<?php if (!$_product->isGrouped()): ?>
|
53 |
+
<?php $_weeeTaxAmount = $_weeeHelper->getAmountForDisplay($_product); ?>
|
54 |
+
<?php if ($_weeeHelper->typeOfDisplay($_product, array(Mage_Weee_Model_Tax::DISPLAY_INCL_DESCR, Mage_Weee_Model_Tax::DISPLAY_EXCL_DESCR_INCL, 4))): ?>
|
55 |
+
<?php $_weeeTaxAmount = $_weeeHelper->getAmount($_product); ?>
|
56 |
+
<?php $_weeeTaxAttributes = $_weeeHelper->getProductWeeeAttributesForDisplay($_product); ?>
|
57 |
+
<?php endif; ?>
|
58 |
+
<?php $_weeeTaxAmountInclTaxes = $_weeeTaxAmount; ?>
|
59 |
+
<?php if ($_weeeHelper->isTaxable() && !$_taxHelper->priceIncludesTax($_storeId)): ?>
|
60 |
+
<?php $_attributes = $_weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, null, true); ?>
|
61 |
+
<?php $_weeeTaxAmountInclTaxes = $_weeeHelper->getAmountInclTaxes($_attributes); ?>
|
62 |
+
<?php endif; ?>
|
63 |
+
|
64 |
+
<div class="price-box">
|
65 |
+
<?php $_price = $_taxHelper->getPrice($_product, $_product->getPrice()) ?>
|
66 |
+
<?php $_regularPrice = $_taxHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?>
|
67 |
+
<?php $_finalPrice = $_taxHelper->getPrice($_product, $_product->getFinalPrice()) ?>
|
68 |
+
<?php $_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true) ?>
|
69 |
+
<?php $_weeeDisplayType = $_weeeHelper->getPriceDisplayType(); ?>
|
70 |
+
<?php if ($_finalPrice >= $_price): ?>
|
71 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
72 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
|
73 |
+
<span class="price-excluding-tax">
|
74 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
75 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
76 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?>
|
77 |
+
</span>
|
78 |
+
</span>
|
79 |
+
<span class="price-including-tax">
|
80 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
81 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
82 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
83 |
+
</span>
|
84 |
+
</span>
|
85 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
|
86 |
+
<span class="price-excluding-tax">
|
87 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
88 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
89 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?>
|
90 |
+
</span>
|
91 |
+
</span>
|
92 |
+
<span class="price-including-tax">
|
93 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
94 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
95 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
96 |
+
</span>
|
97 |
+
<span class="weee">(
|
98 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
99 |
+
<?php echo $_weeeSeparator; ?>
|
100 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
101 |
+
<?php $_weeeSeparator = ' + '; ?>
|
102 |
+
<?php endforeach; ?>
|
103 |
+
)</span>
|
104 |
+
</span>
|
105 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
106 |
+
<span class="price-excluding-tax">
|
107 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
108 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
109 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?>
|
110 |
+
</span>
|
111 |
+
</span>
|
112 |
+
<span class="price-including-tax">
|
113 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
114 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
115 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
116 |
+
</span>
|
117 |
+
<span class="weee">(
|
118 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
119 |
+
<?php echo $_weeeSeparator; ?>
|
120 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
121 |
+
<?php $_weeeSeparator = ' + '; ?>
|
122 |
+
<?php endforeach; ?>
|
123 |
+
)</span>
|
124 |
+
</span>
|
125 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
126 |
+
<span class="price-excluding-tax">
|
127 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
128 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
129 |
+
<?php echo $_coreHelper->currency($_price, true, false) ?>
|
130 |
+
</span>
|
131 |
+
</span>
|
132 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
133 |
+
<span class="weee">
|
134 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
135 |
+
</span>
|
136 |
+
<?php endforeach; ?>
|
137 |
+
<span class="price-including-tax">
|
138 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
139 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
140 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
141 |
+
</span>
|
142 |
+
</span>
|
143 |
+
<?php else: ?>
|
144 |
+
<span class="price-excluding-tax">
|
145 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
146 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
147 |
+
<?php if ($_finalPrice == $_price): ?>
|
148 |
+
<?php echo $_coreHelper->currency($_price, true, false) ?>
|
149 |
+
<?php else: ?>
|
150 |
+
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
|
151 |
+
<?php endif; ?>
|
152 |
+
</span>
|
153 |
+
</span>
|
154 |
+
<span class="price-including-tax">
|
155 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
156 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
157 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?>
|
158 |
+
</span>
|
159 |
+
</span>
|
160 |
+
<?php endif; ?>
|
161 |
+
<?php else: ?>
|
162 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
|
163 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
164 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
|
165 |
+
</span>
|
166 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
|
167 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
168 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
|
169 |
+
</span>
|
170 |
+
<span class="weee">(
|
171 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
172 |
+
<?php echo $_weeeSeparator; ?>
|
173 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
174 |
+
<?php $_weeeSeparator = ' + '; ?>
|
175 |
+
<?php endforeach; ?>
|
176 |
+
)</span>
|
177 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
178 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
179 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
|
180 |
+
</span>
|
181 |
+
<span class="weee">(
|
182 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
183 |
+
<?php echo $_weeeSeparator; ?>
|
184 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
185 |
+
<?php $_weeeSeparator = ' + '; ?>
|
186 |
+
<?php endforeach; ?>
|
187 |
+
)</span>
|
188 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
189 |
+
<span class="regular-price"><?php echo $_coreHelper->currency($_price,true,true) ?></span><br />
|
190 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
191 |
+
<span class="weee">
|
192 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
193 |
+
</span>
|
194 |
+
<?php endforeach; ?>
|
195 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
196 |
+
<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
|
197 |
+
</span>
|
198 |
+
<?php else: ?>
|
199 |
+
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
200 |
+
<?php if ($_finalPrice == $_price): ?>
|
201 |
+
<?php echo $_coreHelper->currency($_price, true, true) ?>
|
202 |
+
<?php else: ?>
|
203 |
+
<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
|
204 |
+
<?php endif; ?>
|
205 |
+
</span>
|
206 |
+
<?php endif; ?>
|
207 |
+
<?php endif; ?>
|
208 |
+
<?php else: /* if ($_finalPrice == $_price): */ ?>
|
209 |
+
<?php $_originalWeeeTaxAmount = $_weeeHelper->getOriginalAmount($_product); ?>
|
210 |
+
|
211 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?>
|
212 |
+
<p class="old-price">
|
213 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
214 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
215 |
+
<?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?>
|
216 |
+
</span>
|
217 |
+
</p>
|
218 |
+
|
219 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
220 |
+
<p class="special-price">
|
221 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
222 |
+
<span class="price-excluding-tax">
|
223 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
224 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
225 |
+
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?>
|
226 |
+
</span>
|
227 |
+
</span>
|
228 |
+
<span class="price-including-tax">
|
229 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
230 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
231 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
232 |
+
</span>
|
233 |
+
</span>
|
234 |
+
</p>
|
235 |
+
<?php else: ?>
|
236 |
+
<p class="special-price">
|
237 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
238 |
+
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
239 |
+
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmountInclTaxes, true, false) ?>
|
240 |
+
</span>
|
241 |
+
</p>
|
242 |
+
<?php endif; ?>
|
243 |
+
|
244 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?>
|
245 |
+
<p class="old-price">
|
246 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
247 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
248 |
+
<?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?>
|
249 |
+
</span>
|
250 |
+
</p>
|
251 |
+
|
252 |
+
<p class="special-price">
|
253 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
254 |
+
<span class="price-excluding-tax">
|
255 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
256 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
257 |
+
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?>
|
258 |
+
</span>
|
259 |
+
</span>
|
260 |
+
<span class="weee">(
|
261 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
262 |
+
<?php echo $_weeeSeparator; ?>
|
263 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
264 |
+
<?php $_weeeSeparator = ' + '; ?>
|
265 |
+
<?php endforeach; ?>
|
266 |
+
)</span>
|
267 |
+
<span class="price-including-tax">
|
268 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
269 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
270 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
271 |
+
</span>
|
272 |
+
</span>
|
273 |
+
</p>
|
274 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?>
|
275 |
+
<p class="old-price">
|
276 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
277 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
278 |
+
<?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?>
|
279 |
+
</span>
|
280 |
+
</p>
|
281 |
+
|
282 |
+
<p class="special-price">
|
283 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
284 |
+
<span class="price-excluding-tax">
|
285 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
286 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
287 |
+
<?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?>
|
288 |
+
</span>
|
289 |
+
</span>
|
290 |
+
<span class="weee">(
|
291 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
292 |
+
<?php echo $_weeeSeparator; ?>
|
293 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?>
|
294 |
+
<?php $_weeeSeparator = ' + '; ?>
|
295 |
+
<?php endforeach; ?>
|
296 |
+
)</span>
|
297 |
+
<span class="price-including-tax">
|
298 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
299 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
300 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
301 |
+
</span>
|
302 |
+
</span>
|
303 |
+
</p>
|
304 |
+
<?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?>
|
305 |
+
<p class="old-price">
|
306 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
307 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
308 |
+
<?php echo $_coreHelper->currency($_regularPrice, true, false) ?>
|
309 |
+
</span>
|
310 |
+
</p>
|
311 |
+
|
312 |
+
<p class="special-price">
|
313 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
314 |
+
<span class="price-excluding-tax">
|
315 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
316 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
317 |
+
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
|
318 |
+
</span>
|
319 |
+
</span>
|
320 |
+
<?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?>
|
321 |
+
<span class="weee">
|
322 |
+
<?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?>
|
323 |
+
</span>
|
324 |
+
<?php endforeach; ?>
|
325 |
+
<span class="price-including-tax">
|
326 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
327 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
328 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?>
|
329 |
+
</span>
|
330 |
+
</span>
|
331 |
+
</p>
|
332 |
+
<?php else: // excl. ?>
|
333 |
+
<p class="old-price">
|
334 |
+
<span class="price-label"><?php echo $this->__('Regular Price:') ?></span>
|
335 |
+
<span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
336 |
+
<?php echo $_coreHelper->currency($_regularPrice, true, false) ?>
|
337 |
+
</span>
|
338 |
+
</p>
|
339 |
+
|
340 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
341 |
+
<p class="special-price">
|
342 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
343 |
+
<span class="price-excluding-tax">
|
344 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
345 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
346 |
+
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
|
347 |
+
</span>
|
348 |
+
</span>
|
349 |
+
<span class="price-including-tax">
|
350 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
351 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
352 |
+
<?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?>
|
353 |
+
</span>
|
354 |
+
</span>
|
355 |
+
</p>
|
356 |
+
<?php else: ?>
|
357 |
+
<p class="special-price">
|
358 |
+
<span class="price-label"><?php echo $this->__('Special Price:') ?></span>
|
359 |
+
<span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
360 |
+
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
|
361 |
+
</span>
|
362 |
+
</p>
|
363 |
+
<?php endif; ?>
|
364 |
+
<?php endif; ?>
|
365 |
+
|
366 |
+
<?php endif; /* if ($_finalPrice == $_price): */ ?>
|
367 |
+
|
368 |
+
<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?>
|
369 |
+
|
370 |
+
<?php $_minimalPriceDisplayValue = $_minimalPrice; ?>
|
371 |
+
<?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?>
|
372 |
+
<?php $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount; ?>
|
373 |
+
<?php endif; ?>
|
374 |
+
|
375 |
+
<?php if ($this->getUseLinkForAsLowAs()):?>
|
376 |
+
<a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link">
|
377 |
+
<?php else:?>
|
378 |
+
<span class="minimal-price-link">
|
379 |
+
<?php endif?>
|
380 |
+
<span class="label"><?php echo $this->__('As low as:') ?></span>
|
381 |
+
<span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
382 |
+
<?php echo $_coreHelper->currency($_minimalPriceDisplayValue, true, false) ?>
|
383 |
+
</span>
|
384 |
+
<?php if ($this->getUseLinkForAsLowAs()):?>
|
385 |
+
</a>
|
386 |
+
<?php else:?>
|
387 |
+
</span>
|
388 |
+
<?php endif?>
|
389 |
+
<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?>
|
390 |
+
</div>
|
391 |
+
|
392 |
+
<?php else: /* if (!$_product->isGrouped()): */ ?>
|
393 |
+
<?php
|
394 |
+
$_exclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue);
|
395 |
+
$_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, true);
|
396 |
+
?>
|
397 |
+
<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue): ?>
|
398 |
+
<div class="price-box">
|
399 |
+
<p class="minimal-price">
|
400 |
+
<span class="price-label"><?php echo $this->__('Starting at:') ?></span>
|
401 |
+
<?php if ($_taxHelper->displayBothPrices()): ?>
|
402 |
+
<span class="price-excluding-tax">
|
403 |
+
<span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
|
404 |
+
<span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
405 |
+
<?php echo $_coreHelper->currency($_exclTax, true, false) ?>
|
406 |
+
</span>
|
407 |
+
</span>
|
408 |
+
<span class="price-including-tax">
|
409 |
+
<span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
|
410 |
+
<span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
411 |
+
<?php echo $_coreHelper->currency($_inclTax, true, false) ?>
|
412 |
+
</span>
|
413 |
+
</span>
|
414 |
+
<?php else: ?>
|
415 |
+
<?php
|
416 |
+
$_showPrice = $_inclTax;
|
417 |
+
if (!$_taxHelper->displayPriceIncludingTax()) {
|
418 |
+
$_showPrice = $_exclTax;
|
419 |
+
}
|
420 |
+
?>
|
421 |
+
<span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
|
422 |
+
<?php echo $_coreHelper->currency($_showPrice, true, false) ?>
|
423 |
+
</span>
|
424 |
+
<?php endif; ?>
|
425 |
+
</p>
|
426 |
+
</div>
|
427 |
+
<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice): */ ?>
|
428 |
+
<?php endif; /* if (!$_product->isGrouped()): */ ?>
|
app/design/frontend/base/default/template/connector/roi_code.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(Mage::getStoreConfig('connector_roi_page_tracking_settings/roi_tracking/enabled')):?>
|
4 |
+
|
5 |
+
<?php
|
6 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
7 |
+
$orderId = $this->getOrderId();
|
8 |
+
$items = $order->getAllItems();
|
9 |
+
$total = number_format($order->getBaseGrandTotal(), 2);
|
10 |
+
|
11 |
+
?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
<?php foreach ($items as $item):?>
|
14 |
+
|
15 |
+
<?php if($item->getParentItemId() != null)
|
16 |
+
continue;?>
|
17 |
+
_dmTrack("product", <?php echo $item->getName()?>;
|
18 |
+
|
19 |
+
<?php endforeach;?>
|
20 |
+
_dmTrack("CheckOutAmount", <?php echo $total;?>);
|
21 |
+
</script>
|
22 |
+
|
23 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/connector/tracking_code.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(Mage::getStoreConfig('connector_roi_page_tracking_settings/page_tracking/enabled')) :?>
|
3 |
+
<script src="http://t.trackedlink.net/_dmpt.js" type="text/javascript"></script>
|
4 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/page/blank.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->getChildHtml('content');?>
|
app/design/frontend/base/default/template/page/connector/products.phtml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $productCollection = $this->getRecommendedProducts();?>
|
2 |
+
|
3 |
+
|
4 |
+
<?php
|
5 |
+
$listMode = $this->getMode();
|
6 |
+
|
7 |
+
?>
|
8 |
+
|
9 |
+
<?php $i = 0;foreach ($productCollection as $key => $_product) :?>
|
10 |
+
<?php $_product = Mage::getModel('catalog/product')->load($_product->getEntityId());?>
|
11 |
+
<?php if($i == 0):?>
|
12 |
+
<table border="0" bordercolor="#FFCC00" width="147" cellpadding="0" cellspacing="0" style='font-family:arial; border-collapse: collapse; font-size:12;'><tr>
|
13 |
+
<?php endif;?>
|
14 |
+
<?php
|
15 |
+
//LIST MODE
|
16 |
+
if($listMode == 'list'){
|
17 |
+
echo '</tr><tr>';
|
18 |
+
}?>
|
19 |
+
|
20 |
+
<td style="vertical-align: text-top; padding-right: 2px;">
|
21 |
+
|
22 |
+
|
23 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="140" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" align="middle" /></a>
|
24 |
+
|
25 |
+
<div align="center"><b><?php echo substr($_product->getName(), 0, 40);?></b></div>
|
26 |
+
|
27 |
+
<div align="center"><?php echo $this->getPriceHtml($_product, true);?></div>
|
28 |
+
<div align="center"><a href="<?php echo $_product->getProductUrl();?>">View Now</a></div>
|
29 |
+
</td>
|
30 |
+
|
31 |
+
<?php if($i++ % 4 ==3 && $listMode == 'grid') echo '</tr><tr>'?>
|
32 |
+
|
33 |
+
<?php endforeach;?>
|
34 |
+
|
35 |
+
</table>
|
36 |
+
|
37 |
+
|
app/etc/modules/Dotdigitalgroup_Email.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Dotdigitalgroup_Email>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Dotdigitalgroup_Email>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>dotmailermagento</name>
|
4 |
+
<version>1.5.1</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>Integrate your ecommerce with dotMailer's powerful triggered email marketing and convert more visits to sales.</summary>
|
10 |
+
<description>Connector Integration for Magento, allows to manage and synchronise customer data and lost baskets.</description>
|
11 |
+
<notes>Product recommendation and dynamic content for connector.</notes>
|
12 |
+
<authors><author><name>Calin Diacon</name><user>cdiacon</user><email>cdiacon@gmail.com</email></author></authors>
|
13 |
+
<date>2013-10-23</date>
|
14 |
+
<time>10:14:57</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Dotdigitalgroup"><dir name="Email"><dir name="Block"><dir name="Adminhtml"><dir name="System"><file name="Bestsellers.php" hash="3712d5b267bcb960ab61ea4c2f7780fd"/><dir name="Config"><file name="Gridlist.php" hash="4022c4af28efa8b521eae76da8781417"/><file name="Insertvariable.php" hash="16efa5b30d69f1a87ba73a39c30d526b"/><file name="Messagedefault.php" hash="316850603c3aba812e34955f4e6ea1ad"/><file name="Password.php" hash="3065946d4e092e6fe0d31cbb4b52edee"/><file name="Smsmessagefour.php" hash="6764248cd2dd0a1df8f8546ef581cefd"/><file name="Smsmessageone.php" hash="f99c4598125f337f5d02003e381466b0"/><file name="Smsmessagethree.php" hash="5deb67df50db7c640c7d8438cad05df6"/><file name="Smsmessagetwo.php" hash="ef33d2f8c780dba2fa71e3723192ed74"/><file name="Validator.php" hash="03288ddcb5cbf3234231d8af8f7723ff"/><file name="Waitingfield.php" hash="fb25e0d81a2067a2d8f6cabff4277f84"/><file name="Wrapper.php" hash="cf5319d175c585354c2d9ebfe30d41e6"/></dir><file name="Couponinfo.php" hash="ede44a34e922becad72a5b3c1c0fc633"/><file name="Crosssell.php" hash="e2f2f5436d3ea902cd40a03795d5e456"/><file name="Lostbasket.php" hash="923a64cb4759f3c1a6bac37437612a7c"/><file name="Mostviewed.php" hash="e6ecfc239e55d4f3781ae8d6e7da15ce"/><file name="Productpush.php" hash="9c243d149366577f47383935892f58d5"/><file name="Recentlyviewed.php" hash="2351cd33be3f670809a72774989b149a"/><file name="Related.php" hash="69a352f8d5c2b397f19cf2a3f1eac9d7"/><file name="Upsell.php" hash="20e8adb20d3bb7e31dfce13e616cd195"/></dir></dir><file name="Basket.php" hash="850034be56ab609ca8345781520148ae"/><file name="Coupon.php" hash="6aaec59401eb7a4602dcb29db9d8c03d"/><dir name="Debug"><file name="Countcontacts.php" hash="59d8d74a82aac88d3cb0f4ed9ffecfef"/><file name="Deletecontacts.php" hash="f2b3f787467ff337331e554117e48408"/><file name="Forcecustomersync.php" hash="d5738efb228c7ba430bf2156941b93a7"/><file name="Forcelostbasketsync.php" hash="f12e28f29b7e1c56edf6464b5af7ead4"/><file name="Forcesuppressedsync.php" hash="cfda0355fae3284853259f3f292dd742"/><file name="Initialsync.php" hash="118b2c178a22fa3cd2301d4d9bbec5f2"/><file name="Rescuenow.php" hash="f20a18a3fe2803c7d71924ec04bc4f50"/><file name="Testcredentials.php" hash="660ca7d025c51974bec5307518649506"/><file name="Transactionalsync.php" hash="7cce60182af6603fa0a082bf02752be8"/></dir><file name="Products.php" hash="091bd0a56391c7fc1b94e96e11ea636c"/></dir><dir name="Helper"><dir name="Api"><file name="DotNetExample.php" hash="cdefe297bf38b6c49ec0acdf9f43264a"/><file name="Restrequest.php" hash="dbd90bdcc12a90bcc875e6c88842e8be"/></dir><file name="Data.php" hash="042d65513fc63e89ff8093e5cb932ec1"/><file name="File.php" hash="7b13d5ce553d5c0442694a9ad2d46016"/><file name="Recommended.php" hash="e14f6657e3243816e8f7d4aae214499e"/></dir><dir name="Model"><dir name="Account"><file name="Test.php" hash="71095642bfae08183962007d59ef028c"/></dir><dir name="Api"><file name="Rest.php" hash="c91400b9e9d21cef977b95479752ad90"/></dir><dir name="Connector"><file name="Account.php" hash="b232ee04f222c3e61a6e6494d13a11b4"/><file name="Customer.php" hash="1f201b107ced31b9bad9b9884f8c4a28"/><file name="Order.php" hash="4baaed26cb6efb7de3dfdf8550acc6fe"/><file name="Quote.php" hash="74cb4c28351223c213889d00552712a7"/><file name="Wishlist.php" hash="7f02a04debb6d6a8971d5e696142b1c7"/></dir><file name="Cron.php" hash="23942f32f5cfeae44479fec3e4ca0294"/><dir name="Customer"><file name="Customer.php" hash="4b853783ed303a61dd5808f0fc368c3a"/><file name="Suppressed.php" hash="639382b91fe82328548429c5d7d48a7e"/><dir name="Wishlist"><file name="Item.php" hash="7087ac6edf465a88a5dd96af483459d9"/></dir></dir><dir name="Dynamic"><dir name="Product"><file name="Mapper.php" hash="63451cbd3d11523ba6d60f71a88d10f6"/></dir><file name="Recommended.php" hash="6588de609b5bc87ed1a51b25f7243858"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="aa06389101532308e6aa14da6cef2c99"/></dir><file name="Observer.php" hash="b3106c169860a62263e3aa92230f9f16"/><file name="Order.php" hash="df951471328bb27f35babb337e527851"/><dir name="Sales"><file name="Order.php" hash="2cb28b4a209825331ea01d6b45576d08"/><file name="Quote.php" hash="c97137d259868f7a44aaaa95e2130674"/><file name="Sms.php" hash="ea05d7b33f140fd308a60215fa5f7baa"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Syncschedule"><file name="Customer.php" hash="d421b5ac07c5bb71051edfda1cc4dcdb"/><file name="Suppressed.php" hash="6eb9b26bbac6c6ce86a7981a20f604ad"/></dir></dir><dir name="Source"><file name="Activebasket.php" hash="1ec34cf0f073f40c36f1918d4f38cbb0"/><file name="Addressbooks.php" hash="e482c8e6d64520eed38110005b6f44ea"/><file name="Campaigns.php" hash="221e817a4796d3754b6230f8e71a91e5"/><file name="Datafields.php" hash="e8d219b3170bf5e416bdf479874f0304"/><file name="Displayifnot.php" hash="175ec822880b9c21bdde7697e90da2d8"/><file name="Displaytype.php" hash="6025a5b7b08908819ec20263b0715b8b"/><file name="Gridview.php" hash="6c9a24e47167cabaa9c749670372e4ed"/><file name="Lostbasket.php" hash="02c5254bd7aeab58253f38e6ee401ee7"/><file name="Orderlimit.php" hash="db8cc03eb2259ce07900b5d2a45eedbc"/><file name="Orderstatus.php" hash="62446aebcb422acce53641412c0fd98f"/><file name="Sendcampain.php" hash="207c467eb35319e26437be126716fc72"/><file name="Syncfrequency.php" hash="19181d66a5688d6da78da9b8b0c639b0"/><file name="Timeperiod.php" hash="6f3d5907f6e6bdff3a6e0fae196fa78c"/></dir></dir></dir></dir><dir name="Test"><dir name="Model"><file name="Product.php" hash="590f024e6ae4a33044897004e81d5a33"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DebugController.php" hash="0b58c42b842da871181f19ca97d69a13"/></dir><file name="EmailController.php" hash="af67b1470e5f33767d2fbf80c8d2725f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5f8fdbfa276d01622117b1a5a7ac4bf4"/><file name="config.xml" hash="10fd0f57b91292c12737b83b9244240c"/><file name="system.xml" hash="2ff93941b9d0336a602bbe410a377282"/></dir><dir name="sql"><dir name="connector_setup"><file name="mysql4-install-0.1.0.php" hash="c33e49225f3974f784f8b7b12f609102"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="7fae25a8ae47fe0ba692076ac04237a4"/></dir></dir></dir></dir><dir name="Varien"><dir name="Data"><file name="Collection.php" hash="a925107e95454d0e6609138b00f972aa"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="connector.xml" hash="d86fe05590ffbcbd4fe671da9cdb2979"/></dir><dir name="template"><dir name="connector"><file name="basket.phtml" hash="2dadd9e056a5a0267fb5a84e8d711fce"/><file name="coupon.phtml" hash="0e39fce43a6b3c4b45130996f1de90ff"/><file name="price.phtml" hash="3600de0d5573415628823b3d1f397cca"/><file name="roi_code.phtml" hash="72b38638e7105a4375cf22d662d67fab"/><file name="tracking_code.phtml" hash="4dcec68640a76074eced63d054a701eb"/></dir><dir name="page"><dir name="connector"><file name="products.phtml" hash="3c8bf292c14da73cd513498978323724"/></dir><file name="blank.phtml" hash="7bf34446254428a5c42740731127b435"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotdigitalgroup_Email.xml" hash="9b9b2dbb1f62fe025fe35da89171b658"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>1.5.2</min><max>6.0.0</max></php><extension><name>curl</name><min>7.15.1</min><max>7.30.0</max></extension></required></dependencies>
|
18 |
+
</package>
|