Remarkety_Mgconnector - Version 1.4.7.0

Version Notes

No comments

Download this release

Release Info

Developer Remarkety
Extension Remarkety_Mgconnector
Version 1.4.7.0
Comparing to
See all releases


Code changes from version 1.4.6.1 to 1.4.7.0

CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  1.4.6.1
2
  -------
3
  - bugfix - Send products which have become disabled
1
+ 1.4.7.0
2
+ -------
3
+ Integrate with Magestore Reward Points extension
4
+ Bugfix for coupons date
5
  1.4.6.1
6
  -------
7
  - bugfix - Send products which have become disabled
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Extension/RewardPoints.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin reward points extension block.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Extension_Rewardpoints
11
+ extends Mage_Adminhtml_Block_Template
12
+ {
13
+ /**
14
+ * Internal constructor.
15
+ *
16
+ * @return void
17
+ */
18
+ protected function _construct()
19
+ {
20
+ parent::_construct();
21
+ }
22
+
23
+ /**
24
+ * Return page header.
25
+ *
26
+ * @return string
27
+ */
28
+ public function getPageHeader()
29
+ {
30
+ return $this->__('Reward Points Extensions');
31
+ }
32
+
33
+ /**
34
+ * Return read more url.
35
+ *
36
+ * @return string
37
+ */
38
+ public function getReadMoreUrl()
39
+ {
40
+ return 'https://support.remarkety.com/hc/en-us/articles/209584646';
41
+ }
42
+
43
+ /**
44
+ * Return supported extension names.
45
+ *
46
+ * @return array
47
+ */
48
+ public function getSupportedExtensionNames()
49
+ {
50
+ $extensionsConfig = Mage::helper('mgconnector/extension')
51
+ ->getRewardPointsExtensions();
52
+
53
+ $extensionNames = array();
54
+ foreach ($extensionsConfig as $extensionConfig) {
55
+ $extensionNames[] = $this->__($extensionConfig['title']);
56
+ }
57
+
58
+ return $extensionNames;
59
+ }
60
+
61
+ /**
62
+ * Return enabled extensions links html.
63
+ *
64
+ * @return string
65
+ */
66
+ public function getEnabledExtensionsListHtml()
67
+ {
68
+ $enabledExtensions = Mage::helper('mgconnector/extension')
69
+ ->getEnabledRewardPointsExtensions();
70
+
71
+ $links = array();
72
+ foreach ($enabledExtensions as $enabledExtension) {
73
+ $links[] = sprintf(
74
+ '<a href="%s" target="_blank">%s</a>',
75
+ $enabledExtension['url'],
76
+ $this->__($enabledExtension['title'])
77
+ );
78
+ }
79
+
80
+ return implode(', ', $links);
81
+ }
82
+ }
app/code/community/Remarkety/Mgconnector/Helper/Extension.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Extension integration helper.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Helper_Extension extends Mage_Core_Helper_Abstract
11
+ {
12
+ const XML_EXTENSIONS_REWARD_POINTS
13
+ = 'mgconnector_supported_extensions/rewardpoints';
14
+
15
+ /**
16
+ * Supported reward points extensions config.
17
+ *
18
+ * @var array
19
+ */
20
+ protected $rewardPointsExtensionsConfig;
21
+
22
+ /**
23
+ * Enabled reward points extensions config.
24
+ *
25
+ * @var array
26
+ */
27
+ protected $enabledRewardPointsExtensionsConfig;
28
+
29
+ /**
30
+ * Return supported reward points extensions config data.
31
+ *
32
+ * @return array
33
+ */
34
+ public function getRewardPointsExtensions()
35
+ {
36
+ if (is_null($this->rewardPointsExtensionsConfig)) {
37
+ $extensionsConfig = Mage::getStoreConfig(
38
+ self::XML_EXTENSIONS_REWARD_POINTS
39
+ );
40
+ if (!is_array($extensionsConfig)) {
41
+ $extensionsConfig = array();
42
+ }
43
+
44
+ foreach ($extensionsConfig as $extensionCode => $extensionConfig) {
45
+ $extensionsConfig[] = array_merge(
46
+ array('code' => $extensionConfig),
47
+ $extensionConfig
48
+ );
49
+ unset($extensionsConfig[$extensionCode]);
50
+ }
51
+
52
+ usort(
53
+ $extensionsConfig,
54
+ function ($a, $b) {
55
+ return (int)$a['sortOrder'] - (int)$b['sortOrder'];
56
+ }
57
+ );
58
+
59
+ $this->rewardPointsExtensionsConfig = $extensionsConfig;
60
+ }
61
+
62
+ return $this->rewardPointsExtensionsConfig;
63
+ }
64
+
65
+ /**
66
+ * Return enabled reward points extensions config data.
67
+ *
68
+ * @return array
69
+ * @throws Mage_Core_Exception
70
+ */
71
+ public function getEnabledRewardPointsExtensions()
72
+ {
73
+ if (is_null($this->enabledRewardPointsExtensionsConfig)) {
74
+ $extensionHelper = Mage::helper('mgconnector/extension');
75
+
76
+ $extensionsConfig = $this->getRewardPointsExtensions();
77
+ $enabledExtensionsConfig = array();
78
+ foreach ($extensionsConfig as $extensionConfig) {
79
+ $model = Mage::getModel($extensionConfig['model']);
80
+ if (!$model instanceof Remarkety_Mgconnector_Model_Extension_RewardPoints_AbstractIntegration) {
81
+ throw new Mage_Core_Exception(
82
+ $extensionHelper->__('Unsupported integration model type.')
83
+ );
84
+ }
85
+
86
+ if ($model->isEnabled()) {
87
+ $enabledExtensionsConfig[] = $extensionConfig;
88
+ }
89
+ }
90
+
91
+ $this->enabledRewardPointsExtensionsConfig = $enabledExtensionsConfig;
92
+ }
93
+
94
+ return $this->enabledRewardPointsExtensionsConfig;
95
+ }
96
+
97
+ /**
98
+ * Return reward point integration model instance.
99
+ * If there are no enabled reward points extensions enabled false
100
+ * will be returned.
101
+ * If there are more than one reward points extensions enabled,
102
+ * first will be returned. Please keep in mind that they are sorted
103
+ * by sortOrder value.
104
+ *
105
+ * @return bool|Mage_Core_Model_Abstract
106
+ * @throws Mage_Core_Exception
107
+ */
108
+ public function getRewardPointsIntegrationInstance()
109
+ {
110
+ $enabledExtensions = $this->getEnabledRewardPointsExtensions();
111
+ if (empty($enabledExtensions)) {
112
+ return false;
113
+ }
114
+
115
+ foreach ($enabledExtensions as $enabledExtension) {
116
+ return $model = Mage::getModel($enabledExtension['model']);
117
+ }
118
+ }
119
+ }
app/code/community/Remarkety/Mgconnector/Model/Core.php CHANGED
@@ -416,6 +416,13 @@ class Remarkety_Mgconnector_Model_Core extends Mage_Core_Model_Abstract {
416
  ->addOrder('updated_at', 'ASC')
417
  ->addAttributeToSelect('*');
418
 
 
 
 
 
 
 
 
419
 
420
  // $customersCollection->addFieldToFilter('store_id', array('eq' => $mage_store_view_id));
421
 
416
  ->addOrder('updated_at', 'ASC')
417
  ->addAttributeToSelect('*');
418
 
419
+ $extensionHelper = Mage::helper('mgconnector/extension');
420
+ $rewardPointsInstance = $extensionHelper
421
+ ->getRewardPointsIntegrationInstance();
422
+ if ($rewardPointsInstance !== false) {
423
+ //add reward points join
424
+ $rewardPointsInstance->modifyCustomersCollection($customersCollection);
425
+ }
426
 
427
  // $customersCollection->addFieldToFilter('store_id', array('eq' => $mage_store_view_id));
428
 
app/code/community/Remarkety/Mgconnector/Model/Extension/RewardPoints/AbstractIntegration.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Reward points integration abstract class.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ abstract class Remarkety_Mgconnector_Model_Extension_RewardPoints_AbstractIntegration
11
+ implements Remarkety_Mgconnector_Model_Extension_RewardPoints_IntegrationInterface
12
+ {
13
+ /**
14
+ * Helper object.
15
+ *
16
+ * @var Remarkety_Mgconnector_Helper_Extension
17
+ */
18
+ protected $helper;
19
+
20
+ /**
21
+ * Helper getter.
22
+ *
23
+ * @return Remarkety_Mgconnector_Helper_Extension
24
+ */
25
+ public function getHelper()
26
+ {
27
+ if (is_null($this->helper)) {
28
+ $this->helper = Mage::helper('mgconnector/extension');
29
+ }
30
+
31
+ return $this->helper;
32
+ }
33
+
34
+ /**
35
+ * Method returns bool value if magento will find and consider
36
+ * extension as enabled.
37
+ *
38
+ * @return bool
39
+ */
40
+ public function isModuleEnabled()
41
+ {
42
+ return $this->getHelper()->isModuleEnabled($this->getModuleName());
43
+ }
44
+
45
+ /**
46
+ * Return store config.
47
+ *
48
+ * @param string $fieldPath Field path.
49
+ * @param mixed $store Store data.
50
+ *
51
+ * @return bool
52
+ */
53
+ protected function getStoreConfig($fieldPath, $store = null)
54
+ {
55
+ return Mage::getStoreConfigFlag(
56
+ $fieldPath,
57
+ $store
58
+ );
59
+ }
60
+ }
app/code/community/Remarkety/Mgconnector/Model/Extension/RewardPoints/IntegrationInterface.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Reward points integration interface.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ interface Remarkety_Mgconnector_Model_Extension_RewardPoints_IntegrationInterface
11
+ {
12
+ /**
13
+ * Method should return bool value whenever extension is enabled or not.
14
+ * It should check if module is enabled and if extension has its own
15
+ * enable/disable flag it should be checked as well.
16
+ *
17
+ * @return bool
18
+ */
19
+ public function isEnabled();
20
+
21
+ /**
22
+ * Method should return extension like, example: Remarkety_Mgconnector.
23
+ *
24
+ * @return string
25
+ */
26
+ public function getModuleName();
27
+
28
+ /**
29
+ * Method should return information about customer reward points
30
+ * balance which will be used in customer update events.
31
+ *
32
+ * @param int $customerId Customer id.
33
+ *
34
+ * @return array
35
+ */
36
+ public function getCustomerUpdateData($customerId);
37
+
38
+ /**
39
+ * Modifies the collection to include the customer points
40
+ * @param Mage_Customer_Model_Resource_Customer_Collection $collection
41
+ * @return mixed
42
+ */
43
+ public function modifyCustomersCollection(&$collection);
44
+ }
app/code/community/Remarkety/Mgconnector/Model/Extension/RewardPoints/MagestoreRewardPoints.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magestore reward points integration class.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Model_Extension_RewardPoints_MagestoreRewardPoints
11
+ extends Remarkety_Mgconnector_Model_Extension_RewardPoints_AbstractIntegration
12
+ {
13
+ /**
14
+ * {@inheritdoc}
15
+ */
16
+ public function isEnabled()
17
+ {
18
+ return (bool)$this->getStoreConfig('rewardpoints/general/enable');
19
+ }
20
+
21
+ /**
22
+ * {@inheritdoc}
23
+ */
24
+ public function getModuleName()
25
+ {
26
+ return 'Magestore_RewardPoints';
27
+ }
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ public function getCustomerUpdateData($customerId)
33
+ {
34
+ $rewardPointsCustomerModel = Mage::getModel('rewardpoints/customer')
35
+ ->load($customerId, 'customer_id');
36
+
37
+ return array(
38
+ 'points' => (int)$rewardPointsCustomerModel->getPointBalance(),
39
+ 'spent' => (int)$rewardPointsCustomerModel->getSpentBalance(),
40
+ 'hold' => (int)$rewardPointsCustomerModel->getHoldingBalance(),
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Modifies the collection to include the customer points
46
+ * @param Mage_Customer_Model_Resource_Customer_Collection $collection
47
+ * @return mixed
48
+ */
49
+ public function modifyCustomersCollection(&$collection)
50
+ {
51
+ $collection->getSelect()
52
+ ->joinLeft(array('rp' => $collection->getTable('rewardpoints/customer')),
53
+ 'e.entity_id = rp.customer_id',
54
+ array('rewards_points' => 'point_balance')
55
+ );
56
+ return null;
57
+ }
58
+ }
app/code/community/Remarkety/Mgconnector/Model/Extension/RewardPoints/Observer/AbstractObserver.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Reward points abstract observer class.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ abstract class Remarkety_Mgconnector_Model_Extension_RewardPoints_Observer_AbstractObserver
11
+ extends Remarkety_Mgconnector_Model_Observer
12
+ {
13
+ /**
14
+ * Send customer update request to remarkety containing
15
+ * information about reward points update.
16
+ *
17
+ * Input data array should have structure:
18
+ * array(
19
+ * 'points' => int value of current points balance,
20
+ * 'hold' => int value of points which are on hold,
21
+ * 'spent' => int value of points which customer spent,
22
+ * 'transaction' => array(
23
+ * 'action' => string type of action
24
+ * ),
25
+ * )
26
+ *
27
+ * @param array $rewardPointsData Reward points data.
28
+ *
29
+ * @return Remarkety_Mgconnector_Model_Extension_RewardPoints_Observer_AbstractObserver
30
+ */
31
+ public function sendCustomerUpdateRequest(array $rewardPointsData)
32
+ {
33
+ $customerData = $this->_prepareCustomerUpdateData();
34
+ $customerData['rewards'] = $rewardPointsData;
35
+
36
+ //queue customer update event
37
+ $this->_queueRequest(
38
+ 'customers/update',
39
+ $customerData,
40
+ 1,
41
+ null
42
+ );
43
+
44
+ return $this;
45
+ }
46
+ }
app/code/community/Remarkety/Mgconnector/Model/Extension/RewardPoints/Observer/MagestoreRewardPoints.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magestore reward points observer class.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Model_Extension_RewardPoints_Observer_MagestoreRewardPoints
11
+ extends Remarkety_Mgconnector_Model_Extension_RewardPoints_Observer_AbstractObserver
12
+ {
13
+ /**
14
+ * Check if magestore reward points extension exists and is enabled.
15
+ * If yes on each customer reward points update customer update event
16
+ * will be triggered to remarkety api.
17
+ *
18
+ * @param Varien_Object $observer Observer data.
19
+ *
20
+ * @return Remarkety_Mgconnector_Model_Extension_RewardPoints_Observer_MagestoreRewardPoints
21
+ */
22
+ public function updateCustomerRewardPoints(Varien_Object $observer)
23
+ {
24
+ $rewardPointsModel = Mage::getModel(
25
+ 'mgconnector/extension_rewardPoints_magestoreRewardPoints'
26
+ );
27
+ if ($rewardPointsModel->isEnabled() === false) {
28
+ return $this;
29
+ }
30
+
31
+ $transactionModel = $observer->getEvent()->getDataObject();
32
+ $transactionModel = Mage::getModel('rewardpoints/transaction')
33
+ ->load($transactionModel->getId());
34
+ if ((int)$transactionModel->getStatus() !== Magestore_RewardPoints_Model_Transaction::STATUS_COMPLETED) {
35
+ return $this;
36
+ }
37
+
38
+ $rewardPointsCustomerModel = Mage::getModel('rewardpoints/customer')
39
+ ->load($transactionModel->getCustomerId(), 'customer_id');
40
+
41
+ $rewardPointsData = array(
42
+ 'points' => (int)$rewardPointsCustomerModel->getPointBalance(),
43
+ 'spent' => (int)$rewardPointsCustomerModel->getSpentBalance(),
44
+ 'hold' => (int)$rewardPointsCustomerModel->getHoldingBalance(),
45
+ 'transaction' => array(
46
+ 'created_at' => $transactionModel->getCreatedTime(),
47
+ 'points' => (int)$transactionModel->getPointAmount(),
48
+ 'store_id' => (int)$transactionModel->getStoreId(),
49
+ 'action' => $transactionModel->getAction(),
50
+ 'expiration_date' => $transactionModel->getExpirationDate(),
51
+ ),
52
+ );
53
+
54
+ $this->_customer = Mage::getModel('customer/customer')
55
+ ->load($transactionModel->getCustomerId());
56
+ $this->sendCustomerUpdateRequest($rewardPointsData);
57
+
58
+ return $this;
59
+ }
60
+ }
app/code/community/Remarkety/Mgconnector/Model/Observer.php CHANGED
@@ -3,13 +3,14 @@
3
  /**
4
  * Observer model, which handle few events and send post request
5
  *
6
- * @category Remarkety
7
- * @package Remarkety_Mgconnector
8
- * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
  */
10
 
11
- if (!defined("REMARKETY_LOG"))
12
- define('REMARKETY_LOG', 'remarkety_mgconnector.log');
 
13
 
14
  class Remarkety_Mgconnector_Model_Observer
15
  {
@@ -34,22 +35,28 @@ class Remarkety_Mgconnector_Model_Observer
34
  {
35
  $this->_token = Mage::getStoreConfig('remarkety/mgconnector/api_key');
36
  $intervals = Mage::getStoreConfig('remarkety/mgconnector/intervals');
 
 
 
37
  $this->_intervals = explode(',', $intervals);
38
  }
39
 
40
 
41
-
42
  public function triggerCustomerAddressBeforeUpdate($observer)
43
  {
44
- $address = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBillingAddress();
45
- if(!empty($address)) {
 
 
 
46
  $this->_origAddressData = $address->getData();
47
  }
 
48
  return $this;
49
  }
50
 
51
- public function beforeBlockToHtml(Varien_Event_Observer $observer) {
52
-
53
  $grid = $observer->getBlock();
54
 
55
  /**
@@ -61,25 +68,28 @@ class Remarkety_Mgconnector_Model_Observer
61
  array(
62
  'header' => Mage::helper('salesrule')->__('Expiration date'),
63
  'index' => 'expiration_date',
64
- 'type' => 'datetime',
65
- 'default' => '-',
66
- 'align' => 'center',
67
- 'width' => '160'
68
  ),
69
  'created_at'
70
  );
71
 
72
- $yesnoOptions = array(null => 'No','1' => 'Yes','' => 'No');
73
-
74
- $grid->addColumnAfter('added_by_remarkety', array(
75
- 'header' => Mage::helper('salesrule')->__('Created By Remarkety'),
76
- 'index' => 'added_by_remarkety',
77
- 'type' => 'options',
78
- 'options' => $yesnoOptions,
79
- 'width' => '30',
80
- 'align' => 'center',
81
- ),'expiration_date');
82
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
 
85
  }
@@ -89,21 +99,25 @@ class Remarkety_Mgconnector_Model_Observer
89
  $this->_address = $observer->getEvent()->getCustomerAddress();
90
  $this->_customer = $this->_address->getCustomer();
91
 
92
- if(Mage::registry('remarkety_customer_save_observer_executed_'.$this->_customer->getId())) {
93
  return $this;
94
  }
95
 
96
  $isDefaultBilling =
97
- ($this->_customer == null || $this->_customer->getDefaultBillingAddress() == null)
98
- ? false
99
- : ($this->_address->getId() == $this->_customer->getDefaultBillingAddress()->getId());
100
  if (!$isDefaultBilling || !$this->_customer->getId()) {
101
- return $this;
102
  }
103
 
104
  $this->_customerUpdate();
105
 
106
- Mage::register('remarkety_customer_save_observer_executed_'.$this->_customer->getId(),true);
 
 
 
 
107
  return $this;
108
  }
109
 
@@ -111,17 +125,21 @@ class Remarkety_Mgconnector_Model_Observer
111
  {
112
  $this->_customer = $observer->getEvent()->getCustomer();
113
 
114
- if(Mage::registry('remarkety_customer_save_observer_executed_'.$this->_customer->getId()) || !$this->_customer->getId()) {
115
  return $this;
116
  }
117
 
118
- if($this->_customer->getOrigData() === null) {
119
  $this->_customerRegistration();
120
  } else {
121
  $this->_customerUpdate();
122
  }
123
 
124
- Mage::register('remarkety_customer_save_observer_executed_'.$this->_customer->getId(),true);
 
 
 
 
125
  return $this;
126
  }
127
 
@@ -131,20 +149,26 @@ class Remarkety_Mgconnector_Model_Observer
131
 
132
  $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
133
 
134
- if($this->_subscriber->getId() && !$loggedIn) {
135
- if($this->_subscriber->getCustomerId() && Mage::registry('remarkety_customer_save_observer_executed_'.$this->_subscriber->getCustomerId())) {
136
  return $this;
137
  }
138
  // Avoid loops - If this unsubsribe was triggered by remarkety, no need to update us
139
- if (Mage::registry('remarkety_subscriber_deleted'))
140
- return $this;
141
- $this->makeRequest('customers/create', $this->_prepareCustomerSubscribtionUpdateData(true));
 
 
 
 
 
 
142
  $email = $this->_subscriber->getSubscriberEmail();
143
- if(!empty($email)){
144
 
145
  //save email to cart if needed
146
  $cart = Mage::getSingleton('checkout/session')->getQuote();
147
- if($cart && !is_null($cart->getId()) && is_null($cart->getCustomerEmail())){
148
  $cart->setCustomerEmail($email)->save();
149
  }
150
 
@@ -158,8 +182,11 @@ class Remarkety_Mgconnector_Model_Observer
158
  public function triggerSubscribeDelete($observer)
159
  {
160
  $this->_subscriber = $observer->getEvent()->getSubscriber();
161
- if(!Mage::registry('remarkety_subscriber_deleted_'.$this->_subscriber->getEmail()) && $this->_subscriber->getId()) {
162
- $this->makeRequest('customers/update', $this->_prepareCustomerSubscribtionDeleteData());
 
 
 
163
  }
164
 
165
  return $this;
@@ -172,35 +199,48 @@ class Remarkety_Mgconnector_Model_Observer
172
  return $this;
173
  }
174
 
175
- $this->makeRequest('customers/delete', array(
176
- 'id' => (int)$this->_customer->getId(),
177
- 'email' => $this->_customer->getEmail(),
178
- ));
 
 
 
 
179
  return $this;
180
  }
181
 
182
- public function triggerProductSave($observer) {
 
183
  // TODO - Need to implement
184
  return $this;
185
  }
186
 
187
  protected function _customerRegistration()
188
  {
189
- $this->makeRequest('customers/create', $this->_prepareCustomerUpdateData());
 
 
 
 
190
  return $this;
191
  }
192
 
193
  protected function _customerUpdate()
194
  {
195
- if($this->_hasDataChanged()) {
196
- $this->makeRequest('customers/update', $this->_prepareCustomerUpdateData());
 
 
 
197
  }
 
198
  return $this;
199
  }
200
 
201
  protected function _hasDataChanged()
202
  {
203
- if(!$this->_hasDataChanged && $this->_customer) {
204
  $validate = array(
205
  'firstname',
206
  'lastname',
@@ -212,33 +252,33 @@ class Remarkety_Mgconnector_Model_Observer
212
  'default_billing',
213
  'is_subscribed',
214
  );
215
- $originalData = $this->_customer->getOrigData();
216
- $currentData = $this->_customer->getData();
217
- foreach ($validate as $field) {
218
- if (isset($originalData[$field])) {
219
- if (!isset($currentData[$field]) || $currentData[$field] != $originalData[$field]) {
220
- $this->_hasDataChanged = true;
221
- break;
222
- }
223
- }
224
- }
225
- // This part has been replaced by the loop above to avoid comparing objects in array_diff
226
- // $customerDiffKeys = array_keys( array_diff($this->_customer->getData(), $this->_customer->getOrigData()) );
227
- //
228
- // if(array_intersect($customerDiffKeys, $validate)) {
229
- // $this->_hasDataChanged = true;
230
- // }
231
  $customerData = $this->_customer->getData();
232
- if(!$this->_hasDataChanged && isset($customerData['is_subscribed'])) {
233
  $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($this->_customer->getEmail());
234
  $isSubscribed = $subscriber->getId() ? $subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED : false;
235
 
236
- if($customerData['is_subscribed'] !== $isSubscribed) {
237
  $this->_hasDataChanged = true;
238
  }
239
  }
240
  }
241
- if(!$this->_hasDataChanged && $this->_address && $this->_origAddressData) {
242
  $validate = array(
243
  'street',
244
  'city',
@@ -247,9 +287,14 @@ class Remarkety_Mgconnector_Model_Observer
247
  'country_id',
248
  'telephone',
249
  );
250
- $addressDiffKeys = array_keys( array_diff($this->_address->getData(), $this->_origAddressData) );
 
 
 
 
 
251
 
252
- if(array_intersect($addressDiffKeys, $validate)) {
253
  $this->_hasDataChanged = true;
254
  }
255
  }
@@ -262,15 +307,15 @@ class Remarkety_Mgconnector_Model_Observer
262
  return array(
263
  'adapter' => 'Zend_Http_Client_Adapter_Curl',
264
  'curloptions' => array(
265
- // CURLOPT_FOLLOWLOCATION => true,
266
  CURLOPT_HEADER => true,
267
  CURLOPT_CONNECTTIMEOUT => self::REMARKETY_TIMEOUT
268
- // CURLOPT_SSL_CIPHER_LIST => "RC4-SHA"
269
  ),
270
  );
271
  }
272
 
273
- protected function _getHeaders($eventType,$payload)
274
  {
275
  $domain = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
276
  $domain = substr($domain, 7, -1);
@@ -282,16 +327,30 @@ class Remarkety_Mgconnector_Model_Observer
282
  'X-Platform: ' . self::REMARKETY_PLATFORM,
283
  'X-Version: ' . self::REMARKETY_VERSION,
284
  );
285
- if (isset($payload['storeId']))
286
  $headers[] = 'X-Magento-Store-Id: ' . $payload['storeId'];
 
 
 
 
287
  return $headers;
288
  }
289
 
290
- public function makeRequest($eventType, $payload, $attempt = 1, $queueId = null)
291
- {
 
 
 
 
292
  try {
293
- $client = new Zend_Http_Client(self::REMARKETY_EVENTS_ENDPOINT, $this->_getRequestConfig($eventType));
294
- $payload = array_merge($payload, $this->_getPayloadBase($eventType));
 
 
 
 
 
 
295
  $headers = $this->_getHeaders($eventType, $payload);
296
  unset($payload['storeId']);
297
  $json = json_encode($payload);
@@ -300,8 +359,12 @@ class Remarkety_Mgconnector_Model_Observer
300
  ->setHeaders($headers)
301
  ->setRawData($json, 'application/json')
302
  ->request(self::REMARKETY_METHOD);
303
-
304
- Mage::log("Sent event to endpoint: ".$json."; Response (".$response->getStatus()."): ".$response->getBody(), \Zend_Log::DEBUG, REMARKETY_LOG);
 
 
 
 
305
  switch ($response->getStatus()) {
306
  case '200':
307
  return true;
@@ -310,9 +373,14 @@ class Remarkety_Mgconnector_Model_Observer
310
  case '401':
311
  throw new Exception('Request failed, probably wrong API key or inactive account.');
312
  default:
313
- $this->_queueRequest($eventType, $payload, $attempt, $queueId);
 
 
 
 
 
314
  }
315
- } catch(Exception $e) {
316
  $this->_queueRequest($eventType, $payload, $attempt, $queueId);
317
  }
318
 
@@ -323,29 +391,34 @@ class Remarkety_Mgconnector_Model_Observer
323
  {
324
  $queueModel = Mage::getModel('mgconnector/queue');
325
 
326
- if(!empty($this->_intervals[$attempt-1])) {
327
  $now = time();
328
- $nextAttempt = $now + (int)$this->_intervals[$attempt-1] * 60;
329
- if($queueId) {
330
  $queueModel->load($queueId);
331
  $queueModel->setAttempts($attempt);
332
- $queueModel->setLastAttempt( date("Y-m-d H:i:s", $now) );
333
- $queueModel->setNextAttempt( date("Y-m-d H:i:s", $nextAttempt) );
334
  } else {
335
- $queueModel->setData(array(
336
- 'event_type' => $eventType,
337
- 'payload' => serialize($payload),
338
- 'attempts' => $attempt,
339
- 'last_attempt' => date("Y-m-d H:i:s", $now),
340
- 'next_attempt' => date("Y-m-d H:i:s", $nextAttempt),
341
- ));
 
 
342
  }
 
343
  return $queueModel->save();
344
- } elseif($queueId) {
345
  $queueModel->load($queueId);
346
  $queueModel->setStatus(0);
 
347
  return $queueModel->save();
348
  }
 
349
  return false;
350
  }
351
 
@@ -356,6 +429,7 @@ class Remarkety_Mgconnector_Model_Observer
356
  'timestamp' => (string)time(),
357
  'event_id' => $eventType,
358
  );
 
359
  return $arr;
360
  }
361
 
@@ -364,51 +438,63 @@ class Remarkety_Mgconnector_Model_Observer
364
  $arr = array(
365
  'id' => (int)$this->_customer->getId(),
366
  'email' => $this->_customer->getEmail(),
367
- 'created_at' => date('c', strtotime($this->_customer->getCreatedAt())),
 
 
 
368
  'first_name' => $this->_customer->getFirstname(),
369
  'last_name' => $this->_customer->getLastname(),
370
- 'store_id' => $this->_customer->getStoreId(),
371
  //'extra_info' => array(),
372
  );
373
 
374
  $isSubscribed = $this->_customer->getIsSubscribed();
375
- if($isSubscribed === null) {
376
- $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($this->_customer->getEmail());
377
- if($subscriber->getId()) {
 
378
  $isSubscribed = $subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED;
379
  } else {
380
  $isSubscribed = false;
381
  }
382
  }
383
- $arr = array_merge($arr, array('accepts_marketing' => (bool)$isSubscribed));
 
 
 
384
 
385
- if($title = $this->_customer->getPrefix()) {
386
  $arr = array_merge($arr, array('title' => $title));
387
  }
388
 
389
- if($dob = $this->_customer->getDob()) {
390
  $arr = array_merge($arr, array('birthdate' => $dob));
391
  }
392
 
393
- if($gender = $this->_customer->getGender()) {
394
  $arr = array_merge($arr, array('gender' => $gender));
395
  }
396
 
397
- if($address = $this->_customer->getDefaultBillingAddress()) {
398
  $street = $address->getStreet();
399
- $arr = array_merge($arr, array('default_address' => array(
400
- 'address1' => isset($street[0]) ? $street[0] : '',
401
- 'address2' => isset($street[1]) ? $street[1] : '',
402
- 'city' => $address->getCity(),
403
- 'province' => $address->getRegion(),
404
- 'phone' => $address->getTelephone(),
405
- 'country_code' => $address->getCountryId(),
406
- 'zip' => $address->getPostcode(),
407
- )));
 
 
 
 
 
408
  }
409
 
410
  $tags = $this->_getCustomerProductTags();
411
- if(!empty($tags) && $tags->getSize()) {
412
  $tagsArr = array();
413
  foreach ($tags as $_tag) {
414
  $tagsArr[] = $_tag->getName();
@@ -416,13 +502,23 @@ class Remarkety_Mgconnector_Model_Observer
416
  $arr = array_merge($arr, array('tags' => $tagsArr));
417
  }
418
 
419
- if($group = Mage::getModel('customer/group')->load($this->_customer->getGroupId())) {
420
- $arr = array_merge($arr, array('groups' => array(
421
- array(
422
- 'id' => (int)$this->_customer->getGroupId(),
423
- 'name' => $group->getCustomerGroupCode(),
424
- )
425
- )));
 
 
 
 
 
 
 
 
 
 
426
  }
427
 
428
  return $arr;
@@ -436,21 +532,23 @@ class Remarkety_Mgconnector_Model_Observer
436
  ->joinRel()
437
  ->addCustomerFilter($this->_customer->getId());
438
  }
 
439
  return $tags;
440
  }
441
 
442
- protected function _prepareCustomerSubscribtionUpdateData($newsletter = false)
443
- {
 
444
  $quote = Mage::getSingleton('checkout/session')->getQuote();
445
  $store = Mage::app()->getStore();
446
 
447
  $arr = array(
448
  'email' => $this->_subscriber->getSubscriberEmail(),
449
  'accepts_marketing' => $this->_subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED,
450
- 'storeId' => $store->getStoreId()
451
  );
452
 
453
- if($newsletter && (!is_object($quote) || $quote->getCheckoutMethod() !== Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST) ){
454
  $arr['is_newsletter_subscriber'] = true;
455
  }
456
 
@@ -464,26 +562,31 @@ class Remarkety_Mgconnector_Model_Observer
464
  $arr = array(
465
  'email' => $this->_subscriber->getSubscriberEmail(),
466
  'accepts_marketing' => false,
467
- 'storeId' => $store->getStoreId()
468
  );
469
 
470
  return $arr;
471
  }
472
 
473
- public function resend($queueItems,$resetAttempts = false) {
474
- $sent=0;
475
- foreach($queueItems as $_queue) {
476
- $result = $this->makeRequest($_queue->getEventType(), unserialize($_queue->getPayload()), $resetAttempts ? 1 : ($_queue->getAttempts()+1), $_queue->getId());
477
- if($result) {
478
- Mage::getModel('mgconnector/queue')
479
- ->load($_queue->getId())
480
- ->delete();
481
- $sent++;
482
- }
483
- }
484
- return $sent;
 
 
 
 
 
485
  }
486
-
487
  public function run()
488
  {
489
  $collection = Mage::getModel('mgconnector/queue')->getCollection();
@@ -493,7 +596,8 @@ class Remarkety_Mgconnector_Model_Observer
493
  ->where('next_attempt <= ?', $nextAttempt)
494
  ->where('status = 1')
495
  ->order('main_table.next_attempt asc');
496
- $this->resend($collection);
 
497
  return $this;
498
  }
499
- }
3
  /**
4
  * Observer model, which handle few events and send post request
5
  *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
  */
10
 
11
+ if (!defined("REMARKETY_LOG")) {
12
+ define('REMARKETY_LOG', 'remarkety_mgconnector.log');
13
+ }
14
 
15
  class Remarkety_Mgconnector_Model_Observer
16
  {
35
  {
36
  $this->_token = Mage::getStoreConfig('remarkety/mgconnector/api_key');
37
  $intervals = Mage::getStoreConfig('remarkety/mgconnector/intervals');
38
+ if(empty($intervals)){
39
+ $intervals = "1,3,10";
40
+ }
41
  $this->_intervals = explode(',', $intervals);
42
  }
43
 
44
 
 
45
  public function triggerCustomerAddressBeforeUpdate($observer)
46
  {
47
+ $address = Mage::getSingleton('customer/session')
48
+ ->getCustomer()
49
+ ->getDefaultBillingAddress();
50
+
51
+ if (!empty($address)) {
52
  $this->_origAddressData = $address->getData();
53
  }
54
+
55
  return $this;
56
  }
57
 
58
+ public function beforeBlockToHtml(Varien_Event_Observer $observer)
59
+ {
60
  $grid = $observer->getBlock();
61
 
62
  /**
68
  array(
69
  'header' => Mage::helper('salesrule')->__('Expiration date'),
70
  'index' => 'expiration_date',
71
+ 'type' => 'datetime',
72
+ 'default' => '-',
73
+ 'align' => 'center',
74
+ 'width' => '160',
75
  ),
76
  'created_at'
77
  );
78
 
79
+ $yesnoOptions = array(null => 'No', '1' => 'Yes', '' => 'No');
 
 
 
 
 
 
 
 
 
80
 
81
+ $grid->addColumnAfter(
82
+ 'added_by_remarkety',
83
+ array(
84
+ 'header' => Mage::helper('salesrule')->__('Created By Remarkety'),
85
+ 'index' => 'added_by_remarkety',
86
+ 'type' => 'options',
87
+ 'options' => $yesnoOptions,
88
+ 'width' => '30',
89
+ 'align' => 'center',
90
+ ),
91
+ 'expiration_date'
92
+ );
93
  }
94
 
95
  }
99
  $this->_address = $observer->getEvent()->getCustomerAddress();
100
  $this->_customer = $this->_address->getCustomer();
101
 
102
+ if (Mage::registry('remarkety_customer_save_observer_executed_' . $this->_customer->getId())) {
103
  return $this;
104
  }
105
 
106
  $isDefaultBilling =
107
+ ($this->_customer == null || $this->_customer->getDefaultBillingAddress() == null)
108
+ ? false
109
+ : ($this->_address->getId() == $this->_customer->getDefaultBillingAddress()->getId());
110
  if (!$isDefaultBilling || !$this->_customer->getId()) {
111
+ return $this;
112
  }
113
 
114
  $this->_customerUpdate();
115
 
116
+ Mage::register(
117
+ 'remarkety_customer_save_observer_executed_' . $this->_customer->getId(),
118
+ true
119
+ );
120
+
121
  return $this;
122
  }
123
 
125
  {
126
  $this->_customer = $observer->getEvent()->getCustomer();
127
 
128
+ if (Mage::registry('remarkety_customer_save_observer_executed_' . $this->_customer->getId()) || !$this->_customer->getId()) {
129
  return $this;
130
  }
131
 
132
+ if ($this->_customer->getOrigData() === null) {
133
  $this->_customerRegistration();
134
  } else {
135
  $this->_customerUpdate();
136
  }
137
 
138
+ Mage::register(
139
+ 'remarkety_customer_save_observer_executed_' . $this->_customer->getId(),
140
+ true
141
+ );
142
+
143
  return $this;
144
  }
145
 
149
 
150
  $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
151
 
152
+ if ($this->_subscriber->getId() && !$loggedIn) {
153
+ if ($this->_subscriber->getCustomerId() && Mage::registry('remarkety_customer_save_observer_executed_' . $this->_subscriber->getCustomerId())) {
154
  return $this;
155
  }
156
  // Avoid loops - If this unsubsribe was triggered by remarkety, no need to update us
157
+ if (Mage::registry('remarkety_subscriber_deleted')) {
158
+ return $this;
159
+ }
160
+
161
+ $this->makeRequest(
162
+ 'customers/create',
163
+ $this->_prepareCustomerSubscribtionUpdateData(true)
164
+ );
165
+
166
  $email = $this->_subscriber->getSubscriberEmail();
167
+ if (!empty($email)) {
168
 
169
  //save email to cart if needed
170
  $cart = Mage::getSingleton('checkout/session')->getQuote();
171
+ if ($cart && !is_null($cart->getId()) && is_null($cart->getCustomerEmail())) {
172
  $cart->setCustomerEmail($email)->save();
173
  }
174
 
182
  public function triggerSubscribeDelete($observer)
183
  {
184
  $this->_subscriber = $observer->getEvent()->getSubscriber();
185
+ if (!Mage::registry('remarkety_subscriber_deleted_' . $this->_subscriber->getEmail()) && $this->_subscriber->getId()) {
186
+ $this->makeRequest(
187
+ 'customers/update',
188
+ $this->_prepareCustomerSubscribtionDeleteData()
189
+ );
190
  }
191
 
192
  return $this;
199
  return $this;
200
  }
201
 
202
+ $this->makeRequest(
203
+ 'customers/delete',
204
+ array(
205
+ 'id' => (int)$this->_customer->getId(),
206
+ 'email' => $this->_customer->getEmail(),
207
+ )
208
+ );
209
+
210
  return $this;
211
  }
212
 
213
+ public function triggerProductSave($observer)
214
+ {
215
  // TODO - Need to implement
216
  return $this;
217
  }
218
 
219
  protected function _customerRegistration()
220
  {
221
+ $this->makeRequest(
222
+ 'customers/create',
223
+ $this->_prepareCustomerUpdateData()
224
+ );
225
+
226
  return $this;
227
  }
228
 
229
  protected function _customerUpdate()
230
  {
231
+ if ($this->_hasDataChanged()) {
232
+ $this->makeRequest(
233
+ 'customers/update',
234
+ $this->_prepareCustomerUpdateData()
235
+ );
236
  }
237
+
238
  return $this;
239
  }
240
 
241
  protected function _hasDataChanged()
242
  {
243
+ if (!$this->_hasDataChanged && $this->_customer) {
244
  $validate = array(
245
  'firstname',
246
  'lastname',
252
  'default_billing',
253
  'is_subscribed',
254
  );
255
+ $originalData = $this->_customer->getOrigData();
256
+ $currentData = $this->_customer->getData();
257
+ foreach ($validate as $field) {
258
+ if (isset($originalData[$field])) {
259
+ if (!isset($currentData[$field]) || $currentData[$field] != $originalData[$field]) {
260
+ $this->_hasDataChanged = true;
261
+ break;
262
+ }
263
+ }
264
+ }
265
+ // This part has been replaced by the loop above to avoid comparing objects in array_diff
266
+ // $customerDiffKeys = array_keys( array_diff($this->_customer->getData(), $this->_customer->getOrigData()) );
267
+ //
268
+ // if(array_intersect($customerDiffKeys, $validate)) {
269
+ // $this->_hasDataChanged = true;
270
+ // }
271
  $customerData = $this->_customer->getData();
272
+ if (!$this->_hasDataChanged && isset($customerData['is_subscribed'])) {
273
  $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($this->_customer->getEmail());
274
  $isSubscribed = $subscriber->getId() ? $subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED : false;
275
 
276
+ if ($customerData['is_subscribed'] !== $isSubscribed) {
277
  $this->_hasDataChanged = true;
278
  }
279
  }
280
  }
281
+ if (!$this->_hasDataChanged && $this->_address && $this->_origAddressData) {
282
  $validate = array(
283
  'street',
284
  'city',
287
  'country_id',
288
  'telephone',
289
  );
290
+ $addressDiffKeys = array_keys(
291
+ array_diff(
292
+ $this->_address->getData(),
293
+ $this->_origAddressData
294
+ )
295
+ );
296
 
297
+ if (array_intersect($addressDiffKeys, $validate)) {
298
  $this->_hasDataChanged = true;
299
  }
300
  }
307
  return array(
308
  'adapter' => 'Zend_Http_Client_Adapter_Curl',
309
  'curloptions' => array(
310
+ // CURLOPT_FOLLOWLOCATION => true,
311
  CURLOPT_HEADER => true,
312
  CURLOPT_CONNECTTIMEOUT => self::REMARKETY_TIMEOUT
313
+ // CURLOPT_SSL_CIPHER_LIST => "RC4-SHA"
314
  ),
315
  );
316
  }
317
 
318
+ protected function _getHeaders($eventType, $payload)
319
  {
320
  $domain = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
321
  $domain = substr($domain, 7, -1);
327
  'X-Platform: ' . self::REMARKETY_PLATFORM,
328
  'X-Version: ' . self::REMARKETY_VERSION,
329
  );
330
+ if (isset($payload['storeId'])) {
331
  $headers[] = 'X-Magento-Store-Id: ' . $payload['storeId'];
332
+ } elseif (isset($payload['store_id'])) {
333
+ $headers[] = 'X-Magento-Store-Id: ' . $payload['store_id'];
334
+ }
335
+
336
  return $headers;
337
  }
338
 
339
+ public function makeRequest(
340
+ $eventType,
341
+ $payload,
342
+ $attempt = 1,
343
+ $queueId = null
344
+ ) {
345
  try {
346
+ $client = new Zend_Http_Client(
347
+ self::REMARKETY_EVENTS_ENDPOINT,
348
+ $this->_getRequestConfig($eventType)
349
+ );
350
+ $payload = array_merge(
351
+ $payload,
352
+ $this->_getPayloadBase($eventType)
353
+ );
354
  $headers = $this->_getHeaders($eventType, $payload);
355
  unset($payload['storeId']);
356
  $json = json_encode($payload);
359
  ->setHeaders($headers)
360
  ->setRawData($json, 'application/json')
361
  ->request(self::REMARKETY_METHOD);
362
+
363
+ Mage::log(
364
+ "Sent event to endpoint: " . $json . "; Response (" . $response->getStatus() . "): " . $response->getBody(),
365
+ \Zend_Log::DEBUG, REMARKETY_LOG
366
+ );
367
+
368
  switch ($response->getStatus()) {
369
  case '200':
370
  return true;
373
  case '401':
374
  throw new Exception('Request failed, probably wrong API key or inactive account.');
375
  default:
376
+ $this->_queueRequest(
377
+ $eventType,
378
+ $payload,
379
+ $attempt,
380
+ $queueId
381
+ );
382
  }
383
+ } catch (Exception $e) {
384
  $this->_queueRequest($eventType, $payload, $attempt, $queueId);
385
  }
386
 
391
  {
392
  $queueModel = Mage::getModel('mgconnector/queue');
393
 
394
+ if (!empty($this->_intervals[$attempt - 1])) {
395
  $now = time();
396
+ $nextAttempt = $now + (int)$this->_intervals[$attempt - 1] * 60;
397
+ if ($queueId) {
398
  $queueModel->load($queueId);
399
  $queueModel->setAttempts($attempt);
400
+ $queueModel->setLastAttempt(date("Y-m-d H:i:s", $now));
401
+ $queueModel->setNextAttempt(date("Y-m-d H:i:s", $nextAttempt));
402
  } else {
403
+ $queueModel->setData(
404
+ array(
405
+ 'event_type' => $eventType,
406
+ 'payload' => serialize($payload),
407
+ 'attempts' => $attempt,
408
+ 'last_attempt' => date("Y-m-d H:i:s", $now),
409
+ 'next_attempt' => date("Y-m-d H:i:s", $nextAttempt),
410
+ )
411
+ );
412
  }
413
+
414
  return $queueModel->save();
415
+ } elseif ($queueId) {
416
  $queueModel->load($queueId);
417
  $queueModel->setStatus(0);
418
+
419
  return $queueModel->save();
420
  }
421
+
422
  return false;
423
  }
424
 
429
  'timestamp' => (string)time(),
430
  'event_id' => $eventType,
431
  );
432
+
433
  return $arr;
434
  }
435
 
438
  $arr = array(
439
  'id' => (int)$this->_customer->getId(),
440
  'email' => $this->_customer->getEmail(),
441
+ 'created_at' => date(
442
+ 'c',
443
+ strtotime($this->_customer->getCreatedAt())
444
+ ),
445
  'first_name' => $this->_customer->getFirstname(),
446
  'last_name' => $this->_customer->getLastname(),
447
+ 'store_id' => $this->_customer->getStoreId(),
448
  //'extra_info' => array(),
449
  );
450
 
451
  $isSubscribed = $this->_customer->getIsSubscribed();
452
+ if ($isSubscribed === null) {
453
+ $subscriber = Mage::getModel('newsletter/subscriber')
454
+ ->loadByEmail($this->_customer->getEmail());
455
+ if ($subscriber->getId()) {
456
  $isSubscribed = $subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED;
457
  } else {
458
  $isSubscribed = false;
459
  }
460
  }
461
+ $arr = array_merge(
462
+ $arr,
463
+ array('accepts_marketing' => (bool)$isSubscribed)
464
+ );
465
 
466
+ if ($title = $this->_customer->getPrefix()) {
467
  $arr = array_merge($arr, array('title' => $title));
468
  }
469
 
470
+ if ($dob = $this->_customer->getDob()) {
471
  $arr = array_merge($arr, array('birthdate' => $dob));
472
  }
473
 
474
+ if ($gender = $this->_customer->getGender()) {
475
  $arr = array_merge($arr, array('gender' => $gender));
476
  }
477
 
478
+ if ($address = $this->_customer->getDefaultBillingAddress()) {
479
  $street = $address->getStreet();
480
+ $arr = array_merge(
481
+ $arr,
482
+ array(
483
+ 'default_address' => array(
484
+ 'address1' => isset($street[0]) ? $street[0] : '',
485
+ 'address2' => isset($street[1]) ? $street[1] : '',
486
+ 'city' => $address->getCity(),
487
+ 'province' => $address->getRegion(),
488
+ 'phone' => $address->getTelephone(),
489
+ 'country_code' => $address->getCountryId(),
490
+ 'zip' => $address->getPostcode(),
491
+ ),
492
+ )
493
+ );
494
  }
495
 
496
  $tags = $this->_getCustomerProductTags();
497
+ if (!empty($tags) && $tags->getSize()) {
498
  $tagsArr = array();
499
  foreach ($tags as $_tag) {
500
  $tagsArr[] = $_tag->getName();
502
  $arr = array_merge($arr, array('tags' => $tagsArr));
503
  }
504
 
505
+ if ($group = Mage::getModel('customer/group')->load($this->_customer->getGroupId())) {
506
+ $arr = array_merge($arr, array(
507
+ 'groups' => array(
508
+ array(
509
+ 'id' => (int)$this->_customer->getGroupId(),
510
+ 'name' => $group->getCustomerGroupCode(),
511
+ ),
512
+ ),
513
+ ));
514
+ }
515
+
516
+ $extensionHelper = Mage::helper('mgconnector/extension');
517
+ $rewardPointsInstance = $extensionHelper
518
+ ->getRewardPointsIntegrationInstance();
519
+ if ($rewardPointsInstance !== false) {
520
+ $arr['rewards'] = $rewardPointsInstance
521
+ ->getCustomerUpdateData($this->_customer->getId());
522
  }
523
 
524
  return $arr;
532
  ->joinRel()
533
  ->addCustomerFilter($this->_customer->getId());
534
  }
535
+
536
  return $tags;
537
  }
538
 
539
+ protected function _prepareCustomerSubscribtionUpdateData(
540
+ $newsletter = false
541
+ ) {
542
  $quote = Mage::getSingleton('checkout/session')->getQuote();
543
  $store = Mage::app()->getStore();
544
 
545
  $arr = array(
546
  'email' => $this->_subscriber->getSubscriberEmail(),
547
  'accepts_marketing' => $this->_subscriber->getData('subscriber_status') == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED,
548
+ 'storeId' => $store->getStoreId(),
549
  );
550
 
551
+ if ($newsletter && (!is_object($quote) || $quote->getCheckoutMethod() !== Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST)) {
552
  $arr['is_newsletter_subscriber'] = true;
553
  }
554
 
562
  $arr = array(
563
  'email' => $this->_subscriber->getSubscriberEmail(),
564
  'accepts_marketing' => false,
565
+ 'storeId' => $store->getStoreId(),
566
  );
567
 
568
  return $arr;
569
  }
570
 
571
+ public function resend($queueItems, $resetAttempts = false)
572
+ {
573
+ $sent = 0;
574
+ foreach ($queueItems as $_queue) {
575
+ $result = $this->makeRequest($_queue->getEventType(),
576
+ unserialize($_queue->getPayload()),
577
+ $resetAttempts ? 1 : ($_queue->getAttempts() + 1),
578
+ $_queue->getId());
579
+ if ($result) {
580
+ Mage::getModel('mgconnector/queue')
581
+ ->load($_queue->getId())
582
+ ->delete();
583
+ $sent++;
584
+ }
585
+ }
586
+
587
+ return $sent;
588
  }
589
+
590
  public function run()
591
  {
592
  $collection = Mage::getModel('mgconnector/queue')->getCollection();
596
  ->where('next_attempt <= ?', $nextAttempt)
597
  ->where('status = 1')
598
  ->order('main_table.next_attempt asc');
599
+ $this->resend($collection);
600
+
601
  return $this;
602
  }
603
+ }
app/code/community/Remarkety/Mgconnector/Model/Resource/Rule/Collection.php CHANGED
@@ -82,6 +82,12 @@ class Remarkety_Mgconnector_Model_Resource_Rule_Collection extends Mage_SalesRu
82
  } else {
83
  $this->addFieldToFilter('main_table.coupon_type', Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON);
84
  }
 
 
 
 
 
 
85
  $this->setOrder('sort_order', self::SORT_ORDER_ASC);
86
  $this->setFlag('validation_filter', true);
87
  }
82
  } else {
83
  $this->addFieldToFilter('main_table.coupon_type', Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON);
84
  }
85
+
86
+ $select->where('
87
+ (main_table.to_date IS NULL) OR
88
+ (main_table.to_date >= ?)
89
+ ', $now);
90
+
91
  $this->setOrder('sort_order', self::SORT_ORDER_ASC);
92
  $this->setFlag('validation_filter', true);
93
  }
app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/Extension/AbstractController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Abstract extension controller.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ abstract class Remarkety_Mgconnector_Adminhtml_Extension_AbstractController
11
+ extends Mage_Adminhtml_Controller_Action
12
+ {
13
+ /**
14
+ * Init action.
15
+ *
16
+ * @return Remarkety_Mgconnector_Adminhtml_Extension_AbstractController
17
+ */
18
+ protected function initAction()
19
+ {
20
+ $this
21
+ ->loadLayout()
22
+ ->_title($this->__('Remarkety'))
23
+ ->_setActiveMenu('mgconnector');
24
+
25
+ return $this;
26
+ }
27
+ }
app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/Extension/RewardPointsController.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once __DIR__ . DS . 'AbstractController.php';
4
+
5
+ /**
6
+ * Reward points extension controller.
7
+ *
8
+ * @category Remarkety
9
+ * @package Remarkety_Mgconnector
10
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
11
+ */
12
+ class Remarkety_Mgconnector_Adminhtml_Extension_RewardPointsController
13
+ extends Remarkety_Mgconnector_Adminhtml_Extension_AbstractController
14
+ {
15
+ /**
16
+ * Index action.
17
+ *
18
+ * @return void
19
+ */
20
+ public function indexAction()
21
+ {
22
+ $this
23
+ ->initAction()
24
+ ->_title($this->__('Reward Points Extensions'))
25
+ ->renderLayout();
26
+ }
27
+ }
app/code/community/Remarkety/Mgconnector/etc/adminhtml.xml CHANGED
@@ -5,16 +5,22 @@
5
  <title>Remarkety</title>
6
  <sort_order>90</sort_order>
7
  <children>
8
- <mgconnector_configuration translate="title" module="mgconnector">
 
9
  <title>Remarkety Installation</title>
10
  <sort_order>10</sort_order>
11
  <action>adminhtml/install/complete</action>
12
  </mgconnector_configuration>
13
  <mgconnector_queue>
14
- <title>Configuration</title>
15
  <sort_order>20</sort_order>
16
  <action>adminhtml/queue/index</action>
17
  </mgconnector_queue>
 
 
 
 
 
18
  </children>
19
  </mgconnector>
20
  </menu>
@@ -22,34 +28,28 @@
22
  <resources>
23
  <admin>
24
  <children>
25
- <children>
26
- <mgconnector translate="title" module="mgconnector">
27
- <title>Remarkety</title>
28
- <children>
29
- <mgconnector_configuration translate="title" module="mgconnector">
30
- <title>Remarkety Configuration</title>
31
- <sort_order>10</sort_order>
32
- </mgconnector_configuration>
33
- <mgconnector_queue>
34
- <title>Remarkety Queue</title>
35
- <sort_order>20</sort_order>
36
- </mgconnector_queue>
37
- </children>
38
- </mgconnector>
39
- </children>
 
 
 
 
 
40
  </children>
41
  </admin>
42
  </resources>
43
  </acl>
44
- <events>
45
- <core_block_abstract_to_html_before>
46
- <observers>
47
- <multiuseraccounts_add_column_parent_customer>
48
- <type>singleton</type>
49
- <class>Cminds_MultiUserAccounts_Model_Observer</class>
50
- <method>beforeBlockToHtml</method>
51
- </multiuseraccounts_add_column_parent_customer>
52
- </observers>
53
- </core_block_abstract_to_html_before>
54
- </events>
55
  </config>
5
  <title>Remarkety</title>
6
  <sort_order>90</sort_order>
7
  <children>
8
+ <mgconnector_configuration translate="title"
9
+ module="mgconnector">
10
  <title>Remarkety Installation</title>
11
  <sort_order>10</sort_order>
12
  <action>adminhtml/install/complete</action>
13
  </mgconnector_configuration>
14
  <mgconnector_queue>
15
+ <title>Remarkety Configuration</title>
16
  <sort_order>20</sort_order>
17
  <action>adminhtml/queue/index</action>
18
  </mgconnector_queue>
19
+ <mgconnector_extensions_rewardpoints>
20
+ <title>Reward Points Extensions</title>
21
+ <sort_order>30</sort_order>
22
+ <action>adminhtml/extension_rewardPoints/index</action>
23
+ </mgconnector_extensions_rewardpoints>
24
  </children>
25
  </mgconnector>
26
  </menu>
28
  <resources>
29
  <admin>
30
  <children>
31
+ <children>
32
+ <mgconnector translate="title" module="mgconnector">
33
+ <title>Remarkety</title>
34
+ <children>
35
+ <mgconnector_configuration translate="title"
36
+ module="mgconnector">
37
+ <title>Remarkety Configuration</title>
38
+ <sort_order>10</sort_order>
39
+ </mgconnector_configuration>
40
+ <mgconnector_queue>
41
+ <title>Remarkety Queue</title>
42
+ <sort_order>20</sort_order>
43
+ </mgconnector_queue>
44
+ <mgconnector_extensions_rewardpoints>
45
+ <title>Reward Points Extensions</title>
46
+ <sort_order>30</sort_order>
47
+ </mgconnector_extensions_rewardpoints>
48
+ </children>
49
+ </mgconnector>
50
+ </children>
51
  </children>
52
  </admin>
53
  </resources>
54
  </acl>
 
 
 
 
 
 
 
 
 
 
 
55
  </config>
app/code/community/Remarkety/Mgconnector/etc/config.xml CHANGED
@@ -1,7 +1,8 @@
 
1
  <config>
2
  <modules>
3
  <Remarkety_Mgconnector>
4
- <version>1.4.6.1</version>
5
  </Remarkety_Mgconnector>
6
  </modules>
7
  <global>
@@ -20,14 +21,10 @@
20
  </mgconnector_resource>
21
  <salesrule_resource>
22
  <rewrite>
23
- <!-- Model -->
24
  <rule_collection>Remarkety_Mgconnector_Model_Resource_Rule_Collection</rule_collection>
25
- <!-- Model -->
26
  <coupon>Remarkety_Mgconnector_Model_Resource_Coupon</coupon>
27
  </rewrite>
28
-
29
  </salesrule_resource>
30
-
31
  </models>
32
  <resources>
33
  <mgconnector_setup>
@@ -120,6 +117,15 @@
120
  </remarkety_add_column_expiration_date>
121
  </observers>
122
  </core_block_abstract_to_html_before>
 
 
 
 
 
 
 
 
 
123
  </events>
124
  </global>
125
  <admin>
@@ -133,6 +139,15 @@
133
  </adminhtml>
134
  </routers>
135
  </admin>
 
 
 
 
 
 
 
 
 
136
  <frontend>
137
  <routers>
138
  <mgconnector>
@@ -159,5 +174,16 @@
159
  </mgconnector_cron>
160
  </jobs>
161
  </crontab>
162
- </config>
163
-
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
  <Remarkety_Mgconnector>
5
+ <version>1.4.7.0</version>
6
  </Remarkety_Mgconnector>
7
  </modules>
8
  <global>
21
  </mgconnector_resource>
22
  <salesrule_resource>
23
  <rewrite>
 
24
  <rule_collection>Remarkety_Mgconnector_Model_Resource_Rule_Collection</rule_collection>
 
25
  <coupon>Remarkety_Mgconnector_Model_Resource_Coupon</coupon>
26
  </rewrite>
 
27
  </salesrule_resource>
 
28
  </models>
29
  <resources>
30
  <mgconnector_setup>
117
  </remarkety_add_column_expiration_date>
118
  </observers>
119
  </core_block_abstract_to_html_before>
120
+ <rewardpoints_transaction_save_after>
121
+ <observers>
122
+ <remarkety_customer_rewardpoints_update>
123
+ <type>singleton</type>
124
+ <class>mgconnector/extension_rewardPoints_observer_magestoreRewardPoints</class>
125
+ <method>updateCustomerRewardPoints</method>
126
+ </remarkety_customer_rewardpoints_update>
127
+ </observers>
128
+ </rewardpoints_transaction_save_after>
129
  </events>
130
  </global>
131
  <admin>
139
  </adminhtml>
140
  </routers>
141
  </admin>
142
+ <adminhtml>
143
+ <layout>
144
+ <updates>
145
+ <mgconnector>
146
+ <file>mgconnector.xml</file>
147
+ </mgconnector>
148
+ </updates>
149
+ </layout>
150
+ </adminhtml>
151
  <frontend>
152
  <routers>
153
  <mgconnector>
174
  </mgconnector_cron>
175
  </jobs>
176
  </crontab>
177
+ <default>
178
+ <mgconnector_supported_extensions>
179
+ <rewardpoints>
180
+ <magestore_rewardpoints>
181
+ <model>Remarkety_Mgconnector_Model_Extension_RewardPoints_MagestoreRewardPoints</model>
182
+ <title>Mage Store Reward Points</title>
183
+ <url>http://www.magestore.com/rewardpoints/</url>
184
+ <sortOrder>10</sortOrder>
185
+ </magestore_rewardpoints>
186
+ </rewardpoints>
187
+ </mgconnector_supported_extensions>
188
+ </default>
189
+ </config>
app/design/adminhtml/default/default/layout/mgconnector.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Adminhtml layout update.
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ -->
11
+ <layout version="0.1.0">
12
+ <adminhtml_extension_rewardpoints_index>
13
+ <reference name="content">
14
+ <block type="mgconnector/adminhtml_extension_rewardPoints"
15
+ name="remarkety.extension.rewardpoints"
16
+ template="mgconnector/extension/rewardpoints.phtml"/>
17
+ </reference>
18
+ </adminhtml_extension_rewardpoints_index>
19
+ </layout>
app/design/adminhtml/default/default/template/mgconnector/extension/rewardpoints.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin reward points extension template.
4
+ *
5
+ * @category Remarkety
6
+ * @package Remarkety_Mgconnector
7
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
8
+ */
9
+ ?>
10
+ <?php
11
+ $extensionHelper = Mage::helper('mgconnector/extension');
12
+
13
+ $supportedExtensions = $this->getSupportedExtensionNames();
14
+ $enabledExtensions = $extensionHelper->getEnabledRewardPointsExtensions();
15
+ ?>
16
+ <div class="content-header">
17
+ <h3 class="icon-head"><?php echo $this->getPageHeader() ?></h3>
18
+ </div>
19
+
20
+ <div class="entry-edit">
21
+ <div class="entry-edit-head">
22
+ <h4 class="head-edit-form fieldset-legend">
23
+ <?php echo $this->getPageHeader() ?>
24
+ </h4>
25
+ </div>
26
+ <div class="fieldset">
27
+ <div>
28
+ <?php if (!empty($enabledExtensions)) : ?>
29
+ <?php echo $this->__('Reward point extension detected: ') ?>
30
+ <strong><?php echo $this->getEnabledExtensionsListHtml() ?></strong>.
31
+ <?php
32
+ echo $this->__(
33
+ 'Reward point information will be synchronized with Remarkety.'
34
+ );
35
+ ?>
36
+ <?php else: ?>
37
+ <?php
38
+ echo $this->__(
39
+ 'There are no reward point extensions detected. '
40
+ . 'Remarkety can currently detect and synchronize reward '
41
+ . 'points from %s.',
42
+ implode(', ', $supportedExtensions)
43
+ );
44
+ ?>
45
+
46
+ <?php endif; ?>
47
+
48
+ <a href="<?php echo $this->getReadMoreUrl() ?>" target="_blank">
49
+ <?php echo $this->__('Read more.') ?>
50
+ </a>
51
+ </div>
52
+ </div>
53
+ </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Remarkety_Mgconnector</name>
4
- <version>1.4.6.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.html">GPL v3</license>
7
  <channel>community</channel>
@@ -9,15 +9,15 @@
9
  <summary>Remarkety Magento Connector</summary>
10
  <description>Remarkety Magento Connector</description>
11
  <notes>No comments</notes>
12
- <date>2016-06-29</date>
13
- <time>14-48-52</time>
14
  <contents>
15
  <target name="magecommunity">
16
- <dir name="Remarkety"><dir name="Mgconnector"><dir name="Block"><dir name="Adminhtml"><dir name="Configuration"><dir name="Complete"><file name="Form.php" hash="dc799532128513364fc3afd17eabb78b"/></dir><file name="Complete.php" hash="b9f7b4ecbd2be587c0efbd16523b167e"/><dir name="Configuration"><file name="Form.php" hash="89b286409ad9d64ae8e51e314198f427"/></dir><file name="Configuration.php" hash="67b3b564c2c3123301f5f97b2b258a7a"/><dir name="Install"><file name="Form.php" hash="59541fe2ad9a49b9fb56a41f00e6a591"/></dir><file name="Install.php" hash="f631fcdfd86d2bc416eb1ad4422fc20c"/><dir name="Upgrade"><file name="Form.php" hash="598f83eca99d0153537e22f9ee6b1934"/></dir><file name="Upgrade.php" hash="c672741b0407f108d2266dd939590846"/></dir><file name="Configuration.php" hash="bf0c9aabe92f669694e0699c009b2a9c"/><dir name="Install"><dir name="Complete"><file name="Form.php" hash="5992149b9ff2d2a7c2b008d98098362d"/></dir><file name="Complete.php" hash="452944c613b88ede358ee4dacd562d05"/><dir name="Install"><dir name="Create"><file name="Form.php" hash="65d98f1449ce6af413a3185692e07533"/></dir><file name="Create.php" hash="0d3182923fd5542e3d0a757625a85ae4"/><dir name="Login"><file name="Form.php" hash="a58c19056e47c7851eb6a5f40517f757"/></dir><file name="Login.php" hash="3ee61a883f843c55b1b32a328af84322"/></dir><dir name="Upgrade"><file name="Form.php" hash="6f4e2ac19d30115de4e275fdb8dca5b6"/></dir><file name="Upgrade.php" hash="f16ba61a8c86007bbc0a980e8faeade1"/><dir name="Welcome"><file name="Form.php" hash="58cb26cc7555498bd0367c77a99c8d60"/><file name="Store.php" hash="9f3b5c7bbd9f4d7201189598e5a64cc4"/></dir><file name="Welcome.php" hash="86589c79b5c38ea5f25d58ac932f33cb"/></dir><dir name="Queue"><dir name="Configure"><file name="Form.php" hash="9f754c625055984f7c145e56aaf46245"/></dir><file name="Configure.php" hash="03d5ebf7644462904c439d172cde3afc"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="EventType.php" hash="4ac5971c368b70efa96b4c8297c85c3c"/><file name="Status.php" hash="ec57ddafc2515b952958e6ace6de22ec"/></dir></dir></dir><file name="Grid.php" hash="74d5f3b18d76cdf8219e2d39a83a2f7c"/></dir><file name="Queue.php" hash="2c905cc54a6c08d4d73a392d5b95a25c"/></dir><dir name="Tracking"><file name="Base.php" hash="5e0f245ac5ee59d2f6c6f35087059b56"/><file name="General.php" hash="9ca2796c6f2bf9233553e6b782f3722b"/><file name="Product.php" hash="3a0c1b1a5fcbd23d1dcd04714742ebe9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b27f970b943e6e989e9061275cc25c7b"/><file name="Links.php" hash="8bb36c918e956663113646183bd33c4c"/><file name="Urls.php" hash="ce396940c96bf8139da8ec59bb498acf"/></dir><dir name="Model"><dir name="Core"><file name="Api.php" hash="948c7965f7fe9d044b532314aaa8e0f9"/></dir><file name="Core.php" hash="7f1989c8e305138d72aaf28239fa2813"/><file name="Install.php" hash="fc260ea02ba27273cd51e7051c953cce"/><file name="Observer.php" hash="8975e5b8d9802b616d9b177cd1e58599"/><file name="Queue.php" hash="3a0fda4b18ec947c20e6e81cc1e995de"/><file name="Recovery.php" hash="bd856fdd5788e00bcf29a67446ad8ef1"/><file name="Request.php" hash="47e81216d7bca3f0aba93bf816298221"/><dir name="Resource"><file name="Coupon.php" hash="6079c05e422e9c1ad5327fc881cee7e3"/><dir name="Queue"><file name="Collection.php" hash="ce59b04c8a8146f5094d6622134885d3"/></dir><file name="Queue.php" hash="971a539849d0cde2e413b0642403a6ca"/><dir name="Rule"><file name="Collection.php" hash="d57fff76c25dab67dbdbbd57b3afdfdf"/></dir><file name="Setup.php" hash="13253a5b7a2749f4a3bc84e32e31e27c"/></dir><file name="Webtracking.php" hash="4b2d9d73dcc8d68b40f375f6c55c4999"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigureController.php" hash="b4e51acf22ea798e2d2144a4672bc30f"/><file name="InstallController.php" hash="cebbe5f80c59d6fbc18eecff20e7d432"/><file name="MgconnectorController.php" hash="a8e55464624c5fa9e9641cf97f963b3b"/><file name="QueueController.php" hash="5de347b6e0f6d04a19817097ab44bff3"/></dir><file name="RecoveryController.php" hash="0a53efaef9019c6b661fe494067473e3"/><file name="WebtrackingController.php" hash="fd2c5034d94161c0e6f7f4e6b5816a55"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c555aaf95943f74e1c29032e3ed385a1"/><file name="api.xml" hash="9f6d5fd3330bb0640f97efc3f819e684"/><file name="config.xml" hash="7a4bf2ed3f8bd6955a3f9e97c0639ccd"/></dir><dir name="sql"><dir name="mgconnector_setup"><file name="mysql4-install-1.0.0.13.php" hash="d1033ffd3d6b13af28ad4082d5744c25"/><file name="mysql4-upgrade-1.0.0.13-1.0.0.14.php" hash="db871ba73f3dcc7abfb806991edc12f1"/><file name="mysql4-upgrade-1.0.0.14-1.0.0.15.php" hash="c9ced7a4a2e85c9d594e9f97320cab58"/><file name="mysql4-upgrade-1.0.0.14-1.1.0.0.php" hash="fd445e8c179cdb2718a85adec05c5343"/><file name="mysql4-upgrade-1.1.0.5-1.1.0.6.php" hash="e24831cfd077827ba545f7ea71669729"/><file name="mysql4-upgrade-1.1.2.8-1.3.0.0.php" hash="97bbb9e411bcd45f875f29fcc8c8b420"/></dir></dir></dir></dir></target>
17
  <target name="mageetc">
18
  <dir name="modules"><file name="Remarkety_Mgconnector.xml" hash="d584b234f653fbf34376e7dcb8caf117"/></dir></target>
19
  <target name="magedesign">
20
- <dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mgconnector"><file name="element.phtml" hash="b956df05d4eeb30f5199a75deab74fbc"/><dir name="install"><dir name="welcome"><file name="store.phtml" hash="3839928b62115329e0f3af442f44774d"/></dir></dir><dir name="widget"><dir name="form"><dir name="renderer"><dir name="fieldset"><file name="element.phtml" hash="abd5b9848b714779ddecb4536c846395"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mgconnector.xml" hash="81584e822ae52179c8fb1dfc48cb8a9f"/></dir><dir name="template"><dir name="mgconnector"><dir name="tracking"><file name="general.phtml" hash="9da11c45059c094753ea65b2067be9a7"/><file name="product_view.phtml" hash="cf48e30b61979eaed3813b422959937f"/></dir></dir></dir></dir></dir></dir></target>
21
  </contents>
22
  <compatible/>
23
  <dependencies>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Remarkety_Mgconnector</name>
4
+ <version>1.4.7.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0.html">GPL v3</license>
7
  <channel>community</channel>
9
  <summary>Remarkety Magento Connector</summary>
10
  <description>Remarkety Magento Connector</description>
11
  <notes>No comments</notes>
12
+ <date>2016-06-30</date>
13
+ <time>16-03-13</time>
14
  <contents>
15
  <target name="magecommunity">
16
+ <dir name="Remarkety"><dir name="Mgconnector"><dir name="Block"><dir name="Adminhtml"><dir name="Configuration"><dir name="Complete"><file name="Form.php" hash="dc799532128513364fc3afd17eabb78b"/></dir><file name="Complete.php" hash="b9f7b4ecbd2be587c0efbd16523b167e"/><dir name="Configuration"><file name="Form.php" hash="89b286409ad9d64ae8e51e314198f427"/></dir><file name="Configuration.php" hash="67b3b564c2c3123301f5f97b2b258a7a"/><dir name="Install"><file name="Form.php" hash="59541fe2ad9a49b9fb56a41f00e6a591"/></dir><file name="Install.php" hash="f631fcdfd86d2bc416eb1ad4422fc20c"/><dir name="Upgrade"><file name="Form.php" hash="598f83eca99d0153537e22f9ee6b1934"/></dir><file name="Upgrade.php" hash="c672741b0407f108d2266dd939590846"/></dir><file name="Configuration.php" hash="bf0c9aabe92f669694e0699c009b2a9c"/><dir name="Extension"><file name="RewardPoints.php" hash="82e320930f59dfd45e5aa73005118833"/></dir><dir name="Install"><dir name="Complete"><file name="Form.php" hash="5992149b9ff2d2a7c2b008d98098362d"/></dir><file name="Complete.php" hash="452944c613b88ede358ee4dacd562d05"/><dir name="Install"><dir name="Create"><file name="Form.php" hash="65d98f1449ce6af413a3185692e07533"/></dir><file name="Create.php" hash="0d3182923fd5542e3d0a757625a85ae4"/><dir name="Login"><file name="Form.php" hash="a58c19056e47c7851eb6a5f40517f757"/></dir><file name="Login.php" hash="3ee61a883f843c55b1b32a328af84322"/></dir><dir name="Upgrade"><file name="Form.php" hash="6f4e2ac19d30115de4e275fdb8dca5b6"/></dir><file name="Upgrade.php" hash="f16ba61a8c86007bbc0a980e8faeade1"/><dir name="Welcome"><file name="Form.php" hash="58cb26cc7555498bd0367c77a99c8d60"/><file name="Store.php" hash="9f3b5c7bbd9f4d7201189598e5a64cc4"/></dir><file name="Welcome.php" hash="86589c79b5c38ea5f25d58ac932f33cb"/></dir><dir name="Queue"><dir name="Configure"><file name="Form.php" hash="9f754c625055984f7c145e56aaf46245"/></dir><file name="Configure.php" hash="03d5ebf7644462904c439d172cde3afc"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="EventType.php" hash="4ac5971c368b70efa96b4c8297c85c3c"/><file name="Status.php" hash="ec57ddafc2515b952958e6ace6de22ec"/></dir></dir></dir><file name="Grid.php" hash="74d5f3b18d76cdf8219e2d39a83a2f7c"/></dir><file name="Queue.php" hash="2c905cc54a6c08d4d73a392d5b95a25c"/></dir><dir name="Tracking"><file name="Base.php" hash="5e0f245ac5ee59d2f6c6f35087059b56"/><file name="General.php" hash="9ca2796c6f2bf9233553e6b782f3722b"/><file name="Product.php" hash="3a0c1b1a5fcbd23d1dcd04714742ebe9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="b27f970b943e6e989e9061275cc25c7b"/><file name="Extension.php" hash="5788a232ffaa32674b4bfc1e12e4ea98"/><file name="Links.php" hash="8bb36c918e956663113646183bd33c4c"/><file name="Urls.php" hash="ce396940c96bf8139da8ec59bb498acf"/></dir><dir name="Model"><dir name="Core"><file name="Api.php" hash="948c7965f7fe9d044b532314aaa8e0f9"/></dir><file name="Core.php" hash="1034d8a7c1246805dea0a1fb259ffc0f"/><dir name="Extension"><dir name="RewardPoints"><file name="AbstractIntegration.php" hash="4ac34942072ce49d2971065a82d1068c"/><file name="IntegrationInterface.php" hash="f95f9f1e243c9fd920d27b9299b90f72"/><file name="MagestoreRewardPoints.php" hash="28671b6f35cb829f2d11166f081ad816"/><dir name="Observer"><file name="AbstractObserver.php" hash="eb710b7582050de644de2a8402d759ec"/><file name="MagestoreRewardPoints.php" hash="bac2ae11f94aa923accb0437027b4bec"/></dir></dir></dir><file name="Install.php" hash="fc260ea02ba27273cd51e7051c953cce"/><file name="Observer.php" hash="58af7cc67d91ae2fcb7890eb8c1a133c"/><file name="Queue.php" hash="3a0fda4b18ec947c20e6e81cc1e995de"/><file name="Recovery.php" hash="bd856fdd5788e00bcf29a67446ad8ef1"/><file name="Request.php" hash="47e81216d7bca3f0aba93bf816298221"/><dir name="Resource"><file name="Coupon.php" hash="6079c05e422e9c1ad5327fc881cee7e3"/><dir name="Queue"><file name="Collection.php" hash="ce59b04c8a8146f5094d6622134885d3"/></dir><file name="Queue.php" hash="971a539849d0cde2e413b0642403a6ca"/><dir name="Rule"><file name="Collection.php" hash="b7cd7bbc0c4100a1a320e0f551be067a"/></dir><file name="Setup.php" hash="13253a5b7a2749f4a3bc84e32e31e27c"/></dir><file name="Webtracking.php" hash="4b2d9d73dcc8d68b40f375f6c55c4999"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigureController.php" hash="b4e51acf22ea798e2d2144a4672bc30f"/><dir name="Extension"><file name="AbstractController.php" hash="f5402dbc0e13412a52b70b5d36a14110"/><file name="RewardPointsController.php" hash="3e94e5ae4d467abf03f41e260b0421f9"/></dir><file name="InstallController.php" hash="cebbe5f80c59d6fbc18eecff20e7d432"/><file name="MgconnectorController.php" hash="a8e55464624c5fa9e9641cf97f963b3b"/><file name="QueueController.php" hash="5de347b6e0f6d04a19817097ab44bff3"/></dir><file name="RecoveryController.php" hash="0a53efaef9019c6b661fe494067473e3"/><file name="WebtrackingController.php" hash="fd2c5034d94161c0e6f7f4e6b5816a55"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a417737a2225ef9f70b47eef77d75b7c"/><file name="api.xml" hash="9f6d5fd3330bb0640f97efc3f819e684"/><file name="config.xml" hash="1ecb5327294ccbf97f02d517ce658f64"/></dir><dir name="sql"><dir name="mgconnector_setup"><file name="mysql4-install-1.0.0.13.php" hash="d1033ffd3d6b13af28ad4082d5744c25"/><file name="mysql4-upgrade-1.0.0.13-1.0.0.14.php" hash="db871ba73f3dcc7abfb806991edc12f1"/><file name="mysql4-upgrade-1.0.0.14-1.0.0.15.php" hash="c9ced7a4a2e85c9d594e9f97320cab58"/><file name="mysql4-upgrade-1.0.0.14-1.1.0.0.php" hash="fd445e8c179cdb2718a85adec05c5343"/><file name="mysql4-upgrade-1.1.0.5-1.1.0.6.php" hash="e24831cfd077827ba545f7ea71669729"/><file name="mysql4-upgrade-1.1.2.8-1.3.0.0.php" hash="97bbb9e411bcd45f875f29fcc8c8b420"/></dir></dir></dir></dir></target>
17
  <target name="mageetc">
18
  <dir name="modules"><file name="Remarkety_Mgconnector.xml" hash="d584b234f653fbf34376e7dcb8caf117"/></dir></target>
19
  <target name="magedesign">
20
+ <dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mgconnector.xml" hash="f08b20d71711e3497822310184cc903f"/></dir><dir name="template"><dir name="mgconnector"><file name="element.phtml" hash="b956df05d4eeb30f5199a75deab74fbc"/><dir name="extension"><file name="rewardpoints.phtml" hash="80b6252967b82121a2c6c19eff26b6a4"/></dir><dir name="install"><dir name="welcome"><file name="store.phtml" hash="3839928b62115329e0f3af442f44774d"/></dir></dir><dir name="widget"><dir name="form"><dir name="renderer"><dir name="fieldset"><file name="element.phtml" hash="abd5b9848b714779ddecb4536c846395"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="mgconnector.xml" hash="81584e822ae52179c8fb1dfc48cb8a9f"/></dir><dir name="template"><dir name="mgconnector"><dir name="tracking"><file name="general.phtml" hash="9da11c45059c094753ea65b2067be9a7"/><file name="product_view.phtml" hash="cf48e30b61979eaed3813b422959937f"/></dir></dir></dir></dir></dir></dir></target>
21
  </contents>
22
  <compatible/>
23
  <dependencies>