Listrak_Remarketing - Version 1.1.6

Version Notes

Updated extension to prevent warnings from appearing in error logs.
Additional performance updates throughout the extension.

Download this release

Release Info

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


Code changes from version 1.1.5 to 1.1.6

Files changed (91) hide show
  1. app/code/community/Listrak/Remarketing/Block/Adminhtml/Abandonedcartreport.php +25 -11
  2. app/code/community/Listrak/Remarketing/Block/Adminhtml/Abandonedcartreport/Grid.php +144 -107
  3. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture.php +14 -3
  4. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit.php +18 -7
  5. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Form.php +22 -10
  6. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tab/Form.php +54 -31
  7. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tabs.php +27 -11
  8. app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Grid.php +44 -27
  9. app/code/community/Listrak/Remarketing/Block/Adminhtml/Notifications.php +35 -23
  10. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes.php +59 -43
  11. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit.php +17 -7
  12. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Form.php +22 -10
  13. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Brand.php +31 -15
  14. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Categories.php +22 -13
  15. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tabs.php +45 -25
  16. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Grid.php +65 -46
  17. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands.php +21 -9
  18. app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands/Form.php +52 -36
  19. app/code/community/Listrak/Remarketing/Block/Ecjs.php +121 -102
  20. app/code/community/Listrak/Remarketing/Block/Modal.php +46 -29
  21. app/code/community/Listrak/Remarketing/Helper/Data.php +106 -75
  22. app/code/community/Listrak/Remarketing/Helper/Product.php +271 -210
  23. app/code/community/Listrak/Remarketing/Helper/Product/Attribute/Set/Map.php +21 -10
  24. app/code/community/Listrak/Remarketing/Helper/Review/Update.php +63 -40
  25. app/code/community/Listrak/Remarketing/Model/Abandonedcart.php +46 -36
  26. app/code/community/Listrak/Remarketing/Model/Abandonedcart/Api.php +71 -63
  27. app/code/community/Listrak/Remarketing/Model/Abandonedcart/Api/V2.php +16 -5
  28. app/code/community/Listrak/Remarketing/Model/Apiextension.php +14 -3
  29. app/code/community/Listrak/Remarketing/Model/Apiextension/Api.php +322 -277
  30. app/code/community/Listrak/Remarketing/Model/Apiextension/Api/V2.php +16 -5
  31. app/code/community/Listrak/Remarketing/Model/Click.php +42 -29
  32. app/code/community/Listrak/Remarketing/Model/Click/Api.php +65 -48
  33. app/code/community/Listrak/Remarketing/Model/Click/Api/V2.php +16 -5
  34. app/code/community/Listrak/Remarketing/Model/Emailcapture.php +20 -9
  35. app/code/community/Listrak/Remarketing/Model/Log.php +42 -30
  36. app/code/community/Listrak/Remarketing/Model/Log/Api.php +67 -49
  37. app/code/community/Listrak/Remarketing/Model/Log/Api/V2.php +16 -5
  38. app/code/community/Listrak/Remarketing/Model/Mysql4/Abandonedcart.php +66 -56
  39. app/code/community/Listrak/Remarketing/Model/Mysql4/Abandonedcart/Collection.php +57 -37
  40. app/code/community/Listrak/Remarketing/Model/Mysql4/Apiextension.php +70 -53
  41. app/code/community/Listrak/Remarketing/Model/Mysql4/Click.php +71 -56
  42. app/code/community/Listrak/Remarketing/Model/Mysql4/Click/Collection.php +31 -16
  43. app/code/community/Listrak/Remarketing/Model/Mysql4/Emailcapture.php +24 -12
  44. app/code/community/Listrak/Remarketing/Model/Mysql4/Emailcapture/Collection.php +20 -8
  45. app/code/community/Listrak/Remarketing/Model/Mysql4/Log.php +24 -13
  46. app/code/community/Listrak/Remarketing/Model/Mysql4/Log/Collection.php +24 -13
  47. app/code/community/Listrak/Remarketing/Model/Mysql4/Product/Attribute/Set/Map.php +25 -14
  48. app/code/community/Listrak/Remarketing/Model/Mysql4/Product/Attribute/Set/Map/Collection.php +42 -25
  49. app/code/community/Listrak/Remarketing/Model/Mysql4/Review/Update.php +25 -14
  50. app/code/community/Listrak/Remarketing/Model/Mysql4/Review/Update/Collection.php +77 -61
  51. app/code/community/Listrak/Remarketing/Model/Mysql4/Session.php +116 -93
  52. app/code/community/Listrak/Remarketing/Model/Mysql4/Session/Collection.php +35 -22
  53. app/code/community/Listrak/Remarketing/Model/Mysql4/Subscriberupdate.php +25 -13
  54. app/code/community/Listrak/Remarketing/Model/Mysql4/Subscriberupdate/Collection.php +14 -3
  55. app/code/community/Listrak/Remarketing/Model/Observer.php +101 -121
  56. app/code/community/Listrak/Remarketing/Model/Product/Attribute/Set/Map.php +81 -76
  57. app/code/community/Listrak/Remarketing/Model/Product/Attributes.php +39 -19
  58. app/code/community/Listrak/Remarketing/Model/Product/Category/Source.php +14 -5
  59. app/code/community/Listrak/Remarketing/Model/Review/Update.php +59 -43
  60. app/code/community/Listrak/Remarketing/Model/Review/Update/Api.php +282 -242
  61. app/code/community/Listrak/Remarketing/Model/Review/Update/Api/V2.php +18 -7
  62. app/code/community/Listrak/Remarketing/Model/Session.php +102 -84
  63. app/code/community/Listrak/Remarketing/Model/Subscriber.php +32 -19
  64. app/code/community/Listrak/Remarketing/Model/Subscriberupdate.php +12 -2
  65. app/code/community/Listrak/Remarketing/controllers/Adminhtml/AbandonedcartreportController.php +42 -30
  66. app/code/community/Listrak/Remarketing/controllers/Adminhtml/EmailcaptureController.php +149 -121
  67. app/code/community/Listrak/Remarketing/controllers/Adminhtml/ProductattributesController.php +157 -137
  68. app/code/community/Listrak/Remarketing/controllers/CartController.php +75 -61
  69. app/code/community/Listrak/Remarketing/controllers/ConfigController.php +38 -25
  70. app/code/community/Listrak/Remarketing/controllers/EmailController.php +48 -43
  71. app/code/community/Listrak/Remarketing/controllers/TroubleshootingController.php +18 -6
  72. app/code/community/Listrak/Remarketing/etc/adminhtml.xml +62 -62
  73. app/code/community/Listrak/Remarketing/etc/api.xml +194 -185
  74. app/code/community/Listrak/Remarketing/etc/config.xml +206 -215
  75. app/code/community/Listrak/Remarketing/etc/system.xml +143 -143
  76. app/code/community/Listrak/Remarketing/etc/wsdl.xml +991 -878
  77. app/code/community/Listrak/Remarketing/etc/wsi.xml +1385 -1125
  78. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-install-1.0.0.php +22 -7
  79. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.0.0-1.0.1.php +19 -7
  80. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.0.8-1.0.9.php +21 -8
  81. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.0-1.1.1.php +21 -8
  82. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.3-1.1.4.php +18 -7
  83. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.4-1.1.5.php +18 -19
  84. app/code/community/Listrak/Remarketing/sql/listrak_remarketing_setup/mysql4-upgrade-1.1.5-1.1.6.php +35 -0
  85. app/design/adminhtml/default/default/layout/remarketing.xml +8 -6
  86. app/design/adminhtml/default/default/template/listrak/remarketing/productattributes.phtml +25 -13
  87. app/design/adminhtml/default/default/template/listrak/remarketing/productattributes/form/categories.phtml +158 -137
  88. app/design/adminhtml/default/default/template/listrak/remarketing/productattributes/form/initbrands.phtml +52 -37
  89. app/design/frontend/base/default/layout/remarketing.xml +5 -3
  90. app/etc/modules/Listrak_Remarketing.xml +1 -1
  91. package.xml +6 -7
app/code/community/Listrak/Remarketing/Block/Adminhtml/Abandonedcartreport.php CHANGED
@@ -1,15 +1,29 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Abandonedcartreport extends Mage_Adminhtml_Block_Widget_Grid_Container
6
{
7
- public function __construct()
8
- {
9
- $this->_controller = 'adminhtml_abandonedcartreport';
10
- $this->_blockGroup = 'remarketing';
11
- $this->_headerText = Mage::helper('remarketing')->__('Abandoned Carts');
12
- parent::__construct();
13
- $this->_removeButton('add');
14
- }
15
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
+ class Listrak_Remarketing_Block_Adminhtml_Abandonedcartreport
16
+ extends Mage_Adminhtml_Block_Widget_Grid_Container
17
{
18
+ /**
19
+ * The class constructor.
20
+ */
21
+ public function __construct()
22
+ {
23
+ $this->_controller = 'adminhtml_abandonedcartreport';
24
+ $this->_blockGroup = 'remarketing';
25
+ $this->_headerText = Mage::helper('remarketing')->__('Abandoned Carts');
26
+ parent::__construct();
27
+ $this->_removeButton('add');
28
+ }
29
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Abandonedcartreport/Grid.php CHANGED
@@ -1,111 +1,148 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Abandonedcartreport_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
{
7
- public function __construct()
8
- {
9
- parent::__construct();
10
- $this->setId('abandonedCartsGrid');
11
- $this->setDefaultSort('updated_at');
12
- $this->setDefaultDir('DESC');
13
- $this->setSaveParametersInSession(true);
14
- }
15
-
16
- protected function _prepareCollection()
17
- {
18
- $reportTimeout = Mage::getStoreConfig('remarketing/abandonedcarts/abandoned_cart_report_timeout') * 60;
19
-
20
- $startDate = gmdate('Y-m-d H:i:s', time() - $reportTimeout);
21
- $collection = Mage::getModel('listrak/abandonedcart')->getCollection()
22
- ->addFieldToFilter('main_table.updated_at',array('lt'=>$startDate));
23
- $collection->_prepareForReport = true;
24
-
25
- $this->setCollection($collection);
26
- return parent::_prepareCollection();
27
- }
28
-
29
- protected function _prepareColumns()
30
- {
31
- $this->addColumn('is_customer', array(
32
- 'header' =>Mage::helper('remarketing')->__('Registered'),
33
- 'index' =>'is_customer',
34
- 'width' =>'75px',
35
- 'sortable' => false,
36
- 'filter' => false
37
- ));
38
-
39
- $this->addColumn('session_id', array(
40
- 'header' =>Mage::helper('remarketing')->__('Session Id'),
41
- 'index' =>'session_id',
42
- 'width' =>'250px',
43
- 'sortable' => false,
44
- 'filter' => false
45
- ));
46
-
47
- $this->addColumn('customer_name', array(
48
- 'header' =>Mage::helper('remarketing')->__('Customer Name'),
49
- 'index' =>'customer_name',
50
- 'sortable' => false,
51
- 'filter' => false
52
- ));
53
-
54
- $this->addColumn('email', array(
55
- 'header' =>Mage::helper('remarketing')->__('Email'),
56
- 'index' =>'email',
57
- 'sortable' => false,
58
- 'filter' => false
59
- ));
60
-
61
- $this->addColumn('items_count', array(
62
- 'header' =>Mage::helper('remarketing')->__('# Items'),
63
- 'width' =>'80px',
64
- 'align' =>'right',
65
- 'index' =>'items_qty',
66
- 'sortable' =>false,
67
- 'type' =>'number',
68
- 'filter' => false
69
- ));
70
-
71
- $this->addColumn('total', array(
72
- 'header' =>Mage::helper('remarketing')->__('Total'),
73
- 'width' =>'80px',
74
- 'type' =>'currency',
75
- 'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT),
76
- 'index' =>'grand_total',
77
- 'sortable' =>false,
78
- 'renderer' =>'adminhtml/report_grid_column_renderer_currency',
79
- 'filter' => false
80
- ));
81
-
82
- $this->addColumn('created_at', array(
83
- 'header' =>Mage::helper('remarketing')->__('Creation Date'),
84
- 'width' =>'170px',
85
- 'type' =>'datetime',
86
- 'index' =>'created_at',
87
- //'filter_index'=>'main_table.created_at',
88
- 'sortable' =>false,
89
- 'filter' => false
90
- ));
91
-
92
- $this->addColumn('updated_at', array(
93
- 'header' =>Mage::helper('remarketing')->__('Abandon Date'),
94
- 'width' =>'170px',
95
- 'type' =>'datetime',
96
- 'index' =>'updated_at',
97
- //'filter_index'=>'main_table.updated_at',
98
- 'sortable' =>false,
99
- 'filter' => false
100
- ));
101
-
102
- return parent::_prepareColumns();
103
- }
104
-
105
- public function getRowUrl($row)
106
- {
107
- return FALSE;
108
- }
109
-
110
-
111
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
+ class Listrak_Remarketing_Block_Adminhtml_Abandonedcartreport_Grid
16
+ extends Mage_Adminhtml_Block_Widget_Grid
17
{
18
+ public function __construct()
19
+ {
20
+ parent::__construct();
21
+ $this->setId('abandonedCartsGrid');
22
+ $this->setDefaultSort('updated_at');
23
+ $this->setDefaultDir('DESC');
24
+ $this->setSaveParametersInSession(true);
25
+ }
26
+
27
+ protected function _prepareCollection()
28
+ {
29
+ $reportTimeout = Mage::getStoreConfig('remarketing/abandonedcarts/abandoned_cart_report_timeout') * 60;
30
+
31
+ $startDate = gmdate('Y-m-d H:i:s', time() - $reportTimeout);
32
+ $collection = Mage::getModel('listrak/abandonedcart')->getCollection()
33
+ ->addFieldToFilter('main_table.updated_at', array('lt' => $startDate))
34
+ ->setPrepareForReport(true);
35
+
36
+ $this->setCollection($collection);
37
+ return parent::_prepareCollection();
38
+ }
39
+
40
+ protected function _prepareColumns()
41
+ {
42
+ $this->addColumn(
43
+ 'is_customer',
44
+ array(
45
+ 'header' => Mage::helper('remarketing')->__('Registered'),
46
+ 'index' => 'is_customer',
47
+ 'width' => '75px',
48
+ 'sortable' => false,
49
+ 'filter' => false
50
+ )
51
+ );
52
+
53
+ $this->addColumn(
54
+ 'session_id',
55
+ array(
56
+ 'header' => Mage::helper('remarketing')->__('Session Id'),
57
+ 'index' => 'session_id',
58
+ 'width' => '250px',
59
+ 'sortable' => false,
60
+ 'filter' => false
61
+ )
62
+ );
63
+
64
+ $this->addColumn(
65
+ 'customer_name',
66
+ array(
67
+ 'header' => Mage::helper('remarketing')->__('Customer Name'),
68
+ 'index' => 'customer_name',
69
+ 'sortable' => false,
70
+ 'filter' => false
71
+ )
72
+ );
73
+
74
+ $this->addColumn(
75
+ 'email',
76
+ array(
77
+ 'header' => Mage::helper('remarketing')->__('Email'),
78
+ 'index' => 'email',
79
+ 'sortable' => false,
80
+ 'filter' => false
81
+ )
82
+ );
83
+
84
+ $this->addColumn(
85
+ 'items_count',
86
+ array(
87
+ 'header' => Mage::helper('remarketing')->__('# Items'),
88
+ 'width' => '80px',
89
+ 'align' => 'right',
90
+ 'index' => 'items_qty',
91
+ 'sortable' => false,
92
+ 'type' => 'number',
93
+ 'filter' => false
94
+ )
95
+ );
96
+
97
+ $this->addColumn(
98
+ 'total',
99
+ array(
100
+ 'header' => Mage::helper('remarketing')->__('Total'),
101
+ 'width' => '80px',
102
+ 'type' => 'currency',
103
+ 'currency_code' => (string)Mage::getStoreConfig(
104
+ Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT
105
+ ),
106
+ 'index' => 'grand_total',
107
+ 'sortable' => false,
108
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency',
109
+ 'filter' => false
110
+ )
111
+ );
112
+
113
+ $this->addColumn(
114
+ 'created_at',
115
+ array(
116
+ 'header' => Mage::helper('remarketing')->__('Creation Date'),
117
+ 'width' => '170px',
118
+ 'type' => 'datetime',
119
+ 'index' => 'created_at',
120
+ //'filter_index'=>'main_table.created_at',
121
+ 'sortable' => false,
122
+ 'filter' => false
123
+ )
124
+ );
125
+
126
+ $this->addColumn(
127
+ 'updated_at',
128
+ array(
129
+ 'header' => Mage::helper('remarketing')->__('Abandon Date'),
130
+ 'width' => '170px',
131
+ 'type' => 'datetime',
132
+ 'index' => 'updated_at',
133
+ //'filter_index'=>'main_table.updated_at',
134
+ 'sortable' => false,
135
+ 'filter' => false
136
+ )
137
+ );
138
+
139
+ return parent::_prepareColumns();
140
+ }
141
+
142
+ public function getRowUrl($row)
143
+ {
144
+ return false;
145
+ }
146
+
147
+
148
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture.php CHANGED
@@ -1,8 +1,19 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture extends Mage_Adminhtml_Block_Widget_Grid_Container
6
{
7
public function __construct()
8
{
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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
{
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit.php CHANGED
@@ -1,24 +1,35 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
6
{
7
public function __construct()
8
{
9
parent::__construct();
10
-
11
$this->_objectId = 'id';
12
$this->_blockGroup = 'remarketing';
13
$this->_controller = 'adminhtml_emailcapture';
14
-
15
$this->_updateButton('save', 'label', Mage::helper('remarketing')->__('Save Field'));
16
$this->_updateButton('delete', 'label', Mage::helper('remarketing')->__('Delete Field'));
17
}
18
-
19
public function getHeaderText()
20
{
21
- if( Mage::registry('emailcapture_data') && Mage::registry('emailcapture_data')->getId() ) {
22
return Mage::helper('remarketing')->__("Edit Field");
23
} else {
24
return Mage::helper('remarketing')->__('Add Field');
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
+
22
$this->_objectId = 'id';
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');
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Form.php CHANGED
@@ -1,18 +1,30 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
-
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
6
{
7
protected function _prepareForm()
8
{
9
- $form = new Varien_Data_Form(array(
10
- 'id' => 'edit_form',
11
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
12
- 'method' => 'post',
13
- )
14
);
15
-
16
$form->setUseContainer(true);
17
$this->setForm($form);
18
return parent::_prepareForm();
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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
);
27
+
28
$form->setUseContainer(true);
29
$this->setForm($form);
30
return parent::_prepareForm();
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tab/Form.php CHANGED
@@ -1,38 +1,61 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
6
{
7
- protected function _prepareForm()
8
- {
9
- $form = new Varien_Data_Form();
10
- $this->setForm($form);
11
- $fieldset = $form->addFieldset('emailcapture_form', array('legend'=>Mage::helper('remarketing')->__('Field information')));
12
13
- $fieldset->addField('page', 'text', array(
14
- 'label' => Mage::helper('remarketing')->__('Page'),
15
- 'class' => 'required-entry',
16
- 'required' => true,
17
- 'name' => 'page',
18
- 'after_element_html' => '<p class="note"><span>For example: /checkout/onepage/index. Each URL has 3 parts. If yours does not have 3 parts, fill the last with "index". You can also use wildcard character "*" to capture field on all pages in the store.</span></p>'
19
- ));
20
21
- $fieldset->addField('field_id', 'text', array(
22
- 'label' => Mage::helper('remarketing')->__('Field ID'),
23
- 'name' => 'field_id',
24
- 'required' => true,
25
- 'class' => 'required-entry',
26
- 'after_element_html' => '<p class="note"><span>Field id attribute. You can check it in HTML code preview.</span></p>'
27
- ));
28
29
- if (Mage::getSingleton('adminhtml/session')->getEmailCaptureData())
30
- {
31
- $form->setValues(Mage::getSingleton('adminhtml/session')->getEmailCaptureData());
32
- Mage::getSingleton('adminhtml/session')->setEmailCaptureData(null);
33
- } elseif (Mage::registry('emailcapture_data')) {
34
- $form->setValues(Mage::registry('emailcapture_data')->getData());
35
- }
36
- return parent::_prepareForm();
37
- }
38
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
+ $this->setForm($form);
22
+ $fieldset = $form->addFieldset(
23
+ 'emailcapture_form',
24
+ array('legend' => Mage::helper('remarketing')->__('Field information'))
25
+ );
26
27
+ $fieldset->addField(
28
+ 'page', 'text', array(
29
+ 'label' => Mage::helper('remarketing')->__('Page'),
30
+ 'class' => 'required-entry',
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
41
+ $fieldset->addField(
42
+ 'field_id', 'text', array(
43
+ 'label' => Mage::helper('remarketing')->__('Field ID'),
44
+ 'name' => 'field_id',
45
+ 'required' => true,
46
+ 'class' => 'required-entry',
47
+ 'after_element_html' => '<p class="note"><span>Field id '
48
+ . 'attribute. You can check it in HTML code '
49
+ . 'preview.</span></p>'
50
+ )
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
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Edit/Tabs.php CHANGED
@@ -1,10 +1,21 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
6
{
7
-
8
public function __construct()
9
{
10
parent::__construct();
@@ -12,15 +23,20 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Edit_Tabs extends Mage_Ad
12
$this->setDestElementId('edit_form');
13
$this->setTitle(Mage::helper('remarketing')->__('Field Information'));
14
}
15
-
16
protected function _beforeToHtml()
17
{
18
- $this->addTab('form_section', array(
19
- 'label' => Mage::helper('remarketing')->__('Field Information'),
20
- 'title' => Mage::helper('remarketing')->__('Field Information'),
21
- 'content' => $this->getLayout()->createBlock('remarketing/adminhtml_emailcapture_edit_tab_form')->toHtml(),
22
- ));
23
-
24
return parent::_beforeToHtml();
25
}
26
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
23
$this->setDestElementId('edit_form');
24
$this->setTitle(Mage::helper('remarketing')->__('Field Information'));
25
}
26
+
27
protected function _beforeToHtml()
28
{
29
+ $this->addTab(
30
+ 'form_section',
31
+ array(
32
+ 'label' => Mage::helper('remarketing')->__('Field Information'),
33
+ 'title' => Mage::helper('remarketing')->__('Field Information'),
34
+ 'content' => $this->getLayout()->createBlock(
35
+ 'remarketing/adminhtml_emailcapture_edit_tab_form'
36
+ )->toHtml(),
37
+ )
38
+ );
39
+
40
return parent::_beforeToHtml();
41
}
42
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Emailcapture/Grid.php CHANGED
@@ -1,8 +1,19 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
{
7
public function __construct()
8
{
@@ -12,42 +23,48 @@ class Listrak_Remarketing_Block_Adminhtml_EmailCapture_Grid extends Mage_Adminht
12
$this->setDefaultDir('ASC');
13
$this->setSaveParametersInSession(true);
14
}
15
-
16
protected function _prepareCollection()
17
{
18
$collection = Mage::getModel('listrak/emailcapture')->getCollection();
19
$this->setCollection($collection);
20
return parent::_prepareCollection();
21
}
22
-
23
protected function _prepareColumns()
24
{
25
- $this->addColumn('emailcapture_id', array(
26
- 'header' => Mage::helper('remarketing')->__('ID'),
27
- 'align' =>'right',
28
- 'width' => '50px',
29
- 'index' => 'emailcapture_id',
30
- ));
31
-
32
- $this->addColumn('page', array(
33
- 'header' => Mage::helper('remarketing')->__('Page'),
34
- 'align' =>'left',
35
- 'index' => 'page',
36
- ));
37
-
38
- $this->addColumn('field_id', array(
39
- 'header' => Mage::helper('remarketing')->__('Field ID'),
40
- 'align' => 'left',
41
- 'index' => 'field_id',
42
- ));
43
-
44
return parent::_prepareColumns();
45
}
46
-
47
public function getRowUrl($row)
48
{
49
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
50
}
51
-
52
-
53
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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
{
23
$this->setDefaultDir('ASC');
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()));
67
}
68
+
69
+
70
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Notifications.php CHANGED
@@ -1,28 +1,40 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
class Listrak_Remarketing_Block_Adminhtml_Notifications extends Mage_Core_Block_Text
6
{
7
- protected function _toHtml()
8
- {
9
- $html = "";
10
-
11
- if(!Mage::helper('remarketing')->checkSetupStatus()) {
12
- $html .= "<div class='notification-global'>The Listrak module requires a Listrak account. Please " .
13
- "<a href='http://www.listrak.com/partners/magento-extension.aspx'>fill out our form</a> to get an account. ".
14
- "If you already have a Listrak account, please contact your account manager " .
15
- "or <a href='mailto:support@listrak.com'>support@listrak.com</a>.</div>";
16
- }
17
-
18
- if (strpos(Mage::helper('core/url')->getCurrentUrl(), "/adminhtml_productattributes/") === false
19
- && Mage::helper('remarketing')->displayAttributeSetNotification()
20
- ) {
21
- $html .= "<div class='notification-global'>Brand attribute has not been defined for one or more attribute sets. Please " .
22
- "<a href='" . Mage::helper('adminhtml')->getUrl('remarketing/adminhtml_productattributes/index') . "'>click here</a>, " .
23
- "or go to Listrak > Product Attributes to review your current settings.</div>";
24
- }
25
-
26
- return $html;
27
- }
28
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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;
39
+ }
40
}
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes.php CHANGED
@@ -1,48 +1,64 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_ProductAttributes extends Mage_Adminhtml_Block_Widget_Container
6
{
7
- public function __construct()
8
- {
9
- parent::__construct();
10
- $this->_controller = 'adminhtml_productattributes';
11
- $this->_removeButton('add');
12
-
13
- $this->setTemplate('listrak/remarketing/productattributes.phtml');
14
- }
15
-
16
- public function _prepareLayout()
17
- {
18
- $this->setChild('grid', $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_grid'));
19
- $this->setChild('init_brands', $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_init_brands'));
20
- return parent::_prepareLayout();
21
- }
22
-
23
- public function getInitBrandsHtml()
24
- {
25
- return $this->getChildHtml('init_brands');
26
- }
27
-
28
- public function getGridHtml()
29
- {
30
- return $this->getChildHtml('grid');
31
- }
32
-
33
- public function setsWithoutBrandAttribute()
34
- {
35
- $sets = array();
36
-
37
- $allSets = Mage::registry('productattribute_sets');
38
- foreach($allSets as $set)
39
- {
40
- if ($set->getBrandAttributeCode() == null)
41
- array_push($sets, $set);
42
- }
43
-
44
- return $sets;
45
- }
46
}
47
48
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
+ $this->_controller = 'adminhtml_productattributes';
22
+ $this->_removeButton('add');
23
+
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);
58
+ }
59
+ }
60
+
61
+ return $sets;
62
+ }
63
}
64
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit.php CHANGED
@@ -1,24 +1,34 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
6
{
7
public function __construct()
8
{
9
parent::__construct();
10
-
11
$this->_objectId = 'id';
12
$this->_blockGroup = 'remarketing';
13
$this->_controller = 'adminhtml_productattributes';
14
-
15
$this->_removeButton('delete');
16
}
17
-
18
public function getHeaderText()
19
{
20
return Mage::registry('productattribute_data')->getAttributeSetName();
21
}
22
}
23
24
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
+
22
$this->_objectId = 'id';
23
$this->_blockGroup = 'remarketing';
24
$this->_controller = 'adminhtml_productattributes';
25
+
26
$this->_removeButton('delete');
27
}
28
+
29
public function getHeaderText()
30
{
31
return Mage::registry('productattribute_data')->getAttributeSetName();
32
}
33
}
34
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Form.php CHANGED
@@ -1,21 +1,33 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
6
{
7
protected function _prepareForm()
8
{
9
- $form = new Varien_Data_Form(array(
10
- 'id' => 'edit_form',
11
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
12
- 'method' => 'post',
13
- ));
14
-
15
$form->setUseContainer(true);
16
$this->setForm($form);
17
return parent::_prepareForm();
18
}
19
}
20
21
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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
+ );
27
+
28
$form->setUseContainer(true);
29
$this->setForm($form);
30
return parent::_prepareForm();
31
}
32
}
33
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Brand.php CHANGED
@@ -1,31 +1,47 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Brand extends Mage_Adminhtml_Block_Widget_Form
6
{
7
protected function _prepareForm()
8
{
9
$form = new Varien_Data_Form();
10
$this->setForm($form);
11
- $fieldset = $form->addFieldset('productattribute_form', array('legend'=>Mage::helper('remarketing')->__('Field information')));
12
13
$attributeCodes = array();
14
$attributeCodes[''] = '- No Brand Attribute -';
15
- foreach($this->getAttributeOptions() as $key => $value)
16
- {
17
$attributeCodes[$key] = $value;
18
}
19
-
20
- $fieldset->addField('brand_attribute', 'select', array(
21
- 'label' => Mage::helper('remarketing')->__('Brand Attribute'),
22
- 'name' => 'brand_attribute',
23
- 'values' => $attributeCodes,
24
- 'value' => Mage::registry('productattribute_data')->getBrandAttributeCode()
25
- ));
26
-
27
return parent::_prepareForm();
28
}
29
}
30
31
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
$this->setForm($form);
22
+ $fieldset = $form->addFieldset(
23
+ 'productattribute_form',
24
+ array('legend' => Mage::helper('remarketing')->__('Field information'))
25
+ );
26
27
$attributeCodes = array();
28
$attributeCodes[''] = '- No Brand Attribute -';
29
+ foreach ($this->getAttributeOptions() as $key => $value) {
30
$attributeCodes[$key] = $value;
31
}
32
+
33
+ $fieldset->addField(
34
+ 'brand_attribute',
35
+ 'select',
36
+ array(
37
+ 'label' => Mage::helper('remarketing')->__('Brand Attribute'),
38
+ 'name' => 'brand_attribute',
39
+ 'values' => $attributeCodes,
40
+ 'value' => Mage::registry('productattribute_data')->getBrandAttributeCode()
41
+ )
42
+ );
43
+
44
return parent::_prepareForm();
45
}
46
}
47
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tab/Form/Categories.php CHANGED
@@ -1,46 +1,55 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tab_Form_Categories extends Mage_Adminhtml_Block_Widget
6
{
7
public function __construct()
8
{
9
parent::__construct();
10
$this->setTemplate('listrak/remarketing/productattributes/form/categories.phtml');
11
-
12
$this->setModel(Mage::registry('productattribute_data'));
13
}
14
-
15
public function getCategoriesSource()
16
{
17
- if ($this->getUseConfigCategoriesSource())
18
- {
19
return $this->getConfigCategoriesSource();
20
}
21
-
22
return $this->getModel()->getCategoriesSource();
23
}
24
-
25
public function getConfigCategoriesSource()
26
{
27
return Mage::helper('remarketing')->categoriesSource();
28
}
29
-
30
public function getUseConfigCategoriesSource()
31
{
32
return $this->getModel()->getUseConfigCategoriesSource();
33
}
34
-
35
public function getCategoryAttributeCode()
36
{
37
return $this->getModel()->getCategoryAttributeCode();
38
}
39
-
40
public function getSubcategoryAttributeCode()
41
{
42
return $this->getModel()->getSubcategoryAttributeCode();
43
}
44
}
45
46
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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()) {
29
return $this->getConfigCategoriesSource();
30
}
31
+
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();
53
}
54
}
55
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Edit/Tabs.php CHANGED
@@ -1,49 +1,69 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
6
{
7
public function __construct()
8
{
9
parent::__construct();
10
-
11
$this->setId('productattributes_map_tabs');
12
$this->setDestElementId('edit_form');
13
$this->setTitle(Mage::helper('remarketing')->__('Map Attributes'));
14
}
15
-
16
public function _prepareLayout()
17
{
18
- $attributeCodes = $this->attributeSetAttributes(Mage::registry('productattribute_data')->getAttributeSetId());
19
-
20
- $this->addTab('productattributes_brand', array(
21
- 'label' => Mage::helper('remarketing')->__('Brand'),
22
- 'content' => $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_edit_tab_form_brand')->setAttributeOptions($attributeCodes)->toHtml()
23
- ));
24
-
25
- $this->addTab('productattributes_categories', array(
26
- 'label' => Mage::helper('remarketing')->__('Category and Subcategory'),
27
- 'content' => $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_edit_tab_form_categories')->setAttributeOptions($attributeCodes)->toHtml()
28
- ));
29
}
30
-
31
- private function attributeSetAttributes($setId)
32
{
33
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
34
->setAttributeSetFilter($setId)
35
->addVisibleFilter();
36
-
37
$attributes = array();
38
- foreach($collection as $value)
39
- {
40
- $attributes[$value->getAttributeCode()] = $value->getFrontendLabel() . ' (' . $value->getAttributeCode() . ')';
41
}
42
-
43
asort($attributes);
44
-
45
return $attributes;
46
}
47
}
48
49
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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();
21
+
22
$this->setId('productattributes_map_tabs');
23
$this->setDestElementId('edit_form');
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()
38
+ )
39
+ );
40
+
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')
55
->setAttributeSetFilter($setId)
56
->addVisibleFilter();
57
+
58
$attributes = array();
59
+ foreach ($collection as $value) {
60
+ $attributes[$value->getAttributeCode()] = $value->getFrontendLabel()
61
+ . ' (' . $value->getAttributeCode() . ')';
62
}
63
+
64
asort($attributes);
65
+
66
return $attributes;
67
}
68
}
69
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Grid.php CHANGED
@@ -1,8 +1,19 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
{
7
public function __construct()
8
{
@@ -12,68 +23,76 @@ class Listrak_Remarketing_Block_Adminhtml_ProductAttributes_Grid extends Mage_Ad
12
$this->setDefaultDir('ASC');
13
$this->setSaveParametersInSession(false);
14
}
15
-
16
protected function _prepareCollection()
17
{
18
$collection = Mage::registry('productattribute_sets');
19
-
20
// prepare visible fields
21
- foreach($collection as $item)
22
- {
23
$item->setFrontendCategoriesSource($item->frontendCategoriesSource());
24
$item->setFrontendBrandAttribute($item->frontendBrandAttribute());
25
$item->setFrontendCategoryAttribute($item->frontendCategoryAttribute());
26
$item->setFrontendSubcategoryAttribute($item->frontendSubcategoryAttribute());
27
}
28
-
29
$this->setCollection($collection);
30
return parent::_prepareCollection();
31
}
32
-
33
protected function _prepareColumns()
34
{
35
- $this->addColumn('attribute_set', array(
36
- 'header' => Mage::helper('remarketing')->__('Attribute Set Name'),
37
- 'align' => 'left',
38
- 'index' => 'attribute_set_name',
39
- 'filter' => false
40
- ));
41
-
42
- $this->addColumn('brand_attribute', array(
43
- 'header' => Mage::helper('remarketing')->__('Brand Attribute'),
44
- 'align' => 'left',
45
- 'index' => 'frontend_brand_attribute',
46
- 'filter' => false
47
- ));
48
-
49
- $this->addColumn('categories_source', array(
50
- 'header' => Mage::helper('remarketing')->__('Category Source'),
51
- 'align' => 'left',
52
- 'index' => 'frontend_categories_source',
53
- 'filter' => false
54
- ));
55
-
56
- $this->addColumn('category_attribute', array(
57
- 'header' => Mage::helper('remarketing')->__('Category Attribute'),
58
- 'align' => 'left',
59
- 'index' => 'frontend_category_attribute',
60
- 'filter' => false
61
- ));
62
-
63
- $this->addColumn('subcategory_attribute', array(
64
- 'header' => Mage::helper('remarketing')->__('Subcategory Attribute'),
65
- 'align' => 'left',
66
- 'index' => 'frontend_subcategory_attribute',
67
- 'filter' => false
68
- ));
69
-
70
return parent::_prepareColumns();
71
}
72
-
73
public function getRowUrl($row)
74
{
75
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
76
}
77
}
78
79
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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
{
23
$this->setDefaultDir('ASC');
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()));
96
}
97
}
98
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands.php CHANGED
@@ -1,31 +1,43 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands extends Mage_Adminhtml_Block_Template
6
{
7
public function __construct()
8
{
9
parent::__construct();
10
$this->setTemplate('listrak/remarketing/productattributes/form/initbrands.phtml');
11
}
12
-
13
public function _prepareLayout()
14
{
15
- $this->setChild('form', $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_init_brands_form'));
16
- $this->setChild('form-elements', $this->getLayout()->createBlock('remarketing/adminhtml_productattributes_init_brands_form_attributes'));
17
return parent::_prepareLayout();
18
}
19
-
20
public function getFormHtml()
21
{
22
return $this->getChildHtml('form');
23
}
24
-
25
public function getFormElementsHtml()
26
{
27
return $this->getChildHtml('form-elements');
28
}
29
}
30
31
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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');
41
}
42
}
43
app/code/community/Listrak/Remarketing/Block/Adminhtml/Productattributes/Init/Brands/Form.php CHANGED
@@ -1,67 +1,83 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Block_Adminhtml_Productattributes_Init_Brands_Form extends Mage_Adminhtml_Block_Widget_Form
6
{
7
protected function _prepareForm()
8
{
9
- $form = new Varien_Data_Form(array(
10
- 'id' => 'bulk_form',
11
- 'action' => $this->getUrl('*/*/bulkassign'),
12
- 'method' => 'post'
13
- ));
14
15
$attributeCodes = array();
16
$attributeCodes[''] = '- No Brand Attribute -';
17
- foreach($this->availableAttributes() as $key => $value)
18
- {
19
$attributeCodes[$key] = $value;
20
}
21
-
22
- $form->addField('bulkassign_attribute', 'select', array(
23
- 'label' => Mage::helper('remarketing')->__('Attribute'),
24
- 'name' => 'bulkassign_attribute',
25
- 'values' => $attributeCodes
26
- ));
27
-
28
- $form->addField('bulkassign_submit', 'button', array(
29
- 'class' => 'form-button',
30
- 'value' => Mage::helper('remarketing')->__('Set')
31
- ));
32
-
33
$form->setUseContainer(true);
34
$this->setForm($form);
35
return parent::_prepareForm();
36
}
37
-
38
public function availableAttributes()
39
{
40
$everything = Mage::registry('productattribute_sets');
41
$attributes = array();
42
-
43
- foreach($everything as $item)
44
- {
45
- if ($item->getBrandAttributeCode() == null)
46
- {
47
//get the attributes for this attribute set and add them to the attributes array
48
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
49
->setAttributeSetFilter($item->getAttributeSetId())
50
->addVisibleFilter();
51
- foreach($collection as $attribute)
52
- {
53
- if (!array_key_exists($attribute->getAttributeCode(), $attributes))
54
- {
55
- $attributes[$attribute->getAttributeCode()] = $attribute->getFrontendLabel() . ' ('. $attribute->getAttributeCode() . ')';
56
}
57
}
58
}
59
}
60
-
61
asort($attributes);
62
-
63
return $attributes;
64
}
65
}
66
67
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.1.5
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2013 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
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(
21
+ array(
22
+ 'id' => 'bulk_form',
23
+ 'action' => $this->getUrl('*/*/bulkassign'),
24
+ 'method' => 'post'
25
+ )
26
+ );
27
28
$attributeCodes = array();
29
$attributeCodes[''] = '- No Brand Attribute -';
30
+ foreach ($this->availableAttributes() as $key => $value) {
31
$attributeCodes[$key] = $value;
32
}
33
+
34
+ $form->addField(
35
+ 'bulkassign_attribute',
36
+ 'select',
37
+ array(
38
+ 'label' => Mage::helper('remarketing')->__('Attribute'),
39
+ 'name' => 'bulkassign_attribute',
40
+ 'values' => $attributeCodes
41
+ )
42
+ );
43
+
44
+ $form->addField(
45
+ 'bulkassign_submit',
46
+ 'button',
47
+ array(
48
+ 'class' => 'form-button',
49
+ 'value' => Mage::helper('remarketing')->__('Set')
50
+ )
51
+ );
52
+
53
$form->setUseContainer(true);
54
$this->setForm($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
}
75
}
76
}
77
+
78
asort($attributes);
79
+
80
return $attributes;
81
}
82
}
83
app/code/community/Listrak/Remarketing/Block/Ecjs.php CHANGED
@@ -1,107 +1,126 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
class Listrak_Remarketing_Block_Ecjs extends Mage_Core_Block_Text
6
{
7
-
8
- public function getPageName()
9
- {
10
- return $this->_getData('page_name');
11
- }
12
-
13
- public function getMatchingPages()
14
- {
15
- $fullMatches = array();
16
-
17
- try {
18
- $route = Mage::app()->getRequest()->getRouteName();
19
- $controller = Mage::app()->getRequest()->getControllerName();
20
- $action = Mage::app()->getRequest()->getActionName();
21
-
22
- $matches = array();
23
- $matches[] = '/' . $route . '/' . $controller . '/' . $action . '/';
24
- $matches[] = '/' . $route . '/' . $controller . '/' . $action;
25
- $matches[] = '/' . $route . '/' . $controller . '/*';
26
- $matches[] = '/' . $route . '/' . $controller . '/';
27
- $matches[] = '/' . $route . '/*/*';
28
- $matches[] = '/' . $route . '/*';
29
- $matches[] = '/*/*/*';
30
- $matches[] = '/*/*';
31
- $matches[] = '/*';
32
- $matches[] = '';
33
-
34
- if(strtolower($action) == 'index') {
35
- $matches[] = '/' . $route . '/' . $controller;
36
- }
37
- if(strtolower($action) == 'index' && strtolower($controller) == 'index') {
38
- $matches[] = '/' . $route;
39
- }
40
-
41
- foreach($matches as $match) {
42
- $fullMatches[] = $match;
43
- if($match && $match{0} && $match{0} == '/') {
44
- $fullMatches[] = substr($match, 1);
45
- }
46
- }
47
- }
48
- catch(Exception $ex) {
49
- Mage::getModel("listrak/log")->addException($ex);
50
- }
51
-
52
- return $fullMatches;
53
- }
54
-
55
- protected function _toHtml()
56
- {
57
- if (!Mage::helper('remarketing')->coreEnabled())
58
- return "";
59
-
60
- $collections = Mage::getModel('listrak/emailcapture')->getCollection()->addFieldToFilter('page', $this->getMatchingPages());
61
-
62
- if($collections && $collections->count()) {
63
- $html = array();
64
- $observed = array();
65
-
66
- $html[] = '<script type="text/javascript">';
67
- $html[] = 'arrEcjs = [];';
68
- $html[] = 'function _ecjs(ecid,email) { new Ajax.Request("' . $this->getAjaxUrl() . '", {parameters:{cid: ecid, email: email}}); }';
69
- $html[] = 'function ecjsInit() {' .
70
- 'for(var ecjsi = 0; ecjsi < arrEcjs.length; ecjsi++) {' .
71
- 'if($(arrEcjs[ecjsi].id)) {' .
72
- '$(arrEcjs[ecjsi].id).stopObserving("change", arrEcjs[ecjsi].fn);' .
73
- '$(arrEcjs[ecjsi].id).observe("change", arrEcjs[ecjsi].fn);' .
74
- '}' .
75
- '}' .
76
- '}';
77
-
78
- foreach($collections as $observer) {
79
- if(!in_array($observer->getFieldId(), $observed)) {
80
- $html[] = 'arrEcjs.push({id:"'. $observer->getFieldId() .'", fn: function() { _ecjs('. $observer->getEmailcaptureId() . ', $(this).value);}});';
81
- $observed[] = $observer->getFieldId();
82
- }
83
- }
84
-
85
- $html[] = 'document.observe("dom:loaded", function() { ecjsInit(); ';
86
- $html[] = 'Ajax.Responders.register({' .
87
- 'onComplete: function() {' .
88
- 'ecjsInit();' .
89
- '}' .
90
- '});});';
91
-
92
- if($observed && count($observed) === 0) {
93
- return "";
94
- }
95
-
96
- $html[] = '</script>';
97
- return implode("\n", $html);
98
- }
99
-
100
- return "";
101
- }
102
-
103
- public function getAjaxUrl()
104
- {
105
- return Mage::getUrl('remarketing/email', array('_secure' => Mage::app()->getStore()->isCurrentlySecure()));
106
- }
107
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
class Listrak_Remarketing_Block_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();
26
+
27
+ try {
28
+ $route = Mage::app()->getRequest()->getRouteName();
29
+ $controller = Mage::app()->getRequest()->getControllerName();
30
+ $action = Mage::app()->getRequest()->getActionName();
31
+
32
+ $matches = array();
33
+ $matches[] = '/' . $route . '/' . $controller . '/' . $action . '/';
34
+ $matches[] = '/' . $route . '/' . $controller . '/' . $action;
35
+ $matches[] = '/' . $route . '/' . $controller . '/*';
36
+ $matches[] = '/' . $route . '/' . $controller . '/';
37
+ $matches[] = '/' . $route . '/*/*';
38
+ $matches[] = '/' . $route . '/*';
39
+ $matches[] = '/*/*/*';
40
+ $matches[] = '/*/*';
41
+ $matches[] = '/*';
42
+ $matches[] = '';
43
+
44
+ if (strtolower($action) == 'index') {
45
+ $matches[] = '/' . $route . '/' . $controller;
46
+ }
47
+ if (strtolower($action) == 'index' && strtolower($controller) == 'index') {
48
+ $matches[] = '/' . $route;
49
+ }
50
+
51
+ foreach ($matches as $match) {
52
+ $fullMatches[] = $match;
53
+ if ($match && $match{0} && $match{0} == '/') {
54
+ $fullMatches[] = substr($match, 1);
55
+ }
56
+ }
57
+ } catch (Exception $ex) {
58
+ Mage::getModel("listrak/log")->addException($ex);
59
+ }
60
+
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();
77
+ $observed = array();
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++) {' .
85
+ 'if($(arrEcjs[ecjsi].id)) {' .
86
+ '$(arrEcjs[ecjsi].id).stopObserving("change", arrEcjs[ecjsi].fn);' .
87
+ '$(arrEcjs[ecjsi].id).observe("change", arrEcjs[ecjsi].fn);' .
88
+ '}' .
89
+ '}' .
90
+ '}';
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
+ }
99
+ }
100
+
101
+ $html[] = 'document.observe("dom:loaded", function() { ecjsInit(); ';
102
+ $html[] = 'Ajax.Responders.register({' .
103
+ 'onComplete: function() {' .
104
+ 'ecjsInit();' .
105
+ '}' .
106
+ '});});';
107
+
108
+ if ($observed && count($observed) === 0) {
109
+ return "";
110
+ }
111
+
112
+ $html[] = '</script>';
113
+ return implode("\n", $html);
114
+ }
115
+
116
+ return "";
117
+ }
118
+
119
+ public function getAjaxUrl()
120
+ {
121
+ return Mage::getUrl(
122
+ 'remarketing/email',
123
+ array('_secure' => Mage::app()->getStore()->isCurrentlySecure())
124
+ );
125
+ }
126
}
app/code/community/Listrak/Remarketing/Block/Modal.php CHANGED
@@ -1,34 +1,51 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
class Listrak_Remarketing_Block_Modal extends Mage_Core_Block_Text
6
{
7
-
8
- public function getPageName()
9
- {
10
- return $this->_getData('page_name');
11
- }
12
-
13
- protected function _toHtml()
14
- {
15
- if (!Mage::helper("remarketing")->coreEnabled())
16
- return "";
17
-
18
- $merchantID = Mage::getStoreConfig('remarketing/modal/listrakMerchantID');
19
- if(!Mage::getStoreConfig('remarketing/modal/enabled') || strlen(Mage::getStoreConfig('remarketing/modal/scriptLocation')) < 1 || strlen(trim($merchantID)) < 12) {
20
- return "";
21
- }
22
-
23
- return '<script type="text/javascript">' .
24
- 'var biJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' .
25
- 'document.write(unescape("%3Cscript src=\'" + biJsHost + "'. Mage::getStoreConfig('remarketing/modal/scriptLocation') .'?m='. $merchantID .'&v=1\' type=\'text/javascript\'%3E%3C/script%3E"));' .
26
- '</script>'.
27
- '<script type="text/javascript">'.
28
- 'var _mlm = setInterval(function() { '.
29
- 'if(!window.jQuery) { return; }'.
30
- 'clearInterval(_mlm);'.
31
- 'jQuery(document).bind("ltkmodal.show", function() { if(typeof ecjsInit === "function") { ecjsInit(); } }); }, 100);'.
32
- '</script>';
33
- }
34
}
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
class Listrak_Remarketing_Block_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
+
29
+ $merchantID = Mage::getStoreConfig('remarketing/modal/listrakMerchantID');
30
+ if (!Mage::getStoreConfig('remarketing/modal/enabled')
31
+ || strlen(Mage::getStoreConfig('remarketing/modal/scriptLocation')) < 1
32
+ || strlen(trim($merchantID)) < 12
33
+ ) {
34
+ return "";
35
+ }
36
+
37
+ return '<script type="text/javascript">' .
38
+ 'var biJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' .
39
+ 'document.write(unescape("%3Cscript src=\'" + biJsHost + "' .
40
+ Mage::getStoreConfig('remarketing/modal/scriptLocation') .
41
+ '?m=' . $merchantID . '&v=1\' type=\'text/javascript\'%3E%3C/script%3E"));' .
42
+ '</script>' .
43
+ '<script type="text/javascript">' .
44
+ 'var _mlm = setInterval(function() { ' .
45
+ 'if(!window.jQuery) { return; }' .
46
+ 'clearInterval(_mlm);jQuery' .
47
+ '(document).bind("ltkmodal.show", function() { ' .
48
+ 'if(typeof ecjsInit === "function") { ecjsInit(); } }); }, 100);' .
49
+ '</script>';
50
+ }
51
}
app/code/community/Listrak/Remarketing/Helper/Data.php CHANGED
@@ -1,79 +1,110 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.0.0
3
- // © 2011 Listrak, Inc.
4
5
- class Listrak_Remarketing_Helper_Data extends Mage_Core_Helper_Abstract
6
{
7
- private $customer_groups;
8
-
9
- public function setGroupNameAndGenderNameForCustomer($customer) {
10
- if ($customer_groups == null) {
11
- $customer_groups = array();
12
- foreach (Mage::getModel('customer/group')->getCollection() as $group)
13
- $customer_groups[$group['customer_group_id']] = $group['customer_group_code'];
14
- }
15
- if (array_key_exists($customer->getGroupId(), $customer_groups))
16
- $customer->setGroupName($customer_groups[$customer->getGroupId()]);
17
- $customer->setGenderName(Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getOptionText($customer->getGender()));
18
- }
19
-
20
- public function gen_uuid() {
21
- return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
22
- // 32 bits for "time_low"
23
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
24
-
25
- // 16 bits for "time_mid"
26
- mt_rand( 0, 0xffff ),
27
-
28
- // 16 bits for "time_hi_and_version",
29
- // four most significant bits holds version number 4
30
- mt_rand( 0, 0x0fff ) | 0x4000,
31
-
32
- // 16 bits, 8 bits for "clk_seq_hi_res",
33
- // 8 bits for "clk_seq_low",
34
- // two most significant bits holds zero and one for variant DCE1.1
35
- mt_rand( 0, 0x3fff ) | 0x8000,
36
-
37
- // 48 bits for "node"
38
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
39
- );
40
- }
41
-
42
- public function checkSetupStatus() {
43
- return Mage::getStoreConfig('remarketing/config/account_created');
44
- }
45
-
46
- public function displayAttributeSetNotification() {
47
- return (Mage::helper('remarketing/product_attribute_set_map')->newAttributeSetsCollection()->count() > 0);
48
- }
49
-
50
- public function coreEnabled() {
51
- return Mage::getStoreConfig('remarketing/modules/core');
52
- }
53
-
54
- public function reviewsEnabled() {
55
- return Mage::getStoreConfig('remarketing/modules/reviews');
56
- }
57
-
58
- public function requireCoreEnabled() {
59
- if (!$this->coreEnabled())
60
- throw new Exception('Listrak core functionality has been turned off in the System Configuration.');
61
- }
62
-
63
- public function requireReviewsEnabled() {
64
- if (!$this->reviewsEnabled())
65
- throw new Exception('Listrak reviews API has been turned off in the System Configuration.');
66
- }
67
-
68
- public function categoriesSource() {
69
- return Mage::getStoreConfig('remarketing/productcategories/categories_source');
70
- }
71
-
72
- public function getCategoryRootIdForStore($storeId)
73
- {
74
- return Mage::getModel('core/store_group')
75
- ->load(Mage::getModel('core/store')->load($storeId)->getGroupId())
76
- ->getRootCategoryId();
77
- }
78
}
79
-
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
+ class Listrak_Remarketing_Helper_Data
16
+ extends Mage_Core_Helper_Abstract
17
{
18
+ private $_customerGroups;
19
+ private $_categoryRootIdForStores = array();
20
+
21
+ public function setGroupNameAndGenderNameForCustomer($customer)
22
+ {
23
+ if ($this->_customerGroups == null) {
24
+ $this->_customerGroups = array();
25
+ foreach (Mage::getModel('customer/group')->getCollection() as $group) {
26
+ $this->_customerGroups[$group['customer_group_id']] = $group['customer_group_code'];
27
+ }
28
+ }
29
+ if (array_key_exists($customer->getGroupId(), $this->_customerGroups)) {
30
+ $customer->setGroupName($this->_customerGroups[$customer->getGroupId()]);
31
+ }
32
+ $customer->setGenderName(
33
+ Mage::getResourceSingleton('customer/customer')
34
+ ->getAttribute('gender')
35
+ ->getSource()
36
+ ->getOptionText($customer->getGender())
37
+ );
38
+ }
39
+
40
+ public function genUuid()
41
+ {
42
+ // 32 bits for "time_low"
43
+ // 16 bits for "time_mid"
44
+ // 16 bits for "time_hi_and_version", four most significant bits holds version number 4
45
+ // 16 bits, 8 bits for "clk_seq_hi_res", 8 bits for "clk_seq_low",
46
+ // two most significant bits holds zero and one for variant DCE1.1
47
+ // 48 bits for "node"
48
+ return sprintf(
49
+ '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
50
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff),
51
+ mt_rand(0, 0xffff),
52
+ mt_rand(0, 0x0fff) | 0x4000,
53
+ mt_rand(0, 0x3fff) | 0x8000,
54
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
55
+ );
56
+ }
57
+
58
+ public function checkSetupStatus()
59
+ {
60
+ return Mage::getStoreConfig('remarketing/config/account_created');
61
+ }
62
+
63
+ public function displayAttributeSetNotification()
64
+ {
65
+ return (Mage::helper('remarketing/product_attribute_set_map')->newAttributeSetsCollection()->count() > 0);
66
+ }
67
+
68
+ public function coreEnabled()
69
+ {
70
+ return Mage::getStoreConfig('remarketing/modules/core');
71
+ }
72
+
73
+ public function reviewsEnabled()
74
+ {
75
+ return Mage::getStoreConfig('remarketing/modules/reviews');
76
+ }
77
+
78
+ public function requireCoreEnabled()
79
+ {
80
+ if (!$this->coreEnabled()) {
81
+ throw new Exception('Listrak core functionality has been turned off in the System Configuration.');
82
+ }
83
+ }
84
+
85
+ public function requireReviewsEnabled()
86
+ {
87
+ if (!$this->reviewsEnabled()) {
88
+ throw new Exception('Listrak reviews API has been turned off in the System Configuration.');
89
+ }
90
+ }
91
+
92
+ public function categoriesSource()
93
+ {
94
+ return Mage::getStoreConfig('remarketing/productcategories/categories_source');
95
+ }
96
+
97
+ public function getCategoryRootIdForStore($storeId)
98
+ {
99
+ if (!array_key_exists($storeId, $this->_categoryRootIdForStores)) {
100
+ $this->_categoryRootIdForStores[$storeId] = Mage::getModel('core/store_group')
101
+ ->load(
102
+ Mage::getModel('core/store')
103
+ ->load($storeId)
104
+ ->getGroupId()
105
+ )
106
+ ->getRootCategoryId();
107
+ }
108
+ return $this->_categoryRootIdForStores[$storeId];
109
+ }
110
}
app/code/community/Listrak/Remarketing/Helper/Product.php CHANGED
@@ -1,214 +1,275 @@
1
<?php
2
- // Listrak Remarketing Magento Extension Ver. 1.1.5
3
- // 2013 Listrak, Inc.
4
5
- class Listrak_Remarketing_Helper_Product extends Mage_Core_Helper_Abstract
6
{
7
- private $parentsById = array();
8
- private $attributeSets = null;
9
- private $categoryNames = array();
10
- private $baseDir = null;
11
- private $baseMediaPath = null;
12
- private $imageModel = null;
13
-
14
- public function getProductEntity($product, $includeBrandAndCategory = true, $includeInventory = true, $includeConfigurableAttributes = true) {
15
- $result = array();
16
-
17
- $result['entity_id'] = $product->getEntityId();
18
- $result['sku'] = $product->getSku();
19
- $result['name'] = $product->getName();
20
- $result['price'] = $product->getPrice();
21
- $result['special_price'] = $product->getSpecialPrice();
22
- $result['special_from_date'] = $product->getSpecialFromDate();
23
- $result['special_to_date'] = $product->getSpecialToDate();
24
- $result['cost'] = $product->getCost();
25
- $result['description'] = $product->getDescription();
26
- $result['short_description'] = $product->getShortDescription();
27
- $result['weight'] = $product->getWeight();
28
- $result['url_key'] = $product->getUrlKey();
29
- if ($product->isVisibleInSiteVisibility())
30
- $result['url_path'] = $product->getUrlPath();
31
-
32
- $thumbnailProduct = $small_imageProduct = $imageProduct = $product;
33
- $parentProduct = $this->getParentProduct($product);
34
- if ($parentProduct != null)
35
- {
36
- $result['parent_id'] = $parentProduct->getEntityId();
37
- $result['parent_sku'] = $parentProduct->getSku();
38
-
39
- if (!$product->isVisibleInSiteVisibility()) {
40
- $result['name'] = $parentProduct->getName();
41
- $result['url_path'] = $parentProduct->getUrlPath();
42
- $result['url_key'] = $parentProduct->getUrlKey();
43
- }
44
-
45
- $useParent = Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId() && Mage::getStoreConfig(Mage_Checkout_Block_Cart_Item_Renderer_Configurable::CONFIGURABLE_PRODUCT_IMAGE) == Mage_Checkout_Block_Cart_Item_Renderer_Configurable::USE_PARENT_IMAGE;
46
- if (!$product->getData('image') || ($product->getData('image') == 'no_selection') || $useParent) $imageProduct = $parentProduct;
47
- if (!$product->getData('small_image') || ($product->getData('small_image') == 'no_selection') || $useParent) $small_imageProduct = $parentProduct;
48
- if (!$product->getData('thumbnail') || ($product->getData('thumbnail') == 'no_selection') || $useParent) $thumbnailProduct = $parentProduct;
49
-
50
- if ($includeConfigurableAttributes && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId())
51
- foreach ($parentProduct->getTypeInstance(true)->getUsedProductAttributes($parentProduct) as $attribute)
52
- {
53
- if (!array_key_exists('configurable_attributes', $result)) $result['configurable_attributes'] = array();
54
- $attr = array();
55
- $attr['attribute_name'] = $attribute->getFrontend()->getLabel();
56
- $attr['value'] = $product->getAttributeText($attribute->getAttributeCode());
57
- $result['configurable_attributes'][] = $attr;
58
- }
59
- }
60
- $result['image'] = $this->getProductImage($imageProduct, 'image');
61
- $result['small_image'] = $this->getProductImage($small_imageProduct, 'small_image');
62
- $result['thumbnail'] = $this->getProductImage($thumbnailProduct, 'thumbnail');
63
-
64
- if ($includeBrandAndCategory)
65
- {
66
- $setSettings = $this->getProductAttributeSetSettings($product);
67
-
68
- if ($setSettings['brandAttribute'] != null)
69
- $result['brand'] = $product->getAttributeText($setSettings['brandAttribute']);
70
-
71
- if ($setSettings['catFromMagento'])
72
- {
73
- $categories = $this->getCategoryIds($product, $categoryRootId);
74
- if (array_key_exists('category_id', $categories))
75
- {
76
- $catId = $categories['category_id'];
77
- if (!array_key_exists($catId, $categoryNames))
78
- $categoryNames[$catId] = $this->getCategoryName($catId);
79
-
80
- $result['category'] = $categoryNames[$catId];
81
- }
82
- if (array_key_exists('sub_category_id', $categories))
83
- {
84
- $catId = $categories['sub_category_id'];
85
- if (!array_key_exists($catId, $categoryNames))
86
- $categoryNames[$catId] = $this->getCategoryName($catId);
87
-
88
- $result['sub_category'] = $categoryNames[$catId];
89
- }
90
- }
91
- else if ($setSettings['catFromAttributes'])
92
- {
93
- if ($setSettings['categoryAttribute'] != null)
94
- $result['category'] = $product->getAttributeText($setSettings['categoryAttribute']);
95
-
96
- if ($setSettings['subcategoryAttribute'] != null)
97
- $result['sub_category'] = $product->getAttributeText($setSettings['subcategoryAttribute']);
98
- }
99
- }
100
-
101
- if ($includeInventory)
102
- {
103
- $result['in_stock'] = $product->isAvailable() ? "true" : "false";
104
- $stockItem = $product->getStockItem();
105
- if ($stockItem)
106
- $result['qty_on_hand'] = $stockItem->getStockQty();
107
- }
108
-
109
- $result['type'] = $product->getTypeId();
110
-
111
- return $result;
112
- }
113
-
114
-
115
- private function getProductImage($product, $imageType) {
116
- if ($baseDir == null) $baseDir = Mage::getBaseDir();
117
- if ($baseMediaPath == null) $baseMediaPath = Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath();
118
- if ($imageModel == null) $imageModel = Mage::getModel('catalog/product_image');
119
- $imageModel->setDestinationSubdir($imageType);
120
- try {
121
- $imageModel->setBaseFile($product->getData($imageType));
122
- $imageBaseFile = $imageModel->getBaseFile();
123
- if (!(false === strpos($imageBaseFile, $baseMediaPath)))
124
- return substr($imageBaseFile, strlen($baseMediaPath));
125
- return '/../../..'.substr($imageBaseFile, strlen($baseDir));
126
- }
127
- catch (Exception $e) {
128
- return null;
129
- }
130
- }
131
-
132
- private function getParentProduct($product)
133
- {
134
- $parentIds = Mage::getModel('catalog/product_type_configurable')
135
- ->getParentIdsByChild($product->getEntityId());
136
-
137
- if (is_array($parentIds) && count($parentIds) > 0)
138
- {
139
- if (count($parentIds) > 1) Mage::getModel("listrak/log")->addException("Product has multiple parents: sku=" . $product->getSku() . " parentIds=" . implode(', ', $parentIds));
140
-
141
- $parentId = $parentIds[0];
142
- if ($parentId != null)
143
- {
144
- if (!array_key_exists($parentId, $parentsById))
145
- $parentsById[$parentId] = Mage::getModel('catalog/product')
146
- ->load($parentId);
147
- return $parentsById[$parentId];
148
- }
149
- }
150
-
151
- return null;
152
- }
153
-
154
- private function getProductAttributeSetSettings($product) {
155
- if ($attributeSets == null) {
156
- $categoryRootId = Mage::helper('remarketing')->getCategoryRootIdForStore($storeId);
157
-
158
- $attributeSets = array(0 => array(
159
- //default values
160
- 'brandAttribute' => null,
161
- 'catFromMagento' => true,
162
- 'catFromAttributes' => false,
163
- 'categoryAttribute' => null,
164
- 'subcategoryAttribute' => null
165
- ));
166
-
167
- $attributeSetSettings = Mage::getModel('listrak/product_attribute_set_map')
168
- ->getCollection();
169
- foreach($attributeSetSettings as $setSettings)
170
- {
171
- $attributeSets[$setSettings->getAttributeSetId()] = array(
172
- 'brandAttribute' => $setSettings->getBrandAttributeCode(),
173
- 'catFromMagento' => $setSettings->finalCategoriesSource() == 'default',
174
- 'catFromAttributes' => $setSettings->finalCategoriesSource() == 'attributes',
175
- 'categoryAttribute' => $setSettings->getCategoryAttributeCode(),
176
- 'subcategoryAttribute' => $setSettings->getSubcategoryAttributeCode()
177
- );
178
- }
179
- }
180
- return array_key_exists($product->getAttributeSetId(), $attributeSets) ? $attributeSets[$product->getAttributeSetId()] : $attributeSets[0];
181
- }
182
-
183
- private function getCategoryIds($product, $categoryRootId = null)
184
- {
185
- $categories = $product->getCategoryCollection();
186
- $final = array();
187
-
188
- foreach($categories as $category)
189
- {
190
- $pathIds = $category->getPathIds();
191
- if ($categoryRootId == null || $pathIds[1] == $categoryRootId)
192
- {
193
- if (count($pathIds) > 2)
194
- $final['category_id'] = $pathIds[2];
195
- if (count($pathIds) > 3)
196
- $final['sub_category_id'] = $pathIds[3];
197
-
198
- break;
199
- }
200
- }
201
-
202
- return $final;
203
- }
204
-
205
- private function getCategoryName($categoryId)
206
- {
207
- $category = Mage::getModel('catalog/category')
208
- ->load($categoryId);
209
-
210
- if ($category != null)
211
- return $category->getName();
212
- }
213
}
214
- ?>
1
<?php
2
+ /**
3
+ * Listrak Remarketing Magento Extension Ver. 1.0.0
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Listrak
8
+ * @package Listrak_Remarketing
9
+ * @author Listrak Magento Team <magento@listrak.com>
10
+ * @copyright 2011 Listrak Inc
11
+ * @license http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
12
+ * @link http://www.listrak.com
13
+ */
14
15
+ class Listrak_Remarketing_Helper_Product
16
+ extends Mage_Core_Helper_Abstract
17
{
18
+ private $_parentsById = array();
19
+ private $_attributeSets = null;
20
+ private $_categoryNames = array();
21
+ private $_baseDir = null;
22
+ private $_baseMediaPath = null;
23
+ private $_imageModel = null;
24
+
25
+ public function getProductEntity(Mage_Catalog_Model_Product $product, $storeId,
26
+ $includeBrandAndCategory = true, $includeInventory = true,
27
+ $includeConfigurableAttributes = true
28
+ )
29
+ {
30
+ $result = array();
31
+
32
+ $result['entity_id'] = $product->getEntityId();
33
+ $result['sku'] = $product->getSku();
34
+ $result['name'] = $product->getName();
35
+ $result['price'] = $product->getPrice();
36
+ $result['special_price'] = $product->getSpecialPrice();
37
+ $result['special_from_date'] = $product->getSpecialFromDate();
38
+ $result['special_to_date'] = $product->getSpecialToDate();
39
+ $result['cost'] = $product->getCost();
40
+ $result['description'] = $product->getDescription();
41
+ $result['short_description'] = $product->getShortDescription();
42
+ $result['weight'] = $product->getWeight();
43
+ $result['url_key'] = $product->getUrlKey();
44
+ if ($product->isVisibleInSiteVisibility()) {
45
+ $result['url_path'] = $product->getUrlPath();
46
+ }
47
+
48
+ $thumbnailProduct = $smallImageProduct = $imageProduct = $product;
49
+ $parentProduct = $this->_getParentProduct($product);
50
+ if ($parentProduct != null) {
51
+ $result['parent_id'] = $parentProduct->getEntityId();
52
+ $result['parent_sku'] = $parentProduct->getSku();
53
+
54
+ if (!$product->isVisibleInSiteVisibility()) {
55
+ $result['name'] = $parentProduct->getName();
56
+ $result['url_path'] = $parentProduct->getUrlPath();
57
+ $result['url_key'] = $parentProduct->getUrlKey();
58
+ }
59
+
60
+ $useParent = Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId()
61
+ && Mage::getStoreConfig(
62
+ Mage_Checkout_Block_Cart_Item_Renderer_Configurable::CONFIGURABLE_PRODUCT_IMAGE
63
+ )
64
+ == Mage_Checkout_Block_Cart_Item_Renderer_Configurable::USE_PARENT_IMAGE;
65
+
66
+ if (!$product->getData('image')
67
+ || ($product->getData('image') == 'no_selection')
68
+ || $useParent
69
+ ) {
70
+ $imageProduct = $parentProduct;
71
+ }
72
+ if (!$product->getData('small_image')
73
+ || ($product->getData('small_image') == 'no_selection')
74
+ || $useParent
75
+ ) {
76
+ $smallImageProduct = $parentProduct;
77
+ }
78
+ if (!$product->getData('thumbnail')
79
+ || ($product->getData('thumbnail') == 'no_selection')
80
+ || $useParent
81
+ ) {
82
+ $thumbnailProduct = $parentProduct;
83
+ }
84
+
85
+ if ($includeConfigurableAttributes
86
+ && Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $parentProduct->getTypeId()
87
+ ) {
88
+ foreach (
89
+ $parentProduct
90
+ ->getTypeInstance(true)
91