Version Notes
- Send full order, product, and category data to Campaigner: Target your subscribers by the products they purchase, the amount of money they spend, the categories they shop in and more! Campaigner’s Magento extension now automatically sends order and product information into your Campaigner database. Order information sent to Campaigner includes Email Address, Order Number, Product Name, SKU, Purchase Price, Purchase Date and more. Category/product data will be moved to Campaigner gradually as orders are moved, but it can alternatively be moved in bulk (using new sync features, see below) or automatically any time you make a change to a product or category in Magento. This information will appear in the e-Commerce tab of your Campaigner account; if you don't see the e-Commerce main navigation tab, contact Campaigner Sales before you begin.
- Bulk data synchronization: Get started quickly by importing your Magento subscriber data directly into Campaigner®. Send orders and product information in bulk to kick start segmentation-driven drip campaigns right after a fresh install or at any time afterwards to keep your email marketing initiatives and Magento activities seamlessly in sync.
- Trigger Campaigner workflows: Choose whether or not subscriber actions (profile updates and subscription preferences) performed in your Magento storefront will trigger any related, active workflows set up in your Campaigner account.
- Tracking background tasks: additional sections have been added to the 'Management' menu item under the 'Campaigner' main navigation tab to display information on data transfer activities relating to orders, products, and categories.
Release Info
Developer | Magento Core Team |
Extension | Campaigner_Integration |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.1.1
- app/code/community/Campaigner/Integration/Block/Adminhtml/Abandoned.php +3 -62
- app/code/community/Campaigner/Integration/Block/Adminhtml/Abandoned/Details.php +3 -3
- app/code/community/Campaigner/Integration/Block/Adminhtml/Abandoned/Grid.php +2 -2
- app/code/community/Campaigner/Integration/Block/Adminhtml/Abandoned/Status.php +2 -2
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task.php +12 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Details.php +85 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Details/Form.php +10 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Details/Tab/Info.php +75 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Grid.php +195 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Status.php +9 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Background/Task/Tabs.php +29 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Container.php +75 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Latest.php +3 -54
- app/code/community/Campaigner/Integration/Block/Adminhtml/Latest/Grid.php +1 -1
- app/code/community/Campaigner/Integration/Block/Adminhtml/Latest/Status.php +2 -2
- app/code/community/Campaigner/Integration/Block/Adminhtml/Order/View/Tab/Diagnostics.php +84 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Order/View/Tab/Diagnostics/Status.php +83 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Orders.php +27 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Orders/Filter.php +44 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Orders/Grid.php +273 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Orders/Status.php +9 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Products.php +12 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Products/Grid.php +210 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Products/Status.php +9 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Fieldset/Hint.php +0 -5
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Api.php +8 -3
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Commerce/Api.php +30 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Commerce/Note.php +25 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Cron/Url/Info.php +72 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/EmailDirect.php +30 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Note.php +5 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Customers.php +17 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Customers/Button.php +39 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Customers/Range.php +11 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Orders/Button.php +39 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Orders/Range.php +11 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Products/Button.php +17 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Config/Form/Field/Sync/Range.php +34 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Convert/Profile/Sync.php +79 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Convert/Profile/Sync/Customers.php +27 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Convert/Profile/Sync/Orders.php +27 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/System/Convert/Profile/Sync/Products.php +131 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Cron.php +234 -0
- app/code/community/Campaigner/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Help.php +5 -1
- app/code/community/Campaigner/Integration/Block/Adminhtml/Troubleshooting/View/Tab/Log.php +21 -0
- app/code/community/Campaigner/Integration/Block/Widget/Grid/Column/Renderer/Abandoned/Minutes.php +1 -1
- app/code/community/Campaigner/Integration/Block/Widget/Grid/Column/Renderer/Orders/State.php +35 -0
- app/code/community/Campaigner/Integration/Block/Widget/Grid/Column/Renderer/Products/Name.php +18 -0
- app/code/community/Campaigner/Integration/Helper/Abandoned.php +16 -6
- app/code/community/Campaigner/Integration/Helper/Cron.php +133 -0
- app/code/community/Campaigner/Integration/Helper/Data.php +137 -140
- app/code/community/Campaigner/Integration/Helper/Order.php +2 -2
- app/code/community/Campaigner/Integration/Helper/Sync.php +383 -0
- app/code/community/Campaigner/Integration/Helper/Troubleshooting.php +32 -12
- app/code/community/Campaigner/Integration/Model/Abandoned/Observer.php +3 -6
- app/code/community/Campaigner/Integration/Model/Action/List.php +0 -40
- app/code/community/Campaigner/Integration/Model/Action/Observer.php +0 -18
- app/code/community/Campaigner/Integration/Model/Background/Observer.php +333 -0
- app/code/community/Campaigner/Integration/Model/Background/Task.php +69 -0
- app/code/community/Campaigner/Integration/Model/Category.php +51 -0
- app/code/community/Campaigner/Integration/Model/Configuration/Observer.php +121 -15
- app/code/community/Campaigner/Integration/Model/Customer/Observer.php +2 -3
- app/code/community/Campaigner/Integration/Model/Mysql4/Action/List/Collection.php +0 -17
- app/code/community/Campaigner/Integration/Model/Mysql4/{Action/List.php → Background/Task.php} +6 -5
- app/code/community/Campaigner/Integration/Model/Mysql4/Background/Task/Collection.php +66 -0
- app/code/community/Campaigner/Integration/Model/Mysql4/Category.php +28 -0
- app/code/community/Campaigner/Integration/Model/Mysql4/Order/Collection.php +86 -4
- app/code/community/Campaigner/Integration/Model/Mysql4/Product.php +28 -0
- app/code/community/Campaigner/Integration/Model/Mysql4/Product/Category/Action.php +40 -0
- app/code/community/Campaigner/Integration/Model/Mysql4/Product/Category/Action/Collection.php +26 -0
- app/code/community/Campaigner/Integration/Model/Newsletter/Observer.php +231 -229
- app/code/community/Campaigner/Integration/Model/Observer.php +1 -1
- app/code/community/Campaigner/Integration/Model/Order/Observer.php +365 -8
- app/code/community/Campaigner/Integration/Model/Product.php +74 -0
- app/code/community/Campaigner/Integration/Model/Product/Category/Action.php +77 -0
- app/code/community/Campaigner/Integration/Model/Product/Observer.php +335 -0
- app/code/community/Campaigner/Integration/Model/System/Config/Source/Store.php +0 -2
- app/code/community/Campaigner/Integration/Model/Wrapper/Abandoned.php +3 -8
- app/code/community/Campaigner/Integration/Model/Wrapper/Abstract.php +30 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Commerce/Category.php +114 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Commerce/Execute.php +209 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Commerce/Orders.php +90 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Commerce/Product.php +138 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Execute.php +19 -0
- app/code/community/Campaigner/Integration/Model/Wrapper/Orders.php +2 -14
- app/code/community/Campaigner/Integration/Model/Wrapper/Subscribers.php +49 -41
- app/code/community/Campaigner/Integration/Model/Wrapper/Wishlist.php +11 -13
- app/code/community/Campaigner/Integration/controllers/AbandonedController.php +13 -14
- app/code/community/Campaigner/Integration/controllers/{Admin → Adminhtml/Campaigner}/AbandonedController.php +1 -1
- app/code/community/Campaigner/Integration/controllers/Adminhtml/Campaigner/Background/TaskController.php +142 -0
- app/code/community/Campaigner/Integration/controllers/{Admin → Adminhtml/Campaigner}/DiagnosticController.php +17 -15
- app/code/community/Campaigner/Integration/controllers/{Admin → Adminhtml/Campaigner}/LatestController.php +3 -3
- app/code/community/Campaigner/Integration/controllers/Adminhtml/Campaigner/OrderController.php +119 -0
- app/code/community/Campaigner/Integration/controllers/Adminhtml/Campaigner/ProductController.php +126 -0
- app/code/community/Campaigner/Integration/controllers/Adminhtml/Campaigner/SyncController.php +709 -0
- app/code/community/Campaigner/Integration/controllers/{Admin → Adminhtml/Campaigner}/TroubleshootingController.php +54 -8
- app/code/community/Campaigner/Integration/controllers/CronController.php +40 -0
- app/code/community/Campaigner/Integration/etc/adminhtml.xml +55 -18
- app/code/community/Campaigner/Integration/etc/config.xml +111 -35
- app/code/community/Campaigner/Integration/etc/system.xml +481 -1
- app/code/community/Campaigner/Integration/sql/campaigner_setup/mysql4-upgrade-1.0.2-1.0.3.php +35 -0
- app/code/community/Campaigner/Integration/sql/campaigner_setup/mysql4-upgrade-1.0.3-1.1.0.php +25 -0
- app/code/community/Campaigner/Integration/sql/campaigner_setup/mysql4-upgrade-1.1.0-1.1.1.php +47 -0
- app/design/adminhtml/default/default/layout/campaigner.xml +87 -21
- app/design/adminhtml/default/default/template/campaigner/abandoned/status.phtml +0 -18
- app/design/adminhtml/default/default/template/campaigner/background/task/details.phtml +15 -0
- app/design/adminhtml/default/default/template/campaigner/background/task/details/form.phtml +1 -0
- app/design/adminhtml/default/default/template/campaigner/background/task/details/tab/info.phtml +41 -0
- app/design/adminhtml/default/default/template/campaigner/{latest → cron}/status.phtml +1 -1
- app/design/adminhtml/default/default/template/campaigner/diagnostics.phtml +2 -2
- app/design/adminhtml/default/default/template/campaigner/order/view/tab/diagnostics/status.phtml +78 -0
- app/design/adminhtml/default/default/template/campaigner/orders/filter.phtml +28 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/fieldset/hint.phtml +143 -23
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/api.phtml +4 -5
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/array.phtml +2 -30
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/commerce/api.phtml +54 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/commerce/note.phtml +4 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/cron/url/info.phtml +16 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/diagnostics.phtml +3 -3
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/emaildirect.phtml +5 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/export/date_range.phtml +0 -144
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/export/orders.phtml +0 -20
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/export/products.phtml +0 -21
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/info.phtml +1 -1
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/logging.phtml +21 -25
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/note.phtml +7 -3
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/smtp/test.phtml +1 -1
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/customers.phtml +47 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/customers/button.phtml +139 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/customers/date_range_remove.phtml +147 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/date_range.phtml +100 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/orders/button.phtml +131 -0
- app/design/adminhtml/default/default/template/campaigner/system/config/form/field/sync/products/button.phtml +98 -0
- app/design/adminhtml/default/default/template/campaigner/system/convert/profile/export.phtml +0 -221
- app/design/adminhtml/default/default/template/campaigner/system/convert/profile/product_sync.phtml +257 -0
- app/design/adminhtml/default/default/template/campaigner/system/convert/profile/sync.phtml +222 -0
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/status.phtml +20 -20
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/cron.phtml +150 -0
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/download.phtml +2 -2
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/help.phtml +64 -1
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/info.phtml +23 -19
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/log.phtml +57 -11
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/settings.phtml +2 -2
- app/design/adminhtml/default/default/template/campaigner/troubleshooting/view/tab/submit.phtml +2 -2
- package.xml +11 -5
- skin/adminhtml/default/default/campaigner/campaigner.css +15 -3
@@ -1,71 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Campaigner_Integration_Block_Adminhtml_Abandoned extends
|
4 |
{
|
5 |
public function __construct()
|
6 |
{
|
7 |
-
$this->
|
8 |
-
$this->
|
9 |
-
|
10 |
-
$status = Mage::helper('campaigner')->getAbandonedStatus();
|
11 |
-
|
12 |
-
if ($status['enabled']) {
|
13 |
-
|
14 |
-
$this->_headerText = "Abandoned Carts - Cron Last Run: " . Mage::helper('campaigner')->getCronLastRunHtml();
|
15 |
-
|
16 |
-
$label = 'Run now on all stores';
|
17 |
-
|
18 |
-
if (Mage::app()->isSingleStoreMode()) {
|
19 |
-
$label = 'Run now';
|
20 |
-
}
|
21 |
-
|
22 |
-
$this->addButton('refresh', array(
|
23 |
-
'label' => Mage::helper('campaigner')->__('Refresh'),
|
24 |
-
'onclick' => 'abandonedGridJsObject.reload();return false;',
|
25 |
-
));
|
26 |
-
|
27 |
-
$this->_addButton('run_now', array(
|
28 |
-
'label' => Mage::helper('campaigner')->__($label),
|
29 |
-
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/run') .'\')',
|
30 |
-
));
|
31 |
-
} else {
|
32 |
-
$this->_headerText = "Abandoned Carts - <span class='ab_ng'>Disabled</span>";
|
33 |
-
}
|
34 |
-
|
35 |
-
$data = Mage::helper('campaigner')->getCronLastRun(0,'cron_last_run');
|
36 |
-
|
37 |
-
if ($data['class'] == 'ab_ng') {
|
38 |
-
Mage::getSingleton('adminhtml/session')->addWarning("There appears to be a problem with your cron settings. Please make sure that cron is running so that Abandoned Carts can be processed.");
|
39 |
-
}
|
40 |
|
41 |
parent::__construct();
|
42 |
-
$this->_removeButton('add');
|
43 |
-
}
|
44 |
-
|
45 |
-
public function getStatusHtml()
|
46 |
-
{
|
47 |
-
return $this->getChildHtml('abandoned_status');
|
48 |
-
}
|
49 |
-
|
50 |
-
protected function _prepareLayout()
|
51 |
-
{
|
52 |
-
$this->setChild('store_switcher',
|
53 |
-
$this->getLayout()->createBlock('adminhtml/store_switcher')
|
54 |
-
->setUseConfirm(false)
|
55 |
-
->setSwitchUrl($this->getUrl('*/*/*', array('store'=>null)))
|
56 |
-
->setTemplate('report/store/switcher.phtml')
|
57 |
-
);
|
58 |
-
|
59 |
-
$this->setChild('abandoned_status',
|
60 |
-
$this->getLayout()->createBlock('campaigner/adminhtml_abandoned_status')
|
61 |
-
->setTemplate('campaigner/abandoned/status.phtml')
|
62 |
-
);
|
63 |
-
|
64 |
-
return parent::_prepareLayout();
|
65 |
-
}
|
66 |
-
|
67 |
-
public function getGridHtml()
|
68 |
-
{
|
69 |
-
return $this->getStatusHtml() . parent::getGridHtml();
|
70 |
}
|
71 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Abandoned extends Campaigner_Integration_Block_Adminhtml_Container
|
4 |
{
|
5 |
public function __construct()
|
6 |
{
|
7 |
+
$this->_type = Campaigner_Integration_Helper_Cron::ABANDONED;
|
8 |
+
$this->_label = 'Abandoned Carts';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
parent::__construct();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
12 |
}
|
@@ -47,11 +47,11 @@ class Campaigner_Integration_Block_Adminhtml_Abandoned_Details extends Mage_Admi
|
|
47 |
|
48 |
if ($abandoned_cart->getCustomerGroupId() == 0) {
|
49 |
// Guest
|
50 |
-
$email = $abandoned_cart->getEmail();
|
51 |
|
52 |
$additional = "Guest Customer ({$email})";
|
53 |
} else {
|
54 |
-
$email = $abandoned_cart->getCustomerEmail();
|
55 |
$name = $abandoned_cart->getCustomerFirstname() . " " . $abandoned_cart->getCustomerLastname();
|
56 |
$additional = "{$name} ({$email})";
|
57 |
}
|
@@ -68,7 +68,7 @@ class Campaigner_Integration_Block_Adminhtml_Abandoned_Details extends Mage_Admi
|
|
68 |
|
69 |
public function getDownloadUrl()
|
70 |
{
|
71 |
-
return $this->getUrl('
|
72 |
}
|
73 |
|
74 |
public function getBackUrl()
|
47 |
|
48 |
if ($abandoned_cart->getCustomerGroupId() == 0) {
|
49 |
// Guest
|
50 |
+
$email = $this->escapeHtml($abandoned_cart->getEmail());
|
51 |
|
52 |
$additional = "Guest Customer ({$email})";
|
53 |
} else {
|
54 |
+
$email = $this->escapeHtml($abandoned_cart->getCustomerEmail());
|
55 |
$name = $abandoned_cart->getCustomerFirstname() . " " . $abandoned_cart->getCustomerLastname();
|
56 |
$additional = "{$name} ({$email})";
|
57 |
}
|
68 |
|
69 |
public function getDownloadUrl()
|
70 |
{
|
71 |
+
return $this->getUrl('adminhtml/campaigner_troubleshooting/download/');
|
72 |
}
|
73 |
|
74 |
public function getBackUrl()
|
@@ -26,7 +26,7 @@ class Campaigner_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminht
|
|
26 |
$this->setTemplate('widget/grid.phtml');
|
27 |
$this->setRowClickCallback('openGridRow');
|
28 |
|
29 |
-
$this->_abandoned_status = Mage::helper('campaigner')->
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -163,7 +163,7 @@ class Campaigner_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminht
|
|
163 |
'filter_index' => 'main_table.store_id',
|
164 |
'store_view' => true,
|
165 |
'sortable' => false
|
166 |
-
|
167 |
|
168 |
$this->addColumn('subtotal', array(
|
169 |
'header' => Mage::helper('campaigner')->__('Subtotal'),
|
26 |
$this->setTemplate('widget/grid.phtml');
|
27 |
$this->setRowClickCallback('openGridRow');
|
28 |
|
29 |
+
$this->_abandoned_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::ABANDONED);
|
30 |
}
|
31 |
|
32 |
/**
|
163 |
'filter_index' => 'main_table.store_id',
|
164 |
'store_view' => true,
|
165 |
'sortable' => false
|
166 |
+
));
|
167 |
|
168 |
$this->addColumn('subtotal', array(
|
169 |
'header' => Mage::helper('campaigner')->__('Subtotal'),
|
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
class Campaigner_Integration_Block_Adminhtml_Abandoned_Status extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
-
public function
|
6 |
{
|
7 |
-
return Mage::helper('campaigner')->
|
8 |
}
|
9 |
}
|
2 |
|
3 |
class Campaigner_Integration_Block_Adminhtml_Abandoned_Status extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
+
public function getStatus()
|
6 |
{
|
7 |
+
return Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::ABANDONED);
|
8 |
}
|
9 |
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task extends Campaigner_Integration_Block_Adminhtml_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_type = Campaigner_Integration_Helper_Cron::BACKGROUND;
|
8 |
+
$this->_label = 'Background Tasks';
|
9 |
+
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Details extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
protected $_task = null;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->_blockGroup = "campaigner";
|
10 |
+
$this->_controller = 'adminhtml_background_task';
|
11 |
+
$this->_mode = 'details';
|
12 |
+
|
13 |
+
parent::__construct();
|
14 |
+
|
15 |
+
if (!$this->isGuestCustomer()) {
|
16 |
+
$this->_addButton('view_customer', array(
|
17 |
+
'label' => Mage::helper('campaigner')->__('View Customer'),
|
18 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/customer/edit', array('id'=> $this->getCustomerId(), 'active_tab'=>'cart')) . '\')',
|
19 |
+
), 0);
|
20 |
+
}
|
21 |
+
|
22 |
+
$task = $this->getTask();
|
23 |
+
|
24 |
+
$this->_removeButton('delete');
|
25 |
+
$this->_removeButton('reset');
|
26 |
+
$this->_removeButton('save');
|
27 |
+
$this->setId('background_task_details');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getTask()
|
31 |
+
{
|
32 |
+
return Mage::registry('background_task');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getCustomerId()
|
36 |
+
{
|
37 |
+
return $this->getTask()->getCustomerId();
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getCustomer()
|
41 |
+
{
|
42 |
+
return Mage::getModel('customer/customer')->load($this->getCustomerId());
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isGuestCustomer()
|
46 |
+
{
|
47 |
+
return $this->getCustomerId() == null;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getHeaderText()
|
51 |
+
{
|
52 |
+
//$abandoned_cart = Mage::helper('campaigner/diagnostic')->getAbandonedCart();
|
53 |
+
$task = $this->getTask();
|
54 |
+
|
55 |
+
$email = $this->escapeHtml($task->getEmail());
|
56 |
+
$name = "";
|
57 |
+
$additional = "";
|
58 |
+
|
59 |
+
if ($this->isGuestCustomer()) {
|
60 |
+
// Guest
|
61 |
+
$email = $this->escapeHtml($task->getEmail());
|
62 |
+
|
63 |
+
$additional = "Guest Customer ({$email})";
|
64 |
+
} else {
|
65 |
+
$customer = $this->getCustomer();
|
66 |
+
|
67 |
+
$name = $customer->getName();
|
68 |
+
$additional = "{$name} ({$email})";
|
69 |
+
}
|
70 |
+
|
71 |
+
$date = Mage::helper('core')->formatTime($task->getCreatedAt(), 'medium', true);
|
72 |
+
|
73 |
+
return Mage::helper('campaigner')->__('Background Task (' . $task->getCode() . ') - ' . $additional . " - Created On: " . $date);
|
74 |
+
}
|
75 |
+
|
76 |
+
public function getUrl($params='', $params2=array())
|
77 |
+
{
|
78 |
+
return parent::getUrl($params, $params2);
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getBackUrl()
|
82 |
+
{
|
83 |
+
return Mage::helper('campaigner')->getAdminUrl('*/*/index');
|
84 |
+
}
|
85 |
+
}
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Details_Form extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate('campaigner/background/task/details/form.phtml');
|
9 |
+
}
|
10 |
+
}
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Details_Tab_Info
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
public function getTabLabel()
|
8 |
+
{
|
9 |
+
return Mage::helper('campaigner')->__('Task Details');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getTabTitle()
|
13 |
+
{
|
14 |
+
return Mage::helper('campaigner')->__('Task Details');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function canShowTab()
|
18 |
+
{
|
19 |
+
return true;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isHidden()
|
23 |
+
{
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function __construct()
|
28 |
+
{
|
29 |
+
parent::__construct();
|
30 |
+
$this->setTemplate('campaigner/background/task/details/tab/info.phtml');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getTask()
|
34 |
+
{
|
35 |
+
return Mage::registry('background_task');
|
36 |
+
}
|
37 |
+
|
38 |
+
private function mapField($customField, $fieldMap)
|
39 |
+
{
|
40 |
+
foreach ($fieldMap as $code => $id) {
|
41 |
+
if ($customField['Id'] == $id) {
|
42 |
+
return $code;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
return "Unknown";
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getDetails()
|
50 |
+
{
|
51 |
+
try {
|
52 |
+
$details = $this->getTask()->getDetails();
|
53 |
+
|
54 |
+
$customFields = $details['CustomAttributes'];
|
55 |
+
|
56 |
+
if ($customFields) {
|
57 |
+
$customData = array();
|
58 |
+
|
59 |
+
$fieldMap = Mage::helper('campaigner/fields')->getFieldMap();
|
60 |
+
|
61 |
+
foreach ($customFields as $customField) {
|
62 |
+
$code = $this->mapField($customField, $fieldMap);
|
63 |
+
$customData[$code] = $customField["_"];
|
64 |
+
}
|
65 |
+
|
66 |
+
$details['CustomAttributes'] = $customData;
|
67 |
+
}
|
68 |
+
|
69 |
+
return $details;
|
70 |
+
|
71 |
+
} catch (Exception $e) {
|
72 |
+
return $e->getMessage();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* ids of current stores
|
8 |
+
*/
|
9 |
+
protected $_store_ids = array();
|
10 |
+
|
11 |
+
protected $_status = null;
|
12 |
+
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
$this->setId('background_taskGrid');
|
17 |
+
$this->setUseAjax(true);
|
18 |
+
$this->setDefaultSort('created_at');
|
19 |
+
$this->setSaveParametersInSession(true);
|
20 |
+
$this->setPagerVisibility(true);
|
21 |
+
$this->setTemplate('widget/grid.phtml');
|
22 |
+
$this->setRowClickCallback('openGridRow');
|
23 |
+
|
24 |
+
$this->_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::BACKGROUND);
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* store_ids setter
|
29 |
+
*
|
30 |
+
* @param array $store_ids
|
31 |
+
* @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
|
32 |
+
*/
|
33 |
+
public function setStoreIds()
|
34 |
+
{
|
35 |
+
if ($this->getRequest()->getParam('website')) {
|
36 |
+
$this->_store_ids = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
37 |
+
} else if ($this->getRequest()->getParam('group')) {
|
38 |
+
$this->_store_ids = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
39 |
+
} else if ($this->getRequest()->getParam('store')) {
|
40 |
+
$this->_store_ids = array((int)$this->getRequest()->getParam('store'));
|
41 |
+
} else {
|
42 |
+
$this->_store_ids = array();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function _prepareCollection()
|
47 |
+
{
|
48 |
+
$collection = Mage::getResourceModel('campaigner/background_task_collection');
|
49 |
+
|
50 |
+
$filter = $this->getParam($this->getVarNameFilter(), array());
|
51 |
+
|
52 |
+
if ($filter) {
|
53 |
+
$filter = base64_decode($filter);
|
54 |
+
parse_str(urldecode($filter), $data);
|
55 |
+
}
|
56 |
+
|
57 |
+
$this->setCollection($collection);
|
58 |
+
|
59 |
+
/*if (!empty($data)) {
|
60 |
+
$collection->prepareForAbandonedReport($this->_store_ids, $data);
|
61 |
+
} else {
|
62 |
+
$collection->prepareForAbandonedReport($this->_store_ids);
|
63 |
+
}*/
|
64 |
+
|
65 |
+
return parent::_prepareCollection();
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function _addColumnFilterToCollection($column)
|
69 |
+
{
|
70 |
+
$field = ($column->getFilterIndex()) ? $column->getFilterIndex() : $column->getIndex();
|
71 |
+
|
72 |
+
parent::_addColumnFilterToCollection($column);
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
private function getCustomerGroups($blank = false)
|
77 |
+
{
|
78 |
+
$options = array();
|
79 |
+
|
80 |
+
$groups = Mage::Helper('customer')->getGroups();
|
81 |
+
|
82 |
+
if ($blank) {
|
83 |
+
$options[""] = "";
|
84 |
+
}
|
85 |
+
|
86 |
+
foreach($groups as $group) {
|
87 |
+
$options[$group->getData('customer_group_id')] = Mage::helper('catalog')->__($group->getData('customer_group_code'));
|
88 |
+
}
|
89 |
+
|
90 |
+
$options[0] = Mage::helper('catalog')->__('NOT LOGGED IN');
|
91 |
+
|
92 |
+
return $options;
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function _prepareColumns()
|
96 |
+
{
|
97 |
+
$this->addColumn('email', array(
|
98 |
+
'header' => Mage::helper('campaigner')->__('Email'),
|
99 |
+
'index' => 'email'
|
100 |
+
));
|
101 |
+
|
102 |
+
$this->setStoreIds();
|
103 |
+
|
104 |
+
$currencyCode = $this->getCurrentCurrencyCode();
|
105 |
+
|
106 |
+
$this->addColumn('store_id', array(
|
107 |
+
'header' => Mage::helper('catalog')->__('Store'),
|
108 |
+
'index' => 'store_id',
|
109 |
+
'type' => 'store',
|
110 |
+
'store_view' => true,
|
111 |
+
'sortable' => false
|
112 |
+
));
|
113 |
+
|
114 |
+
$this->addColumn('created_at', array(
|
115 |
+
'header' => Mage::helper('campaigner')->__('Created At'),
|
116 |
+
'type' => 'datetime',
|
117 |
+
'index' => 'created_at',
|
118 |
+
|
119 |
+
));
|
120 |
+
|
121 |
+
$this->addColumn('code', array(
|
122 |
+
'header' => Mage::helper('campaigner')->__('Task'),
|
123 |
+
'index' => 'code'
|
124 |
+
));
|
125 |
+
|
126 |
+
$this->addColumn('date_sent', array(
|
127 |
+
'header' => Mage::helper('campaigner')->__('Date Sent to Campaigner'),
|
128 |
+
'index' => 'date_sent',
|
129 |
+
'type' => 'datetime'
|
130 |
+
));
|
131 |
+
|
132 |
+
$this->addColumn('status', array(
|
133 |
+
'header' => Mage::helper('campaigner')->__('Status'),
|
134 |
+
'index' => 'status'
|
135 |
+
));
|
136 |
+
|
137 |
+
if ($this->_status['enabled']) {
|
138 |
+
$this->addColumn('action',
|
139 |
+
array(
|
140 |
+
'header' => Mage::helper('campaigner')->__('Action'),
|
141 |
+
'width' => '50px',
|
142 |
+
'type' => 'action',
|
143 |
+
'getter' => 'getId',
|
144 |
+
'actions' => array(
|
145 |
+
array(
|
146 |
+
'caption' => Mage::helper('campaigner')->__('Send'),
|
147 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
148 |
+
'field' => 'id',
|
149 |
+
'sent' => false
|
150 |
+
),
|
151 |
+
array(
|
152 |
+
'caption' => Mage::helper('campaigner')->__('Resend'),
|
153 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
154 |
+
'field' => 'id',
|
155 |
+
'sent' => true
|
156 |
+
)
|
157 |
+
),
|
158 |
+
'filter' => false,
|
159 |
+
'sortable' => false,
|
160 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
161 |
+
'index' => 'stores',
|
162 |
+
'is_system' => true,
|
163 |
+
));
|
164 |
+
}
|
165 |
+
|
166 |
+
return parent::_prepareColumns();
|
167 |
+
}
|
168 |
+
|
169 |
+
protected function _prepareMassaction()
|
170 |
+
{
|
171 |
+
if (!$this->_status['enabled']) {
|
172 |
+
return $this;
|
173 |
+
}
|
174 |
+
|
175 |
+
$this->setMassactionIdField('post_id');
|
176 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
177 |
+
|
178 |
+
$this->getMassactionBlock()->addItem('send', array(
|
179 |
+
'label' => Mage::helper('campaigner')->__('Send or Resend'),
|
180 |
+
'url' => $this->getUrl('*/*/massSend', Mage::helper('campaigner')->getUrlParams())
|
181 |
+
));
|
182 |
+
|
183 |
+
return $this;
|
184 |
+
}
|
185 |
+
|
186 |
+
public function getGridUrl()
|
187 |
+
{
|
188 |
+
return $this->getUrl('*/*/grid', array('_current'=> true));
|
189 |
+
}
|
190 |
+
|
191 |
+
public function getRowUrl($row)
|
192 |
+
{
|
193 |
+
return $this->getUrl('*/*/details', array('id'=>$row->getId(),'store_id' => $row->getStoreId(), 'active_tab'=>'cart'));
|
194 |
+
}
|
195 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Status extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
public function getStatus()
|
6 |
+
{
|
7 |
+
return Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::BACKGROUND);
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Background_Task_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('background_task_details_tabs');
|
9 |
+
$this->setDestElementId('background_task_details');
|
10 |
+
$this->setTitle(Mage::helper('campaigner')->__('Background Task Details'));
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _beforeToHtml()
|
14 |
+
{
|
15 |
+
$this->_updateActiveTab();
|
16 |
+
return parent::_beforeToHtml();
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _updateActiveTab()
|
20 |
+
{
|
21 |
+
$tabId = $this->getRequest()->getParam('tab');
|
22 |
+
if ($tabId) {
|
23 |
+
$tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
|
24 |
+
if ($tabId) {
|
25 |
+
$this->setActiveTab($tabId);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Container extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
protected $_type = "";
|
6 |
+
protected $_label = "";
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
$this->_controller = "adminhtml_{$this->_type}";
|
11 |
+
$this->_blockGroup = 'campaigner';
|
12 |
+
|
13 |
+
$status = Mage::helper('campaigner/cron')->getStatus($this->_type);
|
14 |
+
|
15 |
+
if ($status['enabled']) {
|
16 |
+
|
17 |
+
$this->_headerText = "{$this->_label} - Cron Last Run: " . Mage::helper('campaigner/cron')->getCronLastRunHtml($this->_type);
|
18 |
+
|
19 |
+
$label = 'Run now on all stores';
|
20 |
+
|
21 |
+
if (Mage::app()->isSingleStoreMode() || $this->_type == 'products') {
|
22 |
+
$label = 'Run now';
|
23 |
+
}
|
24 |
+
|
25 |
+
$this->addButton('refresh', array(
|
26 |
+
'label' => Mage::helper('campaigner')->__('Refresh'),
|
27 |
+
'onclick' => "{$this->_type}GridJsObject.reload();return false;",
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->_addButton('run_now', array(
|
31 |
+
'label' => Mage::helper('campaigner')->__($label),
|
32 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/run') .'\')',
|
33 |
+
));
|
34 |
+
} else {
|
35 |
+
$this->_headerText = "{$this->_label} - <span class='ab_ng'>Disabled</span>";
|
36 |
+
}
|
37 |
+
|
38 |
+
$data = Mage::helper('campaigner/cron')->getCronLastRun($this->_type);
|
39 |
+
|
40 |
+
if ($data['class'] == 'ab_ng') {
|
41 |
+
$url = Mage::helper('campaigner')->getAdminUrl("adminhtml/campaigner_troubleshooting/index",array('active_tab' => 'trouble_cron'));
|
42 |
+
Mage::getSingleton('adminhtml/session')->addWarning("There appears to be a problem with your cron settings. Please make sure that cron is running so that {$this->_label} can be processed. Click <a href='{$url}'>here</a> for more information.");
|
43 |
+
}
|
44 |
+
|
45 |
+
parent::__construct();
|
46 |
+
$this->_removeButton('add');
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getStatusHtml()
|
50 |
+
{
|
51 |
+
return $this->getChildHtml("{$this->_type}_status");
|
52 |
+
}
|
53 |
+
|
54 |
+
private function getTypePath()
|
55 |
+
{
|
56 |
+
return str_replace('_','/',$this->_type);
|
57 |
+
}
|
58 |
+
|
59 |
+
protected function _prepareLayout()
|
60 |
+
{
|
61 |
+
if ($this->_type != 'products') {
|
62 |
+
$this->setChild("{$this->_type}_status",
|
63 |
+
$this->getLayout()->createBlock("campaigner/adminhtml_{$this->_type}_status")
|
64 |
+
->setTemplate("campaigner/cron/status.phtml")
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
return parent::_prepareLayout();
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getGridHtml()
|
72 |
+
{
|
73 |
+
return $this->getStatusHtml() . parent::getGridHtml();
|
74 |
+
}
|
75 |
+
}
|
@@ -1,63 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class Campaigner_Integration_Block_Adminhtml_Latest extends
|
4 |
{
|
5 |
public function __construct()
|
6 |
{
|
7 |
-
$this->
|
8 |
-
$this->
|
9 |
-
|
10 |
-
$status = Mage::helper('campaigner')->getLatestStatus();
|
11 |
-
|
12 |
-
if ($status['enabled']) {
|
13 |
-
$this->_headerText = "Latest Orders - Cron Last Run: " . Mage::helper('campaigner')->getLatestCronLastRunHtml();
|
14 |
-
|
15 |
-
$label = 'Run now on all stores';
|
16 |
-
|
17 |
-
if (Mage::app()->isSingleStoreMode()) {
|
18 |
-
$label = 'Run now';
|
19 |
-
}
|
20 |
-
|
21 |
-
$this->addButton('refresh', array(
|
22 |
-
'label' => Mage::helper('campaigner')->__('Refresh'),
|
23 |
-
'onclick' => 'latestGridJsObject.reload();return false;',
|
24 |
-
));
|
25 |
-
|
26 |
-
$this->_addButton('run_now', array(
|
27 |
-
'label' => Mage::helper('campaigner')->__($label),
|
28 |
-
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/run') .'\')',
|
29 |
-
));
|
30 |
-
} else {
|
31 |
-
$this->_headerText = "Latest Orders - <span class='ab_ng'>Disabled</span>";
|
32 |
-
}
|
33 |
-
|
34 |
-
$data = Mage::helper('campaigner')->getCronLastRun(0,'latest_cron_last_run');
|
35 |
-
|
36 |
-
if ($data['class'] == 'ab_ng') {
|
37 |
-
Mage::getSingleton('adminhtml/session')->addWarning("There appears to be a problem with your cron settings. Please make sure that cron is running so that Latest Orders can be processed.");
|
38 |
-
}
|
39 |
|
40 |
parent::__construct();
|
41 |
-
$this->_removeButton('add');
|
42 |
-
}
|
43 |
-
|
44 |
-
public function getStatusHtml()
|
45 |
-
{
|
46 |
-
return $this->getChildHtml('latest_status');
|
47 |
-
}
|
48 |
-
|
49 |
-
protected function _prepareLayout()
|
50 |
-
{
|
51 |
-
$this->setChild('latest_status',
|
52 |
-
$this->getLayout()->createBlock('campaigner/adminhtml_latest_status')
|
53 |
-
->setTemplate('campaigner/latest/status.phtml')
|
54 |
-
);
|
55 |
-
|
56 |
-
return parent::_prepareLayout();
|
57 |
-
}
|
58 |
-
|
59 |
-
public function getGridHtml()
|
60 |
-
{
|
61 |
-
return $this->getStatusHtml() . parent::getGridHtml();
|
62 |
}
|
63 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Latest extends Campaigner_Integration_Block_Adminhtml_Container
|
4 |
{
|
5 |
public function __construct()
|
6 |
{
|
7 |
+
$this->_type = Campaigner_Integration_Helper_Cron::LATEST_ORDERS;
|
8 |
+
$this->_label = 'Latest Orders';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
parent::__construct();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
12 |
}
|
@@ -26,7 +26,7 @@ class Campaigner_Integration_Block_Adminhtml_Latest_Grid extends Mage_Adminhtml_
|
|
26 |
$this->setTemplate('widget/grid.phtml');
|
27 |
$this->setRowClickCallback('openGridRow');
|
28 |
|
29 |
-
$this->_latest_status = Mage::helper('campaigner')->
|
30 |
}
|
31 |
|
32 |
/**
|
26 |
$this->setTemplate('widget/grid.phtml');
|
27 |
$this->setRowClickCallback('openGridRow');
|
28 |
|
29 |
+
$this->_latest_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::LATEST_ORDERS);
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
class Campaigner_Integration_Block_Adminhtml_Latest_Status extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
-
public function
|
6 |
{
|
7 |
-
return Mage::helper('campaigner')->
|
8 |
}
|
9 |
}
|
2 |
|
3 |
class Campaigner_Integration_Block_Adminhtml_Latest_Status extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
+
public function getStatus()
|
6 |
{
|
7 |
+
return Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::LATEST_ORDERS);
|
8 |
}
|
9 |
}
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Order_View_Tab_Diagnostics
|
4 |
+
extends Mage_Adminhtml_Block_Sales_Order_Abstract
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
public function getDiagnosticOptions()
|
9 |
+
{
|
10 |
+
$options = array(
|
11 |
+
//array('code' => 'order_custom_fields', 'label' => 'Custom Fields', 'description' => 'Get the custom fields'),
|
12 |
+
//array('code' => 'order_last_items', 'label' => 'Order Items', 'description' => 'Test of getting the order items to send'),
|
13 |
+
//array('code' => 'order_related_items', 'label' => 'Related Order Items', 'description' => 'Test of the Related Order Items'),
|
14 |
+
array('code' => 'order_full_request', 'label' => 'Full Order Request', 'description' => 'Diagnose the request that will be sent to campaigner for this Order.'),
|
15 |
+
|
16 |
+
);
|
17 |
+
|
18 |
+
$full_order = array(
|
19 |
+
'code' => 'order_full',
|
20 |
+
'label' => 'Full Order (Request and Response)',
|
21 |
+
'description' => 'Diagnose the request and response for this Order.',
|
22 |
+
'note' => 'This will send the order to Campaigner but it will not mark it as sent.'
|
23 |
+
);
|
24 |
+
|
25 |
+
if (!$this->isCampaignerEnabled() || !$this->isCampaignerSetup() || !$this->isSendOrdersEnabled()) {
|
26 |
+
$full_order['disabled'] = true;
|
27 |
+
$full_order['disabled_reason'] = 'Campaigner must be enabled (and setup to send orders) to perform this diagnostic.';
|
28 |
+
}
|
29 |
+
|
30 |
+
$options[] = $full_order;
|
31 |
+
return $options;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getItemId()
|
35 |
+
{
|
36 |
+
return $this->getOrder()->getId();
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getStoreId()
|
40 |
+
{
|
41 |
+
return $this->getOrder()->getStoreId();
|
42 |
+
}
|
43 |
+
|
44 |
+
public function iscampaignerEnabled()
|
45 |
+
{
|
46 |
+
return Mage::helper('campaigner')->config('active',$this->getOrderStore()) == 1;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function iscampaignerSetup()
|
50 |
+
{
|
51 |
+
return Mage::helper('campaigner')->config('setup',$this->getOrderStore()) == 1;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function isSendOrdersEnabled()
|
55 |
+
{
|
56 |
+
return Mage::helper('campaigner')->commerceConfig('enabled',$this->getOrderStore()) == 1;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getTabLabel()
|
60 |
+
{
|
61 |
+
return Mage::helper('campaigner')->__('Campaigner Diagnostics');
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getTabTitle()
|
65 |
+
{
|
66 |
+
return Mage::helper('campaigner')->__('Campaigner Diagnostics');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function canShowTab()
|
70 |
+
{
|
71 |
+
return Mage::helper('campaigner/troubleshooting')->isDiagnosticEnabled();
|
72 |
+
}
|
73 |
+
|
74 |
+
public function isHidden()
|
75 |
+
{
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function __construct()
|
80 |
+
{
|
81 |
+
parent::__construct();
|
82 |
+
//$this->setTemplate('campaigner/order/view/tab/diagnostics.phtml');
|
83 |
+
}
|
84 |
+
}
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Order_View_Tab_Diagnostics_Status extends Campaigner_Integration_Block_Adminhtml_Diagnostics_Status_Abstract
|
4 |
+
{
|
5 |
+
public function isSendOrdersEnabled()
|
6 |
+
{
|
7 |
+
return $this->_helper->commerceConfig('enabled',$this->_helper->getCurrentStore()) == 1;
|
8 |
+
}
|
9 |
+
|
10 |
+
public function canSendOrders()
|
11 |
+
{
|
12 |
+
if (!$this->isCampaignerEnabled() || !$this->isCampaignerSetup() || !$this->isSendOrdersEnabled()) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getCampaignerDate()
|
20 |
+
{
|
21 |
+
$camp_order = Mage::getModel('campaigner/order')->loadByOrderId($this->getOrder()->getId());
|
22 |
+
|
23 |
+
if ($camp_order != null && $camp_order->getDateSent() != null) {
|
24 |
+
return $camp_order->getDateSent();
|
25 |
+
}
|
26 |
+
|
27 |
+
return null;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getStateList()
|
31 |
+
{
|
32 |
+
$state_options = Mage::getSingleton("campaigner/system_config_source_states")->toOptionArray();
|
33 |
+
|
34 |
+
$set_states = Mage::helper('campaigner')->commerceConfig('send_states');
|
35 |
+
$state_list = explode(",",$set_states);
|
36 |
+
|
37 |
+
$display_list = array();
|
38 |
+
|
39 |
+
foreach ($state_options as $option) {
|
40 |
+
if (in_array($option['value'],$state_list)) {
|
41 |
+
$display_list[] = $option['label'];
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return $display_list;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getStatusList()
|
49 |
+
{
|
50 |
+
$sales_config = Mage::getSingleton('sales/order_config');
|
51 |
+
|
52 |
+
$statuses = $sales_config->getStatuses();
|
53 |
+
|
54 |
+
$set_statuses = Mage::helper('campaigner')->commerceConfig('send_statuses');
|
55 |
+
$status_list = explode(",",$set_statuses);
|
56 |
+
|
57 |
+
$display_list = array();
|
58 |
+
|
59 |
+
foreach ($statuses as $value => $label) {
|
60 |
+
if (in_array($value,$status_list))
|
61 |
+
$display_list[] = $label;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $display_list;
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getSendField()
|
68 |
+
{
|
69 |
+
return Mage::helper('campaigner')->commerceConfig('send_field');
|
70 |
+
}
|
71 |
+
|
72 |
+
public function getOrderState()
|
73 |
+
{
|
74 |
+
$order = $this->getOrder();
|
75 |
+
|
76 |
+
return $order->getConfig()->getStateLabel($order->getState());
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getOrder()
|
80 |
+
{
|
81 |
+
return Mage::registry('current_order');
|
82 |
+
}
|
83 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Orders extends Campaigner_Integration_Block_Adminhtml_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_type = Campaigner_Integration_Helper_Cron::ORDERS;
|
8 |
+
$this->_label = 'Orders';
|
9 |
+
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getStatusHtml()
|
14 |
+
{
|
15 |
+
return $this->getChildHtml("{$this->_type}_status") . $this->getChildHtml("orders_filter");
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _prepareLayout()
|
19 |
+
{
|
20 |
+
$this->setChild("orders_filter",
|
21 |
+
$this->getLayout()->createBlock("campaigner/adminhtml_orders_filter")
|
22 |
+
->setTemplate("campaigner/orders/filter.phtml")
|
23 |
+
);
|
24 |
+
|
25 |
+
return parent::_prepareLayout();
|
26 |
+
}
|
27 |
+
}
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Orders_Filter extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
public function getValidStates()
|
6 |
+
{
|
7 |
+
$mode = Mage::helper('campaigner')->commerceConfig('send_field');
|
8 |
+
|
9 |
+
$data = array(
|
10 |
+
'mode' => $mode,
|
11 |
+
);
|
12 |
+
|
13 |
+
if ($mode == 'state') {
|
14 |
+
$states = Mage::getSingleton('sales/order_config')->getStates();
|
15 |
+
$configured_states = Mage::helper('campaigner')->commerceConfig('send_states');
|
16 |
+
$valid_list = explode(",",$configured_states);
|
17 |
+
|
18 |
+
$data['display'] = "States";
|
19 |
+
} else {
|
20 |
+
$states = Mage::getSingleton('sales/order_config')->getStatuses();
|
21 |
+
$configured_statuses = Mage::helper('campaigner')->commerceConfig('send_statuses');
|
22 |
+
$valid_list = explode(",",$configured_statuses);
|
23 |
+
$data['display'] = "Statuses";
|
24 |
+
}
|
25 |
+
|
26 |
+
$valid = array();
|
27 |
+
|
28 |
+
foreach ($valid_list as $valid_state) {
|
29 |
+
$valid[] = $states[$valid_state];
|
30 |
+
}
|
31 |
+
|
32 |
+
$data['valid'] = $valid;
|
33 |
+
|
34 |
+
return $data;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function showAll()
|
38 |
+
{
|
39 |
+
if (Mage::app()->getRequest()->getParam('show_all') == 1) {
|
40 |
+
return true;
|
41 |
+
}
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
}
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* ids of current stores
|
8 |
+
*/
|
9 |
+
protected $_store_ids = array();
|
10 |
+
|
11 |
+
protected $_latest_status = null;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* stores current currency code
|
15 |
+
*/
|
16 |
+
protected $_currentCurrencyCode = null;
|
17 |
+
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
parent::__construct();
|
21 |
+
$this->setId('ordersGrid');
|
22 |
+
$this->setUseAjax(true);
|
23 |
+
$this->setDefaultSort('updated_at');
|
24 |
+
$this->setSaveParametersInSession(true);
|
25 |
+
$this->setPagerVisibility(true);
|
26 |
+
$this->setTemplate('widget/grid.phtml');
|
27 |
+
$this->setRowClickCallback('openGridRow');
|
28 |
+
|
29 |
+
$this->_latest_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::ORDERS);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve currency code based on selected store
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getCurrentCurrencyCode()
|
38 |
+
{
|
39 |
+
if (is_null($this->_currentCurrencyCode))
|
40 |
+
{
|
41 |
+
reset($this->_store_ids);
|
42 |
+
$this->_currentCurrencyCode = (count($this->_store_ids) > 0)
|
43 |
+
? Mage::app()->getStore(current($this->_store_ids))->getBaseCurrencyCode()
|
44 |
+
: Mage::app()->getStore()->getBaseCurrencyCode();
|
45 |
+
}
|
46 |
+
return $this->_currentCurrencyCode;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* store_ids setter
|
51 |
+
*
|
52 |
+
* @param array $store_ids
|
53 |
+
* @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
|
54 |
+
*/
|
55 |
+
public function setStoreIds()
|
56 |
+
{
|
57 |
+
if ($this->getRequest()->getParam('website')) {
|
58 |
+
$this->_store_ids = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
59 |
+
} else if ($this->getRequest()->getParam('group')) {
|
60 |
+
$this->_store_ids = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
61 |
+
} else if ($this->getRequest()->getParam('store')) {
|
62 |
+
$this->_store_ids = array((int)$this->getRequest()->getParam('store'));
|
63 |
+
} else {
|
64 |
+
$this->_store_ids = array();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function _prepareCollection()
|
69 |
+
{
|
70 |
+
$collection = Mage::getResourceModel('campaigner/order_collection');
|
71 |
+
|
72 |
+
$show_all = $this->getRequest()->getParam('show_all') == 1;
|
73 |
+
|
74 |
+
$filter = $this->getParam($this->getVarNameFilter(), array());
|
75 |
+
|
76 |
+
if ($filter) {
|
77 |
+
$filter = base64_decode($filter);
|
78 |
+
parse_str(urldecode($filter), $data);
|
79 |
+
}
|
80 |
+
|
81 |
+
$this->setCollection($collection);
|
82 |
+
|
83 |
+
if (!empty($data)) {
|
84 |
+
$collection->prepareForReport($this->_store_ids, $data, $show_all);
|
85 |
+
} else {
|
86 |
+
$collection->prepareForReport($this->_store_ids, null, $show_all);
|
87 |
+
}
|
88 |
+
|
89 |
+
return parent::_prepareCollection();
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function _addColumnFilterToCollection($column)
|
93 |
+
{
|
94 |
+
$field = ($column->getFilterIndex()) ? $column->getFilterIndex() : $column->getIndex();
|
95 |
+
|
96 |
+
parent::_addColumnFilterToCollection($column);
|
97 |
+
return $this;
|
98 |
+
}
|
99 |
+
|
100 |
+
private function getCustomerGroups($blank = false)
|
101 |
+
{
|
102 |
+
$options = array();
|
103 |
+
|
104 |
+
$groups = Mage::Helper('customer')->getGroups();
|
105 |
+
|
106 |
+
if ($blank) {
|
107 |
+
$options[""] = "";
|
108 |
+
}
|
109 |
+
|
110 |
+
foreach($groups as $group) {
|
111 |
+
$options[$group->getData('customer_group_id')] = Mage::helper('catalog')->__($group->getData('customer_group_code'));
|
112 |
+
}
|
113 |
+
|
114 |
+
$options[0] = Mage::helper('catalog')->__('NOT LOGGED IN');
|
115 |
+
|
116 |
+
return $options;
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _prepareColumns()
|
120 |
+
{
|
121 |
+
$this->addColumn('increment_id', array(
|
122 |
+
'header' => Mage::helper('campaigner')->__('Order #'),
|
123 |
+
'width' => '80px',
|
124 |
+
'index' => 'increment_id'
|
125 |
+
));
|
126 |
+
|
127 |
+
$this->addColumn('customer_firstname', array(
|
128 |
+
'header' => Mage::helper('campaigner')->__('First Name'),
|
129 |
+
'index' => 'customer_firstname'
|
130 |
+
));
|
131 |
+
|
132 |
+
$this->addColumn('customer_lastname', array(
|
133 |
+
'header' => Mage::helper('campaigner')->__('Last Name'),
|
134 |
+
'index' => 'customer_lastname'
|
135 |
+
));
|
136 |
+
|
137 |
+
$this->addColumn('email', array(
|
138 |
+
'header' => Mage::helper('campaigner')->__('Email'),
|
139 |
+
//'filter_index' => 'IF(main_table.customer_email IS NOT NULL, main_table.customer_email, email)',
|
140 |
+
'index' => 'customer_email'
|
141 |
+
));
|
142 |
+
|
143 |
+
$this->addColumn('customer_group_id', array(
|
144 |
+
'header' => Mage::helper('campaigner')->__('Customer Group'),
|
145 |
+
'index' => 'customer_group_id',
|
146 |
+
'type' => 'options',
|
147 |
+
'options' => $this->getCustomerGroups()
|
148 |
+
));
|
149 |
+
|
150 |
+
$mode = Mage::helper('campaigner')->commerceConfig('send_field');
|
151 |
+
|
152 |
+
if ($mode == 'state') {
|
153 |
+
$this->addColumn('state', array(
|
154 |
+
'header' => Mage::helper('campaigner')->__('State'),
|
155 |
+
'index' => 'state',
|
156 |
+
'type' => 'options',
|
157 |
+
'width' => '70px',
|
158 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Orders_State',
|
159 |
+
'options' => Mage::getSingleton('sales/order_config')->getStates(),
|
160 |
+
));
|
161 |
+
} else {
|
162 |
+
$this->addColumn('status', array(
|
163 |
+
'header' => Mage::helper('campaigner')->__('Status'),
|
164 |
+
'index' => 'status',
|
165 |
+
'type' => 'options',
|
166 |
+
'width' => '70px',
|
167 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Orders_State',
|
168 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
169 |
+
));
|
170 |
+
}
|
171 |
+
|
172 |
+
$this->addColumn('items_count', array(
|
173 |
+
'header' => Mage::helper('campaigner')->__('Number of Items'),
|
174 |
+
'align' => 'right',
|
175 |
+
'index' => 'total_item_count',
|
176 |
+
'type' => 'number'
|
177 |
+
));
|
178 |
+
|
179 |
+
$this->setStoreIds();
|
180 |
+
|
181 |
+
$currencyCode = $this->getCurrentCurrencyCode();
|
182 |
+
|
183 |
+
$this->addColumn('store_id', array(
|
184 |
+
'header' => Mage::helper('catalog')->__('Store'),
|
185 |
+
'index' => 'store_id',
|
186 |
+
'type' => 'store',
|
187 |
+
'filter_index' => 'main_table.store_id',
|
188 |
+
'store_view' => true,
|
189 |
+
'sortable' => false
|
190 |
+
));
|
191 |
+
|
192 |
+
$this->addColumn('subtotal', array(
|
193 |
+
'header' => Mage::helper('campaigner')->__('Subtotal'),
|
194 |
+
'width' => '80px',
|
195 |
+
'type' => 'currency',
|
196 |
+
'currency_code' => $currencyCode,
|
197 |
+
'index' => 'subtotal',
|
198 |
+
'renderer' => 'adminhtml/report_grid_column_renderer_currency',
|
199 |
+
'rate' => $this->getRate($currencyCode),
|
200 |
+
));
|
201 |
+
|
202 |
+
$this->addColumn('updated_at', array(
|
203 |
+
'header' => Mage::helper('campaigner')->__('Date'),
|
204 |
+
'type' => 'datetime',
|
205 |
+
'index' => 'updated_at',
|
206 |
+
'filter_index' => 'main_table.updated_at'
|
207 |
+
));
|
208 |
+
|
209 |
+
$this->addColumn('date_sent', array(
|
210 |
+
'header' => Mage::helper('campaigner')->__('Date Sent to Campaigner'),
|
211 |
+
'index' => 'date_sent',
|
212 |
+
'type' => 'datetime'
|
213 |
+
));
|
214 |
+
|
215 |
+
if ($this->_latest_status['enabled']) {
|
216 |
+
$this->addColumn('action',
|
217 |
+
array(
|
218 |
+
'header' => Mage::helper('campaigner')->__('Action'),
|
219 |
+
'width' => '50px',
|
220 |
+
'type' => 'action',
|
221 |
+
'getter' => 'getId',
|
222 |
+
'actions' => array(
|
223 |
+
array(
|
224 |
+
'caption' => Mage::helper('campaigner')->__('Send'),
|
225 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
226 |
+
'field' => 'id',
|
227 |
+
'sent' => false
|
228 |
+
),
|
229 |
+
array(
|
230 |
+
'caption' => Mage::helper('campaigner')->__('Resend'),
|
231 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
232 |
+
'field' => 'id',
|
233 |
+
'sent' => true
|
234 |
+
)
|
235 |
+
),
|
236 |
+
'filter' => false,
|
237 |
+
'sortable' => false,
|
238 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
239 |
+
'index' => 'stores',
|
240 |
+
'is_system' => true,
|
241 |
+
));
|
242 |
+
}
|
243 |
+
|
244 |
+
return parent::_prepareColumns();
|
245 |
+
}
|
246 |
+
|
247 |
+
protected function _prepareMassaction()
|
248 |
+
{
|
249 |
+
if (!$this->_latest_status['enabled']) {
|
250 |
+
return $this;
|
251 |
+
}
|
252 |
+
|
253 |
+
$this->setMassactionIdField('post_id');
|
254 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
255 |
+
|
256 |
+
$this->getMassactionBlock()->addItem('send', array(
|
257 |
+
'label' => Mage::helper('campaigner')->__('Send or Resend'),
|
258 |
+
'url' => $this->getUrl('*/*/massSend', Mage::helper('campaigner')->getUrlParams())
|
259 |
+
));
|
260 |
+
|
261 |
+
return $this;
|
262 |
+
}
|
263 |
+
|
264 |
+
public function getGridUrl()
|
265 |
+
{
|
266 |
+
return $this->getUrl('*/*/grid', array('_current'=> true));
|
267 |
+
}
|
268 |
+
|
269 |
+
public function getRowUrl($row)
|
270 |
+
{
|
271 |
+
return $this->getUrl('*/sales_order/view', array('order_id'=>$row->getId(),'store_id' => $row->getStoreId(), 'active_tab'=>'cart'));
|
272 |
+
}
|
273 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Orders_Status extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
public function getStatus()
|
6 |
+
{
|
7 |
+
return Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::ORDERS);
|
8 |
+
}
|
9 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_products extends Campaigner_Integration_Block_Adminhtml_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_type = Campaigner_Integration_Helper_Cron::PRODUCTS;
|
8 |
+
$this->_label = 'Products';
|
9 |
+
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Products_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* ids of current stores
|
8 |
+
*/
|
9 |
+
protected $_store_ids = array();
|
10 |
+
|
11 |
+
protected $_latest_status = null;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* stores current currency code
|
15 |
+
*/
|
16 |
+
protected $_currentCurrencyCode = null;
|
17 |
+
|
18 |
+
public function __construct()
|
19 |
+
{
|
20 |
+
parent::__construct();
|
21 |
+
$this->setId('productsGrid');
|
22 |
+
$this->setUseAjax(true);
|
23 |
+
$this->setDefaultSort('updated_at');
|
24 |
+
$this->setSaveParametersInSession(true);
|
25 |
+
$this->setPagerVisibility(true);
|
26 |
+
$this->setTemplate('widget/grid.phtml');
|
27 |
+
$this->setRowClickCallback('openGridRow');
|
28 |
+
|
29 |
+
$this->_latest_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::PRODUCTS);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Retrieve currency code based on selected store
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function getCurrentCurrencyCode()
|
38 |
+
{
|
39 |
+
if (is_null($this->_currentCurrencyCode))
|
40 |
+
{
|
41 |
+
reset($this->_store_ids);
|
42 |
+
$this->_currentCurrencyCode = (count($this->_store_ids) > 0)
|
43 |
+
? Mage::app()->getStore(current($this->_store_ids))->getBaseCurrencyCode()
|
44 |
+
: Mage::app()->getStore()->getBaseCurrencyCode();
|
45 |
+
}
|
46 |
+
return $this->_currentCurrencyCode;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* store_ids setter
|
51 |
+
*
|
52 |
+
* @param array $store_ids
|
53 |
+
* @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
|
54 |
+
*/
|
55 |
+
public function setStoreIds()
|
56 |
+
{
|
57 |
+
if ($this->getRequest()->getParam('website')) {
|
58 |
+
$this->_store_ids = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
|
59 |
+
} else if ($this->getRequest()->getParam('group')) {
|
60 |
+
$this->_store_ids = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
|
61 |
+
} else if ($this->getRequest()->getParam('store')) {
|
62 |
+
$this->_store_ids = array((int)$this->getRequest()->getParam('store'));
|
63 |
+
} else {
|
64 |
+
$this->_store_ids = array();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function _prepareCollection()
|
69 |
+
{
|
70 |
+
$collection = Mage::getResourceModel('campaigner/product_category_action_collection')->prepareForGrid();
|
71 |
+
|
72 |
+
$filter = $this->getParam($this->getVarNameFilter(), array());
|
73 |
+
|
74 |
+
if ($filter) {
|
75 |
+
$filter = base64_decode($filter);
|
76 |
+
parse_str(urldecode($filter), $data);
|
77 |
+
}
|
78 |
+
|
79 |
+
$this->setCollection($collection);
|
80 |
+
|
81 |
+
return parent::_prepareCollection();
|
82 |
+
}
|
83 |
+
|
84 |
+
protected function _addColumnFilterToCollection($column)
|
85 |
+
{
|
86 |
+
$field = ($column->getFilterIndex()) ? $column->getFilterIndex() : $column->getIndex();
|
87 |
+
|
88 |
+
parent::_addColumnFilterToCollection($column);
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
private function getTypeOptions()
|
93 |
+
{
|
94 |
+
$options = array("product" => 'Product', 'category' => 'Category');
|
95 |
+
|
96 |
+
return $options;
|
97 |
+
}
|
98 |
+
|
99 |
+
private function getOperationOptions()
|
100 |
+
{
|
101 |
+
$options = array("new" => 'New', 'update' => 'Update', 'moved' => 'Moved');
|
102 |
+
|
103 |
+
return $options;
|
104 |
+
}
|
105 |
+
|
106 |
+
protected function _prepareColumns()
|
107 |
+
{
|
108 |
+
$this->addColumn('name', array(
|
109 |
+
'header' => Mage::helper('campaigner')->__('Name'),
|
110 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Products_Name',
|
111 |
+
'filter' => false,
|
112 |
+
'sortable' => false,
|
113 |
+
'index' => 'name'
|
114 |
+
));
|
115 |
+
|
116 |
+
$this->addColumn('sku', array(
|
117 |
+
'header' => Mage::helper('campaigner')->__('Product Sku'),
|
118 |
+
'filter' => false,
|
119 |
+
'sortable' => false,
|
120 |
+
'index' => 'sku'
|
121 |
+
));
|
122 |
+
|
123 |
+
$this->addColumn('type', array(
|
124 |
+
'header' => Mage::helper('campaigner')->__('Type'),
|
125 |
+
'index' => 'type',
|
126 |
+
'type' => 'options',
|
127 |
+
'options' => $this->getTypeOptions()
|
128 |
+
));
|
129 |
+
|
130 |
+
$this->addColumn('operation', array(
|
131 |
+
'header' => Mage::helper('campaigner')->__('Operation'),
|
132 |
+
'index' => 'action',
|
133 |
+
'type' => 'options',
|
134 |
+
'options' => $this->getOperationOptions()
|
135 |
+
));
|
136 |
+
|
137 |
+
$this->addColumn('status', array(
|
138 |
+
'header' => Mage::helper('campaigner')->__('Status'),
|
139 |
+
'index' => 'status',
|
140 |
+
));
|
141 |
+
|
142 |
+
$this->setStoreIds();
|
143 |
+
|
144 |
+
$currencyCode = $this->getCurrentCurrencyCode();
|
145 |
+
|
146 |
+
$this->addColumn('date_sent', array(
|
147 |
+
'header' => Mage::helper('campaigner')->__('Date Sent to Campaigner'),
|
148 |
+
'index' => 'date_sent',
|
149 |
+
'type' => 'datetime'
|
150 |
+
));
|
151 |
+
|
152 |
+
if ($this->_latest_status['enabled']) {
|
153 |
+
$this->addColumn('action',
|
154 |
+
array(
|
155 |
+
'header' => Mage::helper('campaigner')->__('Action'),
|
156 |
+
'width' => '50px',
|
157 |
+
'type' => 'action',
|
158 |
+
'getter' => 'getId',
|
159 |
+
'actions' => array(
|
160 |
+
array(
|
161 |
+
'caption' => Mage::helper('campaigner')->__('Send'),
|
162 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
163 |
+
'field' => 'id',
|
164 |
+
'sent' => false
|
165 |
+
),
|
166 |
+
array(
|
167 |
+
'caption' => Mage::helper('campaigner')->__('Resend'),
|
168 |
+
'url' => array('base'=> '*/*/send', 'params' => Mage::helper('campaigner')->getUrlParams()),
|
169 |
+
'field' => 'id',
|
170 |
+
'sent' => true
|
171 |
+
)
|
172 |
+
),
|
173 |
+
'filter' => false,
|
174 |
+
'sortable' => false,
|
175 |
+
'renderer' => 'Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Action',
|
176 |
+
'index' => 'stores',
|
177 |
+
'is_system' => true,
|
178 |
+
));
|
179 |
+
}
|
180 |
+
|
181 |
+
return parent::_prepareColumns();
|
182 |
+
}
|
183 |
+
|
184 |
+
protected function _prepareMassaction()
|
185 |
+
{
|
186 |
+
if (!$this->_latest_status['enabled']) {
|
187 |
+
return $this;
|
188 |
+
}
|
189 |
+
|
190 |
+
$this->setMassactionIdField('post_id');
|
191 |
+
$this->getMassactionBlock()->setFormFieldName('id');
|
192 |
+
|
193 |
+
$this->getMassactionBlock()->addItem('send', array(
|
194 |
+
'label' => Mage::helper('campaigner')->__('Send or Resend'),
|
195 |
+
'url' => $this->getUrl('*/*/massSend', Mage::helper('campaigner')->getUrlParams())
|
196 |
+
));
|
197 |
+
|
198 |
+
return $this;
|
199 |
+
}
|
200 |
+
|
201 |
+
public function getGridUrl()
|
202 |
+
{
|
203 |
+
return $this->getUrl('*/*/grid', array('_current'=> true));
|
204 |
+
}
|
205 |
+
|
206 |
+
public function getRowUrl($row)
|
207 |
+
{
|
208 |
+
return null;
|
209 |
+
}
|
210 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Products_Status extends Mage_Adminhtml_Block_Template
|
4 |
+
{
|
5 |
+
public function getStatus()
|
6 |
+
{
|
7 |
+
return Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::PRODUCTS);
|
8 |
+
}
|
9 |
+
}
|
@@ -22,11 +22,6 @@ class Campaigner_Integration_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
22 |
return (string) Mage::getConfig()->getNode('modules/Campaigner_Integration/version');
|
23 |
}
|
24 |
|
25 |
-
public function getAbandonedLastRunHtml()
|
26 |
-
{
|
27 |
-
return Mage::helper('campaigner')->getAbandonedLastRunHtml();
|
28 |
-
}
|
29 |
-
|
30 |
public function getAbandonedEnabled()
|
31 |
{
|
32 |
return Mage::helper('campaigner')->getAbandonedEnabled();
|
22 |
return (string) Mage::getConfig()->getNode('modules/Campaigner_Integration/version');
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
public function getAbandonedEnabled()
|
26 |
{
|
27 |
return Mage::helper('campaigner')->getAbandonedEnabled();
|
@@ -20,11 +20,16 @@ class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Api extend
|
|
20 |
|
21 |
public function isValid()
|
22 |
{
|
23 |
-
return
|
24 |
}
|
25 |
|
26 |
-
public function
|
27 |
{
|
28 |
-
return $this->_helper->
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
}
|
20 |
|
21 |
public function isValid()
|
22 |
{
|
23 |
+
return $this->_helper->config('setup') == 1;
|
24 |
}
|
25 |
|
26 |
+
public function getCurrentApiUsername()
|
27 |
{
|
28 |
+
return $this->_helper->getApiUsername();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getCurrentApiPassword()
|
32 |
+
{
|
33 |
+
return $this->_helper->getApiPassword();
|
34 |
}
|
35 |
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Commerce_Api extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
private $_helper = null;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->setTemplate('campaigner/system/config/form/field/commerce/api.phtml');
|
11 |
+
$this->_helper = Mage::helper('campaigner');
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$this->setElement($element);
|
17 |
+
$html = $this->_toHtml();
|
18 |
+
return $html;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function isValid()
|
22 |
+
{
|
23 |
+
return $this->_helper->commerceConfig('setup') == 1;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getCurrentApikey()
|
27 |
+
{
|
28 |
+
return $this->_helper->getApikey();
|
29 |
+
}
|
30 |
+
}
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Commerce_Note extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
private $_helper = null;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->setTemplate('campaigner/system/config/form/field/note.phtml');
|
11 |
+
$this->_helper = Mage::helper('campaigner');
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
15 |
+
{
|
16 |
+
$this->setElement($element);
|
17 |
+
$html = $this->_toHtml();
|
18 |
+
return $html;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getMode()
|
22 |
+
{
|
23 |
+
return 'key';
|
24 |
+
}
|
25 |
+
}
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Cron_Url_Info extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
private $_helper = null;
|
6 |
+
private $_logger = null;
|
7 |
+
private $_status = null;
|
8 |
+
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this->setTemplate('campaigner/system/config/form/field/cron/url/info.phtml');
|
13 |
+
$this->_helper = Mage::helper('campaigner');
|
14 |
+
$this->_logger = Mage::helper('campaigner/troubleshooting');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
$this->setElement($element);
|
20 |
+
$useContainerId = $element->getData('use_container_id');
|
21 |
+
return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5">%s</td></tr>',
|
22 |
+
$element->getHtmlId(), $this->_toHtml()
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
27 |
+
{
|
28 |
+
$this->setElement($element);
|
29 |
+
$html = $this->_toHtml();
|
30 |
+
return $html;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getCronPassword()
|
34 |
+
{
|
35 |
+
return $this->_helper->config('cron_url_password');
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getCronUrl($process = null, $password = null)
|
39 |
+
{
|
40 |
+
$params = array();
|
41 |
+
|
42 |
+
if ($process != null) {
|
43 |
+
$params['process'] = $process;
|
44 |
+
}
|
45 |
+
|
46 |
+
if ($password != null) {
|
47 |
+
$params['password'] = $password;
|
48 |
+
}
|
49 |
+
|
50 |
+
return Mage::getUrl('campaigner/cron/run', $params);
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getProcessOptions()
|
54 |
+
{
|
55 |
+
$password = $this->getCronPassword();
|
56 |
+
|
57 |
+
$options = array(
|
58 |
+
array('label' => "Abandoned Carts", 'param' => 'abandoned'),
|
59 |
+
array('label' => "Latest Orders", 'param' => 'latest_orders'),
|
60 |
+
array('label' => "Background Tasks", 'param' => 'background_tasks'),
|
61 |
+
array('label' => "Orders", 'param' => 'orders'),
|
62 |
+
array('label' => "Products and Categories", 'param' => 'products'),
|
63 |
+
);
|
64 |
+
|
65 |
+
foreach ($options as &$option) {
|
66 |
+
$option['url'] = $this->getCronUrl($option['param'],$password);
|
67 |
+
}
|
68 |
+
|
69 |
+
return $options;
|
70 |
+
|
71 |
+
}
|
72 |
+
}
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_EmailDirect
|
4 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
5 |
+
{
|
6 |
+
private $_helper = null;
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
$this->setTemplate('campaigner/system/config/form/field/emaildirect.phtml');
|
12 |
+
$this->_helper = Mage::helper('campaigner');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
16 |
+
{
|
17 |
+
if (!$this->_helper->isEmailDirectInstalled()) {
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
|
21 |
+
return parent::render($element);
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
25 |
+
{
|
26 |
+
$this->setElement($element);
|
27 |
+
$html = $this->_toHtml();
|
28 |
+
return $html;
|
29 |
+
}
|
30 |
+
}
|
@@ -17,4 +17,9 @@ class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Note exten
|
|
17 |
$html = $this->_toHtml();
|
18 |
return $html;
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
17 |
$html = $this->_toHtml();
|
18 |
return $html;
|
19 |
}
|
20 |
+
|
21 |
+
public function getMode()
|
22 |
+
{
|
23 |
+
return 'user';
|
24 |
+
}
|
25 |
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Customers extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('campaigner/system/config/form/field/sync/customers.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
$this->setElement($element);
|
14 |
+
$html = $this->_toHtml();
|
15 |
+
return $html;
|
16 |
+
}
|
17 |
+
}
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Customers_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('campaigner/system/config/form/field/sync/customers/button.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getCustomersCount()
|
12 |
+
{
|
13 |
+
try
|
14 |
+
{
|
15 |
+
$helper = Mage::helper('campaigner/sync');
|
16 |
+
$store = Mage::helper('campaigner')->getAdminStore();
|
17 |
+
|
18 |
+
$from = $helper->getDefaultFromDate();
|
19 |
+
$to = $helper->getDefaultToDate();
|
20 |
+
$include = $helper->getDefaultInclude("customers");
|
21 |
+
|
22 |
+
$customers = $helper->getCustomerCollection($from, $to, $include, $store);
|
23 |
+
|
24 |
+
return $customers->getSize();
|
25 |
+
}
|
26 |
+
catch (Exception $e)
|
27 |
+
{
|
28 |
+
Mage::logException($e);
|
29 |
+
return "Unknown";
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
34 |
+
{
|
35 |
+
$this->setElement($element);
|
36 |
+
$html = $this->_toHtml();
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Customers_Range extends Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Range
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_key = "customers";
|
8 |
+
parent::__construct();
|
9 |
+
|
10 |
+
}
|
11 |
+
}
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Orders_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('campaigner/system/config/form/field/sync/orders/button.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getOrdersCount()
|
12 |
+
{
|
13 |
+
try
|
14 |
+
{
|
15 |
+
$helper = Mage::helper('campaigner/sync');
|
16 |
+
$store = Mage::helper('campaigner')->getAdminStore();
|
17 |
+
|
18 |
+
$from = $helper->getDefaultFromDate();
|
19 |
+
$to = $helper->getDefaultToDate();
|
20 |
+
$include = $helper->getDefaultInclude("orders");
|
21 |
+
|
22 |
+
$orders = $helper->getOrderCollection($from, $to, $include, $store);
|
23 |
+
|
24 |
+
return $orders->getSize();
|
25 |
+
}
|
26 |
+
catch (Exception $e)
|
27 |
+
{
|
28 |
+
Mage::logException($e);
|
29 |
+
return "Unknown";
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
34 |
+
{
|
35 |
+
$this->setElement($element);
|
36 |
+
$html = $this->_toHtml();
|
37 |
+
return $html;
|
38 |
+
}
|
39 |
+
}
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Orders_Range extends Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Range
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_key = "orders";
|
8 |
+
parent::__construct();
|
9 |
+
|
10 |
+
}
|
11 |
+
}
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Products_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('campaigner/system/config/form/field/sync/products/button.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
12 |
+
{
|
13 |
+
$this->setElement($element);
|
14 |
+
$html = $this->_toHtml();
|
15 |
+
return $html;
|
16 |
+
}
|
17 |
+
}
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Config_Form_Field_Sync_Range extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected $_key = null;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->setTemplate('campaigner/system/config/form/field/sync/date_range.phtml');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getKey()
|
14 |
+
{
|
15 |
+
return $this->_key;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getFromDate()
|
19 |
+
{
|
20 |
+
return Mage::helper('campaigner/sync')->getDefaultFromDate();
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getToDate()
|
24 |
+
{
|
25 |
+
return Mage::helper('campaigner/sync')->getDefaultToDate();
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
29 |
+
{
|
30 |
+
$this->setElement($element);
|
31 |
+
$html = $this->_toHtml();
|
32 |
+
return $html;
|
33 |
+
}
|
34 |
+
}
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync extends Mage_Adminhtml_Block_Abstract
|
4 |
+
{
|
5 |
+
protected $_record_name = "record";
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->_init();
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function getCollection()
|
14 |
+
{
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _init()
|
19 |
+
{
|
20 |
+
$collection = $this->getCollection();
|
21 |
+
$importData = array_map('intval',$collection->getAllIds());
|
22 |
+
$this->setBatchItemsCount(count($importData));
|
23 |
+
|
24 |
+
$this->setBatchConfig(
|
25 |
+
array(
|
26 |
+
'styles' => array(
|
27 |
+
'error' => array(
|
28 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/error_msg_icon.gif'),
|
29 |
+
'bg' => '#FDD'
|
30 |
+
),
|
31 |
+
'message' => array(
|
32 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/fam_bullet_success.gif'),
|
33 |
+
'bg' => '#DDF'
|
34 |
+
),
|
35 |
+
'loader' => Mage::getDesign()->getSkinUrl('images/ajax-loader.gif')
|
36 |
+
),
|
37 |
+
'template' => '<li style="#{style}" id="#{id}">'
|
38 |
+
. '<img id="#{id}_img" src="#{image}" class="v-middle" style="margin-right:5px"/>'
|
39 |
+
. '<span id="#{id}_status" class="text">#{text}</span>'
|
40 |
+
. '</li>',
|
41 |
+
'text' => $this->__('Processed <strong>%s%% %s/%d</strong> ' . $this->_record_name . 's', '#{percent}', '#{updated}', $this->getBatchItemsCount()),
|
42 |
+
'successText' => $this->__('Synced <strong>%s</strong> ' . $this->_record_name . 's', '#{updated}')
|
43 |
+
)
|
44 |
+
);
|
45 |
+
|
46 |
+
$this->setImportData($importData);
|
47 |
+
|
48 |
+
$this->setUploadStatus('true');
|
49 |
+
|
50 |
+
$this->setBatchSize(Mage::helper('campaigner')->syncConfig('batch'));
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getBatchConfigJson()
|
54 |
+
{
|
55 |
+
return Mage::helper('core')->jsonEncode(
|
56 |
+
$this->getBatchConfig()
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
public function jsonEncode($source)
|
61 |
+
{
|
62 |
+
return Mage::helper('core')->jsonEncode($source);
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getFormKey()
|
66 |
+
{
|
67 |
+
return Mage::getSingleton('core/session')->getFormKey();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getStore()
|
71 |
+
{
|
72 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
73 |
+
if ($store) {
|
74 |
+
return $store;
|
75 |
+
}
|
76 |
+
|
77 |
+
return 0;
|
78 |
+
}
|
79 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync_Customers extends Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_record_name = "customer";
|
8 |
+
parent::__construct();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getSyncType()
|
12 |
+
{
|
13 |
+
return "customer";
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCollection()
|
17 |
+
{
|
18 |
+
$from = Mage::app()->getRequest()->getParam('sync_from');
|
19 |
+
$to = Mage::app()->getRequest()->getParam('sync_to');
|
20 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
21 |
+
$include = Mage::app()->getRequest()->getParam('include');
|
22 |
+
|
23 |
+
$customers = Mage::helper('campaigner/sync')->getCustomerCollection($from, $to, $include, $store);
|
24 |
+
|
25 |
+
return $customers;
|
26 |
+
}
|
27 |
+
}
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync_Orders extends Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_record_name = "order";
|
8 |
+
parent::__construct();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getSyncType()
|
12 |
+
{
|
13 |
+
return "order";
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCollection()
|
17 |
+
{
|
18 |
+
$from = Mage::app()->getRequest()->getParam('sync_from');
|
19 |
+
$to = Mage::app()->getRequest()->getParam('sync_to');
|
20 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
21 |
+
$include = Mage::app()->getRequest()->getParam('include');
|
22 |
+
|
23 |
+
$orders = Mage::helper('campaigner/sync')->getOrderCollection($from, $to, $include, $store);
|
24 |
+
|
25 |
+
return $orders;
|
26 |
+
}
|
27 |
+
}
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_System_Convert_Profile_Sync_Products extends Mage_Adminhtml_Block_Abstract
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->_init();
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getSyncType()
|
12 |
+
{
|
13 |
+
return "product";
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getCategoryCollection()
|
17 |
+
{
|
18 |
+
$collection = Mage::getResourceModel('catalog/category_collection')
|
19 |
+
->setOrder('level', 'ASC')
|
20 |
+
->setOrder('position', 'ASC')
|
21 |
+
->addFieldToFilter('level', array('gt' => 0));
|
22 |
+
|
23 |
+
return $collection;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getProductCollection()
|
27 |
+
{
|
28 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
29 |
+
$include = Mage::app()->getRequest()->getParam('include');
|
30 |
+
|
31 |
+
$products = Mage::helper('campaigner/sync')->getProductCollection($include, $store);
|
32 |
+
|
33 |
+
return $products;
|
34 |
+
}
|
35 |
+
|
36 |
+
private function setBatchConfig($collection, $type, $plural)
|
37 |
+
{
|
38 |
+
$importData = array();
|
39 |
+
|
40 |
+
if ($type == 'category') {
|
41 |
+
// GetAllIds removes the sorting of our collection which is bad since
|
42 |
+
// we want to process the categories by level (not as critical now
|
43 |
+
// that we changed the sync, but still more efficient).
|
44 |
+
foreach ($collection as $row) {
|
45 |
+
$importData[] = (int)$row->getId();
|
46 |
+
}
|
47 |
+
} else {
|
48 |
+
$importData = array_map('intval',$collection->getAllIds());
|
49 |
+
}
|
50 |
+
|
51 |
+
$count = count($importData);
|
52 |
+
|
53 |
+
$this->setData("batch_items_count_{$type}",$count);
|
54 |
+
|
55 |
+
$batch_data = array(
|
56 |
+
'styles' => array(
|
57 |
+
'error' => array(
|
58 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/error_msg_icon.gif'),
|
59 |
+
'bg' => '#FDD'
|
60 |
+
),
|
61 |
+
'message' => array(
|
62 |
+
'icon' => Mage::getDesign()->getSkinUrl('images/fam_bullet_success.gif'),
|
63 |
+
'bg' => '#DDF'
|
64 |
+
),
|
65 |
+
'loader' => Mage::getDesign()->getSkinUrl('images/ajax-loader.gif')
|
66 |
+
),
|
67 |
+
'template' => '<li style="#{style}" id="#{id}_' . $type . '">'
|
68 |
+
. '<img id="#{id}_' . $type . '_img" src="#{image}" class="v-middle" style="margin-right:5px"/>'
|
69 |
+
. '<span id="#{id}_' . $type . '_status" class="text">#{text}</span>'
|
70 |
+
. '</li>',
|
71 |
+
'text' => $this->__('Processed <strong>%s%% %s/%d</strong> ' . $plural, '#{percent}', '#{updated}', $count),
|
72 |
+
'successText' => $this->__('Synced <strong>%s</strong> ' . $plural, '#{updated}')
|
73 |
+
);
|
74 |
+
|
75 |
+
$this->setData("batch_config_{$type}",$batch_data);
|
76 |
+
$this->setData("import_data_{$type}",$importData);
|
77 |
+
}
|
78 |
+
|
79 |
+
protected function _init()
|
80 |
+
{
|
81 |
+
$categories = $this->getCategoryCollection();
|
82 |
+
$products = $this->getProductCollection();
|
83 |
+
|
84 |
+
$this->setBatchConfig($categories, "category", "categories");
|
85 |
+
$this->setBatchConfig($products, "product", "products");
|
86 |
+
|
87 |
+
$this->setBatchSize(Mage::helper('campaigner')->syncConfig('product_batch'));
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getBatchConfig($type)
|
91 |
+
{
|
92 |
+
return $this->getData("batch_config_{$type}");
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getImportData($type)
|
96 |
+
{
|
97 |
+
return $this->getData("import_data_{$type}");
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getBatchItemsCount($type)
|
101 |
+
{
|
102 |
+
return $this->getData("batch_items_count_{$type}");
|
103 |
+
}
|
104 |
+
|
105 |
+
public function getBatchConfigJson($type)
|
106 |
+
{
|
107 |
+
return Mage::helper('core')->jsonEncode(
|
108 |
+
$this->getBatchConfig($type)
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
+
public function jsonEncode($source)
|
113 |
+
{
|
114 |
+
return Mage::helper('core')->jsonEncode($source);
|
115 |
+
}
|
116 |
+
|
117 |
+
public function getFormKey()
|
118 |
+
{
|
119 |
+
return Mage::getSingleton('core/session')->getFormKey();
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getStore()
|
123 |
+
{
|
124 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
125 |
+
if ($store) {
|
126 |
+
return $store;
|
127 |
+
}
|
128 |
+
|
129 |
+
return 0;
|
130 |
+
}
|
131 |
+
}
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Cron
|
4 |
+
extends Mage_Adminhtml_Block_Template
|
5 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
6 |
+
{
|
7 |
+
|
8 |
+
protected $_status_types = array();
|
9 |
+
protected $_helper = null;
|
10 |
+
protected $_mode = "standard";
|
11 |
+
|
12 |
+
public function setMode($mode)
|
13 |
+
{
|
14 |
+
$this->_mode = $mode;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getMode()
|
18 |
+
{
|
19 |
+
return $this->_mode;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getTabLabel()
|
23 |
+
{
|
24 |
+
return Mage::helper('campaigner')->__('Cron');
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getTabTitle()
|
28 |
+
{
|
29 |
+
return Mage::helper('campaigner')->__('Cron');
|
30 |
+
}
|
31 |
+
|
32 |
+
public function canShowTab()
|
33 |
+
{
|
34 |
+
return true;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function isHidden()
|
38 |
+
{
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getScheduleRowLimit()
|
43 |
+
{
|
44 |
+
return Mage::helper('campaigner')->config('schedule_row_limit');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function __construct()
|
48 |
+
{
|
49 |
+
$this->_helper = Mage::helper('campaigner/cron');
|
50 |
+
$this->_status_types = array(
|
51 |
+
Campaigner_Integration_Helper_Cron::ABANDONED => 'Abandoned Carts',
|
52 |
+
Campaigner_Integration_Helper_Cron::LATEST_ORDERS => 'Latest Orders',
|
53 |
+
Campaigner_Integration_Helper_Cron::BACKGROUND => 'Background Tasks',
|
54 |
+
Campaigner_Integration_Helper_Cron::ORDERS => 'Orders',
|
55 |
+
Campaigner_Integration_Helper_Cron::PRODUCTS => 'Products and Categories',
|
56 |
+
);
|
57 |
+
|
58 |
+
parent::__construct();
|
59 |
+
$this->setTemplate('campaigner/troubleshooting/view/tab/cron.phtml');
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getCronStatus()
|
63 |
+
{
|
64 |
+
/*
|
65 |
+
* Abandoned Cron last run
|
66 |
+
* Latest Cron last run
|
67 |
+
* Background Cron last run
|
68 |
+
*
|
69 |
+
* Look at schedule table for entries for the above as well
|
70 |
+
* Also get the last success entry
|
71 |
+
* last entry period
|
72 |
+
* Difference between last success and last entry (or the one right after)
|
73 |
+
*/
|
74 |
+
|
75 |
+
$data = array();
|
76 |
+
|
77 |
+
$cron_status = array();
|
78 |
+
|
79 |
+
foreach ($this->_status_types as $type => $label) {
|
80 |
+
$cron_status[$label] = $this->_helper->getStatus($type, false);
|
81 |
+
}
|
82 |
+
|
83 |
+
$data['cron_status'] = $cron_status;
|
84 |
+
|
85 |
+
$data['schedule']['info'] = $this->getTableInfo('cron_schedule');
|
86 |
+
$data['schedule']['rows'] = $this->getScheduleRows();
|
87 |
+
|
88 |
+
$last_success = $this->getLastSuccess();
|
89 |
+
$minutes = $this->_helper->getMinutesSince($last_success);
|
90 |
+
|
91 |
+
$early = true;
|
92 |
+
|
93 |
+
if ($minutes > $this->_helper->getCronNotRunMinutes()) {
|
94 |
+
$early = false;
|
95 |
+
}
|
96 |
+
$data['last_success'] = array(
|
97 |
+
'date' => $last_success,
|
98 |
+
'minutes' => $minutes,
|
99 |
+
'early' => $early,
|
100 |
+
'elapsed' => $this->_helper->timeElapsed2string($last_success)
|
101 |
+
);
|
102 |
+
|
103 |
+
$data['last_campaigner_success'] = $this->getLastCampaignerSuccess();
|
104 |
+
|
105 |
+
|
106 |
+
return $data;
|
107 |
+
}
|
108 |
+
|
109 |
+
private function getLastSuccess()
|
110 |
+
{
|
111 |
+
$table_name = $this->getCronTable();
|
112 |
+
|
113 |
+
$sql = "SELECT * FROM `{$table_name}` ORDER BY finished_at DESC LIMIT 50";
|
114 |
+
|
115 |
+
$rows = $this->query($sql);
|
116 |
+
|
117 |
+
if (isset($rows[0])) {
|
118 |
+
return $rows[0]['finished_at'];
|
119 |
+
}
|
120 |
+
|
121 |
+
return null;
|
122 |
+
}
|
123 |
+
|
124 |
+
private function getLastCampaignerSuccess()
|
125 |
+
{
|
126 |
+
$data = array('working' => false);
|
127 |
+
$table_name = $this->getCronTable();
|
128 |
+
|
129 |
+
$sql = "SELECT * FROM `{$table_name}` WHERE job_code LIKE 'campaigner%' ORDER BY finished_at DESC LIMIT 50";
|
130 |
+
|
131 |
+
$rows = $this->query($sql);
|
132 |
+
|
133 |
+
if (isset($rows[0])) {
|
134 |
+
$row = $rows[0];
|
135 |
+
|
136 |
+
$last_success = $row['finished_at'];
|
137 |
+
$minutes = $this->_helper->getMinutesSince($last_success);
|
138 |
+
$working = true;
|
139 |
+
|
140 |
+
if ($minutes > $this->_helper->getCronNotRunMinutes()) {
|
141 |
+
$working = false;
|
142 |
+
}
|
143 |
+
|
144 |
+
$data = array(
|
145 |
+
'date' => $last_success,
|
146 |
+
'elapsed' => $this->_helper->timeElapsed2string($last_success),
|
147 |
+
'minutes' => $minutes,
|
148 |
+
'code' => $row['job_code'],
|
149 |
+
'working' => $working,
|
150 |
+
'label' => $this->getJobLabel($row['job_code'])
|
151 |
+
);
|
152 |
+
}
|
153 |
+
|
154 |
+
return $data;
|
155 |
+
}
|
156 |
+
|
157 |
+
private function getJobLabel($code)
|
158 |
+
{
|
159 |
+
$code = str_replace('campaigner_integration_','',$code);
|
160 |
+
|
161 |
+
if ($code == 'latest_orders') {
|
162 |
+
$code = 'latest';
|
163 |
+
}
|
164 |
+
|
165 |
+
if (isset($this->_status_types[$code])) {
|
166 |
+
return $this->_status_types[$code];
|
167 |
+
}
|
168 |
+
return $code;
|
169 |
+
}
|
170 |
+
|
171 |
+
private function getTableInfo($table)
|
172 |
+
{
|
173 |
+
$table_name = $this->getCronTable();
|
174 |
+
|
175 |
+
$sql = "SHOW TABLE STATUS LIKE '{$table_name}'";
|
176 |
+
|
177 |
+
$status = $this->query($sql);
|
178 |
+
|
179 |
+
if (isset($status[0]))
|
180 |
+
return $status[0];
|
181 |
+
|
182 |
+
return array();
|
183 |
+
}
|
184 |
+
|
185 |
+
private function processScheduleRows($rows)
|
186 |
+
{
|
187 |
+
$updated_rows = array();
|
188 |
+
|
189 |
+
foreach ($rows as $row_key => $row) {
|
190 |
+
$updated_row = array();
|
191 |
+
foreach ($row as $key => $value) {
|
192 |
+
if ($value != null && strpos($key, "_at") !== false) {
|
193 |
+
$updated_row[$key] = Mage::getModel('core/date')->date(null, $value);
|
194 |
+
} else {
|
195 |
+
$updated_row[$key] = $value;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
if ($updated_row['executed_at'] == null) {
|
200 |
+
$updated_row['minutes_late'] = Mage::helper('campaigner/cron')->getMinutesSince($row['scheduled_at']);
|
201 |
+
} else {
|
202 |
+
$updated_row['minutes_late'] = null;
|
203 |
+
}
|
204 |
+
|
205 |
+
$updated_rows[] = $updated_row;
|
206 |
+
}
|
207 |
+
|
208 |
+
return $updated_rows;
|
209 |
+
}
|
210 |
+
|
211 |
+
private function getScheduleRows()
|
212 |
+
{
|
213 |
+
$table_name = $this->getCronTable();
|
214 |
+
|
215 |
+
$sql = "SELECT * FROM `{$table_name}` ORDER BY schedule_id DESC LIMIT " . $this->getScheduleRowLimit();
|
216 |
+
|
217 |
+
return $this->processScheduleRows($this->query($sql));
|
218 |
+
}
|
219 |
+
|
220 |
+
private function getCronTable()
|
221 |
+
{
|
222 |
+
return Mage::getSingleton('core/resource')->getTableName('cron_schedule');
|
223 |
+
}
|
224 |
+
|
225 |
+
private function query($sql)
|
226 |
+
{
|
227 |
+
$rows = Mage::getSingleton('core/resource')
|
228 |
+
->getConnection('core_read')
|
229 |
+
->query($sql)
|
230 |
+
->fetchAll();
|
231 |
+
|
232 |
+
return $rows;
|
233 |
+
}
|
234 |
+
}
|
@@ -81,7 +81,11 @@ class Campaigner_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Help
|
|
81 |
$table_entities = array(
|
82 |
'abandoned',
|
83 |
'latest_order',
|
84 |
-
'session'
|
|
|
|
|
|
|
|
|
85 |
);
|
86 |
|
87 |
$tables = array();
|
81 |
$table_entities = array(
|
82 |
'abandoned',
|
83 |
'latest_order',
|
84 |
+
'session',
|
85 |
+
'order',
|
86 |
+
'product',
|
87 |
+
'category',
|
88 |
+
'product_category_action'
|
89 |
);
|
90 |
|
91 |
$tables = array();
|
@@ -35,4 +35,25 @@ class Campaigner_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Log
|
|
35 |
{
|
36 |
return Mage::helper('campaigner/troubleshooting')->getLogFileContents();
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
35 |
{
|
36 |
return Mage::helper('campaigner/troubleshooting')->getLogFileContents();
|
37 |
}
|
38 |
+
|
39 |
+
public function getLogFiles()
|
40 |
+
{
|
41 |
+
return array(
|
42 |
+
Mage::helper('campaigner/troubleshooting')->getLogFileName(),
|
43 |
+
"campaigner_install.log",
|
44 |
+
"exception.log",
|
45 |
+
"system.log"
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getSelectedLog()
|
50 |
+
{
|
51 |
+
// At some point we might want to pick this up from the URL
|
52 |
+
return Mage::helper('campaigner/troubleshooting')->getLogFileName();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getDefaultLog()
|
56 |
+
{
|
57 |
+
return Mage::helper('campaigner/troubleshooting')->getLogFileName();
|
58 |
+
}
|
59 |
}
|
@@ -16,7 +16,7 @@ class Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Abandoned_Minutes
|
|
16 |
$minutes = round(abs($current_date - $abandoned_date) / 60,0);
|
17 |
|
18 |
$class = 'ab_ok';
|
19 |
-
if ($minutes >
|
20 |
$class = 'ab_ng';
|
21 |
}
|
22 |
|
16 |
$minutes = round(abs($current_date - $abandoned_date) / 60,0);
|
17 |
|
18 |
$class = 'ab_ok';
|
19 |
+
if ($minutes > Mage::helper('campaigner/cron')->getCronNotRunMinutes()) {
|
20 |
$class = 'ab_ng';
|
21 |
}
|
22 |
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Orders_State extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$state = "";
|
7 |
+
|
8 |
+
$mode = Mage::helper('campaigner')->commerceConfig('send_field');
|
9 |
+
|
10 |
+
if ($mode == 'state') {
|
11 |
+
$configured_states = Mage::helper('campaigner')->commerceConfig('send_states');
|
12 |
+
$valid_list = explode(",",$configured_states);
|
13 |
+
|
14 |
+
$state = $row->getData('state');
|
15 |
+
} else {
|
16 |
+
$configured_statuses = Mage::helper('campaigner')->commerceConfig('send_statuses');
|
17 |
+
$valid_list = explode(",",$configured_statuses);
|
18 |
+
$data['display'] = "Statuses";
|
19 |
+
|
20 |
+
$state = $row->getData('status');
|
21 |
+
}
|
22 |
+
|
23 |
+
$class = 'valid';
|
24 |
+
|
25 |
+
if (!in_array($state, $valid_list)) {
|
26 |
+
$class = 'invalid';
|
27 |
+
}
|
28 |
+
|
29 |
+
$options = $this->getColumn()->getOptions();
|
30 |
+
|
31 |
+
$state = $options[$state];
|
32 |
+
|
33 |
+
return "<span class='{$class}'>{$state}</span>";
|
34 |
+
}
|
35 |
+
}
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Campaigner_Integration_Block_Widget_Grid_Column_Renderer_Products_Name extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$type = $row->getData('type');
|
7 |
+
|
8 |
+
if ($type == 'product') {
|
9 |
+
$product = Mage::getModel('catalog/product')->load($row->getData('product_id'));
|
10 |
+
|
11 |
+
return $product->getName();
|
12 |
+
} else {
|
13 |
+
$category = Mage::getModel('catalog/category')->load($row->getData('category_id'));
|
14 |
+
|
15 |
+
return $category->getName();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
}
|
@@ -86,25 +86,35 @@ class Campaigner_Integration_Helper_Abandoned extends Campaigner_Integration_Hel
|
|
86 |
|
87 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
88 |
|
89 |
-
//$this->logAndDebug($url_data, "Abandoned Url Data");
|
90 |
$this->debug("URL Data:");
|
91 |
$this->debug($url_data);
|
92 |
|
93 |
$url = base64_encode(serialize($url_data));
|
94 |
|
95 |
-
$url = Mage::getUrl('campaigner/abandoned/restore',array('_secure'=>true
|
96 |
|
97 |
$this->debug("URL:");
|
98 |
$this->debug($url);
|
99 |
|
100 |
-
|
101 |
-
|
102 |
|
103 |
public function getLastOrder($quote)
|
104 |
{
|
105 |
-
$this->logAndDebug("Get Last Order");
|
106 |
$customer_id = $quote->getData('customer_id');
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
$this->logAndDebug("Customer ID: {$customer_id}");
|
109 |
|
110 |
$orders = Mage::getResourceModel('sales/order_collection')
|
@@ -140,13 +150,13 @@ class Campaigner_Integration_Helper_Abandoned extends Campaigner_Integration_Hel
|
|
140 |
$sequence_value = $this->_sequences[$this->_current_sequence++];
|
141 |
} else {
|
142 |
// Individual. Stored in session table
|
143 |
-
|
144 |
$sequence = $quote->getSequence();
|
145 |
|
146 |
// If we've already sent the cart, don't update the sequence
|
147 |
if ($quote->getDateSent()) {
|
148 |
return;
|
149 |
}
|
|
|
150 |
if (!isset($this->_sequences[$sequence])) {
|
151 |
$sequence = 0;
|
152 |
}
|
86 |
|
87 |
$url_data = array("quote" => $quote->getId(), "id" => $ids, "qty" => $qtys);
|
88 |
|
|
|
89 |
$this->debug("URL Data:");
|
90 |
$this->debug($url_data);
|
91 |
|
92 |
$url = base64_encode(serialize($url_data));
|
93 |
|
94 |
+
$url = Mage::getUrl('campaigner/abandoned/restore',array('_secure' => true, 'cart' => $url));
|
95 |
|
96 |
$this->debug("URL:");
|
97 |
$this->debug($url);
|
98 |
|
99 |
+
return $url;
|
100 |
+
}
|
101 |
|
102 |
public function getLastOrder($quote)
|
103 |
{
|
|
|
104 |
$customer_id = $quote->getData('customer_id');
|
105 |
|
106 |
+
return $this->getCustomerLastOrder($customer_id);
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getCustomerLastOrder($customer)
|
110 |
+
{
|
111 |
+
$this->logAndDebug("Get Customer Last Order");
|
112 |
+
if (is_int($customer)) {
|
113 |
+
$customer_id = $customer;
|
114 |
+
} else {
|
115 |
+
$customer_id = $customer->getId();
|
116 |
+
}
|
117 |
+
|
118 |
$this->logAndDebug("Customer ID: {$customer_id}");
|
119 |
|
120 |
$orders = Mage::getResourceModel('sales/order_collection')
|
150 |
$sequence_value = $this->_sequences[$this->_current_sequence++];
|
151 |
} else {
|
152 |
// Individual. Stored in session table
|
|
|
153 |
$sequence = $quote->getSequence();
|
154 |
|
155 |
// If we've already sent the cart, don't update the sequence
|
156 |
if ($quote->getDateSent()) {
|
157 |
return;
|
158 |
}
|
159 |
+
|
160 |
if (!isset($this->_sequences[$sequence])) {
|
161 |
$sequence = 0;
|
162 |
}
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Helper_Cron extends Campaigner_Integration_Helper_Data
|
4 |
+
{
|
5 |
+
const ABANDONED = 'abandoned';
|
6 |
+
const LATEST_ORDERS = 'latest';
|
7 |
+
const ORDERS = 'orders';
|
8 |
+
const BACKGROUND = 'background_task';
|
9 |
+
const PRODUCTS = 'products';
|
10 |
+
protected $_date_format = Campaigner_Integration_Helper_Data::DATE_FORMAT;
|
11 |
+
|
12 |
+
public function getCronNotRunMinutes()
|
13 |
+
{
|
14 |
+
return $this->config('cron_not_run_minutes');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getMinutesSince($date)
|
18 |
+
{
|
19 |
+
return round(abs(time() - strtotime($date)) / 60,0);
|
20 |
+
}
|
21 |
+
|
22 |
+
public function setCronLastRun($type, $date = null)
|
23 |
+
{
|
24 |
+
if ($date == null) {
|
25 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
26 |
+
$date = date($this->_date_format, $date);
|
27 |
+
}
|
28 |
+
|
29 |
+
$this->log("Saving Last Cron Run Date: {$date}");
|
30 |
+
$this->updateConfig("{$type}_cron_last_run", $date);
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getLastRun($config = "abandoned_cron", $store = null)
|
34 |
+
{
|
35 |
+
$last_run = $this->config("{$config}_last_run", $store);
|
36 |
+
|
37 |
+
$data = array();
|
38 |
+
|
39 |
+
if ($last_run != null) {
|
40 |
+
$data['last_run'] = $last_run;
|
41 |
+
|
42 |
+
$minutes = $this->getMinutesSince($last_run);
|
43 |
+
|
44 |
+
$data['minutes'] = $minutes;
|
45 |
+
|
46 |
+
if ($minutes > $this->getCronNotRunMinutes()) {
|
47 |
+
$data['class'] = 'ab_ng';
|
48 |
+
} else {
|
49 |
+
$data['class'] = 'ab_ok';
|
50 |
+
}
|
51 |
+
|
52 |
+
$data['last_run_display'] = Mage::helper('core')->formatTime($last_run, 'long', true);
|
53 |
+
$data['time_elapsed'] = $this->timeElapsed2string($last_run);
|
54 |
+
} else {
|
55 |
+
$data['last_run'] = 'NEVER';
|
56 |
+
$data['minutes'] = -1;
|
57 |
+
$data['last_run_display'] = 'NEVER';
|
58 |
+
$data['time_elapsed'] = "";
|
59 |
+
$data['class'] = 'ab_ng';
|
60 |
+
}
|
61 |
+
|
62 |
+
return $data;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getCronLastRun($config = 'abandoned', $store = Mage_Core_Model_App::ADMIN_STORE_ID)
|
66 |
+
{
|
67 |
+
return $this->getLastRun("{$config}_cron",$store);
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getStatus($type = 'abandoned', $helpLink = true)
|
71 |
+
{
|
72 |
+
$stores = Mage::app()->getStores();
|
73 |
+
|
74 |
+
$status = array(
|
75 |
+
'enabled' => false,
|
76 |
+
'cron_last_run' => $this->getCronLastRunHtml($type, $helpLink),
|
77 |
+
'stores' => array()
|
78 |
+
);
|
79 |
+
|
80 |
+
foreach ($stores as $store) {
|
81 |
+
$data = array();
|
82 |
+
|
83 |
+
$data['id'] = $store->getId();
|
84 |
+
$data['name'] = $this->getFullStoreName($store);
|
85 |
+
$data['enabled'] = $this->getEnabledStatus($type, $store->getId());
|
86 |
+
if ($data['enabled']) {
|
87 |
+
$status['enabled'] = true;
|
88 |
+
}
|
89 |
+
|
90 |
+
$data['last_run'] = $this->getLastRunhtml($type,$store->getId(),$helpLink);
|
91 |
+
|
92 |
+
$status['stores'][] = $data;
|
93 |
+
}
|
94 |
+
|
95 |
+
return $status;
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getEnabledStatus($type, $store = null)
|
100 |
+
{
|
101 |
+
switch ($type) {
|
102 |
+
case self::ABANDONED: return $this->getAbandonedEnabled($store);
|
103 |
+
case self::LATEST_ORDERS : return $this->config('save_latest_order',$store);
|
104 |
+
case self::ORDERS : return ($this->commerceConfig('enabled',$store) && $this->commerceConfig('batch_enabled',$store));
|
105 |
+
case self::PRODUCTS : return ($this->commerceConfig('enabled',$store) && $this->commerceConfig('product_category_enabled',$store));
|
106 |
+
case self::BACKGROUND : return $this->config('background_task_enabled',$store);
|
107 |
+
}
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
|
111 |
+
private function getLastRunHtml($config = self::ABANDONED, $store = null, $helpLink = true)
|
112 |
+
{
|
113 |
+
$data = $this->getLastRun($config, $store);
|
114 |
+
$warning_img = "";
|
115 |
+
|
116 |
+
if ($helpLink && ($data['class'] == "ab_ng")) {
|
117 |
+
$warning_img = "<a href='" . $this->getAdminUrl("adminhtml/campaigner_troubleshooting/index") . "#abandoned_carts' target='_blank'><img src='" . Mage::getDesign()->getSkinUrl('images/warning_msg_icon.gif') . "' class='cron_warning' /></a>";
|
118 |
+
}
|
119 |
+
|
120 |
+
$time_elapsed = "";
|
121 |
+
|
122 |
+
if ($data['time_elapsed'] != '') {
|
123 |
+
$time_elapsed = "({$data['time_elapsed']})";
|
124 |
+
}
|
125 |
+
|
126 |
+
return "<span class='{$data['class']}'>{$data['last_run_display']} {$time_elapsed}</span>{$warning_img}";
|
127 |
+
}
|
128 |
+
|
129 |
+
public function getCronLastRunHtml($type, $helpLink = true)
|
130 |
+
{
|
131 |
+
return $this->getLastRunHtml("{$type}_cron",Mage_Core_Model_App::ADMIN_STORE_ID, $helpLink);
|
132 |
+
}
|
133 |
+
}
|
@@ -14,6 +14,35 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
14 |
$this->_logger = Mage::helper('campaigner/troubleshooting');
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
protected function logAndDebug($data)
|
18 |
{
|
19 |
$this->_logger->logAndDebug($data);
|
@@ -75,6 +104,13 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
75 |
return $merge_vars;
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
public function getMergeVars($customer)
|
79 |
{
|
80 |
$merge_vars = array();
|
@@ -313,9 +349,19 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
313 |
return $filename;
|
314 |
}
|
315 |
|
316 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
{
|
318 |
-
return $this->config('
|
319 |
}
|
320 |
|
321 |
public function isWebsiteConfig()
|
@@ -329,7 +375,7 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
329 |
return false;
|
330 |
}
|
331 |
|
332 |
-
public function updateConfig($path, $value, $store = 0, $base_path = 'general')
|
333 |
{
|
334 |
$scope = "stores";
|
335 |
|
@@ -394,6 +440,21 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
394 |
$this->_current_store = null;
|
395 |
}
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
public function getCurrentStore()
|
398 |
{
|
399 |
$store = Mage::app()->getStore()->getId();
|
@@ -438,9 +499,14 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
438 |
return $this->_config($value,'general',$store);
|
439 |
}
|
440 |
|
441 |
-
public function
|
442 |
{
|
443 |
-
return $this->_config($value,'
|
|
|
|
|
|
|
|
|
|
|
444 |
}
|
445 |
|
446 |
public function troubleConfig($value, $store = null)
|
@@ -503,9 +569,9 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
503 |
return $options;
|
504 |
}
|
505 |
|
506 |
-
public function
|
507 |
{
|
508 |
-
return $this->config('
|
509 |
}
|
510 |
|
511 |
public function isSignupTest()
|
@@ -513,6 +579,31 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
513 |
return Mage::app()->getRequest()->getParam('signup_test') == "true";
|
514 |
}
|
515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
public function canCapture()
|
517 |
{
|
518 |
if (!$this->campaignerEnabled()) {
|
@@ -622,6 +713,22 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
622 |
return $this->onConfigPage();
|
623 |
}
|
624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
private function storeHasCustomAPI($store_id)
|
626 |
{
|
627 |
$sql = "SELECT * FROM core_config_data WHERE scope='stores' AND scope_id='{$store_id}' AND path = 'campaigner/general/api_username'";
|
@@ -671,6 +778,17 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
671 |
$this->updateConfig('locked', false, $store_id);
|
672 |
}
|
673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
public function onConfigPage()
|
675 |
{
|
676 |
$controller = Mage::app()->getRequest()->getControllerName();
|
@@ -728,132 +846,6 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
728 |
return $this->getFullStoreName($store);
|
729 |
}
|
730 |
|
731 |
-
public function getAbandonedStatus()
|
732 |
-
{
|
733 |
-
$stores = Mage::app()->getStores();
|
734 |
-
|
735 |
-
$abandoned_status = array(
|
736 |
-
'enabled' => false,
|
737 |
-
'cron_last_run' => $this->getCronLastRunHtml(),
|
738 |
-
'stores' => array()
|
739 |
-
);
|
740 |
-
|
741 |
-
foreach ($stores as $store) {
|
742 |
-
$data = array();
|
743 |
-
|
744 |
-
$data['id'] = $store->getId();
|
745 |
-
$data['name'] = $this->getFullStoreName($store);
|
746 |
-
$data['enabled'] = $this->getAbandonedEnabled($store->getId());
|
747 |
-
if ($data['enabled']) {
|
748 |
-
$abandoned_status['enabled'] = true;
|
749 |
-
}
|
750 |
-
|
751 |
-
$data['last_run'] = $this->getAbandonedLastRunhtml($store->getId());
|
752 |
-
|
753 |
-
$abandoned_status['stores'][] = $data;
|
754 |
-
}
|
755 |
-
|
756 |
-
return $abandoned_status;
|
757 |
-
}
|
758 |
-
|
759 |
-
public function getLatestStatus()
|
760 |
-
{
|
761 |
-
$stores = Mage::app()->getStores();
|
762 |
-
|
763 |
-
$latest_status = array(
|
764 |
-
'enabled' => false,
|
765 |
-
'cron_last_run' => $this->getLatestCronLastRunHtml(),
|
766 |
-
'stores' => array()
|
767 |
-
);
|
768 |
-
|
769 |
-
foreach ($stores as $store) {
|
770 |
-
$data = array();
|
771 |
-
|
772 |
-
$data['id'] = $store->getId();
|
773 |
-
$data['name'] = $this->getFullStoreName($store);
|
774 |
-
$data['enabled'] = $this->config('save_latest_order',$store->getId());
|
775 |
-
if ($data['enabled']) {
|
776 |
-
$latest_status['enabled'] = true;
|
777 |
-
}
|
778 |
-
|
779 |
-
$data['last_run'] = $this->getLatestLastRunhtml($store->getId());
|
780 |
-
|
781 |
-
$latest_status['stores'][] = $data;
|
782 |
-
}
|
783 |
-
|
784 |
-
return $latest_status;
|
785 |
-
}
|
786 |
-
|
787 |
-
public function getCronLastRun($store = null, $config = 'abandoned_last_run')
|
788 |
-
{
|
789 |
-
$last_run = $this->config($config, $store);
|
790 |
-
|
791 |
-
$data = array();
|
792 |
-
|
793 |
-
if ($last_run != null) {
|
794 |
-
$data['last_run'] = $last_run;
|
795 |
-
|
796 |
-
$minutes = round(abs(time() - strtotime($last_run)) / 60,0);
|
797 |
-
|
798 |
-
$data['minutes'] = $minutes;
|
799 |
-
|
800 |
-
if ($minutes > 60) {
|
801 |
-
$data['class'] = 'ab_ng';
|
802 |
-
} else {
|
803 |
-
$data['class'] = 'ab_ok';
|
804 |
-
}
|
805 |
-
|
806 |
-
$data['last_run_display'] = Mage::helper('core')->formatTime($last_run, 'long', true);
|
807 |
-
$data['time_elapsed'] = $this->timeElapsed2string($last_run);
|
808 |
-
} else {
|
809 |
-
$data['last_run'] = 'NEVER';
|
810 |
-
$data['minutes'] = -1;
|
811 |
-
$data['last_run_display'] = 'NEVER';
|
812 |
-
$data['time_elapsed'] = "";
|
813 |
-
$data['class'] = 'ab_ng';
|
814 |
-
}
|
815 |
-
|
816 |
-
return $data;
|
817 |
-
}
|
818 |
-
|
819 |
-
private function getLastRunHtml($store = null, $config = 'abandoned_last_run')
|
820 |
-
{
|
821 |
-
$data = $this->getCronLastRun($store,$config);
|
822 |
-
$warning_img = "";
|
823 |
-
|
824 |
-
if ($data['class'] == "ab_ng") {
|
825 |
-
$warning_img = "<a href='" . $this->getAdminUrl("campaigner_dashboard/admin_troubleshooting/index") . "#abandoned_carts' target='_blank'><img src='" . Mage::getDesign()->getSkinUrl('images/warning_msg_icon.gif') . "' class='cron_warning' /></a>";
|
826 |
-
}
|
827 |
-
|
828 |
-
$time_elapsed = "";
|
829 |
-
|
830 |
-
if ($data['time_elapsed'] != '') {
|
831 |
-
$time_elapsed = "({$data['time_elapsed']})";
|
832 |
-
}
|
833 |
-
|
834 |
-
return "<span class='{$data['class']}'>{$data['last_run_display']} {$time_elapsed}</span>{$warning_img}";
|
835 |
-
}
|
836 |
-
|
837 |
-
public function getAbandonedLastRunHtml($store = null)
|
838 |
-
{
|
839 |
-
return $this->getLastRunHtml($store);
|
840 |
-
}
|
841 |
-
|
842 |
-
public function getLatestLastRunHtml($store = null)
|
843 |
-
{
|
844 |
-
return $this->getLastRunHtml($store, 'latest_last_run');
|
845 |
-
}
|
846 |
-
|
847 |
-
public function getCronLastRunHtml()
|
848 |
-
{
|
849 |
-
return $this->getLastRunHtml(0, 'cron_last_run');
|
850 |
-
}
|
851 |
-
|
852 |
-
public function getLatestCronLastRunHtml()
|
853 |
-
{
|
854 |
-
return $this->getLastRunHtml(0, 'latest_cron_last_run');
|
855 |
-
}
|
856 |
-
|
857 |
public function getAdminUrlParams($params = array())
|
858 |
{
|
859 |
$request = Mage::app()->getRequest();
|
@@ -879,9 +871,10 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
879 |
{
|
880 |
$active = $this->config('active');
|
881 |
$setup = $this->config('setup');
|
882 |
-
$
|
|
|
883 |
|
884 |
-
if (!$
|
885 |
return false;
|
886 |
}
|
887 |
|
@@ -890,11 +883,13 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
890 |
|
891 |
public function getBatchEnabled()
|
892 |
{
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
|
897 |
-
|
|
|
|
|
898 |
return false;
|
899 |
}
|
900 |
|
@@ -903,7 +898,7 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
903 |
|
904 |
public function getBatchOnly()
|
905 |
{
|
906 |
-
$batch_only = $this->
|
907 |
|
908 |
if (!$batch_only) {
|
909 |
return false;
|
@@ -1117,6 +1112,8 @@ class Campaigner_Integration_Helper_Data extends Mage_Core_Helper_Abstract
|
|
1117 |
$email = $customer->getEmail();
|
1118 |
}
|
1119 |
|
|
|
|
|
1120 |
$lists = $this->getLists();
|
1121 |
|
1122 |
$subscriptions = $this->getSubscriberData($email, $lists);
|
14 |
$this->_logger = Mage::helper('campaigner/troubleshooting');
|
15 |
}
|
16 |
|
17 |
+
public function getCustomHeaders()
|
18 |
+
{
|
19 |
+
$exclude = array('Website URL');
|
20 |
+
$info = $this->_logger->getEnvironmentInfo();
|
21 |
+
|
22 |
+
$headers = array(
|
23 |
+
'Source' => "Magento"
|
24 |
+
);
|
25 |
+
|
26 |
+
foreach ($info as $key => $value) {
|
27 |
+
if (!in_array($key, $exclude)) {
|
28 |
+
$headers[$key] = $value;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
return $headers;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function isEmailDirectInstalled()
|
36 |
+
{
|
37 |
+
$moduleName = "EmailDirect_Integration";
|
38 |
+
|
39 |
+
if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
return true;
|
44 |
+
}
|
45 |
+
|
46 |
protected function logAndDebug($data)
|
47 |
{
|
48 |
$this->_logger->logAndDebug($data);
|
104 |
return $merge_vars;
|
105 |
}
|
106 |
|
107 |
+
public function getTriggerWorkflows()
|
108 |
+
{
|
109 |
+
$trigger = $this->config("trigger_workflows");
|
110 |
+
|
111 |
+
return ($trigger == 1);
|
112 |
+
}
|
113 |
+
|
114 |
public function getMergeVars($customer)
|
115 |
{
|
116 |
$merge_vars = array();
|
349 |
return $filename;
|
350 |
}
|
351 |
|
352 |
+
public function getApikey($store = null)
|
353 |
+
{
|
354 |
+
return $this->commerceConfig('apikey',$store);
|
355 |
+
}
|
356 |
+
|
357 |
+
public function getApiUsername($store = null)
|
358 |
+
{
|
359 |
+
return $this->config('api_username',$store);
|
360 |
+
}
|
361 |
+
|
362 |
+
public function getApiPassword($store = null)
|
363 |
{
|
364 |
+
return $this->config('api_password',$store);
|
365 |
}
|
366 |
|
367 |
public function isWebsiteConfig()
|
375 |
return false;
|
376 |
}
|
377 |
|
378 |
+
public function updateConfig($path, $value, $store = 0, $base_path = 'general', $cleanCache = true)
|
379 |
{
|
380 |
$scope = "stores";
|
381 |
|
440 |
$this->_current_store = null;
|
441 |
}
|
442 |
|
443 |
+
public function getCurrentCustomerId()
|
444 |
+
{
|
445 |
+
if (!Mage::helper('customer')->isLoggedIn()) {
|
446 |
+
return null;
|
447 |
+
}
|
448 |
+
|
449 |
+
$customer_session = Mage::getSingleton("customer/session");
|
450 |
+
|
451 |
+
if ($customer_session) {
|
452 |
+
return $customer_session->getId();
|
453 |
+
}
|
454 |
+
|
455 |
+
return null;
|
456 |
+
}
|
457 |
+
|
458 |
public function getCurrentStore()
|
459 |
{
|
460 |
$store = Mage::app()->getStore()->getId();
|
499 |
return $this->_config($value,'general',$store);
|
500 |
}
|
501 |
|
502 |
+
public function commerceConfig($value, $store = null)
|
503 |
{
|
504 |
+
return $this->_config($value,'commerce',$store);
|
505 |
+
}
|
506 |
+
|
507 |
+
public function syncConfig($value, $store = null)
|
508 |
+
{
|
509 |
+
return $this->_config($value,'sync',$store);
|
510 |
}
|
511 |
|
512 |
public function troubleConfig($value, $store = null)
|
569 |
return $options;
|
570 |
}
|
571 |
|
572 |
+
public function getDefaultList($storeId)
|
573 |
{
|
574 |
+
return $this->config('list', $storeId);
|
575 |
}
|
576 |
|
577 |
public function isSignupTest()
|
579 |
return Mage::app()->getRequest()->getParam('signup_test') == "true";
|
580 |
}
|
581 |
|
582 |
+
public function isCronUrlEnabled()
|
583 |
+
{
|
584 |
+
if (!$this->campaignerEnabled()) {
|
585 |
+
return false;
|
586 |
+
}
|
587 |
+
|
588 |
+
if ((bool)($this->config('cron_url_enabled') == 0)) {
|
589 |
+
return false;
|
590 |
+
}
|
591 |
+
|
592 |
+
if ($this->config('cron_url_password_enabled') == 1) {
|
593 |
+
$password = Mage::app()->getRequest()->getParam('password');
|
594 |
+
if ($password != $this->config('cron_url_password')) {
|
595 |
+
return false;
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
+
return true;
|
600 |
+
}
|
601 |
+
|
602 |
+
public function isBackgroundEnabled()
|
603 |
+
{
|
604 |
+
return $this->config('background_task_enabled') == 1;
|
605 |
+
}
|
606 |
+
|
607 |
public function canCapture()
|
608 |
{
|
609 |
if (!$this->campaignerEnabled()) {
|
713 |
return $this->onConfigPage();
|
714 |
}
|
715 |
|
716 |
+
public function commerceEnabled()
|
717 |
+
{
|
718 |
+
if (!$this->campaignerEnabled()) {
|
719 |
+
return false;
|
720 |
+
}
|
721 |
+
|
722 |
+
$active = $this->commerceConfig('enabled');
|
723 |
+
$setup = $this->commerceConfig('setup');
|
724 |
+
|
725 |
+
if ($active && $setup) {
|
726 |
+
return true;
|
727 |
+
}
|
728 |
+
|
729 |
+
return $this->onConfigPage() || $this->onSyncPage();
|
730 |
+
}
|
731 |
+
|
732 |
private function storeHasCustomAPI($store_id)
|
733 |
{
|
734 |
$sql = "SELECT * FROM core_config_data WHERE scope='stores' AND scope_id='{$store_id}' AND path = 'campaigner/general/api_username'";
|
778 |
$this->updateConfig('locked', false, $store_id);
|
779 |
}
|
780 |
|
781 |
+
public function onSyncPage()
|
782 |
+
{
|
783 |
+
$controller = Mage::app()->getRequest()->getControllerName();
|
784 |
+
|
785 |
+
if ($controller == 'campaigner_sync') {
|
786 |
+
return true;
|
787 |
+
}
|
788 |
+
|
789 |
+
return false;
|
790 |
+
}
|
791 |
+
|
792 |
public function onConfigPage()
|
793 |
{
|
794 |
$controller = Mage::app()->getRequest()->getControllerName();
|
846 |
return $this->getFullStoreName($store);
|
847 |
}
|
848 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
public function getAdminUrlParams($params = array())
|
850 |
{
|
851 |
$request = Mage::app()->getRequest();
|
871 |
{
|
872 |
$active = $this->config('active');
|
873 |
$setup = $this->config('setup');
|
874 |
+
$commerce_setup = $this->commerceConfig('setup');
|
875 |
+
$commerce_enabled = $this->commerceConfig('enabled');
|
876 |
|
877 |
+
if (!$commerce_setup || !$commerce_enabled || !$setup || !$active) {
|
878 |
return false;
|
879 |
}
|
880 |
|
883 |
|
884 |
public function getBatchEnabled()
|
885 |
{
|
886 |
+
if (!$this->getOrdersEnabled()) {
|
887 |
+
return false;
|
888 |
+
}
|
889 |
|
890 |
+
$batch = $this->commerceConfig('batch_enabled');
|
891 |
+
|
892 |
+
if (!$batch) {
|
893 |
return false;
|
894 |
}
|
895 |
|
898 |
|
899 |
public function getBatchOnly()
|
900 |
{
|
901 |
+
$batch_only = $this->commerceConfig('batch_only');
|
902 |
|
903 |
if (!$batch_only) {
|
904 |
return false;
|
1112 |
$email = $customer->getEmail();
|
1113 |
}
|
1114 |
|
1115 |
+
Mage::getSingleton('campaigner/background_observer')->processPendingTasks($email);
|
1116 |
+
|
1117 |
$lists = $this->getLists();
|
1118 |
|
1119 |
$subscriptions = $this->getSubscriberData($email, $lists);
|
@@ -164,10 +164,10 @@ class Campaigner_Integration_Helper_Order extends Campaigner_Integration_Helper_
|
|
164 |
return $min;
|
165 |
}
|
166 |
|
167 |
-
|
168 |
{
|
|
|
169 |
try {
|
170 |
-
$image = "";
|
171 |
if ($product->getImage() == 'no_selection' || $product->getImage() == "") {
|
172 |
if ($parent_product != null && $parent_product->getImage() != "no_selection" && $parent_product->getImage() != "") {
|
173 |
$image = Mage::getModel('catalog/product_media_config')->getMediaUrl($parent_product->getImage());
|
164 |
return $min;
|
165 |
}
|
166 |
|
167 |
+
public function getProductImage($product, $parent_product = null)
|
168 |
{
|
169 |
+
$image = "";
|
170 |
try {
|
|
|
171 |
if ($product->getImage() == 'no_selection' || $product->getImage() == "") {
|
172 |
if ($parent_product != null && $parent_product->getImage() != "no_selection" && $parent_product->getImage() != "") {
|
173 |
$image = Mage::getModel('catalog/product_media_config')->getMediaUrl($parent_product->getImage());
|
@@ -0,0 +1,383 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Helper_Sync extends Campaigner_Integration_Helper_Data
|
4 |
+
{
|
5 |
+
public function getDefaultFromDate()
|
6 |
+
{
|
7 |
+
$time = strtotime("-1 year", Mage::getModel('core/date')->timestamp(time()));
|
8 |
+
return date("Y-m-d", $time);
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getDefaultToDate()
|
12 |
+
{
|
13 |
+
$time = strtotime("+1 day", Mage::getModel('core/date')->timestamp(time()));
|
14 |
+
return date("Y-m-d", $time);
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getDefaultInclude($type = null)
|
18 |
+
{
|
19 |
+
if ($type == null) {
|
20 |
+
return false;
|
21 |
+
}
|
22 |
+
|
23 |
+
return $this->syncConfig("{$type}_include_already_sent") == 1;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getCustomerCollection($from, $to, $include, $store = null)
|
27 |
+
{
|
28 |
+
$from_date = Mage::getModel('core/date')->gmtDate(null,strtotime($from));
|
29 |
+
|
30 |
+
$to_date = Mage::getModel('core/date')->gmtDate(null,strtotime($to));
|
31 |
+
|
32 |
+
$customers = Mage::getModel('customer/customer')->getCollection()
|
33 |
+
->addAttributeToFilter('created_at', array('from' => $from_date, 'to' => $to_date));
|
34 |
+
|
35 |
+
if ($store != null && $store != 0) {
|
36 |
+
$customers->addAttributeToFilter('store_id', array('eq' => $store));
|
37 |
+
}
|
38 |
+
|
39 |
+
if (!$include) {
|
40 |
+
$customers->getSelect()->joinLeft(array('camp_session' => Mage::getSingleton('core/resource')->getTableName("campaigner/session")),"camp_session.customer_id=e.entity_id",array(
|
41 |
+
'customer_id' => "customer_id"
|
42 |
+
));
|
43 |
+
$customers->getSelect()->where('`camp_session`.`customer_id` IS NULL');
|
44 |
+
}
|
45 |
+
|
46 |
+
return $customers;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getOrderCollection($from, $to, $include, $store = null)
|
50 |
+
{
|
51 |
+
$from_date = Mage::getModel('core/date')->gmtDate(null,strtotime($from));
|
52 |
+
|
53 |
+
$to_date = Mage::getModel('core/date')->gmtDate(null,strtotime($to));
|
54 |
+
|
55 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
56 |
+
->addAttributeToFilter('created_at', array('from' => $from_date, 'to' => $to_date));
|
57 |
+
|
58 |
+
$mode = $this->commerceConfig('send_field');
|
59 |
+
|
60 |
+
if ($mode == 'state') {
|
61 |
+
$states = $this->commerceConfig('send_states');
|
62 |
+
$state_list = explode(",",$states);
|
63 |
+
$orders->addAttributeToFilter('state', array('in' => $state_list));
|
64 |
+
} else {
|
65 |
+
$statuses = $this->commerceConfig('send_statuses');
|
66 |
+
$status_list = explode(",",$statuses);
|
67 |
+
$orders->addAttributeToFilter('status', array('in' => $status_list));
|
68 |
+
}
|
69 |
+
|
70 |
+
if ($store != null && $store != 0) {
|
71 |
+
$orders->addAttributeToFilter('store_id', array('eq' => $store));
|
72 |
+
}
|
73 |
+
|
74 |
+
if (!$include) {
|
75 |
+
$orders->getSelect()->joinLeft(array('camp_order' => Mage::getSingleton('core/resource')->getTableName("campaigner/order")),"camp_order.order_id=main_table.entity_id",array(
|
76 |
+
'date_sent' => "date_sent"
|
77 |
+
));
|
78 |
+
$orders->getSelect()->where('`camp_order`.`date_sent` IS NULL');
|
79 |
+
}
|
80 |
+
|
81 |
+
return $orders;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getProductCollection($include = false, $store = null)
|
85 |
+
{
|
86 |
+
$products = Mage::getModel('catalog/product')->getCollection();
|
87 |
+
|
88 |
+
if ($include == false) {
|
89 |
+
$products->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($store != null && $store != 0) {
|
93 |
+
$products->addStoreFilter($store);
|
94 |
+
}
|
95 |
+
|
96 |
+
return $products;
|
97 |
+
}
|
98 |
+
|
99 |
+
private function initProduct($product, $response)
|
100 |
+
{
|
101 |
+
$campaigner_id = (int)$response->ProductID;
|
102 |
+
$campaigner_product = Mage::getModel('campaigner/product')->init($product, $campaigner_id);
|
103 |
+
|
104 |
+
return $campaigner_product;
|
105 |
+
}
|
106 |
+
|
107 |
+
private function getUpdateCategories($current, $previous)
|
108 |
+
{
|
109 |
+
$delete = array_diff($previous, $current);
|
110 |
+
$add = array_diff($current, $previous);
|
111 |
+
|
112 |
+
return array('add' => $add, 'delete' => $delete);
|
113 |
+
}
|
114 |
+
|
115 |
+
private function getCampaignerCategoryIds($category_ids)
|
116 |
+
{
|
117 |
+
$campaigner_category_ids = array();
|
118 |
+
foreach ($category_ids as $cat_id) {
|
119 |
+
$category = Mage::getModel('catalog/category')->load($cat_id);
|
120 |
+
$campaigner_category = $this->syncCategory($category);
|
121 |
+
|
122 |
+
$campaigner_category_ids[] = $campaigner_category->getCampaignerId();
|
123 |
+
}
|
124 |
+
|
125 |
+
return $campaigner_category_ids;
|
126 |
+
}
|
127 |
+
|
128 |
+
private function getErrorCode($response)
|
129 |
+
{
|
130 |
+
if (isset($response->ErrorCode)) {
|
131 |
+
$error_code = (string)$response->ErrorCode;
|
132 |
+
if ($error_code != "") {
|
133 |
+
return $error_code;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
private function debugResponse($response)
|
141 |
+
{
|
142 |
+
$xml = $response->asXml();
|
143 |
+
|
144 |
+
$xml = htmlentities($xml);
|
145 |
+
|
146 |
+
return $xml;
|
147 |
+
}
|
148 |
+
|
149 |
+
private function getErrorMessage($response)
|
150 |
+
{
|
151 |
+
if (isset($response->Message)) {
|
152 |
+
return (string)$response->Message;
|
153 |
+
}
|
154 |
+
|
155 |
+
return "Unknown";
|
156 |
+
}
|
157 |
+
|
158 |
+
private function getCampaignerProduct($id)
|
159 |
+
{
|
160 |
+
$campaigner_product = Mage::getModel('campaigner/product')->load($id);
|
161 |
+
|
162 |
+
if ($campaigner_product->getCampaignerId() == 0) {
|
163 |
+
$campaigner_product->delete();
|
164 |
+
$campaigner_product = Mage::getModel('campaigner/product');
|
165 |
+
}
|
166 |
+
|
167 |
+
return $campaigner_product;
|
168 |
+
}
|
169 |
+
|
170 |
+
public function syncProduct($product)
|
171 |
+
{
|
172 |
+
$this->log("syncProduct Start");
|
173 |
+
$wrapper = Mage::getSingleton('campaigner/wrapper_commerce_product');
|
174 |
+
$campaigner_product = $this->getCampaignerProduct($product->getId());
|
175 |
+
$current_category_ids = $product->getCategoryIds();
|
176 |
+
|
177 |
+
if ($campaigner_product->getId()) {
|
178 |
+
$this->log("Campaigner ID found... Update Product");
|
179 |
+
$existing_category_ids = $campaigner_product->getCategoryIds();
|
180 |
+
|
181 |
+
$response = $wrapper->updateProduct($product, $campaigner_product->getCampaignerId());
|
182 |
+
|
183 |
+
$error_code = $this->getErrorCode($response);
|
184 |
+
|
185 |
+
if ($error_code) {
|
186 |
+
if ($error_code == '277') {
|
187 |
+
$this->log('Product Update Failed. Erasing Local Data and re-syncing');
|
188 |
+
$campaigner_product->delete();
|
189 |
+
return $this->syncProduct($product);
|
190 |
+
}
|
191 |
+
|
192 |
+
throw new Exception("Failed to Sync Product [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
193 |
+
}
|
194 |
+
|
195 |
+
$cat_ids = $this->getUpdateCategories($current_category_ids, $campaigner_product->getCategoryIds());
|
196 |
+
|
197 |
+
$add = $this->getCampaignerCategoryIds($cat_ids['add']);
|
198 |
+
$delete = $this->getCampaignerCategoryIds($cat_ids['delete']);
|
199 |
+
|
200 |
+
$cat_response = $wrapper->updateProductCategories($campaigner_product->getCampaignerId(), $add, $delete);
|
201 |
+
|
202 |
+
if ($this->getErrorCode($cat_response)) {
|
203 |
+
throw new Exception("Failed to Sync Product Categories: " . $this->getErrorMessage($cat_response));
|
204 |
+
}
|
205 |
+
|
206 |
+
$campaigner_product->setCategoryIds($current_category_ids);
|
207 |
+
$campaigner_product->save();
|
208 |
+
|
209 |
+
} else {
|
210 |
+
$this->log("Campaigner ID not found... Create Product");
|
211 |
+
$campaigner_category_ids = $this->getCampaignerCategoryIds($current_category_ids);
|
212 |
+
$response = $wrapper->addProduct($product, $campaigner_category_ids);
|
213 |
+
|
214 |
+
$this->log("Add Product Response");
|
215 |
+
$this->log($response);
|
216 |
+
|
217 |
+
$error_code = $this->getErrorCode($response);
|
218 |
+
|
219 |
+
if ($error_code) {
|
220 |
+
if ($error_code == '278') {
|
221 |
+
$this->log("Error 278 (Already Exists)");
|
222 |
+
$response = $wrapper->getProductDetails($product->getSku());
|
223 |
+
|
224 |
+
$this->log("Update Product Response");
|
225 |
+
$this->log($response);
|
226 |
+
|
227 |
+
if (isset($response->ProductID)) {
|
228 |
+
$this->log("Product ID Found");
|
229 |
+
|
230 |
+
$campaigner_id = (int)$response->ProductID;
|
231 |
+
$this->log("Campaigner ID: {$campaigner_id}");
|
232 |
+
|
233 |
+
$response = $wrapper->updateProduct($product, $campaigner_id);
|
234 |
+
|
235 |
+
$this->log("Update Product Response");
|
236 |
+
$this->log($response);
|
237 |
+
$error_code = $this->getErrorCode($response);
|
238 |
+
|
239 |
+
if ($error_code) {
|
240 |
+
throw new Exception("Failed to Sync Product [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
241 |
+
}
|
242 |
+
|
243 |
+
$cat_response = $wrapper->updateProductCategories($campaigner_id, $current_category_ids);
|
244 |
+
|
245 |
+
$this->log("Category Response");
|
246 |
+
$this->log($cat_response);
|
247 |
+
$error_code = $this->getErrorCode($cat_response);
|
248 |
+
if ($error_code) {
|
249 |
+
throw new Exception("Failed to Sync Product Categories [{$error_code}]: " . $this->getErrorMessage($cat_response), $error_code);
|
250 |
+
}
|
251 |
+
} else {
|
252 |
+
$this->log("Update Failed. Product ID not found.");
|
253 |
+
|
254 |
+
throw new Exception("Failed to Sync Product: Unable to load Campaigner Product - " . $this->getErrorMessage($response));
|
255 |
+
}
|
256 |
+
} else {
|
257 |
+
throw new Exception("Failed to Sync Product [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
$campaigner_product = $this->initProduct($product, $response);
|
262 |
+
}
|
263 |
+
|
264 |
+
$this->log("syncProduct Finished");
|
265 |
+
|
266 |
+
return $campaigner_product;
|
267 |
+
}
|
268 |
+
|
269 |
+
private function initCategory($category, $response)
|
270 |
+
{
|
271 |
+
$campaigner_id = (int)$response->CategoryID;
|
272 |
+
|
273 |
+
$campaigner_category = Mage::getModel('campaigner/category')->init($category, $campaigner_id);
|
274 |
+
|
275 |
+
return $campaigner_category;
|
276 |
+
}
|
277 |
+
|
278 |
+
private function getCategoryFromParent($parent_id, $name)
|
279 |
+
{
|
280 |
+
$parent = Mage::getSingleton('campaigner/wrapper_commerce_category')->getCategory($parent_id);
|
281 |
+
|
282 |
+
if (!empty($parent->Categories)) {
|
283 |
+
foreach ($parent->Categories->ProductCategory as $sub) {
|
284 |
+
if ((string)$sub->Name == $name) {
|
285 |
+
return $sub;
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
|
293 |
+
private function getCampaignerCategory($id)
|
294 |
+
{
|
295 |
+
$campaigner_category = Mage::getModel('campaigner/category')->load($id);
|
296 |
+
|
297 |
+
if ($campaigner_category->getCampaignerId() == 0) {
|
298 |
+
$campaigner_category->delete();
|
299 |
+
$campaigner_category = Mage::getModel('campaigner/category');
|
300 |
+
}
|
301 |
+
|
302 |
+
return $campaigner_category;
|
303 |
+
}
|
304 |
+
|
305 |
+
public function syncCategory($category, $update = false)
|
306 |
+
{
|
307 |
+
$this->log("syncCategory Start");
|
308 |
+
$wrapper = Mage::getSingleton('campaigner/wrapper_commerce_category');
|
309 |
+
$campaigner_category = $this->getCampaignerCategory($category->getId());
|
310 |
+
|
311 |
+
if ($campaigner_category->getId()) {
|
312 |
+
$this->log("Update Category");
|
313 |
+
// Update
|
314 |
+
if ($update) {
|
315 |
+
$this->log("Force Update");
|
316 |
+
$response = $wrapper->updateCategory($category, $campaigner_category->getCampaignerId());
|
317 |
+
$error_code = $this->getErrorCode($response);
|
318 |
+
|
319 |
+
if ($error_code) {
|
320 |
+
if ($error_code == '270') {
|
321 |
+
$this->log('Category Update Failed. Erasing Local Data and re-syncing');
|
322 |
+
$campaigner_category->delete();
|
323 |
+
return $this->syncCategory($category, $update);
|
324 |
+
}
|
325 |
+
throw new Exception("Failed to Sync Category [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
326 |
+
}
|
327 |
+
}
|
328 |
+
} else {
|
329 |
+
// Create
|
330 |
+
$this->log("Create Category");
|
331 |
+
if ($category->getParentId() == 0) {
|
332 |
+
$this->log("Top Level");
|
333 |
+
// Create Magento category
|
334 |
+
$root_category = new Varien_Object();
|
335 |
+
|
336 |
+
$root_category->setName("Magento");
|
337 |
+
$root_category->setDescription("Magento Root");
|
338 |
+
|
339 |
+
$response = $wrapper->AddCategory($root_category);
|
340 |
+
|
341 |
+
$error_code = $this->getErrorCode($response);
|
342 |
+
|
343 |
+
if ($error_code) {
|
344 |
+
throw new Exception("Failed to Sync Category [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
345 |
+
}
|
346 |
+
} else {
|
347 |
+
$this->log("Sub Level");
|
348 |
+
|
349 |
+
$this->log("Sync Parent Category");
|
350 |
+
$parent_category = Mage::getModel('catalog/category')->load($category->getParentId());
|
351 |
+
$parent_campaigner_category = $this->syncCategory($parent_category);
|
352 |
+
|
353 |
+
$parent_id = $parent_campaigner_category->getCampaignerId();
|
354 |
+
|
355 |
+
$this->log("Parent ID: {$parent_id}");
|
356 |
+
$this->log("Add Current Category");
|
357 |
+
$response = $wrapper->AddCategory($category, $parent_id);
|
358 |
+
|
359 |
+
$error_code = $this->getErrorCode($response);
|
360 |
+
|
361 |
+
if ($error_code) {
|
362 |
+
if ($error_code == '272') {
|
363 |
+
$this->log("Category already exists. Load from Parent");
|
364 |
+
$response = $this->getCategoryFromParent($parent_id, $category->getName());
|
365 |
+
$error_code = $this->getErrorCode($response);
|
366 |
+
|
367 |
+
if ($error_code) {
|
368 |
+
throw new Exception("Failed to Sync Category [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
369 |
+
}
|
370 |
+
} else {
|
371 |
+
throw new Exception("Failed to Sync Category [{$error_code}]: " . $this->getErrorMessage($response), $error_code);
|
372 |
+
}
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
$campaigner_category = $this->initCategory($category, $response);
|
377 |
+
}
|
378 |
+
|
379 |
+
$this->log("syncCategory End");
|
380 |
+
|
381 |
+
return $campaigner_category;
|
382 |
+
}
|
383 |
+
}
|
@@ -17,6 +17,8 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
17 |
const WISHLIST = "WL";
|
18 |
const DEFAULT_AREA = "CA";
|
19 |
const ACTIONS = "AC";
|
|
|
|
|
20 |
|
21 |
const DISABLED_REASON_PREFIX = "Skipping";
|
22 |
|
@@ -40,14 +42,29 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
40 |
protected $_date_format = Campaigner_Integration_Helper_Data::DATE_FORMAT;
|
41 |
|
42 |
private $_areas = array(
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
//"CG" => "Configuration",
|
48 |
-
|
|
|
49 |
);
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
public function validateCredentials($api_username, $api_password, $report_error = false)
|
52 |
{
|
53 |
$filters = Mage::getSingleton('campaigner/wrapper_database')->getAttributeFilters();
|
@@ -66,7 +83,6 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
66 |
try {
|
67 |
$response = Mage::getSingleton('campaigner/wrapper_execute')
|
68 |
->sendCommandDirect($api_username, $api_password, $service, $method, $tag, $filters);
|
69 |
-
|
70 |
} catch (Exception $e) {
|
71 |
$valid = false;
|
72 |
$message = $e->getMessage();
|
@@ -393,9 +409,9 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
393 |
return $store_data;
|
394 |
}
|
395 |
|
396 |
-
public function getLogFileContents()
|
397 |
{
|
398 |
-
$log_file = $this->getLogFilePath();
|
399 |
|
400 |
if (!file_exists($log_file)) {
|
401 |
return "";
|
@@ -412,9 +428,13 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
412 |
return htmlentities(file_get_contents($log_file,false,null,$offset));
|
413 |
}
|
414 |
|
415 |
-
public function getLogFilePath()
|
416 |
{
|
417 |
-
|
|
|
|
|
|
|
|
|
418 |
}
|
419 |
|
420 |
public function getLogFileName()
|
@@ -422,9 +442,9 @@ class Campaigner_Integration_Helper_Troubleshooting extends Mage_Core_Helper_Abs
|
|
422 |
return self::LOG_FILE_NAME . self::LOG_FILE_EXT;
|
423 |
}
|
424 |
|
425 |
-
public function getLogFileSize()
|
426 |
{
|
427 |
-
$log_file = $this->getLogFilePath();
|
428 |
|
429 |
if (file_exists($log_file)) {
|
430 |
return filesize($log_file);
|
17 |
const WISHLIST = "WL";
|
18 |
const DEFAULT_AREA = "CA";
|
19 |
const ACTIONS = "AC";
|
20 |
+
const BACKGROUND = "BG";
|
21 |
+
const COMMERCE = "PB";
|
22 |
|
23 |
const DISABLED_REASON_PREFIX = "Skipping";
|
24 |
|
42 |
protected $_date_format = Campaigner_Integration_Helper_Data::DATE_FORMAT;
|
43 |
|
44 |
private $_areas = array(
|
45 |
+
self::ABANDONED_CART => "Abandoned Carts",
|
46 |
+
self::ORDERS => "Orders",
|
47 |
+
self::NEWSLETTER => "Newsletter",
|
48 |
+
self::CONFIG => "Customer",
|
49 |
//"CG" => "Configuration",
|
50 |
+
self::BACKGROUND => "Background",
|
51 |
+
self::WISHLIST => "Wishlist"
|
52 |
);
|
53 |
|
54 |
+
public function validateApiKey($apikey)
|
55 |
+
{
|
56 |
+
$valid = true;
|
57 |
+
$message = "";
|
58 |
+
$response = Mage::getSingleton('campaigner/wrapper_commerce_execute')->sendCommandDirect($apikey, 'ping');
|
59 |
+
|
60 |
+
if (isset($response->ErrorCode)) {
|
61 |
+
$valid = false;
|
62 |
+
$message = (string) $response->Message;
|
63 |
+
}
|
64 |
+
|
65 |
+
return array('valid' => $valid, 'message' => $message);
|
66 |
+
}
|
67 |
+
|
68 |
public function validateCredentials($api_username, $api_password, $report_error = false)
|
69 |
{
|
70 |
$filters = Mage::getSingleton('campaigner/wrapper_database')->getAttributeFilters();
|
83 |
try {
|
84 |
$response = Mage::getSingleton('campaigner/wrapper_execute')
|
85 |
->sendCommandDirect($api_username, $api_password, $service, $method, $tag, $filters);
|
|
|
86 |
} catch (Exception $e) {
|
87 |
$valid = false;
|
88 |
$message = $e->getMessage();
|
409 |
return $store_data;
|
410 |
}
|
411 |
|
412 |
+
public function getLogFileContents($file = null)
|
413 |
{
|
414 |
+
$log_file = $this->getLogFilePath($file);
|
415 |
|
416 |
if (!file_exists($log_file)) {
|
417 |
return "";
|
428 |
return htmlentities(file_get_contents($log_file,false,null,$offset));
|
429 |
}
|
430 |
|
431 |
+
public function getLogFilePath($file = null)
|
432 |
{
|
433 |
+
if ($file == null) {
|
434 |
+
return Mage::getBaseDir('log') . DS. self::LOG_FILE_NAME . self::LOG_FILE_EXT;
|
435 |
+
}
|
436 |
+
|
437 |
+
return Mage::getBaseDir('log') . DS. $file;
|
438 |
}
|
439 |
|
440 |
public function getLogFileName()
|
442 |
return self::LOG_FILE_NAME . self::LOG_FILE_EXT;
|
443 |
}
|
444 |
|
445 |
+
public function getLogFileSize($file = null)
|
446 |
{
|
447 |
+
$log_file = $this->getLogFilePath($file);
|
448 |
|
449 |
if (file_exists($log_file)) {
|
450 |
return filesize($log_file);
|
@@ -62,6 +62,7 @@ class Campaigner_Integration_Model_Abandoned_Observer extends Campaigner_Integra
|
|
62 |
private function processAbandoned(&$quote)
|
63 |
{
|
64 |
$this->_log("ProcessAbandoned Start");
|
|
|
65 |
$email = $quote->getCustomerEmail();
|
66 |
|
67 |
if ($email == null) {
|
@@ -131,7 +132,7 @@ class Campaigner_Integration_Model_Abandoned_Observer extends Campaigner_Integra
|
|
131 |
|
132 |
// Get the data for each abandoned cart
|
133 |
foreach ($collection as $quote) {
|
134 |
-
$contactData = $this->processAbandoned($quote
|
135 |
|
136 |
$contactList[] = $contactData;
|
137 |
|
@@ -278,11 +279,7 @@ class Campaigner_Integration_Model_Abandoned_Observer extends Campaigner_Integra
|
|
278 |
|
279 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
280 |
|
281 |
-
|
282 |
-
$date = date($this->_date_format, $date);
|
283 |
-
|
284 |
-
$this->_log("Saving Last Cron Run Date: {$date}");
|
285 |
-
$this->_helper->updateConfig("cron_last_run", $date);
|
286 |
|
287 |
$this->_log("Abandoned Carts Processor End");
|
288 |
} catch (Exception $e) {
|
62 |
private function processAbandoned(&$quote)
|
63 |
{
|
64 |
$this->_log("ProcessAbandoned Start");
|
65 |
+
|
66 |
$email = $quote->getCustomerEmail();
|
67 |
|
68 |
if ($email == null) {
|
132 |
|
133 |
// Get the data for each abandoned cart
|
134 |
foreach ($collection as $quote) {
|
135 |
+
$contactData = $this->processAbandoned($quote);
|
136 |
|
137 |
$contactList[] = $contactData;
|
138 |
|
279 |
|
280 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
281 |
|
282 |
+
Mage::helper('campaigner/cron')->setCronLastRun(Campaigner_Integration_Helper_Cron::ABANDONED);
|
|
|
|
|
|
|
|
|
283 |
|
284 |
$this->_log("Abandoned Carts Processor End");
|
285 |
} catch (Exception $e) {
|
@@ -1,40 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Campaigner_Integration_Model_Action_List extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
public function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
$this->_init('campaigner/action_list');
|
9 |
-
}
|
10 |
-
|
11 |
-
public function init($email, $action, $action_data, $customer_id = null)
|
12 |
-
{
|
13 |
-
$this->loadByEmailAndAction($email, $action);
|
14 |
-
|
15 |
-
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
16 |
-
$date = date(Campaigner_Integration_Helper_Data::DATE_FORMAT, $date);
|
17 |
-
|
18 |
-
$data = array(
|
19 |
-
'email' => $email,
|
20 |
-
'customer_id' => $customer_id,
|
21 |
-
'action' => $action,
|
22 |
-
'data' => serialize($action_data),
|
23 |
-
'store_id' => Mage::helper('campaigner')->getCurrentStore(),
|
24 |
-
'created_at' => $date
|
25 |
-
);
|
26 |
-
|
27 |
-
$this->addData($data);
|
28 |
-
|
29 |
-
return $this;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function loadByEmailAndAction($email, $action)
|
33 |
-
{
|
34 |
-
if ($data = $this->getResource()->loadByEmailAndAction($email, $action)) {
|
35 |
-
$this->addData($data);
|
36 |
-
return $this;
|
37 |
-
}
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Campaigner_Integration_Model_Action_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
-
{
|
5 |
-
public function processActions()
|
6 |
-
{
|
7 |
-
try {
|
8 |
-
$order_helper = Mage::helper('campaigner/order');
|
9 |
-
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ACTIONS);
|
10 |
-
$this->_log("processActions Start");
|
11 |
-
|
12 |
-
$this->_log("processActions End");
|
13 |
-
} catch (Exception $e) {
|
14 |
-
Mage::logException($e);
|
15 |
-
$this->_logException($e);
|
16 |
-
}
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Background_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
private $_task_status = array();
|
6 |
+
|
7 |
+
private function mergeCustomAttributes(&$older, &$newer)
|
8 |
+
{
|
9 |
+
$merged = $older;
|
10 |
+
foreach ($newer as $newAttribute) {
|
11 |
+
$found = false;
|
12 |
+
foreach ($merged as &$oldAttribute) {
|
13 |
+
if ($oldAttribute['Id'] == $newAttribute['Id']) {
|
14 |
+
$found = true;
|
15 |
+
$oldAttribute['_'] = $newAttribute['_'];
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
if (!$found) {
|
20 |
+
$merged[] = $newAttribute;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
return $merged;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function mergeContactData(&$older, &$newer)
|
28 |
+
{
|
29 |
+
$merged = $older;
|
30 |
+
|
31 |
+
foreach ($newer as $key => &$value) {
|
32 |
+
if ($key == "CustomAttributes") {
|
33 |
+
$merged[$key] = $this->mergeCustomAttributes($merged[$key],$value);
|
34 |
+
} else if (is_array($value) && isset($merged[$key])) {// && is_array($merged[$key]))
|
35 |
+
$merged[$key] = $this->mergeContactData($merged[$key], $value);
|
36 |
+
} else {
|
37 |
+
$merged[$key] = $value;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
return $merged;
|
42 |
+
}
|
43 |
+
|
44 |
+
private function mergeTasks($collection)
|
45 |
+
{
|
46 |
+
$tasks = array();
|
47 |
+
$taskList = array();
|
48 |
+
|
49 |
+
foreach ($collection as $task) {
|
50 |
+
$task = Mage::getModel('campaigner/background_task')->load($task->getId());
|
51 |
+
|
52 |
+
$email = $task->getEmail();
|
53 |
+
|
54 |
+
if (!isset($taskList[$email])) {
|
55 |
+
$taskList[$email] = array();
|
56 |
+
}
|
57 |
+
|
58 |
+
$taskList[$email][] = $task->getId();
|
59 |
+
|
60 |
+
if (isset($tasks[$email])) {
|
61 |
+
$details = $task->getDetails();
|
62 |
+
$tasks[$email] = $this->mergeContactData($tasks[$email], $details);
|
63 |
+
} else {
|
64 |
+
$tasks[$email] = $task->getDetails();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
$contactData = array();
|
69 |
+
|
70 |
+
foreach ($tasks as $task) {
|
71 |
+
$contactData[] = $task;
|
72 |
+
}
|
73 |
+
|
74 |
+
$response = array(
|
75 |
+
"contactData" => $contactData,
|
76 |
+
"taskList" => $taskList
|
77 |
+
);
|
78 |
+
|
79 |
+
return $response;
|
80 |
+
}
|
81 |
+
|
82 |
+
private function _taskProcessor($collection, $store = null, $mark_time = true)
|
83 |
+
{
|
84 |
+
$response = null;
|
85 |
+
// Store the time we last run
|
86 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
87 |
+
$date = date($this->_date_format, $date);
|
88 |
+
|
89 |
+
if ($mark_time) {
|
90 |
+
$this->_log("Saving Last Run Date: {$date}");
|
91 |
+
$this->_helper->updateConfig("background_task_last_run", $date, $store);
|
92 |
+
}
|
93 |
+
|
94 |
+
if ($collection->getSize() == 0) {
|
95 |
+
$this->_log("No Tasks found.");
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$taskData = $this->mergeTasks($collection);
|
100 |
+
|
101 |
+
$this->_log("Sending Background Tasks");
|
102 |
+
|
103 |
+
try {
|
104 |
+
$details = Mage::getSingleton('campaigner/wrapper_subscribers')->massUpdate($taskData['contactData']);
|
105 |
+
} catch (Campaigner_Integration_Model_Wrapper_Exception $e) {
|
106 |
+
$this->_logException($e);
|
107 |
+
$details = $e->getDetails();
|
108 |
+
$this->_log($details);
|
109 |
+
}
|
110 |
+
|
111 |
+
$this->_log("Updating status of background tasks Start");
|
112 |
+
|
113 |
+
$this->updateBackgroundTasks($taskData['taskList'],$details, $date);
|
114 |
+
|
115 |
+
$this->_log("Updating status of background tasks End");
|
116 |
+
}
|
117 |
+
|
118 |
+
private function updateTask($taskId, $date, $status = null)
|
119 |
+
{
|
120 |
+
try {
|
121 |
+
$task = Mage::getModel("campaigner/background_task")->load($taskId);
|
122 |
+
|
123 |
+
if (!$task) {
|
124 |
+
throw new Exception("Failed to load task during update.", 1);
|
125 |
+
}
|
126 |
+
|
127 |
+
if ($status != null) {
|
128 |
+
$this->_task_status[$taskId] = array('success' => false, 'status' => $status);
|
129 |
+
$task->setStatus($status);
|
130 |
+
} else {
|
131 |
+
$this->_task_status[$taskId] = array('success' => true);
|
132 |
+
$task->setDateSent($date);
|
133 |
+
$task->setStatus("");
|
134 |
+
}
|
135 |
+
$task->save();
|
136 |
+
} catch (Exception $e) {
|
137 |
+
Mage::logException($e);
|
138 |
+
$this->_logException($e);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
private function updateTasks($taskList, $date, $status = null)
|
143 |
+
{
|
144 |
+
foreach ($taskList as $taskId) {
|
145 |
+
$this->updateTask($taskId, $date, $status);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
private function updateBackgroundTasks($tasks, $details, $date)
|
150 |
+
{
|
151 |
+
$results = $details->UploadResultData;
|
152 |
+
|
153 |
+
if (!is_array($results)) {
|
154 |
+
$results = array($results);
|
155 |
+
}
|
156 |
+
|
157 |
+
foreach ($results as $result) {
|
158 |
+
$email = $result->ContactKey->ContactUniqueIdentifier;
|
159 |
+
|
160 |
+
$taskList = $tasks[$email];
|
161 |
+
|
162 |
+
$resultCode = $result->ResultCode;
|
163 |
+
$resultDescription = $result->ResultDescription;
|
164 |
+
|
165 |
+
if ($resultCode == "Success") {
|
166 |
+
$this->updateTasks($taskList, $date);
|
167 |
+
} else {
|
168 |
+
$status = $resultCode;
|
169 |
+
|
170 |
+
if ($resultDescription != "") {
|
171 |
+
$status = "{$status} ({$resultDescription})";
|
172 |
+
}
|
173 |
+
$this->updateTasks($taskList, $date, $status);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
public function backgroundTaskStoreProcessor($store)
|
179 |
+
{
|
180 |
+
$store_code = $store->getCode();
|
181 |
+
|
182 |
+
$this->_log("Processing Store: {$store_code}");
|
183 |
+
|
184 |
+
if (!$this->_helper->isBackgroundEnabled()) {
|
185 |
+
$this->_logReason("Sending Background Tasks is disabled");
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
Mage::helper('campaigner/fields')->verifyFields();
|
190 |
+
|
191 |
+
// Get Background Task collection
|
192 |
+
$collection = Mage::getResourceModel('campaigner/background_task_collection');
|
193 |
+
|
194 |
+
$collection->prepareForBackgroundProcess($store->getId());
|
195 |
+
|
196 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
197 |
+
|
198 |
+
$this->_taskProcessor($collection, $store->getId());
|
199 |
+
|
200 |
+
$this->_log("Finished Processing Store: {$store_code}");
|
201 |
+
}
|
202 |
+
|
203 |
+
public function processBackgroundTasks()
|
204 |
+
{
|
205 |
+
try {
|
206 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
207 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::BACKGROUND);
|
208 |
+
$this->_log("Background Task Processor Start");
|
209 |
+
|
210 |
+
$stores = Mage::app()->getStores();
|
211 |
+
|
212 |
+
foreach ($stores as $store) {
|
213 |
+
Mage::app()->setCurrentStore($store->getCode());
|
214 |
+
|
215 |
+
$this->backgroundTaskStoreProcessor($store);
|
216 |
+
}
|
217 |
+
|
218 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
219 |
+
|
220 |
+
Mage::helper('campaigner/cron')->setCronLastRun(Campaigner_Integration_Helper_Cron::BACKGROUND);
|
221 |
+
|
222 |
+
$this->_log("Background Task Processor End");
|
223 |
+
} catch (Exception $e) {
|
224 |
+
Mage::logException($e);
|
225 |
+
$this->_logException($e);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
public function manualBackgroundTaskProcessor($store_id = null)
|
230 |
+
{
|
231 |
+
try {
|
232 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
233 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::BACKGROUND);
|
234 |
+
$this->_log("Manual Background Task Processor Start");
|
235 |
+
|
236 |
+
$stores = Mage::app()->getStores();
|
237 |
+
|
238 |
+
foreach ($stores as $store) {
|
239 |
+
if ($store_id == null || $store_id == $store->getId()) {
|
240 |
+
Mage::app()->setCurrentStore($store->getCode());
|
241 |
+
|
242 |
+
$this->backgroundTaskStoreProcessor($store);
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
247 |
+
|
248 |
+
$this->_log("Manual Background Task Processor End");
|
249 |
+
} catch (Exception $e) {
|
250 |
+
Mage::logException($e);
|
251 |
+
$this->_logException($e);
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
public function sendBackgroundTasks($id_list)
|
256 |
+
{
|
257 |
+
$count = 0;
|
258 |
+
$this->_task_status = array();
|
259 |
+
|
260 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
261 |
+
|
262 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::BACKGROUND);
|
263 |
+
$this->_log("Sending Specific Background Tasks Start");
|
264 |
+
|
265 |
+
Mage::helper('campaigner/fields')->verifyFields();
|
266 |
+
|
267 |
+
$this->_log($id_list, "ID LIST");
|
268 |
+
|
269 |
+
$stores = Mage::app()->getStores();
|
270 |
+
|
271 |
+
foreach ($stores as $store) {
|
272 |
+
Mage::app()->setCurrentStore($store->getCode());
|
273 |
+
$this->_log("Checking for valid tasks in store: {$store->getName()} ({$store->getId()})");
|
274 |
+
if (!$this->_helper->isBackgroundEnabled()) {
|
275 |
+
$this->_log('Background Tasks not enabled...');
|
276 |
+
continue;
|
277 |
+
}
|
278 |
+
|
279 |
+
// Get abandoned collection
|
280 |
+
$collection = Mage::getResourceModel('campaigner/background_task_collection');
|
281 |
+
|
282 |
+
$collection->prepareForManualProcess($id_list, $store->getId());
|
283 |
+
|
284 |
+
$count += count($collection);
|
285 |
+
|
286 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
287 |
+
|
288 |
+
$this->_taskProcessor($collection, $store, false);
|
289 |
+
}
|
290 |
+
|
291 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
292 |
+
|
293 |
+
$this->_log("Sending Specific Tasks Orders End");
|
294 |
+
|
295 |
+
return $this->_task_status;
|
296 |
+
}
|
297 |
+
|
298 |
+
public function processPendingTasks($email, $storeId = null)
|
299 |
+
{
|
300 |
+
$currentStore = null;
|
301 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::BACKGROUND);
|
302 |
+
$this->_log("Process Pending Tasks Start ({$email}) [{$storeId}]");
|
303 |
+
|
304 |
+
if (($storeId != null) && ($currentStore->getId() != $storeId)) {
|
305 |
+
$currentStore = Mage::app()->getStore();
|
306 |
+
Mage::app()->setCurrentStore($storeId);
|
307 |
+
}
|
308 |
+
|
309 |
+
$store = Mage::app()->getStore();
|
310 |
+
|
311 |
+
if (!$this->_helper->isBackgroundEnabled()) {
|
312 |
+
$this->_log('Background Tasks not enabled...');
|
313 |
+
return;
|
314 |
+
}
|
315 |
+
|
316 |
+
$this->_log("Checking for valid tasks in store: {$store->getName()} ({$store->getId()})");
|
317 |
+
|
318 |
+
$collection = Mage::getResourceModel('campaigner/background_task_collection');
|
319 |
+
|
320 |
+
$collection->prepareForPendingProcess($email, $store->getId());
|
321 |
+
|
322 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
323 |
+
|
324 |
+
$this->_taskProcessor($collection, $store, false);
|
325 |
+
|
326 |
+
if ($storeId != null) {
|
327 |
+
Mage::app()->setCurrentStore($currentStore->getCode());
|
328 |
+
}
|
329 |
+
|
330 |
+
$this->_log("Process Pending Tasks Orders End");
|
331 |
+
}
|
332 |
+
|
333 |
+
}
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Background_Task extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('campaigner/background_task');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function init($email, $code, $task_data, $store_id = null, $customer_id = null)
|
12 |
+
{
|
13 |
+
if ($store_id == null) {
|
14 |
+
$store_id = Mage::helper('campaigner')->getCurrentStore();
|
15 |
+
}
|
16 |
+
|
17 |
+
if ($customer_id == null) {
|
18 |
+
$customer_id = Mage::helper('campaigner')->getCurrentCustomerId();
|
19 |
+
}
|
20 |
+
|
21 |
+
$this->loadByEmailAndCode($email, $code, $store_id);
|
22 |
+
|
23 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
24 |
+
$date = date(Campaigner_Integration_Helper_Data::DATE_FORMAT, $date);
|
25 |
+
|
26 |
+
$data = array(
|
27 |
+
'email' => $email,
|
28 |
+
'customer_id' => $customer_id,
|
29 |
+
'store_id' => $store_id,
|
30 |
+
'code' => $code,
|
31 |
+
'details' => $task_data,
|
32 |
+
'store_id' => Mage::helper('campaigner')->getCurrentStore(),
|
33 |
+
'created_at' => $date
|
34 |
+
);
|
35 |
+
|
36 |
+
$this->addData($data);
|
37 |
+
|
38 |
+
$this->save();
|
39 |
+
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function loadByEmailAndCode($email, $code, $store_id)
|
44 |
+
{
|
45 |
+
if ($data = $this->getResource()->loadByEmailAndCode($email, $code, $store_id)) {
|
46 |
+
$this->addData($data);
|
47 |
+
return $this;
|
48 |
+
}
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
protected function _afterLoad()
|
53 |
+
{
|
54 |
+
$details = unserialize($this->getDetails());
|
55 |
+
|
56 |
+
$this->setData('details', $details);
|
57 |
+
|
58 |
+
return parent::_afterLoad();
|
59 |
+
}
|
60 |
+
|
61 |
+
protected function _beforeSave()
|
62 |
+
{
|
63 |
+
$details = serialize($this->getDetails());
|
64 |
+
|
65 |
+
$this->setData('details', $details);
|
66 |
+
|
67 |
+
return parent::_beforeSave();
|
68 |
+
}
|
69 |
+
}
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Category extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('campaigner/category');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function loadByCampaignerId($campaigner_id)
|
12 |
+
{
|
13 |
+
try {
|
14 |
+
if ($data = $this->getResource()->loadByCampaignerId($campaigner_id)) {
|
15 |
+
$this->addData($data);
|
16 |
+
} else {
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
} catch (Exception $e) {
|
20 |
+
Mage::logException($e);
|
21 |
+
Mage::helper('campaigner')->logException($e);
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function init($category, $campaigner_id)
|
28 |
+
{
|
29 |
+
if ($campaigner_id == 0) {
|
30 |
+
throw new Exception("Campaigner ID not found", 1);
|
31 |
+
}
|
32 |
+
|
33 |
+
try {
|
34 |
+
$id = $category->getId();
|
35 |
+
|
36 |
+
$this->load($id);
|
37 |
+
|
38 |
+
if (!$this->getId()) {
|
39 |
+
$this->setId($id);
|
40 |
+
$this->setParentId($category->getParentId());
|
41 |
+
$this->setCampaignerId($campaigner_id);
|
42 |
+
$this->save();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
catch (Exception $e) {
|
46 |
+
Mage::helper('campaigner/troubleshooting')->logException($e);
|
47 |
+
Mage::logException($e);
|
48 |
+
}
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
}
|
@@ -2,28 +2,62 @@
|
|
2 |
|
3 |
class Campaigner_Integration_Model_Configuration_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
-
|
|
|
|
|
|
|
6 |
{
|
7 |
-
$
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
if ($api_username == '' || $api_password == '') {
|
18 |
$this->_helper->updateConfig('setup', 0, $store);
|
19 |
$this->_helper->updateConfig('active', false, $store);
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
$old_username = $
|
24 |
-
$old_password = $
|
25 |
|
26 |
-
//
|
27 |
|
28 |
$result = Mage::helper('campaigner/troubleshooting')->validateCredentials($api_username, $api_password);
|
29 |
|
@@ -36,11 +70,83 @@ class Campaigner_Integration_Model_Configuration_Observer extends Campaigner_Int
|
|
36 |
|
37 |
$this->_helper->enableCampaigner($store);
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// Verify all custom fields are present
|
45 |
Mage::helper('campaigner/fields')->verifyFields($force_product);
|
46 |
|
2 |
|
3 |
class Campaigner_Integration_Model_Configuration_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
{
|
5 |
+
private $_fields = null;
|
6 |
+
private $_commerce_fields = null;
|
7 |
+
|
8 |
+
protected function transferFromEmailDirect()
|
9 |
{
|
10 |
+
$transferMap = array(
|
11 |
+
'checkout_subscribe',
|
12 |
+
'lastlogin_enabled',
|
13 |
+
'save_latest_order',
|
14 |
+
'store_send_type',
|
15 |
+
'wishlist_enabled',
|
16 |
+
array('sendabandoned', 'abandoned_enabled'),
|
17 |
+
'abandonedtime',
|
18 |
+
'capture_enabled',
|
19 |
+
'abandonedsequence_enabled',
|
20 |
+
'abandonedsequence_options',
|
21 |
+
'signup_delay',
|
22 |
+
'signup_recurrence',
|
23 |
+
'signup_width',
|
24 |
+
'signup_height',
|
25 |
+
'signup_opacity'
|
26 |
+
);
|
27 |
|
28 |
+
foreach ($transferMap as $map) {
|
29 |
+
$from = $map;
|
30 |
+
$to = $map;
|
31 |
+
if (is_array($map)) {
|
32 |
+
$from = $map[0];
|
33 |
+
$to = $map[1];
|
34 |
+
}
|
35 |
|
36 |
+
$value = Mage::helper('emaildirect')->config($from);
|
37 |
+
|
38 |
+
if ($value != null && $value != '') {
|
39 |
+
Mage::helper('campaigner')->updateConfig($to,$value);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
private function validateApiCredentials($store)
|
45 |
+
{
|
46 |
+
$api_username = $this->getField('api_username',$this->_helper->config('api_username'));
|
47 |
+
$api_password = $this->getField('api_password',$this->_helper->config('api_password'));
|
48 |
|
49 |
if ($api_username == '' || $api_password == '') {
|
50 |
$this->_helper->updateConfig('setup', 0, $store);
|
51 |
$this->_helper->updateConfig('active', false, $store);
|
52 |
+
$this->_helper->updateConfig('setup', 0, $store, "commerce");
|
53 |
+
$this->_helper->updateConfig('enabled', 0, $store, "commerce");
|
54 |
+
return false;
|
55 |
}
|
56 |
|
57 |
+
$old_username = $this->getField('old_api_username', "");
|
58 |
+
$old_password = $this->getField('old_api_password', "");
|
59 |
|
60 |
+
// Do we want to only do the validation when the old and new are different?
|
61 |
|
62 |
$result = Mage::helper('campaigner/troubleshooting')->validateCredentials($api_username, $api_password);
|
63 |
|
70 |
|
71 |
$this->_helper->enableCampaigner($store);
|
72 |
|
73 |
+
// -----------
|
74 |
+
// API Key
|
75 |
+
|
76 |
+
$apikey = $this->getCommerceField('apikey', $this->_helper->commerceConfig('apikey'));
|
77 |
+
|
78 |
+
if ($apikey != "") {
|
79 |
+
$response = Mage::helper('campaigner/troubleshooting')->validateApiKey($apikey);
|
80 |
+
|
81 |
+
if ($response['valid'] == false) {
|
82 |
+
$message = "Purchase Behavior Targeting error: {$response['message']}";
|
83 |
+
$this->_logger->log($message);
|
84 |
+
$this->_helper->updateConfig('setup', 0, $store, "commerce");
|
85 |
+
$this->_helper->updateConfig('enabled', 0, $store, "commerce");
|
86 |
+
Mage::getSingleton('adminhtml/session')->addWarning($message);
|
87 |
+
} else {
|
88 |
+
$this->_helper->updateConfig('setup', 1, $store, "commerce");
|
89 |
+
//$this->_helper->updateConfig('enabled', 1, $store, "commerce");
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
$this->_helper->updateConfig('setup', 0, $store, "commerce");
|
93 |
+
$this->_helper->updateConfig('enabled', 0, $store, "commerce");
|
94 |
+
}
|
95 |
+
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
|
99 |
+
private function getFields($type = 'general')
|
100 |
+
{
|
101 |
+
$post = Mage::app()->getRequest()->getPost();
|
102 |
+
|
103 |
+
if (isset($post['groups'][$type]['fields'])) {
|
104 |
+
return $post['groups'][$type]['fields'];
|
105 |
+
}
|
106 |
+
|
107 |
+
return null;
|
108 |
+
}
|
109 |
+
|
110 |
+
private function getField($name, $default = "")
|
111 |
+
{
|
112 |
+
if ($this->_fields == null || !isset($this->_fields[$name])) {
|
113 |
+
return $default;
|
114 |
+
}
|
115 |
+
|
116 |
+
return $this->_fields[$name]['value'];
|
117 |
+
}
|
118 |
+
|
119 |
+
private function getCommerceField($name, $default = "")
|
120 |
+
{
|
121 |
+
if ($this->_commerce_fields == null || !isset($this->_commerce_fields[$name])) {
|
122 |
+
return $default;
|
123 |
+
}
|
124 |
+
|
125 |
+
return $this->_commerce_fields[$name]['value'];
|
126 |
+
}
|
127 |
+
|
128 |
+
public function saveConfig(Varien_Event_Observer $observer)
|
129 |
+
{
|
130 |
+
$this->_logger->setLogArea(Campaigner_Integration_Helper_Troubleshooting::CONFIG);
|
131 |
+
$this->_logger->setLogLevel(Campaigner_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
132 |
+
|
133 |
+
$store = $this->_helper->getStoreId($observer->getEvent()->getStore());
|
134 |
+
$this->_fields = $this->getFields();
|
135 |
+
$this->_commerce_fields = $this->getFields('commerce');
|
136 |
+
|
137 |
+
if ($this->getField('emaildirect_transfer',0)) {
|
138 |
+
|
139 |
+
//isset($fields['emaildirect_transfer']['value']) && $fields['emaildirect_transfer']['value'] == '1') {
|
140 |
+
$this->transferFromEmailDirect();
|
141 |
}
|
142 |
|
143 |
+
if (!$this->validateApiCredentials($store)) {
|
144 |
+
// Invalid Credentials, stop further processing
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
$force_product = $this->getField('save_latest_order', false);
|
149 |
+
|
150 |
// Verify all custom fields are present
|
151 |
Mage::helper('campaigner/fields')->verifyFields($force_product);
|
152 |
|
@@ -114,7 +114,7 @@ class Campaigner_Integration_Model_Customer_Observer extends Campaigner_Integrat
|
|
114 |
} break;
|
115 |
case "hardbounce": {
|
116 |
$url = Mage::getUrl('customer/account/edit');
|
117 |
-
$email = $session->getCustomer()->getEmail();
|
118 |
$notice = "We've been unable to reach you at {$email}. Please <a href='{$url}'>update</a> your email address.";
|
119 |
$session->addNotice($notice);
|
120 |
} break;
|
@@ -251,9 +251,8 @@ class Campaigner_Integration_Model_Customer_Observer extends Campaigner_Integrat
|
|
251 |
$this->resetLocalStatus($customer);
|
252 |
} else {
|
253 |
$this->_log("Status was not Hard Bounced so just update");
|
254 |
-
$api->
|
255 |
}
|
256 |
-
|
257 |
} else {
|
258 |
if ($this->hasCustomerChanged($customer)) {
|
259 |
$this->_log("Updating Subscriber");
|
114 |
} break;
|
115 |
case "hardbounce": {
|
116 |
$url = Mage::getUrl('customer/account/edit');
|
117 |
+
$email = Mage::helper('core')->escapeHtml($session->getCustomer()->getEmail());
|
118 |
$notice = "We've been unable to reach you at {$email}. Please <a href='{$url}'>update</a> your email address.";
|
119 |
$session->addNotice($notice);
|
120 |
} break;
|
251 |
$this->resetLocalStatus($customer);
|
252 |
} else {
|
253 |
$this->_log("Status was not Hard Bounced so just update");
|
254 |
+
$api->changeEmail($customer, false);
|
255 |
}
|
|
|
256 |
} else {
|
257 |
if ($this->hasCustomerChanged($customer)) {
|
258 |
$this->_log("Updating Subscriber");
|
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Campaigner_Integration_Model_Mysql4_Action_List_Collection extends Mage_Sales_Model_Mysql4_Quote_Collection
|
4 |
-
{
|
5 |
-
protected function _construct()
|
6 |
-
{
|
7 |
-
parent::_construct();
|
8 |
-
}
|
9 |
-
|
10 |
-
public function filterByQuoteId($quote_id)
|
11 |
-
{
|
12 |
-
$this->prepareCollection(array());
|
13 |
-
$this->getSelect()->where("quote_id = {$quote_id}");
|
14 |
-
|
15 |
-
return $this;
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,23 +1,24 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected $_read = null;
|
6 |
protected $_write = null;
|
7 |
|
8 |
protected function _construct()
|
9 |
{
|
10 |
-
$this->_init('campaigner/
|
11 |
$this->_read = $this->_getReadAdapter();
|
12 |
$this->_write = $this->_getWriteAdapter();
|
13 |
}
|
14 |
|
15 |
-
public function
|
16 |
{
|
17 |
$select = $this->_read->select()
|
18 |
-
->from($this->getTable('campaigner/
|
19 |
->where('email=?', $email)
|
20 |
-
->where('
|
|
|
21 |
->where('date_sent IS NULL')
|
22 |
->where('status IS NULL');
|
23 |
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Background_Task extends Mage_Core_Model_Mysql4_Abstract
|
4 |
{
|
5 |
protected $_read = null;
|
6 |
protected $_write = null;
|
7 |
|
8 |
protected function _construct()
|
9 |
{
|
10 |
+
$this->_init('campaigner/background_task', 'id');
|
11 |
$this->_read = $this->_getReadAdapter();
|
12 |
$this->_write = $this->_getWriteAdapter();
|
13 |
}
|
14 |
|
15 |
+
public function loadByEmailAndCode($email, $code, $store_id)
|
16 |
{
|
17 |
$select = $this->_read->select()
|
18 |
+
->from($this->getTable('campaigner/background_task'))
|
19 |
->where('email=?', $email)
|
20 |
+
->where('code=?', $code)
|
21 |
+
->where('store_id=?',$store_id)
|
22 |
->where('date_sent IS NULL')
|
23 |
->where('status IS NULL');
|
24 |
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Background_Task_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('campaigner/background_task');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function filterByQuoteId($quote_id)
|
11 |
+
{
|
12 |
+
$this->prepareCollection(array());
|
13 |
+
$this->getSelect()->where("quote_id = {$quote_id}");
|
14 |
+
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function prepareCollection($store_ids = '')
|
19 |
+
{
|
20 |
+
$resource = Mage::getSingleton('core/resource');
|
21 |
+
|
22 |
+
if (is_array($store_ids) && !empty($store_ids)) {
|
23 |
+
$this->addFieldToFilter('main_table.store_id', array('in' => $store_ids));
|
24 |
+
}
|
25 |
+
|
26 |
+
$this->getSelect()->order('created_at ASC');
|
27 |
+
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
+
|
31 |
+
public function prepareForBackgroundProcess($store_id = null)
|
32 |
+
{
|
33 |
+
$store_ids = array($store_id);
|
34 |
+
|
35 |
+
$this->prepareCollection($store_ids);
|
36 |
+
|
37 |
+
$this->addFieldToFilter('date_sent',array('null' => true));
|
38 |
+
$this->addFieldToFilter('status',array('null' => true));
|
39 |
+
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function prepareForManualProcess($id_list, $store_id = null)
|
44 |
+
{
|
45 |
+
$store_ids = array($store_id);
|
46 |
+
|
47 |
+
$this->prepareCollection($store_ids);
|
48 |
+
|
49 |
+
$this->addFieldToFilter('id', array('in' => $id_list))
|
50 |
+
->setOrder('created_at');
|
51 |
+
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function prepareForPendingProcess($email, $store_id = null)
|
56 |
+
{
|
57 |
+
$store_ids = array($store_id);
|
58 |
+
|
59 |
+
$this->prepareCollection($store_ids);
|
60 |
+
|
61 |
+
$this->addFieldToFilter('email', array('eq' => $email))
|
62 |
+
->setOrder('created_at');
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
protected $_read = null;
|
6 |
+
protected $_write = null;
|
7 |
+
protected $_isPkAutoIncrement = false;
|
8 |
+
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('campaigner/category', 'id');
|
12 |
+
$this->_read = $this->_getReadAdapter();
|
13 |
+
$this->_write = $this->_getWriteAdapter();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function loadByCampaignerId($campaigner_id)
|
17 |
+
{
|
18 |
+
$select = $this->_read->select()
|
19 |
+
->from($this->getTable('campaigner/category'))
|
20 |
+
->where('campaigner_id=?', $campaigner_id);
|
21 |
+
|
22 |
+
if ($result = $this->_read->fetchRow($select)) {
|
23 |
+
return $result;
|
24 |
+
}
|
25 |
+
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
}
|
@@ -14,7 +14,7 @@ class Campaigner_Integration_Model_Mysql4_Order_Collection extends Mage_Sales_Mo
|
|
14 |
{
|
15 |
$resource = Mage::getSingleton('core/resource');
|
16 |
|
17 |
-
$this->getSelect()->joinLeft(array('
|
18 |
'date_sent' => "date_sent"
|
19 |
));
|
20 |
|
@@ -27,14 +27,45 @@ class Campaigner_Integration_Model_Mysql4_Order_Collection extends Mage_Sales_Mo
|
|
27 |
return $this;
|
28 |
}
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
private function stateStatusFilter()
|
31 |
{
|
32 |
-
$mode = $this->_helper->
|
33 |
|
34 |
if ($mode == "state") {
|
35 |
-
$options = $this->_helper->
|
36 |
} else {
|
37 |
-
$options = $this->_helper->
|
38 |
}
|
39 |
|
40 |
$option_list = explode(",",$options);
|
@@ -80,4 +111,55 @@ class Campaigner_Integration_Model_Mysql4_Order_Collection extends Mage_Sales_Mo
|
|
80 |
|
81 |
return $this;
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
14 |
{
|
15 |
$resource = Mage::getSingleton('core/resource');
|
16 |
|
17 |
+
$this->getSelect()->joinLeft(array('camp_order' => $resource->getTableName("campaigner/order")),"camp_order.order_id=main_table.entity_id",array(
|
18 |
'date_sent' => "date_sent"
|
19 |
));
|
20 |
|
27 |
return $this;
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* Prepare for report
|
32 |
+
*
|
33 |
+
* @param array $store_ids
|
34 |
+
* @param string $filter
|
35 |
+
* @param bool $show_all
|
36 |
+
* @return Mage_Reports_Model_Resource_Quote_Collection
|
37 |
+
*/
|
38 |
+
public function prepareForReport($store_ids, $filter = null, $show_all = false)
|
39 |
+
{
|
40 |
+
$this->prepareCollection($store_ids);
|
41 |
+
|
42 |
+
if ($show_all == false) {
|
43 |
+
$mode = $this->_helper->commerceConfig('send_field');
|
44 |
+
|
45 |
+
if ($mode == 'state') {
|
46 |
+
$states = $this->_helper->commerceConfig('send_states');
|
47 |
+
$state_list = explode(",",$states);
|
48 |
+
$this->addAttributeToFilter('state', array('in' => $state_list));
|
49 |
+
} else {
|
50 |
+
$statuses = $this->_helper->commerceConfig('send_statuses');
|
51 |
+
$status_list = explode(",",$statuses);
|
52 |
+
$this->addAttributeToFilter('status', array('in' => $status_list));
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->addSubtotal($store_ids, $filter);
|
57 |
+
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
private function stateStatusFilter()
|
62 |
{
|
63 |
+
$mode = $this->_helper->commerceConfig('send_field');
|
64 |
|
65 |
if ($mode == "state") {
|
66 |
+
$options = $this->_helper->commerceConfig('send_states');
|
67 |
} else {
|
68 |
+
$options = $this->_helper->commerceConfig('send_statuses');
|
69 |
}
|
70 |
|
71 |
$option_list = explode(",",$options);
|
111 |
|
112 |
return $this;
|
113 |
}
|
114 |
+
|
115 |
+
public function prepareForManualProcess($id_list, $store_id)
|
116 |
+
{
|
117 |
+
$store_ids = array($store_id);
|
118 |
+
|
119 |
+
$this->prepareCollection($store_ids);
|
120 |
+
|
121 |
+
$this->addFieldToFilter('entity_id', array('in' => $id_list))
|
122 |
+
->setOrder('updated_at');
|
123 |
+
|
124 |
+
return $this;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Add subtotals
|
129 |
+
*
|
130 |
+
* @param array $store_ids
|
131 |
+
* @param array $filter
|
132 |
+
* @return Mage_Reports_Model_Resource_Quote_Collection
|
133 |
+
*/
|
134 |
+
public function addSubtotal($store_ids = '', $filter = null)
|
135 |
+
{
|
136 |
+
if (is_array($store_ids)) {
|
137 |
+
$this->getSelect()->columns(array(
|
138 |
+
'subtotal' => '(main_table.base_subtotal*main_table.base_to_global_rate)'
|
139 |
+
));
|
140 |
+
$this->_joinedFields['subtotal'] =
|
141 |
+
'(main_table.base_subtotal*main_table.base_to_global_rate)';
|
142 |
+
} else {
|
143 |
+
$this->getSelect()->columns(array('subtotal' => 'main_table.base_subtotal'));
|
144 |
+
$this->_joinedFields['subtotal'] = 'main_table.base_subtotal';
|
145 |
+
}
|
146 |
+
|
147 |
+
if ($filter && is_array($filter) && isset($filter['subtotal'])) {
|
148 |
+
if (isset($filter['subtotal']['from'])) {
|
149 |
+
$this->getSelect()->where(
|
150 |
+
$this->_joinedFields['subtotal'] . ' >= ?',
|
151 |
+
$filter['subtotal']['from'], Zend_Db::FLOAT_TYPE
|
152 |
+
);
|
153 |
+
}
|
154 |
+
if (isset($filter['subtotal']['to'])) {
|
155 |
+
$this->getSelect()->where(
|
156 |
+
$this->_joinedFields['subtotal'] . ' <= ?',
|
157 |
+
$filter['subtotal']['to'], Zend_Db::FLOAT_TYPE
|
158 |
+
);
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
return $this;
|
163 |
+
}
|
164 |
+
|
165 |
}
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Product extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
protected $_read = null;
|
6 |
+
protected $_write = null;
|
7 |
+
protected $_isPkAutoIncrement = false;
|
8 |
+
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('campaigner/product', 'id');
|
12 |
+
$this->_read = $this->_getReadAdapter();
|
13 |
+
$this->_write = $this->_getWriteAdapter();
|
14 |
+
}
|
15 |
+
|
16 |
+
public function loadByCampaignerId($campaigner_id)
|
17 |
+
{
|
18 |
+
$select = $this->_read->select()
|
19 |
+
->from($this->getTable('campaigner/category'))
|
20 |
+
->where('campaigner_id=?', $campaigner_id);
|
21 |
+
|
22 |
+
if ($result = $this->_read->fetchRow($select)) {
|
23 |
+
return $result;
|
24 |
+
}
|
25 |
+
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
}
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Product_Category_Action extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
protected $_read = null;
|
6 |
+
protected $_write = null;
|
7 |
+
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->_init('campaigner/product_category_action', 'id');
|
11 |
+
$this->_read = $this->_getReadAdapter();
|
12 |
+
$this->_write = $this->_getWriteAdapter();
|
13 |
+
}
|
14 |
+
|
15 |
+
public function loadByProductId($product_id)
|
16 |
+
{
|
17 |
+
$select = $this->_read->select()
|
18 |
+
->from($this->getTable('campaigner/product_category_action'))
|
19 |
+
->where('product_id=?', $product_id);
|
20 |
+
|
21 |
+
if ($result = $this->_read->fetchRow($select)) {
|
22 |
+
return $result;
|
23 |
+
}
|
24 |
+
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function loadByCategoryId($category_id)
|
29 |
+
{
|
30 |
+
$select = $this->_read->select()
|
31 |
+
->from($this->getTable('campaigner/product_category_action'))
|
32 |
+
->where('category_id=?', $category_id);
|
33 |
+
|
34 |
+
if ($result = $this->_read->fetchRow($select)) {
|
35 |
+
return $result;
|
36 |
+
}
|
37 |
+
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
}
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Mysql4_Product_Category_Action_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('campaigner/product_category_action');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function prepareForCronProcess()
|
11 |
+
{
|
12 |
+
$this->addFieldToFilter('date_sent',array('null' => true));
|
13 |
+
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function prepareForGrid()
|
18 |
+
{
|
19 |
+
$resource = Mage::getSingleton('core/resource');
|
20 |
+
$this->getSelect()->joinLeft(array('cpe' => $resource->getTableName("catalog/product") ),"cpe.entity_id=main_table.product_id",array(
|
21 |
+
'sku' => "sku"
|
22 |
+
));
|
23 |
+
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
}
|
@@ -1,229 +1,231 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Campaigner_Integration_Model_Newsletter_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Handle Subscriber object saving process
|
7 |
-
*/
|
8 |
-
public function handleSubscriber(Varien_Event_Observer $observer)
|
9 |
-
{
|
10 |
-
try
|
11 |
-
{
|
12 |
-
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::NEWSLETTER);
|
13 |
-
$this->_log('handleSubscriber Start');
|
14 |
-
|
15 |
-
if (!$this->_helper->campaignerEnabled()) {
|
16 |
-
$this->_logReason($this->_helper->getDisabledReason());
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
|
20 |
-
$subscriber = $observer->getEvent()->getSubscriber();
|
21 |
-
$subscriber->setImportMode(false);
|
22 |
-
|
23 |
-
$customer = Mage::getModel('customer/customer');
|
24 |
-
|
25 |
-
if ($subscriber->getCustomerId() != 0) {
|
26 |
-
$customer->load($subscriber->getCustomerId());
|
27 |
-
}
|
28 |
-
|
29 |
-
$email = $subscriber->getSubscriberEmail();
|
30 |
-
|
31 |
-
$isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
|
32 |
-
|
33 |
-
//New subscriber, just add
|
34 |
-
if ($subscriber->isObjectNew()) {
|
35 |
-
$this->_log("New Subscriber");
|
36 |
-
if (TRUE === $isConfirmNeed) {
|
37 |
-
$this->_log("Confirmation Needed");
|
38 |
-
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
39 |
-
if (!Mage::helper('customer')->isLoggedIn() && Mage::registry('campaigner_guest_customer')) {
|
40 |
-
$this->_log("Guest Customer");
|
41 |
-
$guestCustomer = Mage::registry('campaigner_guest_customer');
|
42 |
-
$subscriber->setFirstname($guestCustomer->getFirstname());
|
43 |
-
$subscriber->setLastname($guestCustomer->getLastname());
|
44 |
-
Mage::unregister('campaigner_guest_customer');
|
45 |
-
$subscriber->save();
|
46 |
-
} else {
|
47 |
-
$this->_log("Not a Guest Customer (Doing Nothing?)");
|
48 |
-
}
|
49 |
-
} else {
|
50 |
-
$this->_log("Confirmation Not Required");
|
51 |
-
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
52 |
-
$merge_vars = $this->_helper->getMergeVars($customer);
|
53 |
-
|
54 |
-
$this->_log($merge_vars,"Merge Vars");
|
55 |
-
|
56 |
-
Mage::getSingleton('campaigner/wrapper_subscribers')
|
57 |
-
->addByEmail($email,$merge_vars, true);
|
58 |
-
}
|
59 |
-
} else {
|
60 |
-
$this->_log("Existing Subscriber");
|
61 |
-
$status = (int)$subscriber->getData('subscriber_status');
|
62 |
-
|
63 |
-
$oldSubscriber = Mage::getModel('newsletter/subscriber')
|
64 |
-
->load($subscriber->getId());
|
65 |
-
$oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
|
66 |
-
|
67 |
-
if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
|
68 |
-
$this->_log("Unconfirmed to Subscribed");
|
69 |
-
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
70 |
-
$merge_vars = $this->_helper->getMergeVars($customer);
|
71 |
-
|
72 |
-
$this->_log($merge_vars,"Merge Vars");
|
73 |
-
Mage::getSingleton('campaigner/wrapper_subscribers')
|
74 |
-
->addByEmail($email,$merge_vars, true);
|
75 |
-
} elseif( $status !== $oldstatus ) {
|
76 |
-
//Status change
|
77 |
-
$this->_log("Status Change");
|
78 |
-
|
79 |
-
if (!$customer->getId()) {
|
80 |
-
$this->_log("Customer not found. Aborting...");
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
$
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
}
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Newsletter_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Handle Subscriber object saving process
|
7 |
+
*/
|
8 |
+
public function handleSubscriber(Varien_Event_Observer $observer)
|
9 |
+
{
|
10 |
+
try
|
11 |
+
{
|
12 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::NEWSLETTER);
|
13 |
+
$this->_log('handleSubscriber Start');
|
14 |
+
|
15 |
+
if (!$this->_helper->campaignerEnabled()) {
|
16 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
21 |
+
$subscriber->setImportMode(false);
|
22 |
+
|
23 |
+
$customer = Mage::getModel('customer/customer');
|
24 |
+
|
25 |
+
if ($subscriber->getCustomerId() != 0) {
|
26 |
+
$customer->load($subscriber->getCustomerId());
|
27 |
+
}
|
28 |
+
|
29 |
+
$email = $subscriber->getSubscriberEmail();
|
30 |
+
|
31 |
+
$isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
|
32 |
+
|
33 |
+
//New subscriber, just add
|
34 |
+
if ($subscriber->isObjectNew()) {
|
35 |
+
$this->_log("New Subscriber");
|
36 |
+
if (TRUE === $isConfirmNeed) {
|
37 |
+
$this->_log("Confirmation Needed");
|
38 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
|
39 |
+
if (!Mage::helper('customer')->isLoggedIn() && Mage::registry('campaigner_guest_customer')) {
|
40 |
+
$this->_log("Guest Customer");
|
41 |
+
$guestCustomer = Mage::registry('campaigner_guest_customer');
|
42 |
+
$subscriber->setFirstname($guestCustomer->getFirstname());
|
43 |
+
$subscriber->setLastname($guestCustomer->getLastname());
|
44 |
+
Mage::unregister('campaigner_guest_customer');
|
45 |
+
$subscriber->save();
|
46 |
+
} else {
|
47 |
+
$this->_log("Not a Guest Customer (Doing Nothing?)");
|
48 |
+
}
|
49 |
+
} else {
|
50 |
+
$this->_log("Confirmation Not Required");
|
51 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
52 |
+
$merge_vars = $this->_helper->getMergeVars($customer);
|
53 |
+
|
54 |
+
$this->_log($merge_vars,"Merge Vars");
|
55 |
+
|
56 |
+
Mage::getSingleton('campaigner/wrapper_subscribers')
|
57 |
+
->addByEmail($email,$merge_vars, true);
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
$this->_log("Existing Subscriber");
|
61 |
+
$status = (int)$subscriber->getData('subscriber_status');
|
62 |
+
|
63 |
+
$oldSubscriber = Mage::getModel('newsletter/subscriber')
|
64 |
+
->load($subscriber->getId());
|
65 |
+
$oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
|
66 |
+
|
67 |
+
if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
|
68 |
+
$this->_log("Unconfirmed to Subscribed");
|
69 |
+
$subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
|
70 |
+
$merge_vars = $this->_helper->getMergeVars($customer);
|
71 |
+
|
72 |
+
$this->_log($merge_vars,"Merge Vars");
|
73 |
+
Mage::getSingleton('campaigner/wrapper_subscribers')
|
74 |
+
->addByEmail($email,$merge_vars, true);
|
75 |
+
} elseif( $status !== $oldstatus ) {
|
76 |
+
//Status change
|
77 |
+
$this->_log("Status Change");
|
78 |
+
|
79 |
+
if (!$customer->getId()) {
|
80 |
+
$this->_log("Customer not found. Aborting...");
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
$listId = $this->_helper->getDefaultList($subscriber->getStoreId());
|
85 |
+
|
86 |
+
//Unsubscribe customer
|
87 |
+
if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED) {
|
88 |
+
$this->_log("Unsubscribed");
|
89 |
+
Mage::getSingleton('campaigner/wrapper_subscribers')
|
90 |
+
->updateSubscriptions($customer, array(), array($listId));
|
91 |
+
} else if($status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) {
|
92 |
+
$this->_log("Subscribed");
|
93 |
+
if( $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE || $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED ) {
|
94 |
+
$this->_log("Changing Status");
|
95 |
+
Mage::getSingleton('campaigner/wrapper_subscribers')
|
96 |
+
->updateSubscriptions($customer, array($listId), array());
|
97 |
+
} else {
|
98 |
+
$this->_log("Status Not Changed");
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
$this->_log('handleSubscriber End');
|
104 |
+
} catch (Exception $e) {
|
105 |
+
Mage::logException($e);
|
106 |
+
$this->_logException($e);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
// Remove Unsubscribe option from Newsletter grid
|
111 |
+
public function updateNewsletterMassAction($observer)
|
112 |
+
{
|
113 |
+
try {
|
114 |
+
if (!$this->_helper->campaignerEnabled()) {
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
|
118 |
+
$block = $observer->getEvent()->getBlock();
|
119 |
+
|
120 |
+
if (get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
|
121 |
+
&& $block->getRequest()->getControllerName() == 'newsletter_subscriber') {
|
122 |
+
$block->removeItem('unsubscribe');
|
123 |
+
}
|
124 |
+
} catch (Exception $e) {
|
125 |
+
Mage::logException($e);
|
126 |
+
$this->_logException($e);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Handle Subscriber deletion from Magento, unsubcribes email
|
132 |
+
* and sends the delete_member flag so the subscriber gets deleted.
|
133 |
+
*/
|
134 |
+
public function handleSubscriberDeletion(Varien_Event_Observer $observer)
|
135 |
+
{
|
136 |
+
try {
|
137 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::NEWSLETTER);
|
138 |
+
$this->_log("Handle Subscriber Deletion Start");
|
139 |
+
|
140 |
+
if (!$this->_helper->campaignerEnabled()) {
|
141 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
146 |
+
|
147 |
+
$email = $subscriber->getSubscriberEmail();
|
148 |
+
|
149 |
+
Mage::getSingleton('campaigner/wrapper_subscribers')
|
150 |
+
->delete($email);
|
151 |
+
|
152 |
+
$this->_log("Handle Subscriber Deletion End");
|
153 |
+
} catch (Exception $e) {
|
154 |
+
Mage::logException($e);
|
155 |
+
$this->_logException($e);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
|
160 |
+
{
|
161 |
+
try {
|
162 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::NEWSLETTER);
|
163 |
+
$this->_log("Register Checkout Subscribe Start");
|
164 |
+
if (!$this->_helper->campaignerEnabled()) {
|
165 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
$subscribe = Mage::app()->getRequest()->getPost('campaigner_subscribe');
|
169 |
+
|
170 |
+
if (!is_null($subscribe) || $this->_helper->forceSubscribe()) {
|
171 |
+
Mage::getSingleton('core/session')->setCampaignerCheckout($subscribe);
|
172 |
+
}
|
173 |
+
|
174 |
+
$this->_log("Register Checkout Subscribe End");
|
175 |
+
} catch (Exception $e) {
|
176 |
+
Mage::logException($e);
|
177 |
+
$this->_logException($e);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Subscribe customer to Newsletter if flag on session is present
|
183 |
+
*/
|
184 |
+
public function registerCheckoutSuccess(Varien_Event_Observer $observer)
|
185 |
+
{
|
186 |
+
try {
|
187 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::NEWSLETTER);
|
188 |
+
$this->_log("Register Checkout Success Start");
|
189 |
+
|
190 |
+
if (!$this->_helper->campaignerEnabled()) {
|
191 |
+
$this->_logReason($this->_helper->getDisabledReason());
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
+
$sessionFlag = Mage::getSingleton('core/session')->getCampaignerCheckout(TRUE);
|
196 |
+
if (!$sessionFlag && !$this->_helper->forceSubscribe()) {
|
197 |
+
$this->_logReason("Session flag not found.");
|
198 |
+
return;
|
199 |
+
}
|
200 |
+
|
201 |
+
$order_id = (int)current($observer->getEvent()->getOrderIds());
|
202 |
+
|
203 |
+
if (!$order_id) {
|
204 |
+
$this->_logReason("Order ID not found.");
|
205 |
+
return;
|
206 |
+
}
|
207 |
+
|
208 |
+
$order = Mage::getModel('sales/order')->load($order_id);
|
209 |
+
if (!$order->getId()) {
|
210 |
+
$this->_logReason("Failed to Load Order ({$order_id}).");
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
|
214 |
+
$this->_log("Processing Order # " . $order->getIncrementId());
|
215 |
+
|
216 |
+
//Guest Checkout
|
217 |
+
if ((int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID ) {
|
218 |
+
$this->_log("Guest Checkout");
|
219 |
+
$this->_helper->registerGuestCustomer($order);
|
220 |
+
}
|
221 |
+
|
222 |
+
$subscriber = Mage::getModel('newsletter/subscriber')
|
223 |
+
->subscribe($order->getCustomerEmail());
|
224 |
+
|
225 |
+
$this->_log("Register Checkout Success End");
|
226 |
+
} catch (Exception $e) {
|
227 |
+
Mage::logException($e);
|
228 |
+
$this->_logException($e);
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
@@ -10,7 +10,7 @@ class Campaigner_Integration_Model_Observer extends Campaigner_Integration_Model
|
|
10 |
try
|
11 |
{
|
12 |
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::WISHLIST);
|
13 |
-
|
14 |
$this->_log('onWishlistProductAddAfter Start');
|
15 |
|
16 |
if (!$this->_helper->canSendWishlist()) {
|
10 |
try
|
11 |
{
|
12 |
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::WISHLIST);
|
13 |
+
//$this->_logger->setLogLevel(Campaigner_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
14 |
$this->_log('onWishlistProductAddAfter Start');
|
15 |
|
16 |
if (!$this->_helper->canSendWishlist()) {
|
@@ -177,11 +177,7 @@ class Campaigner_Integration_Model_Order_Observer extends Campaigner_Integration
|
|
177 |
|
178 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
179 |
|
180 |
-
|
181 |
-
$date = date($this->_date_format, $date);
|
182 |
-
|
183 |
-
$this->_log("Saving Last Cron Run Date: {$date}");
|
184 |
-
$this->_helper->updateConfig("latest_cron_last_run", $date);
|
185 |
|
186 |
$this->_log("Latest Orders Processor End");
|
187 |
} catch (Exception $e) {
|
@@ -216,7 +212,7 @@ class Campaigner_Integration_Model_Order_Observer extends Campaigner_Integration
|
|
216 |
}
|
217 |
}
|
218 |
|
219 |
-
public function
|
220 |
{
|
221 |
$count = 0;
|
222 |
$this->_order_status = array();
|
@@ -233,14 +229,14 @@ class Campaigner_Integration_Model_Order_Observer extends Campaigner_Integration
|
|
233 |
$stores = Mage::app()->getStores();
|
234 |
|
235 |
foreach ($stores as $store) {
|
|
|
|
|
236 |
$this->_log("Checking for valid orders in store: {$store->getName()} ({$store->getId()})");
|
237 |
if (!$this->_helper->config('save_latest_order',$store->getId())) {
|
238 |
$this->_log('Latest Orders not enabled...');
|
239 |
continue;
|
240 |
}
|
241 |
|
242 |
-
Mage::app()->setCurrentStore($store->getCode());
|
243 |
-
|
244 |
// Get abandoned collection
|
245 |
$collection = Mage::getResourceModel('campaigner/latest_order_collection');
|
246 |
|
@@ -276,6 +272,14 @@ class Campaigner_Integration_Model_Order_Observer extends Campaigner_Integration
|
|
276 |
|
277 |
$latest = Mage::getModel('campaigner/latest_order')->init($order);
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
$this->_log("Sales Order Save After End");
|
280 |
} catch (Exception $e) {
|
281 |
Mage::logException($e);
|
@@ -325,4 +329,357 @@ class Campaigner_Integration_Model_Order_Observer extends Campaigner_Integration
|
|
325 |
$this->_logException($e);
|
326 |
}
|
327 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
}
|
177 |
|
178 |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
179 |
|
180 |
+
Mage::helper('campaigner/cron')->setCronLastRun(Campaigner_Integration_Helper_Cron::LATEST_ORDERS);
|
|
|
|
|
|
|
|
|
181 |
|
182 |
$this->_log("Latest Orders Processor End");
|
183 |
} catch (Exception $e) {
|
212 |
}
|
213 |
}
|
214 |
|
215 |
+
public function sendLatestOrders($id_list)
|
216 |
{
|
217 |
$count = 0;
|
218 |
$this->_order_status = array();
|
229 |
$stores = Mage::app()->getStores();
|
230 |
|
231 |
foreach ($stores as $store) {
|
232 |
+
Mage::app()->setCurrentStore($store->getCode());
|
233 |
+
|
234 |
$this->_log("Checking for valid orders in store: {$store->getName()} ({$store->getId()})");
|
235 |
if (!$this->_helper->config('save_latest_order',$store->getId())) {
|
236 |
$this->_log('Latest Orders not enabled...');
|
237 |
continue;
|
238 |
}
|
239 |
|
|
|
|
|
240 |
// Get abandoned collection
|
241 |
$collection = Mage::getResourceModel('campaigner/latest_order_collection');
|
242 |
|
272 |
|
273 |
$latest = Mage::getModel('campaigner/latest_order')->init($order);
|
274 |
|
275 |
+
if ($this->_helper->getBatchOnly())
|
276 |
+
{
|
277 |
+
$this->_log("Skipping... Batch Processing Only");
|
278 |
+
return;
|
279 |
+
}
|
280 |
+
|
281 |
+
$this->processSavedOrder($order);
|
282 |
+
|
283 |
$this->_log("Sales Order Save After End");
|
284 |
} catch (Exception $e) {
|
285 |
Mage::logException($e);
|
329 |
$this->_logException($e);
|
330 |
}
|
331 |
}
|
332 |
+
|
333 |
+
//--------------------------------------------------------------------------
|
334 |
+
// Purchase Behavior Tracking
|
335 |
+
|
336 |
+
private function canSendOrder($order, $batch = false)
|
337 |
+
{
|
338 |
+
$camp_order = Mage::getModel('campaigner/order')->loadByOrderId($order->getId());
|
339 |
+
|
340 |
+
if (!$batch && $camp_order != null && $camp_order->getDateSent() != null) {
|
341 |
+
$this->_order_status[$order->getIncrementId] = array('success' => false, 'status' => "Order has already been sent.");
|
342 |
+
$this->_logReason("Order has already been sent.");
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
|
346 |
+
if ($batch) {
|
347 |
+
$this->_log("Batch process. Skipping State/Status Check");
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
|
351 |
+
$mode = $this->_helper->commerceConfig('send_field');
|
352 |
+
|
353 |
+
$this->_log("Send Field: {$mode}");
|
354 |
+
|
355 |
+
if ($mode == "state") {
|
356 |
+
$this->_log("Order State: " . $order->getState());
|
357 |
+
|
358 |
+
$states = Mage::helper('campaigner')->commerceConfig('send_states');
|
359 |
+
$state_list = explode(",",$states);
|
360 |
+
|
361 |
+
$this->_log("Check States: " . $states);
|
362 |
+
$this->_log($state_list, "State array");
|
363 |
+
|
364 |
+
if (array_search($order->getState(),$state_list) === FALSE) {
|
365 |
+
$this->_logReason("State not setup to send (" . $order->getState() . ")");
|
366 |
+
return false;
|
367 |
+
}
|
368 |
+
} else {
|
369 |
+
$this->_log("Order Status: " . $order->getStatus());
|
370 |
+
|
371 |
+
$statuses = Mage::helper('campaigner')->commerceConfig('send_statuses');
|
372 |
+
$status_list = explode(",",$statuses);
|
373 |
+
|
374 |
+
$this->_log("Check Statuses: " . $statuses);
|
375 |
+
$this->_log($status_list, "Status array");
|
376 |
+
|
377 |
+
if (array_search($order->getStatus(),$status_list) === FALSE) {
|
378 |
+
$this->_logReason("Status not setup to send (" . $order->getStatus() . ")");
|
379 |
+
return false;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
return true;
|
384 |
+
}
|
385 |
+
|
386 |
+
private function getSubscriberOrders($orders)
|
387 |
+
{
|
388 |
+
$subscribers = "<Subscribers>";
|
389 |
+
|
390 |
+
foreach ($orders as $email => $order_list) {
|
391 |
+
$subscribers .= "<Subscriber><EmailAddress>{$email}</EmailAddress><Orders>{$order_list}</Orders></Subscriber>";
|
392 |
+
}
|
393 |
+
|
394 |
+
$subscribers .= "</Subscribers>";
|
395 |
+
|
396 |
+
$this->_log("Subscriber Orders");
|
397 |
+
$this->_log($subscribers);
|
398 |
+
|
399 |
+
return $subscribers;
|
400 |
+
}
|
401 |
+
|
402 |
+
private function processOrders($collection)
|
403 |
+
{
|
404 |
+
$order_list = array();
|
405 |
+
$failures = array();
|
406 |
+
|
407 |
+
$count = 0;
|
408 |
+
|
409 |
+
$order_emails = array();
|
410 |
+
|
411 |
+
foreach ($collection as $order) {
|
412 |
+
$order_list[$order->getIncrementId()] = $order;
|
413 |
+
$order_xml = $this->processSavedOrder($order, true);
|
414 |
+
if ($order_xml != "") {
|
415 |
+
if (!isset($order_emails[$order->getCustomerEmail()])) {
|
416 |
+
$order_emails[$order->getCustomerEmail()] = $order_xml;
|
417 |
+
} else {
|
418 |
+
$order_emails[$order->getCustomerEmail()] .= $order_xml;
|
419 |
+
}
|
420 |
+
$count++;
|
421 |
+
//$orders .= $order_xml;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
if ($count == 0) {
|
426 |
+
return $failures;
|
427 |
+
}
|
428 |
+
|
429 |
+
$subscribers = $this->getSubscriberOrders($order_emails);
|
430 |
+
|
431 |
+
$response = Mage::getSingleton('campaigner/wrapper_commerce_orders')->sendOrders($subscribers);
|
432 |
+
|
433 |
+
if (isset($response->ErrorCode)) {
|
434 |
+
throw new Exception((string)$response->Message, (int)$response->ErrorCode);
|
435 |
+
} else {
|
436 |
+
$this->updateSentToCampaigner($order_list, $failures);
|
437 |
+
}
|
438 |
+
|
439 |
+
$this->_log("Response");
|
440 |
+
$this->_log($response);
|
441 |
+
return $failures;
|
442 |
+
}
|
443 |
+
|
444 |
+
private function updateSentToCampaigner($order_list, $failures)
|
445 |
+
{
|
446 |
+
foreach ($order_list as $increment_id => $order) {
|
447 |
+
if (!isset($failures[$increment_id])) {
|
448 |
+
$this->_order_status[$increment_id] = array('success' => true);
|
449 |
+
$this->setOrderSentToCampaigner($order);
|
450 |
+
} else {
|
451 |
+
$this->_order_status[$increment_id] = array('success' => false, 'status' => (string)$failures[$increment_id]->Message);
|
452 |
+
}
|
453 |
+
}
|
454 |
+
}
|
455 |
+
|
456 |
+
private function processBatchStoreOrders($store)
|
457 |
+
{
|
458 |
+
try {
|
459 |
+
$store_code = $store->getCode();
|
460 |
+
|
461 |
+
$this->_log("Processing Store: {$store_code}");
|
462 |
+
|
463 |
+
if (!$this->_helper->getBatchEnabled()) {
|
464 |
+
$this->_logReason($this->_helper->getBatchDisabledReason());
|
465 |
+
return;
|
466 |
+
}
|
467 |
+
|
468 |
+
// Store the time we last run
|
469 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
470 |
+
$date = date($this->_date_format, $date);
|
471 |
+
|
472 |
+
|
473 |
+
$this->_log("Saving Last Run Date: {$date}");
|
474 |
+
$this->_helper->updateConfig("orders_last_run", $date, $store->getId());
|
475 |
+
|
476 |
+
Mage::helper('campaigner/fields')->checkFields();
|
477 |
+
|
478 |
+
// Get order collection
|
479 |
+
$collection = Mage::getResourceModel('campaigner/order_collection');
|
480 |
+
|
481 |
+
$limit = $this->_helper->commerceConfig('batch_size');
|
482 |
+
|
483 |
+
$this->_log("Batch Size: [{$limit}]");
|
484 |
+
|
485 |
+
if ($limit != "") {
|
486 |
+
if (!is_numeric($limit)) {
|
487 |
+
$limit = 100;
|
488 |
+
} else {
|
489 |
+
$limit = (int)$limit;
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
$collection->getUnsentOrders($store->getId(), $limit);
|
494 |
+
|
495 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
496 |
+
|
497 |
+
$failures = $this->processOrders($collection);
|
498 |
+
|
499 |
+
$this->_log("Finished Processing Store: {$store_code}");
|
500 |
+
} catch (Exception $e) {
|
501 |
+
Mage::logException($e);
|
502 |
+
$this->_logException($e);
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
public function manualOrderProcessor($store_id = null)
|
507 |
+
{
|
508 |
+
try {
|
509 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
510 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ORDERS);
|
511 |
+
$this->_log("Manual Order Processor Start");
|
512 |
+
|
513 |
+
$stores = Mage::app()->getStores();
|
514 |
+
|
515 |
+
foreach ($stores as $store) {
|
516 |
+
if ($store_id == null || $store_id == $store->getId()) {
|
517 |
+
Mage::app()->setCurrentStore($store->getCode());
|
518 |
+
|
519 |
+
$this->processBatchStoreOrders($store);
|
520 |
+
}
|
521 |
+
}
|
522 |
+
|
523 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
524 |
+
|
525 |
+
$this->_log("Manual Order Processor End");
|
526 |
+
} catch (Exception $e) {
|
527 |
+
Mage::logException($e);
|
528 |
+
$this->_logException($e);
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
public function processBatchOrders()
|
533 |
+
{
|
534 |
+
try {
|
535 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
536 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ORDERS);
|
537 |
+
$this->_log("Process Batch Orders Start");
|
538 |
+
|
539 |
+
$stores = Mage::app()->getStores();
|
540 |
+
|
541 |
+
foreach ($stores as $store) {
|
542 |
+
Mage::app()->setCurrentStore($store->getCode());
|
543 |
+
|
544 |
+
$this->processBatchStoreOrders($store);
|
545 |
+
}
|
546 |
+
|
547 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
548 |
+
|
549 |
+
Mage::helper('campaigner/cron')->setCronLastRun(Campaigner_Integration_Helper_Cron::ORDERS);
|
550 |
+
|
551 |
+
$this->_log("Process Batch Orders End");
|
552 |
+
} catch (Exception $e) {
|
553 |
+
Mage::logException($e);
|
554 |
+
$this->_logException($e);
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
public function sendOrders($id_list, $force = false)
|
559 |
+
{
|
560 |
+
$count = 0;
|
561 |
+
$this->_order_status = array();
|
562 |
+
|
563 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
564 |
+
|
565 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ORDERS);
|
566 |
+
$this->_log("Sending Specific Orders Start");
|
567 |
+
|
568 |
+
//Mage::helper('campaigner/fields')->verifyFields();
|
569 |
+
|
570 |
+
$this->_log($id_list, "ID LIST");
|
571 |
+
|
572 |
+
$stores = Mage::app()->getStores();
|
573 |
+
|
574 |
+
foreach ($stores as $store) {
|
575 |
+
Mage::app()->setCurrentStore($store->getCode());
|
576 |
+
|
577 |
+
$this->_log("Checking for valid orders in store: {$store->getName()} ({$store->getId()})");
|
578 |
+
if (!$force && !$this->_helper->commerceConfig('enabled',$store->getId())) {
|
579 |
+
$this->_log('Orders not enabled...');
|
580 |
+
continue;
|
581 |
+
}
|
582 |
+
|
583 |
+
// Get abandoned collection
|
584 |
+
$collection = Mage::getResourceModel('campaigner/order_collection');
|
585 |
+
|
586 |
+
$collection->prepareForManualProcess($id_list, $store->getId());
|
587 |
+
|
588 |
+
$count += count($collection);
|
589 |
+
|
590 |
+
$this->_log("SQL: " . $collection->getSelect()->__toString());
|
591 |
+
|
592 |
+
$response = $this->processOrders($collection);
|
593 |
+
}
|
594 |
+
|
595 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
596 |
+
|
597 |
+
$this->_log("Sending Specific Orders End");
|
598 |
+
|
599 |
+
return $this->_order_status;
|
600 |
+
|
601 |
+
}
|
602 |
+
|
603 |
+
public function processSavedOrder($order, $batch = false)
|
604 |
+
{
|
605 |
+
try {
|
606 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ORDERS);
|
607 |
+
$this->_log("Process Saved Order Start");
|
608 |
+
|
609 |
+
$this->_log("Order ID: " . $order->getIncrementId());
|
610 |
+
|
611 |
+
$this->_log("Order Store: " . $order->getStoreId());
|
612 |
+
$starting_store = Mage::app()->getStore()->getCode();
|
613 |
+
|
614 |
+
Mage::app()->setCurrentStore($order->getStoreId());
|
615 |
+
|
616 |
+
if (!$batch && !$this->_helper->getOrdersEnabled()) {
|
617 |
+
$this->_logReason($this->_helper->getOrdersDisabledReason());
|
618 |
+
Mage::app()->setCurrentStore($starting_store);
|
619 |
+
return "";
|
620 |
+
}
|
621 |
+
|
622 |
+
if (!$this->canSendOrder($order, $batch)) {
|
623 |
+
Mage::app()->setCurrentStore($starting_store);
|
624 |
+
return "";
|
625 |
+
}
|
626 |
+
|
627 |
+
$this->_log("Order is ready to send. Processing...");
|
628 |
+
|
629 |
+
if (!$batch) {
|
630 |
+
$rc = Mage::getSingleton('campaigner/wrapper_commerce_orders')->sendOrder($order);
|
631 |
+
|
632 |
+
if (!isset($rc->ErrorCode)) {
|
633 |
+
$this->setOrderSentToCampaigner($order);
|
634 |
+
}
|
635 |
+
} else {
|
636 |
+
return Mage::getSingleton('campaigner/wrapper_commerce_orders')->getOrderXml($order);
|
637 |
+
}
|
638 |
+
|
639 |
+
$this->_log("Process Saved Order End");
|
640 |
+
} catch (Exception $e) {
|
641 |
+
Mage::logException($e);
|
642 |
+
$this->_logException($e);
|
643 |
+
}
|
644 |
+
|
645 |
+
Mage::app()->setCurrentStore($starting_store);
|
646 |
+
return "";
|
647 |
+
}
|
648 |
+
|
649 |
+
public function orderSaveAfterAdmin(Varien_Event_Observer $observer)
|
650 |
+
{
|
651 |
+
try {
|
652 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::ORDERS);
|
653 |
+
$this->_log("Order Save After (Admin) Start");
|
654 |
+
|
655 |
+
if ($this->_helper->getBatchOnly()) {
|
656 |
+
$this->_log("Skipping... Batch Processing Only");
|
657 |
+
return;
|
658 |
+
}
|
659 |
+
|
660 |
+
$order = $observer->getEvent()->getOrder();
|
661 |
+
|
662 |
+
$this->processSavedOrder($order);
|
663 |
+
|
664 |
+
$this->_log("Order Save After (Admin) End");
|
665 |
+
} catch (Exception $e) {
|
666 |
+
Mage::logException($e);
|
667 |
+
$this->_logException($e);
|
668 |
+
}
|
669 |
+
}
|
670 |
+
|
671 |
+
private function setOrderSentToCampaigner($order, $date = null)
|
672 |
+
{
|
673 |
+
try {
|
674 |
+
if ($date == null) {
|
675 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
676 |
+
$date = date($this->_date_format, $date);
|
677 |
+
}
|
678 |
+
|
679 |
+
$camp_order = Mage::getModel('campaigner/order')->saveSent($order, $date);
|
680 |
+
} catch (Exception $e) {
|
681 |
+
Mage::logException($e);
|
682 |
+
$this->_logException($e);
|
683 |
+
}
|
684 |
+
}
|
685 |
}
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Product extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('campaigner/product');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function loadByCampaignerId($campaigner_id)
|
12 |
+
{
|
13 |
+
try {
|
14 |
+
if ($data = $this->getResource()->loadByCampaignerId($campaigner_id)) {
|
15 |
+
$this->addData($data);
|
16 |
+
} else {
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
} catch (Exception $e) {
|
20 |
+
Mage::logException($e);
|
21 |
+
Mage::helper('campaigner')->logException($e);
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function init($product, $campaigner_id)
|
28 |
+
{
|
29 |
+
if ($campaigner_id == 0) {
|
30 |
+
throw new Exception("Campaigner ID not found", 1);
|
31 |
+
}
|
32 |
+
|
33 |
+
try {
|
34 |
+
$id = $product->getId();
|
35 |
+
|
36 |
+
$this->load($id);
|
37 |
+
|
38 |
+
if (!$this->getId()) {
|
39 |
+
$this->setId($id);
|
40 |
+
$this->setCampaignerId($campaigner_id);
|
41 |
+
|
42 |
+
$this->setCategoryIds($product->getCategoryIds());
|
43 |
+
$this->save();
|
44 |
+
}
|
45 |
+
}
|
46 |
+
catch (Exception $e) {
|
47 |
+
Mage::helper('campaigner/troubleshooting')->logException($e);
|
48 |
+
Mage::logException($e);
|
49 |
+
}
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getCategoryIds()
|
54 |
+
{
|
55 |
+
if ($this->_category_ids == null) {
|
56 |
+
$ids = $this->getData('campaigner_categories');
|
57 |
+
|
58 |
+
if ($ids == "") {
|
59 |
+
$this->_category_ids = array();
|
60 |
+
} else {
|
61 |
+
$this->_category_ids = explode(",",$ids);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return $this->_category_ids;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function setCategoryIds($ids)
|
69 |
+
{
|
70 |
+
$this->_category_ids = $ids;
|
71 |
+
|
72 |
+
$this->setData('campaigner_categories',implode(",",$this->_category_ids));
|
73 |
+
}
|
74 |
+
}
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Product_Category_Action extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('campaigner/product_category_action');
|
9 |
+
}
|
10 |
+
|
11 |
+
public function loadByProductId($product_id)
|
12 |
+
{
|
13 |
+
if ($data = $this->getResource()->loadByProductId($product_id)) {
|
14 |
+
$this->addData($data);
|
15 |
+
}
|
16 |
+
else {
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function loadByCategoryId($category_id)
|
24 |
+
{
|
25 |
+
if ($data = $this->getResource()->loadByCategoryId($category_id)) {
|
26 |
+
$this->addData($data);
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function initProduct($product, $action)
|
36 |
+
{
|
37 |
+
try {
|
38 |
+
$product_id = $product->getId();
|
39 |
+
|
40 |
+
if (!$this->loadByProductId($product_id)) {
|
41 |
+
$this->setProductId($product_id);
|
42 |
+
$this->setType('product');
|
43 |
+
}
|
44 |
+
$this->setDateSent(null);
|
45 |
+
$this->setStatus("");
|
46 |
+
$this->setAction($action);
|
47 |
+
$this->save();
|
48 |
+
}
|
49 |
+
catch (Exception $e) {
|
50 |
+
Mage::helper('campaigner/troubleshooting')->logException($e);
|
51 |
+
Mage::logException($e);
|
52 |
+
}
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function initCategory($category, $action)
|
57 |
+
{
|
58 |
+
try {
|
59 |
+
$category_id = $category->getId();
|
60 |
+
|
61 |
+
if (!$this->loadByCategoryId($category_id)) {
|
62 |
+
$this->setCategoryId($category_id);
|
63 |
+
$this->setType('category');
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->setDateSent(null);
|
67 |
+
$this->setStatus("");
|
68 |
+
$this->setAction($action);
|
69 |
+
$this->save();
|
70 |
+
}
|
71 |
+
catch (Exception $e) {
|
72 |
+
Mage::helper('campaigner/troubleshooting')->logException($e);
|
73 |
+
Mage::logException($e);
|
74 |
+
}
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
}
|
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Product_Observer extends Campaigner_Integration_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* has the Product changed
|
7 |
+
*
|
8 |
+
* @param Mage_Customer_Model_Product $product
|
9 |
+
* @return bool
|
10 |
+
*/
|
11 |
+
private function hasProductChanged($product)
|
12 |
+
{
|
13 |
+
$this->_log('hasProductChanged');
|
14 |
+
|
15 |
+
$fields = array(
|
16 |
+
'name',
|
17 |
+
'description',
|
18 |
+
'short_description',
|
19 |
+
'image',
|
20 |
+
'url_path',
|
21 |
+
'weight',
|
22 |
+
'price'
|
23 |
+
);
|
24 |
+
|
25 |
+
if ($product->getData('is_changed_categories') == 1) {
|
26 |
+
$this->_log('Category Changed');
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->_log('Checking for mapped data changes');
|
31 |
+
|
32 |
+
foreach ($fields as $field) {
|
33 |
+
$original = $product->getOrigData($field);
|
34 |
+
$current = $product->getData($field);
|
35 |
+
|
36 |
+
$this->_log("Original: {$original} - Current: {$current}");
|
37 |
+
|
38 |
+
if ($original != $current) {
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return false;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* has the Category changed
|
48 |
+
*
|
49 |
+
* @param Mage_Customer_Model_Category $category
|
50 |
+
* @return bool
|
51 |
+
*/
|
52 |
+
private function hasCategoryChanged($category)
|
53 |
+
{
|
54 |
+
$fields = array(
|
55 |
+
'name',
|
56 |
+
'description',
|
57 |
+
'image',
|
58 |
+
'url_path',
|
59 |
+
);
|
60 |
+
|
61 |
+
//$this->_log('Checking for mapped data changes');
|
62 |
+
|
63 |
+
foreach ($fields as $field) {
|
64 |
+
$original = $category->getOrigData($field);
|
65 |
+
$current = $category->getData($field);
|
66 |
+
|
67 |
+
$this->_log("Original: {$original} - Current: {$current}");
|
68 |
+
|
69 |
+
if ($original != $current) {
|
70 |
+
return true;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
private function moveCategory($category)
|
78 |
+
{
|
79 |
+
$campaigner_category = Mage::getModel('campaigner/category')->load($category->getId());
|
80 |
+
|
81 |
+
if ($campaigner_category && $campaigner_category->getId()) {
|
82 |
+
$campaigner_category->delete();
|
83 |
+
}
|
84 |
+
|
85 |
+
$action = Mage::getModel('campaigner/product_category_action')->initCategory($category, 'moved');
|
86 |
+
|
87 |
+
$children = $category->getChildrenCategories();
|
88 |
+
|
89 |
+
foreach ($children as $child) {
|
90 |
+
$this->moveCategory($child);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
public function categoryTreeMoveAfter(Varien_Event_Observer $observer)
|
95 |
+
{
|
96 |
+
try {
|
97 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::COMMERCE);
|
98 |
+
$this->_log("Category Tree Move After (Admin) Start");
|
99 |
+
|
100 |
+
if (!$this->_helper->commerceConfig('enabled')) {
|
101 |
+
$this->_log("Skipping... Commerce not Enabled");
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
|
105 |
+
if (!$this->_helper->commerceConfig('product_category_enabled')) {
|
106 |
+
$this->_log("Skipping... Product Category Sync not enabled");
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
$category = $observer->getEvent()->getCategory();
|
111 |
+
|
112 |
+
$this->moveCategory($category);
|
113 |
+
|
114 |
+
$this->_log("Category Tree Move After (Admin) End");
|
115 |
+
} catch (Exception $e) {
|
116 |
+
Mage::logException($e);
|
117 |
+
$this->_logException($e);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
public function productSaveAfterAdmin(Varien_Event_Observer $observer)
|
122 |
+
{
|
123 |
+
try {
|
124 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::COMMERCE);
|
125 |
+
$this->_log("Product Save After (Admin) Start");
|
126 |
+
|
127 |
+
if (!$this->_helper->commerceConfig('enabled')) {
|
128 |
+
$this->_log("Skipping... Commerce not Enabled");
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
|
132 |
+
if (!$this->_helper->commerceConfig('product_category_enabled')) {
|
133 |
+
$this->_log("Skipping... Product Category Sync not enabled");
|
134 |
+
return;
|
135 |
+
}
|
136 |
+
|
137 |
+
$product = $observer->getEvent()->getProduct();
|
138 |
+
|
139 |
+
//$this->_log($product->getData());
|
140 |
+
|
141 |
+
if ($product->isObjectNew()) {
|
142 |
+
$this->_log('New Product');
|
143 |
+
$action = Mage::getModel('campaigner/product_category_action')->initProduct($product, 'new');
|
144 |
+
} else {
|
145 |
+
$this->_log('Updated Product');
|
146 |
+
$campaigner_product = Mage::getModel('campaigner/product')->load($product->getId());
|
147 |
+
if (!$this->hasProductChanged($product) && $campaigner_product->getId()) {
|
148 |
+
$this->_log('Skipping... Product has not changed.');
|
149 |
+
return;
|
150 |
+
}
|
151 |
+
$this->_log('Update Product');
|
152 |
+
$action = Mage::getModel('campaigner/product_category_action')->initProduct($product, 'update');
|
153 |
+
}
|
154 |
+
|
155 |
+
//$this->processSavedOrder($order);
|
156 |
+
|
157 |
+
$this->_log("Product Save After (Admin) End");
|
158 |
+
} catch (Exception $e) {
|
159 |
+
Mage::logException($e);
|
160 |
+
$this->_logException($e);
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
public function categorySaveAfterAdmin(Varien_Event_Observer $observer)
|
165 |
+
{
|
166 |
+
try {
|
167 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::COMMERCE);
|
168 |
+
$this->_log("Category Save After (Admin) Start");
|
169 |
+
|
170 |
+
if (!$this->_helper->commerceConfig('enabled')) {
|
171 |
+
$this->_log("Skipping... Commerce not Enabled");
|
172 |
+
return;
|
173 |
+
}
|
174 |
+
|
175 |
+
if (!$this->_helper->commerceConfig('product_category_enabled')) {
|
176 |
+
$this->_log("Skipping... Product Category Sync not enabled");
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
|
180 |
+
$category = $observer->getEvent()->getCategory();
|
181 |
+
|
182 |
+
//$this->_log($product->getData());
|
183 |
+
|
184 |
+
if ($category->isObjectNew()) {
|
185 |
+
$this->_log('New Category');
|
186 |
+
$action = Mage::getModel('campaigner/product_category_action')->initCategory($category, 'new');
|
187 |
+
} else {
|
188 |
+
$campaigner_category = Mage::getModel('campaigner/category')->load($category->getId());
|
189 |
+
|
190 |
+
if (!$this->hasCategoryChanged($category) && $campaigner_category->getId()) {
|
191 |
+
$this->_log('Skipping... Category has not changed.');
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
$this->_log('Update Category');
|
195 |
+
$action = Mage::getModel('campaigner/product_category_action')->initCategory($category, 'update');
|
196 |
+
}
|
197 |
+
|
198 |
+
$this->_log("Category Save After (Admin) End");
|
199 |
+
} catch (Exception $e) {
|
200 |
+
Mage::logException($e);
|
201 |
+
$this->_logException($e);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
private function performAction($id)
|
206 |
+
{
|
207 |
+
$this->_log("performAction({$id})");
|
208 |
+
$action = Mage::getModel('campaigner/product_category_action')->load($id);
|
209 |
+
|
210 |
+
$helper = Mage::helper('campaigner/sync');
|
211 |
+
|
212 |
+
// Perform Action
|
213 |
+
|
214 |
+
try {
|
215 |
+
if ($action->getType() == 'product') {
|
216 |
+
$this->_log("Action Type: product");
|
217 |
+
$product = Mage::getModel('catalog/product')->load($action->getProductId());
|
218 |
+
$campaigner_product = $helper->syncProduct($product);
|
219 |
+
} else {
|
220 |
+
$this->_log("Action Type: category");
|
221 |
+
$category = Mage::getModel('catalog/category')->load($action->getCategoryId());
|
222 |
+
$campaigner_category = $helper->syncCategory($category, true);
|
223 |
+
}
|
224 |
+
|
225 |
+
$this->setActionSentToCampaigner($action);
|
226 |
+
|
227 |
+
} catch (Exception $e) {
|
228 |
+
$this->setActionError($action, $e);
|
229 |
+
|
230 |
+
throw $e;
|
231 |
+
}
|
232 |
+
|
233 |
+
return true;
|
234 |
+
}
|
235 |
+
|
236 |
+
public function performActions($id_list)
|
237 |
+
{
|
238 |
+
$count = 0;
|
239 |
+
$this->_action_status = array();
|
240 |
+
|
241 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
242 |
+
|
243 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::COMMERCE);
|
244 |
+
$this->_log("Sending Specific Products/Categories Start");
|
245 |
+
|
246 |
+
//Mage::helper('campaigner/fields')->verifyFields();
|
247 |
+
|
248 |
+
$this->_log($id_list, "ID LIST");
|
249 |
+
|
250 |
+
foreach ($id_list as $id) {
|
251 |
+
try {
|
252 |
+
$this->performAction($id);
|
253 |
+
|
254 |
+
$this->_action_status[$id] = array('success' => true);
|
255 |
+
} catch (Exception $e) {
|
256 |
+
$this->_action_status[$id] = array('success' => false, 'status' => $e->getMessage());
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
261 |
+
|
262 |
+
$this->_log("Sending Specific Products/Categories End");
|
263 |
+
|
264 |
+
return $this->_action_status;
|
265 |
+
}
|
266 |
+
|
267 |
+
private function setActionSentToCampaigner($action, $date = null)
|
268 |
+
{
|
269 |
+
try {
|
270 |
+
if ($date == null) {
|
271 |
+
$date = date(Mage::getModel('core/date')->gmtTimestamp());
|
272 |
+
$date = date($this->_date_format, $date);
|
273 |
+
}
|
274 |
+
|
275 |
+
$action->setDateSent($date);
|
276 |
+
$action->setStatus("");
|
277 |
+
$action->save();
|
278 |
+
} catch (Exception $e) {
|
279 |
+
Mage::logException($e);
|
280 |
+
$this->_logException($e);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
private function setActionError($action, $e)
|
285 |
+
{
|
286 |
+
try {
|
287 |
+
$message = $e->getMessage();
|
288 |
+
|
289 |
+
$action->setStatus($message);
|
290 |
+
$action->save();
|
291 |
+
} catch (Exception $e) {
|
292 |
+
Mage::logException($e);
|
293 |
+
$this->_logException($e);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
public function processProducts($save_date = true)
|
298 |
+
{
|
299 |
+
try {
|
300 |
+
$this->_setLogArea(Campaigner_Integration_Helper_Troubleshooting::COMMERCE);
|
301 |
+
$this->_log("Products and Categories Processor Start");
|
302 |
+
|
303 |
+
Mage::helper('campaigner/cron')->setCronLastRun(Campaigner_Integration_Helper_Cron::PRODUCTS);
|
304 |
+
|
305 |
+
if (!$this->_helper->commerceConfig('enabled')) {
|
306 |
+
$this->_log("Skipping... Commerce not Enabled");
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
|
310 |
+
if (!$this->_helper->commerceConfig('product_category_enabled')) {
|
311 |
+
$this->_log("Skipping... Product Category Sync not enabled");
|
312 |
+
return;
|
313 |
+
}
|
314 |
+
|
315 |
+
$collection = Mage::getResourceModel('campaigner/product_category_action_collection')->prepareForCronProcess();
|
316 |
+
|
317 |
+
foreach ($collection as $action) {
|
318 |
+
$id = $action->getId();
|
319 |
+
|
320 |
+
$this->performAction($id);
|
321 |
+
}
|
322 |
+
|
323 |
+
$this->_log("Products and Categories Processor End");
|
324 |
+
} catch (Exception $e) {
|
325 |
+
Mage::logException($e);
|
326 |
+
$this->_logException($e);
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
public function manualProductsProcessor()
|
331 |
+
{
|
332 |
+
$this->processProducts(false);
|
333 |
+
}
|
334 |
+
|
335 |
+
}
|
@@ -7,8 +7,6 @@ class Campaigner_Integration_Model_System_Config_Source_Store
|
|
7 |
Mage::helper('campaigner/troubleshooting')->setLogArea(Campaigner_Integration_Helper_Troubleshooting::CONFIG);
|
8 |
Mage::helper('campaigner/troubleshooting')->setLogLevel(Campaigner_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
9 |
|
10 |
-
$lists = Mage::getSingleton('campaigner/wrapper_lists')->getLists();
|
11 |
-
|
12 |
$options = array(
|
13 |
array (
|
14 |
'value' => 'id',
|
7 |
Mage::helper('campaigner/troubleshooting')->setLogArea(Campaigner_Integration_Helper_Troubleshooting::CONFIG);
|
8 |
Mage::helper('campaigner/troubleshooting')->setLogLevel(Campaigner_Integration_Helper_Troubleshooting::LOG_LEVEL_LOW);
|
9 |
|
|
|
|
|
10 |
$options = array(
|
11 |
array (
|
12 |
'value' => 'id',
|
@@ -5,14 +5,9 @@ class Campaigner_Integration_Model_Wrapper_Abandoned extends Campaigner_Integrat
|
|
5 |
{
|
6 |
$listId = (int)Mage::helper('campaigner')->config('abandoned_list');
|
7 |
|
8 |
-
$data =
|
9 |
-
|
10 |
-
|
11 |
-
'contacts' => Array(
|
12 |
-
'ContactData' => $contactData
|
13 |
-
),
|
14 |
-
'globalAddToGroup' => array($listId)
|
15 |
-
);
|
16 |
|
17 |
$service = 'contact';
|
18 |
$method = "ImmediateUpload";
|
5 |
{
|
6 |
$listId = (int)Mage::helper('campaigner')->config('abandoned_list');
|
7 |
|
8 |
+
$data = $this->getBaseData($contactData);
|
9 |
+
|
10 |
+
$data['globalAddToGroup'] = array($listId);
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
$service = 'contact';
|
13 |
$method = "ImmediateUpload";
|
@@ -4,6 +4,36 @@ class Campaigner_Integration_Model_Wrapper_Abstract extends Campaigner_Integrati
|
|
4 |
{
|
5 |
protected $_prefix = "";
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
public function getCommonData($email, $customFields, $newEmail = null, $contactId = 0, $testContact = false)
|
8 |
{
|
9 |
if ($newEmail == null) {
|
4 |
{
|
5 |
protected $_prefix = "";
|
6 |
|
7 |
+
protected function getBaseData($contactData)
|
8 |
+
{
|
9 |
+
return array(
|
10 |
+
'UpdateExistingContacts' => true,
|
11 |
+
'TriggerWorkflow' => Mage::helper('campaigner')->getTriggerWorkflows(),
|
12 |
+
'contacts' => Array(
|
13 |
+
'ContactData' => $contactData
|
14 |
+
),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function addBackgroundTask($contactData, $code, $email = null)
|
19 |
+
{
|
20 |
+
if ($this->_helper->isBackgroundEnabled()) {
|
21 |
+
$this->log("Background Processing Enabled. Adding Task ({$code})...");
|
22 |
+
$task = Mage::getModel('campaigner/background_task');
|
23 |
+
|
24 |
+
if ($email == null) {
|
25 |
+
$email = $contactData['ContactKey']['ContactUniqueIdentifier'];
|
26 |
+
}
|
27 |
+
|
28 |
+
$task->init($email, $code,$contactData);
|
29 |
+
$task->save();
|
30 |
+
$this->log("Task Added.");
|
31 |
+
return true;
|
32 |
+
}
|
33 |
+
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
public function getCommonData($email, $customFields, $newEmail = null, $contactId = 0, $testContact = false)
|
38 |
{
|
39 |
if ($newEmail == null) {
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Wrapper_Commerce_Category extends Campaigner_Integration_Model_Wrapper_Commerce_Execute
|
4 |
+
{
|
5 |
+
private $_max_length = 200;
|
6 |
+
|
7 |
+
private function processExistingCategory($category, $existing)
|
8 |
+
{
|
9 |
+
$name = (string)$category->Name;
|
10 |
+
|
11 |
+
$existing[$name] = array(
|
12 |
+
'id' => (int)$category->CategoryID,
|
13 |
+
'Name' => $name,
|
14 |
+
'Description' => (string)$category->Description,
|
15 |
+
'Image' => (string)$category->Image,
|
16 |
+
'Url' => (string)$category->Url
|
17 |
+
);
|
18 |
+
|
19 |
+
$subs = array();
|
20 |
+
|
21 |
+
if (!empty($category->Categories)) {
|
22 |
+
foreach ($category->Categories->ProductCategory as $sub) {
|
23 |
+
$subs = $this->processExistingCategory($sub, $subs);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
$existing[$name]['Categories'] = $subs;
|
28 |
+
|
29 |
+
return $existing;
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getExistingCategories()
|
33 |
+
{
|
34 |
+
$existing = array();
|
35 |
+
$categories = $this->sendCommand('product_categories',null,null,null,'GET');
|
36 |
+
|
37 |
+
if (isset($categories->ErrorCode)) {
|
38 |
+
return $existing;
|
39 |
+
}
|
40 |
+
|
41 |
+
$existing = array();
|
42 |
+
|
43 |
+
$existing = $this->processExistingCategory($categories, $existing);
|
44 |
+
|
45 |
+
return $existing;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getCategoryByName($name)
|
49 |
+
{
|
50 |
+
$response = $this->sendCommand('category_by_name', null, $name, null, 'GET');
|
51 |
+
return $response;
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getCategoryXml($category)
|
55 |
+
{
|
56 |
+
$xml = "<ProductCategory>";
|
57 |
+
|
58 |
+
$name = $category->getName();
|
59 |
+
$description = $category->getDescription();
|
60 |
+
$image = null;
|
61 |
+
if ($category->getImage()) {
|
62 |
+
$image = $category->getImageUrl();
|
63 |
+
}
|
64 |
+
|
65 |
+
$url = $category->getUrl();
|
66 |
+
|
67 |
+
$xml .= "<Name><![CDATA[{$name}]]></Name>";
|
68 |
+
|
69 |
+
if ($description != null) {
|
70 |
+
$description = substr($description, 0, $this->_max_length);
|
71 |
+
$xml .= "<Description><![CDATA[{$description}]]></Description>";
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($image != null) {
|
75 |
+
$image = substr($image, 0, $this->_max_length);
|
76 |
+
$xml .= "<Image><![CDATA[{$image}]]></Image>";
|
77 |
+
}
|
78 |
+
|
79 |
+
if ($url != null) {
|
80 |
+
$url = substr($url, 0, $this->_max_length);
|
81 |
+
$xml .= "<URL><![CDATA[{$url}]]></URL>";
|
82 |
+
}
|
83 |
+
|
84 |
+
$xml .= "</ProductCategory>";
|
85 |
+
|
86 |
+
return $xml;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function addCategory($category, $parent_id = null)
|
90 |
+
{
|
91 |
+
$xml = $this->getCategoryXml($category);
|
92 |
+
|
93 |
+
$this->_logger->log($xml, "Add Category Xml");
|
94 |
+
|
95 |
+
$response = $this->sendCommand('product_categories', null, $parent_id, $xml);
|
96 |
+
return $response;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function updateCategory($category, $campaigner_id)
|
100 |
+
{
|
101 |
+
$xml = $this->getCategoryXml($category);
|
102 |
+
|
103 |
+
$this->_logger->log($xml, "Update Category Xml");
|
104 |
+
|
105 |
+
$response = $this->sendCommand('product_categories', null, $campaigner_id, $xml, 'PUT');
|
106 |
+
return $response;
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getCategory($category_id)
|
110 |
+
{
|
111 |
+
$response = $this->sendCommand('product_categories', null, $category_id, null, 'GET');
|
112 |
+
return $response;
|
113 |
+
}
|
114 |
+
}
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Wrapper_Commerce_Execute
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_helper = Mage::helper('campaigner');
|
8 |
+
$this->_logger = Mage::helper('campaigner/troubleshooting');
|
9 |
+
}
|
10 |
+
|
11 |
+
private function parseHttpResponse($str)
|
12 |
+
{
|
13 |
+
try {
|
14 |
+
if ($str == "connect() timed out!") {
|
15 |
+
return array("code" => 'timeout', "msg" => "Connection timeout!");
|
16 |
+
}
|
17 |
+
|
18 |
+
$parts = explode(PHP_EOL,$str,2);
|
19 |
+
|
20 |
+
$http_parts = explode(' ',$parts[0],3);
|
21 |
+
|
22 |
+
if (!isset($http_parts[1]) || !isset($http_parts[2])) {
|
23 |
+
throw new Exception("Unable to process HTTP Response", 1);
|
24 |
+
}
|
25 |
+
|
26 |
+
return array("code" => $http_parts[1], "msg" => $http_parts[2]);
|
27 |
+
} catch (Exception $e) {
|
28 |
+
$this->_logger->log($e->getMessage(),"Failed to parse HTTP Response");
|
29 |
+
$this->_logger->log($str,"HTTP Response");
|
30 |
+
|
31 |
+
return array("code" => "0", "msg" => "Failed to parse HTTP Response");
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function sendCommand($command, $subcommand = null, $id= null, $xmldata=null, $method = "POST")
|
36 |
+
{
|
37 |
+
$debug = $this->_logger->isDebugMode();
|
38 |
+
|
39 |
+
if ($debug) {
|
40 |
+
$this->_logger->setDebugRequest($xmldata);
|
41 |
+
|
42 |
+
if ($this->_logger->getDebugExecuteMode() == 'request_only') {
|
43 |
+
return $xmldata;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
if (!$this->_helper->commerceEnabled()) {
|
48 |
+
$strxml = "<Response><ErrorCode>0</ErrorCode><Message>Campaigner not enabled</Message></Response>";
|
49 |
+
return simplexml_load_string($strxml);
|
50 |
+
}
|
51 |
+
|
52 |
+
$apikey = $this->_helper->getApiKey();
|
53 |
+
|
54 |
+
$response = $this->sendCommandDirect($apikey, $command, $subcommand,$id,$xmldata,$method);
|
55 |
+
|
56 |
+
if ($debug) {
|
57 |
+
$this->_logger->setDebugResponse($response->saveXml());
|
58 |
+
}
|
59 |
+
return $response;
|
60 |
+
}
|
61 |
+
|
62 |
+
private function getHeaders($apikey)
|
63 |
+
{
|
64 |
+
$custom_headers = $this->_helper->getCustomHeaders();
|
65 |
+
|
66 |
+
$headers = array(
|
67 |
+
'Content-Type: text/xml',
|
68 |
+
'ApiKey: '.$apikey,
|
69 |
+
'Accept: application/xml'
|
70 |
+
);
|
71 |
+
|
72 |
+
foreach ($custom_headers as $key => $value) {
|
73 |
+
$key = str_replace(" ", "-", $key);
|
74 |
+
$headers[] = "{$key}: {$value}";
|
75 |
+
}
|
76 |
+
|
77 |
+
return $headers;
|
78 |
+
}
|
79 |
+
|
80 |
+
public function sendCommandDirect($apikey, $command, $subcommand = null, $id= null, $xmldata=null, $method = "POST")
|
81 |
+
{
|
82 |
+
$error = false;
|
83 |
+
|
84 |
+
$this->_logger->log("Command: {$command}");
|
85 |
+
if ($subcommand != null) {
|
86 |
+
$this->_logger->log("Sub Command: {$subcommand}");
|
87 |
+
}
|
88 |
+
if ($id != null) {
|
89 |
+
$this->_logger->log("ID: {$id}");
|
90 |
+
}
|
91 |
+
if ($xmldata != null) {
|
92 |
+
$this->_logger->log("XML");
|
93 |
+
$this->_logger->log($xmldata);
|
94 |
+
}
|
95 |
+
$this->_logger->log("Method: {$method}");
|
96 |
+
if (!$apikey || $apikey == "") {
|
97 |
+
$strxml = "<Response><ErrorCode>0</ErrorCode><Message>Invalid or Missing APIKey</Message></Response>";
|
98 |
+
$this->log($strxml,"Response");
|
99 |
+
return simplexml_load_string($strxml);
|
100 |
+
}
|
101 |
+
|
102 |
+
if ($xmldata != null) {
|
103 |
+
$this->_logger->logXml($xmldata,"Xml Data ({$command})");
|
104 |
+
}
|
105 |
+
|
106 |
+
$URL = $this->_helper->config('commerce/accesspoint');
|
107 |
+
$urlsuffix = $this->_helper->config("commerce/{$command}");
|
108 |
+
$URL .= $urlsuffix;
|
109 |
+
if ($id) {
|
110 |
+
$id = rawurlencode($id);
|
111 |
+
if (strpos($urlsuffix,"?") !== false) {
|
112 |
+
$URL .= $id;
|
113 |
+
} else {
|
114 |
+
$URL .= "/{$id}";
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
if ($subcommand) {
|
119 |
+
$URL .= "/{$subcommand}";
|
120 |
+
}
|
121 |
+
|
122 |
+
$this->_logger->log("API KEY: {$apikey}");
|
123 |
+
$this->_logger->log("URL: {$URL}");
|
124 |
+
|
125 |
+
$headers = $this->getHeaders($apikey);
|
126 |
+
|
127 |
+
$this->_logger->log($headers, "Headers");
|
128 |
+
|
129 |
+
$ch = curl_init($URL);
|
130 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
131 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
132 |
+
curl_setopt($ch, CURLOPT_HEADER, true);
|
133 |
+
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
134 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
135 |
+
//curl_setopt($ch, CURLOPT_TIMEOUT_MS, 250);
|
136 |
+
|
137 |
+
switch ($method)
|
138 |
+
{
|
139 |
+
case "DELETE":
|
140 |
+
{
|
141 |
+
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
|
142 |
+
} break;
|
143 |
+
case "POST":
|
144 |
+
{
|
145 |
+
curl_setopt($ch, CURLOPT_POST, 0);
|
146 |
+
if ($xmldata) {
|
147 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);
|
148 |
+
}
|
149 |
+
} break;
|
150 |
+
case "PUT":
|
151 |
+
{
|
152 |
+
$putString = stripslashes($xmldata);
|
153 |
+
$putData = tmpfile();
|
154 |
+
fwrite($putData, $putString);
|
155 |
+
fseek($putData, 0);
|
156 |
+
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
|
157 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
158 |
+
curl_setopt($ch, CURLOPT_PUT, true);
|
159 |
+
curl_setopt($ch, CURLOPT_INFILE, $putData);
|
160 |
+
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
|
161 |
+
} break;
|
162 |
+
case "GET":
|
163 |
+
{
|
164 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true);
|
165 |
+
} break;
|
166 |
+
}
|
167 |
+
|
168 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
169 |
+
|
170 |
+
$output = curl_exec($ch);
|
171 |
+
|
172 |
+
if (curl_errno($ch) != 0) {
|
173 |
+
$this->_logger->log("ERROR");
|
174 |
+
$code = curl_errno($ch);
|
175 |
+
$msg = curl_error($ch);
|
176 |
+
$strxml = "<Response><ErrorCode>{$code}</ErrorCode><Message>{$msg}</Message></Response>";
|
177 |
+
$error = true;
|
178 |
+
}
|
179 |
+
|
180 |
+
curl_close($ch);
|
181 |
+
|
182 |
+
if (!$error) {
|
183 |
+
$this->_logger->log($output, "RAW OUTPUT");
|
184 |
+
|
185 |
+
$start = strpos($output,'<?xml');
|
186 |
+
if (!$start) {
|
187 |
+
$start = strpos($output,'<Response>');
|
188 |
+
}
|
189 |
+
|
190 |
+
if (!$start) {
|
191 |
+
$results = $this->parseHttpResponse($output);
|
192 |
+
$strxml = "<Response><ErrorCode>{$results['code']}</ErrorCode><Message>{$results['msg']}</Message></Response>";
|
193 |
+
}
|
194 |
+
else {
|
195 |
+
$strxml = substr($output,$start);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
try {
|
200 |
+
$xml = simplexml_load_string($strxml);
|
201 |
+
} catch(Exception $e) {
|
202 |
+
Mage::throwException($e->getMessage());
|
203 |
+
}
|
204 |
+
|
205 |
+
$this->_logger->log($xml, "Response");
|
206 |
+
|
207 |
+
return $xml;
|
208 |
+
}
|
209 |
+
}
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Wrapper_Commerce_Orders extends Campaigner_Integration_Model_Wrapper_Commerce_Execute
|
4 |
+
{
|
5 |
+
public function getOrderXml($order, $email = null)
|
6 |
+
{
|
7 |
+
$date = $order->getCreatedAt();
|
8 |
+
$orderNum = $order->getIncrementId();
|
9 |
+
|
10 |
+
$items = $order->getAllItems();
|
11 |
+
|
12 |
+
$xml = "<Order>";
|
13 |
+
if ($email != null) {
|
14 |
+
$xml .= "<EmailAddress><![CDATA[{$email}]]></EmailAddress>";
|
15 |
+
}
|
16 |
+
|
17 |
+
$status = $order->getStatus();
|
18 |
+
|
19 |
+
$xml .= "<PurchaseDate><![CDATA[{$date}]]></PurchaseDate>";
|
20 |
+
$xml .= "<OrderNumber><![CDATA[{$orderNum}]]></OrderNumber>";
|
21 |
+
$xml .= "<Status><![CDATA[{$status}]]></Status>";
|
22 |
+
|
23 |
+
if (is_array($items)) {
|
24 |
+
$parent_items = array();
|
25 |
+
foreach($items as $item) {
|
26 |
+
$type = $item->getProductType();
|
27 |
+
if ($type == "bundle") {
|
28 |
+
$parent_items[$item->getId()] = $item;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
$xml .= "<Items>";
|
33 |
+
|
34 |
+
foreach ($items as $item) {
|
35 |
+
$type = $item->getProductType();
|
36 |
+
$parent = null;
|
37 |
+
if ($item->getParentItemId() != null) {
|
38 |
+
if (isset($parent_items[$item->getParentItemId()])) {
|
39 |
+
$parent = $parent_items[$item->getParentItemId()];
|
40 |
+
} else {
|
41 |
+
continue;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$qty = (int)$item->getQtyOrdered();
|
46 |
+
$name = $item->getName();
|
47 |
+
$sku = $item->getSku();
|
48 |
+
if ($type == "bundle") {
|
49 |
+
$price = 0;
|
50 |
+
} else {
|
51 |
+
$price = $item->getPrice();
|
52 |
+
}
|
53 |
+
$weight = $item->getWeight();
|
54 |
+
$status = 'Completed';
|
55 |
+
|
56 |
+
if ($weight) {
|
57 |
+
$weight = "<Weight>{$weight}</Weight>";
|
58 |
+
}
|
59 |
+
|
60 |
+
$xml .= "<OrderItem>"
|
61 |
+
. "<ProductName><![CDATA[$name]]></ProductName>"
|
62 |
+
. "<SKU><![CDATA[{$sku}]]></SKU>"
|
63 |
+
. "<Quantity>{$qty}</Quantity>"
|
64 |
+
. "<UnitPrice>{$price}</UnitPrice>"
|
65 |
+
. $weight
|
66 |
+
. "<Status><![CDATA[{$status}]]></Status>"
|
67 |
+
. "</OrderItem>";
|
68 |
+
}
|
69 |
+
|
70 |
+
$xml .= "</Items>";
|
71 |
+
}
|
72 |
+
$xml .= "</Order>";
|
73 |
+
|
74 |
+
return $xml;
|
75 |
+
}
|
76 |
+
|
77 |
+
public function sendOrder($order)
|
78 |
+
{
|
79 |
+
$xml = $this->getOrderXml($order);
|
80 |
+
|
81 |
+
$xml = "<Subscribers><Subscriber><EmailAddress>{$order->getCustomerEmail()}</EmailAddress><Orders>{$xml}</Orders></Subscriber></Subscribers>";
|
82 |
+
|
83 |
+
return $this->sendCommand('orders', '', null, $xml);
|
84 |
+
}
|
85 |
+
|
86 |
+
public function sendOrders($orders)
|
87 |
+
{
|
88 |
+
return $this->sendCommand('orders', '', null, $orders);
|
89 |
+
}
|
90 |
+
}
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Model_Wrapper_Commerce_Product extends Campaigner_Integration_Model_Wrapper_Commerce_Execute
|
4 |
+
{
|
5 |
+
private $_max_length = 200;
|
6 |
+
|
7 |
+
public function getCategories($category_ids, $tag = "int")
|
8 |
+
{
|
9 |
+
$xml = "";
|
10 |
+
if (count($category_ids) > 0) {
|
11 |
+
$xml .= "<Categories>";
|
12 |
+
|
13 |
+
foreach ($category_ids as $category_id) {
|
14 |
+
$xml .= "<{$tag}>{$category_id}</{$tag}>";
|
15 |
+
}
|
16 |
+
|
17 |
+
$xml .= "</Categories>";
|
18 |
+
}
|
19 |
+
|
20 |
+
return $xml;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getProductXml($product, $category_ids = array())
|
24 |
+
{
|
25 |
+
$xml = "<Product>";
|
26 |
+
|
27 |
+
$name = $product->getName();
|
28 |
+
$sku = $product->getSku();
|
29 |
+
$description = $product->getDescription();
|
30 |
+
$short_description = $product->getShortDescription();
|
31 |
+
$weight = $product->getWeight();
|
32 |
+
$price = $product->getprice();
|
33 |
+
$image = Mage::helper('campaigner/order')->getProductImage($product);
|
34 |
+
|
35 |
+
$url = $product->getUrl();
|
36 |
+
|
37 |
+
$xml .= "<SKU><![CDATA[{$sku}]]></SKU>";
|
38 |
+
$xml .= "<ProductName><![CDATA[{$name}]]></ProductName>";
|
39 |
+
|
40 |
+
if ($description != null) {
|
41 |
+
$description = substr($description, 0, 2000);
|
42 |
+
$xml .= "<LongDescription><![CDATA[{$description}]]></LongDescription>";
|
43 |
+
}
|
44 |
+
|
45 |
+
if ($short_description != null) {
|
46 |
+
$short_description = substr($short_description, 0, $this->_max_length);
|
47 |
+
$xml .= "<ShortDescription><![CDATA[{$short_description}]]></ShortDescription>";
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($image != null && $image != "") {
|
51 |
+
$image = substr($image, 0, $this->_max_length);
|
52 |
+
$xml .= "<ProductImage><![CDATA[{$image}]]></ProductImage>";
|
53 |
+
}
|
54 |
+
|
55 |
+
if ($url != null) {
|
56 |
+
$url = substr($url, 0, $this->_max_length);
|
57 |
+
$xml .= "<ProductURL><![CDATA[{$url}]]></ProductURL>";
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($weight) {
|
61 |
+
$xml .= "<Weight>{$weight}</Weight>";
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($price) {
|
65 |
+
$xml .= "<Price>{$price}</Price>";
|
66 |
+
}
|
67 |
+
|
68 |
+
$xml .= $this->getCategories($category_ids);
|
69 |
+
|
70 |
+
$xml .= "</Product>";
|
71 |
+
|
72 |
+
return $xml;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function addProduct($product, $category_ids = array())
|
76 |
+
{
|
77 |
+
$xml = $this->getProductXml($product, $category_ids);
|
78 |
+
|
79 |
+
$this->_logger->log($xml, "Add Product Xml");
|
80 |
+
|
81 |
+
$response = $this->sendCommand('products', null, null, $xml);
|
82 |
+
return $response;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function updateProduct($product, $product_id)
|
86 |
+
{
|
87 |
+
$xml = $this->getProductXml($product);
|
88 |
+
|
89 |
+
$this->_logger->log($xml, "Update Product Xml");
|
90 |
+
|
91 |
+
$response = $this->sendCommand('products', null, $product_id, $xml, 'PUT');
|
92 |
+
return $response;
|
93 |
+
}
|
94 |
+
|
95 |
+
public function updateProductCategories($campaigner_id, $add_categories, $delete_categories = array())
|
96 |
+
{
|
97 |
+
$add_xml = $this->getCategories($add_categories, "Category");
|
98 |
+
$delete_xml = $this->getCategories($delete_categories, "Category");
|
99 |
+
|
100 |
+
$this->_logger->log("UPDATE PRODUCT CATEGORIES");
|
101 |
+
|
102 |
+
if ($delete_xml != "") {
|
103 |
+
$this->_logger->log($delete_xml);
|
104 |
+
|
105 |
+
$response = $this->sendCommand('products', "RemoveFromCategories", $campaigner_id, $delete_xml);
|
106 |
+
|
107 |
+
$this->_logger->log($response);
|
108 |
+
}
|
109 |
+
|
110 |
+
if ($add_xml != "") {
|
111 |
+
$this->_logger->log($add_xml);
|
112 |
+
|
113 |
+
$response = $this->sendCommand('products', "AddToCategories", $campaigner_id, $add_xml);
|
114 |
+
|
115 |
+
$this->_logger->log($response);
|
116 |
+
}
|
117 |
+
|
118 |
+
return "";
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getProductDetails($sku)
|
122 |
+
{
|
123 |
+
$response = $this->sendCommand('product_details', null, $sku, null);
|
124 |
+
return $response;
|
125 |
+
}
|
126 |
+
|
127 |
+
public function deleteProduct($id)
|
128 |
+
{
|
129 |
+
$response = $this->sendCommand('products', null, $id, null, 'DELETE');
|
130 |
+
return $response;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getProducts()
|
134 |
+
{
|
135 |
+
$response = $this->sendCommand('products');
|
136 |
+
return $response;
|
137 |
+
}
|
138 |
+
}
|
@@ -55,6 +55,21 @@ class Campaigner_Integration_Model_Wrapper_Execute
|
|
55 |
return $data;
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
public function sendCommandDirect($username, $password, $service, $method, $tag = null, $data = null)
|
59 |
{
|
60 |
if ((!$username || $username == "") || (!$password || $password == "")) {
|
@@ -78,6 +93,10 @@ class Campaigner_Integration_Model_Wrapper_Execute
|
|
78 |
'trace' => true,
|
79 |
'connection_timeout' => 300));
|
80 |
|
|
|
|
|
|
|
|
|
81 |
$authentication = array(
|
82 |
"Username" => $username,
|
83 |
"Password" => $password
|
55 |
return $data;
|
56 |
}
|
57 |
|
58 |
+
private function getHeaders()
|
59 |
+
{
|
60 |
+
$custom_headers = $this->_helper->getCustomHeaders();
|
61 |
+
|
62 |
+
$headers = array();
|
63 |
+
|
64 |
+
foreach ($custom_headers as $key => $value) {
|
65 |
+
|
66 |
+
$headers[] = new SoapHeader('https://ws.campaigner.com/2013/01/',
|
67 |
+
str_replace(" ","_",$key),
|
68 |
+
$value);
|
69 |
+
}
|
70 |
+
return $headers;
|
71 |
+
}
|
72 |
+
|
73 |
public function sendCommandDirect($username, $password, $service, $method, $tag = null, $data = null)
|
74 |
{
|
75 |
if ((!$username || $username == "") || (!$password || $password == "")) {
|
93 |
'trace' => true,
|
94 |
'connection_timeout' => 300));
|
95 |
|
96 |
+
$headers = $this->getHeaders();
|
97 |
+
|
98 |
+
$client->__setSoapHeaders($headers);
|
99 |
+
|
100 |
$authentication = array(
|
101 |
"Username" => $username,
|
102 |
"Password" => $password
|
@@ -4,13 +4,7 @@ class Campaigner_Integration_Model_Wrapper_Orders extends Campaigner_Integration
|
|
4 |
{
|
5 |
public function send($contactData)
|
6 |
{
|
7 |
-
$data =
|
8 |
-
'UpdateExistingContacts' => true,
|
9 |
-
'TriggerWorkflow' => false,
|
10 |
-
'contacts' => Array(
|
11 |
-
'ContactData' => $contactData
|
12 |
-
),
|
13 |
-
);
|
14 |
|
15 |
$service = 'contact';
|
16 |
$method = "ImmediateUpload";
|
@@ -22,13 +16,7 @@ class Campaigner_Integration_Model_Wrapper_Orders extends Campaigner_Integration
|
|
22 |
{
|
23 |
$contactData = $this->getEmailContactData($email, $merge_vars);
|
24 |
|
25 |
-
$data =
|
26 |
-
'UpdateExistingContacts' => true,
|
27 |
-
'TriggerWorkflow' => false,
|
28 |
-
'contacts' => Array(
|
29 |
-
'ContactData' => $contactData
|
30 |
-
),
|
31 |
-
);
|
32 |
|
33 |
$service = 'contact';
|
34 |
$method = "ImmediateUpload";
|
4 |
{
|
5 |
public function send($contactData)
|
6 |
{
|
7 |
+
$data = $this->getBaseData($contactData);
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
$service = 'contact';
|
10 |
$method = "ImmediateUpload";
|
16 |
{
|
17 |
$contactData = $this->getEmailContactData($email, $merge_vars);
|
18 |
|
19 |
+
$data = $this->getBaseData($contactData);
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
$service = 'contact';
|
22 |
$method = "ImmediateUpload";
|
@@ -22,7 +22,25 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
22 |
return false;
|
23 |
}
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
{
|
27 |
// Check first so that it stores the current data if nothing has been
|
28 |
// stored yet
|
@@ -31,19 +49,25 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
31 |
return;
|
32 |
}
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
'TriggerWorkflow' => false,
|
37 |
-
'contacts' => Array(
|
38 |
-
'ContactData' => $contactData
|
39 |
-
),
|
40 |
-
);
|
41 |
-
|
42 |
if ($subscribe) {
|
43 |
$listId = (int)Mage::helper('campaigner')->config('list');
|
44 |
-
$
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
$service = 'contact';
|
48 |
$method = "ImmediateUpload";
|
49 |
|
@@ -57,11 +81,17 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
57 |
return $this->_add($contactData, $subscribe);
|
58 |
}
|
59 |
|
60 |
-
public function changeEmail($customer)
|
61 |
{
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
-
return $this->_add($contactData);
|
65 |
}
|
66 |
|
67 |
public function addByEmail($email, $merge_vars, $subscribe = false)
|
@@ -102,13 +132,7 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
102 |
$contactData['RemoveFromGroup'] = $remove;
|
103 |
}
|
104 |
|
105 |
-
$data =
|
106 |
-
'UpdateExistingContacts' => true,
|
107 |
-
'TriggerWorkflow' => false,
|
108 |
-
'contacts' => Array(
|
109 |
-
'ContactData' => $contactData
|
110 |
-
)
|
111 |
-
);
|
112 |
|
113 |
$service = 'contact';
|
114 |
$method = "ImmediateUpload";
|
@@ -161,13 +185,7 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
161 |
{
|
162 |
$contactData = $this->getEmailContactData($email, $merge_vars);
|
163 |
|
164 |
-
$data =
|
165 |
-
'UpdateExistingContacts' => true,
|
166 |
-
'TriggerWorkflow' => false,
|
167 |
-
'contacts' => Array(
|
168 |
-
'ContactData' => $contactData
|
169 |
-
),
|
170 |
-
);
|
171 |
|
172 |
$service = 'contact';
|
173 |
$method = "ImmediateUpload";
|
@@ -199,24 +217,14 @@ class Campaigner_Integration_Model_Wrapper_subscribers extends Campaigner_Integr
|
|
199 |
{
|
200 |
$merge_vars = array("LastLogin" => $date);
|
201 |
|
202 |
-
|
203 |
-
|
|
|
204 |
|
205 |
-
|
206 |
-
$action->save();
|
207 |
return;
|
208 |
}
|
209 |
|
210 |
-
$contactData = $this->getEmailContactData($email, $merge_vars);
|
211 |
-
|
212 |
-
$data = array(
|
213 |
-
'UpdateExistingContacts' => true,
|
214 |
-
'TriggerWorkflow' => false,
|
215 |
-
'contacts' => Array(
|
216 |
-
'ContactData' => $contactData
|
217 |
-
),
|
218 |
-
);
|
219 |
-
|
220 |
$service = 'contact';
|
221 |
$method = "ImmediateUpload";
|
222 |
|
22 |
return false;
|
23 |
}
|
24 |
|
25 |
+
public function massUpdate($contactData, $subscribe = false)
|
26 |
+
{
|
27 |
+
$data = $this->getBaseData($contactData);
|
28 |
+
|
29 |
+
if ($subscribe !== false) {
|
30 |
+
if (is_array($subscribe)) {
|
31 |
+
$data['globalAddToGroup'] = $subscribe;
|
32 |
+
} else {
|
33 |
+
$data['globalAddToGroup'] = array($subscribe);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
$service = 'contact';
|
38 |
+
$method = "ImmediateUpload";
|
39 |
+
|
40 |
+
return $this->sendCommand($service, $method, null, $data);
|
41 |
+
}
|
42 |
+
|
43 |
+
private function _add($contactData, $subscribe = false, $background = true)
|
44 |
{
|
45 |
// Check first so that it stores the current data if nothing has been
|
46 |
// stored yet
|
49 |
return;
|
50 |
}
|
51 |
|
52 |
+
// Add the subscription after so that the contact cache checking will
|
53 |
+
// see that everything else is the same
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
if ($subscribe) {
|
55 |
$listId = (int)Mage::helper('campaigner')->config('list');
|
56 |
+
$contactData['AddToGroup'] = array($listId);
|
57 |
}
|
58 |
|
59 |
+
$task = "subscribe";
|
60 |
+
|
61 |
+
if (!$subscribe) {
|
62 |
+
$task = "update";
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($background && $this->addBackgroundTask($contactData, $task)) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
$data = $this->getBaseData($contactData);
|
70 |
+
|
71 |
$service = 'contact';
|
72 |
$method = "ImmediateUpload";
|
73 |
|
81 |
return $this->_add($contactData, $subscribe);
|
82 |
}
|
83 |
|
84 |
+
public function changeEmail($customer, $subscribe = true)
|
85 |
{
|
86 |
+
Mage::getSingleton('campaigner/background_observer')->processPendingTasks($customer->getOrigData('email'), $customer->getStoreId());
|
87 |
+
|
88 |
+
if ($subscribe) {
|
89 |
+
$contactData = $this->getContactData($customer, array('Status' => "Subscribed"));
|
90 |
+
} else {
|
91 |
+
$contactData = $this->getContactData($customer);
|
92 |
+
}
|
93 |
|
94 |
+
return $this->_add($contactData, false, false);
|
95 |
}
|
96 |
|
97 |
public function addByEmail($email, $merge_vars, $subscribe = false)
|
132 |
$contactData['RemoveFromGroup'] = $remove;
|
133 |
}
|
134 |
|
135 |
+
$data = $this->getBaseData($contactData);
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
$service = 'contact';
|
138 |
$method = "ImmediateUpload";
|
185 |
{
|
186 |
$contactData = $this->getEmailContactData($email, $merge_vars);
|
187 |
|
188 |
+
$data = $this->getBaseData($contactData);
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
$service = 'contact';
|
191 |
$method = "ImmediateUpload";
|
217 |
{
|
218 |
$merge_vars = array("LastLogin" => $date);
|
219 |
|
220 |
+
$contactData = $this->getEmailContactData($email, $merge_vars);
|
221 |
+
|
222 |
+
$data = $this->getBaseData($contactData);
|
223 |
|
224 |
+
if ($this->addBackgroundTask($contactData, "last_login", $email)) {
|
|
|
225 |
return;
|
226 |
}
|
227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
$service = 'contact';
|
229 |
$method = "ImmediateUpload";
|
230 |
|
@@ -3,24 +3,22 @@ class Campaigner_Integration_Model_Wrapper_Wishlist extends Campaigner_Integrati
|
|
3 |
{
|
4 |
public function send($email, $merge_vars)
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
$action->save();
|
12 |
return;
|
13 |
}
|
14 |
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
'ContactData' => $contactData
|
22 |
-
),
|
23 |
-
);
|
24 |
|
25 |
$service = 'contact';
|
26 |
$method = "ImmediateUpload";
|
3 |
{
|
4 |
public function send($email, $merge_vars)
|
5 |
{
|
6 |
+
$contactData = $this->getEmailContactData($email, $merge_vars);
|
7 |
+
|
8 |
+
$data = $this->getBaseData($contactData);
|
9 |
|
10 |
+
if ($this->addBackgroundTask($contactData, "wishlist", $email)) {
|
|
|
11 |
return;
|
12 |
}
|
13 |
|
14 |
+
/*if ($this->_helper->isBackgroundEnabled()) {
|
15 |
+
$this->log("Background Processing Enabled");
|
16 |
+
$task = Mage::getModel('campaigner/background_task');
|
17 |
|
18 |
+
$task->init($email, "WISHLIST",$contactData);
|
19 |
+
$task->save();
|
20 |
+
return;
|
21 |
+
}*/
|
|
|
|
|
|
|
22 |
|
23 |
$service = 'contact';
|
24 |
$method = "ImmediateUpload";
|
@@ -2,15 +2,6 @@
|
|
2 |
|
3 |
class Campaigner_Integration_AbandonedController extends Campaigner_Integration_Controller_Front_Abstract
|
4 |
{
|
5 |
-
public function testAction()
|
6 |
-
{
|
7 |
-
$customer_session = Mage::getSingleton("customer/session");
|
8 |
-
|
9 |
-
$magento_session_id = $customer_session->getEncryptedSessionId();
|
10 |
-
|
11 |
-
echo "[$magento_session_id]";
|
12 |
-
}
|
13 |
-
|
14 |
public function restoreAction()
|
15 |
{
|
16 |
try {
|
@@ -18,6 +9,10 @@ class Campaigner_Integration_AbandonedController extends Campaigner_Integration_
|
|
18 |
|
19 |
$cart_data = unserialize(base64_decode($coded_cart));
|
20 |
|
|
|
|
|
|
|
|
|
21 |
$this->clearCart($cart_data['quote']);
|
22 |
$this->restoreCartItems($cart_data);
|
23 |
|
@@ -85,7 +80,7 @@ class Campaigner_Integration_AbandonedController extends Campaigner_Integration_
|
|
85 |
|
86 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
87 |
$product = Mage::getModel('catalog/product')->load($id);
|
88 |
-
if (!$product) {
|
89 |
continue;
|
90 |
}
|
91 |
|
@@ -103,11 +98,11 @@ class Campaigner_Integration_AbandonedController extends Campaigner_Integration_
|
|
103 |
{
|
104 |
$parent_product = Mage::getModel('catalog/product')->load($option);
|
105 |
|
106 |
-
if (!$parent_product)
|
107 |
continue;
|
|
|
108 |
|
109 |
-
if (!isset($group_list[$option]))
|
110 |
-
{
|
111 |
$group_list[$option] = array(
|
112 |
'position' => $position,
|
113 |
'product_type' => 'grouped',
|
@@ -133,7 +128,7 @@ class Campaigner_Integration_AbandonedController extends Campaigner_Integration_
|
|
133 |
|
134 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
135 |
$product = Mage::getModel('catalog/product')->load($item_id);
|
136 |
-
if (!$product) {
|
137 |
continue;
|
138 |
}
|
139 |
|
@@ -162,6 +157,10 @@ class Campaigner_Integration_AbandonedController extends Campaigner_Integration_
|
|
162 |
|
163 |
$item_list = $this->prepareCartItems($cart_data);
|
164 |
|
|
|
|
|
|
|
|
|
165 |
foreach ($item_list as $item) {
|
166 |
$this->addItemToCart($item);
|
167 |
}
|
2 |
|
3 |
class Campaigner_Integration_AbandonedController extends Campaigner_Integration_Controller_Front_Abstract
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public function restoreAction()
|
6 |
{
|
7 |
try {
|
9 |
|
10 |
$cart_data = unserialize(base64_decode($coded_cart));
|
11 |
|
12 |
+
if (!$cart_data) {
|
13 |
+
Mage::throwException(Mage::helper('campaigner')->__('Unable to Restore your cart. Cart Data is empty'));
|
14 |
+
}
|
15 |
+
|
16 |
$this->clearCart($cart_data['quote']);
|
17 |
$this->restoreCartItems($cart_data);
|
18 |
|
80 |
|
81 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
82 |
$product = Mage::getModel('catalog/product')->load($id);
|
83 |
+
if (!$product || !$product->getId()) {
|
84 |
continue;
|
85 |
}
|
86 |
|
98 |
{
|
99 |
$parent_product = Mage::getModel('catalog/product')->load($option);
|
100 |
|
101 |
+
if (!$parent_product || !$parent_product->getId()) {
|
102 |
continue;
|
103 |
+
}
|
104 |
|
105 |
+
if (!isset($group_list[$option])) {
|
|
|
106 |
$group_list[$option] = array(
|
107 |
'position' => $position,
|
108 |
'product_type' => 'grouped',
|
128 |
|
129 |
// MAKE SURE WE CAN LOAD THE PRODUCT
|
130 |
$product = Mage::getModel('catalog/product')->load($item_id);
|
131 |
+
if (!$product || !$product->getId()) {
|
132 |
continue;
|
133 |
}
|
134 |
|
157 |
|
158 |
$item_list = $this->prepareCartItems($cart_data);
|
159 |
|
160 |
+
if (count($item_list) == 0) {
|
161 |
+
throw new Exception("No cart items found!", 1);
|
162 |
+
}
|
163 |
+
|
164 |
foreach ($item_list as $item) {
|
165 |
$this->addItemToCart($item);
|
166 |
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected function _isAllowed()
|
6 |
{
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_AbandonedController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
protected function _isAllowed()
|
6 |
{
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_Background_TaskController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _isAllowed()
|
6 |
+
{
|
7 |
+
return Mage::getSingleton('admin/session')->isAllowed('campaigner/campaigner_background');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
|
14 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Background Tasks'));
|
15 |
+
$this->_setActiveMenu('campaigner');
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
private function getTask()
|
20 |
+
{
|
21 |
+
$id = $this->getRequest()->getParam('id');
|
22 |
+
|
23 |
+
if (!$id) {
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
$task = Mage::getModel('campaigner/background_task')->load($id);
|
28 |
+
|
29 |
+
if (!$task->getId()) {
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
|
33 |
+
return $task;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function detailsAction()
|
37 |
+
{
|
38 |
+
$task = $this->getTask();
|
39 |
+
|
40 |
+
if ($task === false) {
|
41 |
+
$this->_getSession()->addError("Unable to load Task Details...");
|
42 |
+
$this->_redirect('*/*/index');
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
Mage::register('background_task',$task);
|
47 |
+
|
48 |
+
$this->loadLayout();
|
49 |
+
|
50 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Background Tasks'));
|
51 |
+
$this->_setActiveMenu('campaigner');
|
52 |
+
$this->renderLayout();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function gridAction()
|
56 |
+
{
|
57 |
+
$this->showGrid();
|
58 |
+
}
|
59 |
+
|
60 |
+
private function showGrid()
|
61 |
+
{
|
62 |
+
$this->loadLayout();
|
63 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('campaigner/adminhtml_background_task_grid')->toHtml());
|
64 |
+
}
|
65 |
+
|
66 |
+
public function runAction()
|
67 |
+
{
|
68 |
+
$store_id = $this->getRequest()->getParam('store_id');
|
69 |
+
|
70 |
+
Mage::getSingleton('campaigner/background_observer')->manualBackgroundTaskProcessor($store_id);
|
71 |
+
|
72 |
+
$msg = "The Background Task process has been run";
|
73 |
+
|
74 |
+
if ($store_id) {
|
75 |
+
$msg .= " on store: " . Mage::helper('campaigner')->getFullStoreNameById($store_id);
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__($msg));
|
79 |
+
$this->_redirect('*/*/index');
|
80 |
+
}
|
81 |
+
|
82 |
+
public function sendAction()
|
83 |
+
{
|
84 |
+
try {
|
85 |
+
$id = $this->getRequest()->getParam('id');
|
86 |
+
|
87 |
+
if ($id == null) {
|
88 |
+
$this->_getSession()->addError(Mage::helper('adminhtml')->__("No Tasks were specified."));
|
89 |
+
} else {
|
90 |
+
$id_list = array($id);
|
91 |
+
Mage::getSingleton('campaigner/background_observer')->SendBackgroundTasks($id_list);
|
92 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Task has been sent."));
|
93 |
+
}
|
94 |
+
} catch (Exception $e) {
|
95 |
+
$this->_getSession()->addError($e->getMessage());
|
96 |
+
}
|
97 |
+
$this->_redirect('*/*/index');
|
98 |
+
}
|
99 |
+
|
100 |
+
public function massSendAction()
|
101 |
+
{
|
102 |
+
$params = array();
|
103 |
+
if ($this->getRequest()->isPost()) {
|
104 |
+
$params = $this->getRequest()->getPost();
|
105 |
+
}
|
106 |
+
|
107 |
+
$id_list = $params['id'];
|
108 |
+
|
109 |
+
if (!is_array($id_list)) {
|
110 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one task to send or resend.'));
|
111 |
+
} else {
|
112 |
+
try {
|
113 |
+
$task_status = Mage::getSingleton('campaigner/background_observer')->SendBackgroundTasks($id_list);
|
114 |
+
|
115 |
+
$success_count = 0;
|
116 |
+
$failure_count = 0;
|
117 |
+
foreach ($task_status as $status) {
|
118 |
+
if ($status['success'] == false) {
|
119 |
+
$failure_count++;
|
120 |
+
} else {
|
121 |
+
$success_count++;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
if ($success_count > 0) {
|
126 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
127 |
+
Mage::helper('adminhtml')->__('Total of %d tasks(s) were sent.', $success_count));
|
128 |
+
}
|
129 |
+
|
130 |
+
if ($failure_count > 0) {
|
131 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
132 |
+
Mage::helper('adminhtml')->__('Total of %d tasks(s) failed to send.', $failure_count));
|
133 |
+
}
|
134 |
+
}
|
135 |
+
catch (Exception $e) {
|
136 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
$this->_redirect('*/*/index', Mage::helper('campaigner')->getUrlParams());
|
141 |
+
}
|
142 |
+
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
private $_logger = null;
|
6 |
private $_order = null;
|
@@ -78,7 +78,7 @@ class Campaigner_Integration_Admin_DiagnosticController extends Mage_Adminhtml_C
|
|
78 |
$this->_result['details'] = $details;
|
79 |
}
|
80 |
|
81 |
-
$this->_result['output'] = $this->getCss() . $output;
|
82 |
|
83 |
return true;
|
84 |
}
|
@@ -133,15 +133,23 @@ class Campaigner_Integration_Admin_DiagnosticController extends Mage_Adminhtml_C
|
|
133 |
|
134 |
$store = Mage::getModel('core/store')->load($store_id);
|
135 |
|
136 |
-
$
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
-
return
|
145 |
}
|
146 |
|
147 |
private function decorateArray($array)
|
@@ -290,19 +298,13 @@ class Campaigner_Integration_Admin_DiagnosticController extends Mage_Adminhtml_C
|
|
290 |
return $this->setFailure("Order not found");
|
291 |
}
|
292 |
|
293 |
-
$customer = Mage::helper('campaigner/order')->getOrderCustomer($order);
|
294 |
-
|
295 |
-
$merge_vars = Mage::helper('campaigner/order')->getMergeVars($customer);
|
296 |
-
|
297 |
-
$merge_vars = Mage::helper('campaigner/order')->processOrderItems($order, $merge_vars);
|
298 |
-
|
299 |
if ($request_only) {
|
300 |
$this->_logger->setDebugExecuteMode('request_only');
|
301 |
} else {
|
302 |
$this->_logger->setDebugExecuteMode('full');
|
303 |
}
|
304 |
|
305 |
-
Mage::getSingleton('campaigner/
|
306 |
|
307 |
$this->_output = "<h2>Full Order Diagnostic Results</h2><h3>Request Xml</h3><pre>" . htmlentities($this->_logger->formatXml($this->_logger->getDebugRequest())) . "</pre>";
|
308 |
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_DiagnosticController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
private $_logger = null;
|
6 |
private $_order = null;
|
78 |
$this->_result['details'] = $details;
|
79 |
}
|
80 |
|
81 |
+
$this->_result['output'] = $this->getCss() . utf8_decode($output);
|
82 |
|
83 |
return true;
|
84 |
}
|
133 |
|
134 |
$store = Mage::getModel('core/store')->load($store_id);
|
135 |
|
136 |
+
$collection = Mage::getResourceModel('campaigner/abandoned_collection');
|
137 |
|
138 |
+
$collection->filterByQuoteId($quote_id);
|
139 |
+
|
140 |
+
foreach ($collection as $quote) {
|
141 |
+
$this->_quote = $quote;
|
142 |
+
|
143 |
+
if ($this->_quote != null && !$this->_quote->getId()) {
|
144 |
+
$this->_quote = null;
|
145 |
+
} else {
|
146 |
+
Mage::app()->setCurrentStore($store);
|
147 |
+
}
|
148 |
+
|
149 |
+
return $this->_quote;
|
150 |
}
|
151 |
|
152 |
+
return null;
|
153 |
}
|
154 |
|
155 |
private function decorateArray($array)
|
298 |
return $this->setFailure("Order not found");
|
299 |
}
|
300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
if ($request_only) {
|
302 |
$this->_logger->setDebugExecuteMode('request_only');
|
303 |
} else {
|
304 |
$this->_logger->setDebugExecuteMode('full');
|
305 |
}
|
306 |
|
307 |
+
Mage::getSingleton('campaigner/wrapper_commerce_orders')->sendOrder($order);
|
308 |
|
309 |
$this->_output = "<h2>Full Order Diagnostic Results</h2><h3>Request Xml</h3><pre>" . htmlentities($this->_logger->formatXml($this->_logger->getDebugRequest())) . "</pre>";
|
310 |
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected function _isAllowed()
|
6 |
{
|
@@ -61,7 +61,7 @@ class Campaigner_Integration_Admin_LatestController extends Mage_Adminhtml_Contr
|
|
61 |
$this->_getSession()->addError(Mage::helper('adminhtml')->__("No Orders were specified."));
|
62 |
} else {
|
63 |
$id_list = array($id);
|
64 |
-
Mage::getSingleton('campaigner/order_observer')->
|
65 |
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Latest Order has been sent."));
|
66 |
}
|
67 |
} catch (Exception $e) {
|
@@ -83,7 +83,7 @@ class Campaigner_Integration_Admin_LatestController extends Mage_Adminhtml_Contr
|
|
83 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one order to send or resend.'));
|
84 |
} else {
|
85 |
try {
|
86 |
-
$order_status = Mage::getSingleton('campaigner/order_observer')->
|
87 |
|
88 |
$success_count = 0;
|
89 |
$failure_count = 0;
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_LatestController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
protected function _isAllowed()
|
6 |
{
|
61 |
$this->_getSession()->addError(Mage::helper('adminhtml')->__("No Orders were specified."));
|
62 |
} else {
|
63 |
$id_list = array($id);
|
64 |
+
Mage::getSingleton('campaigner/order_observer')->sendLatestOrders($id_list);
|
65 |
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Latest Order has been sent."));
|
66 |
}
|
67 |
} catch (Exception $e) {
|
83 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one order to send or resend.'));
|
84 |
} else {
|
85 |
try {
|
86 |
+
$order_status = Mage::getSingleton('campaigner/order_observer')->sendLatestOrders($id_list);
|
87 |
|
88 |
$success_count = 0;
|
89 |
$failure_count = 0;
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_OrderController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _isAllowed()
|
6 |
+
{
|
7 |
+
return Mage::getSingleton('admin/session')->isAllowed('campaigner/campaigner_orders');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
|
14 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Orders'));
|
15 |
+
$this->_setActiveMenu('campaigner');
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function detailsAction()
|
20 |
+
{
|
21 |
+
$this->loadLayout();
|
22 |
+
|
23 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Orders'));
|
24 |
+
$this->_setActiveMenu('campaigner');
|
25 |
+
$this->renderLayout();
|
26 |
+
}
|
27 |
+
|
28 |
+
public function gridAction()
|
29 |
+
{
|
30 |
+
$this->showGrid();
|
31 |
+
}
|
32 |
+
|
33 |
+
private function showGrid()
|
34 |
+
{
|
35 |
+
$this->loadLayout();
|
36 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('campaigner/adminhtml_orders_grid')->toHtml());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function runAction()
|
40 |
+
{
|
41 |
+
$store_id = $this->getRequest()->getParam('store_id');
|
42 |
+
|
43 |
+
Mage::getSingleton('campaigner/order_observer')->manualOrderProcessor($store_id);
|
44 |
+
|
45 |
+
$msg = "The Order process has been run";
|
46 |
+
|
47 |
+
if ($store_id) {
|
48 |
+
$msg .= " on store: " . Mage::helper('campaigner')->getFullStoreNameById($store_id);
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__($msg));
|
52 |
+
$this->_redirect('*/*/index');
|
53 |
+
}
|
54 |
+
|
55 |
+
public function sendAction()
|
56 |
+
{
|
57 |
+
try {
|
58 |
+
$id = $this->getRequest()->getParam('id');
|
59 |
+
|
60 |
+
if ($id == null) {
|
61 |
+
$this->_getSession()->addError(Mage::helper('adminhtml')->__("No Orders were specified."));
|
62 |
+
} else {
|
63 |
+
$id_list = array($id);
|
64 |
+
Mage::getSingleton('campaigner/order_observer')->sendOrders($id_list);
|
65 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Order has been sent."));
|
66 |
+
}
|
67 |
+
} catch (Exception $e) {
|
68 |
+
$this->_getSession()->addError($e->getMessage());
|
69 |
+
}
|
70 |
+
$this->_redirect('*/*/index');
|
71 |
+
}
|
72 |
+
|
73 |
+
public function massSendAction()
|
74 |
+
{
|
75 |
+
$params = array();
|
76 |
+
if ($this->getRequest()->isPost()) {
|
77 |
+
$params = $this->getRequest()->getPost();
|
78 |
+
}
|
79 |
+
|
80 |
+
$id_list = $params['id'];
|
81 |
+
|
82 |
+
if (!is_array($id_list)) {
|
83 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one order to send or resend.'));
|
84 |
+
} else {
|
85 |
+
try {
|
86 |
+
$order_status = Mage::getSingleton('campaigner/order_observer')->sendOrders($id_list);
|
87 |
+
|
88 |
+
$success_count = 0;
|
89 |
+
$failure_count = 0;
|
90 |
+
foreach ($order_status as $order_number => $status) {
|
91 |
+
if ($status['success'] == false) {
|
92 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
93 |
+
"Order #{$order_number} failed to upload ({$status['status']})"
|
94 |
+
);
|
95 |
+
$failure_count++;
|
96 |
+
} else {
|
97 |
+
$success_count++;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if ($success_count > 0) {
|
102 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
103 |
+
Mage::helper('adminhtml')->__('Total of %d order(s) were sent.', $success_count));
|
104 |
+
}
|
105 |
+
|
106 |
+
if ($failure_count > 0) {
|
107 |
+
|
108 |
+
|
109 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
110 |
+
Mage::helper('adminhtml')->__('Total of %d order(s) failed to send.', $failure_count));
|
111 |
+
}
|
112 |
+
}
|
113 |
+
catch (Exception $e) {
|
114 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
115 |
+
}
|
116 |
+
}
|
117 |
+
$this->_redirect('*/*/index', Mage::helper('campaigner')->getUrlParams());
|
118 |
+
}
|
119 |
+
}
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_ProductController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected function _isAllowed()
|
6 |
+
{
|
7 |
+
return Mage::getSingleton('admin/session')->isAllowed('campaigner/campaigner_product_category');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
|
14 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Products and Categories'));
|
15 |
+
$this->_setActiveMenu('campaigner');
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function detailsAction()
|
20 |
+
{
|
21 |
+
$this->loadLayout();
|
22 |
+
|
23 |
+
$this->getLayout()->getBlock('head')->setTitle($this->__('Campaigner Products and Categories'));
|
24 |
+
$this->_setActiveMenu('campaigner');
|
25 |
+
$this->renderLayout();
|
26 |
+
}
|
27 |
+
|
28 |
+
public function gridAction()
|
29 |
+
{
|
30 |
+
$this->showGrid();
|
31 |
+
}
|
32 |
+
|
33 |
+
private function showGrid()
|
34 |
+
{
|
35 |
+
$this->loadLayout();
|
36 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('campaigner/adminhtml_products_grid')->toHtml());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function runAction()
|
40 |
+
{
|
41 |
+
$store_id = $this->getRequest()->getParam('store_id');
|
42 |
+
|
43 |
+
Mage::getSingleton('campaigner/product_observer')->manualProductsProcessor($store_id);
|
44 |
+
|
45 |
+
$msg = "The Product/Category process has been run";
|
46 |
+
|
47 |
+
if ($store_id) {
|
48 |
+
$msg .= " on store: " . Mage::helper('campaigner')->getFullStoreNameById($store_id);
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__($msg));
|
52 |
+
$this->_redirect('*/*/index');
|
53 |
+
}
|
54 |
+
|
55 |
+
public function sendAction()
|
56 |
+
{
|
57 |
+
try {
|
58 |
+
$id = $this->getRequest()->getParam('id');
|
59 |
+
|
60 |
+
if ($id == null) {
|
61 |
+
$this->_getSession()->addError(Mage::helper('adminhtml')->__("No Products or Categories were specified."));
|
62 |
+
} else {
|
63 |
+
$id_list = array($id);
|
64 |
+
$status = Mage::getSingleton('campaigner/product_observer')->performActions($id_list);
|
65 |
+
$this->showActionStatus($status);
|
66 |
+
}
|
67 |
+
} catch (Exception $e) {
|
68 |
+
$this->_getSession()->addError($e->getMessage());
|
69 |
+
}
|
70 |
+
$this->_redirect('*/*/index');
|
71 |
+
}
|
72 |
+
|
73 |
+
public function massSendAction()
|
74 |
+
{
|
75 |
+
$params = array();
|
76 |
+
if ($this->getRequest()->isPost()) {
|
77 |
+
$params = $this->getRequest()->getPost();
|
78 |
+
}
|
79 |
+
|
80 |
+
$id_list = $params['id'];
|
81 |
+
|
82 |
+
if (!is_array($id_list)) {
|
83 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select at least one product or category to send or resend.'));
|
84 |
+
} else {
|
85 |
+
try {
|
86 |
+
$status = Mage::getSingleton('campaigner/product_observer')->performActions($id_list);
|
87 |
+
|
88 |
+
$this->showActionStatus($status);
|
89 |
+
}
|
90 |
+
catch (Exception $e) {
|
91 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
92 |
+
}
|
93 |
+
}
|
94 |
+
$this->_redirect('*/*/index', Mage::helper('campaigner')->getUrlParams());
|
95 |
+
}
|
96 |
+
|
97 |
+
private function showActionStatus($action_status, $single = false)
|
98 |
+
{
|
99 |
+
$success_count = 0;
|
100 |
+
$failure_count = 0;
|
101 |
+
foreach ($action_status as $action_number => $status) {
|
102 |
+
if ($status['success'] == false) {
|
103 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
104 |
+
"Product/Category failed to upload ({$status['status']})"
|
105 |
+
);
|
106 |
+
$failure_count++;
|
107 |
+
} else {
|
108 |
+
$success_count++;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
if (!$single) {
|
113 |
+
if ($success_count > 0) {
|
114 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
115 |
+
Mage::helper('adminhtml')->__('Total of %d products or categories were sent.', $success_count));
|
116 |
+
}
|
117 |
+
|
118 |
+
if ($failure_count > 0) {
|
119 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
120 |
+
Mage::helper('adminhtml')->__('Total of %d products or categories failed to send.', $failure_count));
|
121 |
+
}
|
122 |
+
} else if ($success_count > 0) {
|
123 |
+
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("Product/Category has been sent."));
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
@@ -0,0 +1,709 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_SyncController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected $_sync_type = null;
|
6 |
+
|
7 |
+
private $_sequences = null;
|
8 |
+
private $_current_sequence = 0;
|
9 |
+
private $_sequence_enabled = false;
|
10 |
+
private $_helper = null;
|
11 |
+
|
12 |
+
public function _construct()
|
13 |
+
{
|
14 |
+
$this->_helper = Mage::helper('campaigner/sync');
|
15 |
+
parent::_construct();
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _isAllowed()
|
19 |
+
{
|
20 |
+
return Mage::getSingleton('admin/session')->isAllowed('campaigner/campaigner_sync');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function customersCountAction()
|
24 |
+
{
|
25 |
+
$count = "Unknown";
|
26 |
+
|
27 |
+
try {
|
28 |
+
$from = $this->getRequest()->getParam('from');
|
29 |
+
$to = $this->getRequest()->getParam('to');
|
30 |
+
$include = $this->getRequest()->getParam('include');
|
31 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
32 |
+
|
33 |
+
$customers = $this->_helper->getCustomerCollection($from, $to, $include, $store);
|
34 |
+
|
35 |
+
$count = $customers->getSize();
|
36 |
+
} catch (Exception $e) {
|
37 |
+
$this->_helper->logException($e);
|
38 |
+
}
|
39 |
+
|
40 |
+
$this->getResponse()->setBody($count);
|
41 |
+
}
|
42 |
+
|
43 |
+
public function ordersCountAction()
|
44 |
+
{
|
45 |
+
$count = "Unknown";
|
46 |
+
|
47 |
+
try {
|
48 |
+
$from = $this->getRequest()->getParam('from');
|
49 |
+
$to = $this->getRequest()->getParam('to');
|
50 |
+
$include = $this->getRequest()->getParam('include');
|
51 |
+
$store = Mage::app()->getRequest()->getParam('store');
|
52 |
+
|
53 |
+
$orders = $this->_helper->getOrderCollection($from, $to, $include, $store);
|
54 |
+
|
55 |
+
$count = $orders->getSize();
|
56 |
+
} catch (Exception $e) {
|
57 |
+
$this->_helper->logException($e);
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->getResponse()->setBody($count);
|
61 |
+
}
|
62 |
+
|
63 |
+
private function setConfigValue($name)
|
64 |
+
{
|
65 |
+
$old_value = Mage::helper('campaigner')->syncConfig($name);
|
66 |
+
|
67 |
+
$new_value = $this->getRequest()->getParam($name);
|
68 |
+
|
69 |
+
$this->_helper->log("OLD: [$old_value] - NEW: [$new_value]");
|
70 |
+
|
71 |
+
if (($new_value != '' || ($name == 'customers_lists' && $new_value == '')) && $new_value != $old_value) {
|
72 |
+
Mage::helper('campaigner')->updateConfig($name, $new_value, null, 'sync', false);
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
return false;
|
77 |
+
}
|
78 |
+
|
79 |
+
private function setConfiguration()
|
80 |
+
{
|
81 |
+
$this->_helper->log("SET CONFIG");
|
82 |
+
$this->_helper->log($this->getRequest()->getParams());
|
83 |
+
|
84 |
+
$config_options = array(
|
85 |
+
'customers_include_latest_orders',
|
86 |
+
'customers_include_abandoned_carts',
|
87 |
+
'customers_include_already_sent',
|
88 |
+
'customers_lists',
|
89 |
+
'customers_sequence_field',
|
90 |
+
'customers_sequence_enabled',
|
91 |
+
'customers_sequence_options',
|
92 |
+
'orders_include_already_sent',
|
93 |
+
);
|
94 |
+
|
95 |
+
$changed = false;
|
96 |
+
|
97 |
+
foreach ($config_options as $option) {
|
98 |
+
if ($this->setConfigValue($option)) {
|
99 |
+
$changed = true;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($changed) {
|
104 |
+
$this->_helper->log("CHANGED");
|
105 |
+
Mage::getConfig()->cleanCache();
|
106 |
+
Mage::getConfig()->reinit();
|
107 |
+
Mage::app()->reinitStores();
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
public function configAction()
|
112 |
+
{
|
113 |
+
// Update export configuration options if changed before button click
|
114 |
+
$this->setConfiguration();
|
115 |
+
}
|
116 |
+
|
117 |
+
public function customersAction()
|
118 |
+
{
|
119 |
+
$this->loadLayout();
|
120 |
+
$this->renderLayout();
|
121 |
+
}
|
122 |
+
|
123 |
+
public function ordersAction()
|
124 |
+
{
|
125 |
+
$this->loadLayout();
|
126 |
+
$this->renderLayout();
|
127 |
+
}
|
128 |
+
|
129 |
+
public function productsAction()
|
130 |
+
{
|
131 |
+
$this->loadLayout();
|
132 |
+
$this->renderLayout();
|
133 |
+
}
|
134 |
+
|
135 |
+
private function setupSequence()
|
136 |
+
{
|
137 |
+
$this->_sequence_enabled = Mage::helper('campaigner')->syncConfig('customers_sequence_enabled');
|
138 |
+
|
139 |
+
if (!$this->_sequence_enabled) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
+
$sequences = str_replace("\r\n","\n",Mage::helper('campaigner')->syncConfig('customers_sequence_options'));
|
144 |
+
$this->_current_sequence = Mage::helper('campaigner')->syncConfig('customers_sequence_current');
|
145 |
+
|
146 |
+
if (!is_numeric($this->_current_sequence)) {
|
147 |
+
$this->_current_sequence = 0;
|
148 |
+
}
|
149 |
+
|
150 |
+
$this->_sequences = explode("\n",$sequences);
|
151 |
+
$this->_sequence_field = Mage::helper('campaigner')->syncConfig('customers_sequence_field');
|
152 |
+
}
|
153 |
+
|
154 |
+
private function saveCurrentSequence()
|
155 |
+
{
|
156 |
+
if (!$this->_sequence_enabled) {
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
|
160 |
+
Mage::helper('campaigner')->updateConfig('customer_sequence_current',$this->_current_sequence, null, 'export');
|
161 |
+
}
|
162 |
+
|
163 |
+
private function addSequence(&$merge_vars)
|
164 |
+
{
|
165 |
+
if (!$this->_sequence_enabled) {
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
$sequence_value = "";
|
169 |
+
|
170 |
+
|
171 |
+
if (!isset($this->_sequences[$this->_current_sequence])) {
|
172 |
+
$this->_current_sequence = 0;
|
173 |
+
}
|
174 |
+
|
175 |
+
$sequence_value = $this->_sequences[$this->_current_sequence++];
|
176 |
+
|
177 |
+
$merge_vars[$this->_sequence_field] = $sequence_value;
|
178 |
+
}
|
179 |
+
|
180 |
+
private function getAbandonedData($quote)
|
181 |
+
{
|
182 |
+
$email = $quote->getCustomerEmail();
|
183 |
+
|
184 |
+
if ($email == null) {
|
185 |
+
$email = $quote->getEmail();
|
186 |
+
}
|
187 |
+
|
188 |
+
$abandonedDate = $quote->getUpdatedAt();
|
189 |
+
|
190 |
+
$merge_vars = Mage::helper('campaigner')->getQuoteMergeVars($quote);
|
191 |
+
|
192 |
+
$merge_vars['AbandonedDate'] = $abandonedDate;
|
193 |
+
$merge_vars['AbandonedUrl'] = Mage::helper('campaigner/abandoned')->getAbandonedUrl($quote);
|
194 |
+
|
195 |
+
$this->addSequence($merge_vars);
|
196 |
+
|
197 |
+
$merge_vars = Mage::helper('campaigner/order')->getMergeOrderItems($quote, $merge_vars, "AB");
|
198 |
+
|
199 |
+
return $merge_vars;
|
200 |
+
}
|
201 |
+
|
202 |
+
private function getCustomerData($customer, $abandoned, $latest)
|
203 |
+
{
|
204 |
+
Mage::helper('campaigner/abandoned')->setupSequence();
|
205 |
+
|
206 |
+
if ($abandoned) {
|
207 |
+
$quote = Mage::getModel('sales/quote')->loadByCustomer($customer);
|
208 |
+
|
209 |
+
$merge_vars = $this->getAbandonedData($quote);
|
210 |
+
} else {
|
211 |
+
$merge_vars = Mage::helper('campaigner')->getMergeVars($customer);
|
212 |
+
}
|
213 |
+
|
214 |
+
if ($latest) {
|
215 |
+
$order = Mage::helper('campaigner/abandoned')->getCustomerLastOrder($customer);
|
216 |
+
if ($order && $order->getId()) {
|
217 |
+
$merge_vars = Mage::helper('campaigner/order')->processOrderItems($order, $merge_vars);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
$email = $customer->getEmail();
|
222 |
+
|
223 |
+
$contactData = Mage::getSingleton('campaigner/wrapper_orders')->getEmailContactData($email, $merge_vars);
|
224 |
+
|
225 |
+
return $contactData;
|
226 |
+
}
|
227 |
+
|
228 |
+
private function getSyncType()
|
229 |
+
{
|
230 |
+
if ($this->_sync_type == null) {
|
231 |
+
$this->_sync_type = $this->getRequest()->getParam('sync_type', 'customer');
|
232 |
+
}
|
233 |
+
|
234 |
+
return $this->_sync_type;
|
235 |
+
}
|
236 |
+
|
237 |
+
public function batchRunAction()
|
238 |
+
{
|
239 |
+
switch ($this->getSyncType()) {
|
240 |
+
case "order": {
|
241 |
+
$this->batchRunOrders();
|
242 |
+
} break;
|
243 |
+
case "product": {
|
244 |
+
$this->batchRunProducts();
|
245 |
+
} break;
|
246 |
+
case "category": {
|
247 |
+
$this->batchRunCategories();
|
248 |
+
} break;
|
249 |
+
default: {
|
250 |
+
$this->batchRunCustomers();
|
251 |
+
} break;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
private function createSession($customer)
|
256 |
+
{
|
257 |
+
$this->_helper->log("CUSTOMER ID: " . $customer->getId());
|
258 |
+
$campaignerSession = Mage::getModel('campaigner/session')->loadByCustomerId($customer->getId());
|
259 |
+
|
260 |
+
if ($campaignerSession && $campaignerSession->getId()) {
|
261 |
+
$this->_helper->log("CAMPAIGNER SESSION FOUND");
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
|
265 |
+
$campaignerSession = Mage::getModel('campaigner/session');
|
266 |
+
|
267 |
+
$campaignerSession->setCustomerId($customer->getId());
|
268 |
+
$campaignerSession->save();
|
269 |
+
}
|
270 |
+
|
271 |
+
private function processResponse($response, $customerList)
|
272 |
+
{
|
273 |
+
$errors = array();
|
274 |
+
//$successCount
|
275 |
+
if (!isset($response->UploadResultData)) {
|
276 |
+
$result = array(
|
277 |
+
'savedRows' => count($customerList),
|
278 |
+
'errors' => array('Unable to process response')
|
279 |
+
);
|
280 |
+
return $result;
|
281 |
+
}
|
282 |
+
|
283 |
+
$resultData = $response->UploadResultData;
|
284 |
+
|
285 |
+
if (!is_array($resultData)) {
|
286 |
+
$resultData = array($resultData);
|
287 |
+
}
|
288 |
+
|
289 |
+
foreach ($resultData as $data) {
|
290 |
+
$email = $data->ContactKey->ContactUniqueIdentifier;
|
291 |
+
|
292 |
+
if ((string)$data->ResultCode != 'Success') {
|
293 |
+
$message = (string)$data->ResultDescription;
|
294 |
+
if ($message == "") {
|
295 |
+
$message = (string)$data->ResultCode;
|
296 |
+
}
|
297 |
+
if (isset($customerList[$email])) {
|
298 |
+
$customer = $customerList[$email];
|
299 |
+
$id = $customerList[$email]->getId();
|
300 |
+
$email = $this->escapeHtml($email);
|
301 |
+
$errors[] = "Failed to export customer (ID: {$id} - Email: {$email} - Message: {$message})";
|
302 |
+
} else {
|
303 |
+
$email = $this->escapeHtml($email);
|
304 |
+
$errors[] = "Failed to export customer (Email: {$email} - Message: {$message})";
|
305 |
+
}
|
306 |
+
} else {
|
307 |
+
// Save session if not found
|
308 |
+
if (isset($customerList[$email])) {
|
309 |
+
$customer = $customerList[$email];
|
310 |
+
$this->createSession($customer);
|
311 |
+
}
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
$result = array(
|
316 |
+
'savedRows' => count($customerList),
|
317 |
+
'errors' => $errors
|
318 |
+
);
|
319 |
+
|
320 |
+
return $result;
|
321 |
+
}
|
322 |
+
|
323 |
+
private function batchRunOrders()
|
324 |
+
{
|
325 |
+
if ($this->getRequest()->isPost())
|
326 |
+
{
|
327 |
+
$id_list = $this->getRequest()->getPost('id', 0);
|
328 |
+
//$file_name = $this->getRequest()->getPost('filename', 0);
|
329 |
+
|
330 |
+
if (!is_array($id_list)) {
|
331 |
+
$id_list = array($id_list);
|
332 |
+
}
|
333 |
+
|
334 |
+
$success_count = 0;
|
335 |
+
$failures = array();
|
336 |
+
$abort = false;
|
337 |
+
|
338 |
+
try {
|
339 |
+
//$order_status = Mage::getSingleton('campaigner/order_observer')->sendOrders($id_list, true);
|
340 |
+
$order_status = $this->performSync($id_list, 'order');
|
341 |
+
|
342 |
+
foreach ($order_status as $order_number => $status) {
|
343 |
+
if ($status['success'] == false) {
|
344 |
+
$failures[] = "Order #{$order_number} failed to Sync ({$status['status']})";
|
345 |
+
} else {
|
346 |
+
$success_count++;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
} catch (Exception $e) {
|
350 |
+
$failures[] = "Order Sync Failed: {$e->getmessage()}";
|
351 |
+
$abort = true;
|
352 |
+
}
|
353 |
+
|
354 |
+
$result = array(
|
355 |
+
'savedRows' => $success_count,
|
356 |
+
'errors' => $failures
|
357 |
+
);
|
358 |
+
|
359 |
+
if ($abort) {
|
360 |
+
$result['abort'] = true;
|
361 |
+
}
|
362 |
+
|
363 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
private function batchRunCustomers()
|
368 |
+
{
|
369 |
+
if ($this->getRequest()->isPost()) {
|
370 |
+
$customer_id = $this->getRequest()->getPost('id', 0);
|
371 |
+
|
372 |
+
$latest = Mage::helper('campaigner')->syncConfig("customers_include_latest_orders");
|
373 |
+
$abandoned = Mage::helper('campaigner')->syncConfig("customers_include_abandoned_carts");
|
374 |
+
$contactData = array();
|
375 |
+
$customerList = array();
|
376 |
+
|
377 |
+
if ($abandoned) {
|
378 |
+
$this->_helper->log("ABANDONED");
|
379 |
+
$this->setupSequence();
|
380 |
+
}
|
381 |
+
|
382 |
+
if (is_array($customer_id)) {
|
383 |
+
$this->_helper->log($customer_id);
|
384 |
+
foreach ($customer_id as $id) {
|
385 |
+
$customer = Mage::getModel('customer/customer')->load($id);
|
386 |
+
$contactData[] = $this->getCustomerData($customer, $abandoned, $latest);
|
387 |
+
$customerList[$customer->getEmail()] = $customer;
|
388 |
+
}
|
389 |
+
} else {
|
390 |
+
$contactData[] = $this->getCustomerData($id, $abandoned, $latest);
|
391 |
+
}
|
392 |
+
|
393 |
+
$lists = Mage::helper('campaigner')->syncConfig("customers_lists");
|
394 |
+
$subscribe = false;
|
395 |
+
|
396 |
+
if ($lists != '') {
|
397 |
+
|
398 |
+
$this->_helper->log("-----------------");
|
399 |
+
$this->_helper->log($lists);
|
400 |
+
|
401 |
+
$subscribe = explode(",",$lists);
|
402 |
+
$this->_helper->log($subscribe);
|
403 |
+
}
|
404 |
+
|
405 |
+
|
406 |
+
try {
|
407 |
+
$response = Mage::getSingleton('campaigner/wrapper_subscribers')->massUpdate($contactData, $subscribe);
|
408 |
+
|
409 |
+
$result = $this->processResponse($response, $customerList);
|
410 |
+
//$this->_helper->log($response);
|
411 |
+
} catch (Campaigner_Integration_Model_Wrapper_Exception $e) {
|
412 |
+
//$this->_logException($e);
|
413 |
+
$details = $e->getDetails();
|
414 |
+
$this->_helper->log($details);
|
415 |
+
|
416 |
+
$result = $this->processResponse($details, $customerList);
|
417 |
+
}
|
418 |
+
|
419 |
+
if ($abandoned) {
|
420 |
+
$this->saveCurrentSequence();
|
421 |
+
}
|
422 |
+
|
423 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
// ---------------------------------------- CATEGORIES -------------------------------------------
|
428 |
+
|
429 |
+
private $_categories = array();
|
430 |
+
|
431 |
+
private function getParents($category)
|
432 |
+
{
|
433 |
+
$parents = array();
|
434 |
+
$path = explode("/",$category->getPath());
|
435 |
+
|
436 |
+
array_shift($path);
|
437 |
+
|
438 |
+
if (count($path) == 1) {
|
439 |
+
return $parents;
|
440 |
+
}
|
441 |
+
|
442 |
+
array_pop($path);
|
443 |
+
|
444 |
+
foreach ($path as $id) {
|
445 |
+
if (!isset($this->_categories[$id])) {
|
446 |
+
$this->_categories[$id] = Mage::getModel('catalog/category')->load($id);
|
447 |
+
}
|
448 |
+
|
449 |
+
$parents[] = $this->_categories[$id]->getName();
|
450 |
+
}
|
451 |
+
|
452 |
+
return $parents;
|
453 |
+
}
|
454 |
+
|
455 |
+
private function loadCategory($id)
|
456 |
+
{
|
457 |
+
$category = Mage::getModel('catalog/category')->load($id);
|
458 |
+
|
459 |
+
$category->setParents($this->getParents($category));
|
460 |
+
|
461 |
+
$category->setParentsPath(implode("/",$category->getParents()));
|
462 |
+
|
463 |
+
if ($category->getParentsPath() != "") {
|
464 |
+
$category->setFullPath($category->getParentsPath() . "/" . $category->getName());
|
465 |
+
} else {
|
466 |
+
$category->setFullPath($category->getName());
|
467 |
+
}
|
468 |
+
|
469 |
+
return $category;
|
470 |
+
}
|
471 |
+
|
472 |
+
private function processCategoryResponse($response, $category, &$existing, &$mapping)
|
473 |
+
{
|
474 |
+
if ($response == null) {
|
475 |
+
return true;
|
476 |
+
}
|
477 |
+
|
478 |
+
$this->_helper->log($response);
|
479 |
+
if (isset($response->CategoryID)) {
|
480 |
+
if (!isset($existing[$category->getFullPath()])) {
|
481 |
+
$category_id = (int)$response->CategoryID;
|
482 |
+
|
483 |
+
$existing[$category->getFullPath()] = array(
|
484 |
+
'CategoryID' => $category_id,
|
485 |
+
'Name' => $category->getName(),
|
486 |
+
);
|
487 |
+
}
|
488 |
+
$mapping[$category->getId()] = $category_id;
|
489 |
+
return true;
|
490 |
+
} else {
|
491 |
+
return false;
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
private function hasCategoryChanged($category, $existing)
|
496 |
+
{
|
497 |
+
$check = $existing[$category->getFullPath()];
|
498 |
+
|
499 |
+
$description = substr($category->getDescription(), 0, 200);
|
500 |
+
$image = substr($category->getImageUrl(), 0, 200);
|
501 |
+
$url = substr($category->getUrl(), 0, 200);
|
502 |
+
|
503 |
+
if ($check['Description'] != $description) {
|
504 |
+
return true;
|
505 |
+
}
|
506 |
+
|
507 |
+
// Image and URL not working
|
508 |
+
|
509 |
+
return false;
|
510 |
+
}
|
511 |
+
|
512 |
+
private function getParentId($category, $existing)
|
513 |
+
{
|
514 |
+
$parent_path = $category->getParentsPath();
|
515 |
+
|
516 |
+
if (!isset($existing[$parent_path])) {
|
517 |
+
// Shouldn't happen
|
518 |
+
return null;
|
519 |
+
} else {
|
520 |
+
return $existing[$parent_path]['CategoryID'];
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
private function batchRunCategories()
|
525 |
+
{
|
526 |
+
$wrapper = Mage::getSingleton('campaigner/wrapper_commerce_category');
|
527 |
+
|
528 |
+
if ($this->getRequest()->isPost()) {
|
529 |
+
$success_count = 0;
|
530 |
+
$id_list = $this->getRequest()->getPost('id', 0);
|
531 |
+
|
532 |
+
if (!is_array($id_list)) {
|
533 |
+
$id_list = array($id_list);
|
534 |
+
}
|
535 |
+
|
536 |
+
$success_count = 0;
|
537 |
+
$failures = array();
|
538 |
+
|
539 |
+
$timeout = false;
|
540 |
+
|
541 |
+
foreach ($id_list as $id) {
|
542 |
+
$category = $this->loadCategory($id);
|
543 |
+
|
544 |
+
try {
|
545 |
+
$this->performSync($category, 'category');
|
546 |
+
$success_count++;
|
547 |
+
} catch (Exception $e) {
|
548 |
+
if ($e->getCode() == 28) {
|
549 |
+
$timeout = true;
|
550 |
+
}
|
551 |
+
$failures[] = "Failed to sync category [{$category->getName()}]: {$e->getMessage()}";
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
$result = array(
|
556 |
+
'savedRows' => $success_count,
|
557 |
+
'errors' => $failures,
|
558 |
+
);
|
559 |
+
|
560 |
+
if ($timeout) {
|
561 |
+
$result['abort'] = true;
|
562 |
+
}
|
563 |
+
|
564 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
565 |
+
}
|
566 |
+
}
|
567 |
+
|
568 |
+
private function hasProductChanged($product, $details)
|
569 |
+
{
|
570 |
+
if ($product->getName() != (string)$details->ProductName) {
|
571 |
+
$this->_helper->log('Name Changed');
|
572 |
+
return true;
|
573 |
+
}
|
574 |
+
|
575 |
+
if ($product->getDescription() != (string)$details->LongDescription) {
|
576 |
+
$this->_helper->log('Description Changed');
|
577 |
+
return true;
|
578 |
+
}
|
579 |
+
|
580 |
+
if ($product->getShortDescription() != (string)$details->ShortDescription) {
|
581 |
+
$this->_helper->log('Short Description Changed');
|
582 |
+
return true;
|
583 |
+
}
|
584 |
+
|
585 |
+
if ($product->getUrl() != (string)$details->ProductUrl) {
|
586 |
+
$this->_helper->log('Url Changed');
|
587 |
+
return true;
|
588 |
+
}
|
589 |
+
|
590 |
+
if (Mage::helper('campaigner/order')->getProductImage($product) != (string)$details->ProductImage) {
|
591 |
+
$this->_helper->log('Image Changed');
|
592 |
+
return true;
|
593 |
+
}
|
594 |
+
|
595 |
+
if ($product->getWeight() != (float)$details->Weight) {
|
596 |
+
$this->_helper->log('Weight Changed');
|
597 |
+
return true;
|
598 |
+
}
|
599 |
+
|
600 |
+
/*if ($product->getCost() != (string)$details->Weight) {
|
601 |
+
return true;
|
602 |
+
}*/
|
603 |
+
|
604 |
+
if ($product->getprice() != (float)$details->Price) {
|
605 |
+
$this->_helper->log('Price Changed');
|
606 |
+
return true;
|
607 |
+
}
|
608 |
+
|
609 |
+
return false;
|
610 |
+
}
|
611 |
+
|
612 |
+
private function performSync($item, $type)
|
613 |
+
{
|
614 |
+
$attempt = 0;
|
615 |
+
$max_attempts = 5;
|
616 |
+
$success = false;
|
617 |
+
|
618 |
+
do {
|
619 |
+
try {
|
620 |
+
$attempt++;
|
621 |
+
switch ($type) {
|
622 |
+
case "product": $this->_helper->syncProduct($item); break;
|
623 |
+
case "category": $this->_helper->syncCategory($item, true); break;
|
624 |
+
case "order":
|
625 |
+
{
|
626 |
+
$order_status = Mage::getSingleton('campaigner/order_observer')->sendOrders($item, true);
|
627 |
+
|
628 |
+
return $order_status;
|
629 |
+
} break;
|
630 |
+
}
|
631 |
+
$success = true;
|
632 |
+
} catch (Exception $e) {
|
633 |
+
if ($e->getCode() != 28) {
|
634 |
+
throw $e;
|
635 |
+
}
|
636 |
+
if ($attempt >= 5) {
|
637 |
+
throw new Exception("Unable to connect to Campaigner web services ({$max_attempts} of {$max_attempts}) attempts failed)", 28);
|
638 |
+
}
|
639 |
+
}
|
640 |
+
} while ($success == false);
|
641 |
+
}
|
642 |
+
|
643 |
+
private function batchRunProducts()
|
644 |
+
{
|
645 |
+
$wrapper = Mage::getSingleton('campaigner/wrapper_commerce_product');
|
646 |
+
if ($this->getRequest()->isPost())
|
647 |
+
{
|
648 |
+
$id_list = $this->getRequest()->getPost('id', 0);
|
649 |
+
|
650 |
+
if (!is_array($id_list)) {
|
651 |
+
$id_list = array($id_list);
|
652 |
+
}
|
653 |
+
|
654 |
+
$success_count = 0;
|
655 |
+
$failures = array();
|
656 |
+
|
657 |
+
$timeout = false;
|
658 |
+
|
659 |
+
foreach ($id_list as $id) {
|
660 |
+
$product = Mage::getModel('catalog/product')->load($id);
|
661 |
+
|
662 |
+
if (!$product || !$product->getId()) {
|
663 |
+
$failures[] = "Failed to load product: {$id}";
|
664 |
+
continue;
|
665 |
+
}
|
666 |
+
|
667 |
+
try {
|
668 |
+
$this->performSync($product, 'product');
|
669 |
+
$success_count++;
|
670 |
+
} catch (Exception $e) {
|
671 |
+
if ($e->getCode() == 28) {
|
672 |
+
$timeout = true;
|
673 |
+
}
|
674 |
+
$failures[] = "Failed to sync product [{$product->getSku()}]: {$e->getMessage()}";
|
675 |
+
}
|
676 |
+
}
|
677 |
+
|
678 |
+
$result = array(
|
679 |
+
'savedRows' => $success_count,
|
680 |
+
'errors' => $failures
|
681 |
+
);
|
682 |
+
|
683 |
+
if ($timeout) {
|
684 |
+
$result['abort'] = true;
|
685 |
+
}
|
686 |
+
|
687 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
688 |
+
}
|
689 |
+
}
|
690 |
+
|
691 |
+
public function batchFinishAction()
|
692 |
+
{
|
693 |
+
if ($this->getRequest()->isPost()) {
|
694 |
+
$result = array('success' => true);
|
695 |
+
$store = $this->getRequest()->getPost('store', 0);
|
696 |
+
|
697 |
+
if ($store != 0) {
|
698 |
+
$starting_store = Mage::app()->getStore()->getCode();
|
699 |
+
Mage::app()->setCurrentStore($store);
|
700 |
+
}
|
701 |
+
|
702 |
+
if ($store != 0) {
|
703 |
+
Mage::app()->setCurrentStore($starting_store);
|
704 |
+
}
|
705 |
+
|
706 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
707 |
+
}
|
708 |
+
}
|
709 |
+
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
private $_output = array();
|
6 |
private $_config = null;
|
@@ -125,11 +125,24 @@ class Campaigner_Integration_Admin_TroubleshootingController extends Mage_Adminh
|
|
125 |
$this->getResponse()->setBody(json_encode($result));
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
private function getLogFile()
|
129 |
{
|
|
|
|
|
130 |
$empty = false;
|
131 |
$too_large = false;
|
132 |
-
$file_size = Mage::helper('campaigner/troubleshooting')->getLogFileSize();
|
133 |
|
134 |
if ($file_size == 0) {
|
135 |
$empty = true;
|
@@ -140,11 +153,13 @@ class Campaigner_Integration_Admin_TroubleshootingController extends Mage_Adminh
|
|
140 |
$max_size = Mage::helper('campaigner')->formatSize(Mage::helper('campaigner/troubleshooting')->getMaxLogFileSize());
|
141 |
|
142 |
$result = array(
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
148 |
return $result;
|
149 |
}
|
150 |
|
@@ -229,10 +244,41 @@ class Campaigner_Integration_Admin_TroubleshootingController extends Mage_Adminh
|
|
229 |
{
|
230 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('campaigner')->__('Failed to send Report Email'));
|
231 |
|
232 |
-
$this->_redirect('
|
233 |
}
|
234 |
}
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
public function downloadAction()
|
237 |
{
|
238 |
$output = Mage::helper('campaigner/troubleshooting')->getReport();
|
1 |
<?php
|
2 |
|
3 |
+
class Campaigner_Integration_Adminhtml_Campaigner_TroubleshootingController extends Mage_Adminhtml_Controller_Action
|
4 |
{
|
5 |
private $_output = array();
|
6 |
private $_config = null;
|
125 |
$this->getResponse()->setBody(json_encode($result));
|
126 |
}
|
127 |
|
128 |
+
public function validateKeyAction()
|
129 |
+
{
|
130 |
+
$apikey = $this->getRequest()->getParam('apikey');
|
131 |
+
|
132 |
+
Mage::register('validation_mode',true);
|
133 |
+
|
134 |
+
$result = Mage::helper('campaigner/troubleshooting')->validateApiKey($apikey);
|
135 |
+
|
136 |
+
$this->getResponse()->setBody(json_encode($result));
|
137 |
+
}
|
138 |
+
|
139 |
private function getLogFile()
|
140 |
{
|
141 |
+
$file = $this->getRequest()->getParam('file');
|
142 |
+
|
143 |
$empty = false;
|
144 |
$too_large = false;
|
145 |
+
$file_size = Mage::helper('campaigner/troubleshooting')->getLogFileSize($file);
|
146 |
|
147 |
if ($file_size == 0) {
|
148 |
$empty = true;
|
153 |
$max_size = Mage::helper('campaigner')->formatSize(Mage::helper('campaigner/troubleshooting')->getMaxLogFileSize());
|
154 |
|
155 |
$result = array(
|
156 |
+
'success' => true,
|
157 |
+
'empty' => $empty,
|
158 |
+
'too_large' => $too_large,
|
159 |
+
'max_size' => $max_size,
|
160 |
+
'contents' => utf8_encode(Mage::helper('campaigner/troubleshooting')->getLogFileContents($file))
|
161 |
+
);
|
162 |
+
|
163 |
return $result;
|
164 |
}
|
165 |
|
244 |
{
|
245 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('campaigner')->__('Failed to send Report Email'));
|
246 |
|
247 |
+
$this->_redirect('adminhtml/campaigner_troubleshooting/');
|
248 |
}
|
249 |
}
|
250 |
|
251 |
+
protected function _getCronReport()
|
252 |
+
{
|
253 |
+
$this->loadLayout();
|
254 |
+
|
255 |
+
$block = $this->getLayout()->createBlock(
|
256 |
+
'Campaigner_Integration_Block_Adminhtml_Troubleshooting_View_Tab_Cron',
|
257 |
+
'trouble_cron',
|
258 |
+
array('template' => 'campaigner/troubleshooting/view/tab/cron.phtml')
|
259 |
+
);
|
260 |
+
|
261 |
+
$block->setMode("download");
|
262 |
+
return $block->toHtml();
|
263 |
+
|
264 |
+
$layout = $this->getLayout();
|
265 |
+
$update = $layout->getUpdate();
|
266 |
+
$update->load('campaigner/adminhtml_troubleshooting_view_tab_cron');
|
267 |
+
$layout->generateXml();
|
268 |
+
$layout->generateBlocks();
|
269 |
+
$output = $layout->getOutput();
|
270 |
+
return $output;
|
271 |
+
}
|
272 |
+
|
273 |
+
public function downloadCronAction()
|
274 |
+
{
|
275 |
+
$filename = Mage::helper('campaigner')->troubleConfig('cron_report_file');
|
276 |
+
|
277 |
+
$output = $this->_getCronReport();
|
278 |
+
|
279 |
+
$this->_prepareDownloadResponse($filename, $output);
|
280 |
+
}
|
281 |
+
|
282 |
public function downloadAction()
|
283 |
{
|
284 |
$output = Mage::helper('campaigner/troubleshooting')->getReport();
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Campaigner_Integration_CronController extends Campaigner_Integration_Controller_Front_Abstract
|
4 |
+
{
|
5 |
+
public function runAction()
|
6 |
+
{
|
7 |
+
if (Mage::helper('campaigner')->isCronUrlEnabled()) {
|
8 |
+
|
9 |
+
$process = $this->getRequest()->getParam("process");
|
10 |
+
|
11 |
+
switch ($process) {
|
12 |
+
case "abandoned": {
|
13 |
+
echo "<p>Starting Abandoned Cart Process...</p>";
|
14 |
+
Mage::getSingleton('campaigner/abandoned_observer')->manualCartsProcessor();
|
15 |
+
echo "<p>Abandoned Cart Process completed</p>";
|
16 |
+
} break;
|
17 |
+
case "latest_orders": {
|
18 |
+
echo "<p>Starting Latest Orders Process...</p>";
|
19 |
+
Mage::getSingleton('campaigner/order_observer')->manualLatestProcessor();
|
20 |
+
echo "<p>Latest Orders Process completed</p>";
|
21 |
+
} break;
|
22 |
+
case "background_tasks": {
|
23 |
+
echo "<p>Starting Background Tasks Process...</p>";
|
24 |
+
Mage::getSingleton('campaigner/background_observer')->manualBackgroundTaskProcessor();
|
25 |
+
echo "<p>Background Tasks Process completed</p>";
|
26 |
+
} break;
|
27 |
+
case "products": {
|
28 |
+
echo "<p>Starting Products and Categories Process...</p>";
|
29 |
+
Mage::getSingleton('campaigner/product_observer')->manualProductsProcessor();
|
30 |
+
echo "<p>Products and Categories Process completed</p>";
|
31 |
+
} break;
|
32 |
+
case "orders": {
|
33 |
+
echo "<p>Starting Orders Process...</p>";
|
34 |
+
Mage::getSingleton('campaigner/order_observer')->processBatchOrders();
|
35 |
+
echo "<p>Orders Process completed</p>";
|
36 |
+
} break;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
@@ -5,20 +5,41 @@
|
|
5 |
<title>Campaigner</title>
|
6 |
<sort_order>80</sort_order>
|
7 |
<children>
|
8 |
-
<
|
9 |
-
<title>
|
10 |
-
<sort_order>
|
11 |
-
<
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<campaigner_troubleshooting module='campaigner'>
|
19 |
<title>Troubleshooting</title>
|
20 |
-
<sort_order>
|
21 |
-
<action>
|
22 |
</campaigner_troubleshooting>
|
23 |
<campaigner_config module='campaigner'>
|
24 |
<title>Configuration</title>
|
@@ -35,18 +56,34 @@
|
|
35 |
<campaigner>
|
36 |
<title>Campaigner</title>
|
37 |
<children>
|
38 |
-
<
|
39 |
-
<
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<campaigner_troubleshooting module='campaigner'>
|
45 |
<title>Troubleshooting</title>
|
46 |
</campaigner_troubleshooting>
|
47 |
<campaigner_diagnostics>
|
48 |
<title>Diagnostics</title>
|
49 |
</campaigner_diagnostics>
|
|
|
|
|
|
|
50 |
<campaigner_config>
|
51 |
<title>Configuration Link</title>
|
52 |
</campaigner_config>
|
5 |
<title>Campaigner</title>
|
6 |
<sort_order>80</sort_order>
|
7 |
<children>
|
8 |
+
<campaigner_management module='campaigner'>
|
9 |
+
<title>Management</title>
|
10 |
+
<sort_order>120</sort_order>
|
11 |
+
<children>
|
12 |
+
<campaigner_abandoned module='campaigner'>
|
13 |
+
<title>Abandoned Carts</title>
|
14 |
+
<sort_order>100</sort_order>
|
15 |
+
<action>adminhtml/campaigner_abandoned</action>
|
16 |
+
</campaigner_abandoned>
|
17 |
+
<campaigner_latest module='campaigner'>
|
18 |
+
<title>Latest Orders</title>
|
19 |
+
<sort_order>110</sort_order>
|
20 |
+
<action>adminhtml/campaigner_latest</action>
|
21 |
+
</campaigner_latest>
|
22 |
+
<campaigner_orders module='campaigner'>
|
23 |
+
<title>Orders</title>
|
24 |
+
<sort_order>120</sort_order>
|
25 |
+
<action>adminhtml/campaigner_order</action>
|
26 |
+
</campaigner_orders>
|
27 |
+
<campaigner_background_task module='campaigner'>
|
28 |
+
<title>Background Tasks</title>
|
29 |
+
<sort_order>130</sort_order>
|
30 |
+
<action>adminhtml/campaigner_background_task</action>
|
31 |
+
</campaigner_background_task>
|
32 |
+
<campaigner_product_category module='campaigner'>
|
33 |
+
<title>Products and Categories</title>
|
34 |
+
<sort_order>140</sort_order>
|
35 |
+
<action>adminhtml/campaigner_product</action>
|
36 |
+
</campaigner_product_category>
|
37 |
+
</children>
|
38 |
+
</campaigner_management>
|
39 |
<campaigner_troubleshooting module='campaigner'>
|
40 |
<title>Troubleshooting</title>
|
41 |
+
<sort_order>140</sort_order>
|
42 |
+
<action>adminhtml/campaigner_troubleshooting</action>
|
43 |
</campaigner_troubleshooting>
|
44 |
<campaigner_config module='campaigner'>
|
45 |
<title>Configuration</title>
|
56 |
<campaigner>
|
57 |
<title>Campaigner</title>
|
58 |
<children>
|
59 |
+
<campaigner_management module='campaigner'>
|
60 |
+
<children>
|
61 |
+
<campaigner_abandoned module='campaigner'>
|
62 |
+
<title>Abandoned Carts</title>
|
63 |
+
</campaigner_abandoned>
|
64 |
+
<campaigner_latest>
|
65 |
+
<title>Latest Orders</title>
|
66 |
+
</campaigner_latest>
|
67 |
+
<campaigner_orders>
|
68 |
+
<title>Orders</title>
|
69 |
+
</campaigner_orders>
|
70 |
+
<campaigner_background_task>
|
71 |
+
<title>Background Tasks</title>
|
72 |
+
</campaigner_background_task>
|
73 |
+
<campaigner_product_category module='campaigner'>
|
74 |
+
<title>Products and Categories</title>
|
75 |
+
</campaigner_product_category>
|
76 |
+
</children>
|
77 |
+
</campaigner_management>
|
78 |
<campaigner_troubleshooting module='campaigner'>
|
79 |
<title>Troubleshooting</title>
|
80 |
</campaigner_troubleshooting>
|
81 |
<campaigner_diagnostics>
|
82 |
<title>Diagnostics</title>
|
83 |
</campaigner_diagnostics>
|
84 |
+
<campaigner_sync>
|
85 |
+
<title>Sync</title>
|
86 |
+
</campaigner_sync>
|
87 |
<campaigner_config>
|
88 |
<title>Configuration Link</title>
|
89 |
</campaigner_config>
|
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Campaigner_Integration>
|
5 |
-
<version>1.
|
6 |
</Campaigner_Integration>
|
7 |
</modules>
|
8 |
<global>
|
@@ -60,9 +60,18 @@
|
|
60 |
<session>
|
61 |
<table>campaigner_session</table>
|
62 |
</session>
|
63 |
-
<
|
64 |
-
<table>
|
65 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
</entities>
|
67 |
</campaigner_mysql4>
|
68 |
<core>
|
@@ -76,7 +85,7 @@
|
|
76 |
</models>
|
77 |
<template>
|
78 |
<email>
|
79 |
-
<campaigner_relay_test translate="label" module="
|
80 |
<label>Relay Test</label>
|
81 |
<file>campaigner_relay_test.html</file>
|
82 |
<type>html</type>
|
@@ -186,13 +195,13 @@
|
|
186 |
</frontend>
|
187 |
<admin>
|
188 |
<routers>
|
189 |
-
<
|
190 |
-
<use>admin</use>
|
191 |
<args>
|
192 |
-
<
|
193 |
-
|
|
|
194 |
</args>
|
195 |
-
</
|
196 |
</routers>
|
197 |
</admin>
|
198 |
<adminhtml>
|
@@ -213,14 +222,22 @@
|
|
213 |
</modules>
|
214 |
</translate>
|
215 |
<events>
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
<sales_order_shipment_track_save_after>
|
225 |
<observers>
|
226 |
<campaigner_track_save_after>
|
@@ -246,24 +263,49 @@
|
|
246 |
</campaigner_update_customer_admin>
|
247 |
</observers>
|
248 |
</customer_save_after>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
</events>
|
250 |
</adminhtml>
|
251 |
<default>
|
252 |
<campaigner>
|
253 |
<general>
|
254 |
-
<
|
255 |
-
|
256 |
-
<
|
257 |
-
<
|
258 |
-
<
|
259 |
-
<
|
|
|
|
|
|
|
260 |
<products>Products</products>
|
261 |
-
<
|
262 |
-
<
|
263 |
-
<
|
264 |
-
|
265 |
-
<ftp>FTP</ftp>
|
266 |
-
</urls>
|
267 |
<active>0</active>
|
268 |
<sourceid>0</sourceid>
|
269 |
<source>Magento</source>
|
@@ -296,13 +338,19 @@ C]]></abandonedsequence_options>
|
|
296 |
<wishlist_enabled>0</wishlist_enabled>
|
297 |
<field_prefix>Mage_</field_prefix>
|
298 |
<status_check_time>-24 hours</status_check_time>
|
|
|
|
|
299 |
</general>
|
300 |
-
<
|
301 |
-
<
|
302 |
-
<
|
|
|
|
|
303 |
<batch>100</batch>
|
304 |
-
<
|
305 |
-
|
|
|
|
|
306 |
<troubleshooting>
|
307 |
<logging_enabled>0</logging_enabled>
|
308 |
<logging_duration>10</logging_duration>
|
@@ -313,6 +361,7 @@ C]]></abandonedsequence_options>
|
|
313 |
<email>support@campaigner.com</email>
|
314 |
<subject>Campaigner Magento Module Troubleshooting Report</subject>
|
315 |
<report_file>troubleshootingreport.html</report_file>
|
|
|
316 |
<max_file_size>1048576</max_file_size>
|
317 |
<duration>10</duration>
|
318 |
</troubleshooting>
|
@@ -346,6 +395,33 @@ C]]></abandonedsequence_options>
|
|
346 |
<model>campaigner/order_observer::processLatestOrders</model>
|
347 |
</run>
|
348 |
</campaigner_integration_latest_orders>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
</jobs>
|
350 |
</crontab>
|
351 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Campaigner_Integration>
|
5 |
+
<version>1.1.1</version>
|
6 |
</Campaigner_Integration>
|
7 |
</modules>
|
8 |
<global>
|
60 |
<session>
|
61 |
<table>campaigner_session</table>
|
62 |
</session>
|
63 |
+
<background_task>
|
64 |
+
<table>campaigner_background_task</table>
|
65 |
+
</background_task>
|
66 |
+
<product>
|
67 |
+
<table>campaigner_product</table>
|
68 |
+
</product>
|
69 |
+
<category>
|
70 |
+
<table>campaigner_category</table>
|
71 |
+
</category>
|
72 |
+
<product_category_action>
|
73 |
+
<table>campaigner_product_category_action</table>
|
74 |
+
</product_category_action>
|
75 |
</entities>
|
76 |
</campaigner_mysql4>
|
77 |
<core>
|
85 |
</models>
|
86 |
<template>
|
87 |
<email>
|
88 |
+
<campaigner_relay_test translate="label" module="campaigner">
|
89 |
<label>Relay Test</label>
|
90 |
<file>campaigner_relay_test.html</file>
|
91 |
<type>html</type>
|
195 |
</frontend>
|
196 |
<admin>
|
197 |
<routers>
|
198 |
+
<adminhtml>
|
|
|
199 |
<args>
|
200 |
+
<modules>
|
201 |
+
<campaigner_integration after="Mage_Adminhtml">Campaigner_Integration_Adminhtml</campaigner_integration>
|
202 |
+
</modules>
|
203 |
</args>
|
204 |
+
</adminhtml>
|
205 |
</routers>
|
206 |
</admin>
|
207 |
<adminhtml>
|
222 |
</modules>
|
223 |
</translate>
|
224 |
<events>
|
225 |
+
<catalog_category_tree_move_after>
|
226 |
+
<observers>
|
227 |
+
<campaigner_category_tree_move_after>
|
228 |
+
<class>campaigner/product_observer</class>
|
229 |
+
<method>categoryTreeMoveAfter</method>
|
230 |
+
</campaigner_category_tree_move_after>
|
231 |
+
</observers>
|
232 |
+
</catalog_category_tree_move_after>
|
233 |
+
<core_block_abstract_to_html_before>
|
234 |
+
<observers>
|
235 |
+
<campaigner_newsletter_massaction>
|
236 |
+
<class>campaigner/newsletter_observer</class>
|
237 |
+
<method>updateNewsletterMassAction</method>
|
238 |
+
</campaigner_newsletter_massaction>
|
239 |
+
</observers>
|
240 |
+
</core_block_abstract_to_html_before>
|
241 |
<sales_order_shipment_track_save_after>
|
242 |
<observers>
|
243 |
<campaigner_track_save_after>
|
263 |
</campaigner_update_customer_admin>
|
264 |
</observers>
|
265 |
</customer_save_after>
|
266 |
+
<sales_order_save_after>
|
267 |
+
<observers>
|
268 |
+
<campaigner_order_save_after_admin>
|
269 |
+
<class>campaigner/order_observer</class>
|
270 |
+
<method>orderSaveAfterAdmin</method>
|
271 |
+
</campaigner_order_save_after_admin>
|
272 |
+
</observers>
|
273 |
+
</sales_order_save_after>
|
274 |
+
<catalog_product_save_after>
|
275 |
+
<observers>
|
276 |
+
<campaigner_product_save_after_admin>
|
277 |
+
<class>campaigner/product_observer</class>
|
278 |
+
<method>productSaveAfterAdmin</method>
|
279 |
+
</campaigner_product_save_after_admin>
|
280 |
+
</observers>
|
281 |
+
</catalog_product_save_after>
|
282 |
+
<catalog_category_save_after>
|
283 |
+
<observers>
|
284 |
+
<campaigner_category_save_after_admin>
|
285 |
+
<class>campaigner/product_observer</class>
|
286 |
+
<method>categorySaveAfterAdmin</method>
|
287 |
+
</campaigner_category_save_after_admin>
|
288 |
+
</observers>
|
289 |
+
</catalog_category_save_after>
|
290 |
</events>
|
291 |
</adminhtml>
|
292 |
<default>
|
293 |
<campaigner>
|
294 |
<general>
|
295 |
+
<accesspoint>https://rest.campaigner.com/v1/</accesspoint>
|
296 |
+
<commerce>
|
297 |
+
<accesspoint>https://edapi.campaigner.com/v1/</accesspoint>
|
298 |
+
<ping>Ping</ping>
|
299 |
+
<order>Orders</order>
|
300 |
+
<orders_old>Orders/Import</orders_old>
|
301 |
+
<orders>Import/Subscribers</orders>
|
302 |
+
<product_categories>ProductCategories</product_categories>
|
303 |
+
<product_details>Products/SKU</product_details>
|
304 |
<products>Products</products>
|
305 |
+
<category_by_name>ProductCategories?categoryName=</category_by_name>
|
306 |
+
<send_states>complete</send_states>
|
307 |
+
<send_statuses>complete</send_statuses>
|
308 |
+
</commerce>
|
|
|
|
|
309 |
<active>0</active>
|
310 |
<sourceid>0</sourceid>
|
311 |
<source>Magento</source>
|
338 |
<wishlist_enabled>0</wishlist_enabled>
|
339 |
<field_prefix>Mage_</field_prefix>
|
340 |
<status_check_time>-24 hours</status_check_time>
|
341 |
+
<cron_not_run_minutes>80</cron_not_run_minutes>
|
342 |
+
<schedule_row_limit>50</schedule_row_limit>
|
343 |
</general>
|
344 |
+
<commerce>
|
345 |
+
<batch_size>500</batch_size>
|
346 |
+
<product_category_enabled>1</product_category_enabled>
|
347 |
+
</commerce>
|
348 |
+
<sync>
|
349 |
<batch>100</batch>
|
350 |
+
<product_batch>1</product_batch>
|
351 |
+
<customers_sequence_field>Mage_AbandonedSequence</customers_sequence_field>
|
352 |
+
<customers_sequence_options><![CDATA[Exported]]></customers_sequence_options>
|
353 |
+
</sync>
|
354 |
<troubleshooting>
|
355 |
<logging_enabled>0</logging_enabled>
|
356 |
<logging_duration>10</logging_duration>
|
361 |
<email>support@campaigner.com</email>
|
362 |
<subject>Campaigner Magento Module Troubleshooting Report</subject>
|
363 |
<report_file>troubleshootingreport.html</report_file>
|
364 |
+
<cron_report_file>cron_troubleshooting.html</cron_report_file>
|
365 |
<max_file_size>1048576</max_file_size>
|
366 |
<duration>10</duration>
|
367 |
</troubleshooting>
|
395 |
<model>campaigner/order_observer::processLatestOrders</model>
|
396 |
</run>
|
397 |
</campaigner_integration_latest_orders>
|
398 |
+
<campaigner_integration_background_tasks>
|
399 |
+
<schedule>
|
400 |
+
<cron_expr>*/10 * * * *</cron_expr>
|
401 |
+
<!--<cron_expr>*/5 * * * *</cron_expr>--><!-- every 5 minutes for testing -->
|
402 |
+
</schedule>
|
403 |
+
<run>
|
404 |
+
<model>campaigner/background_observer::processBackgroundTasks</model>
|
405 |
+
</run>
|
406 |
+
</campaigner_integration_background_tasks>
|
407 |
+
<campaigner_integration_orders>
|
408 |
+
<schedule>
|
409 |
+
<cron_expr>45 * * * *</cron_expr>
|
410 |
+
<!--<cron_expr>*/5 * * * *</cron_expr>--><!-- every 5 minutes for testing -->
|
411 |
+
</schedule>
|
412 |
+
<run>
|
413 |
+
<model>campaigner/order_observer::processBatchOrders</model>
|
414 |
+
</run>
|
415 |
+
</campaigner_integration_orders>
|
416 |
+
<campaigner_integration_products>
|
417 |
+
<schedule>
|
418 |
+
<cron_expr>15 * * * *</cron_expr>
|
419 |
+
<!--<cron_expr>*/5 * * * *</cron_expr>--><!-- every 5 minutes for testing -->
|
420 |
+
</schedule>
|
421 |
+
<run>
|
422 |
+
<model>campaigner/product_observer::processProducts</model>
|
423 |
+
</run>
|
424 |
+
</campaigner_integration_products>
|
425 |
</jobs>
|
426 |
</crontab>
|
427 |
</config>
|
@@ -21,7 +21,7 @@
|
|
21 |
<general translate="label comment">
|
22 |
<label>General</label>
|
23 |
<frontend_type>text</frontend_type>
|
24 |
-
<sort_order>
|
25 |
<show_in_default>1</show_in_default>
|
26 |
<show_in_website>1</show_in_website>
|
27 |
<show_in_store>1</show_in_store>
|
@@ -85,6 +85,14 @@
|
|
85 |
<show_in_website>0</show_in_website>
|
86 |
<show_in_store>1</show_in_store>
|
87 |
</api_instructions>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<smtp_link translate="label">
|
89 |
<label>SMTP Relay</label>
|
90 |
<frontend_model>campaigner/adminhtml_system_config_form_field_smtp</frontend_model>
|
@@ -158,6 +166,37 @@
|
|
158 |
<comment>Save information from the latest order along with the first 3 products from that order</comment>
|
159 |
</save_latest_order>
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
<heading_mappings translate="label">
|
162 |
<label>Field Mappings</label>
|
163 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
@@ -427,9 +466,450 @@
|
|
427 |
<show_in_store>1</show_in_store>
|
428 |
<comment>Send subscriber Wishlist URL and their most recent Wishlist Date to your Campaigner database.</comment>
|
429 |
</wishlist_enabled>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
</fields>
|
431 |
</general>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
<troubleshooting translate="label comment">
|
434 |
<label>Troubleshooting</label>
|
435 |
<frontend_type>text</frontend_type>
|
21 |
<general translate="label comment">
|
22 |
<label>General</label>
|
23 |
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>100</sort_order>
|
25 |
<show_in_default>1</show_in_default>
|
26 |
<show_in_website>1</show_in_website>
|
27 |
<show_in_store>1</show_in_store>
|
85 |
<show_in_website>0</show_in_website>
|
86 |
<show_in_store>1</show_in_store>
|
87 |
</api_instructions>
|
88 |
+
<emaildirect_transfer>
|
89 |
+
<label>Transfer settings from EmailDirect?</label>
|
90 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_emaildirect</frontend_model>
|
91 |
+
<sort_order>26</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>0</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
</emaildirect_transfer>
|
96 |
<smtp_link translate="label">
|
97 |
<label>SMTP Relay</label>
|
98 |
<frontend_model>campaigner/adminhtml_system_config_form_field_smtp</frontend_model>
|
166 |
<comment>Save information from the latest order along with the first 3 products from that order</comment>
|
167 |
</save_latest_order>
|
168 |
|
169 |
+
<trigger_workflows translate="label">
|
170 |
+
<label>Trigger Campaigner Workflows</label>
|
171 |
+
<frontend_type>select</frontend_type>
|
172 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
173 |
+
<sort_order>90</sort_order>
|
174 |
+
<show_in_default>1</show_in_default>
|
175 |
+
<show_in_website>0</show_in_website>
|
176 |
+
<show_in_store>1</show_in_store>
|
177 |
+
<comment>When enabled, any active Campaigner workflows set to trigger on list membership or contact information updates will fire as a result of activities performed in Magento.</comment>
|
178 |
+
</trigger_workflows>
|
179 |
+
|
180 |
+
<heading_background translate="label">
|
181 |
+
<label>Background Processing</label>
|
182 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
183 |
+
<sort_order>150</sort_order>
|
184 |
+
<show_in_default>1</show_in_default>
|
185 |
+
<show_in_website>0</show_in_website>
|
186 |
+
<show_in_store>1</show_in_store>
|
187 |
+
</heading_background>
|
188 |
+
|
189 |
+
<background_task_enabled translate="label">
|
190 |
+
<label>Enabled</label>
|
191 |
+
<frontend_type>select</frontend_type>
|
192 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
193 |
+
<sort_order>160</sort_order>
|
194 |
+
<show_in_default>1</show_in_default>
|
195 |
+
<show_in_website>0</show_in_website>
|
196 |
+
<show_in_store>1</show_in_store>
|
197 |
+
<comment>When this feature is enabled, all non-realtime communication with the Campaigner API will be done in the background. On sites with high traffic this can help with performance.</comment>
|
198 |
+
</background_task_enabled>
|
199 |
+
|
200 |
<heading_mappings translate="label">
|
201 |
<label>Field Mappings</label>
|
202 |
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
466 |
<show_in_store>1</show_in_store>
|
467 |
<comment>Send subscriber Wishlist URL and their most recent Wishlist Date to your Campaigner database.</comment>
|
468 |
</wishlist_enabled>
|
469 |
+
|
470 |
+
<!-- CRON URL -->
|
471 |
+
<heading_cron_url translate="label">
|
472 |
+
<label>Cron URL</label>
|
473 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
474 |
+
<sort_order>800</sort_order>
|
475 |
+
<show_in_default>1</show_in_default>
|
476 |
+
<show_in_website>0</show_in_website>
|
477 |
+
<show_in_store>1</show_in_store>
|
478 |
+
</heading_cron_url>
|
479 |
+
<cron_url_enabled>
|
480 |
+
<label>Allow cron to be run from a URL?</label>
|
481 |
+
<frontend_type>select</frontend_type>
|
482 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
483 |
+
<sort_order>810</sort_order>
|
484 |
+
<show_in_default>1</show_in_default>
|
485 |
+
<show_in_website>0</show_in_website>
|
486 |
+
<show_in_store>1</show_in_store>
|
487 |
+
<comment>This URL is an alternate method to trigger Campaigner cron jobs</comment>
|
488 |
+
</cron_url_enabled>
|
489 |
+
<cron_url_password_enabled>
|
490 |
+
<label>Require a password?</label>
|
491 |
+
<frontend_type>select</frontend_type>
|
492 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
493 |
+
<sort_order>820</sort_order>
|
494 |
+
<show_in_default>1</show_in_default>
|
495 |
+
<show_in_website>0</show_in_website>
|
496 |
+
<show_in_store>1</show_in_store>
|
497 |
+
<comment>Limit access to the cron URL</comment>
|
498 |
+
<depends><cron_url_enabled>1</cron_url_enabled></depends>
|
499 |
+
</cron_url_password_enabled>
|
500 |
+
<cron_url_password>
|
501 |
+
<label>Password</label>
|
502 |
+
<frontend_type>text</frontend_type>
|
503 |
+
<sort_order>830</sort_order>
|
504 |
+
<show_in_default>1</show_in_default>
|
505 |
+
<show_in_website>0</show_in_website>
|
506 |
+
<show_in_store>1</show_in_store>
|
507 |
+
<depends><cron_url_enabled>1</cron_url_enabled><cron_url_password_enabled>1</cron_url_password_enabled></depends>
|
508 |
+
<validate>required-entry</validate>
|
509 |
+
</cron_url_password>
|
510 |
+
<cron_url_info>
|
511 |
+
<label>URL Info</label>
|
512 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_cron_url_info</frontend_model>
|
513 |
+
<sort_order>850</sort_order>
|
514 |
+
<show_in_default>1</show_in_default>
|
515 |
+
<show_in_website>0</show_in_website>
|
516 |
+
<show_in_store>1</show_in_store>
|
517 |
+
<depends><cron_url_enabled>1</cron_url_enabled></depends>
|
518 |
+
</cron_url_info>
|
519 |
</fields>
|
520 |
</general>
|
521 |
+
<commerce translate="label comment">
|
522 |
+
<label>Purchase Behavior Targeting</label>
|
523 |
+
<frontend_type>text</frontend_type>
|
524 |
+
<sort_order>600</sort_order>
|
525 |
+
<show_in_default>1</show_in_default>
|
526 |
+
<show_in_website>0</show_in_website>
|
527 |
+
<show_in_store>1</show_in_store>
|
528 |
+
<expanded>1</expanded>
|
529 |
+
<fields>
|
530 |
+
<heading_orders translate="label">
|
531 |
+
<label>Orders</label>
|
532 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
533 |
+
<sort_order>10</sort_order>
|
534 |
+
<show_in_default>1</show_in_default>
|
535 |
+
<show_in_website>0</show_in_website>
|
536 |
+
<show_in_store>1</show_in_store>
|
537 |
+
</heading_orders>
|
538 |
+
<enabled translate="label">
|
539 |
+
<label>Send orders to Campaigner</label>
|
540 |
+
<frontend_type>select</frontend_type>
|
541 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
542 |
+
<sort_order>20</sort_order>
|
543 |
+
<show_in_default>1</show_in_default>
|
544 |
+
<show_in_website>0</show_in_website>
|
545 |
+
<show_in_store>1</show_in_store>
|
546 |
+
<comment>Sends all completed orders to Campaigner Purchase Behavior for detailed reporting, filtering and targeting</comment>
|
547 |
+
</enabled>
|
548 |
+
<apikey translate="label comment">
|
549 |
+
<label>API Key</label>
|
550 |
+
<frontend_type>text</frontend_type>
|
551 |
+
<sort_order>30</sort_order>
|
552 |
+
<show_in_default>1</show_in_default>
|
553 |
+
<show_in_website>0</show_in_website>
|
554 |
+
<show_in_store>1</show_in_store>
|
555 |
+
<comment>Enter your Campaigner API Key here</comment>
|
556 |
+
</apikey>
|
557 |
+
<apikey_validation translate="label">
|
558 |
+
<label>API Key Status</label>
|
559 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_commerce_api</frontend_model>
|
560 |
+
<sort_order>40</sort_order>
|
561 |
+
<show_in_default>1</show_in_default>
|
562 |
+
<show_in_website>0</show_in_website>
|
563 |
+
<show_in_store>1</show_in_store>
|
564 |
+
<comment></comment>
|
565 |
+
</apikey_validation>
|
566 |
+
<apikey_instructions>
|
567 |
+
<label>Get your API Key</label>
|
568 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_commerce_note</frontend_model>
|
569 |
+
<sort_order>50</sort_order>
|
570 |
+
<show_in_default>1</show_in_default>
|
571 |
+
<show_in_website>0</show_in_website>
|
572 |
+
<show_in_store>1</show_in_store>
|
573 |
+
</apikey_instructions>
|
574 |
+
<send_field>
|
575 |
+
<label>Send orders based on</label>
|
576 |
+
<frontend_type>select</frontend_type>
|
577 |
+
<source_model>campaigner/system_config_source_send_field</source_model>
|
578 |
+
<sort_order>60</sort_order>
|
579 |
+
<show_in_default>1</show_in_default>
|
580 |
+
<show_in_website>0</show_in_website>
|
581 |
+
<show_in_store>1</show_in_store>
|
582 |
+
<depends><enabled>1</enabled></depends>
|
583 |
+
</send_field>
|
584 |
+
<send_states translate="label comment">
|
585 |
+
<label>State options</label>
|
586 |
+
<frontend_type>multiselect</frontend_type>
|
587 |
+
<source_model>campaigner/system_config_source_states</source_model>
|
588 |
+
<sort_order>70</sort_order>
|
589 |
+
<show_in_default>1</show_in_default>
|
590 |
+
<show_in_website>0</show_in_website>
|
591 |
+
<show_in_store>1</show_in_store>
|
592 |
+
<comment>Choose one or more States to determine when an order will be sent to Campaigner. Orders will only be sent the first time one of these states is encountered. This information will appear as the Order 'Status' in Campaigner.</comment>
|
593 |
+
<depends><enabled>1</enabled><send_field>state</send_field></depends>
|
594 |
+
</send_states>
|
595 |
+
<send_statuses translate="label comment">
|
596 |
+
<label>Status options</label>
|
597 |
+
<frontend_type>multiselect</frontend_type>
|
598 |
+
<source_model>campaigner/system_config_source_statuses</source_model>
|
599 |
+
<sort_order>80</sort_order>
|
600 |
+
<show_in_default>1</show_in_default>
|
601 |
+
<show_in_website>0</show_in_website>
|
602 |
+
<show_in_store>1</show_in_store>
|
603 |
+
<comment>Choose one or more Statuses to determine when an order will be sent to Campaigner. Orders will only be sent the first time one of these statuses is encountered. This information will appear as the Order 'Status' in Campaigner.</comment>
|
604 |
+
<depends><enabled>1</enabled><send_field>status</send_field></depends>
|
605 |
+
</send_statuses>
|
606 |
+
<batch_enabled>
|
607 |
+
<label>Send orders in the background?</label>
|
608 |
+
<frontend_type>select</frontend_type>
|
609 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
610 |
+
<sort_order>90</sort_order>
|
611 |
+
<show_in_default>1</show_in_default>
|
612 |
+
<show_in_website>0</show_in_website>
|
613 |
+
<show_in_store>1</show_in_store>
|
614 |
+
<comment>If selected, orders will be sent in batches of up to 500 every hour through a cron process. Note that only orders up to a week old from the present date will be processed. To process older orders please use the order sync function below.</comment>
|
615 |
+
<depends><enabled>1</enabled></depends>
|
616 |
+
</batch_enabled>
|
617 |
+
<batch_only>
|
618 |
+
<label>Send in background only?</label>
|
619 |
+
<frontend_type>select</frontend_type>
|
620 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
621 |
+
<sort_order>100</sort_order>
|
622 |
+
<show_in_default>1</show_in_default>
|
623 |
+
<show_in_website>0</show_in_website>
|
624 |
+
<show_in_store>1</show_in_store>
|
625 |
+
<comment>Orders will only be sent in the background process.</comment>
|
626 |
+
<depends><enabled>1</enabled><batch_enabled>1</batch_enabled></depends>
|
627 |
+
</batch_only>
|
628 |
+
|
629 |
+
<heading_products translate="label">
|
630 |
+
<label>Products and Product Categories</label>
|
631 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
632 |
+
<sort_order>400</sort_order>
|
633 |
+
<show_in_default>1</show_in_default>
|
634 |
+
<show_in_website>0</show_in_website>
|
635 |
+
<show_in_store>1</show_in_store>
|
636 |
+
<depends><enabled>1</enabled></depends>
|
637 |
+
</heading_products>
|
638 |
+
<product_category_enabled>
|
639 |
+
<label>Automatically sync product and product category information?</label>
|
640 |
+
<frontend_type>select</frontend_type>
|
641 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
642 |
+
<sort_order>410</sort_order>
|
643 |
+
<show_in_default>1</show_in_default>
|
644 |
+
<show_in_website>0</show_in_website>
|
645 |
+
<show_in_store>1</show_in_store>
|
646 |
+
<comment>Sends any updates you make to product or product category information to Campaigner in the background. Alternatively, you can use the ‘Sync Products’ feature (further below) to manually update all products and product categories in Campaigner in a single action.</comment>
|
647 |
+
<depends><enabled>1</enabled></depends>
|
648 |
+
</product_category_enabled>
|
649 |
+
|
650 |
+
<not_available>
|
651 |
+
<label>Not Available</label>
|
652 |
+
<frontend_type>label</frontend_type>
|
653 |
+
<sort_order>1000</sort_order>
|
654 |
+
<show_in_default>1</show_in_default>
|
655 |
+
<show_in_website>0</show_in_website>
|
656 |
+
<show_in_store>1</show_in_store>
|
657 |
+
<comment>Please setup your Campaigner API Username and Password before setting up Purchase Behavior Targeting</comment>
|
658 |
+
<!--<depends><setup>0</setup></depends>-->
|
659 |
+
</not_available>
|
660 |
+
<not_enabled>
|
661 |
+
<label>Not Available</label>
|
662 |
+
<frontend_type>label</frontend_type>
|
663 |
+
<sort_order>2000</sort_order>
|
664 |
+
<show_in_default>1</show_in_default>
|
665 |
+
<show_in_website>0</show_in_website>
|
666 |
+
<show_in_store>1</show_in_store>
|
667 |
+
<comment>Please enable the Campaigner Module to setup Purchase Behavior Targeting</comment>
|
668 |
+
<!--<depends><setup>0</setup></depends>-->
|
669 |
+
</not_enabled>
|
670 |
+
</fields>
|
671 |
+
</commerce>
|
672 |
+
<sync translate="label comment">
|
673 |
+
<label>Sync</label>
|
674 |
+
<frontend_type>text</frontend_type>
|
675 |
+
<sort_order>670</sort_order>
|
676 |
+
<show_in_default>1</show_in_default>
|
677 |
+
<show_in_website>0</show_in_website>
|
678 |
+
<show_in_store>1</show_in_store>
|
679 |
+
<expanded>1</expanded>
|
680 |
+
<fields>
|
681 |
+
<customers_heading translate="label">
|
682 |
+
<label>Sync Customers</label>
|
683 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
684 |
+
<sort_order>10</sort_order>
|
685 |
+
<show_in_default>1</show_in_default>
|
686 |
+
<show_in_website>0</show_in_website>
|
687 |
+
<show_in_store>1</show_in_store>
|
688 |
+
</customers_heading>
|
689 |
+
<customers_include_already_sent translate="label">
|
690 |
+
<label>Include customers already sent?</label>
|
691 |
+
<frontend_type>select</frontend_type>
|
692 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
693 |
+
<sort_order>20</sort_order>
|
694 |
+
<show_in_default>1</show_in_default>
|
695 |
+
<show_in_website>0</show_in_website>
|
696 |
+
<show_in_store>1</show_in_store>
|
697 |
+
<comment>This option allows you to include or exclude customers that have been sent directly to Campaigner through the normal processes.</comment>
|
698 |
+
</customers_include_already_sent>
|
699 |
+
<customers_lists translate="label comment">
|
700 |
+
<label>Subscribe to lists</label>
|
701 |
+
<frontend_type>multiselect</frontend_type>
|
702 |
+
<source_model>campaigner/system_config_source_list</source_model>
|
703 |
+
<sort_order>30</sort_order>
|
704 |
+
<show_in_default>1</show_in_default>
|
705 |
+
<show_in_website>0</show_in_website>
|
706 |
+
<show_in_store>1</show_in_store>
|
707 |
+
<can_be_empty>1</can_be_empty>
|
708 |
+
<comment>Select the lists you want to subscribe these customers to in Campaigner.</comment>
|
709 |
+
</customers_lists>
|
710 |
+
<customers_include_latest_orders translate="label">
|
711 |
+
<label>Include latest orders?</label>
|
712 |
+
<frontend_type>select</frontend_type>
|
713 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
714 |
+
<sort_order>40</sort_order>
|
715 |
+
<show_in_default>1</show_in_default>
|
716 |
+
<show_in_website>0</show_in_website>
|
717 |
+
<show_in_store>1</show_in_store>
|
718 |
+
<comment>Include basic information about each customer’s latest order (if applicable). To sync full historical order information, use the Sync Orders feature provided further below.</comment>
|
719 |
+
</customers_include_latest_orders>
|
720 |
+
<customers_include_abandoned_carts translate="label">
|
721 |
+
<label>Include abandoned carts?</label>
|
722 |
+
<frontend_type>select</frontend_type>
|
723 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
724 |
+
<sort_order>50</sort_order>
|
725 |
+
<show_in_default>1</show_in_default>
|
726 |
+
<show_in_website>0</show_in_website>
|
727 |
+
<show_in_store>1</show_in_store>
|
728 |
+
<comment>Include abandoned cart information with each customer.</comment>
|
729 |
+
</customers_include_abandoned_carts>
|
730 |
+
<customers_sequence_enabled>
|
731 |
+
<label>Add a sequence value to each abandoned cart?</label>
|
732 |
+
<frontend_type>select</frontend_type>
|
733 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
734 |
+
<sort_order>60</sort_order>
|
735 |
+
<show_in_default>1</show_in_default>
|
736 |
+
<show_in_website>0</show_in_website>
|
737 |
+
<show_in_store>1</show_in_store>
|
738 |
+
<comment>This will allow you to assign a sequence of values to your subscribers, one for each abandoned cart.</comment>
|
739 |
+
<depends><customers_include_abandoned_carts>1</customers_include_abandoned_carts></depends>
|
740 |
+
</customers_sequence_enabled>
|
741 |
+
<customers_sequence_field translate="label comment">
|
742 |
+
<label>Sequence Database Field</label>
|
743 |
+
<frontend_type>select</frontend_type>
|
744 |
+
<source_model>campaigner/system_config_source_sequence</source_model>
|
745 |
+
<sort_order>70</sort_order>
|
746 |
+
<show_in_default>1</show_in_default>
|
747 |
+
<show_in_website>0</show_in_website>
|
748 |
+
<show_in_store>1</show_in_store>
|
749 |
+
<can_be_empty>1</can_be_empty>
|
750 |
+
<comment>This is the database field in Campaigner that the sequence will be stored in.</comment>
|
751 |
+
<depends><customers_include_abandoned_carts>1</customers_include_abandoned_carts><customers_sequence_enabled>1</customers_sequence_enabled></depends>
|
752 |
+
</customers_sequence_field>
|
753 |
+
<customers_sequence_options translate="label comment">
|
754 |
+
<label>Sequence Options</label>
|
755 |
+
<frontend_type>textarea</frontend_type>
|
756 |
+
<sort_order>80</sort_order>
|
757 |
+
<show_in_default>1</show_in_default>
|
758 |
+
<show_in_website>0</show_in_website>
|
759 |
+
<show_in_store>1</show_in_store>
|
760 |
+
<can_be_empty>1</can_be_empty>
|
761 |
+
<comment>Enter one sequence per line to be appended.</comment>
|
762 |
+
<depends><customers_include_abandoned_carts>1</customers_include_abandoned_carts><customers_sequence_enabled>1</customers_sequence_enabled></depends>
|
763 |
+
</customers_sequence_options>
|
764 |
+
<customers_range>
|
765 |
+
<label>Customer Date Range</label>
|
766 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_sync_customers_range</frontend_model>
|
767 |
+
<sort_order>90</sort_order>
|
768 |
+
<show_in_default>1</show_in_default>
|
769 |
+
<show_in_website>0</show_in_website>
|
770 |
+
<show_in_store>1</show_in_store>
|
771 |
+
<can_be_empty>1</can_be_empty>
|
772 |
+
<comment>Only customers updated within the past year can by sent to Campaigner.</comment>
|
773 |
+
</customers_range>
|
774 |
+
<customers_button>
|
775 |
+
<label>Send Customers</label>
|
776 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_sync_customers_button</frontend_model>
|
777 |
+
<sort_order>100</sort_order>
|
778 |
+
<show_in_default>1</show_in_default>
|
779 |
+
<show_in_website>0</show_in_website>
|
780 |
+
<show_in_store>1</show_in_store>
|
781 |
+
<can_be_empty>1</can_be_empty>
|
782 |
+
<!--<comment>If configuration changes have been made to abandoned cart sequences, please save before running export.</comment>-->
|
783 |
+
</customers_button>
|
784 |
+
|
785 |
+
<!-- SYNC ORDERS START -->
|
786 |
+
|
787 |
+
<orders_heading translate="label">
|
788 |
+
<label>Sync Orders</label>
|
789 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
790 |
+
<sort_order>300</sort_order>
|
791 |
+
<show_in_default>1</show_in_default>
|
792 |
+
<show_in_website>0</show_in_website>
|
793 |
+
<show_in_store>1</show_in_store>
|
794 |
+
</orders_heading>
|
795 |
+
<orders_not_available>
|
796 |
+
<label>Not Available</label>
|
797 |
+
<frontend_type>label</frontend_type>
|
798 |
+
<sort_order>310</sort_order>
|
799 |
+
<show_in_default>1</show_in_default>
|
800 |
+
<show_in_website>0</show_in_website>
|
801 |
+
<show_in_store>1</show_in_store>
|
802 |
+
<comment>Please setup your API Key to perform a Sync</comment>
|
803 |
+
<!--<depends><setup>0</setup></depends>-->
|
804 |
+
</orders_not_available>
|
805 |
+
<orders_not_enabled>
|
806 |
+
<label>Not Available</label>
|
807 |
+
<frontend_type>label</frontend_type>
|
808 |
+
<sort_order>315</sort_order>
|
809 |
+
<show_in_default>1</show_in_default>
|
810 |
+
<show_in_website>0</show_in_website>
|
811 |
+
<show_in_store>1</show_in_store>
|
812 |
+
<comment>Please enable the Campaigner Module to perform a sync</comment>
|
813 |
+
<!--<depends><setup>0</setup></depends>-->
|
814 |
+
</orders_not_enabled>
|
815 |
+
<orders_include_already_sent translate="label">
|
816 |
+
<label>Include orders already sent?</label>
|
817 |
+
<frontend_type>select</frontend_type>
|
818 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
819 |
+
<sort_order>320</sort_order>
|
820 |
+
<show_in_default>1</show_in_default>
|
821 |
+
<show_in_website>0</show_in_website>
|
822 |
+
<show_in_store>1</show_in_store>
|
823 |
+
<comment>This option allows you to include or exclude orders that have been sent directly to Campaigner through the normal order creation process.</comment>
|
824 |
+
</orders_include_already_sent>
|
825 |
+
<orders_range>
|
826 |
+
<label>Order Date Range</label>
|
827 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_sync_orders_range</frontend_model>
|
828 |
+
<sort_order>340</sort_order>
|
829 |
+
<show_in_default>1</show_in_default>
|
830 |
+
<show_in_website>0</show_in_website>
|
831 |
+
<show_in_store>1</show_in_store>
|
832 |
+
<can_be_empty>1</can_be_empty>
|
833 |
+
<comment>Only orders within the past year can by sent to Campaigner.</comment>
|
834 |
+
</orders_range>
|
835 |
+
<orders_button>
|
836 |
+
<label>Send Orders</label>
|
837 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_sync_orders_button</frontend_model>
|
838 |
+
<sort_order>350</sort_order>
|
839 |
+
<show_in_default>1</show_in_default>
|
840 |
+
<show_in_website>0</show_in_website>
|
841 |
+
<show_in_store>1</show_in_store>
|
842 |
+
<can_be_empty>1</can_be_empty>
|
843 |
+
<!--<comment>API Key has been changed. Please save configuration before performing a Sync.</comment>-->
|
844 |
+
</orders_button>
|
845 |
|
846 |
+
<!-- SYNC ORDERS END -->
|
847 |
+
|
848 |
+
<!-- SYNC PRODUCTS START -->
|
849 |
+
|
850 |
+
<products_heading translate="label">
|
851 |
+
<label>Sync Products</label>
|
852 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
853 |
+
<sort_order>500</sort_order>
|
854 |
+
<show_in_default>1</show_in_default>
|
855 |
+
<show_in_website>0</show_in_website>
|
856 |
+
<show_in_store>1</show_in_store>
|
857 |
+
</products_heading>
|
858 |
+
<products_not_available>
|
859 |
+
<label>Not Available</label>
|
860 |
+
<frontend_type>label</frontend_type>
|
861 |
+
<sort_order>510</sort_order>
|
862 |
+
<show_in_default>1</show_in_default>
|
863 |
+
<show_in_website>0</show_in_website>
|
864 |
+
<show_in_store>1</show_in_store>
|
865 |
+
<comment>Please setup your API Key to perform a Sync</comment>
|
866 |
+
<!--<depends><setup>0</setup></depends>-->
|
867 |
+
</products_not_available>
|
868 |
+
<products_not_enabled>
|
869 |
+
<label>Not Available</label>
|
870 |
+
<frontend_type>label</frontend_type>
|
871 |
+
<sort_order>520</sort_order>
|
872 |
+
<show_in_default>1</show_in_default>
|
873 |
+
<show_in_website>0</show_in_website>
|
874 |
+
<show_in_store>1</show_in_store>
|
875 |
+
<comment>Please enable the Campaigner Module to perform a sync</comment>
|
876 |
+
<!--<depends><setup>0</setup></depends>-->
|
877 |
+
</products_not_enabled>
|
878 |
+
<products_include_disabled translate="label">
|
879 |
+
<label>Include disabled products?</label>
|
880 |
+
<frontend_type>select</frontend_type>
|
881 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
882 |
+
<sort_order>530</sort_order>
|
883 |
+
<show_in_default>1</show_in_default>
|
884 |
+
<show_in_website>0</show_in_website>
|
885 |
+
<show_in_store>1</show_in_store>
|
886 |
+
<comment></comment>
|
887 |
+
</products_include_disabled>
|
888 |
+
<products_button>
|
889 |
+
<label>Send Products</label>
|
890 |
+
<frontend_model>campaigner/adminhtml_system_config_form_field_sync_products_button</frontend_model>
|
891 |
+
<sort_order>550</sort_order>
|
892 |
+
<show_in_default>1</show_in_default>
|
893 |
+
<show_in_website>0</show_in_website>
|
894 |
+
<show_in_store>1</show_in_store>
|
895 |
+
<can_be_empty>1</can_be_empty>
|
896 |
+
<!--<comment>API Key has been changed. Please save configuration before performing a Sync.</comment>-->
|
897 |
+
</products_button>
|
898 |
+
|
899 |
+
<!-- SYNC PRODUCTS END -->
|
900 |
+
|
901 |
+
<not_available>
|
902 |
+
<label>Not Available</label>
|
903 |
+
<frontend_type>label</frontend_type>
|
904 |
+
<sort_order>1000</sort_order>
|
905 |
+
<show_in_default>1</show_in_default>
|
906 |
+
<show_in_website>0</show_in_website>
|
907 |
+
<show_in_store>1</show_in_store>
|
908 |
+
<comment>Please setup your API Credentials to perform a Sync</comment>
|
909 |
+
<!--<depends><setup>0</setup></depends>-->
|
910 |
+
</not_available>
|
911 |
+
</fields>
|
912 |
+
</sync>
|
913 |
<troubleshooting translate="label comment">
|
914 |
<label>Troubleshooting</label>
|
915 |
<frontend_type>text</frontend_type>
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
try
|
8 |
+
{
|
9 |
+
$this->run("
|
10 |
+
DROP TABLE IF EXISTS {$this->getTable('campaigner/background_task')};
|
11 |
+
CREATE TABLE {$this->getTable('campaigner/background_task')} (
|
12 |
+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
13 |
+
`email` varchar(255) NULL,
|
14 |
+
`customer_id` int(11) NULL,
|
15 |
+
`store_id` int(11) NULL,
|
16 |
+
`code` varchar(50) NULL,
|
17 |
+
`details` text NULL,
|
18 |
+
`status` varchar(255) NULL,
|
19 |
+
`created_at` TIMESTAMP NULL,
|
20 |
+
`date_sent` TIMESTAMP NULL,
|
21 |
+
PRIMARY KEY (`id`),
|
22 |
+
KEY `idx_date_sent` (`date_sent`),
|
23 |
+
KEY `idx_email` (`email`),
|
24 |
+
KEY `idx_customer_id` (`customer_id`),
|
25 |
+
KEY `idx_code` (`code`),
|
26 |
+
KEY `idx_status` (`status`)
|
27 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
+
");
|
29 |
+
}
|
30 |
+
catch (Exception $e)
|
31 |
+
{
|
32 |
+
$this->install_log($e->getMessage());
|
33 |
+
}
|
34 |
+
|
35 |
+
$installer->endSetup();
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
try
|
8 |
+
{
|
9 |
+
$this->run("
|
10 |
+
DROP TABLE IF EXISTS {$this->getTable('campaigner/order')};
|
11 |
+
CREATE TABLE {$this->getTable('campaigner/order')} (
|
12 |
+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
13 |
+
`date_sent` TIMESTAMP NULL,
|
14 |
+
`order_id` int(11) DEFAULT NULL,
|
15 |
+
PRIMARY KEY (`id`),
|
16 |
+
KEY `idx_order_id` (`order_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
+
");
|
19 |
+
}
|
20 |
+
catch (Exception $e)
|
21 |
+
{
|
22 |
+
$this->install_log($e->getMessage());
|
23 |
+
}
|
24 |
+
|
25 |
+
$installer->endSetup();
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
try
|
8 |
+
{
|
9 |
+
$this->run("
|
10 |
+
DROP TABLE IF EXISTS {$this->getTable('campaigner/product')};
|
11 |
+
CREATE TABLE {$this->getTable('campaigner/product')} (
|
12 |
+
`id` int(10) unsigned NOT NULL,
|
13 |
+
`campaigner_id` int(10) unsigned NOT NULL,
|
14 |
+
`campaigner_categories` TEXT,
|
15 |
+
PRIMARY KEY (`id`),
|
16 |
+
KEY `idx_campaigner_id` (`campaigner_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
+
|
19 |
+
DROP TABLE IF EXISTS {$this->getTable('campaigner/category')};
|
20 |
+
CREATE TABLE {$this->getTable('campaigner/category')} (
|
21 |
+
`id` int(10) unsigned NOT NULL,
|
22 |
+
`campaigner_id` int(10) unsigned NOT NULL,
|
23 |
+
`parent_id` int(10) unsigned NOT NULL,
|
24 |
+
PRIMARY KEY (`id`),
|
25 |
+
KEY `idx_campaigner_id` (`campaigner_id`)
|
26 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
27 |
+
|
28 |
+
DROP TABLE IF EXISTS {$this->getTable('campaigner/product_category_action')};
|
29 |
+
CREATE TABLE {$this->getTable('campaigner/product_category_action')} (
|
30 |
+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
31 |
+
`product_id` int(10) unsigned NULL,
|
32 |
+
`category_id` int(10) unsigned NULL,
|
33 |
+
`type` varchar(50) NOT NULL,
|
34 |
+
`action` varchar(50) NOT NULL,
|
35 |
+
`date_sent` TIMESTAMP NULL,
|
36 |
+
`status` varchar(255) NULL,
|
37 |
+
PRIMARY KEY (`id`),
|
38 |
+
KEY `idx_date_sent` (`date_sent`)
|
39 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
40 |
+
");
|
41 |
+
}
|
42 |
+
catch (Exception $e)
|
43 |
+
{
|
44 |
+
$this->install_log($e->getMessage());
|
45 |
+
}
|
46 |
+
|
47 |
+
$installer->endSetup();
|
@@ -9,7 +9,34 @@
|
|
9 |
</reference>
|
10 |
</adminhtml_system_config_edit>
|
11 |
|
12 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
<remove name="root"/>
|
14 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
15 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
@@ -18,13 +45,13 @@
|
|
18 |
<action method="addJs"><script>varien/js.js</script></action>
|
19 |
<action method="addJs"><script>mage/translate.js</script></action>
|
20 |
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
21 |
-
<action method="setTitle" translate="title"><title>Campaigner -
|
22 |
</block>
|
23 |
-
<block type="campaigner/
|
24 |
</block>
|
25 |
-
</
|
26 |
|
27 |
-
<
|
28 |
<remove name="root"/>
|
29 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
30 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
@@ -33,13 +60,13 @@
|
|
33 |
<action method="addJs"><script>varien/js.js</script></action>
|
34 |
<action method="addJs"><script>mage/translate.js</script></action>
|
35 |
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
36 |
-
<action method="setTitle" translate="title"><title>Campaigner -
|
37 |
</block>
|
38 |
-
<block type="campaigner/
|
39 |
</block>
|
40 |
-
</
|
41 |
|
42 |
-
<
|
43 |
<reference name="head">
|
44 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
45 |
</reference>
|
@@ -55,33 +82,59 @@
|
|
55 |
<action method="addTab"><name>trouble_settings</name><block>campaigner/adminhtml_troubleshooting_view_tab_settings</block></action>
|
56 |
<action method="addTab"><name>trouble_info</name><block>campaigner/adminhtml_troubleshooting_view_tab_info</block></action>
|
57 |
<action method="addTab"><name>trouble_log</name><block>campaigner/adminhtml_troubleshooting_view_tab_log</block></action>
|
|
|
58 |
<action method="addTab"><name>trouble_submit</name><block>campaigner/adminhtml_troubleshooting_view_tab_submit</block></action>
|
59 |
<action method="addTab"><name>trouble_download</name><block>campaigner/adminhtml_troubleshooting_view_tab_download</block></action>
|
60 |
</block>
|
61 |
</reference>
|
62 |
-
</
|
63 |
|
64 |
-
<
|
65 |
<reference name="head">
|
66 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
67 |
</reference>
|
68 |
<reference name="content">
|
69 |
-
<block type="campaigner/adminhtml_latest" name="latest_orders"
|
70 |
-
</block>
|
71 |
</reference>
|
72 |
-
</
|
73 |
|
74 |
-
<
|
75 |
<reference name="head">
|
76 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
77 |
</reference>
|
78 |
<reference name="content">
|
79 |
-
<block type="campaigner/
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</reference>
|
82 |
-
</
|
83 |
|
84 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
<reference name="head">
|
86 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
87 |
</reference>
|
@@ -94,11 +147,24 @@
|
|
94 |
<block type="campaigner/adminhtml_abandoned_details_tab_diagnostics" name="abandoned_tab_details_campaigner" template="campaigner/diagnostics.phtml">
|
95 |
<block type="campaigner/adminhtml_abandoned_details_tab_diagnostics_status" name="diagnostic_status" template="campaigner/abandoned/details/tab/diagnostics/status.phtml"></block>
|
96 |
</block>
|
97 |
-
|
98 |
<action method="addTab"><name>abandoned_cart</name><block>campaigner/adminhtml_abandoned_details_tab_cart</block></action>
|
99 |
<action method="addTab"><name>abandoned_details</name><block>abandoned_tab_details_campaigner</block></action>
|
|
|
|
|
|
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</block>
|
102 |
</reference>
|
103 |
-
</
|
104 |
</layout>
|
9 |
</reference>
|
10 |
</adminhtml_system_config_edit>
|
11 |
|
12 |
+
<adminhtml_sales_order_view>
|
13 |
+
<reference name="sales_order_tabs">
|
14 |
+
<block type="campaigner/adminhtml_order_view_tab_diagnostics" name="order_view_tab_campaigner" template="campaigner/diagnostics.phtml">
|
15 |
+
<block type="campaigner/adminhtml_order_view_tab_diagnostics_status" name="diagnostic_status" template="campaigner/order/view/tab/diagnostics/status.phtml"></block>
|
16 |
+
</block>
|
17 |
+
<action method="addTab">
|
18 |
+
<name>order_view_tab_campaigner</name>
|
19 |
+
<block>order_view_tab_campaigner</block>
|
20 |
+
</action>
|
21 |
+
</reference>
|
22 |
+
</adminhtml_sales_order_view>
|
23 |
+
|
24 |
+
<adminhtml_campaigner_sync_products>
|
25 |
+
<remove name="root"/>
|
26 |
+
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
27 |
+
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
28 |
+
<action method="addJs"><script>prototype/prototype.js</script></action>
|
29 |
+
<action method="addJs"><script>prototype/validation.js</script></action>
|
30 |
+
<action method="addJs"><script>varien/js.js</script></action>
|
31 |
+
<action method="addJs"><script>mage/translate.js</script></action>
|
32 |
+
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
33 |
+
<action method="setTitle" translate="title"><title>Campaigner - Sync Products</title></action>
|
34 |
+
</block>
|
35 |
+
<block type="campaigner/adminhtml_system_convert_profile_sync_products" name="content" template="campaigner/system/convert/profile/product_sync.phtml"/>
|
36 |
+
</block>
|
37 |
+
</adminhtml_campaigner_sync_products>
|
38 |
+
|
39 |
+
<adminhtml_campaigner_sync_customers>
|
40 |
<remove name="root"/>
|
41 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
42 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
45 |
<action method="addJs"><script>varien/js.js</script></action>
|
46 |
<action method="addJs"><script>mage/translate.js</script></action>
|
47 |
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
48 |
+
<action method="setTitle" translate="title"><title>Campaigner - Sync Customers</title></action>
|
49 |
</block>
|
50 |
+
<block type="campaigner/adminhtml_system_convert_profile_sync_customers" name="content" template="campaigner/system/convert/profile/sync.phtml"/>
|
51 |
</block>
|
52 |
+
</adminhtml_campaigner_sync_customers>
|
53 |
|
54 |
+
<adminhtml_campaigner_sync_orders>
|
55 |
<remove name="root"/>
|
56 |
<block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml">
|
57 |
<block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml">
|
60 |
<action method="addJs"><script>varien/js.js</script></action>
|
61 |
<action method="addJs"><script>mage/translate.js</script></action>
|
62 |
<action method="addJs"><script>mage/adminhtml/tools.js</script></action>
|
63 |
+
<action method="setTitle" translate="title"><title>Campaigner - Sync Orders</title></action>
|
64 |
</block>
|
65 |
+
<block type="campaigner/adminhtml_system_convert_profile_sync_orders" name="content" template="campaigner/system/convert/profile/sync.phtml"/>
|
66 |
</block>
|
67 |
+
</adminhtml_campaigner_sync_orders>
|
68 |
|
69 |
+
<adminhtml_campaigner_troubleshooting_index>
|
70 |
<reference name="head">
|
71 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
72 |
</reference>
|
82 |
<action method="addTab"><name>trouble_settings</name><block>campaigner/adminhtml_troubleshooting_view_tab_settings</block></action>
|
83 |
<action method="addTab"><name>trouble_info</name><block>campaigner/adminhtml_troubleshooting_view_tab_info</block></action>
|
84 |
<action method="addTab"><name>trouble_log</name><block>campaigner/adminhtml_troubleshooting_view_tab_log</block></action>
|
85 |
+
<action method="addTab"><name>trouble_cron</name><block>campaigner/adminhtml_troubleshooting_view_tab_cron</block></action>
|
86 |
<action method="addTab"><name>trouble_submit</name><block>campaigner/adminhtml_troubleshooting_view_tab_submit</block></action>
|
87 |
<action method="addTab"><name>trouble_download</name><block>campaigner/adminhtml_troubleshooting_view_tab_download</block></action>
|
88 |
</block>
|
89 |
</reference>
|
90 |
+
</adminhtml_campaigner_troubleshooting_index>
|
91 |
|
92 |
+
<adminhtml_campaigner_latest_index>
|
93 |
<reference name="head">
|
94 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
95 |
</reference>
|
96 |
<reference name="content">
|
97 |
+
<block type="campaigner/adminhtml_latest" name="latest_orders" />
|
|
|
98 |
</reference>
|
99 |
+
</adminhtml_campaigner_latest_index>
|
100 |
|
101 |
+
<adminhtml_campaigner_product_index>
|
102 |
<reference name="head">
|
103 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
104 |
</reference>
|
105 |
<reference name="content">
|
106 |
+
<block type="campaigner/adminhtml_products" name="products" />
|
107 |
+
</reference>
|
108 |
+
</adminhtml_campaigner_product_index>
|
109 |
+
|
110 |
+
<adminhtml_campaigner_order_index>
|
111 |
+
<reference name="head">
|
112 |
+
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
113 |
+
</reference>
|
114 |
+
<reference name="content">
|
115 |
+
<block type="campaigner/adminhtml_orders" name="orders" />
|
116 |
</reference>
|
117 |
+
</adminhtml_campaigner_order_index>
|
118 |
|
119 |
+
<adminhtml_campaigner_abandoned_index>
|
120 |
+
<reference name="head">
|
121 |
+
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
122 |
+
</reference>
|
123 |
+
<reference name="content">
|
124 |
+
<block type="campaigner/adminhtml_abandoned" name="abandoned_cart" />
|
125 |
+
</reference>
|
126 |
+
</adminhtml_campaigner_abandoned_index>
|
127 |
+
|
128 |
+
<adminhtml_campaigner_background_task_index>
|
129 |
+
<reference name="head">
|
130 |
+
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
131 |
+
</reference>
|
132 |
+
<reference name="content">
|
133 |
+
<block type="campaigner/adminhtml_background_task" name="background_task" />
|
134 |
+
</reference>
|
135 |
+
</adminhtml_campaigner_background_task_index>
|
136 |
+
|
137 |
+
<adminhtml_campaigner_abandoned_details>
|
138 |
<reference name="head">
|
139 |
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
140 |
</reference>
|
147 |
<block type="campaigner/adminhtml_abandoned_details_tab_diagnostics" name="abandoned_tab_details_campaigner" template="campaigner/diagnostics.phtml">
|
148 |
<block type="campaigner/adminhtml_abandoned_details_tab_diagnostics_status" name="diagnostic_status" template="campaigner/abandoned/details/tab/diagnostics/status.phtml"></block>
|
149 |
</block>
|
|
|
150 |
<action method="addTab"><name>abandoned_cart</name><block>campaigner/adminhtml_abandoned_details_tab_cart</block></action>
|
151 |
<action method="addTab"><name>abandoned_details</name><block>abandoned_tab_details_campaigner</block></action>
|
152 |
+
</block>
|
153 |
+
</reference>
|
154 |
+
</adminhtml_campaigner_abandoned_details>
|
155 |
|
156 |
+
<adminhtml_campaigner_background_task_details>
|
157 |
+
<reference name="head">
|
158 |
+
<action method="addCss"><stylesheet>campaigner/campaigner.css</stylesheet></action>
|
159 |
+
</reference>
|
160 |
+
<reference name="content">
|
161 |
+
<block type="campaigner/adminhtml_background_task_details" name="background_details" template="campaigner/background/task/details.phtml">
|
162 |
+
</block>
|
163 |
+
</reference>
|
164 |
+
<reference name="left">
|
165 |
+
<block type="campaigner/adminhtml_background_task_tabs" name="background.tabs" as="background.tabs" template="widget/tabs.phtml" >
|
166 |
+
<action method="addTab"><name>background_task_info</name><block>campaigner/adminhtml_background_task_details_tab_info</block></action>
|
167 |
</block>
|
168 |
</reference>
|
169 |
+
</adminhtml_campaigner_background_task_details>
|
170 |
</layout>
|
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php $status = $this->getAbandonedStatus(); ?>
|
2 |
-
|
3 |
-
<table class='abandoned_status'>
|
4 |
-
<tr>
|
5 |
-
<th><?php echo $this->__('Store'); ?></th>
|
6 |
-
<th><?php echo $this->__('Status'); ?></th>
|
7 |
-
<th><?php echo $this->__('Last Run'); ?></th>
|
8 |
-
</tr>
|
9 |
-
<?php foreach ($status['stores'] as $state): ?>
|
10 |
-
<tr>
|
11 |
-
<td><?php echo $state['name']; ?></td>
|
12 |
-
<td><?php if ($state['enabled']): ?><span class='ab_ok'>Enabled</span><?php else: ?><span class='ab_ng'><?php echo $this->__('Disabled'); ?></span><?php endif; ?></td>
|
13 |
-
<td><?php echo $state['last_run']; ?></td>
|
14 |
-
<td><?php if ($state['enabled']): ?><button onclick="setLocation('<?php echo $this->getUrl('*/*/run', array('store_id' => $state['id'])); ?>');"><span><?php echo $this->__('Run Now'); ?></span></button><?php endif; ?></td>
|
15 |
-
</tr>
|
16 |
-
<?php endforeach; ?>
|
17 |
-
</table>
|
18 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php echo $this->getFormInitScripts() ?>
|
2 |
+
<div class="content-header">
|
3 |
+
<?php echo $this->getHeaderHtml() ?>
|
4 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('header') ?></p>
|
5 |
+
</div>
|
6 |
+
<?php echo $this->getFormHtml() ?>
|
7 |
+
<?php if ($this->hasFooterButtons()): ?>
|
8 |
+
<div class="content-footer">
|
9 |
+
<p class="form-buttons"><?php echo $this->getButtonsHtml('footer') ?></p>
|
10 |
+
</div>
|
11 |
+
<?php endif; ?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
editForm = new varienForm('edit_form', '<?php echo $this->getValidationUrl() ?>');
|
14 |
+
</script>
|
15 |
+
<?php echo $this->getFormScripts() ?>
|
@@ -0,0 +1 @@
|
|
|
1 |
+
<div class="entry-edit" id="background_task_details"></div>
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $task = $this->getTask();
|
2 |
+
|
3 |
+
$details = $this->getDetails();
|
4 |
+
|
5 |
+
?>
|
6 |
+
<div class="entry-edit">
|
7 |
+
<div class="entry-edit-head">
|
8 |
+
<h4 class="icon-head head-products"><?php echo $this->__('Background Task Details'); ?></h4>
|
9 |
+
</div>
|
10 |
+
<div class="fieldset">
|
11 |
+
<table cellspacing="0" class="form-list">
|
12 |
+
<tbody>
|
13 |
+
<tr>
|
14 |
+
<td class="label"><label>Created At</label></td>
|
15 |
+
<td class="value">
|
16 |
+
<strong>
|
17 |
+
<?php echo $task->getCreatedAt(); ?>
|
18 |
+
</strong>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<td class="label"><label>Code</label></td>
|
23 |
+
<td class="value">
|
24 |
+
<strong>
|
25 |
+
<?php echo $task->getCode(); ?>
|
26 |
+
</strong>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
<tr>
|
30 |
+
<td class="label"><label>Data</label></td>
|
31 |
+
<td class="value">
|
32 |
+
<strong>
|
33 |
+
<?php Zend_debug::dump($details); ?>
|
34 |
+
</strong>
|
35 |
+
</td>
|
36 |
+
</tr>
|
37 |
+
</tbody>
|
38 |
+
</table>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
|
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php $status = $this->
|
2 |
|
3 |
<table class='abandoned_status'>
|
4 |
<tr>
|
1 |
+
<?php $status = $this->getStatus(); ?>
|
2 |
|
3 |
<table class='abandoned_status'>
|
4 |
<tr>
|
@@ -77,7 +77,7 @@ table.diagnostic-options { width: 100%; }
|
|
77 |
|
78 |
<tr>
|
79 |
<td>
|
80 |
-
<form id='download_form' method='post' action='<?php echo $this->getUrl("
|
81 |
<input type='hidden' name='form_key' value='<?php echo $this->getFormKey(); ?>'></input>
|
82 |
<input type='hidden' name='output' id='hidden_output' value='' ></input>
|
83 |
<input type='hidden' name='filename' value='diagnostic_output.html' ></input>
|
@@ -204,7 +204,7 @@ function performRequest(method)
|
|
204 |
clear('details');
|
205 |
}
|
206 |
|
207 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
208 |
{
|
209 |
parameters: {isAjax: 'true', form_key: FORM_KEY, method: method, item_id: item_id, store_id: store_id},
|
210 |
onSuccess: function(transport)
|
77 |
|
78 |
<tr>
|
79 |
<td>
|
80 |
+
<form id='download_form' method='post' action='<?php echo $this->getUrl("adminhtml/campaigner_diagnostic/download") ?>'>
|
81 |
<input type='hidden' name='form_key' value='<?php echo $this->getFormKey(); ?>'></input>
|
82 |
<input type='hidden' name='output' id='hidden_output' value='' ></input>
|
83 |
<input type='hidden' name='filename' value='diagnostic_output.html' ></input>
|
204 |
clear('details');
|
205 |
}
|
206 |
|
207 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/campaigner_diagnostic/ajax') ?>',
|
208 |
{
|
209 |
parameters: {isAjax: 'true', form_key: FORM_KEY, method: method, item_id: item_id, store_id: store_id},
|
210 |
onSuccess: function(transport)
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$_order = $this->getOrder();
|
4 |
+
$_send_field = $this->getSendField();
|
5 |
+
$_date_sent = $this->getCampaignerDate();
|
6 |
+
$_can_send_orders = $this->canSendOrders();
|
7 |
+
|
8 |
+
?>
|
9 |
+
|
10 |
+
<div class="box-left">
|
11 |
+
<!--Diagnostic Information-->
|
12 |
+
<div class="entry-edit">
|
13 |
+
<div class="entry-edit-head">
|
14 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Campaigner Diagnostics for <?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></h4>
|
15 |
+
</div>
|
16 |
+
<div class="fieldset">
|
17 |
+
<table cellspacing="0" class="form-list">
|
18 |
+
<tbody>
|
19 |
+
<tr>
|
20 |
+
<td class="label"><label>Sent to Campaigner</label></td>
|
21 |
+
<td class="value"><strong>
|
22 |
+
<?php if ($_date_sent == null): ?>
|
23 |
+
<span style='color: red'>Not Sent</span>
|
24 |
+
<?php else: ?>
|
25 |
+
<span style='color: green'><?php echo $this->formatDate($_date_sent, 'medium', true); ?></span>
|
26 |
+
<?php endif; ?>
|
27 |
+
</strong></td>
|
28 |
+
</tr>
|
29 |
+
<?php if ($_send_field == 'status'): ?>
|
30 |
+
<?php $send_status_list = $this->getStatusList(); ?>
|
31 |
+
<tr>
|
32 |
+
<td class="label"><label>Send on Status</label></td>
|
33 |
+
<td class="value"><strong>
|
34 |
+
<span id="send_on_status">
|
35 |
+
<?php echo implode("<br />",$send_status_list); ?>
|
36 |
+
</span></strong>
|
37 |
+
</td>
|
38 |
+
</tr>
|
39 |
+
<tr>
|
40 |
+
<td class="label"><label>Order Status</label></td>
|
41 |
+
<td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
|
42 |
+
</tr>
|
43 |
+
<?php else: ?>
|
44 |
+
<?php $send_state_list = $this->getStateList(); ?>
|
45 |
+
<tr>
|
46 |
+
<td class="label"><label>Send on State</label></td>
|
47 |
+
<td class="value"><strong>
|
48 |
+
<span id="send_on_state">
|
49 |
+
<?php echo implode("<br />",$send_state_list); ?>
|
50 |
+
</span></strong>
|
51 |
+
</td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td class="label"><label>Order State</label></td>
|
55 |
+
<td class="value"><strong><span id="order_state"><?php echo $this->getOrderState() ?></span></strong></td>
|
56 |
+
</tr>
|
57 |
+
<?php endif; ?>
|
58 |
+
|
59 |
+
<tr>
|
60 |
+
<td class="label"><label>Campaigner Status</label></td>
|
61 |
+
<td class="value"><strong>
|
62 |
+
<?php if (!$this->isCampaignerEnabled()): ?>
|
63 |
+
<div style='color: red'>Disabled for this Store</div>
|
64 |
+
<?php elseif (!$this->isCampaignerSetup()): ?>
|
65 |
+
<div style='color: red'>Api Key Missing/Invalid</div>
|
66 |
+
<?php else: ?>
|
67 |
+
<div style='color: green'>Enabled</div>
|
68 |
+
<?php if (!$this->isSendOrdersEnabled()): ?>
|
69 |
+
<div style='color: red'>Sending orders is disabled</div>
|
70 |
+
<?php endif; ?>
|
71 |
+
<?php endif; ?>
|
72 |
+
</strong></td>
|
73 |
+
</tr>
|
74 |
+
</tbody>
|
75 |
+
</table>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</div>
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$valid = $this->getValidStates();
|
3 |
+
?>
|
4 |
+
|
5 |
+
<div id='orders_filter'>
|
6 |
+
<div class='valid_states'>
|
7 |
+
<strong>Configured <?php echo $valid['display']; ?>: </strong>
|
8 |
+
<span><?php echo implode(', ', $valid['valid']); ?></span>
|
9 |
+
</div>
|
10 |
+
<div class='show_all_states'>
|
11 |
+
<label for='show_all'>Show all orders</label><input type='checkbox' id='show_all' value='yes' <?php if ($this->showAll()) echo "checked='checked'"; ?> />
|
12 |
+
</div>
|
13 |
+
</div>
|
14 |
+
<script type='text/javascript'>
|
15 |
+
$('show_all').observe('change', function(event)
|
16 |
+
{
|
17 |
+
var url = "";
|
18 |
+
|
19 |
+
if (this.checked) {
|
20 |
+
url = '<?php echo $this->getUrl('adminhtml/campaigner_order', array('show_all' => 1)); ?>';
|
21 |
+
} else {
|
22 |
+
url = '<?php echo $this->getUrl('adminhtml/campaigner_order'); ?>';
|
23 |
+
}
|
24 |
+
console.log(url);
|
25 |
+
window.location = url;
|
26 |
+
|
27 |
+
});
|
28 |
+
</script>
|
@@ -1,10 +1,16 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$
|
4 |
-
|
5 |
-
$
|
6 |
-
$
|
7 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
$ab_enabled = $this->getAbandonedEnabled();
|
9 |
$last_run = $abandoned_status['cron_last_run'];
|
10 |
$last_run_label = $this->__("Cron Last Run");
|
@@ -27,7 +33,7 @@ if ($locked) {
|
|
27 |
<span class='ab_ng'><?php echo $this->__('Disabled') ?></span>
|
28 |
<?php endif; ?>
|
29 |
- <?php echo $last_run_label ?>: <?php echo $abandoned_status['cron_last_run'] ?> -
|
30 |
-
<button onclick="window.location='<?php echo $this->getUrl('
|
31 |
<?php echo $this->__('Details') ?>
|
32 |
</button>
|
33 |
</div>
|
@@ -37,29 +43,143 @@ if ($locked) {
|
|
37 |
</div>
|
38 |
<script type='text/javascript'>
|
39 |
var setup = <?php echo $setup == true ? 'true' : 'false'; ?>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
document.observe('dom:loaded', function()
|
42 |
{
|
43 |
if (setup) {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
});
|
63 |
}
|
64 |
});
|
65 |
-
</script>
|
1 |
<?php
|
2 |
|
3 |
+
$helper = Mage::helper('campaigner');
|
4 |
+
|
5 |
+
$setup = $helper->config('setup') == 1;
|
6 |
+
$active = $helper->config('active') == 1;
|
7 |
+
$commerce_setup = $helper->commerceConfig('setup') == 1;
|
8 |
+
$commerce_enabled = $helper->commerceConfig('enabled') == 1;
|
9 |
+
$locked = $helper->config('locked') == 1;
|
10 |
+
$api_username = $helper->config('api_username');
|
11 |
+
$api_password = $helper->config('api_password');
|
12 |
+
$apikey = $helper->commerceConfig('apikey');
|
13 |
+
$abandoned_status = Mage::helper('campaigner/cron')->getStatus(Campaigner_Integration_Helper_Cron::ABANDONED);
|
14 |
$ab_enabled = $this->getAbandonedEnabled();
|
15 |
$last_run = $abandoned_status['cron_last_run'];
|
16 |
$last_run_label = $this->__("Cron Last Run");
|
33 |
<span class='ab_ng'><?php echo $this->__('Disabled') ?></span>
|
34 |
<?php endif; ?>
|
35 |
- <?php echo $last_run_label ?>: <?php echo $abandoned_status['cron_last_run'] ?> -
|
36 |
+
<button onclick="window.location='<?php echo $this->getUrl('adminhtml/campaigner_abandoned/index'); ?>'; return false;" id="campaigner_details">
|
37 |
<?php echo $this->__('Details') ?>
|
38 |
</button>
|
39 |
</div>
|
43 |
</div>
|
44 |
<script type='text/javascript'>
|
45 |
var setup = <?php echo $setup == true ? 'true' : 'false'; ?>;
|
46 |
+
var active = <?php echo $active == true ? 'true' : 'false'; ?>;
|
47 |
+
var commerce_setup = <?php echo $commerce_setup == true ? 'true' : 'false'; ?>;
|
48 |
+
var commerce_enabled = <?php echo $commerce_enabled == true ? 'true' : 'false'; ?>;
|
49 |
+
var current_apikey = '<?php echo $apikey; ?>';
|
50 |
+
|
51 |
+
function processElements(item)
|
52 |
+
{
|
53 |
+
var id = item.readAttribute('id');
|
54 |
+
|
55 |
+
if (id) {
|
56 |
+
var id_parts = id.split('_');
|
57 |
+
|
58 |
+
if (id_parts[0] == 'row') {
|
59 |
+
var name = id_parts.slice(3).join('_');
|
60 |
+
switch (name)
|
61 |
+
{
|
62 |
+
case 'api_instructions':
|
63 |
+
case 'emaildirect_transfer':
|
64 |
+
case 'api_validation':
|
65 |
+
case 'heading_general':
|
66 |
+
case 'info':
|
67 |
+
case 'api_username':
|
68 |
+
case 'not_available':
|
69 |
+
case 'not_enabled':
|
70 |
+
case 'api_password': break;
|
71 |
+
default: $(id).remove(); break;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
function processCommerceElements(item)
|
78 |
+
{
|
79 |
+
var id = item.readAttribute('id');
|
80 |
+
|
81 |
+
if (id) {
|
82 |
+
var id_parts = id.split('_');
|
83 |
+
console.log(id_parts);
|
84 |
+
|
85 |
+
if (id_parts[0] == 'row' && id_parts[3] != 'customers') {
|
86 |
+
var name = id_parts.slice(4).join('_');
|
87 |
+
switch (name)
|
88 |
+
{
|
89 |
+
case 'heading':
|
90 |
+
case 'not_enabled':
|
91 |
+
case 'not_available': break;
|
92 |
+
default: $(id).remove(); break;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
function show(field)
|
99 |
+
{
|
100 |
+
if ($(field)) {
|
101 |
+
$(field).show();
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
function hide(field)
|
106 |
+
{
|
107 |
+
if ($(field)) {
|
108 |
+
$(field).hide();
|
109 |
+
}
|
110 |
+
}
|
111 |
|
112 |
document.observe('dom:loaded', function()
|
113 |
{
|
114 |
if (setup) {
|
115 |
+
console.log('setup');
|
116 |
+
hide('row_campaigner_general_api_instructions');
|
117 |
+
hide('row_campaigner_general_emaildirect_transfer');
|
118 |
+
|
119 |
+
hide('row_campaigner_commerce_not_available');
|
120 |
+
hide('row_campaigner_commerce_not_enabled');
|
121 |
+
hide('row_campaigner_sync_not_available');
|
122 |
+
hide('row_campaigner_sync_orders_not_enabled');
|
123 |
+
hide('row_campaigner_sync_orders_not_available');
|
124 |
+
hide('row_campaigner_sync_products_not_enabled');
|
125 |
+
hide('row_campaigner_sync_products_not_available');
|
126 |
+
|
127 |
+
if (!active) {
|
128 |
+
console.log('!active');
|
129 |
+
$$('#campaigner_commerce table.form-list tbody tr').each(function(item) {
|
130 |
+
processElements(item);
|
131 |
+
});
|
132 |
+
|
133 |
+
$$('#campaigner_sync table.form-list tbody tr').each(function(item) {
|
134 |
+
processCommerceElements(item);
|
135 |
+
});
|
136 |
+
|
137 |
+
show('row_campaigner_commerce_not_enabled');
|
138 |
+
hide('row_campaigner_sync_orders_not_available');
|
139 |
+
show('row_campaigner_sync_orders_not_enabled');
|
140 |
+
hide('row_campaigner_sync_products_not_available');
|
141 |
+
show('row_campaigner_sync_products_not_enabled');
|
142 |
+
} else {
|
143 |
+
console.log('active');
|
144 |
+
if (commerce_setup) {
|
145 |
+
console.log('commerce setup');
|
146 |
+
hide('row_campaigner_commerce_apikey_instructions');
|
147 |
+
if (!commerce_enabled) {
|
148 |
+
console.log('commerce not enabled');
|
149 |
+
/*$('row_campaigner_sync_orders_not_enabled').show();
|
150 |
+
|
151 |
+
$('row_campaigner_sync_products_not_enabled').show();
|
152 |
+
$$('#campaigner_sync table.form-list tbody tr').each(function(item) {
|
153 |
+
processCommerceElements(item);
|
154 |
+
});*/
|
155 |
}
|
156 |
+
} else {
|
157 |
+
console.log('commerce not setup');
|
158 |
+
hide('row_campaigner_commerce_enabled');
|
159 |
+
|
160 |
+
$$('#campaigner_sync table.form-list tbody tr').each(function(item) {
|
161 |
+
processCommerceElements(item);
|
162 |
+
});
|
163 |
+
|
164 |
+
show('row_campaigner_sync_orders_not_available');
|
165 |
+
|
166 |
+
show('row_campaigner_sync_products_not_available');
|
167 |
}
|
168 |
+
}
|
169 |
+
} else {
|
170 |
+
console.log('not setup');
|
171 |
+
|
172 |
+
hide('row_campaigner_commerce_not_enabled');
|
173 |
+
|
174 |
+
$$('#campaigner_general table.form-list tbody tr').each(function(item) {
|
175 |
+
processElements(item);
|
176 |
+
});
|
177 |
+
$$('#campaigner_commerce table.form-list tbody tr').each(function(item) {
|
178 |
+
processElements(item);
|
179 |
+
});
|
180 |
+
$$('#campaigner_sync table.form-list tbody tr').each(function(item) {
|
181 |
+
processElements(item);
|
182 |
});
|
183 |
}
|
184 |
});
|
185 |
+
</script>
|
@@ -11,15 +11,14 @@
|
|
11 |
|
12 |
<input type='hidden' name='groups[general][fields][old_api_username][value]' value='<?php echo $this->getCurrentApiUsername(); ?>' />
|
13 |
<input type='hidden' name='groups[general][fields][old_api_password][value]' value='<?php echo $this->getCurrentApiPassword(); ?>' />
|
14 |
-
<button id='
|
15 |
</div>
|
16 |
|
17 |
<script type='text/javascript'>
|
18 |
|
19 |
-
validate_url = '<?php echo $this->getUrl('campaigner_dashboard/admin_troubleshooting/validate'); ?>';
|
20 |
-
|
21 |
function performValidation()
|
22 |
{
|
|
|
23 |
var api_username = $("campaigner_general_api_username").value;
|
24 |
var api_password = $("campaigner_general_api_password").value;
|
25 |
|
@@ -44,13 +43,13 @@ function performValidation()
|
|
44 |
{
|
45 |
indicator.removeClassName("api_validating");
|
46 |
indicator.addClassName("api_valid");
|
47 |
-
|
48 |
}
|
49 |
else
|
50 |
{
|
51 |
indicator.removeClassName("api_validating");
|
52 |
indicator.addClassName("api_invalid");
|
53 |
-
|
54 |
}
|
55 |
|
56 |
//console.log(response);
|
11 |
|
12 |
<input type='hidden' name='groups[general][fields][old_api_username][value]' value='<?php echo $this->getCurrentApiUsername(); ?>' />
|
13 |
<input type='hidden' name='groups[general][fields][old_api_password][value]' value='<?php echo $this->getCurrentApiPassword(); ?>' />
|
14 |
+
<button id='api_validator' class='api_validator_button' onclick='return performValidation();'>Validate</button>
|
15 |
</div>
|
16 |
|
17 |
<script type='text/javascript'>
|
18 |
|
|
|
|
|
19 |
function performValidation()
|
20 |
{
|
21 |
+
var validate_url = '<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/validate'); ?>';
|
22 |
var api_username = $("campaigner_general_api_username").value;
|
23 |
var api_password = $("campaigner_general_api_password").value;
|
24 |
|
43 |
{
|
44 |
indicator.removeClassName("api_validating");
|
45 |
indicator.addClassName("api_valid");
|
46 |
+
indicator.update("Valid");
|
47 |
}
|
48 |
else
|
49 |
{
|
50 |
indicator.removeClassName("api_validating");
|
51 |
indicator.addClassName("api_invalid");
|
52 |
+
indicator.update(response.message);
|
53 |
}
|
54 |
|
55 |
//console.log(response);
|
@@ -1,30 +1,3 @@
|
|
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 default_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 |
$_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
|
30 |
|
@@ -138,11 +111,10 @@ Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $
|
|
138 |
<?php
|
139 |
$_addAfterId = "headings{$_htmlId}";
|
140 |
|
141 |
-
//Zend_debug::dump($this->getArrayRows());
|
142 |
foreach ($this->getArrayRows() as $_rowId => $_row) {
|
143 |
|
144 |
-
|
145 |
-
|
146 |
|
147 |
echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
|
148 |
$_addAfterId = $_rowId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
$_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
|
3 |
|
111 |
<?php
|
112 |
$_addAfterId = "headings{$_htmlId}";
|
113 |
|
|
|
114 |
foreach ($this->getArrayRows() as $_rowId => $_row) {
|
115 |
|
116 |
+
$_row['_selected_' . $_row['campaigner']] = "selected=\"selected\"";
|
117 |
+
$_row['_selected_' . $_row['magento']] = "selected=\"selected\"";
|
118 |
|
119 |
echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
|
120 |
$_addAfterId = $_rowId;
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$valid = $this->isValid();
|
3 |
+
|
4 |
+
$element = $this->getElement();
|
5 |
+
|
6 |
+
//$enabled = $this->isLoggingEnabled();
|
7 |
+
?>
|
8 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
9 |
+
<div class='campaigner_api_status'>
|
10 |
+
<div id='campaigner_commerce_status_indicator' class='<?php if ($valid) echo "api_valid"; else echo "api_invalid" ?>'><?php if ($valid) echo "Valid"; else echo "Invalid" ?></div>
|
11 |
+
|
12 |
+
<input type='hidden' name='groups[general][fields][old_apikey][value]' value='<?php echo $this->getCurrentApikey(); ?>' />
|
13 |
+
<button id='apikey_validator' class='api_validator_button' onclick='return performKeyValidation();'>Validate</button>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<script type='text/javascript'>
|
17 |
+
|
18 |
+
function performKeyValidation()
|
19 |
+
{
|
20 |
+
var validate_url = '<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/validateKey'); ?>';
|
21 |
+
var apikey = $("campaigner_commerce_apikey").value;
|
22 |
+
|
23 |
+
var indicator = $("campaigner_commerce_status_indicator");
|
24 |
+
|
25 |
+
indicator.update("Validating...");
|
26 |
+
indicator.removeClassName("api_valid");
|
27 |
+
indicator.removeClassName("api_invalid");
|
28 |
+
indicator.addClassName("api_validating");
|
29 |
+
|
30 |
+
new Ajax.Request(validate_url + (validate_url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ),
|
31 |
+
{
|
32 |
+
parameters : {apikey: apikey},
|
33 |
+
method : 'post',
|
34 |
+
onSuccess : function(transport)
|
35 |
+
{
|
36 |
+
if (transport.responseText.isJSON()) {
|
37 |
+
var response = transport.responseText.evalJSON()
|
38 |
+
|
39 |
+
if (response.valid) {
|
40 |
+
indicator.removeClassName("api_validating");
|
41 |
+
indicator.addClassName("api_valid");
|
42 |
+
indicator.update("Valid");
|
43 |
+
} else {
|
44 |
+
indicator.removeClassName("api_validating");
|
45 |
+
indicator.addClassName("api_invalid");
|
46 |
+
indicator.update(response.message);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
});
|
51 |
+
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
</script>
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<p>You can retrieve an API Key by going to your Campaigner account and clicking on Account Setup, then navigating to the API Keys tab.</p>
|
3 |
+
<br />
|
4 |
+
<p>If you do not have an Campaigner account, please email us at <a href="mailto:Sales@Campaigner.com">Sales@Campaigner.com</a> or call 916-439-6948. You can also visit our website at <a href="http://www.Campaigner.com">http://www.Campaigner.com</a> to learn more about this integration and other features that we offer.</p>
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$options = $this->getProcessOptions();
|
3 |
+
?>
|
4 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
5 |
+
<div>
|
6 |
+
<h4 id="campaigner_general_heading_cron_url_info">URL Info</h4>
|
7 |
+
<div class='cron_url_note'>Save configuration to see changes to URLs.</div>
|
8 |
+
<table>
|
9 |
+
<?php foreach($options as $option): ?>
|
10 |
+
<tr>
|
11 |
+
<td><?php echo $option['label']; ?></td>
|
12 |
+
<td><a href='<?php echo $option['url']; ?>' target='_blank'><?php echo $option['url']; ?></a></td>
|
13 |
+
</tr>
|
14 |
+
<?php endforeach; ?>
|
15 |
+
</table>
|
16 |
+
</div>
|
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
$element = $this->getElement();
|
3 |
-
|
4 |
$enabled = $this->getDiagnosticStatus();
|
5 |
?>
|
6 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
@@ -13,7 +13,7 @@
|
|
13 |
function view_details()
|
14 |
{
|
15 |
var form = $('config_edit_form');
|
16 |
-
var logging_url = '<?php echo Mage::helper('campaigner')->getAdminUrl("
|
17 |
|
18 |
window.location = logging_url;
|
19 |
}
|
1 |
+
<?php
|
2 |
$element = $this->getElement();
|
3 |
+
|
4 |
$enabled = $this->getDiagnosticStatus();
|
5 |
?>
|
6 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
13 |
function view_details()
|
14 |
{
|
15 |
var form = $('config_edit_form');
|
16 |
+
var logging_url = '<?php echo Mage::helper('campaigner')->getAdminUrl("adminhtml/campaigner_troubleshooting/", array('tab' => 'troubleshooting_view_tabs_trouble_settings')); ?>';
|
17 |
|
18 |
window.location = logging_url;
|
19 |
}
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<select id="campaigner_general_emaildirect_transfer" name="groups[general][fields][emaildirect_transfer][value]" class=" select">
|
2 |
+
<option value="1">Yes</option>
|
3 |
+
<option selected="selected" value="0">No</option>
|
4 |
+
</select>
|
5 |
+
<p class="note"><span>Transfer applicable settings from EmailDirect.</span></p>
|
@@ -1,144 +0,0 @@
|
|
1 |
-
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
-
<span>From: </span><input style="width: 75px;" type="text" name="order_export_from" id="order_export_from" value="<?php echo $this->getFromDate() ?>" class="input-text">
|
3 |
-
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select From Date" class="v-middle" title="Select From Date" id="from_trig">
|
4 |
-
<span> to: </span>
|
5 |
-
<input style="width: 75px;" type="text" name="order_export_to" id="order_export_to" value="<?php echo $this->getToDate() ?>" class="input-text">
|
6 |
-
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select To Date" class="v-middle" title="Select To Date" id="to_trig">
|
7 |
-
<div class='camp_orders_found'>
|
8 |
-
<strong>Orders Found: </strong><span id='orders_found'><?php echo $this->getOrdersCount() ?></span>
|
9 |
-
</div>
|
10 |
-
<script type='text/javascript'>
|
11 |
-
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
12 |
-
var start_from = '<?php echo $this->getFromDate() ?>';
|
13 |
-
var start_to = '<?php echo $this->getToDate() ?>';
|
14 |
-
var orders_count = '<?php echo $this->getOrdersCount(); ?>';
|
15 |
-
|
16 |
-
var check_from = parseDate(start_from);
|
17 |
-
|
18 |
-
function setButtonState()
|
19 |
-
{
|
20 |
-
if (orders_count == 0 || orders_count == 'Unknown')
|
21 |
-
toggleValueElements({checked:true}, $('campaigner_export_orders').parentNode);
|
22 |
-
else
|
23 |
-
toggleValueElements({checked:false}, $('campaigner_export_orders').parentNode);
|
24 |
-
}
|
25 |
-
|
26 |
-
function parseDate(date_string)
|
27 |
-
{
|
28 |
-
var date_parts = date_string.split('-');
|
29 |
-
return new Date(date_parts[0],date_parts[1] - 1,date_parts[2]);
|
30 |
-
}
|
31 |
-
|
32 |
-
var calendarSetupObject = {
|
33 |
-
inputField : "order_export_from",
|
34 |
-
ifFormat : "%Y-%m-%d",
|
35 |
-
showTime : "false",
|
36 |
-
button : "from_trig",
|
37 |
-
align : "Bl",
|
38 |
-
singleClick : true,
|
39 |
-
disableFunc : function(date)
|
40 |
-
{
|
41 |
-
if (date < check_from)
|
42 |
-
return true;
|
43 |
-
}
|
44 |
-
}
|
45 |
-
Calendar.setup(calendarSetupObject);
|
46 |
-
|
47 |
-
var calendarSetupObject2 = {
|
48 |
-
inputField : "order_export_to",
|
49 |
-
ifFormat : "%Y-%m-%d",
|
50 |
-
showTime : "false",
|
51 |
-
button : "to_trig",
|
52 |
-
align : "Bl",
|
53 |
-
singleClick : true,
|
54 |
-
disableFunc : function(date)
|
55 |
-
{
|
56 |
-
if (date < check_from)
|
57 |
-
return true;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
Calendar.setup(calendarSetupObject2);
|
61 |
-
|
62 |
-
var url = '<?php echo $this->getUrl("campaigner_dashboard/admin_export/count/"); ?>';
|
63 |
-
|
64 |
-
$('campaigner_export_include_already_sent').observe('change', function(event)
|
65 |
-
{
|
66 |
-
if (!validateDates())
|
67 |
-
return;
|
68 |
-
|
69 |
-
dateRangeChange();
|
70 |
-
});
|
71 |
-
|
72 |
-
$('order_export_from').observe('change', function(event)
|
73 |
-
{
|
74 |
-
if (!validateDates())
|
75 |
-
return;
|
76 |
-
|
77 |
-
dateRangeChange();
|
78 |
-
});
|
79 |
-
|
80 |
-
$('order_export_to').observe('change', function(event)
|
81 |
-
{
|
82 |
-
if (!validateDates())
|
83 |
-
return;
|
84 |
-
|
85 |
-
// Check if the date is < to date
|
86 |
-
dateRangeChange();
|
87 |
-
});
|
88 |
-
|
89 |
-
function validateDates()
|
90 |
-
{
|
91 |
-
// Check if the date is < starting date or > to date
|
92 |
-
var from = parseDate($('order_export_from').value);
|
93 |
-
var to = parseDate($('order_export_to').value);
|
94 |
-
|
95 |
-
if (from < check_from)
|
96 |
-
{
|
97 |
-
$('order_export_from').value = start_from;
|
98 |
-
return false;
|
99 |
-
}
|
100 |
-
|
101 |
-
if (to < check_from)
|
102 |
-
{
|
103 |
-
$('order_export_to').value = start_to;
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
|
107 |
-
if (from > to)
|
108 |
-
{
|
109 |
-
var temp = $('order_export_from').value;
|
110 |
-
|
111 |
-
$('order_export_from').value = $('order_export_to').value;
|
112 |
-
$('order_export_to').value = temp;
|
113 |
-
}
|
114 |
-
|
115 |
-
return true;
|
116 |
-
}
|
117 |
-
|
118 |
-
function dateRangeChange()
|
119 |
-
{
|
120 |
-
var from = $('order_export_from').value;
|
121 |
-
var to = $('order_export_to').value;
|
122 |
-
var include = $('campaigner_export_include_already_sent').value;
|
123 |
-
|
124 |
-
$('orders_found').update("???");
|
125 |
-
|
126 |
-
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
127 |
-
parameters : {from: from, to: to, include: include, store: store},
|
128 |
-
method : 'post',
|
129 |
-
loaderArea : false,
|
130 |
-
onSuccess : function(transport)
|
131 |
-
{
|
132 |
-
//console.log(transport.responseText);
|
133 |
-
var response = transport.responseText;
|
134 |
-
orders_count = response;
|
135 |
-
$('orders_found').update(response);
|
136 |
-
setButtonState();
|
137 |
-
}
|
138 |
-
});
|
139 |
-
}
|
140 |
-
|
141 |
-
document.observe("dom:loaded", function() {
|
142 |
-
setButtonState();
|
143 |
-
});
|
144 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,20 +0,0 @@
|
|
1 |
-
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
-
<button id='campaigner_export_orders' onClick="perform_order_export(); return false;">Export Orders</button>
|
3 |
-
<script type='text/javascript'>
|
4 |
-
function perform_order_export()
|
5 |
-
{
|
6 |
-
var form = $('config_edit_form');
|
7 |
-
var from = form['order_export_from'];
|
8 |
-
var to = form['order_export_to'];
|
9 |
-
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
10 |
-
var include = form['groups[export][fields][include_already_sent][value]'];
|
11 |
-
var url = '<?php echo $this->getUrl("campaigner_dashboard/admin_export/orders/"); ?>';
|
12 |
-
|
13 |
-
url += 'export_from/' + $(from).getValue() + '/export_to/' + $(to).getValue() + '/include_already_sent/' + $(include).getValue() + '/store/' + store + '/';
|
14 |
-
|
15 |
-
window.open(url);
|
16 |
-
}
|
17 |
-
<?php if ($this->getElement()->getDisabled()):?>
|
18 |
-
toggleValueElements({checked:true}, $('campaigner_export_orders').parentNode);
|
19 |
-
<?php endif;?>
|
20 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1,21 +0,0 @@
|
|
1 |
-
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
-
<button id='campaigner_export_products' onClick="perform_product_export(); return false;">Export Products</button>
|
3 |
-
<script type='text/javascript'>
|
4 |
-
function perform_product_export()
|
5 |
-
{
|
6 |
-
var form = $('config_edit_form');
|
7 |
-
var include_disabled = form['groups[export][fields][include_disabled][value]'];
|
8 |
-
var url = '<?php echo $this->getUrl("campaigner_dashboard/admin_export/products/"); ?>';
|
9 |
-
var store = <?php echo Mage::helper('campaigner')->getAdminStore() ?>;
|
10 |
-
|
11 |
-
url += 'include_disabled/' + $(include_disabled).getValue() + '/';
|
12 |
-
if (store != 0)
|
13 |
-
url += 'store/' + store;
|
14 |
-
|
15 |
-
window.open(url);
|
16 |
-
}
|
17 |
-
|
18 |
-
<?php if ($this->getElement()->getDisabled()):?>
|
19 |
-
toggleValueElements({checked:true}, $('campaigner_export_products').parentNode);
|
20 |
-
<?php endif;?>
|
21 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@
|
|
2 |
<p>Customer Data and Purchase Behavior Sync by <a href='http://www.campaigner.com' target='_blank'>www.campaigner.com</a></p>
|
3 |
<p>Copyright ©<?php echo date("Y") ?></p>
|
4 |
<br />
|
5 |
-
<p>Download our <a href='http://campaigner.com/downloads/papers/magentoSetupGuide.pdf'>Magento Setup Guide</a> for detailed information on each feature or view the <a href="<?php echo $this->getUrl('
|
6 |
<p>Please contact support (<a href='mailto:support@campaigner.com'>support@campaigner.com</a>) with any questions that you have.</p>
|
7 |
<br />
|
8 |
<?php if ($this->isWebsiteConfig()): ?>
|
2 |
<p>Customer Data and Purchase Behavior Sync by <a href='http://www.campaigner.com' target='_blank'>www.campaigner.com</a></p>
|
3 |
<p>Copyright ©<?php echo date("Y") ?></p>
|
4 |
<br />
|
5 |
+
<p>Download our <a href='http://campaigner.com/downloads/papers/magentoSetupGuide.pdf'>Magento Setup Guide</a> for detailed information on each feature or view the <a href="<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/index') ?>">Help</a> page.</p>
|
6 |
<p>Please contact support (<a href='mailto:support@campaigner.com'>support@campaigner.com</a>) with any questions that you have.</p>
|
7 |
<br />
|
8 |
<?php if ($this->isWebsiteConfig()): ?>
|
@@ -1,30 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
//$store = Mage::getSingleton('adminhtml/config_data')->getStore();
|
10 |
-
|
11 |
-
|
12 |
-
$enabled = $status['enabled'];
|
13 |
?>
|
14 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
15 |
<span class='<?php echo $enabled ? "ab_ok" : "ab_ng" ?>'><?php echo $enabled ? "Enabled" : "Disabled" ?></span>
|
16 |
<?php if ($enabled): ?>
|
17 |
-
|
18 |
<div id='campaigner_trouble_details'>
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
</div>
|
30 |
-
<?php endif; ?>
|
1 |
+
<?php
|
2 |
+
$element = $this->getElement();
|
3 |
+
|
4 |
+
$status = $this->getLoggingStatus();
|
5 |
+
|
6 |
+
$enabled_for_store = $this->isEnabledForStore();
|
7 |
+
|
8 |
+
$enabled = $status['enabled'];
|
|
|
|
|
|
|
|
|
9 |
?>
|
10 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
11 |
<span class='<?php echo $enabled ? "ab_ok" : "ab_ng" ?>'><?php echo $enabled ? "Enabled" : "Disabled" ?></span>
|
12 |
<?php if ($enabled): ?>
|
13 |
+
<?php if (!$enabled_for_store): ?><span class='ab_ng'>(Not for this store!)</span><?php endif; ?>
|
14 |
<div id='campaigner_trouble_details'>
|
15 |
+
<table>
|
16 |
+
<tr>
|
17 |
+
<td>Start Date:</td>
|
18 |
+
<td><?php echo $this->getStartDate() ?></td>
|
19 |
+
</tr>
|
20 |
+
<tr>
|
21 |
+
<td>Log File:</td>
|
22 |
+
<td><?php echo $this->getLogInfo() ?></td>
|
23 |
+
</tr>
|
24 |
+
</table>
|
25 |
+
</div>
|
26 |
+
<?php endif; ?>
|
@@ -1,4 +1,8 @@
|
|
1 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
-
|
3 |
-
<
|
4 |
-
|
|
|
|
|
|
|
|
1 |
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<?php if ($this->getMode() == 'key'): ?>
|
3 |
+
<p>You can create or retrieve an existing API key by going to your Campaigner account and clicking on the ‘Manage Users’ options under the My Account menu. Edit any API user and click on the ‘API Keys’ tab to view & manage its associated API keys.</p>
|
4 |
+
<?php else: ?>
|
5 |
+
<p>You can set up or retrieve an existing API user by going to your Campaigner account and clicking on the ‘Manage Users’ options under the My Account menu.</p>
|
6 |
+
<?php endif; ?>
|
7 |
+
<br />
|
8 |
+
<p>If you do not have a Campaigner account, please email us at <a href='mailto:salesteam@campaigner.com'>salesteam@campaigner.com</a> or call toll free 1-866-358-6355 / international 1-613-216-7423. You can also visit our website at <a href='http://www.campaigner.com' target='_blank'>http://www.campaigner.com</a> to learn more about this integration and other features that we offer.</p>
|
@@ -12,7 +12,7 @@
|
|
12 |
|
13 |
<script type='text/javascript'>
|
14 |
|
15 |
-
validate_smtp_url = '<?php echo $this->getUrl('
|
16 |
var indicator = $("campaigner_smtp_status");
|
17 |
var store_id = <?php echo Mage::helper('campaigner')->getCurrentStore() ?>;
|
18 |
|
12 |
|
13 |
<script type='text/javascript'>
|
14 |
|
15 |
+
validate_smtp_url = '<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/testSmtp'); ?>';
|
16 |
var indicator = $("campaigner_smtp_status");
|
17 |
var store_id = <?php echo Mage::helper('campaigner')->getCurrentStore() ?>;
|
18 |
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<button id='campaigner_export_customers' onClick="syncCustomers(); return false;">Sync Customers</button>
|
3 |
+
<script type='text/javascript'>
|
4 |
+
|
5 |
+
function syncCustomers()
|
6 |
+
{
|
7 |
+
<?php
|
8 |
+
$prefix = "customers_";
|
9 |
+
$fields = array(
|
10 |
+
'include_already_sent',
|
11 |
+
'include_latest_orders',
|
12 |
+
'include_abandoned_carts',
|
13 |
+
'sequence_enabled',
|
14 |
+
'sequence_field',
|
15 |
+
'sequence_options',
|
16 |
+
'lists'
|
17 |
+
);
|
18 |
+
?>
|
19 |
+
var form = $('config_edit_form');
|
20 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_export/config/"); ?>';
|
21 |
+
|
22 |
+
var params = {
|
23 |
+
<?php
|
24 |
+
foreach ($fields as $field) {
|
25 |
+
echo "{$field}: $(form['groups[sync][fields][{$prefix}{$field}][value]']).getValue(),\n";
|
26 |
+
}
|
27 |
+
?>
|
28 |
+
store: store
|
29 |
+
};
|
30 |
+
|
31 |
+
console.log(params);
|
32 |
+
return;
|
33 |
+
|
34 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
35 |
+
parameters : params,
|
36 |
+
method : 'post',
|
37 |
+
loaderArea : false,
|
38 |
+
onSuccess : function(transport)
|
39 |
+
{
|
40 |
+
performExport();
|
41 |
+
}
|
42 |
+
});
|
43 |
+
}
|
44 |
+
<?php if ($this->getElement()->getDisabled()):?>
|
45 |
+
toggleValueElements({checked:true}, $('campaigner_export_customers').parentNode);
|
46 |
+
<?php endif;?>
|
47 |
+
</script>
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<div class='camp_sync_items_found'>
|
3 |
+
<strong>Customers Found: </strong><span id='customers_found'><?php echo $this->getCustomersCount() ?></span>
|
4 |
+
</div>
|
5 |
+
<br />
|
6 |
+
<button id='campaigner_sync_customers' onClick="syncCustomers(); return false;">Send Customers to Campaigner</button>
|
7 |
+
<script type='text/javascript'>
|
8 |
+
|
9 |
+
var customers_count = '<?php echo $this->getCustomersCount(); ?>';
|
10 |
+
|
11 |
+
function performCustomerSync()
|
12 |
+
{
|
13 |
+
console.log('performCustomerSync');
|
14 |
+
var form = $('config_edit_form');
|
15 |
+
//var apikey = $(form['groups[commerce][fields][apikey][value]']).getValue();
|
16 |
+
var from = form['customers_sync_from'];
|
17 |
+
var to = form['customers_sync_to'];
|
18 |
+
var include = form['groups[sync][fields][customers_include_already_sent][value]'];
|
19 |
+
|
20 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
21 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/customers/"); ?>';
|
22 |
+
|
23 |
+
|
24 |
+
console.log(url);
|
25 |
+
|
26 |
+
console.log($(from).getValue());
|
27 |
+
console.log($(to).getValue());
|
28 |
+
//console.log($(include).getValue());
|
29 |
+
|
30 |
+
url += 'sync_from/' + $(from).getValue()
|
31 |
+
+ '/sync_to/' + $(to).getValue()
|
32 |
+
+ '/include/' + $(include).getValue()
|
33 |
+
+ '/store/' + store + '/';
|
34 |
+
|
35 |
+
console.log(url);
|
36 |
+
|
37 |
+
window.open(url);
|
38 |
+
}
|
39 |
+
|
40 |
+
function setCustomersButtonState()
|
41 |
+
{
|
42 |
+
console.log('setCustomerButtonState');
|
43 |
+
if ($('campaigner_sync_customers')) {
|
44 |
+
console.log('check');
|
45 |
+
if (customers_count == 0 || customers_count == 'Unknown') {
|
46 |
+
console.log('Unknown');
|
47 |
+
toggleValueElements({checked:true}, $('campaigner_sync_customers').parentNode);
|
48 |
+
} else {
|
49 |
+
console.log('Cool');
|
50 |
+
toggleValueElements({checked:false}, $('campaigner_sync_customers').parentNode);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
$('campaigner_sync_customers_include_already_sent').observe('change', function(event)
|
56 |
+
{
|
57 |
+
console.log('change');
|
58 |
+
customersRefresh();
|
59 |
+
});
|
60 |
+
|
61 |
+
function customersRefresh()
|
62 |
+
{
|
63 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/customersCount/"); ?>';
|
64 |
+
var from = $('customers_sync_from').value;
|
65 |
+
var to = $('customers_sync_to').value;
|
66 |
+
var include = $('campaigner_sync_customers_include_already_sent').value;
|
67 |
+
//var latest = $('campaigner_export_include_customers_latest_orders').value;
|
68 |
+
//var abandoned = $('campaigner_export_include_customers_abandoned_carts').value;
|
69 |
+
|
70 |
+
$('customers_found').update("???");
|
71 |
+
|
72 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
73 |
+
parameters : {from: from, to: to, include: include, store: customers_store},
|
74 |
+
method : 'post',
|
75 |
+
loaderArea : false,
|
76 |
+
onSuccess : function(transport)
|
77 |
+
{
|
78 |
+
console.log('refresh success');
|
79 |
+
console.log(transport.responseText);
|
80 |
+
var response = transport.responseText;
|
81 |
+
|
82 |
+
customers_count = response;
|
83 |
+
$('customers_found').update(response);
|
84 |
+
setCustomersButtonState();
|
85 |
+
}
|
86 |
+
});
|
87 |
+
}
|
88 |
+
|
89 |
+
function syncCustomers()
|
90 |
+
{
|
91 |
+
<?php
|
92 |
+
$prefix = "customers_";
|
93 |
+
$fields = array(
|
94 |
+
// ADD FROM AND TO
|
95 |
+
'include_already_sent',
|
96 |
+
'include_latest_orders',
|
97 |
+
'include_abandoned_carts',
|
98 |
+
'sequence_enabled',
|
99 |
+
'sequence_field',
|
100 |
+
'sequence_options',
|
101 |
+
|
102 |
+
);
|
103 |
+
?>
|
104 |
+
var form = $('config_edit_form');
|
105 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
106 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/config/"); ?>';
|
107 |
+
|
108 |
+
var params = {
|
109 |
+
customers_lists: $(form['groups[sync][fields][customers_lists][value][]']).getValue().join(),
|
110 |
+
<?php
|
111 |
+
foreach ($fields as $field) {
|
112 |
+
echo "{$prefix}{$field}: $(form['groups[sync][fields][{$prefix}{$field}][value]']).getValue(),\n";
|
113 |
+
}
|
114 |
+
?>
|
115 |
+
store: store
|
116 |
+
};
|
117 |
+
|
118 |
+
console.log(params);
|
119 |
+
//return;
|
120 |
+
|
121 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
122 |
+
parameters : params,
|
123 |
+
method : 'post',
|
124 |
+
loaderArea : false,
|
125 |
+
onSuccess : function(transport)
|
126 |
+
{
|
127 |
+
performCustomerSync();
|
128 |
+
}
|
129 |
+
});
|
130 |
+
}
|
131 |
+
<?php if ($this->getElement()->getDisabled()):?>
|
132 |
+
toggleValueElements({checked:true}, $('campaigner_sync_customers').parentNode);
|
133 |
+
<?php endif;?>
|
134 |
+
|
135 |
+
document.observe("dom:loaded", function() {
|
136 |
+
setCustomersButtonState();
|
137 |
+
});
|
138 |
+
|
139 |
+
</script>
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<span>From: </span><input style="width: 75px;" type="text" name="customer_export_from" id="customer_export_from" value="<?php echo $this->getFromDate() ?>" class="input-text">
|
3 |
+
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select From Date" class="v-middle" title="Select From Date" id="from_trig">
|
4 |
+
<span> to: </span>
|
5 |
+
<input style="width: 75px;" type="text" name="customer_export_to" id="customer_export_to" value="<?php echo $this->getToDate() ?>" class="input-text">
|
6 |
+
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select To Date" class="v-middle" title="Select To Date" id="to_trig">
|
7 |
+
<div class='camp_orders_found'>
|
8 |
+
<strong>Customers Found: </strong><span id='customers_found'><?php echo $this->getCustomersCount() ?></span>
|
9 |
+
</div>
|
10 |
+
<script type='text/javascript'>
|
11 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
12 |
+
var start_from = '<?php echo $this->getFromDate() ?>';
|
13 |
+
var start_to = '<?php echo $this->getToDate() ?>';
|
14 |
+
var customers_count = '<?php echo $this->getCustomersCount(); ?>';
|
15 |
+
|
16 |
+
var check_from = parseDate(start_from);
|
17 |
+
|
18 |
+
function setButtonState()
|
19 |
+
{
|
20 |
+
return;
|
21 |
+
if (customers_count == 0 || customers_count == 'Unknown')
|
22 |
+
toggleValueElements({checked:true}, $('campaigner_export_customers').parentNode);
|
23 |
+
else
|
24 |
+
toggleValueElements({checked:false}, $('campaigner_export_customers').parentNode);
|
25 |
+
}
|
26 |
+
|
27 |
+
function parseDate(date_string)
|
28 |
+
{
|
29 |
+
var date_parts = date_string.split('-');
|
30 |
+
return new Date(date_parts[0],date_parts[1] - 1,date_parts[2]);
|
31 |
+
}
|
32 |
+
|
33 |
+
var calendarSetupObject = {
|
34 |
+
inputField : "customer_export_from",
|
35 |
+
ifFormat : "%Y-%m-%d",
|
36 |
+
showTime : "false",
|
37 |
+
button : "from_trig",
|
38 |
+
align : "Bl",
|
39 |
+
singleClick : true,
|
40 |
+
disableFunc : function(date)
|
41 |
+
{
|
42 |
+
if (date < check_from)
|
43 |
+
return true;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
Calendar.setup(calendarSetupObject);
|
47 |
+
|
48 |
+
var calendarSetupObject2 = {
|
49 |
+
inputField : "customer_export_to",
|
50 |
+
ifFormat : "%Y-%m-%d",
|
51 |
+
showTime : "false",
|
52 |
+
button : "to_trig",
|
53 |
+
align : "Bl",
|
54 |
+
singleClick : true,
|
55 |
+
disableFunc : function(date)
|
56 |
+
{
|
57 |
+
if (date < check_from)
|
58 |
+
return true;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
Calendar.setup(calendarSetupObject2);
|
62 |
+
|
63 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_export/count/"); ?>';
|
64 |
+
|
65 |
+
$('campaigner_sync_customers_include_already_sent').observe('change', function(event)
|
66 |
+
{
|
67 |
+
if (!validateDates())
|
68 |
+
return;
|
69 |
+
|
70 |
+
dateRangeChange();
|
71 |
+
});
|
72 |
+
|
73 |
+
$('customer_export_from').observe('change', function(event)
|
74 |
+
{
|
75 |
+
if (!validateDates())
|
76 |
+
return;
|
77 |
+
|
78 |
+
dateRangeChange();
|
79 |
+
});
|
80 |
+
|
81 |
+
$('customer_export_to').observe('change', function(event)
|
82 |
+
{
|
83 |
+
if (!validateDates())
|
84 |
+
return;
|
85 |
+
|
86 |
+
// Check if the date is < to date
|
87 |
+
dateRangeChange();
|
88 |
+
});
|
89 |
+
|
90 |
+
function validateDates()
|
91 |
+
{
|
92 |
+
// Check if the date is < starting date or > to date
|
93 |
+
var from = parseDate($('customer_export_from').value);
|
94 |
+
var to = parseDate($('customer_export_to').value);
|
95 |
+
|
96 |
+
if (from < check_from)
|
97 |
+
{
|
98 |
+
$('customer_export_from').value = start_from;
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
|
102 |
+
if (to < check_from)
|
103 |
+
{
|
104 |
+
$('customer_export_to').value = start_to;
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
if (from > to)
|
109 |
+
{
|
110 |
+
var temp = $('customer_export_from').value;
|
111 |
+
|
112 |
+
$('customer_export_from').value = $('customer_export_to').value;
|
113 |
+
$('customer_export_to').value = temp;
|
114 |
+
}
|
115 |
+
|
116 |
+
return true;
|
117 |
+
}
|
118 |
+
|
119 |
+
function dateRangeChange()
|
120 |
+
{
|
121 |
+
var from = $('customer_export_from').value;
|
122 |
+
var to = $('customer_export_to').value;
|
123 |
+
var include = $('campaigner_export_include_customers_already_sent').value;
|
124 |
+
//var latest = $('campaigner_export_include_customers_latest_orders').value;
|
125 |
+
//var abandoned = $('campaigner_export_include_customers_abandoned_carts').value;
|
126 |
+
|
127 |
+
$('customers_found').update("???");
|
128 |
+
|
129 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
130 |
+
parameters : {from: from, to: to, include: include, store: store},
|
131 |
+
method : 'post',
|
132 |
+
loaderArea : false,
|
133 |
+
onSuccess : function(transport)
|
134 |
+
{
|
135 |
+
//console.log(transport.responseText);
|
136 |
+
var response = transport.responseText;
|
137 |
+
customers_count = response;
|
138 |
+
$('customers_found').update(response);
|
139 |
+
setButtonState();
|
140 |
+
}
|
141 |
+
});
|
142 |
+
}
|
143 |
+
|
144 |
+
document.observe("dom:loaded", function() {
|
145 |
+
setButtonState();
|
146 |
+
});
|
147 |
+
</script>
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $key = $this->getKey(); ?>
|
2 |
+
|
3 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
4 |
+
<span>From: </span><input style="width: 75px;" type="text" name="<?php echo $key; ?>_sync_from" id="<?php echo $key; ?>_sync_from" value="<?php echo $this->getFromDate() ?>" class="input-text">
|
5 |
+
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select From Date" class="v-middle" title="Select From Date" id="<?php echo $key; ?>_from_trig">
|
6 |
+
<span> to: </span>
|
7 |
+
<input style="width: 75px;" type="text" name="<?php echo $key; ?>_sync_to" id="<?php echo $key; ?>_sync_to" value="<?php echo $this->getToDate() ?>" class="input-text">
|
8 |
+
<img src="<?php echo $this->getSkinUrl('images/grid-cal.gif'); ?>" alt="Select To Date" class="v-middle" title="Select To Date" id="<?php echo $key; ?>_to_trig">
|
9 |
+
<script type='text/javascript'>
|
10 |
+
var <?php echo $key; ?>_store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
11 |
+
var <?php echo $key; ?>_start_from = '<?php echo $this->getFromDate() ?>';
|
12 |
+
var <?php echo $key; ?>_start_to = '<?php echo $this->getToDate() ?>';
|
13 |
+
|
14 |
+
var <?php echo $key; ?>_check_from = <?php echo $key; ?>ParseDate(<?php echo $key; ?>_start_from);
|
15 |
+
|
16 |
+
function <?php echo $key; ?>ParseDate(date_string)
|
17 |
+
{
|
18 |
+
var date_parts = date_string.split('-');
|
19 |
+
return new Date(date_parts[0],date_parts[1] - 1,date_parts[2]);
|
20 |
+
}
|
21 |
+
|
22 |
+
var <?php echo $key; ?>From = {
|
23 |
+
inputField : "<?php echo $key; ?>_sync_from",
|
24 |
+
ifFormat : "%Y-%m-%d",
|
25 |
+
showTime : "false",
|
26 |
+
button : "<?php echo $key; ?>_from_trig",
|
27 |
+
align : "Bl",
|
28 |
+
singleClick : true,
|
29 |
+
disableFunc : function(date)
|
30 |
+
{
|
31 |
+
if (date < <?php echo $key; ?>_check_from) {
|
32 |
+
return true;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
Calendar.setup(<?php echo $key; ?>From);
|
37 |
+
|
38 |
+
var <?php echo $key; ?>To = {
|
39 |
+
inputField : "<?php echo $key; ?>_sync_to",
|
40 |
+
ifFormat : "%Y-%m-%d",
|
41 |
+
showTime : "false",
|
42 |
+
button : "<?php echo $key; ?>_to_trig",
|
43 |
+
align : "Bl",
|
44 |
+
singleClick : true,
|
45 |
+
disableFunc : function(date)
|
46 |
+
{
|
47 |
+
if (date < <?php echo $key; ?>_check_from) {
|
48 |
+
return true;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
Calendar.setup(<?php echo $key; ?>To);
|
53 |
+
|
54 |
+
$('<?php echo $key; ?>_sync_from').observe('change', function(event)
|
55 |
+
{
|
56 |
+
if (!<?php echo $key; ?>ValidateDates()) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
<?php echo $key; ?>Refresh();
|
61 |
+
});
|
62 |
+
|
63 |
+
$('<?php echo $key; ?>_sync_to').observe('change', function(event)
|
64 |
+
{
|
65 |
+
if (!<?php echo $key; ?>ValidateDates()) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
<?php echo $key; ?>Refresh();
|
70 |
+
});
|
71 |
+
|
72 |
+
function <?php echo $key; ?>ValidateDates()
|
73 |
+
{
|
74 |
+
// Check if the date is < starting date or > to date
|
75 |
+
var from = <?php echo $key; ?>ParseDate($('<?php echo $key; ?>_sync_from').value);
|
76 |
+
var to = <?php echo $key; ?>ParseDate($('<?php echo $key; ?>_sync_to').value);
|
77 |
+
|
78 |
+
if (from < <?php echo $key; ?>_check_from)
|
79 |
+
{
|
80 |
+
$('<?php echo $key; ?>_sync_from').value = <?php echo $key; ?>_start_from;
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
if (to < <?php echo $key; ?>_check_from)
|
85 |
+
{
|
86 |
+
$('<?php echo $key; ?>_sync_to').value = <?php echo $key; ?>_start_to;
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
|
90 |
+
if (from > to)
|
91 |
+
{
|
92 |
+
var temp = $('<?php echo $key; ?>_sync_from').value;
|
93 |
+
|
94 |
+
$('<?php echo $key; ?>_sync_from').value = $('<?php echo $key; ?>_sync_to').value;
|
95 |
+
$('<?php echo $key; ?>_sync_to').value = temp;
|
96 |
+
}
|
97 |
+
|
98 |
+
return true;
|
99 |
+
}
|
100 |
+
</script>
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<div class='camp_sync_items_found'>
|
3 |
+
<strong>Orders Found: </strong><span id='orders_found'><?php echo $this->getOrdersCount() ?></span>
|
4 |
+
</div>
|
5 |
+
<br />
|
6 |
+
<button id='campaigner_sync_orders' onClick="syncOrders(); return false;">Send Orders to Campaigner</button>
|
7 |
+
<script type='text/javascript'>
|
8 |
+
|
9 |
+
var orders_count = '<?php echo $this->getOrdersCount(); ?>';
|
10 |
+
|
11 |
+
function setOrdersButtonState()
|
12 |
+
{
|
13 |
+
if ($('campaigner_sync_orders')) {
|
14 |
+
if (orders_count == 0 || orders_count == 'Unknown') {
|
15 |
+
toggleValueElements({checked:true}, $('campaigner_sync_orders').parentNode);
|
16 |
+
} else {
|
17 |
+
toggleValueElements({checked:false}, $('campaigner_sync_orders').parentNode);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
$('campaigner_sync_orders_include_already_sent').observe('change', function(event)
|
23 |
+
{
|
24 |
+
ordersRefresh();
|
25 |
+
});
|
26 |
+
|
27 |
+
function performOrderSync()
|
28 |
+
{
|
29 |
+
console.log('performOrderSync');
|
30 |
+
var form = $('config_edit_form');
|
31 |
+
var apikey = $(form['groups[commerce][fields][apikey][value]']).getValue();
|
32 |
+
var from = form['orders_sync_from'];
|
33 |
+
var to = form['orders_sync_to'];
|
34 |
+
var include = form['groups[sync][fields][orders_include_already_sent][value]'];
|
35 |
+
|
36 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
37 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/orders/"); ?>';
|
38 |
+
|
39 |
+
if (apikey != current_apikey) {
|
40 |
+
alert('API Key has changed. Please save configuration before performing Order Sync');
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
|
44 |
+
console.log(url);
|
45 |
+
|
46 |
+
console.log($(from).getValue());
|
47 |
+
console.log($(to).getValue());
|
48 |
+
console.log($(include).getValue());
|
49 |
+
|
50 |
+
url += 'sync_from/' + $(from).getValue()
|
51 |
+
+ '/sync_to/' + $(to).getValue()
|
52 |
+
+ '/include/' + $(include).getValue()
|
53 |
+
+ '/store/' + store + '/';
|
54 |
+
|
55 |
+
console.log(url);
|
56 |
+
|
57 |
+
window.open(url);
|
58 |
+
}
|
59 |
+
|
60 |
+
function ordersRefresh()
|
61 |
+
{
|
62 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/ordersCount/"); ?>';
|
63 |
+
var from = $('orders_sync_from').value;
|
64 |
+
var to = $('orders_sync_to').value;
|
65 |
+
var include = $('campaigner_sync_orders_include_already_sent').value;
|
66 |
+
//var latest = $('campaigner_export_include_orders_latest_orders').value;
|
67 |
+
//var abandoned = $('campaigner_export_include_orders_abandoned_carts').value;
|
68 |
+
|
69 |
+
$('orders_found').update("???");
|
70 |
+
|
71 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
72 |
+
parameters : {from: from, to: to, include: include, store: orders_store},
|
73 |
+
method : 'post',
|
74 |
+
loaderArea : false,
|
75 |
+
onSuccess : function(transport)
|
76 |
+
{
|
77 |
+
//console.log(transport.responseText);
|
78 |
+
var response = transport.responseText;
|
79 |
+
orders_count = response;
|
80 |
+
$('orders_found').update(response);
|
81 |
+
setOrdersButtonState();
|
82 |
+
}
|
83 |
+
});
|
84 |
+
}
|
85 |
+
|
86 |
+
function syncOrders()
|
87 |
+
{
|
88 |
+
<?php
|
89 |
+
$prefix = "orders_";
|
90 |
+
$fields = array(
|
91 |
+
'include_already_sent',
|
92 |
+
);
|
93 |
+
?>
|
94 |
+
var form = $('config_edit_form');
|
95 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
96 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/config/"); ?>';
|
97 |
+
var from = $('orders_sync_from').value;
|
98 |
+
var to = $('orders_sync_to').value;
|
99 |
+
|
100 |
+
var params = {
|
101 |
+
<?php
|
102 |
+
foreach ($fields as $field) {
|
103 |
+
echo "{$field}: $(form['groups[sync][fields][{$prefix}{$field}][value]']).getValue(),\n";
|
104 |
+
}
|
105 |
+
?>
|
106 |
+
store: store
|
107 |
+
};
|
108 |
+
|
109 |
+
console.log(params);
|
110 |
+
//return;
|
111 |
+
|
112 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
113 |
+
parameters : params,
|
114 |
+
method : 'post',
|
115 |
+
loaderArea : false,
|
116 |
+
onSuccess : function(transport)
|
117 |
+
{
|
118 |
+
console.log('success');
|
119 |
+
performOrderSync();
|
120 |
+
}
|
121 |
+
});
|
122 |
+
}
|
123 |
+
<?php if ($this->getElement()->getDisabled()):?>
|
124 |
+
toggleValueElements({checked:true}, $('campaigner_sync_orders').parentNode);
|
125 |
+
<?php endif;?>
|
126 |
+
|
127 |
+
document.observe("dom:loaded", function() {
|
128 |
+
setOrdersButtonState();
|
129 |
+
});
|
130 |
+
|
131 |
+
</script>
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="<?php echo $this->getElement()->getHtmlId(); ?>" style='display:none'></div>
|
2 |
+
<button id='campaigner_sync_products' onClick="syncProducts(); return false;">Send Products to Campaigner</button>
|
3 |
+
<script type='text/javascript'>
|
4 |
+
|
5 |
+
function performProductSync()
|
6 |
+
{
|
7 |
+
|
8 |
+
console.log('performProductSync');
|
9 |
+
var form = $('config_edit_form');
|
10 |
+
var apikey = $(form['groups[commerce][fields][apikey][value]']).getValue();
|
11 |
+
var include = form['groups[sync][fields][products_include_disabled][value]'];
|
12 |
+
|
13 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
14 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/products/"); ?>';
|
15 |
+
|
16 |
+
if (apikey != current_apikey) {
|
17 |
+
alert('API Key has changed. Please save configuration before performing Product Sync');
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
|
21 |
+
console.log(url);
|
22 |
+
|
23 |
+
console.log($(include).getValue());
|
24 |
+
|
25 |
+
url += '/include/' + $(include).getValue()
|
26 |
+
+ '/store/' + store + '/';
|
27 |
+
|
28 |
+
console.log(url);
|
29 |
+
|
30 |
+
window.open(url);
|
31 |
+
}
|
32 |
+
|
33 |
+
function productsRefresh()
|
34 |
+
{
|
35 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/productsCount/"); ?>';
|
36 |
+
var from = $('products_sync_from').value;
|
37 |
+
var to = $('products_sync_to').value;
|
38 |
+
var include = $('campaigner_sync_products_include_disabled').value;
|
39 |
+
//var latest = $('campaigner_export_include_products_latest_products').value;
|
40 |
+
//var abandoned = $('campaigner_export_include_products_abandoned_carts').value;
|
41 |
+
|
42 |
+
$('products_found').update("???");
|
43 |
+
|
44 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
45 |
+
parameters : {include: include, store: products_store},
|
46 |
+
method : 'post',
|
47 |
+
loaderArea : false,
|
48 |
+
onSuccess : function(transport)
|
49 |
+
{
|
50 |
+
//console.log(transport.responseText);
|
51 |
+
var response = transport.responseText;
|
52 |
+
products_count = response;
|
53 |
+
$('products_found').update(response);
|
54 |
+
//setProductsButtonState();
|
55 |
+
}
|
56 |
+
});
|
57 |
+
}
|
58 |
+
|
59 |
+
function syncProducts()
|
60 |
+
{
|
61 |
+
<?php
|
62 |
+
$prefix = "products_";
|
63 |
+
$fields = array(
|
64 |
+
'include_disabled',
|
65 |
+
);
|
66 |
+
?>
|
67 |
+
var form = $('config_edit_form');
|
68 |
+
var store = <?php echo Mage::helper('campaigner')->getAdminStore(); ?>;
|
69 |
+
var url = '<?php echo $this->getUrl("adminhtml/campaigner_sync/config/"); ?>';
|
70 |
+
|
71 |
+
var params = {
|
72 |
+
<?php
|
73 |
+
foreach ($fields as $field) {
|
74 |
+
echo "{$field}: $(form['groups[sync][fields][{$prefix}{$field}][value]']).getValue(),\n";
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
store: store
|
78 |
+
};
|
79 |
+
|
80 |
+
console.log(params);
|
81 |
+
//return;
|
82 |
+
|
83 |
+
new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), {
|
84 |
+
parameters : params,
|
85 |
+
method : 'post',
|
86 |
+
loaderArea : false,
|
87 |
+
onSuccess : function(transport)
|
88 |
+
{
|
89 |
+
console.log('success');
|
90 |
+
performProductSync();
|
91 |
+
}
|
92 |
+
});
|
93 |
+
}
|
94 |
+
<?php if ($this->getElement()->getDisabled()):?>
|
95 |
+
toggleValueElements({checked:true}, $('campaigner_sync_products').parentNode);
|
96 |
+
<?php endif;?>
|
97 |
+
|
98 |
+
</script>
|
@@ -1,221 +0,0 @@
|
|
1 |
-
<?php $this->getBatchModel() ?>
|
2 |
-
<?php $importData = $this->getImportData();?>
|
3 |
-
<style type="text/css" >
|
4 |
-
ul { list-style-type:none; padding:0; margin:0; }
|
5 |
-
li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 13px sans-serif; }
|
6 |
-
img { margin-right:5px; }
|
7 |
-
</style>
|
8 |
-
<script type="text/javascript">
|
9 |
-
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
10 |
-
var export_type = "<?php echo $this->getExportType(); ?>";
|
11 |
-
</script>
|
12 |
-
<ul>
|
13 |
-
<li>
|
14 |
-
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif')?>" class="v-middle" style="margin-right:5px"/>
|
15 |
-
<?php echo $this->__("Starting Campaigner Export...");?>
|
16 |
-
</li>
|
17 |
-
<li style="background-color:#FFD;">
|
18 |
-
<img src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif');?>" class="v-middle" style="margin-right:5px"/>
|
19 |
-
<?php
|
20 |
-
if (count($importData) == 0)
|
21 |
-
echo $this->__("No items found to export!");
|
22 |
-
else
|
23 |
-
echo $this->__("Warning: Please do not close the window during export process!");
|
24 |
-
?>
|
25 |
-
</li>
|
26 |
-
</ul>
|
27 |
-
<ul id="profileRows">
|
28 |
-
<li id="liFinished" style="display: <?php if (count($importData) == 0) echo 'block'; else echo 'none' ?>;">
|
29 |
-
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
30 |
-
<?php echo $this->__("Finished Export!.");?>
|
31 |
-
<span id='download_link'>
|
32 |
-
|
33 |
-
</span>
|
34 |
-
</li>
|
35 |
-
</ul>
|
36 |
-
<script type="text/javascript">
|
37 |
-
var d = new Date();
|
38 |
-
var countOfStartedProfiles = 0;
|
39 |
-
var filename = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate() + "T" + d.getHours() + "_" + d.getMinutes();
|
40 |
-
var countOfUpdated = 0;
|
41 |
-
var countOfError = 0;
|
42 |
-
var importData = <?php echo $this->jsonEncode($importData);?>;
|
43 |
-
var totalRecords = <?php echo $this->getBatchItemsCount();?>;
|
44 |
-
var config = <?php echo $this->getBatchConfigJson();?>;
|
45 |
-
var group = <?php echo $this->getBatchSize() ?>;
|
46 |
-
var upload_ed = <?php echo $this->getUploadStatus() ?>;
|
47 |
-
var store = <?php echo $this->getStore() ?>;
|
48 |
-
</script>
|
49 |
-
<script type="text/javascript">
|
50 |
-
|
51 |
-
function execImportData()
|
52 |
-
{
|
53 |
-
if (importData.length == 0)
|
54 |
-
{
|
55 |
-
// Finished
|
56 |
-
$("updatedRows_img").src = config.styles.message.icon;
|
57 |
-
$("updatedRows").style.backgroundColor = config.styles.message.bg;
|
58 |
-
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
59 |
-
style: "background-color:"+config.styles.message.bg,
|
60 |
-
image: config.styles.message.icon,
|
61 |
-
text: config.tplSccTxt.evaluate({updated:(countOfUpdated-countOfError)}),
|
62 |
-
id: "updatedFinish"
|
63 |
-
})});
|
64 |
-
|
65 |
-
if (upload_ed)
|
66 |
-
{
|
67 |
-
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
68 |
-
style: "background-color:"+config.styles.message.bg,
|
69 |
-
image: config.styles.message.icon,
|
70 |
-
text: config.tplUploading.evaluate({updated:countOfUpdated}),
|
71 |
-
id: "uploadingFinish"
|
72 |
-
})});
|
73 |
-
}
|
74 |
-
|
75 |
-
if ($("liBeforeFinish"))
|
76 |
-
{
|
77 |
-
Element.insert($("liFinished"), {before: $("liBeforeFinish")});
|
78 |
-
$("liBeforeFinish").show();
|
79 |
-
}
|
80 |
-
|
81 |
-
new Ajax.Request("<?php echo $this->getUrl('*/*/batchFinish');?>",
|
82 |
-
{
|
83 |
-
method: "post",
|
84 |
-
parameters: {filename: filename, form_key: FORM_KEY, export_type: export_type, store: store},
|
85 |
-
onComplete: function(transport)
|
86 |
-
{
|
87 |
-
if (transport.responseText.isJSON())
|
88 |
-
{
|
89 |
-
var response = transport.responseText.evalJSON();
|
90 |
-
|
91 |
-
Element.insert($("download_link"), {bottom: "<a href='" + response.download_link + "'>Download File</a>"});
|
92 |
-
if (response.error)
|
93 |
-
{
|
94 |
-
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
95 |
-
style: "background-color:"+config.styles.error.bg,
|
96 |
-
image: config.styles.error.icon,
|
97 |
-
text: response.error.escapeHTML(),
|
98 |
-
id: "error-finish"
|
99 |
-
})});
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
if ($("before-finish-wait-img"))
|
104 |
-
$("before-finish-wait-img").hide();
|
105 |
-
|
106 |
-
$('liFinished').show();
|
107 |
-
}
|
108 |
-
});
|
109 |
-
}
|
110 |
-
else
|
111 |
-
{
|
112 |
-
if (group > 1)
|
113 |
-
{
|
114 |
-
var ids = [];
|
115 |
-
for (var i = 0; i < group; i++)
|
116 |
-
{
|
117 |
-
ids.push(importData.shift());
|
118 |
-
|
119 |
-
if (importData.length == 0)
|
120 |
-
break;
|
121 |
-
}
|
122 |
-
|
123 |
-
sendImportData(ids,"id[]");
|
124 |
-
|
125 |
-
}
|
126 |
-
else
|
127 |
-
{
|
128 |
-
sendImportData(importData.shift(),"id");
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
function sendImportData(id,id_name)
|
134 |
-
{
|
135 |
-
var data = {}
|
136 |
-
var updated = 1;
|
137 |
-
|
138 |
-
data[id_name] = id;
|
139 |
-
|
140 |
-
if (typeof(id) != 'number')
|
141 |
-
updated = id.length;
|
142 |
-
|
143 |
-
if (!config.tpl)
|
144 |
-
{
|
145 |
-
config.tpl = new Template(config.template);
|
146 |
-
config.tplTxt = new Template(config.text);
|
147 |
-
config.tplSccTxt = new Template(config.successText);
|
148 |
-
config.tplUploading = new Template(config.uploadText);
|
149 |
-
}
|
150 |
-
if (!$("updatedRows"))
|
151 |
-
{
|
152 |
-
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
153 |
-
style: "background-color: #FFD;",
|
154 |
-
image: config.styles.loader,
|
155 |
-
text: config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}),
|
156 |
-
id: "updatedRows"
|
157 |
-
})});
|
158 |
-
}
|
159 |
-
countOfStartedProfiles++;
|
160 |
-
|
161 |
-
if (!data.form_key)
|
162 |
-
data.form_key = FORM_KEY;
|
163 |
-
|
164 |
-
data.export_type = export_type;
|
165 |
-
|
166 |
-
data.filename = filename;
|
167 |
-
|
168 |
-
new Ajax.Request("<?php echo $this->getUrl("*/*/batchRun/");?>",
|
169 |
-
{
|
170 |
-
method: "post",
|
171 |
-
parameters: data,
|
172 |
-
onSuccess: function(transport)
|
173 |
-
{
|
174 |
-
countOfStartedProfiles --;
|
175 |
-
countOfUpdated += updated;
|
176 |
-
if (transport.responseText.isJSON())
|
177 |
-
addProfileRow(transport.responseText.evalJSON());
|
178 |
-
else
|
179 |
-
{
|
180 |
-
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
181 |
-
style: "background-color: "+config.styles.error.bg,
|
182 |
-
image: config.styles.error.icon,
|
183 |
-
text: transport.responseText.escapeHTML(),
|
184 |
-
id: "error-" + countOfStartedProfiles
|
185 |
-
})
|
186 |
-
});
|
187 |
-
countOfError ++;
|
188 |
-
}
|
189 |
-
execImportData();
|
190 |
-
}
|
191 |
-
});
|
192 |
-
}
|
193 |
-
|
194 |
-
function getPercent()
|
195 |
-
{
|
196 |
-
return Math.ceil((countOfUpdated/totalRecords)*1000)/10;
|
197 |
-
}
|
198 |
-
|
199 |
-
function addProfileRow(data)
|
200 |
-
{
|
201 |
-
if (data.errors.length > 0)
|
202 |
-
{
|
203 |
-
for (var i=0, length=data.errors.length; i<length; i++)
|
204 |
-
{
|
205 |
-
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
206 |
-
style: "background-color:"+config.styles.error.bg,
|
207 |
-
image: config.styles.error.icon,
|
208 |
-
text: data.errors[i],
|
209 |
-
id: "id-" + (countOfUpdated + i + 1)
|
210 |
-
})});
|
211 |
-
countOfError ++;
|
212 |
-
}
|
213 |
-
}
|
214 |
-
$("updatedRows_status").update(config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}));
|
215 |
-
}
|
216 |
-
</script>
|
217 |
-
|
218 |
-
<script type="text/javascript">
|
219 |
-
if (totalRecords > 0)
|
220 |
-
execImportData();
|
221 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$importData_category = $this->getImportData('category');
|
4 |
+
$importData_product = $this->getImportData('product');
|
5 |
+
|
6 |
+
?>
|
7 |
+
<style type="text/css" >
|
8 |
+
ul { list-style-type:none; padding:0; margin:0; }
|
9 |
+
li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 13px sans-serif; }
|
10 |
+
img { margin-right:5px; }
|
11 |
+
</style>
|
12 |
+
<script type="text/javascript">
|
13 |
+
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
14 |
+
var sync_type = null;
|
15 |
+
</script>
|
16 |
+
<ul>
|
17 |
+
<li>
|
18 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif')?>" class="v-middle" style="margin-right:5px"/>
|
19 |
+
<?php echo $this->__("Starting Campaigner Sync...");?>
|
20 |
+
</li>
|
21 |
+
<li style="background-color:#FFD;">
|
22 |
+
<img src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif');?>" class="v-middle" style="margin-right:5px"/>
|
23 |
+
<?php
|
24 |
+
if (count($importData_product) == 0)
|
25 |
+
echo $this->__("No items found to sync!");
|
26 |
+
else
|
27 |
+
echo $this->__("Warning: Please do not close the window during sync process!");
|
28 |
+
?>
|
29 |
+
</li>
|
30 |
+
</ul>
|
31 |
+
<ul id="profileRows">
|
32 |
+
<li id="liFinished" style="display: <?php if (count($importData_product) == 0) echo 'block'; else echo 'none' ?>;">
|
33 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
34 |
+
<?php echo $this->__("Finished Sync!");?>
|
35 |
+
</li>
|
36 |
+
<li id="liAborted" style="display: none; background-color:#FDD;">
|
37 |
+
<img src="<?php echo $this->getSkinUrl('images/error_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
38 |
+
<?php echo $this->__("Sync Aborted!");?>
|
39 |
+
</li>
|
40 |
+
</ul>
|
41 |
+
<script type="text/javascript">
|
42 |
+
var d = new Date();
|
43 |
+
var countOfStartedProfiles = 0;
|
44 |
+
var countOfUpdated = 0;
|
45 |
+
var countOfError = 0;
|
46 |
+
|
47 |
+
var importData_category = <?php echo $this->jsonEncode($importData_category);?>;
|
48 |
+
var totalRecords_category = <?php echo $this->getBatchItemsCount("category");?>;
|
49 |
+
var config_category = <?php echo $this->getBatchConfigJson("category");?>;
|
50 |
+
|
51 |
+
var importData_product = <?php echo $this->jsonEncode($importData_product);?>;
|
52 |
+
var totalRecords_product = <?php echo $this->getBatchItemsCount("product");?>;
|
53 |
+
var config_product = <?php echo $this->getBatchConfigJson("product");?>;
|
54 |
+
|
55 |
+
var importData = null;
|
56 |
+
var totalRecords = 0;
|
57 |
+
var config = null;
|
58 |
+
var group = <?php echo $this->getBatchSize() ?>;
|
59 |
+
var store = <?php echo $this->getStore() ?>;
|
60 |
+
</script>
|
61 |
+
<script type="text/javascript">
|
62 |
+
|
63 |
+
function execImportData()
|
64 |
+
{
|
65 |
+
//console.log('execImportData');
|
66 |
+
if (importData.length == 0)
|
67 |
+
{
|
68 |
+
// Finished
|
69 |
+
$("updatedRows_" + sync_type + "_img").src = config.styles.message.icon;
|
70 |
+
$("updatedRows_" + sync_type).style.backgroundColor = config.styles.message.bg;
|
71 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
72 |
+
style: "background-color:"+config.styles.message.bg,
|
73 |
+
image: config.styles.message.icon,
|
74 |
+
text: config.tplSccTxt.evaluate({updated:(countOfUpdated-countOfError)}),
|
75 |
+
id: "updatedFinish"
|
76 |
+
})});
|
77 |
+
|
78 |
+
if ($("liBeforeFinish"))
|
79 |
+
{
|
80 |
+
Element.insert($("liFinished"), {before: $("liBeforeFinish")});
|
81 |
+
$("liBeforeFinish").show();
|
82 |
+
}
|
83 |
+
|
84 |
+
new Ajax.Request("<?php echo $this->getUrl('*/*/batchFinish');?>",
|
85 |
+
{
|
86 |
+
method: "post",
|
87 |
+
parameters: {form_key: FORM_KEY, sync_type: sync_type, store: store},
|
88 |
+
onComplete: function(transport)
|
89 |
+
{
|
90 |
+
if (transport.responseText.isJSON())
|
91 |
+
{
|
92 |
+
var response = transport.responseText.evalJSON();
|
93 |
+
|
94 |
+
//Element.insert($("download_link"), {bottom: "<a href='" + response.download_link + "'>Download File</a>"});
|
95 |
+
if (response.error)
|
96 |
+
{
|
97 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
98 |
+
style: "background-color:"+config.styles.error.bg,
|
99 |
+
image: config.styles.error.icon,
|
100 |
+
text: response.error.escapeHTML(),
|
101 |
+
id: "error-finish"
|
102 |
+
})});
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if (sync_type == 'category') {
|
107 |
+
//console.log('products disabled!!!');
|
108 |
+
processProducts();
|
109 |
+
} else {
|
110 |
+
|
111 |
+
if ($("before-finish-wait-img")) {
|
112 |
+
$("before-finish-wait-img").hide();
|
113 |
+
}
|
114 |
+
|
115 |
+
$('liFinished').show();
|
116 |
+
|
117 |
+
}
|
118 |
+
}
|
119 |
+
});
|
120 |
+
}
|
121 |
+
else
|
122 |
+
{
|
123 |
+
if (group > 1)
|
124 |
+
{
|
125 |
+
var ids = [];
|
126 |
+
for (var i = 0; i < group; i++)
|
127 |
+
{
|
128 |
+
ids.push(importData.shift());
|
129 |
+
|
130 |
+
if (importData.length == 0)
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
sendImportData(ids,"id[]");
|
134 |
+
}
|
135 |
+
else
|
136 |
+
{
|
137 |
+
sendImportData(importData.shift(),"id");
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
function sendImportData(id,id_name)
|
143 |
+
{
|
144 |
+
var data = {}
|
145 |
+
var updated = 1;
|
146 |
+
|
147 |
+
data[id_name] = id;
|
148 |
+
|
149 |
+
if (typeof(id) != 'number')
|
150 |
+
updated = id.length;
|
151 |
+
|
152 |
+
if (!config.tpl)
|
153 |
+
{
|
154 |
+
config.tpl = new Template(config.template);
|
155 |
+
|
156 |
+
config.tplTxt = new Template(config.text);
|
157 |
+
config.tplSccTxt = new Template(config.successText);
|
158 |
+
}
|
159 |
+
if (!$("updatedRows_" + sync_type))
|
160 |
+
{
|
161 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
162 |
+
style: "background-color: #FFD;",
|
163 |
+
image: config.styles.loader,
|
164 |
+
text: config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}),
|
165 |
+
id: "updatedRows"
|
166 |
+
})});
|
167 |
+
}
|
168 |
+
countOfStartedProfiles++;
|
169 |
+
|
170 |
+
if (!data.form_key)
|
171 |
+
data.form_key = FORM_KEY;
|
172 |
+
|
173 |
+
data.sync_type = sync_type;
|
174 |
+
|
175 |
+
new Ajax.Request("<?php echo $this->getUrl("*/*/batchRun/");?>",
|
176 |
+
{
|
177 |
+
method: "post",
|
178 |
+
parameters: data,
|
179 |
+
onSuccess: function(transport)
|
180 |
+
{
|
181 |
+
countOfStartedProfiles --;
|
182 |
+
countOfUpdated += updated;
|
183 |
+
if (transport.responseText.isJSON()) {
|
184 |
+
var response = transport.responseText.evalJSON();
|
185 |
+
|
186 |
+
addProfileRow(response);
|
187 |
+
|
188 |
+
if (response.abort) {
|
189 |
+
if ($("before-finish-wait-img")) {
|
190 |
+
$("before-finish-wait-img").hide();
|
191 |
+
}
|
192 |
+
|
193 |
+
$('liAborted').show();
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
} else {
|
197 |
+
Element.insert($("updatedRows_" + sync_type), {before: config.tpl.evaluate({
|
198 |
+
style: "background-color: "+config.styles.error.bg,
|
199 |
+
image: config.styles.error.icon,
|
200 |
+
text: transport.responseText.escapeHTML(),
|
201 |
+
id: "error-" + countOfStartedProfiles
|
202 |
+
})
|
203 |
+
});
|
204 |
+
countOfError ++;
|
205 |
+
}
|
206 |
+
execImportData();
|
207 |
+
}
|
208 |
+
});
|
209 |
+
}
|
210 |
+
|
211 |
+
function getPercent()
|
212 |
+
{
|
213 |
+
return Math.ceil((countOfUpdated/totalRecords)*1000)/10;
|
214 |
+
}
|
215 |
+
|
216 |
+
function addProfileRow(data)
|
217 |
+
{
|
218 |
+
if (data.errors.length > 0)
|
219 |
+
{
|
220 |
+
for (var i=0, length=data.errors.length; i<length; i++)
|
221 |
+
{
|
222 |
+
Element.insert($("updatedRows_" + sync_type), {before: config.tpl.evaluate({
|
223 |
+
style: "background-color:"+config.styles.error.bg,
|
224 |
+
image: config.styles.error.icon,
|
225 |
+
text: data.errors[i],
|
226 |
+
id: "id-" + (countOfUpdated + i + 1)
|
227 |
+
})});
|
228 |
+
countOfError ++;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
$("updatedRows_" + sync_type + "_status").update(config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}));
|
232 |
+
}
|
233 |
+
|
234 |
+
function processProducts()
|
235 |
+
{
|
236 |
+
// if (totalRecords_product > 0) {
|
237 |
+
countOfUpdated = 0;
|
238 |
+
sync_type = 'product';
|
239 |
+
importData = importData_product;
|
240 |
+
config = config_product;
|
241 |
+
totalRecords = totalRecords_product;
|
242 |
+
execImportData();
|
243 |
+
//}
|
244 |
+
}
|
245 |
+
</script>
|
246 |
+
|
247 |
+
<script type="text/javascript">
|
248 |
+
if (totalRecords_category > 0) {
|
249 |
+
countOfUpdated = 0;
|
250 |
+
sync_type = 'category';
|
251 |
+
importData = importData_category;
|
252 |
+
config = config_category;
|
253 |
+
totalRecords = totalRecords_category;
|
254 |
+
execImportData();
|
255 |
+
}
|
256 |
+
|
257 |
+
</script>
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $importData = $this->getImportData();?>
|
2 |
+
<style type="text/css" >
|
3 |
+
ul { list-style-type:none; padding:0; margin:0; }
|
4 |
+
li { margin-left:0; border:1px solid #ccc; margin:2px; padding:2px 2px 2px 2px; font:normal 13px sans-serif; }
|
5 |
+
img { margin-right:5px; }
|
6 |
+
</style>
|
7 |
+
<script type="text/javascript">
|
8 |
+
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
9 |
+
var sync_type = "<?php echo $this->getSyncType(); ?>";
|
10 |
+
</script>
|
11 |
+
<ul>
|
12 |
+
<li>
|
13 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif')?>" class="v-middle" style="margin-right:5px"/>
|
14 |
+
<?php echo $this->__("Starting Campaigner Sync...");?>
|
15 |
+
</li>
|
16 |
+
<li style="background-color:#FFD;">
|
17 |
+
<img src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif');?>" class="v-middle" style="margin-right:5px"/>
|
18 |
+
<?php
|
19 |
+
if (count($importData) == 0)
|
20 |
+
echo $this->__("No items found to sync!");
|
21 |
+
else
|
22 |
+
echo $this->__("Warning: Please do not close the window during sync process!");
|
23 |
+
?>
|
24 |
+
</li>
|
25 |
+
</ul>
|
26 |
+
<ul id="profileRows">
|
27 |
+
<li id="liFinished" style="display: <?php if (count($importData) == 0) echo 'block'; else echo 'none' ?>;">
|
28 |
+
<img src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
29 |
+
<?php echo $this->__("Finished Sync!");?>
|
30 |
+
<span id='download_link'>
|
31 |
+
|
32 |
+
</span>
|
33 |
+
</li>
|
34 |
+
<li id="liAborted" style="display: none; background-color:#FDD;">
|
35 |
+
<img src="<?php echo $this->getSkinUrl('images/error_msg_icon.gif');?>" class="v-middle" style="margin-right:5px"/>
|
36 |
+
<?php echo $this->__("Sync Aborted!");?>
|
37 |
+
</li>
|
38 |
+
</ul>
|
39 |
+
<script type="text/javascript">
|
40 |
+
var d = new Date();
|
41 |
+
var countOfStartedProfiles = 0;
|
42 |
+
var countOfUpdated = 0;
|
43 |
+
var countOfError = 0;
|
44 |
+
var importData = <?php echo $this->jsonEncode($importData);?>;
|
45 |
+
var totalRecords = <?php echo $this->getBatchItemsCount();?>;
|
46 |
+
var config = <?php echo $this->getBatchConfigJson();?>;
|
47 |
+
var group = <?php echo $this->getBatchSize() ?>;
|
48 |
+
//var upload_ed = <?php echo $this->getUploadStatus() ?>;
|
49 |
+
var store = <?php echo $this->getStore() ?>;
|
50 |
+
</script>
|
51 |
+
<script type="text/javascript">
|
52 |
+
|
53 |
+
function execImportData()
|
54 |
+
{
|
55 |
+
if (importData.length == 0)
|
56 |
+
{
|
57 |
+
// Finished
|
58 |
+
$("updatedRows_img").src = config.styles.message.icon;
|
59 |
+
$("updatedRows").style.backgroundColor = config.styles.message.bg;
|
60 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
61 |
+
style: "background-color:"+config.styles.message.bg,
|
62 |
+
image: config.styles.message.icon,
|
63 |
+
text: config.tplSccTxt.evaluate({updated:(countOfUpdated-countOfError)}),
|
64 |
+
id: "updatedFinish"
|
65 |
+
})});
|
66 |
+
|
67 |
+
if ($("liBeforeFinish"))
|
68 |
+
{
|
69 |
+
Element.insert($("liFinished"), {before: $("liBeforeFinish")});
|
70 |
+
$("liBeforeFinish").show();
|
71 |
+
}
|
72 |
+
|
73 |
+
new Ajax.Request("<?php echo $this->getUrl('*/*/batchFinish');?>",
|
74 |
+
{
|
75 |
+
method: "post",
|
76 |
+
parameters: {form_key: FORM_KEY, sync_type: sync_type, store: store},
|
77 |
+
onComplete: function(transport)
|
78 |
+
{
|
79 |
+
if (transport.responseText.isJSON())
|
80 |
+
{
|
81 |
+
var response = transport.responseText.evalJSON();
|
82 |
+
|
83 |
+
//Element.insert($("download_link"), {bottom: "<a href='" + response.download_link + "'>Download File</a>"});
|
84 |
+
if (response.error)
|
85 |
+
{
|
86 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
87 |
+
style: "background-color:"+config.styles.error.bg,
|
88 |
+
image: config.styles.error.icon,
|
89 |
+
text: response.error.escapeHTML(),
|
90 |
+
id: "error-finish"
|
91 |
+
})});
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($("before-finish-wait-img"))
|
96 |
+
$("before-finish-wait-img").hide();
|
97 |
+
|
98 |
+
$('liFinished').show();
|
99 |
+
}
|
100 |
+
});
|
101 |
+
}
|
102 |
+
else
|
103 |
+
{
|
104 |
+
if (group > 1)
|
105 |
+
{
|
106 |
+
var ids = [];
|
107 |
+
for (var i = 0; i < group; i++)
|
108 |
+
{
|
109 |
+
ids.push(importData.shift());
|
110 |
+
|
111 |
+
if (importData.length == 0)
|
112 |
+
break;
|
113 |
+
}
|
114 |
+
|
115 |
+
sendImportData(ids,"id[]");
|
116 |
+
}
|
117 |
+
else
|
118 |
+
{
|
119 |
+
sendImportData(importData.shift(),"id");
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
function sendImportData(id,id_name)
|
125 |
+
{
|
126 |
+
var data = {}
|
127 |
+
var updated = 1;
|
128 |
+
|
129 |
+
data[id_name] = id;
|
130 |
+
|
131 |
+
if (typeof(id) != 'number')
|
132 |
+
updated = id.length;
|
133 |
+
|
134 |
+
if (!config.tpl)
|
135 |
+
{
|
136 |
+
config.tpl = new Template(config.template);
|
137 |
+
config.tplTxt = new Template(config.text);
|
138 |
+
config.tplSccTxt = new Template(config.successText);
|
139 |
+
//config.tplUploading = new Template(config.uploadText);
|
140 |
+
}
|
141 |
+
if (!$("updatedRows"))
|
142 |
+
{
|
143 |
+
Element.insert($("liFinished"), {before: config.tpl.evaluate({
|
144 |
+
style: "background-color: #FFD;",
|
145 |
+
image: config.styles.loader,
|
146 |
+
text: config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}),
|
147 |
+
id: "updatedRows"
|
148 |
+
})});
|
149 |
+
}
|
150 |
+
countOfStartedProfiles++;
|
151 |
+
|
152 |
+
if (!data.form_key)
|
153 |
+
data.form_key = FORM_KEY;
|
154 |
+
|
155 |
+
data.sync_type = sync_type;
|
156 |
+
|
157 |
+
new Ajax.Request("<?php echo $this->getUrl("*/*/batchRun/");?>",
|
158 |
+
{
|
159 |
+
method: "post",
|
160 |
+
parameters: data,
|
161 |
+
onSuccess: function(transport)
|
162 |
+
{
|
163 |
+
countOfStartedProfiles --;
|
164 |
+
countOfUpdated += updated;
|
165 |
+
if (transport.responseText.isJSON())
|
166 |
+
{
|
167 |
+
var response = transport.responseText.evalJSON();
|
168 |
+
addProfileRow(response);
|
169 |
+
|
170 |
+
if (response.abort) {
|
171 |
+
if ($("before-finish-wait-img")) {
|
172 |
+
$("before-finish-wait-img").hide();
|
173 |
+
}
|
174 |
+
|
175 |
+
$('liAborted').show();
|
176 |
+
return;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
else
|
180 |
+
{
|
181 |
+
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
182 |
+
style: "background-color: "+config.styles.error.bg,
|
183 |
+
image: config.styles.error.icon,
|
184 |
+
text: transport.responseText.escapeHTML(),
|
185 |
+
id: "error-" + countOfStartedProfiles
|
186 |
+
})
|
187 |
+
});
|
188 |
+
countOfError ++;
|
189 |
+
}
|
190 |
+
execImportData();
|
191 |
+
}
|
192 |
+
});
|
193 |
+
}
|
194 |
+
|
195 |
+
function getPercent()
|
196 |
+
{
|
197 |
+
return Math.ceil((countOfUpdated/totalRecords)*1000)/10;
|
198 |
+
}
|
199 |
+
|
200 |
+
function addProfileRow(data)
|
201 |
+
{
|
202 |
+
if (data.errors.length > 0)
|
203 |
+
{
|
204 |
+
for (var i=0, length=data.errors.length; i<length; i++)
|
205 |
+
{
|
206 |
+
Element.insert($("updatedRows"), {before: config.tpl.evaluate({
|
207 |
+
style: "background-color:"+config.styles.error.bg,
|
208 |
+
image: config.styles.error.icon,
|
209 |
+
text: data.errors[i],
|
210 |
+
id: "id-" + (countOfUpdated + i + 1)
|
211 |
+
})});
|
212 |
+
countOfError ++;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
$("updatedRows_status").update(config.tplTxt.evaluate({updated:countOfUpdated, percent:getPercent()}));
|
216 |
+
}
|
217 |
+
</script>
|
218 |
+
|
219 |
+
<script type="text/javascript">
|
220 |
+
if (totalRecords > 0)
|
221 |
+
execImportData();
|
222 |
+
</script>
|
@@ -17,13 +17,13 @@ var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
|
17 |
|
18 |
function getStatus()
|
19 |
{
|
20 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
21 |
{
|
22 |
parameters: {isAjax: 'true', form_key: FORM_KEY, method: "status"},
|
23 |
loaderArea : false,
|
24 |
onSuccess: function(transport)
|
25 |
{
|
26 |
-
try
|
27 |
{
|
28 |
if (transport.responseText.isJSON())
|
29 |
{
|
@@ -36,15 +36,15 @@ function getStatus()
|
|
36 |
{
|
37 |
setLocation(response.ajaxRedirect);
|
38 |
}
|
39 |
-
|
40 |
var status = response.status;
|
41 |
-
|
42 |
if (status.enabled)
|
43 |
{
|
44 |
$("status_state").update("Enabled");
|
45 |
-
|
46 |
seconds = status.duration - status.seconds;
|
47 |
-
|
48 |
statusCounter.setSeconds(seconds);
|
49 |
statusCounter.start();
|
50 |
$('status').value = "yes";
|
@@ -72,7 +72,7 @@ function Countdown(options)
|
|
72 |
seconds = options.seconds || 10,
|
73 |
updateStatus = options.onUpdateStatus || function () {},
|
74 |
counterEnd = options.onCounterEnd || function () {};
|
75 |
-
|
76 |
this.setSeconds = function(new_seconds)
|
77 |
{
|
78 |
options.seconds = new_seconds;
|
@@ -82,7 +82,7 @@ function Countdown(options)
|
|
82 |
{
|
83 |
//console.log(statusCounter.seconds);
|
84 |
updateStatus(seconds);
|
85 |
-
|
86 |
if (seconds === 0)
|
87 |
{
|
88 |
counterEnd();
|
@@ -91,7 +91,7 @@ function Countdown(options)
|
|
91 |
}
|
92 |
seconds--;
|
93 |
}
|
94 |
-
|
95 |
this.start = function ()
|
96 |
{
|
97 |
clearInterval(timer);
|
@@ -99,7 +99,7 @@ function Countdown(options)
|
|
99 |
seconds = options.seconds;
|
100 |
timer = setInterval(decrementCounter, 1000);
|
101 |
};
|
102 |
-
|
103 |
this.stop = function ()
|
104 |
{
|
105 |
clearInterval(timer);
|
@@ -116,46 +116,46 @@ var statusCounter = new Countdown(
|
|
116 |
// calculate (and subtract) whole days
|
117 |
var days = Math.floor(delta / 86400);
|
118 |
delta -= days * 86400;
|
119 |
-
|
120 |
// calculate (and subtract) whole hours
|
121 |
var hours = Math.floor(delta / 3600) % 24;
|
122 |
delta -= hours * 3600;
|
123 |
-
|
124 |
// calculate (and subtract) whole minutes
|
125 |
var minutes = Math.floor(delta / 60) % 60;
|
126 |
delta -= minutes * 60;
|
127 |
-
|
128 |
// what's left is seconds
|
129 |
var seconds = delta % 60;
|
130 |
-
|
131 |
var display = "";
|
132 |
-
|
133 |
if (days > 0)
|
134 |
{
|
135 |
display += " " + days + " day";
|
136 |
if (days != 1)
|
137 |
display += "s";
|
138 |
}
|
139 |
-
|
140 |
if (hours > 0)
|
141 |
{
|
142 |
display += " " + hours + " hour";
|
143 |
if (hours != 1)
|
144 |
display += "s";
|
145 |
}
|
146 |
-
|
147 |
if (minutes > 0)
|
148 |
{
|
149 |
display += " " + minutes + " minute";
|
150 |
if (minutes != 1)
|
151 |
display += "s";
|
152 |
}
|
153 |
-
|
154 |
display += " " + seconds + " second";
|
155 |
-
|
156 |
if (seconds != 1)
|
157 |
display += "s";
|
158 |
-
|
159 |
$('camp_time_remaining').update(display);
|
160 |
}
|
161 |
});
|
17 |
|
18 |
function getStatus()
|
19 |
{
|
20 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/ajax') ?>',
|
21 |
{
|
22 |
parameters: {isAjax: 'true', form_key: FORM_KEY, method: "status"},
|
23 |
loaderArea : false,
|
24 |
onSuccess: function(transport)
|
25 |
{
|
26 |
+
try
|
27 |
{
|
28 |
if (transport.responseText.isJSON())
|
29 |
{
|
36 |
{
|
37 |
setLocation(response.ajaxRedirect);
|
38 |
}
|
39 |
+
|
40 |
var status = response.status;
|
41 |
+
|
42 |
if (status.enabled)
|
43 |
{
|
44 |
$("status_state").update("Enabled");
|
45 |
+
|
46 |
seconds = status.duration - status.seconds;
|
47 |
+
|
48 |
statusCounter.setSeconds(seconds);
|
49 |
statusCounter.start();
|
50 |
$('status').value = "yes";
|
72 |
seconds = options.seconds || 10,
|
73 |
updateStatus = options.onUpdateStatus || function () {},
|
74 |
counterEnd = options.onCounterEnd || function () {};
|
75 |
+
|
76 |
this.setSeconds = function(new_seconds)
|
77 |
{
|
78 |
options.seconds = new_seconds;
|
82 |
{
|
83 |
//console.log(statusCounter.seconds);
|
84 |
updateStatus(seconds);
|
85 |
+
|
86 |
if (seconds === 0)
|
87 |
{
|
88 |
counterEnd();
|
91 |
}
|
92 |
seconds--;
|
93 |
}
|
94 |
+
|
95 |
this.start = function ()
|
96 |
{
|
97 |
clearInterval(timer);
|
99 |
seconds = options.seconds;
|
100 |
timer = setInterval(decrementCounter, 1000);
|
101 |
};
|
102 |
+
|
103 |
this.stop = function ()
|
104 |
{
|
105 |
clearInterval(timer);
|
116 |
// calculate (and subtract) whole days
|
117 |
var days = Math.floor(delta / 86400);
|
118 |
delta -= days * 86400;
|
119 |
+
|
120 |
// calculate (and subtract) whole hours
|
121 |
var hours = Math.floor(delta / 3600) % 24;
|
122 |
delta -= hours * 3600;
|
123 |
+
|
124 |
// calculate (and subtract) whole minutes
|
125 |
var minutes = Math.floor(delta / 60) % 60;
|
126 |
delta -= minutes * 60;
|
127 |
+
|
128 |
// what's left is seconds
|
129 |
var seconds = delta % 60;
|
130 |
+
|
131 |
var display = "";
|
132 |
+
|
133 |
if (days > 0)
|
134 |
{
|
135 |
display += " " + days + " day";
|
136 |
if (days != 1)
|
137 |
display += "s";
|
138 |
}
|
139 |
+
|
140 |
if (hours > 0)
|
141 |
{
|
142 |
display += " " + hours + " hour";
|
143 |
if (hours != 1)
|
144 |
display += "s";
|
145 |
}
|
146 |
+
|
147 |
if (minutes > 0)
|
148 |
{
|
149 |
display += " " + minutes + " minute";
|
150 |
if (minutes != 1)
|
151 |
display += "s";
|
152 |
}
|
153 |
+
|
154 |
display += " " + seconds + " second";
|
155 |
+
|
156 |
if (seconds != 1)
|
157 |
display += "s";
|
158 |
+
|
159 |
$('camp_time_remaining').update(display);
|
160 |
}
|
161 |
});
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$status = $this->getCronStatus();
|
3 |
+
$schedule = $status['schedule'];
|
4 |
+
$lastCampaignerSuccess = $status['last_campaigner_success'];
|
5 |
+
$mode = $this->getMode();
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php if ($mode == "download"): ?>
|
9 |
+
<html>
|
10 |
+
<head>
|
11 |
+
<style>
|
12 |
+
table { border-collapse: collapse; }
|
13 |
+
table tr td { border: solid 1px; padding: 4px; }
|
14 |
+
h4 { border-bottom: solid 1px; }
|
15 |
+
</style>
|
16 |
+
</head>
|
17 |
+
<body>
|
18 |
+
<?php endif; ?>
|
19 |
+
|
20 |
+
<div class="entry-edit">
|
21 |
+
<div class="entry-edit-head">
|
22 |
+
<h4 class="icon-head"><?php echo Mage::helper('campaigner')->__('Cron Troubleshooting') ?></h4>
|
23 |
+
</div>
|
24 |
+
<div class="fieldset">
|
25 |
+
<div class="hor-scroll">
|
26 |
+
<?php if ($lastCampaignerSuccess['working']): ?>
|
27 |
+
<p>Cron seems to be working correctly.</p>
|
28 |
+
<?php else: ?>
|
29 |
+
<p>There appears to be a problem with your cron settings.</p>
|
30 |
+
<?php if ($schedule['info']['Rows'] == 0): ?>
|
31 |
+
<p>There are no entries in your cron schedule table. Please check your cron settings with your service provider.</p>
|
32 |
+
<?php else: ?>
|
33 |
+
<?php if ($status['last_success']['early']): ?>
|
34 |
+
<p>If the module was recently installed, it may be too early to check the cron status.</p>
|
35 |
+
<?php else: ?>
|
36 |
+
<p>It appears that cron was running at some point and has stopped working.</p>
|
37 |
+
<?php endif; ?>
|
38 |
+
<p>The last time that a cron job was executed: <strong><?php echo $status['last_success']['date'] . " (" . $status['last_success']['elapsed'] . " ago)"; ?></strong></p>
|
39 |
+
<?php if (!isset($lastCampaignerSuccess['date']) || ($lastCampaignerSuccess['date'] == null)): ?>
|
40 |
+
<p>None of the Campaigner cron jobs have been executed. Please check the Exception.log file for information or enable Campaigner logging to check the campaigner.log file which can be viewed in the troubleshooting section.</p>
|
41 |
+
<?php else: ?>
|
42 |
+
<p>The last time that a Campaigner cron job was executed: <strong><?php echo $lastCampaignerSuccess['date'] . " (" . $lastCampaignerSuccess['elapsed'] . " ago)"; ?></strong></p>
|
43 |
+
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php if ($mode != "download"): ?>
|
47 |
+
<form id='download_form' method='post' action='<?php echo $this->getUrl("adminhtml/campaigner_troubleshooting/downloadCron") ?>'>
|
48 |
+
<input type='hidden' name='form_key' value='<?php echo $this->getFormKey(); ?>'></input>
|
49 |
+
</form>
|
50 |
+
<button id='download' onclick='return performDownload()'>Download Report</button>
|
51 |
+
<?php endif; ?>
|
52 |
+
<?php endif; ?>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
<div class="entry-edit">
|
58 |
+
<div class="entry-edit-head">
|
59 |
+
<h4 class="icon-head"><?php echo Mage::helper('campaigner')->__('Campaigner Cron Status') ?></h4>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
<div class="grid np">
|
63 |
+
<div class="hor-scroll">
|
64 |
+
<table cellspacing="0" class="data ed-config-table">
|
65 |
+
<thead>
|
66 |
+
<tr class="headings">
|
67 |
+
<th>Cron Job</th>
|
68 |
+
<th>Last Run</th>
|
69 |
+
<th>Enabled</th>
|
70 |
+
</tr>
|
71 |
+
</thead>
|
72 |
+
<tbody>
|
73 |
+
<?php foreach ($status['cron_status'] as $label => $cron_status): ?>
|
74 |
+
<tr>
|
75 |
+
<td><?php echo $label ?></td>
|
76 |
+
<td><?php echo $cron_status['cron_last_run']; ?></td>
|
77 |
+
<td><?php if ($cron_status['enabled']) echo "Enabled"; else echo "Disabled"; ?></td>
|
78 |
+
</tr>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
</tbody>
|
81 |
+
</table>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
<br />
|
85 |
+
<div class="entry-edit">
|
86 |
+
<div class="entry-edit-head">
|
87 |
+
<h4 class="icon-head"><?php echo Mage::helper('campaigner')->__('Cron Schedule Table (Last %s Rows)', $this->getScheduleRowLimit()) ?></h4>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
<div class="grid np">
|
91 |
+
<div class="hor-scroll">
|
92 |
+
<table cellspacing="0" class="data ed-config-table">
|
93 |
+
<thead>
|
94 |
+
<tr class="headings">
|
95 |
+
<th width='1%'>Schedule ID</th>
|
96 |
+
<th>Job Code</th>
|
97 |
+
<th>Status</th>
|
98 |
+
<th>Messages</th>
|
99 |
+
<th>Created At</th>
|
100 |
+
<th>Scheduled At</th>
|
101 |
+
<th>Executed At</th>
|
102 |
+
<th>Finished At</th>
|
103 |
+
</tr>
|
104 |
+
</thead>
|
105 |
+
<?php $class = "even"; ?>
|
106 |
+
<tbody>
|
107 |
+
<?php foreach ($status['schedule']['rows'] as $row): ?>
|
108 |
+
<?php $code = $row['job_code']; ?>
|
109 |
+
<?php $extra_class = ""; ?>
|
110 |
+
<?php if (strpos($code,'campaigner') !== FALSE) {
|
111 |
+
if ($row['executed_at'] == null) {
|
112 |
+
if ($row['minutes_late'] > 60) {
|
113 |
+
$extra_class = " campaigner_schedule_failure";
|
114 |
+
} else {
|
115 |
+
$extra_class = " campaigner_schedule_pending";
|
116 |
+
}
|
117 |
+
} else {
|
118 |
+
$extra_class = " campaigner_schedule_success";
|
119 |
+
}
|
120 |
+
}
|
121 |
+
?>
|
122 |
+
<tr class='border <?php echo $class . $extra_class ?>'>
|
123 |
+
<?php foreach ($row as $key => $column): ?>
|
124 |
+
<?php if ($key != 'minutes_late'): ?>
|
125 |
+
<td><?php echo $column; ?></td>
|
126 |
+
<?php endif; ?>
|
127 |
+
<?php endforeach; ?>
|
128 |
+
</tr>
|
129 |
+
|
130 |
+
<?php $class = ($class == 'even' ? 'odd' : 'even'); ?>
|
131 |
+
<?php endforeach; ?>
|
132 |
+
</tbody>
|
133 |
+
</table>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<?php if ($mode == "download"): ?>
|
138 |
+
</body>
|
139 |
+
</html>
|
140 |
+
<?php else: ?>
|
141 |
+
<script type='text/javascript'>
|
142 |
+
|
143 |
+
function performDownload()
|
144 |
+
{
|
145 |
+
$("download_form").submit();
|
146 |
+
return false;
|
147 |
+
}
|
148 |
+
</script>
|
149 |
+
<?php endif; ?>
|
150 |
+
|
@@ -2,11 +2,11 @@
|
|
2 |
<div class="entry-edit-head">
|
3 |
<h4>Download Report to send to Campaigner</h4>
|
4 |
</div>
|
5 |
-
<div
|
6 |
<div class="hor-scroll">
|
7 |
<p>Click the button below to download the troubleshooting report.</p>
|
8 |
<p>You can then send this report along with your contact information and description of the problem you are having to <a href="mailto:<?php echo $this->getTroubleEmail() ?>?subject=<?php echo $this->getTroubleSubject() ?>"><?php echo $this->getTroubleEmail() ?></a>.</p>
|
9 |
-
<button onclick="setLocation('<?php echo $this->getUrl('
|
10 |
</div>
|
11 |
</div>
|
12 |
</div>
|
2 |
<div class="entry-edit-head">
|
3 |
<h4>Download Report to send to Campaigner</h4>
|
4 |
</div>
|
5 |
+
<div class="fieldset">
|
6 |
<div class="hor-scroll">
|
7 |
<p>Click the button below to download the troubleshooting report.</p>
|
8 |
<p>You can then send this report along with your contact information and description of the problem you are having to <a href="mailto:<?php echo $this->getTroubleEmail() ?>?subject=<?php echo $this->getTroubleSubject() ?>"><?php echo $this->getTroubleEmail() ?></a>.</p>
|
9 |
+
<button onclick="setLocation('<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/download/') ?>'); return false;">Download Report</button>
|
10 |
</div>
|
11 |
</div>
|
12 |
</div>
|
@@ -133,6 +133,69 @@ C<br />
|
|
133 |
<div class='sequence_example'>
|
134 |
1<br />2<br />3<br />4<br />5
|
135 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
<!-- ABANDONED CARTS -->
|
137 |
<h2><a name='abandoned_carts'></a>Abandoned Carts</h2>
|
138 |
<p>In order for abandoned carts to be processed automatically, cron must be running on your server.</p>
|
@@ -144,7 +207,7 @@ C<br />
|
|
144 |
<h3>Orders</h3>
|
145 |
<p>To run Diagnostics on an order, go to the Order View page and select the <strong>Campaigner Diagnostics</strong> tab on the left side of the screen.</p>
|
146 |
<h3>Abandoned Carts</h3>
|
147 |
-
<p>To run Diagnostics on an abandoned cart, go to the <a href='<?php echo $this->getUrl('
|
148 |
<h2><a name='uninstall'></a>Uninstall</h2>
|
149 |
<h3>Magento Connect Manager</h3>
|
150 |
<p>Only modules installed using the Magento Connect Manager can be uninstalled through the admin interface.</p>
|
133 |
<div class='sequence_example'>
|
134 |
1<br />2<br />3<br />4<br />5
|
135 |
</div>
|
136 |
+
<h2>Purchase Behavior Targeting Configuration</h2>
|
137 |
+
<h3>Orders</h3>
|
138 |
+
<h4>Send orders to Campaigner</h4>
|
139 |
+
<p>Must be set to Yes in order to send order, product or category information to Campaigner.</p>
|
140 |
+
<h4>API Key</h4>
|
141 |
+
<p>You must enter an API Key from your Campaigner account. You can retrieve an API Key by going to your Campaigner account and clicking on Account Setup, then navigating to the API Keys tab.</p>
|
142 |
+
<p>After entering your API Key, press the "Validate" button and once the key has been validated press the "Save Config" button.</p>
|
143 |
+
<h4>Send Orders based on</h4>
|
144 |
+
<p>Choose whether orders will be sent based on order State or Status.</p>
|
145 |
+
<h4>State or Status Options</h4>
|
146 |
+
<p>This allows you to choose which order state(s)/statuses will be used to determine when an order will be sent to Campaigner.</p>
|
147 |
+
<p>This will include all custom states or statuses that you have created within your Magento store and selecting multiple options will not send the order twice.</p>
|
148 |
+
<h4>Send Orders in the background?</h4><p>Allows you to send orders through a cron process.</p>
|
149 |
+
<h4>Send in background only?</h4><p>Orders will only be sent in the background process.</p>
|
150 |
+
<h3>Products and Product Categories</h3>
|
151 |
+
<h4>Automatically sync product and product category information?</h4>
|
152 |
+
<p>Sends any updates you make to product or product category information to Campaigner in the background.</p>
|
153 |
+
<h2>Sync Configuration</h2>
|
154 |
+
<h3>Customers</h3>
|
155 |
+
<p>Customer Sync can only be performed if the module is enabled and the API Username and Password are setup in the General Configuration.</p>
|
156 |
+
<h4>Include Customers already sent?</h4>
|
157 |
+
<p>This setting allows you to resend any customers that have already been sent to Campaigner along with any unsent customers.</p>
|
158 |
+
<h4>Subscribe to lists</h4>
|
159 |
+
<p>Select the lists you want to subscribe these customers to in Campaigner. Can be left blank.</p>
|
160 |
+
<h4>Include latest orders?</h4>
|
161 |
+
<p>Selecting Yes will include detailed information for up to 3 products from the customer's latest order.</p>
|
162 |
+
<h4>Include abandoned carts?</h4>
|
163 |
+
<p>Include abandoned cart information with each customer.</p>
|
164 |
+
<h4>Add a sequence value to each abandoned cart?</h4>
|
165 |
+
<p>This will allow you to assign a sequence of values to your subscribers, one for each abandoned shopping cart. For every abandoned cart, the next value in the list will be applied and over write any past values that were assigned.</p>
|
166 |
+
<p>The sequence settings here are for customer sync only and will not override your normal abandoned cart settings.</p>
|
167 |
+
<h4>Sequence Database Field</h4>
|
168 |
+
<p>This is the field within Campaigner that the sequence will be stored in.</p>
|
169 |
+
<h4>Sequence Options</h4>
|
170 |
+
<p>Put a list of sequences that will help you identify and filter for A/B testing your abandoned cart
|
171 |
+
process. This can include any identifying information and can include as many as you want, enter one per line.</p>
|
172 |
+
<p>Example:</p>
|
173 |
+
<div class='sequence_example'>
|
174 |
+
A<br />
|
175 |
+
B<br />
|
176 |
+
C<br />
|
177 |
+
</div>
|
178 |
+
<p>Or</p>
|
179 |
+
<div class='sequence_example'>
|
180 |
+
1<br />2<br />3<br />4<br />5
|
181 |
+
</div>
|
182 |
+
<h4>Customer Date Range</h4>
|
183 |
+
<p>Select the range of dates that you wish to collect customers from.</p>
|
184 |
+
<h4>Send Customers</h4>
|
185 |
+
<p>This will open a new window to send your customers to Campaigner in batches.</p>
|
186 |
+
<h3>Orders</h3>
|
187 |
+
<p>Order Sync can only be performed if the both the module and Purchase Behavior Targeting are enabled. Both an API Username and Password and API Key are required.</p>
|
188 |
+
<h4>Include Orders already sent?</h4>
|
189 |
+
<p>This will allow you to include orders that may have previously been sent to Campaigner and may cause duplicates. We recommend leaving this option set to No, unless you have deleted orders within Campaigner and wish to get them back.</p>
|
190 |
+
<h4>Order Date Range</h4>
|
191 |
+
<p>Select the range of dates that you wish to collect orders from. If the extension is pushing new orders over to Campaigner, select the date ranges in which this process was not running to avoid duplicate orders.</p>
|
192 |
+
<h4>Send Orders</h4>
|
193 |
+
<p>This will open a new window to send your orders to Campaigner in batches.</p>
|
194 |
+
<h3>Products</h3>
|
195 |
+
<p>Product Sync can only be performed if the both the module and Purchase Behavior Targeting are enabled. Both an API Username and Password and API Key are required.</p>
|
196 |
+
<h4>Include Disabled Products</h4><p>This will grab all products in Magento to be passed over to Campaigner, even those
|
197 |
+
which have been disabled.</p>
|
198 |
+
<h4>Send Products</h4><p>This will open a new window to send your products and categories to Campaigner in batches.</p>
|
199 |
<!-- ABANDONED CARTS -->
|
200 |
<h2><a name='abandoned_carts'></a>Abandoned Carts</h2>
|
201 |
<p>In order for abandoned carts to be processed automatically, cron must be running on your server.</p>
|
207 |
<h3>Orders</h3>
|
208 |
<p>To run Diagnostics on an order, go to the Order View page and select the <strong>Campaigner Diagnostics</strong> tab on the left side of the screen.</p>
|
209 |
<h3>Abandoned Carts</h3>
|
210 |
+
<p>To run Diagnostics on an abandoned cart, go to the <a href='<?php echo $this->getUrl('adminhtml/campaigner_abandoned/index') ?>'>Campaigner Abandoned Carts Page</a> and click on a row to run diagnostics on that cart.</p>
|
211 |
<h2><a name='uninstall'></a>Uninstall</h2>
|
212 |
<h3>Magento Connect Manager</h3>
|
213 |
<p>Only modules installed using the Magento Connect Manager can be uninstalled through the admin interface.</p>
|
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
$environment = $this->getEnvironmentInfo();
|
3 |
$store_configuration = $this->getConfigurationInfo();
|
4 |
$row = "even";
|
5 |
?>
|
@@ -18,15 +18,17 @@ $row = "even";
|
|
18 |
<th>Value</th>
|
19 |
</tr>
|
20 |
</thead>
|
|
|
21 |
<?php foreach ($environment as $key => $value): ?>
|
22 |
-
|
23 |
-
<tr class='border'>
|
24 |
<td><?php echo $key; ?></td>
|
25 |
<td><?php echo $value; ?></td>
|
26 |
-
</tr>
|
27 |
-
|
28 |
<?php $row = ($row == 'even' ? 'odd' : 'even'); ?>
|
29 |
-
<?php endforeach; ?>
|
|
|
30 |
</table>
|
31 |
</div>
|
32 |
</div>
|
@@ -38,7 +40,7 @@ $row = "even";
|
|
38 |
</div>
|
39 |
</div>
|
40 |
<div class="grid np">
|
41 |
-
|
42 |
<table cellspacing="0" class="data ed-config-table">
|
43 |
<thead>
|
44 |
<tr class="headings">
|
@@ -46,18 +48,20 @@ $row = "even";
|
|
46 |
<th>Value</th>
|
47 |
</tr>
|
48 |
</thead>
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
</div>
|
62 |
<br />
|
63 |
<?php endforeach; ?>
|
1 |
<?php
|
2 |
+
$environment = $this->getEnvironmentInfo();
|
3 |
$store_configuration = $this->getConfigurationInfo();
|
4 |
$row = "even";
|
5 |
?>
|
18 |
<th>Value</th>
|
19 |
</tr>
|
20 |
</thead>
|
21 |
+
<tbody>
|
22 |
<?php foreach ($environment as $key => $value): ?>
|
23 |
+
|
24 |
+
<tr class='border <?php echo $row ?>'>
|
25 |
<td><?php echo $key; ?></td>
|
26 |
<td><?php echo $value; ?></td>
|
27 |
+
</tr>
|
28 |
+
|
29 |
<?php $row = ($row == 'even' ? 'odd' : 'even'); ?>
|
30 |
+
<?php endforeach; ?>
|
31 |
+
</tbody>
|
32 |
</table>
|
33 |
</div>
|
34 |
</div>
|
40 |
</div>
|
41 |
</div>
|
42 |
<div class="grid np">
|
43 |
+
<div class="hor-scroll">
|
44 |
<table cellspacing="0" class="data ed-config-table">
|
45 |
<thead>
|
46 |
<tr class="headings">
|
48 |
<th>Value</th>
|
49 |
</tr>
|
50 |
</thead>
|
51 |
+
<tbody>
|
52 |
+
<?php $row = 'even';
|
53 |
+
foreach ($configuration as $key => $value): ?>
|
54 |
+
|
55 |
+
<tr class='border <?php echo $row ?>'>
|
56 |
+
<td><?php echo $key; ?></td>
|
57 |
+
<td><?php echo $value; ?></td>
|
58 |
+
</tr>
|
59 |
+
|
60 |
+
<?php $row = ($row == 'even' ? 'odd' : 'even'); ?>
|
61 |
+
<?php endforeach; ?>
|
62 |
+
</tbody>
|
63 |
+
</table>
|
64 |
+
</div>
|
65 |
</div>
|
66 |
<br />
|
67 |
<?php endforeach; ?>
|
@@ -1,19 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div class="entry-edit">
|
2 |
<div class="entry-edit-head">
|
3 |
-
<h4 class="icon-head"><?php echo
|
4 |
<div class="tools">
|
5 |
<a href='#' onclick="return performRequest('log_refresh',false);">Refresh</a>
|
6 |
-
<span> | </span>
|
7 |
-
<a href='#' onclick="return performRequest('erase_log',true);">Erase Log</a>
|
8 |
-
<span> | </span>
|
9 |
-
<a href='#' onclick="return performRequest('test_logging',false);">Test Logging</a>
|
10 |
</div>
|
11 |
</div>
|
12 |
<div class='logfile-fieldset'>
|
13 |
<div class='logfile-container'>
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
</div>
|
18 |
</div>
|
19 |
</div>
|
@@ -21,6 +35,38 @@
|
|
21 |
<script type='text/javascript'>
|
22 |
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
function showLogFile(contents)
|
25 |
{
|
26 |
$("logfile_contents").update("<pre>" + contents + "</pre>");
|
@@ -40,9 +86,9 @@ function performRequest(method, get_confirmation)
|
|
40 |
if (!window.confirm("Are you sure?"))
|
41 |
return;
|
42 |
}
|
43 |
-
new Ajax.Request('<?php echo $this->getUrl('
|
44 |
{
|
45 |
-
parameters: {isAjax: 'true', form_key: FORM_KEY, method: method},
|
46 |
onSuccess: function(transport)
|
47 |
{
|
48 |
try
|
@@ -71,4 +117,4 @@ function performRequest(method, get_confirmation)
|
|
71 |
|
72 |
return false;
|
73 |
}
|
74 |
-
</script>
|
1 |
+
<?php
|
2 |
+
$logFiles = $this->getLogFiles();
|
3 |
+
$selected = $this->getSelectedLog();
|
4 |
+
$default = $this->getDefaultLog();
|
5 |
+
$count = 0;
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div>
|
9 |
+
<?php foreach ($logFiles as $file): ?>
|
10 |
+
<?php if ($count++ > 0) echo "<span> | </span>";?>
|
11 |
+
<a href="#" id="<?php echo $file; ?>" <?php if ($selected == $file) echo " style='font-weight:bold;'"; ?> onclick="return switchLog('<?php echo $file ?>');"><?php echo $file; ?></a>
|
12 |
+
<?php endforeach; ?>
|
13 |
+
</div>
|
14 |
+
<br />
|
15 |
<div class="entry-edit">
|
16 |
<div class="entry-edit-head">
|
17 |
+
<h4 class="icon-head" id='current_logfile'><?php echo $selected ?></h4>
|
18 |
<div class="tools">
|
19 |
<a href='#' onclick="return performRequest('log_refresh',false);">Refresh</a>
|
20 |
+
<span id='erase_log_sep'> | </span>
|
21 |
+
<a href='#' onclick="return performRequest('erase_log',true);" id='erase_log'>Erase Log</a>
|
22 |
+
<span id='test_log_sep'> | </span>
|
23 |
+
<a href='#' onclick="return performRequest('test_logging',false);" id='test_log'>Test Logging</a>
|
24 |
</div>
|
25 |
</div>
|
26 |
<div class='logfile-fieldset'>
|
27 |
<div class='logfile-container'>
|
28 |
+
<div class="entry-logfile" id='logfile_contents'>
|
29 |
+
<pre><?php echo $this->getLogFile() ?></pre>
|
30 |
+
</div>
|
31 |
</div>
|
32 |
</div>
|
33 |
</div>
|
35 |
<script type='text/javascript'>
|
36 |
var FORM_KEY = "<?php echo $this->getFormKey();?>";
|
37 |
|
38 |
+
var selected = '<?php echo $selected; ?>';
|
39 |
+
|
40 |
+
function switchLog(file)
|
41 |
+
{
|
42 |
+
$('current_logfile').update(file);
|
43 |
+
if (file == '<?php echo $default; ?>') {
|
44 |
+
$('erase_log').show();
|
45 |
+
$('erase_log_sep').show();
|
46 |
+
$('test_log').show();
|
47 |
+
$('test_log_sep').show();
|
48 |
+
} else {
|
49 |
+
$('erase_log').hide();
|
50 |
+
$('erase_log_sep').hide();
|
51 |
+
$('test_log').hide();
|
52 |
+
$('test_log_sep').hide();
|
53 |
+
}
|
54 |
+
|
55 |
+
$(selected).setStyle({
|
56 |
+
fontWeight: 'normal'
|
57 |
+
});
|
58 |
+
|
59 |
+
selected = file;
|
60 |
+
|
61 |
+
$(selected).setStyle({
|
62 |
+
fontWeight: 'bold'
|
63 |
+
});
|
64 |
+
|
65 |
+
performRequest('log_refresh',false);
|
66 |
+
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
function showLogFile(contents)
|
71 |
{
|
72 |
$("logfile_contents").update("<pre>" + contents + "</pre>");
|
86 |
if (!window.confirm("Are you sure?"))
|
87 |
return;
|
88 |
}
|
89 |
+
new Ajax.Request('<?php echo $this->getUrl('adminhtml/campaigner_troubleshooting/ajax') ?>',
|
90 |
{
|
91 |
+
parameters: {isAjax: 'true', form_key: FORM_KEY, method: method, file: selected},
|
92 |
onSuccess: function(transport)
|
93 |
{
|
94 |
try
|
117 |
|
118 |
return false;
|
119 |
}
|
120 |
+
</script>
|
@@ -13,11 +13,11 @@ $diagnostic_enabled = Mage::helper('campaigner/troubleshooting')->isDiagnosticEn
|
|
13 |
<div class="entry-edit-head">
|
14 |
<h4>Troubleshooting Settings</h4>
|
15 |
</div>
|
16 |
-
<div
|
17 |
|
18 |
|
19 |
<div class="hor-scroll">
|
20 |
-
<form id='campaigner_settings_form' action='<?php echo Mage::helper('campaigner')->getAdminUrl("
|
21 |
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
|
22 |
|
23 |
<table cellspacing="0" class="form-list">
|
13 |
<div class="entry-edit-head">
|
14 |
<h4>Troubleshooting Settings</h4>
|
15 |
</div>
|
16 |
+
<div class="fieldset">
|
17 |
|
18 |
|
19 |
<div class="hor-scroll">
|
20 |
+
<form id='campaigner_settings_form' action='<?php echo Mage::helper('campaigner')->getAdminUrl("adminhtml/campaigner_troubleshooting/save"); ?>' method='post'>
|
21 |
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
|
22 |
|
23 |
<table cellspacing="0" class="form-list">
|
@@ -10,9 +10,9 @@
|
|
10 |
<div class="entry-edit-head">
|
11 |
<h4>Send Information to Campaigner</h4>
|
12 |
</div>
|
13 |
-
<div
|
14 |
<div class="hor-scroll">
|
15 |
-
<form id='campaigner_submit_form' action='<?php echo $this->getUrl("
|
16 |
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
|
17 |
<table cellspacing="0" class="form-list">
|
18 |
<tbody>
|
10 |
<div class="entry-edit-head">
|
11 |
<h4>Send Information to Campaigner</h4>
|
12 |
</div>
|
13 |
+
<div class="fieldset">
|
14 |
<div class="hor-scroll">
|
15 |
+
<form id='campaigner_submit_form' action='<?php echo $this->getUrl("adminhtml/campaigner_troubleshooting/send"); ?>' method='post'>
|
16 |
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
|
17 |
<table cellspacing="0" class="form-list">
|
18 |
<tbody>
|
@@ -1,18 +1,24 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Campaigner_Integration</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license/>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Campaigner integration for Magento</summary>
|
10 |
<description>Campaigner integration for Magento</description>
|
11 |
-
<notes
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>Mark Cerullo</name><user>auto-converted</user><email>integrations@campaigner.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>16:
|
15 |
-
<contents><target name="magecommunity"><dir name="Campaigner"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><dir name="Details"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="8a19e2e94944ca44fb36b1f1eea2c57e"/></dir><file name="Cart.php" hash="eeb38260b64b43d9d7ae59e27733b269"/><file name="Diagnostics.php" hash="e8fb26b980ead6d7ce9adaa0ccf391d2"/></dir><file name="Form.php" hash="59f4ae15758308ff52cd951d863f13ce"/></dir><file name="Details.php" hash="ccbce1ea6eb14476937df78c721cfba4"/><file name="Grid.php" hash="1155cba06b4d55f87461845e65f91e2c"/><file name="Status.php" hash="dd498f84c5f6beba1bfb465c5e5f9279"/><file name="Tabs.php" hash="ece0311585223168e00396c449e66c40"/></dir><dir name="Diagnostics"><dir name="Status"><file name="Abstract.php" hash="26a7456053abc173fbf8aaf3f68d7ab8"/></dir></dir><dir name="Latest"><file name="Grid.php" hash="fb6f191f0fd9d27f1550ff2caa75c229"/><file name="Status.php" hash="18c32fdc47887ea3231833ca6585362d"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="7d1f4659d72038a03281345bb7798ea1"/></dir><dir name="Form"><dir name="Field"><dir name="Signup"><file name="Test.php" hash="e4489f226eeef06c504b920847ff9593"/></dir><dir name="Smtp"><file name="Server.php" hash="3535455e2c04b70e9a52ef0bc9d00088"/><file name="Test.php" hash="933c8c06879a2e278b4757223fed1c53"/></dir><file name="Addressmapfields.php" hash="55c88d6e85ca0e73e54b842e0e7ab4ba"/><file name="Api.php" hash="549b18aaf277a7ae46408865f195ee81"/><file name="Common.php" hash="c421a4ca9e6bc2c1c64429f3640cc427"/><file name="Diagnostics.php" hash="05bdb6a63bc4742432af8dfb0ffd0a2a"/><file name="Info.php" hash="525c685749a05461e33f3f0df4f146c7"/><file name="Logging.php" hash="183cd28a3156a024455fd854730c859e"/><file name="Mapfields.php" hash="80c79d853273c16e3be073a18c2ec011"/><file name="Note.php" hash="7ba64e042e476f4b8ca6741f3880df23"/><file name="Shippingmapfields.php" hash="741d75b6e332151dba21befccd95ddc7"/><file name="Smtp.php" hash="93eabbd4c24a4001bb5808e51e9d43a0"/></dir></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="8d47397381bc8286c22188c2f6e015e3"/><file name="Help.php" hash="90ec5834c9c198518bbab0536d60d945"/><file name="Info.php" hash="6ce83e41898da9792868bc42e889a429"/><file name="Log.php" hash="a9281138b7791a6a4e5ad2a35623a61d"/><file name="Settings.php" hash="bd0b189a1b1cc313ed0bb96b869a04f8"/><file name="Submit.php" hash="7f5481630cd9f115aa801d16314b8edf"/></dir><file name="Form.php" hash="0809b7e09e2a932bab3f2c85e95516da"/></dir><file name="Status.php" hash="5032e69d110bc15a20ddabd492a2c9e3"/><file name="Tabs.php" hash="08299230ebb95078adf10bd9242b42cc"/><file name="View.php" hash="4e045d938bdddfd5af9917db56f2c8df"/></dir><file name="Abandoned.php" hash="a7d349903733493af5cd3713bad1ec70"/><file name="Latest.php" hash="48e49078842a436c7ce662f5ea745020"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="2d31ac46504200508ffb142e35acb0b9"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Abandoned"><file name="Minutes.php" hash="67c46d39f2824b0288974b6927a98dac"/></dir><file name="Action.php" hash="a8454d2d40609f2de12bdbc0a9f3a551"/></dir></dir></dir></dir><file name="Capture.php" hash="e2f1e84334b5e63fbac13399f76be136"/><file name="Signup.php" hash="3cfb414ed7fc6d6b866d38b296fad7cc"/></dir><dir name="Controller"><dir name="Front"><file name="Abstract.php" hash="1ec0fbe702b70b33cf21097f2472f165"/></dir></dir><dir name="Helper"><file name="Abandoned.php" hash="e05cf79f7862f6e22c675737e97e8474"/><file name="Data.php" hash="52d9de4457d78d89094be8e34cd2a31b"/><file name="Diagnostic.php" hash="0382ce6337fc845fb099ff79507a64ef"/><file name="Email.php" hash="b23abe06562ae3bfc02093d56ea61807"/><file name="Fields.php" hash="87e4067a0bf8091593af31f6978e704d"/><file name="Order.php" hash="822946957285c469a70c1a48c143abee"/><file name="Troubleshooting.php" hash="48915a6a5b68c1b5d60a617e7b4cab8f"/></dir><dir name="Model"><dir name="Abandoned"><file name="Observer.php" hash="582d143f0c57d80f17c82c8312860d94"/></dir><dir name="Action"><file name="List.php" hash="ba8f9239b1c3aba92a870aec4c5e5fd3"/><file name="Observer.php" hash="3d74517e8d5548e06fc669634951b285"/></dir><dir name="Configuration"><file name="Observer.php" hash="71d2841a4f68c3f344e73bd69bf5b363"/></dir><dir name="Customer"><file name="Observer.php" hash="f49389ad3ba057dad9b11e79c28ba88b"/></dir><dir name="Email"><file name="Queue.php" hash="a755044d7d354ac2d3c31dba230eb005"/><file name="Template.php" hash="26096ed08f0339b836938abd7ecec2c5"/></dir><dir name="Latest"><file name="Order.php" hash="15cff0518a0e053bffaa2d8f6113778a"/></dir><dir name="Mysql4"><dir name="Abandoned"><file name="Collection.php" hash="3f68e0ebf3ca9293473ed52551834a0f"/></dir><dir name="Action"><dir name="List"><file name="Collection.php" hash="b901ec897893ace7b3a47b7ce63d1825"/></dir><file name="List.php" hash="d31fdb94086b8c2feca37384af08ae7a"/></dir><dir name="Latest"><dir name="Order"><file name="Collection.php" hash="487eab71efa04552566a1260012a5845"/></dir><file name="Order.php" hash="1b25cfbe2923690187bed3a982968d07"/></dir><dir name="Order"><file name="Collection.php" hash="f751237abc91e49544a473bdf2a5e35d"/></dir><dir name="Session"><file name="Collection.php" hash="629816a4bf1be669d1ed677744357f61"/></dir><file name="Abandoned.php" hash="cd4ca2dbc8f0758a3835a4b870fedcaa"/><file name="Order.php" hash="5bac34cb7dc1d4d2db838894438034fd"/><file name="Session.php" hash="cafb42130e54bea5461e0f709bb09214"/></dir><dir name="Newsletter"><file name="Observer.php" hash="cb0c0946fdfaab2b5939eef840eb7ea6"/></dir><dir name="Observer"><file name="Abstract.php" hash="9ac37b03684b20cddcfd97b6a6f3170b"/></dir><dir name="Order"><file name="Observer.php" hash="0f566abaad6dc86719c75a0b2322b8dc"/></dir><dir name="Resource"><file name="Setup.php" hash="952230e5b0632c3441c20bbfc386ec4f"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Send"><file name="Field.php" hash="e4ea62f64f043668f00eb627837cc6d4"/></dir><dir name="Sequence"><file name="Scope.php" hash="bcf820524f3a9ce5a62569767c8248e3"/></dir><dir name="Signup"><file name="Opacity.php" hash="bd3370611c9551efd53d84565e5cb234"/><file name="Recurrence.php" hash="aa42d1124016892bad804a43dbe0138e"/></dir><dir name="Smtp"><file name="Encryption.php" hash="5447e71037ae34960fff66479d7152c1"/></dir><file name="Abandonedlist.php" hash="64f11bdc40e02d614bb1282c6fb762b8"/><file name="Additionallist.php" hash="84454d9fd80e411efc8540d9dcb51888"/><file name="Checkoutsubscribe.php" hash="c4f2e403652fb6438ec993af3ba0c7b9"/><file name="List.php" hash="6c9784a917109e7b6812b147ffba733e"/><file name="Sequence.php" hash="705c04c54e730c5feadad07d7a01e050"/><file name="States.php" hash="b3bc4e2c3ee3caac578909b85962bf3d"/><file name="Statuses.php" hash="6cd4cd287608cd0ed30088ded5ee5c42"/><file name="Store.php" hash="e0a4863f576e202e66b6fe4bd1ddc12c"/><file name="Time.php" hash="3c402071ddd3dd01bd49717fe5d5016e"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="9fbd98b3d5150ba55d1bb5bd2a071c53"/><file name="Abstract.php" hash="0748d215889a2dfda1a164237ff01905"/><file name="Database.php" hash="164de5c78c9912225afed7192a1a3f7c"/><file name="Exception.php" hash="7e2f930f4106b5d91e595dcac75f6c62"/><file name="Execute.php" hash="f30674355173dd9dd27a69dada96ed61"/><file name="Lists.php" hash="38f8e6989bd6cba51e1f2a41b9529042"/><file name="Orders.php" hash="d741e48adf06eecbe76f92c342ce8cca"/><file name="Subscribers.php" hash="ef30903cc31ce2e0e75c7d1219afa124"/><file name="Wishlist.php" hash="8139aaef7923f7e9313a85d7ecaed853"/></dir><file name="Abandoned.php" hash="3121570ce6e5faf0fcc7aeea98ffa562"/><file name="Observer.php" hash="8e69e0fe1d659a5413ac578dc72299ad"/><file name="Order.php" hash="9a66161a19226a724ebdaa0df847b847"/><file name="Session.php" hash="f25cc2990b4baca8a1265165938f3592"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="f04a9d6af44e95d6dfbcef01c1529142"/><file name="DiagnosticController.php" hash="4f9a5b21d482a9e717887dbccb4bc113"/><file name="LatestController.php" hash="2342b1ecd3003e2340281ad391b5dad3"/><file name="TroubleshootingController.php" hash="be5d0064879d8aa639dbb783feede0a6"/></dir><dir name="Customer"><file name="AccountController.php" hash="948146143dad1495cf5770d5b26df5e5"/></dir><file name="AbandonedController.php" hash="348d8e52d4d439695ecb35c3707345f9"/><file name="CaptureController.php" hash="f4b3dbd7fed2ba835679a465999b6e8d"/><file name="SignupController.php" hash="9f22f1599ec5ca4159dca1f5597dc5b8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="68e19d887bf7ca5641222a68fbd6c8dd"/><file name="config.xml" hash="f2ee047ee76f0cbd9fd5e3e5176474e6"/><file name="system.xml" hash="c02822a1f889fdaae5b63a4404da6803"/></dir><dir name="sql"><dir name="campaigner_setup"><file name="mysql4-install-1.0.0.php" hash="80c1aae7aa0da201429e58f2990128c6"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="65b76f1e85f2ab9f4b17f985fc7be0b8"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="campaigner"><file name="campaigner-tab.png" hash="181849ccef5e616db6aae38a229a759a"/><file name="campaigner.css" hash="84bd6e6afaa0f225faf403046416a5f8"/><file name="logo.png" hash="d73185d0f531abdfb30c95b1305e9c3b"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="campaigner"><dir name="images"><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="campaigner.css" hash="57204bebe8e822a80be8ede51d0c0491"/><file name="integration.js" hash="027627a14bfe078ef56c34202d5c9a19"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="campaigner.xml" hash="0a6c410360dd033e295921873e539bb4"/></dir><dir name="template"><dir name="campaigner"><dir name="abandoned"><dir name="details"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="89eb5aeb29d09d7cc31f33c8d0d9573a"/></dir><file name="cart.phtml" hash="e826e27563af99f9217477b59208853a"/></dir><file name="form.phtml" hash="60633d212382770e99d11d24ae919e47"/></dir><file name="details.phtml" hash="a0569efc165c9435e53c036d468d05ca"/><file name="status.phtml" hash="cfe2fa838e1c68522fa018a17db1c5c2"/></dir><dir name="latest"><file name="status.phtml" hash="3a322cbe915c3252e69ed2e6b1e39a42"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="313fedffa1c7c9079ea4f09387e58eef"/></dir><dir name="form"><dir name="field"><dir name="export"><file name="date_range.phtml" hash="746bf1adb96eb46b4d43f9f4a39c2040"/><file name="orders.phtml" hash="6264bb43770229c38ce12e57886b4787"/><file name="products.phtml" hash="92deede7e13c573897b84262bb55e16d"/></dir><dir name="signup"><file name="test.phtml" hash="a9921c7483bbaf56c0bf98e41a672e1e"/></dir><dir name="smtp"><file name="test.phtml" hash="b5ed32a1e695c6fdf011dc6e1b5801fd"/></dir><file name="api.phtml" hash="8f406515a32962902a055554ac313261"/><file name="array.phtml" hash="082111176e5dac1d0e1f1eec1b1fc5d4"/><file name="diagnostics.phtml" hash="a6e51e54eade038052caa12542a1b163"/><file name="info.phtml" hash="9d3d76056542cb7ecdbbc03551cea432"/><file name="logging.phtml" hash="eafec906a6f3d67b48e138009b0134bb"/><file name="note.phtml" hash="8df6563e1e33c8047d3c399dbe43d476"/><file name="smtp.phtml" hash="0c3151b4d7f34d6cf96f9fd2bfe210fd"/></dir></dir><file name="setup_check.phtml" hash="74f11286e25cea96fdb87642b96d62ec"/></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="c0cc0401d8a4b4cda36b3f28d09c98a8"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="72265504ae19264e31b3e0f5814b219b"/><file name="help.phtml" hash="40398a7ac0d4617956815d627fe086ca"/><file name="info.phtml" hash="53d09908246eade525571ef809e40735"/><file name="log.phtml" hash="db325e68b0584162fa3c2c082a029421"/><file name="settings.phtml" hash="218160085bc1745971cb80216704816e"/><file name="submit.phtml" hash="650f228e6be47ed72a8dfd636fb85512"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="status.phtml" hash="2a11a1c817fdcc7ea8c402583a85bbf4"/><file name="view.phtml" hash="6ddfc8c6efe25d30e63f792b19a95c84"/></dir><file name="diagnostics.phtml" hash="ca3b12f1caf598a0006c7a17bc78ea18"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="campaigner.xml" hash="5c81b7e0468c3c5d411cfede758f9311"/></dir><dir name="template"><dir name="campaigner"><dir name="capture"><file name="email.phtml" hash="fa273ff1a48a12eb386f58f3e3e78f66"/></dir><dir name="checkout"><file name="subscribe.phtml" hash="fd0671d9d8186d7c93e2c2eb5dbffaeb"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="eb8b4743f1a37ac4e9d2d71dae71f65d"/></dir><file name="lists.phtml" hash="e20050217381c740bcffe3dfddff222a"/><file name="unsubscribed.phtml" hash="66a0e1ae8f7fa7e7770c931e2bb73244"/></dir></dir><dir name="signup"><file name="form.phtml" hash="87f1ced5f634d2816a37bca3797ecacf"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="newsletter_subscr_success_campaigner.html" hash="f6afb69d207bbc3f8920e7a72ac9dd07"/><file name="newsletter_unsub_success_campaigner.html" hash="bd9f97e8f5485180d4420097b5200ef4"/><file name="campaigner_relay_test.html" hash="3e01c93e616154068ea4b841802acf2f"/></dir></dir><file name="Campaigner_Integration.csv" hash="d107a2ee0ccd206831a19e21f0e13ad6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Campaigner_Integration.xml" hash="d7311dea93c926305f8ed67be1c1fc12"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Campaigner_Integration</name>
|
4 |
+
<version>1.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license/>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Campaigner integration for Magento</summary>
|
10 |
<description>Campaigner integration for Magento</description>
|
11 |
+
<notes>- Send full order, product, and category data to Campaigner: Target your subscribers by the products they purchase, the amount of money they spend, the categories they shop in and more! Campaigner’s Magento extension now automatically sends order and product information into your Campaigner database. Order information sent to Campaigner includes Email Address, Order Number, Product Name, SKU, Purchase Price, Purchase Date and more. Category/product data will be moved to Campaigner gradually as orders are moved, but it can alternatively be moved in bulk (using new sync features, see below) or automatically any time you make a change to a product or category in Magento. This information will appear in the e-Commerce tab of your Campaigner account; if you don't see the e-Commerce main navigation tab, contact Campaigner Sales before you begin. 
|
12 |
+

|
13 |
+
- Bulk data synchronization: Get started quickly by importing your Magento subscriber data directly into Campaigner®. Send orders and product information in bulk to kick start segmentation-driven drip campaigns right after a fresh install or at any time afterwards to keep your email marketing initiatives and Magento activities seamlessly in sync.
|
14 |
+

|
15 |
+
- Trigger Campaigner workflows: Choose whether or not subscriber actions (profile updates and subscription preferences) performed in your Magento storefront will trigger any related, active workflows set up in your Campaigner account.
|
16 |
+

|
17 |
+
- Tracking background tasks: additional sections have been added to the 'Management' menu item under the 'Campaigner' main navigation tab to display information on data transfer activities relating to orders, products, and categories.</notes>
|
18 |
<authors><author><name>Mark Cerullo</name><user>auto-converted</user><email>integrations@campaigner.com</email></author></authors>
|
19 |
+
<date>2016-05-13</date>
|
20 |
+
<time>16:56:47</time>
|
21 |
+
<contents><target name="magecommunity"><dir name="Campaigner"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><dir name="Details"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="8a19e2e94944ca44fb36b1f1eea2c57e"/></dir><file name="Cart.php" hash="eeb38260b64b43d9d7ae59e27733b269"/><file name="Diagnostics.php" hash="e8fb26b980ead6d7ce9adaa0ccf391d2"/></dir><file name="Form.php" hash="59f4ae15758308ff52cd951d863f13ce"/></dir><file name="Details.php" hash="63d97d33e2e413e74aeb6fc9877ddd54"/><file name="Grid.php" hash="339945a434d2a6abd30b3bf8c47ec4db"/><file name="Status.php" hash="45a930b4da5f6cc0da0d1e2324d0c0d2"/><file name="Tabs.php" hash="ece0311585223168e00396c449e66c40"/></dir><dir name="Background"><dir name="Task"><dir name="Details"><dir name="Tab"><file name="Info.php" hash="b726dd1598ab3d76c05485bb0810c6bb"/></dir><file name="Form.php" hash="a5cc89e3a588305f84ab1467ed1b6293"/></dir><file name="Details.php" hash="66c6d0fac958490cf65fcb066bc3eb7a"/><file name="Grid.php" hash="312ed544659c268ec3b107943f86ba93"/><file name="Status.php" hash="a93df8ed5104300b8071d2feafe0da61"/><file name="Tabs.php" hash="50d029c1b854765ed2a3ba2f1e1e7ea5"/></dir><file name="Task.php" hash="cee2ce839716c6a55b9f0b33ebaac38f"/></dir><dir name="Diagnostics"><dir name="Status"><file name="Abstract.php" hash="26a7456053abc173fbf8aaf3f68d7ab8"/></dir></dir><dir name="Latest"><file name="Grid.php" hash="7e2028b173532987f3a2459fed3eb9eb"/><file name="Status.php" hash="786fd19fdac3fed907e95ccf88dd120a"/></dir><dir name="Order"><dir name="View"><dir name="Tab"><dir name="Diagnostics"><file name="Status.php" hash="438d2c9aac10c3528329675e312e2765"/></dir><file name="Diagnostics.php" hash="def67938b14d701bd3b4ae45fda6e059"/></dir></dir></dir><dir name="Orders"><file name="Filter.php" hash="64b9dc33ef6c86444361d4a1233a7cf7"/><file name="Grid.php" hash="f6c473bf59ffac309325b141d94bea69"/><file name="Status.php" hash="8eff2a62f86b926aafa27070ee04f2af"/></dir><dir name="Products"><file name="Grid.php" hash="04f3412f2468a6a60ae4637551c4e2aa"/><file name="Status.php" hash="a99312f43124805af1b3db607ee23ff5"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="b57b1d42eb3daca55a2167a93586a3df"/></dir><dir name="Form"><dir name="Field"><dir name="Commerce"><file name="Api.php" hash="64acf8642e8d1c27014dee92050af628"/><file name="Note.php" hash="2301fffb8457e24ad37d16b4309a957f"/></dir><dir name="Cron"><dir name="Url"><file name="Info.php" hash="42cb0e0e6953742c3d0c535ac5f44a27"/></dir></dir><dir name="Signup"><file name="Test.php" hash="e4489f226eeef06c504b920847ff9593"/></dir><dir name="Smtp"><file name="Server.php" hash="3535455e2c04b70e9a52ef0bc9d00088"/><file name="Test.php" hash="933c8c06879a2e278b4757223fed1c53"/></dir><dir name="Sync"><dir name="Customers"><file name="Button.php" hash="a2d370802ae358144edb54acccc8e0fd"/><file name="Range.php" hash="c3f3a7ffbb5a79927c379fde8c89e7c0"/></dir><dir name="Orders"><file name="Button.php" hash="d4c1c4e6b804af22bd0e8c583efd29a8"/><file name="Range.php" hash="008ddc2afc06292ebc30f1abf513a559"/></dir><dir name="Products"><file name="Button.php" hash="7c383e8979310a09dc63eb2e9b76b4d7"/></dir><file name="Customers.php" hash="f17010d50ec21aa8d600f45d4297f40a"/><file name="Range.php" hash="dbf712666e09f5059c51036b293fbbc3"/></dir><file name="Addressmapfields.php" hash="55c88d6e85ca0e73e54b842e0e7ab4ba"/><file name="Api.php" hash="5c5fd3f5e50a524875d56dff5fac4b20"/><file name="Common.php" hash="c421a4ca9e6bc2c1c64429f3640cc427"/><file name="Diagnostics.php" hash="05bdb6a63bc4742432af8dfb0ffd0a2a"/><file name="EmailDirect.php" hash="79ea2098dd93fc97a7730452a5f6e966"/><file name="Info.php" hash="525c685749a05461e33f3f0df4f146c7"/><file name="Logging.php" hash="183cd28a3156a024455fd854730c859e"/><file name="Mapfields.php" hash="80c79d853273c16e3be073a18c2ec011"/><file name="Note.php" hash="f5054fdd2ad21805ff03f8fcd6fcffc3"/><file name="Shippingmapfields.php" hash="741d75b6e332151dba21befccd95ddc7"/><file name="Smtp.php" hash="93eabbd4c24a4001bb5808e51e9d43a0"/></dir></dir></dir><dir name="Convert"><dir name="Profile"><dir name="Sync"><file name="Customers.php" hash="faa8374cb0977e62fc82e17ca3460af8"/><file name="Orders.php" hash="3490fc7fb9b685c08d5b93d13afb6681"/><file name="Products.php" hash="bc0f94cabb993d0c856f22b46b5254c0"/></dir><file name="Sync.php" hash="cbd95542f57e6b612556e37b6ad28554"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Cron.php" hash="32c60607f0f03d7e1ed23c0a91bba920"/><file name="Download.php" hash="8d47397381bc8286c22188c2f6e015e3"/><file name="Help.php" hash="d6a6fc2f48b96b0a41c11a648abd6011"/><file name="Info.php" hash="6ce83e41898da9792868bc42e889a429"/><file name="Log.php" hash="6e222565c1f44a91925c2c876991a3f4"/><file name="Settings.php" hash="bd0b189a1b1cc313ed0bb96b869a04f8"/><file name="Submit.php" hash="7f5481630cd9f115aa801d16314b8edf"/></dir><file name="Form.php" hash="0809b7e09e2a932bab3f2c85e95516da"/></dir><file name="Status.php" hash="5032e69d110bc15a20ddabd492a2c9e3"/><file name="Tabs.php" hash="08299230ebb95078adf10bd9242b42cc"/><file name="View.php" hash="4e045d938bdddfd5af9917db56f2c8df"/></dir><file name="Abandoned.php" hash="9ee544b4274f95498c21078c3440cee2"/><file name="Container.php" hash="d102fcb96a449879ce8fb1a36c998cac"/><file name="Latest.php" hash="f50acdb230ec4bd67ca538784298f50e"/><file name="Orders.php" hash="4bd3b9dde4497f024089731ab7f1d9c4"/><file name="Products.php" hash="7e9aa9ed97b6b2ef5e640ae2f5e4c14b"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="2d31ac46504200508ffb142e35acb0b9"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Abandoned"><file name="Minutes.php" hash="5ae765d8eaba0821ef4ce48500f3d4bd"/></dir><dir name="Orders"><file name="State.php" hash="1ab896ccd9c9232ed232d62687cac79a"/></dir><dir name="Products"><file name="Name.php" hash="b56b185f905f43aab4598f418ca91b97"/></dir><file name="Action.php" hash="a8454d2d40609f2de12bdbc0a9f3a551"/></dir></dir></dir></dir><file name="Capture.php" hash="e2f1e84334b5e63fbac13399f76be136"/><file name="Signup.php" hash="3cfb414ed7fc6d6b866d38b296fad7cc"/></dir><dir name="Controller"><dir name="Front"><file name="Abstract.php" hash="1ec0fbe702b70b33cf21097f2472f165"/></dir></dir><dir name="Helper"><file name="Abandoned.php" hash="71550570d7304f5bad70a4eb9e0d26fd"/><file name="Cron.php" hash="da0f517a5dc7a5446ada56508c60d463"/><file name="Data.php" hash="d33c8633a8017e3f441ee3f46a28fe97"/><file name="Diagnostic.php" hash="0382ce6337fc845fb099ff79507a64ef"/><file name="Email.php" hash="b23abe06562ae3bfc02093d56ea61807"/><file name="Fields.php" hash="87e4067a0bf8091593af31f6978e704d"/><file name="Order.php" hash="cc0ed604f8f8978e07414eeca1a8f3d1"/><file name="Sync.php" hash="8e51093ddff02e1783b29ecf4b0061db"/><file name="Troubleshooting.php" hash="4864289d50a96d47b325782f5fd492ce"/></dir><dir name="Model"><dir name="Abandoned"><file name="Observer.php" hash="b3a3916a81b1aa9c945801748f8708bd"/></dir><dir name="Background"><file name="Observer.php" hash="ae0404f1fd56b0bf386238ff31f3b3dd"/><file name="Task.php" hash="1387f9aa6ed4692b2cf5a3304f2a6889"/></dir><dir name="Configuration"><file name="Observer.php" hash="64893f383e2c060501d666f517d111f4"/></dir><dir name="Customer"><file name="Observer.php" hash="9066a955a91e4439895c5572eaf82477"/></dir><dir name="Email"><file name="Queue.php" hash="a755044d7d354ac2d3c31dba230eb005"/><file name="Template.php" hash="26096ed08f0339b836938abd7ecec2c5"/></dir><dir name="Latest"><file name="Order.php" hash="15cff0518a0e053bffaa2d8f6113778a"/></dir><dir name="Mysql4"><dir name="Abandoned"><file name="Collection.php" hash="3f68e0ebf3ca9293473ed52551834a0f"/></dir><dir name="Background"><dir name="Task"><file name="Collection.php" hash="ca88d76a28e0225e99bffe25f5e4eaa2"/></dir><file name="Task.php" hash="b6a730480a84c085bf34bb8d3d3f55ce"/></dir><dir name="Latest"><dir name="Order"><file name="Collection.php" hash="487eab71efa04552566a1260012a5845"/></dir><file name="Order.php" hash="1b25cfbe2923690187bed3a982968d07"/></dir><dir name="Order"><file name="Collection.php" hash="1ec4f1b5771056815abbdeaab1a89797"/></dir><dir name="Product"><dir name="Category"><dir name="Action"><file name="Collection.php" hash="db45ca222feed2b0bf0e17e69431367f"/></dir><file name="Action.php" hash="5f6dae38ce4ddee0045747e0ba42378d"/></dir></dir><dir name="Session"><file name="Collection.php" hash="629816a4bf1be669d1ed677744357f61"/></dir><file name="Abandoned.php" hash="cd4ca2dbc8f0758a3835a4b870fedcaa"/><file name="Category.php" hash="fd2115bda520e4d901cefe4ab371d463"/><file name="Order.php" hash="5bac34cb7dc1d4d2db838894438034fd"/><file name="Product.php" hash="678a622d136064350b93034d0b8ebd58"/><file name="Session.php" hash="cafb42130e54bea5461e0f709bb09214"/></dir><dir name="Newsletter"><file name="Observer.php" hash="48657b067b1d3521ed33ff776dae943e"/></dir><dir name="Observer"><file name="Abstract.php" hash="9ac37b03684b20cddcfd97b6a6f3170b"/></dir><dir name="Order"><file name="Observer.php" hash="a12da23cce78598db5c148a078118fe9"/></dir><dir name="Product"><dir name="Category"><file name="Action.php" hash="70d472e391c4bf22e01d1dae3ef2b6c8"/></dir><file name="Observer.php" hash="bc5d0d7cde028dd61c5d0b442ef34a8c"/></dir><dir name="Resource"><file name="Setup.php" hash="952230e5b0632c3441c20bbfc386ec4f"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Send"><file name="Field.php" hash="e4ea62f64f043668f00eb627837cc6d4"/></dir><dir name="Sequence"><file name="Scope.php" hash="bcf820524f3a9ce5a62569767c8248e3"/></dir><dir name="Signup"><file name="Opacity.php" hash="bd3370611c9551efd53d84565e5cb234"/><file name="Recurrence.php" hash="aa42d1124016892bad804a43dbe0138e"/></dir><dir name="Smtp"><file name="Encryption.php" hash="5447e71037ae34960fff66479d7152c1"/></dir><file name="Abandonedlist.php" hash="64f11bdc40e02d614bb1282c6fb762b8"/><file name="Additionallist.php" hash="84454d9fd80e411efc8540d9dcb51888"/><file name="Checkoutsubscribe.php" hash="c4f2e403652fb6438ec993af3ba0c7b9"/><file name="List.php" hash="6c9784a917109e7b6812b147ffba733e"/><file name="Sequence.php" hash="705c04c54e730c5feadad07d7a01e050"/><file name="States.php" hash="b3bc4e2c3ee3caac578909b85962bf3d"/><file name="Statuses.php" hash="6cd4cd287608cd0ed30088ded5ee5c42"/><file name="Store.php" hash="9089fbcf04991fd1ea1d2a14fee6e6d4"/><file name="Time.php" hash="3c402071ddd3dd01bd49717fe5d5016e"/></dir></dir></dir><dir name="Wrapper"><dir name="Commerce"><file name="Category.php" hash="9e1f8f53e516079c602510bbe1760216"/><file name="Execute.php" hash="0af75d38b3d35a84d5cfe57d29b8e1a5"/><file name="Orders.php" hash="cfb8988fe4792dae958b5434672e8681"/><file name="Product.php" hash="fd0850484774c1cc03f67cbf5cfa505c"/></dir><file name="Abandoned.php" hash="6298fb157a215b4f3585fd8b42147827"/><file name="Abstract.php" hash="5ad36966e2a1cfe89360e60884ede88b"/><file name="Database.php" hash="164de5c78c9912225afed7192a1a3f7c"/><file name="Exception.php" hash="7e2f930f4106b5d91e595dcac75f6c62"/><file name="Execute.php" hash="d2f2fc5147f65be5d7e9116c8661c5fb"/><file name="Lists.php" hash="38f8e6989bd6cba51e1f2a41b9529042"/><file name="Orders.php" hash="0216428b98c04f13c3c3488c52011f3d"/><file name="Subscribers.php" hash="24e602f9ad0da07c7b557478315588b5"/><file name="Wishlist.php" hash="340682e866dd86fdbd0281b6d965bcd8"/></dir><file name="Abandoned.php" hash="3121570ce6e5faf0fcc7aeea98ffa562"/><file name="Category.php" hash="dfdfcafb8a200d1f2160b7f0c839027b"/><file name="Observer.php" hash="93295f6165c9bd379d4ee4a74458388f"/><file name="Order.php" hash="9a66161a19226a724ebdaa0df847b847"/><file name="Product.php" hash="127821cd0e074c82d60f155c46d35c2c"/><file name="Session.php" hash="f25cc2990b4baca8a1265165938f3592"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Campaigner"><dir name="Background"><file name="TaskController.php" hash="b65ead64cf398e01d664ce171c25c283"/></dir><file name="AbandonedController.php" hash="f5d5ceef117b97abdd0b6c29630b3eeb"/><file name="DiagnosticController.php" hash="03e1238f4eeb17b5ee7fb9dc1a5fce89"/><file name="LatestController.php" hash="1486a1858f84d9286385189c9616dd6e"/><file name="OrderController.php" hash="1e5e5d1fbc380130cc5b479e91d3f4bc"/><file name="ProductController.php" hash="9d4e46ab294efafd262c0c935c15bd95"/><file name="SyncController.php" hash="7d1ae6f213665c732acd3ec61360560f"/><file name="TroubleshootingController.php" hash="367c1259af494c8356ae4e48e4686b59"/></dir></dir><dir name="Customer"><file name="AccountController.php" hash="948146143dad1495cf5770d5b26df5e5"/></dir><file name="AbandonedController.php" hash="d62fa78d9132e19fca1232af5bc6434c"/><file name="CaptureController.php" hash="f4b3dbd7fed2ba835679a465999b6e8d"/><file name="CronController.php" hash="ac113712facee9865f22f060e3f5fd14"/><file name="SignupController.php" hash="9f22f1599ec5ca4159dca1f5597dc5b8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="5d51ce7eac327b145c7089250bceb017"/><file name="config.xml" hash="86b6f43af8beceba48227ff14f1ff157"/><file name="system.xml" hash="637a97f7294854d800dcc0e28e322dbc"/></dir><dir name="sql"><dir name="campaigner_setup"><file name="mysql4-install-1.0.0.php" hash="80c1aae7aa0da201429e58f2990128c6"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="65b76f1e85f2ab9f4b17f985fc7be0b8"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="b02a04564bc015858d645798b0045ae7"/><file name="mysql4-upgrade-1.0.3-1.1.0.php" hash="d201f65dcdb5113f293195027a2835c0"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="f1f76686dd9c70ee9698582d6d972f6e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="campaigner"><file name="campaigner-tab.png" hash="181849ccef5e616db6aae38a229a759a"/><file name="campaigner.css" hash="19a92e82527ed7341575bb0d928118d3"/><file name="logo.png" hash="d73185d0f531abdfb30c95b1305e9c3b"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="campaigner"><dir name="images"><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="campaigner.css" hash="57204bebe8e822a80be8ede51d0c0491"/><file name="integration.js" hash="027627a14bfe078ef56c34202d5c9a19"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="campaigner.xml" hash="1e1aae1c743dbb18961d54afbf7ef914"/></dir><dir name="template"><dir name="campaigner"><dir name="abandoned"><dir name="details"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="89eb5aeb29d09d7cc31f33c8d0d9573a"/></dir><file name="cart.phtml" hash="e826e27563af99f9217477b59208853a"/></dir><file name="form.phtml" hash="60633d212382770e99d11d24ae919e47"/></dir><file name="details.phtml" hash="a0569efc165c9435e53c036d468d05ca"/></dir><dir name="background"><dir name="task"><dir name="details"><dir name="tab"><file name="info.phtml" hash="ed7e4388b38297bedbd683274102d033"/></dir><file name="form.phtml" hash="6a832bf34ac4f4146560155b93d82454"/></dir><file name="details.phtml" hash="a0569efc165c9435e53c036d468d05ca"/></dir></dir><dir name="cron"><file name="status.phtml" hash="55557ba4e70a716c4b8ce6f41c2feaa5"/></dir><dir name="order"><dir name="view"><dir name="tab"><dir name="diagnostics"><file name="status.phtml" hash="c32928b810ea6a418204f26914ae3c5e"/></dir></dir></dir></dir><dir name="orders"><file name="filter.phtml" hash="ab210eb96a9f0dda67d0ce2550a3c14e"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="83c54cb8519c604489e2bb0772d3650f"/></dir><dir name="form"><dir name="field"><dir name="commerce"><file name="api.phtml" hash="ecdcca88a48a711a26ae58855c8d0f2c"/><file name="note.phtml" hash="8df6563e1e33c8047d3c399dbe43d476"/></dir><dir name="cron"><dir name="url"><file name="info.phtml" hash="4c5b782a284721b523c395a32daf0897"/></dir></dir><dir name="signup"><file name="test.phtml" hash="a9921c7483bbaf56c0bf98e41a672e1e"/></dir><dir name="smtp"><file name="test.phtml" hash="c23c1c77f0cde99d5628e91f7d883d47"/></dir><dir name="sync"><dir name="customers"><file name="button.phtml" hash="d5771f4fde24410f5380a0018ebd4ebe"/><file name="date_range_remove.phtml" hash="ac4601347423af6dc619cee942fdf65c"/></dir><dir name="orders"><file name="button.phtml" hash="b9a2e5ece2e44fd1c21e854de8d0b72f"/></dir><dir name="products"><file name="button.phtml" hash="49d8967d2e18c1485018d53fddb1c9c0"/></dir><file name="customers.phtml" hash="673b6f4243e94fd32bd64fbb5c409af9"/><file name="date_range.phtml" hash="6c02be324f82dc89617fb905415025a8"/></dir><file name="api.phtml" hash="49390ec00d814232605a6aae96ee5acc"/><file name="array.phtml" hash="2cf6ff2a3f29f448852f1a714b234c3b"/><file name="diagnostics.phtml" hash="0f926b6578ca36de48ce90076af167e7"/><file name="emaildirect.phtml" hash="e1a086ee2c08bb6cfcdcb9281b1ce88f"/><file name="info.phtml" hash="85d8282a2bb406a51abcb865f69027db"/><file name="logging.phtml" hash="a37d5d650937f7ff5d41937140872e4e"/><file name="note.phtml" hash="11e69d144c89ca2797832fe78e4c86d0"/><file name="smtp.phtml" hash="0c3151b4d7f34d6cf96f9fd2bfe210fd"/></dir></dir><file name="setup_check.phtml" hash="74f11286e25cea96fdb87642b96d62ec"/></dir><dir name="convert"><dir name="profile"><file name="product_sync.phtml" hash="616e1d7190eb18471dd9d92744852986"/><file name="sync.phtml" hash="7c06cf4b6fb3f7473a2a76348f57783e"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="cron.phtml" hash="d4f996ff57d2134fb05f6e694df9e3ff"/><file name="download.phtml" hash="8f7da58bf46a9953b329fea7dc6d741e"/><file name="help.phtml" hash="8e6c45cbcc60ec9c6935ad47f844a3a4"/><file name="info.phtml" hash="0cd4d2dff29c59d0ada9ce2a2f72977f"/><file name="log.phtml" hash="e7729b5800e3d03a6fc1f4d78ab02fcd"/><file name="settings.phtml" hash="7e7dab807ee2c697ff9fed9745bd0995"/><file name="submit.phtml" hash="47f398ab9c15ff0a3cd870f34e716b60"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="status.phtml" hash="94e337501d698266cffbf862ad52b6dc"/><file name="view.phtml" hash="6ddfc8c6efe25d30e63f792b19a95c84"/></dir><file name="diagnostics.phtml" hash="768b70daadfd3f6d8b5d26fff294d13e"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="campaigner.xml" hash="5c81b7e0468c3c5d411cfede758f9311"/></dir><dir name="template"><dir name="campaigner"><dir name="capture"><file name="email.phtml" hash="fa273ff1a48a12eb386f58f3e3e78f66"/></dir><dir name="checkout"><file name="subscribe.phtml" hash="fd0671d9d8186d7c93e2c2eb5dbffaeb"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="eb8b4743f1a37ac4e9d2d71dae71f65d"/></dir><file name="lists.phtml" hash="e20050217381c740bcffe3dfddff222a"/><file name="unsubscribed.phtml" hash="66a0e1ae8f7fa7e7770c931e2bb73244"/></dir></dir><dir name="signup"><file name="form.phtml" hash="87f1ced5f634d2816a37bca3797ecacf"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="newsletter_subscr_success_campaigner.html" hash="f6afb69d207bbc3f8920e7a72ac9dd07"/><file name="newsletter_unsub_success_campaigner.html" hash="bd9f97e8f5485180d4420097b5200ef4"/><file name="campaigner_relay_test.html" hash="3e01c93e616154068ea4b841802acf2f"/></dir></dir><file name="Campaigner_Integration.csv" hash="d107a2ee0ccd206831a19e21f0e13ad6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Campaigner_Integration.xml" hash="d7311dea93c926305f8ed67be1c1fc12"/></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies/>
|
24 |
</package>
|
@@ -114,9 +114,9 @@ table.troubleshooting_details { margin-top: 15px; margin-bottom: 10px; }
|
|
114 |
|
115 |
#ip_address { height: 3em; }
|
116 |
|
117 |
-
|
118 |
|
119 |
-
#campaigner_status_indicator, #campaigner_relay_status { font-weight: bold; width: 210px; float: left;}
|
120 |
|
121 |
.apikey_valid { color: green; }
|
122 |
.apikey_invalid { color: red; }
|
@@ -159,4 +159,16 @@ table.map_field_custom tr td:last-child { width: 80%; }
|
|
159 |
.campaigner_uninstall_files { margin-bottom: 15px; }
|
160 |
.campaigner_uninstall_files tr td { padding: 2px 0; }
|
161 |
|
162 |
-
.campaigner_uninstall_files td:first-child { padding-right: 15px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
#ip_address { height: 3em; }
|
116 |
|
117 |
+
.api_validator_button, #relay_setup_button { float: right; }
|
118 |
|
119 |
+
#campaigner_commerce_status_indicator, #campaigner_status_indicator, #campaigner_relay_status { font-weight: bold; width: 210px; float: left;}
|
120 |
|
121 |
.apikey_valid { color: green; }
|
122 |
.apikey_invalid { color: red; }
|
159 |
.campaigner_uninstall_files { margin-bottom: 15px; }
|
160 |
.campaigner_uninstall_files tr td { padding: 2px 0; }
|
161 |
|
162 |
+
.campaigner_uninstall_files td:first-child { padding-right: 15px; }
|
163 |
+
|
164 |
+
.campaigner_schedule_success { color: green; font-weight: bold; }
|
165 |
+
.campaigner_schedule_failure { color: red; font-weight: bold; }
|
166 |
+
.campaigner_schedule_pending { color: orange; font-weight: bold; }
|
167 |
+
|
168 |
+
#orders_filter { margin-bottom: 15px; height: 25px;}
|
169 |
+
.valid_states, .show_all_states { float: left; }
|
170 |
+
.show_all_states { margin-left: 50px; }
|
171 |
+
.show_all_states input { margin-left: 8px; }
|
172 |
+
|
173 |
+
.valid { color: green; }
|
174 |
+
.invalid { color: red; }
|