Remarkety_Mgconnector - Version 1.4.3.0

Version Notes

No comments

Download this release

Release Info

Developer Remarkety
Extension Remarkety_Mgconnector
Version 1.4.3.0
Comparing to
See all releases


Version 1.4.3.0

Files changed (69) hide show
  1. CHANGELOG.txt +79 -0
  2. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration.php +24 -0
  3. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Complete.php +35 -0
  4. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Complete/Form.php +62 -0
  5. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Configuration.php +41 -0
  6. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Configuration/Form.php +64 -0
  7. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Install.php +35 -0
  8. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Install/Form.php +90 -0
  9. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Upgrade.php +35 -0
  10. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Upgrade/Form.php +71 -0
  11. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Complete.php +37 -0
  12. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Complete/Form.php +63 -0
  13. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Create.php +33 -0
  14. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Create/Form.php +140 -0
  15. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Login.php +33 -0
  16. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Login/Form.php +130 -0
  17. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Upgrade.php +37 -0
  18. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Upgrade/Form.php +62 -0
  19. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome.php +39 -0
  20. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome/Form.php +56 -0
  21. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome/Store.php +60 -0
  22. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue.php +24 -0
  23. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Configure.php +38 -0
  24. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Configure/Form.php +104 -0
  25. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid.php +116 -0
  26. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid/Column/Renderer/EventType.php +29 -0
  27. app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid/Column/Renderer/Status.php +25 -0
  28. app/code/community/Remarkety/Mgconnector/Block/Tracking/Base.php +35 -0
  29. app/code/community/Remarkety/Mgconnector/Block/Tracking/General.php +5 -0
  30. app/code/community/Remarkety/Mgconnector/Block/Tracking/Product.php +57 -0
  31. app/code/community/Remarkety/Mgconnector/Helper/Data.php +74 -0
  32. app/code/community/Remarkety/Mgconnector/Helper/Links.php +64 -0
  33. app/code/community/Remarkety/Mgconnector/Helper/Urls.php +46 -0
  34. app/code/community/Remarkety/Mgconnector/Model/Core.php +1399 -0
  35. app/code/community/Remarkety/Mgconnector/Model/Core/Api.php +211 -0
  36. app/code/community/Remarkety/Mgconnector/Model/Install.php +484 -0
  37. app/code/community/Remarkety/Mgconnector/Model/Observer.php +499 -0
  38. app/code/community/Remarkety/Mgconnector/Model/Queue.php +16 -0
  39. app/code/community/Remarkety/Mgconnector/Model/Recovery.php +92 -0
  40. app/code/community/Remarkety/Mgconnector/Model/Request.php +131 -0
  41. app/code/community/Remarkety/Mgconnector/Model/Resource/Coupon.php +77 -0
  42. app/code/community/Remarkety/Mgconnector/Model/Resource/Queue.php +30 -0
  43. app/code/community/Remarkety/Mgconnector/Model/Resource/Queue/Collection.php +30 -0
  44. app/code/community/Remarkety/Mgconnector/Model/Resource/Rule/Collection.php +138 -0
  45. app/code/community/Remarkety/Mgconnector/Model/Resource/Setup.php +13 -0
  46. app/code/community/Remarkety/Mgconnector/Model/Webtracking.php +40 -0
  47. app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/ConfigureController.php +55 -0
  48. app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/InstallController.php +186 -0
  49. app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/MgconnectorController.php +192 -0
  50. app/code/community/Remarkety/Mgconnector/controllers/Adminhtml/QueueController.php +129 -0
  51. app/code/community/Remarkety/Mgconnector/controllers/RecoveryController.php +53 -0
  52. app/code/community/Remarkety/Mgconnector/controllers/WebtrackingController.php +31 -0
  53. app/code/community/Remarkety/Mgconnector/etc/adminhtml.xml +55 -0
  54. app/code/community/Remarkety/Mgconnector/etc/api.xml +68 -0
  55. app/code/community/Remarkety/Mgconnector/etc/config.xml +163 -0
  56. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-install-1.0.0.13.php +26 -0
  57. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-upgrade-1.0.0.13-1.0.0.14.php +26 -0
  58. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-upgrade-1.0.0.14-1.0.0.15.php +13 -0
  59. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-upgrade-1.0.0.14-1.1.0.0.php +13 -0
  60. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-upgrade-1.1.0.5-1.1.0.6.php +15 -0
  61. app/code/community/Remarkety/Mgconnector/sql/mgconnector_setup/mysql4-upgrade-1.1.2.8-1.3.0.0.php +21 -0
  62. app/design/adminhtml/default/default/template/mgconnector/element.phtml +26 -0
  63. app/design/adminhtml/default/default/template/mgconnector/install/welcome/store.phtml +70 -0
  64. app/design/adminhtml/default/default/template/mgconnector/widget/form/renderer/fieldset/element.phtml +26 -0
  65. app/design/frontend/base/default/layout/mgconnector.xml +13 -0
  66. app/design/frontend/base/default/template/mgconnector/tracking/general.phtml +23 -0
  67. app/design/frontend/base/default/template/mgconnector/tracking/product_view.phtml +10 -0
  68. app/etc/modules/Remarkety_Mgconnector.xml +12 -0
  69. package.xml +31 -0
CHANGELOG.txt ADDED
@@ -0,0 +1,79 @@
1
+ 1.4.3.0
2
+ -------
3
+ - Bypass store cache for website tracking
4
+ - Changed menu titles
5
+
6
+ 1.4.2.0
7
+ -------
8
+ - Clear cache after enable/disable website tracking
9
+ - Bugfix: Array declaration error on old PHP versions
10
+
11
+ 1.4.1.0
12
+ -------
13
+ Allow admin to change Remarkety's api key
14
+
15
+ 1.4.0.2
16
+ -------
17
+ Bug fix subscribers view id
18
+
19
+ 1.4.0.1
20
+ -------
21
+ Newsletter subscription saves the email address to the cart
22
+
23
+ 1.4.0.0
24
+ -------
25
+ Enable website tracking from the Remarkety installation menu
26
+
27
+ 1.3.0.1
28
+ -------
29
+ Automatic tagging for newsletter subscribers
30
+
31
+ 1.3.0.0
32
+ -------
33
+ - Add support for per-coupon expiration dates
34
+
35
+ 1.2.0.0
36
+ -------
37
+ - Automatic tagging for newsletter subscribers
38
+ - Add cart recovery link
39
+ - Payment method field added for segmentation
40
+
41
+ 1.1.2.7
42
+ -------
43
+ - Don't sync products which are not visible
44
+ - Deal with no tags collection
45
+ - Fix table prefix issue
46
+
47
+ 1.1.2.6
48
+ -------
49
+ - Backward compatibility for PHP 5.3
50
+
51
+ 1.1.0.10
52
+ --------
53
+ - Support installation of multiple views through the plugin
54
+ - Error logging improvements
55
+
56
+ 1.1.0.9
57
+ -------
58
+ - API can return log for analysis
59
+ - Return more information: Discount prices, stock levels, parent product
60
+ - Performance improvements when fetching products
61
+
62
+ 1.1.0.4
63
+ -------
64
+ - Fix bug in creating a Magento Web Service user, when another WS user already has the same email
65
+
66
+ 1.1.0.3
67
+ -------
68
+ - Fix bug in comparing what's changed in customer observer
69
+
70
+ 1.1.0.1
71
+ -------
72
+ - Resend / delete queue events
73
+
74
+ 1.1.0.0
75
+ -------
76
+ - Implement one-click install for Magento
77
+ - Send customer update events (signup / subscribe / unsubscribe) immediately (push)
78
+ - Fix problem with multiple views
79
+ - Resend / delete queue events
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration.php ADDED
@@ -0,0 +1,24 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration extends Mage_Adminhtml_Block_Widget_Grid_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ $this->_blockGroup = 'mgconnector';
18
+ $this->_controller = 'adminhtml_configuration';
19
+ $this->_headerText = Mage::helper('mgconnector')->__('Remarkety Configuration');
20
+ $this->_removeButton('add');
21
+
22
+ parent::__construct();
23
+ }
24
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Complete.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration complete block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Complete extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'complete_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_configuration';
22
+ $this->_mode = 'complete';
23
+
24
+ $ver = Mage::getConfig()->getModuleConfig("Remarkety_Mgconnector")->version;
25
+ $this->_headerText = $this->__('Install Complete (version: %s)', $ver);
26
+
27
+ $this->_removeButton('back');
28
+ $this->_removeButton('reset');
29
+ $this->_addButton('save', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Done'),
31
+ 'onclick' => 'editForm.submit();',
32
+ 'class' => 'save',
33
+ ), 1);
34
+ }
35
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Complete/Form.php ADDED
@@ -0,0 +1,62 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration complete form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Complete_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Installation Complete')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'complete',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' => '<p style="font-weight:bold;">' . $this->__('Installation complete!') . '</p>'
44
+ ));
45
+ $instruction->getRenderer()->setTemplate('mgconnector/widget/form/renderer/fieldset/element.phtml');
46
+
47
+ $response = unserialize(Mage::getStoreConfig('remarkety/mgconnector/last_response'),true);
48
+ $fieldset->addField('response', 'note', array(
49
+ 'label' => false,
50
+ 'after_element_html' => !empty($response['info']) ? $response['info'] : $this->__('There is no response to display')
51
+ ));
52
+
53
+ $fieldset->addField('button', 'note', array(
54
+ 'label' => false,
55
+ 'name' => 'button',
56
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
57
+ . $this->__('Done') . '</span></span></button>'
58
+ ));
59
+
60
+ return parent::_prepareForm();
61
+ }
62
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Configuration.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration configuration block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Configuration extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'configuration_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_configuration';
22
+ $this->_mode = 'configuration';
23
+
24
+ $ver = Mage::getConfig()->getModuleConfig("Remarkety_Mgconnector")->version;
25
+ $this->_headerText = $this->__('Remarkety configuration (version: %s)', $ver);
26
+
27
+ $this->_removeButton('back');
28
+ $this->_removeButton('reset');
29
+ $this->_addButton('save', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Save'),
31
+ 'onclick' => 'editForm.submit();',
32
+ 'class' => 'save',
33
+ ), 1);
34
+
35
+ $this->_addButton('reinstall', array(
36
+ 'label' => Mage::helper('adminhtml')->__('Reinstall'),
37
+ 'onclick' => "return confirm('Are you sure?') ? window.location = '" . $this->getUrl('*/*/reinstall')."' : false;",
38
+ 'class' => 'delete',
39
+ ), 0);
40
+ }
41
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Configuration/Form.php ADDED
@@ -0,0 +1,64 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration configuration form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Configuration_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/configuration'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Remarkety configuration')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'configuration',
38
+ ));
39
+
40
+ $fieldset->addField('intervals', 'text', array(
41
+ 'label' => $this->__('Intervals:'),
42
+ 'name' => 'data[intervals]',
43
+ 'required' => true,
44
+ 'after_element_html' => '<small style="float:left;width:100%;">' . $this->__(
45
+ 'Here you have to type amount of minutes separated by commas.For example "1,3,10" -
46
+ it means that second attempt will be after 1 minute, third after 3 minutes,
47
+ and fourth after 10 minutes.If last attempt will not be successful,
48
+ status will be changed to "failed" and it will not be processed anymore.'
49
+ ) . '</small>',
50
+ 'value' => Mage::getStoreConfig('remarkety/mgconnector/intervals'),
51
+ 'style' => 'float:left',
52
+ ));
53
+
54
+ $button = $fieldset->addField('button', 'note', array(
55
+ 'label' => false,
56
+ 'name' => 'button',
57
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
58
+ . $this->__('Save') . '</span></span></button>',
59
+ ));
60
+ $button->getRenderer()->setTemplate('mgconnector/widget/form/renderer/fieldset/element.phtml');
61
+
62
+ return parent::_prepareForm();
63
+ }
64
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Install.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration install block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Install extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'install_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_configuration';
22
+ $this->_mode = 'install';
23
+
24
+ $ver = Mage::getConfig()->getModuleConfig("Remarkety_Mgconnector")->version;
25
+ $this->_headerText = $this->__('Install Remarkety extension (version: %s)', $ver);
26
+
27
+ $this->_removeButton('back');
28
+ $this->_removeButton('reset');
29
+ $this->_addButton('save', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Complete Installation'),
31
+ 'onclick' => 'editForm.submit();',
32
+ 'class' => 'save',
33
+ ), 1);
34
+ }
35
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Install/Form.php ADDED
@@ -0,0 +1,90 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration install form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Install_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Install Remarkety extension')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'install',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' =>
44
+ '<p style="font-weight:bold;">' . $this->__('Thank you for installing the Remarkety Magento plugin.
45
+ You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
46
+ . '<br><br>'
47
+ . $this->__('The plugin will automatically create a Magento WebService API user so that
48
+ Remarkety can synchronize with your store.') . '</p>',
49
+ ));
50
+ $instruction->getRenderer()->setTemplate('mgconnector/widget/form/renderer/fieldset/element.phtml');
51
+
52
+ $fieldset->addField('email', 'text', array(
53
+ 'label' => $this->__('Email address for the Remarkety account:'),
54
+ 'name' => 'data[email]',
55
+ 'required' => true,
56
+ 'class' => 'validate-email',
57
+ 'after_element_html' => '<small style="float:left;width:100%;">' . $this->__(
58
+ 'If you’ve already registered to Remarkety, please use the email you used to open your account.
59
+ If you haven’t, an email will be sent to this address with the login information. You will then be able
60
+ to choose your password.'
61
+ ) . '</small>',
62
+ 'style' => 'float:left',
63
+ ));
64
+
65
+ $fieldset->addField('store_id', 'select', array(
66
+ 'name' => 'data[store_id]',
67
+ 'label' => $this->__('Sync Remarkety with this view:'),
68
+ 'required' => true,
69
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false),
70
+ ));
71
+
72
+ $fieldset->addField('terms', 'checkbox', array(
73
+ 'label' => false,
74
+ 'name' => 'data[terms]',
75
+ 'checked' => false,
76
+ 'value' => '1',
77
+ 'class' => 'required-entry',
78
+ 'after_element_html' => $this->__('I agree to Remarkety’s <a href="%s">terms of use</a>.', '#'),
79
+ ));
80
+
81
+ $fieldset->addField('button', 'note', array(
82
+ 'label' => false,
83
+ 'name' => 'button',
84
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
85
+ . $this->__('Complete Installation') . '</span></span></button>'
86
+ ));
87
+
88
+ return parent::_prepareForm();
89
+ }
90
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Upgrade.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration upgrade block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Upgrade extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'upgrade_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_configuration';
22
+ $this->_mode = 'upgrade';
23
+
24
+ $ver = Mage::getConfig()->getModuleConfig("Remarkety_Mgconnector")->version;
25
+ $this->_headerText = $this->__('Upgrade Remarkety extension (version: %s)', $ver);
26
+
27
+ $this->_removeButton('back');
28
+ $this->_removeButton('reset');
29
+ $this->_addButton('save', array(
30
+ 'label' => Mage::helper('adminhtml')->__('Complete Installation'),
31
+ 'onclick' => 'editForm.submit();',
32
+ 'class' => 'save',
33
+ ), 1);
34
+ }
35
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Configuration/Upgrade/Form.php ADDED
@@ -0,0 +1,71 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration upgrade form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Configuration_Upgrade_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Upgrade Remarkety extension')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'upgrade',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' =>
44
+ '<p style="font-weight:bold;">' . $this->__('Thank you for installing the Remarkety Magento plugin.
45
+ You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
46
+ . '<br><br>'
47
+ . $this->__('It seems that you have already installed Remarkety on this website before. This
48
+ version of the plugin will create a new API key, and automatically inform
49
+ Remarkety. If this is a mistake, please <a href="%s">click here</a>.</p>', $this->getUrl('*/*/installation', array('mode' => 'install')))
50
+ ));
51
+ $instruction->getRenderer()->setTemplate('mgconnector/widget/form/renderer/fieldset/element.phtml');
52
+
53
+ $fieldset->addField('terms', 'checkbox', array(
54
+ 'label' => false,
55
+ 'name' => 'data[terms]',
56
+ 'checked' => false,
57
+ 'value' => '1',
58
+ 'class' => 'required-entry',
59
+ 'after_element_html' => $this->__('I agree to Remarkety’s <a href="%s">terms of use</a>.', '#'),
60
+ ));
61
+
62
+ $fieldset->addField('button', 'note', array(
63
+ 'label' => false,
64
+ 'name' => 'button',
65
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
66
+ . $this->__('Complete Installation') . '</span></span></button>'
67
+ ));
68
+
69
+ return parent::_prepareForm();
70
+ }
71
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Complete.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration complete block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Complete extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'complete_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_install';
22
+ $this->_mode = 'complete';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Install Complete (version: %s)',
26
+ Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+ $this->_addButton('save', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Done'),
33
+ 'onclick' => 'editForm.submit();',
34
+ 'class' => 'save',
35
+ ), 1);
36
+ }
37
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Complete/Form.php ADDED
@@ -0,0 +1,63 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration complete form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Complete_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Installation Complete')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'complete',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' => '<p style="font-weight:bold;">' . $this->__('Installation complete!') . '</p>'
44
+ ));
45
+ $instruction->getRenderer()->setTemplate('mgconnector/element.phtml');
46
+
47
+ $response = Mage::getSingleton('core/session')->getRemarketyLastResponseMessage();
48
+ $response = !empty($response) ? unserialize($response) : array();
49
+ $fieldset->addField('response', 'note', array(
50
+ 'label' => false,
51
+ 'after_element_html' => !empty($response['info']) ? $response['info'] : $this->__('There is no response to display')
52
+ ));
53
+
54
+ $fieldset->addField('button', 'note', array(
55
+ 'label' => false,
56
+ 'name' => 'button',
57
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
58
+ . $this->__('Done') . '</span></span></button>'
59
+ ));
60
+
61
+ return parent::_prepareForm();
62
+ }
63
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Create.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml install install block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Install_Create extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'install_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_install_install';
22
+ $this->_mode = 'create';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Install Remarkety extension (version: %s)',
26
+ Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+ $this->_removeButton('save');
32
+ }
33
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Create/Form.php ADDED
@@ -0,0 +1,140 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml install install form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Install_Create_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/install/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $multipleStores = Remarkety_Mgconnector_Model_Install::isMultipleStores();
29
+ $accountWithLoginUrl = $this->getUrl('*/install/install', array('mode' => Remarkety_Mgconnector_Model_Install::MODE_INSTALL_LOGIN));
30
+
31
+ $fieldset = $form->addFieldset(
32
+ 'general',
33
+ array(
34
+ 'legend' => $this->__('Install Remarkety extension')
35
+ )
36
+ );
37
+
38
+ $fieldset->addField('mode', 'hidden', array(
39
+ 'name' => 'data[mode]',
40
+ 'value' => 'install_create',
41
+ ));
42
+
43
+ $headingHtml =
44
+ '<p><b>' . $this->__('Thank you for installing the Remarkety Magento plugin.
45
+ You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
46
+ . '</b><br><br>'
47
+ . $this->__('The plugin will automatically create a Magento WebService API user so that
48
+ Remarkety can synchronize with your store.') . '</p><hr/>'
49
+ . '<h2>'.$this->__('Create a new Remarkety account') . '</h2>'
50
+ . '<p>'.
51
+ sprintf($this->__(
52
+ 'Already registered to Remarkety? <a href="%s">Click here</a>'
53
+ ), $accountWithLoginUrl)
54
+ . '</p>';
55
+
56
+ $instruction = $fieldset->addField('instruction', 'note', array(
57
+ 'text' => '',
58
+ 'label' => false,
59
+ 'after_element_html' => $headingHtml,
60
+
61
+ ));
62
+ $instruction->getRenderer()->setTemplate('mgconnector/element.phtml');
63
+
64
+ $html = '<small style="float:left;width:100%;">' . sprintf($this->__(
65
+ 'Already registered to Remarkety? <a href="%s">Click here</a>'
66
+ ), $accountWithLoginUrl) . '</small>';
67
+
68
+ $fieldset->addField('email', 'text', array(
69
+ 'label' => $this->__('Email address for the Remarkety account:'),
70
+ 'name' => 'data[email]',
71
+ 'required' => true,
72
+ 'class' => 'validate-email',
73
+ //'after_element_html' => $html,
74
+ 'style' => 'float:left',
75
+ ));
76
+
77
+ $fieldset->addField('first_name', 'text', array(
78
+ 'label' => $this->__('First Name:'),
79
+ 'name' => 'data[first_name]',
80
+ 'required' => true,
81
+ 'class' => 'required-entry'
82
+ ));
83
+
84
+ $fieldset->addField('last_name', 'text', array(
85
+ 'label' => $this->__('Last Name:'),
86
+ 'name' => 'data[last_name]',
87
+ 'required' => true,
88
+ 'class' => 'required-entry'
89
+ ));
90
+
91
+ $fieldset->addField('phone', 'text', array(
92
+ 'label' => $this->__('Phone:'),
93
+ 'name' => 'data[phone]',
94
+ 'required' => true,
95
+ 'class' => 'required-entry'
96
+ ));
97
+
98
+ $fieldset->addField('password', 'password', array(
99
+ 'label' => $this->__('Password:'),
100
+ 'name' => 'data[password]',
101
+ 'required' => true,
102
+ 'class' => 'required-entry'
103
+ ));
104
+
105
+
106
+ $fieldset->addField('store_id', $multipleStores ? 'multiselect' : 'select', array(
107
+ 'name' => 'data[store_id]',
108
+ 'label' => $this->__('Sync Remarkety with this view:'),
109
+ 'required' => true,
110
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false),
111
+ ));
112
+
113
+ $fieldset->addField('terms', 'checkbox', array(
114
+ 'label' => false,
115
+ 'name' => 'data[terms]',
116
+ 'checked' => false,
117
+ 'value' => '1',
118
+ 'class' => 'required-entry',
119
+ 'after_element_html' => $this->__('I agree to Remarkety’s <a href="%s">terms of use</a>.', '#'),
120
+ ));
121
+
122
+ $fieldset->addField('create', 'note', array(
123
+ 'label' => false,
124
+ 'name' => 'button',
125
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
126
+ . $this->__('Create New Account And Connect') . '</span></span></button>',
127
+ ));
128
+
129
+ // $fieldset->addField('login', 'note', array(
130
+ // 'label' => false,
131
+ // 'name' => 'button',
132
+ // 'after_element_html' => '<button type="button" class="save"
133
+ // onclick="window.location = \'' . $this->getUrl('*/install/install', array('mode' => Remarkety_Mgconnector_Model_Install::MODE_INSTALL_LOGIN)) . '\'"
134
+ // ><span><span>'
135
+ // . $this->__('I Already Have An Account') . '</span></span></button>',
136
+ // ));
137
+
138
+ return parent::_prepareForm();
139
+ }
140
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Login.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml install install block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Install_Login extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'install_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_install_install';
22
+ $this->_mode = 'login';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Install Remarkety extension (version: %s)',
26
+ Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+ $this->_removeButton('save');
32
+ }
33
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Install/Login/Form.php ADDED
@@ -0,0 +1,130 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml install install form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Install_Login_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/install/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Install Remarkety extension')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'install_login',
38
+ ));
39
+ $noAccountUrl = $this->getUrl('*/install/install', array('mode' => Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE));
40
+
41
+ /*$headingHtml =
42
+ '<p><b>' . $this->__('Thank you for installing the Remarkety Magento plugin.
43
+ You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
44
+ . '</b><br><br>'
45
+ . $this->__('The plugin will automatically create a Magento WebService API user so that
46
+ Remarkety can synchronize with your store.') . '</p><hr/>'
47
+ . '<h2>'.$this->__('Login to Remarkety') . '</h2>'
48
+ . '<p>'.
49
+ sprintf($this->__(
50
+ 'Don\'t have a Remarkety account yet? <a href="%s">Click here</a>'
51
+ ), $noAccountUrl)
52
+ . '</p>';
53
+
54
+ /$instruction = $fieldset->addField('instruction', 'note', array(
55
+ 'text' => '',
56
+ 'label' => false,
57
+ 'after_element_html' => $headingHtml,
58
+ // '<p style="font-weight:bold;">' . $this->__('Thank you for installing the Remarkety Magento plugin.
59
+ // You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
60
+ // . '<br><br>'
61
+ // . $this->__('The plugin will automatically create a Magento WebService API user so that
62
+ // Remarkety can synchronize with your store.') . '</p>',
63
+ ));
64
+ $instruction->getRenderer()->setTemplate('mgconnector/element.phtml');*/
65
+
66
+ $noAccountUrl = $this->getUrl('*/install/install', array('mode' => Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE));
67
+
68
+ $html = '<small style="float:left;width:100%;">' . sprintf($this->__(
69
+ 'Don\'t have a Remarkety account yet? <a href="%s">Click here</a>'
70
+ ), $noAccountUrl) . '</small>';
71
+
72
+ $fieldset->addField('email', 'text', array(
73
+ 'label' => $this->__('Email address for the Remarkety account:'),
74
+ 'name' => 'data[email]',
75
+ 'required' => true,
76
+ 'class' => 'validate-email',
77
+ /*
78
+ 'after_element_html' => $html,
79
+ '<small style="float:left;width:100%;">' . $this->__(
80
+ 'If you’ve already registered to Remarkety, please use the email you used to open your account.
81
+ If you haven’t, please click on the button "Create New Account And Install" below.'
82
+ ) . '</small>',
83
+ */
84
+ 'style' => 'float:left',
85
+ ));
86
+
87
+ $fieldset->addField('password', 'password', array(
88
+ 'label' => $this->__('Password:'),
89
+ 'name' => 'data[password]',
90
+ 'required' => true,
91
+ 'class' => 'required-entry'
92
+ ));
93
+
94
+ $fieldset->addField('store_id', 'select', array(
95
+ 'name' => 'data[store_id]',
96
+ 'label' => $this->__('Connect this view:'),
97
+ 'required' => true,
98
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false),
99
+ //'value' => $this->getRequest()->getParam('store'),
100
+ ));
101
+
102
+ // $fieldset->addField('terms', 'checkbox', array(
103
+ // 'label' => false,
104
+ // 'name' => 'data[terms]',
105
+ // 'checked' => false,
106
+ // 'value' => '1',
107
+ // 'class' => 'required-entry',
108
+ // 'after_element_html' => $this->__('I agree to Remarkety’s <a href="%s">terms of use</a>.', '#'),
109
+ // ));
110
+
111
+ $fieldset->addField('login', 'note', array(
112
+ 'label' => false,
113
+ 'name' => 'button',
114
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span>'
115
+ . $this->__('Login And Connect') . '
116
+ </span></button>',
117
+ ));
118
+
119
+ // $fieldset->addField('create', 'note', array(
120
+ // 'label' => false,
121
+ // 'name' => 'button',
122
+ // 'after_element_html' => '<button type="button" class="save"
123
+ // onclick="window.location = \'' . $this->getUrl('*/install/install', array('mode' => Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE)) . '\'"
124
+ // ><span><span>'
125
+ // . $this->__('Create New Account And Install') . '</span></span></button>',
126
+ // ));
127
+
128
+ return parent::_prepareForm();
129
+ }
130
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Upgrade.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration upgrade block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Upgrade extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'upgrade_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_install';
22
+ $this->_mode = 'upgrade';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Upgrade Remarkety extension (version: %s)',
26
+ Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+ $this->_addButton('save', array(
32
+ 'label' => Mage::helper('adminhtml')->__('Complete Installation'),
33
+ 'onclick' => 'editForm.submit();',
34
+ 'class' => 'save',
35
+ ), 1);
36
+ }
37
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Upgrade/Form.php ADDED
@@ -0,0 +1,62 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configuration upgrade form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Upgrade_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/install/complete'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Upgrade Remarkety extension')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'upgrade',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' =>
44
+ '<p style="font-weight:bold;">' . $this->__('Thank you for installing the Remarkety Magento plugin.
45
+ You are one click away from finishing setting up Remarkety on your store and sending effective, targeted emails!')
46
+ . '<br><br>'
47
+ . $this->__('It seems that you have already installed Remarkety on this website before. This
48
+ version of the plugin will create a new API key, and automatically inform
49
+ Remarkety. If this is a mistake, please <a href="%s">click here</a>.</p>', $this->getUrl('*/install/install', array('mode' => 'install_create')))
50
+ ));
51
+ $instruction->getRenderer()->setTemplate('mgconnector/element.phtml');
52
+
53
+ $fieldset->addField('button', 'note', array(
54
+ 'label' => false,
55
+ 'name' => 'button',
56
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
57
+ . $this->__('Complete Installation') . '</span></span></button>'
58
+ ));
59
+
60
+ return parent::_prepareForm();
61
+ }
62
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome.php ADDED
@@ -0,0 +1,39 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml welcome complete block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Welcome extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'welcome_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_install';
22
+ $this->_mode = 'welcome';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Remarkety (version: %s)',
26
+ Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+ $this->_removeButton('save');
32
+
33
+ $this->_addButton('reinstall', array(
34
+ 'label' => Mage::helper('adminhtml')->__('Reinstall'),
35
+ 'onclick' => "return confirm('Are you sure?') ? window.location = '" . $this->getUrl('*/install/reinstall')."' : false;",
36
+ 'class' => 'delete',
37
+ ), 0);
38
+ }
39
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome/Form.php ADDED
@@ -0,0 +1,56 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml welcome complete form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Welcome_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/*/install'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Remarkety')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'complete',
38
+ ));
39
+
40
+ $instruction = $fieldset->addField('instruction', 'note', array(
41
+ 'text' => '',
42
+ 'label' => false,
43
+ 'after_element_html' => '<p style="font-weight:bold;font-size:25px;">' . $this->__('Welcome to Remarkety - What\'s next?') . '</p>
44
+ <ol style="list-style-type:decimal;margin-left:20px;font-weight:bold;font-size:12px;">
45
+ <li>Sign in to your account <a href="https://app.remarkety.com/?utm_source=plugin&utm_medium=link&utm_campaign=magento-plugin" target="_blank">here</a></li>
46
+ <li>Create campaigns, send emails and monitor results.</li>
47
+ <li>Increase sales and customer\'s Life Time Value</li>
48
+ <li>Need help? We are here for you: <a href="mailto:support@remarkety.com">support@remarkety.com</a> <a href="tel:%28%2B1%20800%20570-7564">(+1 800 570-7564)</a></li>
49
+ </ol>
50
+ '
51
+ ));
52
+ $instruction->getRenderer()->setTemplate('mgconnector/element.phtml');
53
+
54
+ return parent::_prepareForm();
55
+ }
56
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Install/Welcome/Store.php ADDED
@@ -0,0 +1,60 @@
1
+ <?php
2
+
3
+ class Remarkety_Mgconnector_Block_Adminhtml_Install_Welcome_Store extends Mage_Adminhtml_Block_Template
4
+ {
5
+ /**
6
+ * Prepare block
7
+ */
8
+ public function __construct()
9
+ {
10
+ $this->setTemplate('mgconnector/install/welcome/store.phtml');
11
+ parent::__construct();
12
+ }
13
+
14
+ public function getStoresStatus()
15
+ {
16
+ /**
17
+ * @var $wtModel Remarkety_Mgconnector_Model_Webtracking
18
+ */
19
+ $wtModel = Mage::getModel('mgconnector/webtracking');
20
+
21
+ $stores = array();
22
+
23
+ foreach (Mage::app()->getWebsites() as $_website) {
24
+ $stores[$_website->getCode()] = array(
25
+ 'name' => $_website->getName(),
26
+ 'id' => $_website->getWebsiteId(),
27
+ );
28
+
29
+ foreach ($_website->getGroups() as $_group) {
30
+ $stores[$_website->getCode()]['store_groups'][$_group->getCode()] = array(
31
+ 'name' => $_group->getName(),
32
+ 'id' => $_group->getGroupId(),
33
+ );
34
+
35
+ foreach ($_group->getStores() as $_store) {
36
+ $isInstalled = $_store->getConfig(Remarkety_Mgconnector_Model_Install::XPATH_INSTALLED);
37
+ $webtracking = $wtModel->getRemarketyPublicId($_store->getStoreId());
38
+ $stores[$_website->getCode()]['store_groups'][$_group->getCode()]['store_views'][$_store->getCode()] = array(
39
+ 'name' => $_store->getName(),
40
+ 'id' => $_store->getStoreId(),
41
+ 'isInstalled' => $isInstalled,
42
+ 'webTracking' => $webtracking
43
+ );
44
+ }
45
+ }
46
+ }
47
+
48
+ return $stores;
49
+ }
50
+
51
+ public function checkAPIKey(){
52
+ try {
53
+ $uModel = Mage::getModel('api/user');
54
+ $apiKey = Mage::getStoreConfig('remarkety/mgconnector/api_key');
55
+ return $uModel->authenticate(\Remarkety_Mgconnector_Model_Install::WEB_SERVICE_USERNAME, $apiKey);
56
+ } catch (Exception $ex){
57
+ return false;
58
+ }
59
+ }
60
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue.php ADDED
@@ -0,0 +1,24 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml queue block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue extends Mage_Adminhtml_Block_Widget_Grid_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_blockGroup = 'mgconnector';
20
+ $this->_controller = 'adminhtml_queue';
21
+ $this->_headerText = Mage::helper('mgconnector')->__('Queue Contents');
22
+ $this->_removeButton('add');
23
+ }
24
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Configure.php ADDED
@@ -0,0 +1,38 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configure block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue_Configure extends Mage_Adminhtml_Block_Widget_Form_Container
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this->_objectId = 'configure_id';
20
+ $this->_blockGroup = 'mgconnector';
21
+ $this->_controller = 'adminhtml_queue';
22
+ $this->_mode = 'configure';
23
+
24
+ $this->_headerText = $this->__(
25
+ 'Configuration'
26
+ // Mage::helper('mgconnector')->getInstalledVersion()
27
+ );
28
+
29
+ $this->_removeButton('back');
30
+ $this->_removeButton('reset');
31
+
32
+ // $this->_addButton('save', array(
33
+ // 'label' => Mage::helper('adminhtml')->__('Save'),
34
+ // 'onclick' => 'editForm.submit();',
35
+ // 'class' => 'save',
36
+ // ), 0);
37
+ }
38
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Configure/Form.php ADDED
@@ -0,0 +1,104 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml configure form block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue_Configure_Form extends Mage_Adminhtml_Block_Widget_Form
11
+ {
12
+ /**
13
+ * Prepare form
14
+ *
15
+ * @return Mage_Adminhtml_Block_Widget_Form
16
+ */
17
+ protected function _prepareForm()
18
+ {
19
+ $form = new Varien_Data_Form(array(
20
+ 'id' => 'edit_form',
21
+ 'action' => $this->getUrl('*/queue/save'),
22
+ 'method' => 'post',
23
+ ));
24
+ $form->setFieldContainerIdPrefix('data');
25
+ $form->setUseContainer(true);
26
+ $this->setForm($form);
27
+
28
+ $fieldset = $form->addFieldset(
29
+ 'general',
30
+ array(
31
+ 'legend' => $this->__('Remarkety Configuration')
32
+ )
33
+ );
34
+
35
+ $fieldset->addField('mode', 'hidden', array(
36
+ 'name' => 'data[mode]',
37
+ 'value' => 'configuration',
38
+ ));
39
+
40
+ if(!$this->checkAPIKey()) {
41
+ $fieldset->addField('api_warning', 'note', array(
42
+ 'text' => '<span style="color: red;">' . $this->__('Attention! Remarkety\'s API key is not the same as the Magento API key. Please set it below.') . '</span>'.
43
+ ' <a target="_blank" href="https://support.remarkety.com/hc/en-us/articles/209184646-Synchronizing-the-API-key">More Info</a>.',
44
+ ));
45
+ }
46
+
47
+ $fieldset->addField('api_key', 'text', array(
48
+ 'label' => $this->__('API Key:'),
49
+ 'name' => 'data[api_key]',
50
+ 'required' => true,
51
+ 'after_element_html' => '<small style="float:left;width:100%;">' . $this->__(
52
+ 'This API key will be used for Remarkety\'s sync and queue.'
53
+ ) . '</small>',
54
+ 'value' => Mage::getStoreConfig('remarkety/mgconnector/api_key'),
55
+ 'style' => 'float:left',
56
+ ));
57
+
58
+ $fieldset->addField('intervals', 'text', array(
59
+ 'label' => $this->__('Intervals:'),
60
+ 'name' => 'data[intervals]',
61
+ 'required' => true,
62
+ 'after_element_html' => '<small style="float:left;width:100%;">' . $this->__(
63
+ 'This defines the queue retry interval.<br/>
64
+ Type the amount of minutes between retries, separated by commas. For example "1,3,10" -
65
+ the second attempt will be after 1 minute, third after 3 minutes,<br/>
66
+ and fourth after 10 minutes. If the last attempt is unsuccessful,
67
+ the status will be changed to "failed" and will not be retried anymore.'
68
+ ) . '</small>',
69
+ 'value' => Mage::getStoreConfig('remarkety/mgconnector/intervals'),
70
+ 'style' => 'float:left',
71
+ ));
72
+
73
+ $fieldset->addField('bypasscache', 'checkbox', array(
74
+ 'label' => $this->__('Bypass page cache for website tracking:'),
75
+ 'name' => 'data[bypasscache]',
76
+ 'after_element_html' => '<small style="float:left;width:100%;">' . $this->__(
77
+ 'Enable this checkbox if you use caching on your store pages.'
78
+ ) . '</small>',
79
+ 'value' => 1,
80
+ 'checked' => \Remarkety_Mgconnector_Model_Webtracking::getBypassCache() ? 'checked' : '',
81
+ 'style' => 'float:left',
82
+ ));
83
+
84
+ $button = $fieldset->addField('button', 'note', array(
85
+ 'label' => false,
86
+ 'name' => 'button',
87
+ 'after_element_html' => '<button type="button" class="save" onclick="editForm.submit();"><span><span>'
88
+ . $this->__('Save') . '</span></span></button>',
89
+ ));
90
+ $button->getRenderer()->setTemplate('mgconnector/element.phtml');
91
+
92
+ return parent::_prepareForm();
93
+ }
94
+
95
+ private function checkAPIKey(){
96
+ try {
97
+ $uModel = Mage::getModel('api/user');
98
+ $apiKey = Mage::getStoreConfig('remarkety/mgconnector/api_key');
99
+ return $uModel->authenticate(\Remarkety_Mgconnector_Model_Install::WEB_SERVICE_USERNAME, $apiKey);
100
+ } catch (Exception $ex){
101
+ return false;
102
+ }
103
+ }
104
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid.php ADDED
@@ -0,0 +1,116 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml queue grid block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
+ {
12
+ /**
13
+ * Prepare block
14
+ */
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+
19
+ $this
20
+ ->setId('queue_grid')
21
+ ->setDefaultSort('next_attempt')
22
+ ->setDefaultDir('ASC')
23
+ ->setSaveParametersInSession(true)
24
+ ->setUseAjax(true);
25
+ }
26
+
27
+ /**
28
+ * Prepare collection
29
+ *
30
+ * @return Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid
31
+ */
32
+ protected function _prepareCollection()
33
+ {
34
+ $collection = Mage::getResourceModel('mgconnector/queue_collection');
35
+ $this->setCollection($collection);
36
+
37
+ return parent::_prepareCollection();
38
+ }
39
+
40
+ /**
41
+ * Prepare columns
42
+ *
43
+ * @return Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid
44
+ * @throws Exception
45
+ */
46
+ protected function _prepareColumns()
47
+ {
48
+ $helper = Mage::helper('mgconnector');
49
+
50
+ $this->addColumn('queue_id', array(
51
+ 'header' => $helper->__('Queue #'),
52
+ 'width' => '50px',
53
+ 'type' => 'number',
54
+ 'index' => 'queue_id'
55
+ ));
56
+ $this->addColumn('event_type', array(
57
+ 'header' => $helper->__('Event Type'),
58
+ 'index' => 'event_type',
59
+ 'renderer' => 'Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid_Column_Renderer_EventType',
60
+ ));
61
+ $this->addColumn('status', array(
62
+ 'header' => $helper->__('Status'),
63
+ 'width' => '200px',
64
+ 'renderer' => 'Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid_Column_Renderer_Status',
65
+ 'index' => 'status'
66
+ ));
67
+ $this->addColumn('attempts', array(
68
+ 'header' => $helper->__('Attempts'),
69
+ 'index' => 'attempts'
70
+ ));
71
+ $this->addColumn('last_attempt', array(
72
+ 'header' => $helper->__('Last Attempt'),
73
+ 'width' => '200px',
74
+ 'type' => 'datetime',
75
+ 'index' => 'last_attempt'
76
+ ));
77
+ $this->addColumn('next_attempt', array(
78
+ 'header' => $helper->__('Next Attempt'),
79
+ 'width' => '200px',
80
+ 'type' => 'datetime',
81
+ 'index' => 'next_attempt'
82
+ ));
83
+
84
+ return parent::_prepareColumns();
85
+ }
86
+
87
+ /**
88
+ * Return grid url
89
+ *
90
+ * @return string
91
+ */
92
+ public function getGridUrl()
93
+ {
94
+ return $this->getUrl('*/*/grid', array('_current' => true));
95
+ }
96
+
97
+
98
+ protected function _prepareMassaction()
99
+ {
100
+ $this->setMassactionIdField('queue_id');
101
+ $this->getMassactionBlock()->setFormFieldName('queue');
102
+
103
+ $this->getMassactionBlock()->addItem('resend', array(
104
+ 'label' => $this->__('Resend'),
105
+ 'url' => $this->getUrl('*/*/massResend')
106
+ ));
107
+
108
+ $this->getMassactionBlock()->addItem('delete', array(
109
+ 'label' => $this->__('Delete'),
110
+ 'url' => $this->getUrl('*/*/massDelete'),
111
+ 'confirm' => $this->__('Really delete all these events?')
112
+ ));
113
+
114
+ return $this;
115
+ }
116
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid/Column/Renderer/EventType.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml queue grid status column renderer block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid_Column_Renderer_EventType
11
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
12
+ {
13
+ /**
14
+ * Column renderer
15
+ *
16
+ * @param Varien_Object $row
17
+ * @return string
18
+ */
19
+ public function render(Varien_Object $row)
20
+ {
21
+ $value = $row->getData($this->getColumn()->getIndex());
22
+ try {
23
+ $payload = json_encode(unserialize($row->getData('payload')));
24
+ } catch (\Exception $e) {
25
+ $payload = "?";
26
+ }
27
+ return '<span title="'.htmlentities($payload).'">'.$value.'</span>';
28
+ }
29
+ }
app/code/community/Remarkety/Mgconnector/Block/Adminhtml/Queue/Grid/Column/Renderer/Status.php ADDED
@@ -0,0 +1,25 @@
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml queue grid status column renderer block
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Block_Adminhtml_Queue_Grid_Column_Renderer_Status
11
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
12
+ {
13
+ /**
14
+ * Column renderer
15
+ *
16
+ * @param Varien_Object $row
17
+ * @return string
18
+ */
19
+ public function render(Varien_Object $row)
20
+ {
21
+ $value = $row->getData($this->getColumn()->getIndex());
22
+
23
+ return Mage::helper('mgconnector')->__($value ? 'Queued' : 'Failed');
24
+ }
25
+ }
app/code/community/Remarkety/Mgconnector/Block/Tracking/Base.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+ class Remarkety_Mgconnector_Block_Tracking_Base extends Mage_Core_Block_Template
3
+ {
4
+ public function isWebtrackingActivated()
5
+ {
6
+ return ($this->getRemarketyPublicId() !== false);
7
+ }
8
+
9
+ public function getRemarketyPublicId()
10
+ {
11
+ $store = Mage::app()->getStore();
12
+ /**
13
+ * @var $m Remarkety_Mgconnector_Model_Webtracking
14
+ */
15
+ $m = Mage::getModel('mgconnector/webtracking');
16
+ return $m->getRemarketyPublicId($store);
17
+ }
18
+
19
+ public function shouldBypassCache(){
20
+ return \Remarkety_Mgconnector_Model_Webtracking::getBypassCache();
21
+ }
22
+
23
+ public function getCustomer()
24
+ {
25
+ return Mage::getSingleton('customer/session')->getCustomer();
26
+ }
27
+
28
+ public function getEmail(){
29
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
30
+ return $this->getCustomer()->getEmail();
31
+ }
32
+ $email = Mage::getSingleton('customer/session')->getSubscriberEmail();
33
+ return empty($email) ? false : $email;
34
+ }
35
+ }
app/code/community/Remarkety/Mgconnector/Block/Tracking/General.php ADDED
@@ -0,0 +1,5 @@
1
+ <?php
2
+ class Remarkety_Mgconnector_Block_Tracking_General extends Remarkety_Mgconnector_Block_Tracking_Base
3
+ {
4
+
5
+ }
app/code/community/Remarkety/Mgconnector/Block/Tracking/Product.php ADDED
@@ -0,0 +1,57 @@
1
+ <?php
2
+ class Remarkety_Mgconnector_Block_Tracking_Product extends Remarkety_Mgconnector_Block_Tracking_Base
3
+ {
4
+ private $_CategoryNames = array();
5
+ private $_CategoryIds = array();
6
+ /**
7
+ * Get the active product object
8
+ *
9
+ * @return Mage_Catalog_Model_Product
10
+ */
11
+ public function getActiveProduct()
12
+ {
13
+ if($this->getProduct()){
14
+ return $this->getProduct();
15
+ }
16
+ return Mage::registry('product');
17
+ }
18
+
19
+ /**
20
+ * Get arrays of Category ids and names
21
+ * @return array
22
+ */
23
+ public function getCategories(){
24
+ if(empty($this->_CategoryNames) || empty($this->_CategoryIds)) {
25
+ $cats = $this->getActiveProduct()->getCategoryIds();
26
+ $productCategoryNames = Array();
27
+ foreach ($cats as $category_id) {
28
+ $_cat = Mage::getModel('catalog/category')->load($category_id);
29
+ $productCategoryNames[] = $_cat->getName();
30
+ }
31
+ $this->_CategoryNames = $productCategoryNames;
32
+ $this->_CategoryIds = $cats;
33
+ }
34
+ return Array(
35
+ "ids" => $this->_CategoryIds,
36
+ "names" => $this->_CategoryNames
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Return array of Category names
42
+ * @return array
43
+ */
44
+ public function getCategoryNames(){
45
+ $info = $this->getCategories();
46
+ return $info['names'];
47
+ }
48
+
49
+ /**
50
+ * Return array of Category ids
51
+ * @return array
52
+ */
53
+ public function getCategoryIds(){
54
+ $info = $this->getCategories();
55
+ return $info['ids'];
56
+ }
57
+ }
app/code/community/Remarkety/Mgconnector/Helper/Data.php ADDED
@@ -0,0 +1,74 @@
1
+ <?php
2
+
3
+ /**
4
+ * Mgconnector helper
5
+ *
6
+ * @category Remarkety
7
+ * @package Remarkety_Mgconnector
8
+ * @author Piotr Pierzak <piotrek.pierzak@gmail.com>
9
+ */
10
+ class Remarkety_Mgconnector_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ /**
13
+ * Return installed extension version
14
+ *
15
+ * @return string
16
+ */
17
+ public function getInstalledVersion()
18
+ {
19
+ return Mage::getConfig()->getModuleConfig("Remarkety_Mgconnector")->version;
20
+ }
21
+
22
+ /**
23
+ * Return mode
24
+ *
25
+ * @return string
26
+ * @throws Mage_Core_Exception
27
+ */
28
+ public function getMode()
29
+ {
30
+ $mode = Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE;
31
+
32
+ /**
33
+ * If remarkety extension was installed in version lower than 1.0.0.15
34
+ * and remarkety web service user already exists
35
+ */
36
+ $webServiceUser = Mage::getModel('api/user')
37
+ ->setUsername(Remarkety_Mgconnector_Model_Install::WEB_SERVICE_USERNAME)
38
+ ->userExists();
39
+
40
+ if($webServiceUser === true) {
41
+ $mode = Remarkety_Mgconnector_Model_Install::MODE_UPGRADE;
42
+ }
43
+
44
+ $response = Mage::getSingleton('core/session')->getRemarketyLastResponseStatus();
45
+ //$response = Mage::getModel('core/config')->getConfig('remarkety/mgconnector/last_response_status');
46
+ if($response == 1) {
47
+ $mode = Remarkety_Mgconnector_Model_Install::MODE_COMPLETE;
48
+ } elseif($response == 0) {
49
+ $mode = Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE;
50
+ }
51
+
52
+ $configuredStores = Mage::getModel('mgconnector/install')->getConfiguredStores();
53
+ if($configuredStores->getSize()) {
54
+ $mode = Remarkety_Mgconnector_Model_Install::MODE_WELCOME;
55
+ }
56
+
57
+ $forceMode = Mage::app()->getRequest()->getParam('mode', false);
58
+ if(!empty($forceMode)) {
59
+ $mode = $forceMode;
60
+ }
61
+
62
+ if(!in_array($mode, array(
63
+ Remarkety_Mgconnector_Model_Install::MODE_INSTALL_CREATE,
64
+ Remarkety_Mgconnector_Model_Install::MODE_INSTALL_LOGIN,
65
+ Remarkety_Mgconnector_Model_Install::MODE_UPGRADE,
66
+ Remarkety_Mgconnector_Model_Install::MODE_COMPLETE,
67
+ Remarkety_Mgconnector_Model_Install::MODE_WELCOME,
68
+ ))) {
69
+ throw new Mage_Core_Exception('Installation mode can not be handled.');
70
+ }
71
+
72
+ return $mode;
73
+ }
74
+ }
app/code/community/Remarkety/Mgconnector/Helper/Links.php ADDED
@@ -0,0 +1,64 @@
1
+ <?php
2
+
3
+ class Remarkety_Mgconnector_Helper_Links extends Mage_Core_Helper_Abstract
4
+ {
5
+ private $parentId = null;
6
+ private $simpleIds = null;
7
+
8
+
9
+ private function loadProductLinks()
10
+ {
11
+
12
+ if ($this->parentId && $this->simpleIds) {
13
+ return;
14
+ }
15
+
16
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
17
+ $tableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_super_link');
18
+
19
+ $query = 'select product_id,parent_id from ' . $tableName;
20
+ $this->simpleIds = array();
21
+ $this->parentId = array();
22
+
23
+ foreach ($connection->fetchAll($query) as $row) {
24
+ $productId = $row['product_id'];
25
+ $parentId = $row['parent_id'];
26
+
27
+ if (!isset($this->simpleIds[$parentId])) {
28
+ $this->simpleIds[$parentId] = array();
29
+ }
30
+ $this->simpleIds[$parentId][] = $productId;
31
+ $this->parentId[$productId] = $parentId;
32
+ }
33
+ }
34
+
35
+ public function getParentId($productId = null)
36
+ {
37
+ $this->loadProductLinks();
38
+
39
+ if (!$productId) {
40
+ return false;
41
+ }
42
+
43
+ if (isset($this->parentId[$productId])) {
44
+ return $this->parentId[$productId];
45
+ }
46
+
47
+ return null;
48
+ }
49
+
50
+ public function getSimpleIds($productId = null)
51
+ {
52
+
53
+ $this->loadProductLinks();
54
+
55
+ if (!isset($productId)) {
56
+ return $this->simpleIds;
57
+ }
58
+
59
+ if (isset($this->simpleIds[$productId])) {
60
+ return $this->simpleIds[$productId];
61
+ }
62
+ return null;
63
+ }
64
+ }
app/code/community/Remarkety/Mgconnector/Helper/Urls.php ADDED
@@ -0,0 +1,46 @@
1
+ <?php
2
+
3
+ class Remarkety_Mgconnector_Helper_Urls extends Mage_Core_Helper_Abstract
4
+ {
5
+ private $_attributeId = false;
6
+ private $_urlKey = false;
7
+
8
+ public function getValue($productId, $store_id)
9
+ {
10
+ if(isset($this->_urlKey[$store_id]) && isset($this->_urlKey[$store_id][$productId])) {
11
+ return $this->_urlKey[$store_id][$productId];
12
+ }
13
+
14
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
15
+ $tableName = Mage::getSingleton('core/resource')->getTableName('catalog_product_entity_varchar');
16
+ $attrbuteId = $this->_getAttributeId();
17
+ $query = 'SELECT `value`, `store_id` FROM ' . $tableName . ' WHERE (store_id = "'.$store_id.'" OR store_id = 0) AND attribute_id = "' . $attrbuteId . '" AND entity_id = "'. $productId .'"';