Listrak_Remarketing - Version 1.1.9.4

Version Notes

Product API improvements

Download this release

Release Info

Developer Magento Core Team
Extension Listrak_Remarketing
Version 1.1.9.4
Comparing to
See all releases


Code changes from version 1.1.9.2 to 1.1.9.4

Files changed (116) hide show
  1. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture.php +6 -0
  2. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit.php +23 -3
  3. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Form.php +12 -1
  4. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tab/Form.php +22 -7
  5. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tabs.php +13 -1
  6. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Grid.php +45 -18
  7. app/code/community/Listrak/Remarketing/Block/Adminhtml/Notifications.php +36 -12
  8. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes.php +32 -2
  9. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit.php +11 -0
  10. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Form.php +12 -1
  11. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Brand.php +10 -1
  12. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Categories.php +37 -2
  13. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tabs.php +32 -4
  14. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Grid.php +62 -31
  15. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands.php +27 -2
  16. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands/Form.php +24 -4
  17. app/code/community/Listrak/Remarketing/Block/Base.php +126 -30
  18. app/code/community/Listrak/Remarketing/Block/Conversion/Abstract.php +112 -33
  19. app/code/community/Listrak/Remarketing/Block/Conversion/Cart.php +42 -11
  20. app/code/community/Listrak/Remarketing/Block/Conversion/Fingerprint.php +21 -5
  21. app/code/community/Listrak/Remarketing/Block/Conversion/Order.php +46 -16
  22. app/code/community/Listrak/Remarketing/Block/Legacy/Ecjs.php +41 -10
  23. app/code/community/Listrak/Remarketing/Block/Legacy/Modal.php +19 -2
  24. app/code/community/Listrak/Remarketing/Block/Require/Activity.php +32 -8
  25. app/code/community/Listrak/Remarketing/Block/Require/Legacy.php +31 -8
  26. app/code/community/Listrak/Remarketing/Block/Require/Onescript.php +31 -8
  27. app/code/community/Listrak/Remarketing/Block/Require/Sca.php +32 -8
  28. app/code/community/Listrak/Remarketing/Block/Tracking/Activity.php +35 -12
  29. app/code/community/Listrak/Remarketing/Block/Tracking/Click.php +15 -4
  30. app/code/community/Listrak/Remarketing/Block/Tracking/Email.php +47 -14
  31. app/code/community/Listrak/Remarketing/Block/Tracking/Sca.php +203 -57
  32. app/code/community/Listrak/Remarketing/Helper/Data.php +367 -83
  33. app/code/community/Listrak/Remarketing/Helper/Product.php +714 -184
  34. app/code/community/Listrak/Remarketing/Helper/Product/Attribute/Set/Map.php +41 -11
  35. app/code/community/Listrak/Remarketing/Helper/Review/Update.php +45 -5
  36. app/code/community/Listrak/Remarketing/Model/Abandonedcart.php +8 -27
  37. app/code/community/Listrak/Remarketing/Model/Abandonedcart/Api.php +69 -21
  38. app/code/community/Listrak/Remarketing/Model/Abandonedcart/Api/V2.php +3 -0
  39. app/code/community/Listrak/Remarketing/Model/Apiextension.php +11 -0
  40. app/code/community/Listrak/Remarketing/Model/Apiextension/Api.php +434 -135
  41. app/code/community/Listrak/Remarketing/Model/Apiextension/Api/V2.php +3 -0
  42. app/code/community/Listrak/Remarketing/Model/Cache/Sca.php +46 -9
  43. app/code/community/Listrak/Remarketing/Model/Click.php +32 -5
  44. app/code/community/Listrak/Remarketing/Model/Click/Api.php +66 -24
  45. app/code/community/Listrak/Remarketing/Model/Click/Api/V2.php +3 -0
  46. app/code/community/Listrak/Remarketing/Model/Emailcapture.php +10 -1
  47. app/code/community/Listrak/Remarketing/Model/Log.php +32 -4
  48. app/code/community/Listrak/Remarketing/Model/Log/Api.php +62 -25
  49. app/code/community/Listrak/Remarketing/Model/Log/Api/V2.php +3 -0
  50. app/code/community/Listrak/Remarketing/Model/Mysql4/Abandonedcart.php +53 -15
  51. app/code/community/Listrak/Remarketing/Model/Mysql4/Abandonedcart/Collection.php +36 -13
  52. app/code/community/Listrak/Remarketing/Model/Mysql4/Apiextension.php +44 -27
  53. app/code/community/Listrak/Remarketing/Model/Mysql4/Click.php +44 -10
  54. app/code/community/Listrak/Remarketing/Model/Mysql4/Click/Collection.php +15 -1
  55. app/code/community/Listrak/Remarketing/Model/Mysql4/Emailcapture.php +8 -7
  56. app/code/community/Listrak/Remarketing/Model/Mysql4/Emailcapture/Collection.php +8 -1
  57. app/code/community/Listrak/Remarketing/Model/Mysql4/Log.php +8 -7
  58. app/code/community/Listrak/Remarketing/Model/Mysql4/Log/Collection.php +15 -0
  59. app/code/community/Listrak/Remarketing/Model/Mysql4/Product.php +22 -0
  60. app/code/community/Listrak/Remarketing/Model/Mysql4/Product/Attribute/Set/Map.php +6 -7
  61. app/code/community/Listrak/Remarketing/Model/Mysql4/Product/Attribute/Set/Map/Collection.php +55 -10
  62. app/code/community/Listrak/Remarketing/Model/Mysql4/Product/Collection.php +185 -0
  63. app/code/community/Listrak/Remarketing/Model/Mysql4/Review/Update.php +8 -7
  64. app/code/community/Listrak/Remarketing/Model/Mysql4/Review/Update/Collection.php +39 -2
  65. app/code/community/Listrak/Remarketing/Model/Mysql4/Session.php +93 -20
  66. app/code/community/Listrak/Remarketing/Model/Mysql4/Session/Collection.php +21 -1
  67. app/code/community/Listrak/Remarketing/Model/Mysql4/Subscriberupdate.php +8 -7
  68. app/code/community/Listrak/Remarketing/Model/Mysql4/Subscriberupdate/Collection.php +8 -0
  69. app/code/community/Listrak/Remarketing/Model/Observer.php +130 -32
  70. app/code/community/Listrak/Remarketing/Model/Product.php +30 -0
  71. app/code/community/Listrak/Remarketing/Model/Product/Api.php +227 -64
  72. app/code/community/Listrak/Remarketing/Model/Product/Api/V2.php +3 -0
  73. app/code/community/Listrak/Remarketing/Model/Product/Attribute/Set/Map.php +60 -10
  74. app/code/community/Listrak/Remarketing/Model/Product/Attributes.php +20 -6
  75. app/code/community/Listrak/Remarketing/Model/Product/Category/Source.php +18 -2
  76. app/code/community/Listrak/Remarketing/Model/Product/Purchasable/Visibility.php +83 -19
  77. app/code/community/Listrak/Remarketing/Model/Review/Update.php +67 -6
  78. app/code/community/Listrak/Remarketing/Model/Review/Update/Api.php +267 -96
  79. app/code/community/Listrak/Remarketing/Model/Review/Update/Api/V2.php +3 -0
  80. app/code/community/Listrak/Remarketing/Model/Session.php +94 -23
  81. app/code/community/Listrak/Remarketing/Model/Subscriber.php +29 -8
  82. app/code/community/Listrak/Remarketing/Model/Subscriberupdate.php +10 -1
  83. app/code/community/Listrak/Remarketing/controllers/Adminhtml/AbandonedcartreportController.php +0 -47
  84. app/code/community/Listrak/Remarketing/controllers/Adminhtml/EmailcaptureController.php +0 -153
  85. app/code/community/Listrak/Remarketing/controllers/Adminhtml/ProductattributesController.php +0 -162
  86. app/code/community/Listrak/Remarketing/controllers/AjaxController.php +45 -8
  87. app/code/community/Listrak/Remarketing/controllers/CartController.php +136 -33
  88. app/code/community/Listrak/Remarketing/controllers/ConfigController.php +57 -19
  89. app/code/community/Listrak/Remarketing/controllers/EmailController.php +41 -7
  90. app/code/community/Listrak/Remarketing/controllers/Remarketing/EmailcaptureController.php +264 -0
  91. app/code/community/Listrak/Remarketing/controllers/Remarketing/ProductattributesController.php +311 -0
  92. app/code/community/Listrak/Remarketing/controllers/TroubleshootingController.php +8 -0
  93. app/code/community/Listrak/Remarketing/etc/adminhtml.xml +3 -3
  94. app/code/community/Listrak/Remarketing/etc/api.xml +4 -8
  95. app/code/community/Listrak/Remarketing/etc/cache.xml +1 -1
  96. app/code/community/Listrak/Remarketing/etc/config.xml +6 -6
  97. app/code/community/Listrak/Remarketing/etc/wsdl.xml +22 -24
  98. app/code/community/Listrak/Remarketing/etc/wsi.xml +25 -43
  99. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-install-1.0.0.php +4 -2
  100. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-install-1.1.9.php +4 -14
  101. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.0.0-1.0.1.php +8 -3
  102. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.0.8-1.0.9.php +5 -2
  103. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.0-1.1.1.php +4 -3
  104. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.3-1.1.4.php +4 -2
  105. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.4-1.1.5.php +4 -2
  106. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.5-1.1.6.php +4 -2
  107. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.6-1.1.7.php +19 -5
  108. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.7-1.1.8.php +4 -1
  109. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.8-1.1.9.php +8 -3
  110. app/design/adminhtml/default/default/template/listrak/remarketing/productattributes.phtml +9 -5
  111. app/design/adminhtml/default/default/template/listrak/remarketing/productattributes/form/categories.phtml +101 -33
  112. app/design/frontend/base/default/layout/remarketing.xml +3 -3
  113. app/design/frontend/base/default/template/remarketing/async_wrapper.phtml +16 -3
  114. app/design/frontend/base/default/template/remarketing/onescript.phtml +20 -4
  115. app/design/frontend/base/default/template/remarketing/utils.phtml +33 -7
  116. package.xml +5 -8
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture
16
extends Mage_Adminhtml_Block_Widget_Grid_Container
17
{
18
public function __construct()
19
{
20
$this->_controller = 'adminhtml_emailcapture';
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture
19
extends Mage_Adminhtml_Block_Widget_Grid_Container
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
$this->_controller = 'adminhtml_emailcapture';
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit
16
extends Mage_Adminhtml_Block_Widget_Form_Container
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -23,13 +29,27 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit
23
$this->_blockGroup = 'remarketing';
24
$this->_controller = 'adminhtml_emailcapture';
25
26
- $this->_updateButton('save', 'label', Mage::helper('remarketing')->__('Save Field'));
27
- $this->_updateButton('delete', 'label', Mage::helper('remarketing')->__('Delete Field'));
28
}
29
30
public function getHeaderText()
31
{
32
- if (Mage::registry('emailcapture_data') && Mage::registry('emailcapture_data')->getId()) {
33
return Mage::helper('remarketing')->__("Edit Field");
34
} else {
35
return Mage::helper('remarketing')->__('Add Field');
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit
19
extends Mage_Adminhtml_Block_Widget_Form_Container
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
29
$this->_blockGroup = 'remarketing';
30
$this->_controller = 'adminhtml_emailcapture';
31
32
+ $this->_updateButton(
33
+ 'save', 'label',
34
+ Mage::helper('remarketing')->__('Save Field')
35
+ );
36
+
37
+ $this->_updateButton(
38
+ 'delete', 'label',
39
+ Mage::helper('remarketing')->__('Delete Field')
40
+ );
41
}
42
43
+ /**
44
+ * Gets header text for block
45
+ *
46
+ * @return string
47
+ */
48
public function getHeaderText()
49
{
50
+ if (Mage::registry('emailcapture_data')
51
+ && Mage::registry('emailcapture_data')->getId()
52
+ ) {
53
return Mage::helper('remarketing')->__("Edit Field");
54
} else {
55
return Mage::helper('remarketing')->__('Add Field');
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Form.php CHANGED
@@ -12,15 +12,26 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Form
16
extends Mage_Adminhtml_Block_Widget_Form
17
{
18
protected function _prepareForm()
19
{
20
$form = new Varien_Data_Form(
21
array(
22
'id' => 'edit_form',
23
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
24
'method' => 'post',
25
)
26
);
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Form
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Form
19
extends Mage_Adminhtml_Block_Widget_Form
20
{
21
+ /**
22
+ * Prepare form
23
+ *
24
+ * @return Mage_Adminhtml_Block_Widget_Form
25
+ */
26
protected function _prepareForm()
27
{
28
$form = new Varien_Data_Form(
29
array(
30
'id' => 'edit_form',
31
+ 'action' => $this->getUrl(
32
+ '*/*/save',
33
+ array('id' => $this->getRequest()->getParam('id'))
34
+ ),
35
'method' => 'post',
36
)
37
);
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tab/Form.php CHANGED
@@ -12,9 +12,17 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form
16
extends Mage_Adminhtml_Block_Widget_Form
17
{
18
protected function _prepareForm()
19
{
20
$form = new Varien_Data_Form();
@@ -31,10 +39,10 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form
31
'required' => true,
32
'name' => 'page',
33
'after_element_html' => '<p class="note"><span>For example: '
34
- . '/checkout/onepage/index. Each URL has 3 parts. If yours '
35
- . 'does not have 3 parts, fill the last with "index". You '
36
- . 'can also use wildcard character "*" to capture field on '
37
- . 'all pages in the store.</span></p>'
38
)
39
);
40
@@ -51,11 +59,18 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form
51
);
52
53
if (Mage::getSingleton('adminhtml/session')->getEmailCaptureData()) {
54
- $form->setValues(Mage::getSingleton('adminhtml/session')->getEmailCaptureData());
55
- Mage::getSingleton('adminhtml/session')->setEmailCaptureData(null);
56
} elseif (Mage::registry('emailcapture_data')) {
57
- $form->setValues(Mage::registry('emailcapture_data')->getData());
58
}
59
return parent::_prepareForm();
60
}
61
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form
19
extends Mage_Adminhtml_Block_Widget_Form
20
{
21
+ /**
22
+ * Prepare form
23
+ *
24
+ * @return Mage_Adminhtml_Block_Widget_Form
25
+ */
26
protected function _prepareForm()
27
{
28
$form = new Varien_Data_Form();
39
'required' => true,
40
'name' => 'page',
41
'after_element_html' => '<p class="note"><span>For example: '
42
+ . '/checkout/onepage/index. Each URL has 3 parts. If yours'
43
+ . ' does not have 3 parts, fill the last with "index". '
44
+ . 'You can also use wildcard character "*" to capture '
45
+ . 'field on all pages in the store.</span></p>'
46
)
47
);
48
59
);
60
61
if (Mage::getSingleton('adminhtml/session')->getEmailCaptureData()) {
62
+ /* @var Mage_Adminhtml_Model_Session $adminSession */
63
+ $adminSession = Mage::getSingleton('adminhtml/session');
64
+
65
+ $form->setValues($adminSession->getEmailCaptureData());
66
+ $adminSession->setEmailCaptureData(null);
67
} elseif (Mage::registry('emailcapture_data')) {
68
+ $form->setValues(
69
+ Mage::registry('emailcapture_data')
70
+ ->getData()
71
+ );
72
}
73
+
74
return parent::_prepareForm();
75
}
76
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tabs.php CHANGED
@@ -12,10 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs
16
extends Mage_Adminhtml_Block_Widget_Tabs
17
{
18
-
19
public function __construct()
20
{
21
parent::__construct();
@@ -24,6 +29,13 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs
24
$this->setTitle(Mage::helper('remarketing')->__('Field Information'));
25
}
26
27
protected function _beforeToHtml()
28
{
29
$this->addTab(
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs
19
extends Mage_Adminhtml_Block_Widget_Tabs
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
29
$this->setTitle(Mage::helper('remarketing')->__('Field Information'));
30
}
31
32
+ /**
33
+ * Before HTML output
34
+ *
35
+ * Adds necessary UI elements
36
+ *
37
+ * @return Mage_Core_Block_Abstract
38
+ */
39
protected function _beforeToHtml()
40
{
41
$this->addTab(
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Grid.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid
16
extends Mage_Adminhtml_Block_Widget_Grid
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -24,43 +30,64 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid
24
$this->setSaveParametersInSession(true);
25
}
26
27
protected function _prepareCollection()
28
{
29
- $collection = Mage::getModel('listrak/emailcapture')->getCollection();
30
- $this->setCollection($collection);
31
return parent::_prepareCollection();
32
}
33
34
protected function _prepareColumns()
35
{
36
$this->addColumn(
37
- 'emailcapture_id', array(
38
- 'header' => Mage::helper('remarketing')->__('ID'),
39
- 'align' => 'right',
40
- 'width' => '50px',
41
- 'index' => 'emailcapture_id',
42
- )
43
);
44
45
$this->addColumn(
46
- 'page', array(
47
- 'header' => Mage::helper('remarketing')->__('Page'),
48
- 'align' => 'left',
49
- 'index' => 'page',
50
- )
51
);
52
53
$this->addColumn(
54
- 'field_id', array(
55
- 'header' => Mage::helper('remarketing')->__('Field ID'),
56
- 'align' => 'left',
57
- 'index' => 'field_id',
58
- )
59
);
60
61
return parent::_prepareColumns();
62
}
63
64
public function getRowUrl($row)
65
{
66
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid
19
extends Mage_Adminhtml_Block_Widget_Grid
20
{
21
+ /**
22
+ * Initializes the object
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
30
$this->setSaveParametersInSession(true);
31
}
32
33
+ /**
34
+ * Prepare collection
35
+ *
36
+ * @return $this
37
+ */
38
protected function _prepareCollection()
39
{
40
+ /* @var Listrak_Remarketing_Model_Mysql4_Emailcapture_Collection $col */
41
+ $col = Mage::getModel('listrak/emailcapture')->getCollection();
42
+ $this->setCollection($col);
43
return parent::_prepareCollection();
44
}
45
46
+ /**
47
+ * Prepare grid columns
48
+ *
49
+ * @return $this
50
+ */
51
protected function _prepareColumns()
52
{
53
$this->addColumn(
54
+ 'emailcapture_id',
55
+ array(
56
+ 'header' => Mage::helper('remarketing')->__('ID'),
57
+ 'align' => 'right',
58
+ 'width' => '50px',
59
+ 'index' => 'emailcapture_id',
60
+ )
61
);
62
63
$this->addColumn(
64
+ 'page',
65
+ array(
66
+ 'header' => Mage::helper('remarketing')->__('Page'),
67
+ 'align' => 'left',
68
+ 'index' => 'page',
69
+ )
70
);
71
72
$this->addColumn(
73
+ 'field_id',
74
+ array(
75
+ 'header' => Mage::helper('remarketing')->__('Field ID'),
76
+ 'align' => 'left',
77
+ 'index' => 'field_id',
78
+ )
79
);
80
81
return parent::_prepareColumns();
82
}
83
84
+ /**
85
+ * Retrieve the edit page location for a row
86
+ *
87
+ * @param mixed $row Grid row
88
+ *
89
+ * @return string
90
+ */
91
public function getRowUrl($row)
92
{
93
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
app/code/community/Listrak/Remarketing/Block/Adminhtml/Notifications.php CHANGED
@@ -12,27 +12,51 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Notifications extends Mage_Core_Block_Text
16
{
17
protected function _toHtml()
18
{
19
$html = "";
20
21
- if (!Mage::helper('remarketing')->checkSetupStatus()) {
22
- $html .= "<div class='notification-global'>The Listrak module requires a Listrak account. Please " .
23
- "<a href='http://www.listrak.com/partners/magento-extension.aspx'>fill out our form</a> to " .
24
- "get an account. If you already have a Listrak account, please contact your account manager " .
25
- "or <a href='mailto:support@listrak.com'>support@listrak.com</a>.</div>";
26
}
27
28
- if (strpos(Mage::helper('core/url')->getCurrentUrl(), "/adminhtml_productattributes/") === false
29
- && Mage::helper('remarketing')->displayAttributeSetNotification()
30
) {
31
- $html .= "<div class='notification-global'>Brand attribute has not been defined for one or more " .
32
- "attribute sets. Please <a href='" .
33
- Mage::helper('adminhtml')->getUrl('remarketing/adminhtml_productattributes/index') .
34
- "'>click here</a>, or go to Listrak > Product Attributes " .
35
- "to review your current settings.</div>";
36
}
37
38
return $html;
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Notifications
17
+ *
18
+ * Displays notifications in the admin portal
19
+ */
20
class Listrak_Remarketing_Block_Adminhtml_Notifications extends Mage_Core_Block_Text
21
{
22
+ /**
23
+ * Render block
24
+ *
25
+ * @return string
26
+ */
27
protected function _toHtml()
28
{
29
$html = "";
30
31
+ /* @var Listrak_Remarketing_Helper_Data $helper */
32
+ $helper = Mage::helper('remarketing');
33
+ if (!$helper->checkSetupStatus()) {
34
+ $html .= "<div class='notification-global'>The Listrak module "
35
+ . "requires a Listrak account. Please "
36
+ . "<a href='http://www.listrak.com/partners/magento-extension.aspx'>"
37
+ . "fill out our form</a> to get an account. If you already have a "
38
+ . "Listrak account, please contact your account manager or "
39
+ . "<a href='mailto:support@listrak.com'>support@listrak.com</a>."
40
+ . "</div>";
41
}
42
43
+ /* @var Mage_Core_Helper_Url $urlHelper */
44
+ $urlHelper = Mage::helper('core/url');
45
+
46
+ $currentUrl = $urlHelper->getCurrentUrl();
47
+ if (strpos($currentUrl, "/adminhtml_productattributes/") === false
48
+ && $helper->displayAttributeSetNotification()
49
) {
50
+ /* @var Mage_Adminhtml_Helper_Data $adminHelper */
51
+ $adminHelper = Mage::helper('adminhtml');
52
+
53
+ $url = $adminHelper
54
+ ->getUrl('remarketing/adminhtml_productattributes/index');
55
+
56
+ $html .= "<div class='notification-global'>Brand attribute has not been "
57
+ . "defined for one or more attribute sets. Please <a href='{$url}'>"
58
+ . "click here</a>, or go to Listrak > Product Attributes "
59
+ . "to review your current settings.</div>";
60
}
61
62
return $html;
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes
16
extends Mage_Adminhtml_Block_Widget_Container
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -24,34 +30,58 @@ class Listrak_Remarketing_Block_Adminhtml_ProductAttributes
24
$this->setTemplate('listrak/remarketing/productattributes.phtml');
25
}
26
27
public function _prepareLayout()
28
{
29
$this->setChild(
30
'grid',
31
- $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_grid')
32
);
33
$this->setChild(
34
'init_brands',
35
- $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_init_brands')
36
);
37
return parent::_prepareLayout();
38
}
39
40
public function getInitBrandsHtml()
41
{
42
return $this->getChildHtml('init_brands');
43
}
44
45
public function getGridHtml()
46
{
47
return $this->getChildHtml('grid');
48
}
49
50
public function setsWithoutBrandAttribute()
51
{
52
$sets = array();
53
54
$allSets = Mage::registry('productattribute_sets');
55
foreach ($allSets as $set) {
56
if ($set->getBrandAttributeCode() == null) {
57
array_push($sets, $set);
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_ProductAttributes
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes
19
extends Mage_Adminhtml_Block_Widget_Container
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
30
$this->setTemplate('listrak/remarketing/productattributes.phtml');
31
}
32
33
+ /**
34
+ * Creates the layout in code
35
+ *
36
+ * @return Mage_Core_Block_Abstract
37
+ */
38
public function _prepareLayout()
39
{
40
$this->setChild(
41
'grid',
42
+ $this->getLayout()
43
+ ->createBlock('remarketing/adminhtml_productattributes_grid')
44
);
45
$this->setChild(
46
'init_brands',
47
+ $this->getLayout()
48
+ ->createBlock('remarketing/adminhtml_productattributes_init_brands')
49
);
50
return parent::_prepareLayout();
51
}
52
53
+ /**
54
+ * Retrieve brands block
55
+ *
56
+ * @return string
57
+ */
58
public function getInitBrandsHtml()
59
{
60
return $this->getChildHtml('init_brands');
61
}
62
63
+ /**
64
+ * Retrieve the grid
65
+ *
66
+ * @return string
67
+ */
68
public function getGridHtml()
69
{
70
return $this->getChildHtml('grid');
71
}
72
73
+ /**
74
+ * Sets that do not have the brand attribute
75
+ *
76
+ * @return array
77
+ */
78
public function setsWithoutBrandAttribute()
79
{
80
$sets = array();
81
82
$allSets = Mage::registry('productattribute_sets');
83
+
84
+ /* @var Listrak_Remarketing_Model_Product_Attribute_Set_Map $set */
85
foreach ($allSets as $set) {
86
if ($set->getBrandAttributeCode() == null) {
87
array_push($sets, $set);
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Edit
16
extends Mage_Adminhtml_Block_Widget_Form_Container
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -26,6 +32,11 @@ class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Edit
26
$this->_removeButton('delete');
27
}
28
29
public function getHeaderText()
30
{
31
return Mage::registry('productattribute_data')->getAttributeSetName();
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Edit
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Edit
19
extends Mage_Adminhtml_Block_Widget_Form_Container
20
{
21
+ /**
22
+ * Initialize the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
32
$this->_removeButton('delete');
33
}
34
35
+ /**
36
+ * Get header text
37
+ *
38
+ * @return mixed
39
+ */
40
public function getHeaderText()
41
{
42
return Mage::registry('productattribute_data')->getAttributeSetName();
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Form.php CHANGED
@@ -12,15 +12,26 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Form
16
extends Mage_Adminhtml_Block_Widget_Form
17
{
18
protected function _prepareForm()
19
{
20
$form = new Varien_Data_Form(
21
array(
22
'id' => 'edit_form',
23
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
24
'method' => 'post',
25
)
26
);
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Form
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Form
19
extends Mage_Adminhtml_Block_Widget_Form
20
{
21
+ /**
22
+ * Prepare form
23
+ *
24
+ * @return Mage_Adminhtml_Block_Widget_Form
25
+ */
26
protected function _prepareForm()
27
{
28
$form = new Varien_Data_Form(
29
array(
30
'id' => 'edit_form',
31
+ 'action' => $this->getUrl(
32
+ '*/*/save',
33
+ array('id' => $this->getRequest()->getParam('id'))
34
+ ),
35
'method' => 'post',
36
)
37
);
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Brand.php CHANGED
@@ -12,9 +12,17 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Brand
16
extends Mage_Adminhtml_Block_Widget_Form
17
{
18
protected function _prepareForm()
19
{
20
$form = new Varien_Data_Form();
@@ -37,7 +45,8 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Brand
37
'label' => Mage::helper('remarketing')->__('Brand Attribute'),
38
'name' => 'brand_attribute',
39
'values' => $attributeCodes,
40
- 'value' => Mage::registry('productattribute_data')->getBrandAttributeCode()
41
)
42
);
43
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Brand
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Brand
19
extends Mage_Adminhtml_Block_Widget_Form
20
{
21
+ /**
22
+ * Prepare form
23
+ *
24
+ * @return Mage_Adminhtml_Block_Widget_Form
25
+ */
26
protected function _prepareForm()
27
{
28
$form = new Varien_Data_Form();
45
'label' => Mage::helper('remarketing')->__('Brand Attribute'),
46
'name' => 'brand_attribute',
47
'values' => $attributeCodes,
48
+ 'value' => Mage::registry('productattribute_data')
49
+ ->getBrandAttributeCode()
50
)
51
);
52
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Categories.php CHANGED
@@ -12,17 +12,30 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Categories
16
extends Mage_Adminhtml_Block_Widget
17
{
18
public function __construct()
19
{
20
parent::__construct();
21
- $this->setTemplate('listrak/remarketing/productattributes/form/categories.phtml');
22
23
$this->setModel(Mage::registry('productattribute_data'));
24
}
25
26
public function getCategoriesSource()
27
{
28
if ($this->getUseConfigCategoriesSource()) {
@@ -32,21 +45,43 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Catego
32
return $this->getModel()->getCategoriesSource();
33
}
34
35
public function getConfigCategoriesSource()
36
{
37
- return Mage::helper('remarketing')->categoriesSource();
38
}
39
40
public function getUseConfigCategoriesSource()
41
{
42
return $this->getModel()->getUseConfigCategoriesSource();
43
}
44
45
public function getCategoryAttributeCode()
46
{
47
return $this->getModel()->getCategoryAttributeCode();
48
}
49
50
public function getSubcategoryAttributeCode()
51
{
52
return $this->getModel()->getSubcategoryAttributeCode();
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Categories
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Categories
19
extends Mage_Adminhtml_Block_Widget
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
27
+ $this->setTemplate(
28
+ 'listrak/remarketing/productattributes/form/categories.phtml'
29
+ );
30
31
$this->setModel(Mage::registry('productattribute_data'));
32
}
33
34
+ /**
35
+ * Retrieve category source
36
+ *
37
+ * @return mixed
38
+ */
39
public function getCategoriesSource()
40
{
41
if ($this->getUseConfigCategoriesSource()) {
45
return $this->getModel()->getCategoriesSource();
46
}
47
48
+ /**
49
+ * Retrieve stored category source
50
+ *
51
+ * @return mixed
52
+ */
53
public function getConfigCategoriesSource()
54
{
55
+ /* @var Listrak_Remarketing_Helper_Data $helper */
56
+ $helper = Mage::helper('remarketing');
57
+ return $helper->categoriesSource();
58
}
59
60
+ /**
61
+ * Retrieve whether the config category is used
62
+ *
63
+ * @return mixed
64
+ */
65
public function getUseConfigCategoriesSource()
66
{
67
return $this->getModel()->getUseConfigCategoriesSource();
68
}
69
70
+ /**
71
+ * Retrieve category attribute code
72
+ *
73
+ * @return mixed
74
+ */
75
public function getCategoryAttributeCode()
76
{
77
return $this->getModel()->getCategoryAttributeCode();
78
}
79
80
+ /**
81
+ * Retrieve subcategory attribute code
82
+ *
83
+ * @return mixed
84
+ */
85
public function getSubcategoryAttributeCode()
86
{
87
return $this->getModel()->getSubcategoryAttributeCode();
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tabs.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
16
extends Mage_Adminhtml_Block_Widget_Tabs
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -24,14 +30,26 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
24
$this->setTitle(Mage::helper('remarketing')->__('Map Attributes'));
25
}
26
27
public function _prepareLayout()
28
{
29
- $attributeCodes = $this->_attributeSetAttributes(Mage::registry('productattribute_data')->getAttributeSetId());
30
31
$this->addTab(
32
'productattributes_brand',
33
array(
34
- 'label' => Mage::helper('remarketing')->__('Brand'),
35
'content' => $this->getLayout()->createBlock(
36
'remarketing/adminhtml_productattributes_edit_tab_form_brand'
37
)->setAttributeOptions($attributeCodes)->toHtml()
@@ -41,14 +59,23 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
41
$this->addTab(
42
'productattributes_categories',
43
array(
44
- 'label' => Mage::helper('remarketing')->__('Category and Subcategory'),
45
'content' => $this->getLayout()->createBlock(
46
'remarketing/adminhtml_productattributes_edit_tab_form_categories'
47
)->setAttributeOptions($attributeCodes)->toHtml()
48
)
49
);
50
}
51
52
private function _attributeSetAttributes($setId)
53
{
54
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
@@ -57,7 +84,8 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
57
58
$attributes = array();
59
foreach ($collection as $value) {
60
- $attributes[$value->getAttributeCode()] = $value->getFrontendLabel()
61
. ' (' . $value->getAttributeCode() . ')';
62
}
63
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs
19
extends Mage_Adminhtml_Block_Widget_Tabs
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
30
$this->setTitle(Mage::helper('remarketing')->__('Map Attributes'));
31
}
32
33
+ /**
34
+ * Prepare layout
35
+ *
36
+ * @return Mage_Core_Block_Abstract
37
+ */
38
public function _prepareLayout()
39
{
40
+ /* @var Listrak_Remarketing_Helper_Data $helper */
41
+ $helper = Mage::helper('remarketing');
42
+
43
+ $attributeCodes = $this
44
+ ->_attributeSetAttributes(
45
+ Mage::registry('productattribute_data')
46
+ ->getAttributeSetId()
47
+ );
48
49
$this->addTab(
50
'productattributes_brand',
51
array(
52
+ 'label' => $helper->__('Brand'),
53
'content' => $this->getLayout()->createBlock(
54
'remarketing/adminhtml_productattributes_edit_tab_form_brand'
55
)->setAttributeOptions($attributeCodes)->toHtml()
59
$this->addTab(
60
'productattributes_categories',
61
array(
62
+ 'label' => $helper->__('Category and Subcategory'),
63
'content' => $this->getLayout()->createBlock(
64
'remarketing/adminhtml_productattributes_edit_tab_form_categories'
65
)->setAttributeOptions($attributeCodes)->toHtml()
66
)
67
);
68
+
69
+ return parent::_prepareLayout();
70
}
71
72
+ /**
73
+ * Retrieve all attribute for am attribute set
74
+ *
75
+ * @param int $setId Set to process
76
+ *
77
+ * @return array
78
+ */
79
private function _attributeSetAttributes($setId)
80
{
81
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
84
85
$attributes = array();
86
foreach ($collection as $value) {
87
+ $attributes[$value->getAttributeCode()]
88
+ = $value->getFrontendLabel()
89
. ' (' . $value->getAttributeCode() . ')';
90
}
91
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Grid.php CHANGED
@@ -12,9 +12,15 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid
16
extends Mage_Adminhtml_Block_Widget_Grid
17
{
18
public function __construct()
19
{
20
parent::__construct();
@@ -24,72 +30,97 @@ class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid
24
$this->setSaveParametersInSession(false);
25
}
26
27
protected function _prepareCollection()
28
{
29
$collection = Mage::registry('productattribute_sets');
30
31
// prepare visible fields
32
foreach ($collection as $item) {
33
$item->setFrontendCategoriesSource($item->frontendCategoriesSource());
34
$item->setFrontendBrandAttribute($item->frontendBrandAttribute());
35
$item->setFrontendCategoryAttribute($item->frontendCategoryAttribute());
36
- $item->setFrontendSubcategoryAttribute($item->frontendSubcategoryAttribute());
37
}
38
39
$this->setCollection($collection);
40
return parent::_prepareCollection();
41
}
42
43
protected function _prepareColumns()
44
{
45
$this->addColumn(
46
- 'attribute_set', array(
47
- 'header' => Mage::helper('remarketing')->__('Attribute Set Name'),
48
- 'align' => 'left',
49
- 'index' => 'attribute_set_name',
50
- 'filter' => false
51
- )
52
);
53
54
$this->addColumn(
55
- 'brand_attribute', array(
56
- 'header' => Mage::helper('remarketing')->__('Brand Attribute'),
57
- 'align' => 'left',
58
- 'index' => 'frontend_brand_attribute',
59
- 'filter' => false
60
- )
61
);
62
63
$this->addColumn(
64
- 'categories_source', array(
65
- 'header' => Mage::helper('remarketing')->__('Category Source'),
66
- 'align' => 'left',
67
- 'index' => 'frontend_categories_source',
68
- 'filter' => false
69
- )
70
);
71
72
$this->addColumn(
73
- 'category_attribute', array(
74
- 'header' => Mage::helper('remarketing')->__('Category Attribute'),
75
- 'align' => 'left',
76
- 'index' => 'frontend_category_attribute',
77
- 'filter' => false
78
- )
79
);
80
81
$this->addColumn(
82
- 'subcategory_attribute', array(
83
- 'header' => Mage::helper('remarketing')->__('Subcategory Attribute'),
84
- 'align' => 'left',
85
- 'index' => 'frontend_subcategory_attribute',
86
- 'filter' => false
87
- )
88
);
89
90
return parent::_prepareColumns();
91
}
92
93
public function getRowUrl($row)
94
{
95
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid
19
extends Mage_Adminhtml_Block_Widget_Grid
20
{
21
+ /**
22
+ * Initializes the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
30
$this->setSaveParametersInSession(false);
31
}
32
33
+ /**
34
+ * Prepare collection for output
35
+ *
36
+ * @return $this
37
+ */
38
protected function _prepareCollection()
39
{
40
$collection = Mage::registry('productattribute_sets');
41
42
// prepare visible fields
43
+ /* @var Listrak_Remarketing_Model_Product_Attribute_Set_Map $item */
44
foreach ($collection as $item) {
45
$item->setFrontendCategoriesSource($item->frontendCategoriesSource());
46
$item->setFrontendBrandAttribute($item->frontendBrandAttribute());
47
$item->setFrontendCategoryAttribute($item->frontendCategoryAttribute());
48
+ $item->setFrontendSubcategoryAttribute(
49
+ $item->frontendSubcategoryAttribute()
50
+ );
51
}
52
53
$this->setCollection($collection);
54
return parent::_prepareCollection();
55
}
56
57
+ /**
58
+ * Prepare grid columns
59
+ *
60
+ * @return $this
61
+ */
62
protected function _prepareColumns()
63
{
64
$this->addColumn(
65
+ 'attribute_set',
66
+ array(
67
+ 'header' => Mage::helper('remarketing')->__('Attribute Set Name'),
68
+ 'align' => 'left',
69
+ 'index' => 'attribute_set_name',
70
+ 'filter' => false
71
+ )
72
);
73
74
$this->addColumn(
75
+ 'brand_attribute',
76
+ array(
77
+ 'header' => Mage::helper('remarketing')->__('Brand Attribute'),
78
+ 'align' => 'left',
79
+ 'index' => 'frontend_brand_attribute',
80
+ 'filter' => false
81
+ )
82
);
83
84
$this->addColumn(
85
+ 'categories_source',
86
+ array(
87
+ 'header' => Mage::helper('remarketing')->__('Category Source'),
88
+ 'align' => 'left',
89
+ 'index' => 'frontend_categories_source',
90
+ 'filter' => false
91
+ )
92
);
93
94
$this->addColumn(
95
+ 'category_attribute',
96
+ array(
97
+ 'header' => Mage::helper('remarketing')->__('Category Attribute'),
98
+ 'align' => 'left',
99
+ 'index' => 'frontend_category_attribute',
100
+ 'filter' => false
101
+ )
102
);
103
104
$this->addColumn(
105
+ 'subcategory_attribute',
106
+ array(
107
+ 'header' => Mage::helper('remarketing')->__('Subcategory Attribute'),
108
+ 'align' => 'left',
109
+ 'index' => 'frontend_subcategory_attribute',
110
+ 'filter' => false
111
+ )
112
);
113
114
return parent::_prepareColumns();
115
}
116
117
+ /**
118
+ * Link to edit the information in a row
119
+ *
120
+ * @param mixed $row Grid row
121
+ *
122
+ * @return string
123
+ */
124
public function getRowUrl($row)
125
{
126
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands.php CHANGED
@@ -12,29 +12,54 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands
16
extends Mage_Adminhtml_Block_Template
17
{
18
public function __construct()
19
{
20
parent::__construct();
21
- $this->setTemplate('listrak/remarketing/productattributes/form/initbrands.phtml');
22
}
23
24
public function _prepareLayout()
25
{
26
$this->setChild(
27
'form',
28
- $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_init_brands_form')
29
);
30
return parent::_prepareLayout();
31
}
32
33
public function getFormHtml()
34
{
35
return $this->getChildHtml('form');
36
}
37
38
public function getFormElementsHtml()
39
{
40
return $this->getChildHtml('form-elements');
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands
19
extends Mage_Adminhtml_Block_Template
20
{
21
+ /**
22
+ * Initialize the block
23
+ */
24
public function __construct()
25
{
26
parent::__construct();
27
+ $this->setTemplate(
28
+ 'listrak/remarketing/productattributes/form/initbrands.phtml'
29
+ );
30
}
31
32
+ /**
33
+ * Prepare layout
34
+ *
35
+ * @return Mage_Core_Block_Abstract
36
+ */
37
public function _prepareLayout()
38
{
39
$this->setChild(
40
'form',
41
+ $this->getLayout()->createBlock(
42
+ 'remarketing/adminhtml_productattributes_init_brands_form'
43
+ )
44
);
45
return parent::_prepareLayout();
46
}
47
48
+ /**
49
+ * Get the form HTML
50
+ *
51
+ * @return string
52
+ */
53
public function getFormHtml()
54
{
55
return $this->getChildHtml('form');
56
}
57
58
+ /**
59
+ * Get form elements
60
+ *
61
+ * @return string
62
+ */
63
public function getFormElementsHtml()
64
{
65
return $this->getChildHtml('form-elements');
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands/Form.php CHANGED
@@ -12,9 +12,17 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands_Form
16
extends Mage_Adminhtml_Block_Widget_Form
17
{
18
protected function _prepareForm()
19
{
20
$form = new Varien_Data_Form(
@@ -55,20 +63,32 @@ class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands_Form
55
return parent::_prepareForm();
56
}
57
58
public function availableAttributes()
59
{
60
$everything = Mage::registry('productattribute_sets');
61
$attributes = array();
62
63
foreach ($everything as $item) {
64
if ($item->getBrandAttributeCode() == null) {
65
- //get the attributes for this attribute set and add them to the attributes array
66
- $collection = Mage::getResourceModel('catalog/product_attribute_collection')
67
->setAttributeSetFilter($item->getAttributeSetId())
68
->addVisibleFilter();
69
foreach ($collection as $attribute) {
70
- if (!array_key_exists($attribute->getAttributeCode(), $attributes)) {
71
- $attributes[$attribute->getAttributeCode()] = $attribute->getFrontendLabel()
72
. ' (' . $attribute->getAttributeCode() . ')';
73
}
74
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands_Form
17
+ */
18
class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands_Form
19
extends Mage_Adminhtml_Block_Widget_Form
20
{
21
+ /**
22
+ * Prepare form
23
+ *
24
+ * @return Mage_Adminhtml_Block_Widget_Form
25
+ */
26
protected function _prepareForm()
27
{
28
$form = new Varien_Data_Form(
63
return parent::_prepareForm();
64
}
65
66
+ /**
67
+ * Attributes that could be the brand attribute
68
+ *
69
+ * @return array
70
+ */
71
public function availableAttributes()
72
{
73
$everything = Mage::registry('productattribute_sets');
74
$attributes = array();
75
76
+ /* @var Listrak_Remarketing_Model_Product_Attribute_Set_Map $item */
77
foreach ($everything as $item) {
78
if ($item->getBrandAttributeCode() == null) {
79
+ //get the attributes for this attribute set
80
+ //and add them to the attributes array
81
+ $collection = Mage::getResourceModel(
82
+ 'catalog/product_attribute_collection'
83
+ )
84
->setAttributeSetFilter($item->getAttributeSetId())
85
->addVisibleFilter();
86
foreach ($collection as $attribute) {
87
+ if (!array_key_exists(
88
+ $attribute->getAttributeCode(), $attributes
89
+ )) {
90
+ $attributes[$attribute->getAttributeCode()]
91
+ = $attribute->getFrontendLabel()
92
. ' (' . $attribute->getAttributeCode() . ')';
93
}
94
}
app/code/community/Listrak/Remarketing/Block/Base.php CHANGED
@@ -12,67 +12,163 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Base extends Mage_Core_Block_Template
16
{
17
private $_alwaysRenderTemplate = false;
18
private $_lines = array();
19
20
- public function _toHtml() {
21
if ($this->getTemplate()) {
22
- if (!$this->_alwaysRenderTemplate && !trim($this->getScript()))
23
return "";
24
25
return parent::_toHtml();
26
- }
27
- else
28
return $this->getScript();
29
}
30
31
- public function canRender() {
32
return true;
33
}
34
35
- public function getScript($addWhitespace = true) {
36
- $js = "";
37
- foreach($this->_lines as $line) {
38
- $js .= $line . "\n";
39
- if ($addWhitespace) $js .= " ";
40
}
41
42
- return $js . $this->getChildHtml();
43
}
44
45
- protected function addLine($js) {
46
$this->_lines[] = $js;
47
}
48
49
- public function jsEscape($value, $quote = "'") {
50
return addcslashes($value, "\\{$quote}");
51
}
52
53
- public function toJsString($value) {
54
return "'{$this->jsEscape($value)}'";
55
}
56
-
57
- public function setAlwaysRenderTemplate($val) {
58
$this->_alwaysRenderTemplate = (bool)$val;
59
}
60
61
- public function isProductPage() {
62
- return Mage::app()->getRequest()->getModuleName() == 'catalog' &&
63
- Mage::app()->getRequest()->getControllerName() == 'product' &&
64
- Mage::app()->getRequest()->getActionName() == 'view';
65
}
66
67
- public function isCartPage() {
68
- return Mage::app()->getRequest()->getModuleName() == 'checkout' &&
69
- Mage::app()->getRequest()->getControllerName() == 'cart' &&
70
- Mage::app()->getRequest()->getActionName() == 'index';
71
}
72
-
73
- public function isOrderConfirmationPage() {
74
- return Mage::app()->getRequest()->getModuleName() == 'checkout' &&
75
- (Mage::app()->getRequest()->getControllerName() == 'multishipping' || Mage::app()->getRequest()->getControllerName() == 'onepage') &&
76
- Mage::app()->getRequest()->getActionName() == 'success';
77
}
78
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Base
17
+ */
18
+ class Listrak_Remarketing_Block_Base
19
+ extends Mage_Core_Block_Template
20
{
21
private $_alwaysRenderTemplate = false;
22
private $_lines = array();
23
24
+ /**
25
+ * Render block
26
+ *
27
+ * @return string
28
+ */
29
+ public function _toHtml()
30
+ {
31
if ($this->getTemplate()) {
32
+ if (!$this->_alwaysRenderTemplate && !trim($this->getScript())) {
33
return "";
34
+ }
35
36
return parent::_toHtml();
37
+ } else {
38
return $this->getScript();
39
+ }
40
}
41
42
+ /**
43
+ * Retrieve whether the block settings allow for rendering
44
+ *
45
+ * @return bool
46
+ */
47
+ public function canRender()
48
+ {
49
return true;
50
}
51
52
+ /**
53
+ * Retrieve the Javascript code
54
+ *
55
+ * @param bool $addWhitespace Add whitespace characters on each line
56
+ *
57
+ * @return string
58
+ */
59
+ public function getScript($addWhitespace = true)
60
+ {
61
+ $code = "";
62
+ foreach ($this->_lines as $line) {
63
+ $code .= $line . "\n";
64
+ if ($addWhitespace) {
65
+ $code .= " ";
66
+ }
67
}
68
69
+ return $code . $this->getChildHtml();
70
}
71
72
+ /**
73
+ * Adds a JS line to the output
74
+ *
75
+ * @param string $js Javascript line
76
+ *
77
+ * @return void
78
+ */
79
+ protected function addLine($js)
80
+ {
81
$this->_lines[] = $js;
82
}
83
84
+ /**
85
+ * Escapes special characters in a string
86
+ *
87
+ * @param string $value Value
88
+ * @param string $quote Special quote character
89
+ *
90
+ * @return string
91
+ */
92
+ public function jsEscape($value, $quote = "'")
93
+ {
94
return addcslashes($value, "\\{$quote}");
95
}
96
97
+ /**
98
+ * Make string JS-friendly
99
+ *
100
+ * @param string $value Value
101
+ *
102
+ * @return string
103
+ */
104
+ public function toJsString($value)
105
+ {
106
return "'{$this->jsEscape($value)}'";
107
}
108
+
109
+ /**
110
+ * Set flag to require a template
111
+ *
112
+ * @param mixed $val Value
113
+ *
114
+ * @return void
115
+ */
116
+ public function setAlwaysRenderTemplate($val)
117
+ {
118
$this->_alwaysRenderTemplate = (bool)$val;
119
}
120
121
+ /**
122
+ * Retrieve whether current page is product page
123
+ *
124
+ * @return bool
125
+ */
126
+ public function isProductPage()
127
+ {
128
+ return (
129
+ Mage::app()->getRequest()->getModuleName() == 'catalog'
130
+ && Mage::app()->getRequest()->getControllerName() == 'product'
131
+ && Mage::app()->getRequest()->getActionName() == 'view'
132
+ );
133
}
134
135
+ /**
136
+ * Retrieve whether current page is cart page
137
+ *
138
+ * @return bool
139
+ */
140
+ public function isCartPage()
141
+ {
142
+ return (
143
+ Mage::app()->getRequest()->getModuleName() == 'checkout'
144
+ && Mage::app()->getRequest()->getControllerName() == 'cart'
145
+ && Mage::app()->getRequest()->getActionName() == 'index'
146
+ );
147
}
148
+
149
+ /**
150
+ * Retrieve whether current page is order confirmation
151
+ *
152
+ * @return bool
153
+ */
154
+ public function isOrderConfirmationPage()
155
+ {
156
+ $controller = Mage::app()->getRequest()->getControllerName();
157
+
158
+ return (
159
+ Mage::app()->getRequest()->getModuleName() == 'checkout'
160
+ && ($controller == 'multishipping' || $controller == 'onepage')
161
+ && Mage::app()->getRequest()->getActionName() == 'success'
162
+ );
163
+ }
164
+
165
+ /**
166
+ * Logger
167
+ *
168
+ * @return Listrak_Remarketing_Model_Log
169
+ */
170
+ protected function getLogger()
171
+ {
172
+ return Mage::getModel('listrak/log');
173
}
174
}
app/code/community/Listrak/Remarketing/Block/Conversion/Abstract.php CHANGED
@@ -12,45 +12,98 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Conversion_Abstract extends Listrak_Remarketing_Block_Require_Onescript
16
{
17
- private $_order, $_customer, $_billingAddress;
18
19
- public function _toHtml() {
20
return parent::_toHtml();
21
}
22
23
- private $_canRender = null;
24
- public function canRender() {
25
- if ($this->_canRender == null)
26
- $this->_canRender = parent::canRender() && $this->isOrderConfirmationPage();
27
28
return $this->_canRender;
29
}
30
31
- public function getOrderId() {
32
return Mage::getSingleton('checkout/session')->getLastOrderId();
33
}
34
35
- public function getOrder() {
36
- if(!$this->_order && $this->_order !== false) {
37
- $order = Mage::getModel('sales/order')->load($this->getOrderId());
38
- $this->_order = $order ? $order : false;
39
}
40
41
return $this->_order;
42
}
43
-
44
- public function getOrderConfirmationNumber() {
45
return $this->getOrder()->getIncrementId();
46
}
47
48
- public function getOrderItems() {
49
// fix the skus before returning the data
50
$result = array();
51
52
$productHelper = Mage::helper('remarketing/product');
53
- foreach($this->getOrder()->getAllVisibleItems() as $item) {
54
$info = $productHelper->getProductInformationFromOrderItem($item);
55
$item->setSku($info->getSku());
56
@@ -60,47 +113,73 @@ class Listrak_Remarketing_Block_Conversion_Abstract extends Listrak_Remarketing_
60
return $result;
61
}
62
63
- public function getBillingAddress() {
64
- if (!$this->_billingAddress && $this->_billingAddress !== false) {
65
- $addr = $this->getOrder()->getBillingAddress();
66
- $this->_billingAddress = $addr ? $addr : false;
67
}
68
69
return $this->_billingAddress;
70
}
71
72
- public function getCustomer() {
73
- if (!$this->_customer && $this->_customer !== false) {
74
- $customer = Mage::getModel('customer/customer')->load($this->getOrder()->getCustomerId());
75
- $this->_customer = $customer ? $customer : false;
76
}
77
78
return $this->_customer;
79
}
80
81
- public function getEmailAddress() {
82
if ($this->getCustomer()->getId()) {
83
return $this->getCustomer()->getEmail();
84
- }
85
- else {
86
return $this->getOrder()->getCustomerEmail();
87
}
88
}
89
90
- public function getFirstName() {
91
if ($this->getCustomer()->getId()) {
92
return $this->getCustomer()->getFirstname();
93
- }
94
- else {
95
return $this->getBillingAddress()->getFirstname();
96
}
97
}
98
99
- public function getLastName() {
100
if ($this->getCustomer()->getId()) {
101
return $this->getCustomer()->getLastname();
102
- }
103
- else {
104
return $this->getBillingAddress()->getLastname();
105
}
106
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Conversion_Abstract
17
+ */
18
+ class Listrak_Remarketing_Block_Conversion_Abstract
19
+ extends Listrak_Remarketing_Block_Require_Onescript
20
{
21
+ private $_canRender = null;
22
+
23
+ /* @var Mage_Sales_Model_Order $_order */
24
+ private $_order = null;
25
26
+ /* @var Mage_Customer_Model_Customer $_customer */
27
+ private $_customer = null;
28
+
29
+ /* @var Mage_Sales_Model_Order_Address $_billingAddress */
30
+ private $_billingAddress = null;
31
+
32
+ /**
33
+ * Render block
34
+ *
35
+ * @return string
36
+ */
37
+ public function _toHtml()
38
+ {
39
return parent::_toHtml();
40
}
41
42
+ /**
43
+ * Can render
44
+ *
45
+ * @return bool
46
+ */
47
+ public function canRender()
48
+ {
49
+ if ($this->_canRender == null) {
50
+ $this->_canRender = parent::canRender()
51
+ && $this->isOrderConfirmationPage();
52
+ }
53
54
return $this->_canRender;
55
}
56
57
+ /**
58
+ * Get last order ID
59
+ *
60
+ * @return mixed
61
+ */
62
+ public function getOrderId()
63
+ {
64
return Mage::getSingleton('checkout/session')->getLastOrderId();
65
}
66
67
+ /**
68
+ * Retrieve order
69
+ *
70
+ * @return Mage_Sales_Model_Order
71
+ */
72
+ public function getOrder()
73
+ {
74
+ if (!$this->_order) {
75
+ $this->_order = Mage::getModel('sales/order')
76
+ ->load($this->getOrderId());
77
}
78
79
return $this->_order;
80
}
81
+
82
+ /**
83
+ * Order confirmation number
84
+ *
85
+ * @return string
86
+ */
87
+ public function getOrderConfirmationNumber()
88
+ {
89
return $this->getOrder()->getIncrementId();
90
}
91
92
+ /**
93
+ * Get ordered items
94
+ *
95
+ * @return Mage_Sales_Model_Order_Item[]
96
+ */
97
+ public function getOrderItems()
98
+ {
99
// fix the skus before returning the data
100
$result = array();
101
102
+ /* @var Listrak_Remarketing_Helper_Product $productHelper */
103
$productHelper = Mage::helper('remarketing/product');
104
+
105
+ /* @var Mage_Sales_Model_Order_Item $item */
106
+ foreach ($this->getOrder()->getAllVisibleItems() as $item) {
107
$info = $productHelper->getProductInformationFromOrderItem($item);
108
$item->setSku($info->getSku());
109
113
return $result;
114
}
115
116
+ /**
117
+ * Get billing address
118
+ *
119
+ * @return Mage_Sales_Model_Order_Address
120
+ */
121
+ public function getBillingAddress()
122
+ {
123
+ if (!$this->_billingAddress) {
124
+ $this->_billingAddress = $this->getOrder()->getBillingAddress();
125
}
126
127
return $this->_billingAddress;
128
}
129
130
+ /**
131
+ * Get customer
132
+ *
133
+ * @return Mage_Customer_Model_Customer
134
+ */
135
+ public function getCustomer()
136
+ {
137
+ if (!$this->_customer) {
138
+ $this->_customer = Mage::getModel('customer/customer')
139
+ ->load($this->getOrder()->getCustomerId());
140
}
141
142
return $this->_customer;
143
}
144
145
+ /**
146
+ * Get purchaser email
147
+ *
148
+ * @return string
149
+ */
150
+ public function getEmailAddress()
151
+ {
152
if ($this->getCustomer()->getId()) {
153
return $this->getCustomer()->getEmail();
154
+ } else {
155
return $this->getOrder()->getCustomerEmail();
156
}
157
}
158
159
+ /**
160
+ * Get purchaser first name
161
+ *
162
+ * @return string
163
+ */
164
+ public function getFirstName()
165
+ {
166
if ($this->getCustomer()->getId()) {
167
return $this->getCustomer()->getFirstname();
168
+ } else {
169
return $this->getBillingAddress()->getFirstname();
170
}
171
}
172
173
+ /**
174
+ * Get purchaser last name
175
+ *
176
+ * @return string
177
+ */
178
+ public function getLastName()
179
+ {
180
if ($this->getCustomer()->getId()) {
181
return $this->getCustomer()->getLastname();
182
+ } else {
183
return $this->getBillingAddress()->getLastname();
184
}
185
}
app/code/community/Listrak/Remarketing/Block/Conversion/Cart.php CHANGED
@@ -12,32 +12,63 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Conversion_Cart extends Listrak_Remarketing_Block_Conversion_Abstract
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
$this->addLine("_ltk.SCA.Stage = 7;");
23
- $this->addLine("_ltk.SCA.OrderNumber = {$this->toJsString($this->getOrderConfirmationNumber())};");
24
- $this->addLine("_ltk.SCA.SetCustomer("
25
. $this->toJsString($this->getEmailAddress()) . ", "
26
. $this->toJsString($this->getFirstName()) . ", "
27
- . $this->toJsString($this->getLastName()) . ");");
28
$this->addLine("_ltk.SCA.Submit();");
29
30
return parent::_toHtml();
31
} catch(Exception $e) {
32
- Mage::getModel('listrak/log')->addException($e);
33
return '';
34
}
35
}
36
37
- private $_canRender = null;
38
- public function canRender() {
39
- if ($this->_canRender == null)
40
- $this->_canRender = parent::canRender() && Mage::helper('remarketing')->scaEnabled();
41
42
return $this->_canRender;
43
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Conversion_Cart
17
+ */
18
+ class Listrak_Remarketing_Block_Conversion_Cart
19
+ extends Listrak_Remarketing_Block_Conversion_Abstract
20
{
21
+ private $_canRender = null;
22
+
23
+ /**
24
+ * Render block
25
+ *
26
+ * @return string
27
+ */
28
+ public function _toHtml()
29
+ {
30
try {
31
+ if (!$this->canRender()) {
32
return '';
33
+ }
34
35
$this->addLine("_ltk.SCA.Stage = 7;");
36
+ $this->addLine(
37
+ "_ltk.SCA.OrderNumber = "
38
+ . $this->toJsString($this->getOrderConfirmationNumber())
39
+ . ";"
40
+ );
41
+
42
+ $this->addLine(
43
+ "_ltk.SCA.SetCustomer("
44
. $this->toJsString($this->getEmailAddress()) . ", "
45
. $this->toJsString($this->getFirstName()) . ", "
46
+ . $this->toJsString($this->getLastName()) . ");"
47
+ );
48
+
49
$this->addLine("_ltk.SCA.Submit();");
50
51
return parent::_toHtml();
52
} catch(Exception $e) {
53
+ $this->getLogger()->addException($e);
54
return '';
55
}
56
}
57
58
+ /**
59
+ * Can render
60
+ *
61
+ * @return bool
62
+ */
63
+ public function canRender()
64
+ {
65
+ if ($this->_canRender == null) {
66
+ /* @var Listrak_Remarketing_Helper_Data $helper */
67
+ $helper = Mage::helper('remarketing');
68
+
69
+ $this->_canRender = parent::canRender()
70
+ && $helper->scaEnabled();
71
+ }
72
73
return $this->_canRender;
74
}
app/code/community/Listrak/Remarketing/Block/Conversion/Fingerprint.php CHANGED
@@ -12,16 +12,32 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Conversion_Fingerprint extends Listrak_Remarketing_Block_Require_Sca
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
- return '<img src="' . Mage::helper('remarketing')->getFingerprintImageUrl() . '" width="1" height="1" style="position: absolute" />';
23
} catch(Exception $e) {
24
- Mage::getModel('listrak/log')->addException($e);
25
return '';
26
}
27
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Conversion_Fingerprint
17
+ */
18
+ class Listrak_Remarketing_Block_Conversion_Fingerprint
19
+ extends Listrak_Remarketing_Block_Require_Sca
20
{
21
+ /**
22
+ * Render block
23
+ *
24
+ * @return string
25
+ */
26
+ public function _toHtml()
27
+ {
28
try {
29
+ if (!$this->canRender()) {
30
return '';
31
+ }
32
+
33
+ /* @var Listrak_Remarketing_Helper_Data $helper */
34
+ $helper = Mage::helper('remarketing');
35
36
+ return '<img src="'
37
+ . $helper->getFingerprintImageUrl()
38
+ . '" width="1" height="1" style="position: absolute" />';
39
} catch(Exception $e) {
40
+ $this->getLogger()->addException($e);
41
return '';
42
}
43
}
app/code/community/Listrak/Remarketing/Block/Conversion/Order.php CHANGED
@@ -12,37 +12,67 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Conversion_Order extends Listrak_Remarketing_Block_Conversion_Abstract
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
- $this->addLine("_ltk.Order.SetCustomer("
23
. $this->toJsString($this->getEmailAddress()) . ", "
24
. $this->toJsString($this->getFirstName()) . ", "
25
- . $this->toJsString($this->getLastName()) . ");");
26
- $this->addLine("_ltk.Order.OrderNumber = {$this->toJsString($this->getOrderConfirmationNumber())};");
27
28
$order = $this->getOrder();
29
- $this->addLine("_ltk.Order.ItemTotal = {$this->toJsString($order->getSubtotal())};");
30
- //$this->addLine("_ltk.Order.DiscountTotal = {$this->toJsString($order->getDiscountAmount())};");
31
- $this->addLine("_ltk.Order.HandlingTotal = {$this->toJsString($order->getShippingAmount())};");
32
- $this->addLine("_ltk.Order.TaxTotal = {$this->toJsString($order->getTaxAmount())};");
33
- $this->addLine("_ltk.Order.OrderTotal = {$this->toJsString($order->getGrandTotal())};");
34
-
35
- foreach($this->getOrderItems() as $item)
36
- $this->addLine("_ltk.Order.AddItem("
37
. $this->toJsString($item->getSku()) . ", "
38
. $this->toJsString((int)$item->getQtyOrdered()) . ", "
39
- . $this->toJsString($item->getPrice()) . ");");
40
41
$this->addLine("_ltk.Order.Submit();");
42
43
return parent::_toHtml();
44
} catch(Exception $e) {
45
- Mage::getModel('listrak/log')->addException($e);
46
return '';
47
}
48
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Conversion_Order
17
+ */
18
+ class Listrak_Remarketing_Block_Conversion_Order
19
+ extends Listrak_Remarketing_Block_Conversion_Abstract
20
{
21
+ /**
22
+ * Render block
23
+ *
24
+ * @return string
25
+ */
26
+ public function _toHtml()
27
+ {
28
try {
29
+ if (!$this->canRender()) {
30
return '';
31
+ }
32
33
+ $this->addLine(
34
+ "_ltk.Order.SetCustomer("
35
. $this->toJsString($this->getEmailAddress()) . ", "
36
. $this->toJsString($this->getFirstName()) . ", "
37
+ . $this->toJsString($this->getLastName()) . ");"
38
+ );
39
+
40
+ $this->addLine(
41
+ "_ltk.Order.OrderNumber = "
42
+ .$this->toJsString($this->getOrderConfirmationNumber())
43
+ . ";"
44
+ );
45
46
$order = $this->getOrder();
47
+
48
+ $subtotal = $order->getSubtotal();
49
+ $this->addLine("_ltk.Order.ItemTotal = {$this->toJsString($subtotal)};");
50
+
51
+ $shipping = $order->getShippingAmount();
52
+ $this->addLine(
53
+ "_ltk.Order.HandlingTotal = {$this->toJsString($shipping)};"
54
+ );
55
+
56
+ $tax = $order->getTaxAmount();
57
+ $this->addLine("_ltk.Order.TaxTotal = {$this->toJsString($tax)};");
58
+
59
+ $total = $order->getGrandTotal();
60
+ $this->addLine("_ltk.Order.OrderTotal = {$this->toJsString($total)};");
61
+
62
+ foreach ($this->getOrderItems() as $item) {
63
+ $this->addLine(
64
+ "_ltk.Order.AddItem("
65
. $this->toJsString($item->getSku()) . ", "
66
. $this->toJsString((int)$item->getQtyOrdered()) . ", "
67
+ . $this->toJsString($item->getPrice()) . ");"
68
+ );
69
+ }
70
71
$this->addLine("_ltk.Order.Submit();");
72
73
return parent::_toHtml();
74
} catch(Exception $e) {
75
+ $this->getLogger()->addException($e);
76
return '';
77
}
78
}
app/code/community/Listrak/Remarketing/Block/Legacy/Ecjs.php CHANGED
@@ -12,14 +12,28 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
16
{
17
-
18
public function getPageName()
19
{
20
return $this->_getData('page_name');
21
}
22
23
public function getMatchingPages()
24
{
25
$fullMatches = array();
@@ -44,7 +58,9 @@ class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
44
if (strtolower($action) == 'index') {
45
$matches[] = '/' . $route . '/' . $controller;
46
}
47
- if (strtolower($action) == 'index' && strtolower($controller) == 'index') {
48
$matches[] = '/' . $route;
49
}
50
@@ -61,16 +77,23 @@ class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
61
return $fullMatches;
62
}
63
64
protected function _toHtml()
65
{
66
- if (!Mage::helper('remarketing')->coreEnabled()) {
67
return "";
68
}
69
70
- $collections = Mage::getModel('listrak/emailcapture')->getCollection()->addFieldToFilter(
71
- 'page',
72
- $this->getMatchingPages()
73
- );
74
75
if ($collections && $collections->count()) {
76
$html = array();
@@ -78,7 +101,8 @@ class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
78
79
$html[] = '<script type="text/javascript">';
80
$html[] = 'arrEcjs = [];';
81
- $html[] = 'function _ecjs(ecid,email) { new Ajax.Request("' . $this->getAjaxUrl()
82
. '", {parameters:{cid: ecid, email: email}}); }';
83
$html[] = 'function ecjsInit() {' .
84
'for(var ecjsi = 0; ecjsi < arrEcjs.length; ecjsi++) {' .
@@ -91,8 +115,10 @@ class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
91
92
foreach ($collections as $observer) {
93
if (!in_array($observer->getFieldId(), $observed)) {
94
- $html[] = 'arrEcjs.push({id:"' . $observer->getFieldId()
95
- . '", fn: function() { _ecjs(' . $observer->getEmailcaptureId()
96
. ', $(this).value);}});';
97
$observed[] = $observer->getFieldId();
98
}
@@ -116,6 +142,11 @@ class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
116
return "";
117
}
118
119
public function getAjaxUrl()
120
{
121
return Mage::getUrl(
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Legacy_Ecjs
17
+ *
18
+ * @deprecated Emails now captured through OneScript
19
+ */
20
class Listrak_Remarketing_Block_Legacy_Ecjs extends Mage_Core_Block_Text
21
{
22
+ /**
23
+ * Get page name
24
+ *
25
+ * @return mixed
26
+ */
27
public function getPageName()
28
{
29
return $this->_getData('page_name');
30
}
31
32
+ /**
33
+ * Get all routes matching the current page
34
+ *
35
+ * @return array
36
+ */
37
public function getMatchingPages()
38
{
39
$fullMatches = array();
58
if (strtolower($action) == 'index') {
59
$matches[] = '/' . $route . '/' . $controller;
60
}
61
+ if (strtolower($action) == 'index'
62
+ && strtolower($controller) == 'index'
63
+ ) {
64
$matches[] = '/' . $route;
65
}
66
77
return $fullMatches;
78
}
79
80
+ /**
81
+ * Render block
82
+ *
83
+ * @return string
84
+ */
85
protected function _toHtml()
86
{
87
+ /* @var Listrak_Remarketing_Helper_Data $helper */
88
+ $helper = Mage::helper('remarketing');
89
+
90
+ if (!$helper->coreEnabled()) {
91
return "";
92
}
93
94
+ $collections = Mage::getModel('listrak/emailcapture')
95
+ ->getCollection()
96
+ ->addFieldToFilter('page', $this->getMatchingPages());
97
98
if ($collections && $collections->count()) {
99
$html = array();
101
102
$html[] = '<script type="text/javascript">';
103
$html[] = 'arrEcjs = [];';
104
+ $html[] = 'function _ecjs(ecid,email) { new Ajax.Request("'
105
+ . $this->getAjaxUrl()
106
. '", {parameters:{cid: ecid, email: email}}); }';
107
$html[] = 'function ecjsInit() {' .
108
'for(var ecjsi = 0; ecjsi < arrEcjs.length; ecjsi++) {' .
115
116
foreach ($collections as $observer) {
117
if (!in_array($observer->getFieldId(), $observed)) {
118
+ $html[] = 'arrEcjs.push({id:"'
119
+ . $observer->getFieldId()
120
+ . '", fn: function() { _ecjs('
121
+ . $observer->getEmailcaptureId()
122
. ', $(this).value);}});';
123
$observed[] = $observer->getFieldId();
124
}
142
return "";
143
}
144
145
+ /**
146
+ * Returns AJAX postback URL
147
+ *
148
+ * @return string
149
+ */
150
public function getAjaxUrl()
151
{
152
return Mage::getUrl(
app/code/community/Listrak/Remarketing/Block/Legacy/Modal.php CHANGED
@@ -12,17 +12,34 @@
12
* @link http://www.listrak.com
13
*/
14
15
class Listrak_Remarketing_Block_Legacy_Modal extends Mage_Core_Block_Text
16
{
17
-
18
public function getPageName()
19
{
20
return $this->_getData('page_name');
21
}
22
23
protected function _toHtml()
24
{
25
- if (!Mage::helper("remarketing")->coreEnabled()) {
26
return "";
27
}
28
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Legacy_Modal
17
+ *
18
+ * @deprecated OneScript now loaded separately, displaying the modal automatically
19
+ */
20
class Listrak_Remarketing_Block_Legacy_Modal extends Mage_Core_Block_Text
21
{
22
+ /**
23
+ * Get page name
24
+ *
25
+ * @return mixed
26
+ */
27
public function getPageName()
28
{
29
return $this->_getData('page_name');
30
}
31
32
+ /**
33
+ * Render block
34
+ *
35
+ * @return string
36
+ */
37
protected function _toHtml()
38
{
39
+ /* @var Listrak_Remarketing_Helper_Data $helper */
40
+ $helper = Mage::helper('remarketing');
41
+
42
+ if (!$helper->coreEnabled()) {
43
return "";
44
}
45
app/code/community/Listrak/Remarketing/Block/Require/Activity.php CHANGED
@@ -12,24 +12,48 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Require_Activity extends Listrak_Remarketing_Block_Require_Onescript
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
return parent::_toHtml();
23
} catch(Exception $e) {
24
- Mage::getModel('listrak/log')->addException($e);
25
return '';
26
}
27
}
28
29
- private $_canRender = null;
30
- public function canRender() {
31
- if ($this->_canRender == null)
32
- $this->_canRender = parent::canRender() && Mage::helper('remarketing')->activityEnabled();
33
34
return $this->_canRender;
35
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Require_Activity
17
+ */
18
+ class Listrak_Remarketing_Block_Require_Activity
19
+ extends Listrak_Remarketing_Block_Require_Onescript
20
{
21
+ private $_canRender = null;
22
+
23
+ /**
24
+ * Render block
25
+ *
26
+ * @return string
27
+ */
28
+ public function _toHtml()
29
+ {
30
try {
31
+ if (!$this->canRender()) {
32
return '';
33
+ }
34
35
return parent::_toHtml();
36
} catch(Exception $e) {
37
+ $this->getLogger()->addException($e);
38
+
39
return '';
40
}
41
}
42
43
+ /**
44
+ * Can render
45
+ *
46
+ * @return bool
47
+ */
48
+ public function canRender()
49
+ {
50
+ if ($this->_canRender == null) {
51
+ /* @var Listrak_Remarketing_Helper_Data $helper */
52
+ $helper = Mage::helper('remarketing');
53
+
54
+ $this->_canRender = parent::canRender()
55
+ && $helper->activityEnabled();
56
+ }
57
58
return $this->_canRender;
59
}
app/code/community/Listrak/Remarketing/Block/Require/Legacy.php CHANGED
@@ -12,24 +12,47 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Require_Legacy extends Listrak_Remarketing_Block_Base
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
return parent::_toHtml();
23
} catch(Exception $e) {
24
- Mage::getModel('listrak/log')->addException($e);
25
return '';
26
}
27
}
28
29
- private $_canRender = null;
30
- public function canRender() {
31
- if ($this->_canRender == null)
32
- $this->_canRender = Mage::helper('remarketing')->legacyTracking();
33
34
return $this->_canRender;
35
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Require_Legacy
17
+ */
18
+ class Listrak_Remarketing_Block_Require_Legacy
19
+ extends Listrak_Remarketing_Block_Base
20
{
21
+ private $_canRender = null;
22
+
23
+ /**
24
+ * Render block
25
+ *
26
+ * @return string
27
+ */
28
+ public function _toHtml()
29
+ {
30
try {
31
+ if (!$this->canRender()) {
32
return '';
33
+ }
34
35
return parent::_toHtml();
36
} catch(Exception $e) {
37
+ $this->getLogger()->addException($e);
38
+
39
return '';
40
}
41
}
42
43
+ /**
44
+ * Can render
45
+ *
46
+ * @return bool
47
+ */
48
+ public function canRender()
49
+ {
50
+ if ($this->_canRender == null) {
51
+ /* @var Listrak_Remarketing_Helper_Data $helper */
52
+ $helper = Mage::helper('remarketing');
53
+
54
+ $this->_canRender = $helper->legacyTracking();
55
+ }
56
57
return $this->_canRender;
58
}
app/code/community/Listrak/Remarketing/Block/Require/Onescript.php CHANGED
@@ -12,24 +12,47 @@
12
* @link http://www.listrak.com
13
*/
14
15
- class Listrak_Remarketing_Block_Require_Onescript extends Listrak_Remarketing_Block_Base
16
{
17
- public function _toHtml() {
18
try {
19
- if (!$this->canRender())
20
return '';
21
22
return parent::_toHtml();
23
} catch(Exception $e) {
24
- Mage::getModel('listrak/log')->addException($e);
25
return '';
26
}
27
}
28
29
- private $_canRender = null;
30
- public function canRender() {
31
- if ($this->_canRender == null)
32
- $this->_canRender = Mage::helper('remarketing')->onescriptTracking();
33
34
return $this->_canRender;
35
}
12
* @link http://www.listrak.com
13
*/
14
15
+ /**
16
+ * Class Listrak_Remarketing_Block_Require_Onescript
17 <