NanoRep_Widgets_1_1_0 - Version 2.0.0

Version Notes

nanoRep 2.0.0

Download this release

Release Info

Developer NanoRep
Extension NanoRep_Widgets_1_1_0
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.5.0 to 2.0.0

Files changed (75) hide show
  1. app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer.php +20 -0
  2. app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid.php +183 -0
  3. app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid/Export.php +142 -0
  4. app/code/local/NanoRep/Widgets/Block/Adminhtml/Mynanorep.php +2 -2
  5. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order.php +20 -0
  6. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid.php +102 -209
  7. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid/Export.php +113 -0
  8. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/View/Queries.php +1 -1
  9. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Body.php +25 -0
  10. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Body/Pretty.php +16 -0
  11. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Title.php +37 -0
  12. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Title/Pretty.php +37 -0
  13. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Questions.php +28 -0
  14. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Questions/Pretty.php +28 -0
  15. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results.php +52 -0
  16. app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results/Pretty.php +48 -0
  17. app/code/local/NanoRep/Widgets/Block/Customerhistoryjson.php +3 -4
  18. app/code/local/NanoRep/Widgets/Block/{Support.php → Embed.php} +53 -33
  19. app/code/local/NanoRep/Widgets/Block/Events.php +3 -3
  20. app/code/local/NanoRep/Widgets/Block/Float.php +14 -0
  21. app/code/local/NanoRep/Widgets/Block/General.php +0 -14
  22. app/code/local/NanoRep/Widgets/Block/Header.php +237 -0
  23. app/code/local/NanoRep/Widgets/Block/Success.php +3 -3
  24. app/code/local/NanoRep/Widgets/Block/Top.php +0 -169
  25. app/code/local/NanoRep/Widgets/Helper/Data.php +47 -49
  26. app/code/local/NanoRep/Widgets/Model/Answer.php +20 -0
  27. app/code/local/NanoRep/Widgets/Model/History.php +2 -2
  28. app/code/local/NanoRep/Widgets/Model/Mysql4/Setup.php +0 -13
  29. app/code/local/NanoRep/Widgets/Model/Observer.php +20 -16
  30. app/code/local/NanoRep/Widgets/Model/Query.php +8 -5
  31. app/code/local/NanoRep/Widgets/Model/Resource/Answer.php +15 -0
  32. app/code/local/NanoRep/Widgets/Model/Resource/Answer/Collection.php +37 -0
  33. app/code/local/NanoRep/Widgets/Model/{Mysql4 → Resource}/Query.php +3 -3
  34. app/code/local/NanoRep/Widgets/Model/Resource/Query/Collection.php +63 -0
  35. app/code/local/NanoRep/Widgets/Model/Resource/Setup.php +14 -0
  36. app/code/local/NanoRep/Widgets/Model/Session.php +5 -21
  37. app/code/local/NanoRep/Widgets/Model/{Adminhtml/System → System}/Config/Source/Attribute.php +4 -4
  38. app/code/local/NanoRep/Widgets/Model/System/Config/Source/FloatWidgetActivePages.php +5 -5
  39. app/code/local/NanoRep/Widgets/Model/System/Config/Source/OrdersStatusActivePages.php +5 -5
  40. app/code/local/NanoRep/Widgets/Model/{Adminhtml/System → System}/Config/Source/ProductIdAttribute.php +4 -4
  41. app/code/local/NanoRep/Widgets/controllers/Adminhtml/AnswerController.php +39 -0
  42. app/code/local/NanoRep/Widgets/controllers/Adminhtml/MynanorepController.php +2 -17
  43. app/code/local/NanoRep/Widgets/controllers/Adminhtml/OrderController.php +39 -0
  44. app/code/local/NanoRep/Widgets/controllers/IndexController.php +2 -2
  45. app/code/local/NanoRep/Widgets/controllers/QueryController.php +45 -6
  46. app/code/local/NanoRep/Widgets/etc/adminhtml.xml +87 -0
  47. app/code/local/NanoRep/Widgets/etc/config.xml +54 -122
  48. app/code/local/NanoRep/Widgets/etc/system.xml +23 -23
  49. app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/install-2.0.0.php +85 -0
  50. app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-data-upgrade-1.2.2-1.2.3.php +0 -8
  51. app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-install-1.2.2.php +0 -13
  52. app/design/adminhtml/default/default/layout/nanorepwidgets.xml +6 -5
  53. app/design/adminhtml/default/default/template/nanorepwidgets/mynanorep.phtml +4 -4
  54. app/design/adminhtml/default/default/template/nanorepwidgets/order/view/queries.phtml +7 -23
  55. app/design/adminhtml/default/default/template/nanorepwidgets/order/view/tab/info.phtml +7 -23
  56. app/design/frontend/default/default/layout/nanorepwidgets.xml +20 -22
  57. app/design/frontend/default/default/template/nanorepwidgets/cdc.phtml +10 -0
  58. app/design/frontend/default/default/template/nanorepwidgets/embed.phtml +60 -0
  59. app/design/frontend/default/default/template/nanorepwidgets/events.phtml +38 -14
  60. app/design/frontend/default/default/template/nanorepwidgets/{general.phtml → float.phtml} +16 -19
  61. app/design/frontend/default/default/template/nanorepwidgets/grid.phtml +0 -229
  62. app/design/frontend/default/default/template/nanorepwidgets/{top.phtml → header.phtml} +16 -61
  63. app/design/frontend/default/default/template/nanorepwidgets/success.phtml +10 -0
  64. app/design/frontend/default/default/template/nanorepwidgets/support.phtml +0 -67
  65. app/design/frontend/rwd/default/layout/nanorepwidgets.xml +50 -0
  66. app/design/frontend/rwd/default/template/nanorepwidgets/cdc.phtml +86 -0
  67. app/design/frontend/rwd/default/template/nanorepwidgets/embed.phtml +60 -0
  68. app/design/frontend/rwd/default/template/nanorepwidgets/events.phtml +58 -0
  69. app/design/frontend/rwd/default/template/nanorepwidgets/float.phtml +43 -0
  70. app/design/frontend/rwd/default/template/nanorepwidgets/header.phtml +90 -0
  71. app/design/frontend/rwd/default/template/nanorepwidgets/success.phtml +17 -0
  72. app/etc/modules/NanoRep_Widgets.xml +2 -11
  73. package.xml +5 -5
  74. skin/frontend/rwd/default/nanorepwidgets/head.css +20 -0
  75. skin/frontend/rwd/default/nanorepwidgets/head.js +56 -0
app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Block_Adminhtml_Answer extends Mage_Adminhtml_Block_Widget_Grid_Container
11
+ {
12
+ public function __construct()
13
+ {
14
+ $this->_blockGroup = 'nanorepwidgets';
15
+ $this->_controller = 'adminhtml_answer';
16
+ $this->_headerText = Mage::helper('nanorepwidgets')->__('nanoRep search report');
17
+ parent::__construct();
18
+ $this->_removeButton('add');
19
+ }
20
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ private $_productNameSql, $_productCollection;
14
+ private $_productPriceSql;
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+ $this->setId('nanorep_answer_grid');
19
+ $this->setDefaultSort('product_id');
20
+ $this->setDefaultDir('DESC');
21
+ $this->setSaveParametersInSession(true);
22
+ $this->setUseAjax(true);
23
+ }
24
+
25
+ protected function _getStore()
26
+ {
27
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
28
+ return Mage::app()->getStore($storeId);
29
+ }
30
+
31
+ protected function _prepareCollection()
32
+ {
33
+ $store = $this->_getStore();
34
+ $productCollection = Mage::getModel('catalog/product')->getCollection()
35
+ ->addAttributeToSelect('sku')
36
+ ->addAttributeToSelect('name');
37
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
38
+ $productCollection->addStoreFilter($store);
39
+ $productCollection->joinAttribute(
40
+ 'name',
41
+ 'catalog_product/name',
42
+ 'entity_id',
43
+ null,
44
+ 'inner',
45
+ $adminStore
46
+ );
47
+ $productCollection->joinAttribute(
48
+ 'price',
49
+ 'catalog_product/price',
50
+ 'entity_id',
51
+ null,
52
+ 'left',
53
+ $store->getId()
54
+ );
55
+ $productNameSql = $productCollection->getSelect();
56
+ $productNameSql = str_replace('`e`.*, ', '', $productNameSql);
57
+ $productNameSql = str_replace(', `at_price`.`value` AS `price`', '', $productNameSql);
58
+ $productNameSql = '('.$productNameSql.' WHERE main_table.product_id = e.entity_id)';
59
+ $this->_productNameSql = $productNameSql;
60
+ $this->_productCollection = $productCollection;
61
+ $collection = Mage::getResourceModel('nanorepwidgets/answer_collection')
62
+ ->addExpressionFieldToSelect(
63
+ 'product_name',
64
+ $productNameSql, array('product_name' => 'main_table.product_name'))
65
+ ;
66
+
67
+ $productPriceSql = $productCollection->getSelect();
68
+ $productPriceSql = str_replace('`e`.*, ', '', $productPriceSql);
69
+ $productPriceSql = str_replace('`at_name`.`value` AS `name`, ', '', $productPriceSql);
70
+ $productPriceSql = '('.$productPriceSql.' WHERE main_table.product_id = e.entity_id)';
71
+ $this->_productPriceSql = $productNameSql;
72
+ $this->_productCollection = $productCollection;
73
+
74
+ $collection->addExpressionFieldToSelect(
75
+ 'product_price',
76
+ $productPriceSql, array('product_price' => 'main_table.product_price'))
77
+ ;
78
+
79
+ $collection->addExpressionFieldToSelect(
80
+ 'answer_count',
81
+ 'COUNT({{answer_count}})'
82
+ , array('answer_count' => 'main_table.answer_id'))
83
+ ;
84
+ $collection->addExpressionFieldToSelect(
85
+ 'answer_title_with_query',
86
+ '(SELECT CONCAT({{answer_title}}, ":::", GROUP_CONCAT(DISTINCT {{query}} SEPARATOR "###")))'
87
+ , array('answer_title_with_query' => 'main_table.answer_title_with_query', 'answer_title' => 'main_table.answer_title', 'query' => 'main_table.query'))
88
+ ;
89
+ $collection->getSelect()->order('answer_id', 'ASC');
90
+ $collection->getSelect()->group(array('main_table.answer_id'));
91
+
92
+ $filter = $this->getParam($this->getVarNameFilter(), null);
93
+
94
+ if (is_string($filter)) {
95
+ $data = $this->helper('adminhtml')->prepareFilterString($filter);
96
+ $this->_setFilterValues($data);
97
+ }
98
+ else if ($filter && is_array($filter)) {
99
+ $this->_setFilterValues($filter);
100
+ }
101
+
102
+ $this->setCollection($collection);
103
+ parent::_prepareCollection();
104
+ return $this;
105
+ }
106
+ protected function _prepareColumns()
107
+ {
108
+ $helper = Mage::helper('nanorepwidgets');
109
+ $this->addColumn('product_id', array(
110
+ 'header' => $helper->__('Product #'),
111
+ 'index' => 'product_id',
112
+ 'sortable' => false
113
+ ));
114
+ $this->addColumn('product_name', array(
115
+ 'header' => $helper->__('Product Name'),
116
+ 'index' => 'product_name',
117
+ // 'filter_condition_callback' => array($this, '_productNameFilter')
118
+ 'filter' => false,
119
+ 'sortable' => false
120
+
121
+ ));
122
+ $this->addColumn('product_price', array(
123
+ 'header' => $helper->__('Product Price'),
124
+ 'index' => 'product_price',
125
+ 'filter' => false,
126
+ 'sortable' => false
127
+ ));
128
+ // $this->addColumn('query', array(
129
+ // 'header' => $helper->__('Query'),
130
+ // 'index' => 'query',
131
+ // 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Query'
132
+ // ));
133
+ $this->addColumn('answer_id', array(
134
+ 'header' => $helper->__('Answer Id'),
135
+ 'index' => 'answer_id',
136
+ 'sortable' => false
137
+ ));
138
+ $this->addColumn('answer_title_with_query', array(
139
+ 'header' => $helper->__('Answer Title'),
140
+ 'index' => 'answer_title_with_query',
141
+ 'filter' => false,
142
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title',
143
+ 'sortable' => false
144
+ ));
145
+ $this->addColumn('answer_body', array(
146
+ 'header' => $helper->__('Answer Body'),
147
+ 'index' => 'answer_body',
148
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body',
149
+ 'sortable' => false
150
+ ));
151
+ $this->addColumn('answer_count', array(
152
+ 'header' => $helper->__('Count'),
153
+ 'index' => 'answer_count',
154
+ 'filter' => false,
155
+ ));
156
+ $this->addColumn('date', array(
157
+ 'header' => Mage::helper('sales')->__('Date'),
158
+ 'index' => 'date',
159
+ 'type' => 'datetime',
160
+ 'width' => '100px',
161
+ 'sortable' => false
162
+ ));
163
+
164
+ $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
165
+ $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
166
+ return parent::_prepareColumns();
167
+ }
168
+ public function getGridUrl()
169
+ {
170
+ return $this->getUrl('*/*/grid', array('_current'=>true));
171
+ }
172
+
173
+ // protected function _productNameFilter($collection, $column)
174
+ // {
175
+ // if (!$value = $column->getFilter()->getValue()) {
176
+ // return $this;
177
+ // }
178
+ // $collection->addFieldToFilter('product_name', array('like' => '%'.$value.'%'));
179
+ // echo $collection->getSelect();//->where("main_table.product_name LIKE \"%".$value."\%");
180
+ //
181
+ // return $this;
182
+ // }
183
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid/Export.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid_Export extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('nanorep_answer_grid');
17
+ $this->setDefaultSort('product_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ $this->setUseAjax(true);
21
+ }
22
+
23
+ protected function _getStore()
24
+ {
25
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
26
+ return Mage::app()->getStore($storeId);
27
+ }
28
+
29
+ protected function _prepareCollection()
30
+ {
31
+ $store = $this->_getStore();
32
+ $productCollection = Mage::getModel('catalog/product')->getCollection()
33
+ ->addAttributeToSelect('sku')
34
+ ->addAttributeToSelect('name');
35
+ $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
36
+ $productCollection->addStoreFilter($store);
37
+ $productCollection->joinAttribute(
38
+ 'name',
39
+ 'catalog_product/name',
40
+ 'entity_id',
41
+ null,
42
+ 'inner',
43
+ $adminStore
44
+ );
45
+ $productCollection->joinAttribute(
46
+ 'price',
47
+ 'catalog_product/price',
48
+ 'entity_id',
49
+ null,
50
+ 'left',
51
+ $store->getId()
52
+ );
53
+ $productNameSql = $productCollection->getSelect();
54
+ $productNameSql = str_replace('`e`.*, ', '', $productNameSql);
55
+ $productNameSql = str_replace(', `at_price`.`value` AS `price`', '', $productNameSql);
56
+ $productNameSql = '('.$productNameSql.' WHERE main_table.product_id = e.entity_id)';
57
+
58
+ $collection = Mage::getResourceModel('nanorepwidgets/answer_collection')
59
+ ->addExpressionFieldToSelect(
60
+ 'product_name',
61
+ $productNameSql, array('product_name' => 'main_table.product_name'))
62
+ ;
63
+
64
+ $productPriceSql = $productCollection->getSelect();
65
+ $productPriceSql = str_replace('`e`.*, ', '', $productPriceSql);
66
+ $productPriceSql = str_replace('`at_name`.`value` AS `name`, ', '', $productPriceSql);
67
+ $productPriceSql = '('.$productPriceSql.' WHERE main_table.product_id = e.entity_id)';
68
+
69
+ $collection->addExpressionFieldToSelect(
70
+ 'product_price',
71
+ $productPriceSql, array('product_price' => 'main_table.product_price'))
72
+ ;
73
+
74
+ $collection->addExpressionFieldToSelect(
75
+ 'answer_count',
76
+ 'COUNT({{answer_count}})'
77
+ , array('answer_count' => 'main_table.answer_id'))
78
+ ;
79
+ $collection->addExpressionFieldToSelect(
80
+ 'answer_title_with_query',
81
+ '(SELECT CONCAT({{answer_title}}, ":::", GROUP_CONCAT(DISTINCT {{query}} SEPARATOR "###")))'
82
+ , array('answer_title_with_query' => 'main_table.answer_title_with_query', 'answer_title' => 'main_table.answer_title', 'query' => 'main_table.query'))
83
+ ;
84
+ $collection->getSelect()->group('answer_id');
85
+ $this->setCollection($collection);
86
+ parent::_prepareCollection();
87
+ return $this;
88
+ }
89
+ protected function _prepareColumns()
90
+ {
91
+ $helper = Mage::helper('nanorepwidgets');
92
+ $this->addColumn('product_id', array(
93
+ 'header' => $helper->__('Product #'),
94
+ 'index' => 'product_id',
95
+ ));
96
+ $this->addColumn('product_name', array(
97
+ 'header' => $helper->__('Product Name'),
98
+ 'index' => 'product_name',
99
+ ));
100
+ $this->addColumn('product_price', array(
101
+ 'header' => $helper->__('Product Price'),
102
+ 'index' => 'product_price',
103
+ ));
104
+ // $this->addColumn('query', array(
105
+ // 'header' => $helper->__('Query'),
106
+ // 'index' => 'query',
107
+ // 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Query'
108
+ // ));
109
+ $this->addColumn('answer_id', array(
110
+ 'header' => $helper->__('Answer Id'),
111
+ 'index' => 'answer_id',
112
+ ));
113
+ $this->addColumn('answer_title_with_query', array(
114
+ 'header' => $helper->__('Answer Title'),
115
+ 'index' => 'answer_title_with_query',
116
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title_Pretty'
117
+ ));
118
+ $this->addColumn('answer_body', array(
119
+ 'header' => $helper->__('Answer Body'),
120
+ 'index' => 'answer_body',
121
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body_Pretty'
122
+ ));
123
+ $this->addColumn('answer_count', array(
124
+ 'header' => $helper->__('Count'),
125
+ 'index' => 'answer_count',
126
+ ));
127
+ $this->addColumn('date', array(
128
+ 'header' => Mage::helper('sales')->__('Date'),
129
+ 'index' => 'date',
130
+ 'type' => 'datetime',
131
+ 'width' => '100px',
132
+ ));
133
+
134
+ $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
135
+ $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
136
+ return parent::_prepareColumns();
137
+ }
138
+ public function getGridUrl()
139
+ {
140
+ return $this->getUrl('*/*/grid', array('_current'=>true));
141
+ }
142
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Mynanorep.php CHANGED
@@ -3,8 +3,8 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_Block_Adminhtml_Mynanorep extends Mage_Adminhtml_Block_Abstract
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_Block_Adminhtml_Mynanorep extends Mage_Adminhtml_Block_Abstract
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
11
+ {
12
+ public function __construct()
13
+ {
14
+ $this->_blockGroup = 'nanorepwidgets';
15
+ $this->_controller = 'adminhtml_order';
16
+ $this->_headerText = Mage::helper('nanorepwidgets')->__('Purchases Assisted by nanoRep');
17
+ parent::__construct();
18
+ $this->_removeButton('add');
19
+ }
20
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid.php CHANGED
@@ -1,232 +1,125 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Adminhtml sales orders grid
29
- *
30
- * @category Mage
31
- * @package Mage_Adminhtml
32
- * @author Magento Core Team <core@magentocommerce.com>
33
  */
 
34
  class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
  {
36
-
37
- protected $_pagerVisibility = false;
38
-
39
- protected $_headersVisibility = true;
40
-
41
- protected $_filterVisibility = false;
42
-
43
- public function __construct($attributes=array())
44
- {
45
- parent::__construct($attributes);
46
- $this->setTemplate('nanorepwidgets/grid.phtml');
47
-
48
- }
49
- /**
50
- * Retrieve collection class
51
- *
52
- * @return string
53
- */
54
- protected function _getCollectionClass()
55
  {
56
- return 'sales/order_collection';
 
 
 
 
 
57
  }
58
-
59
  protected function _prepareCollection()
60
  {
61
- $collection = Mage::getResourceModel($this->_getCollectionClass());
62
- $grid = Mage::getSingleton('nanorepwidgets/history');
63
- if(!is_null($grid->getEmail()) && $grid->getEmail() != ""){
64
- $collection->addAttributeToFilter("customer_email", $grid->getEmail());
65
- $this->setCollection($collection);
66
- }
67
- return parent::_prepareCollection();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
-
70
  protected function _prepareColumns()
71
  {
72
-
73
- $this->addColumn('real_order_id', array(
74
- 'header'=> Mage::helper('sales')->__('Order #'),
75
- 'width' => '80px',
76
- 'type' => 'text',
77
- 'index' => 'increment_id',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ));
79
-
80
- // if (!Mage::app()->isSingleStoreMode()) {
81
- // $this->addColumn('store_id', array(
82
- // 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
83
- // 'index' => 'store_id',
84
- // 'type' => 'store',
85
- // 'store_view'=> true,
86
- // 'display_deleted' => true,
87
- // ));
88
- // }
89
 
90
- // $this->addColumn('customer_email', array(
91
- // 'header' => Mage::helper('sales')->__('Email'),
92
- // 'index' => 'customer_email',
93
- // ));
94
-
95
- // $this->addColumn('customer_firstname', array(
96
- // 'header' => Mage::helper('sales')->__('Customer Firstname'),
97
- // 'index' => 'customer_firstname',
98
- // ));
99
- //
100
- // $this->addColumn('customer_lastname', array(
101
- // 'header' => Mage::helper('sales')->__('Customer Lastname'),
102
- // 'index' => 'customer_lastname',
103
- // ));
104
 
105
- $this->addColumn('created_at', array(
106
- 'header' => Mage::helper('sales')->__('Purchased On'),
107
- 'index' => 'created_at',
108
- 'type' => 'datetime',
109
- 'width' => '100px',
 
110
  ));
111
-
112
-
113
- // $this->addColumn('base_grand_total', array(
114
- // 'header' => Mage::helper('sales')->__('G.T. (Base)'),
115
- // 'index' => 'base_grand_total',
116
- // 'type' => 'currency',
117
- // 'currency' => 'base_currency_code',
118
- // ));
119
-
120
- $this->addColumn('grand_total', array(
121
- 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
122
- 'index' => 'grand_total',
123
- 'type' => 'currency',
124
- 'currency' => 'order_currency_code',
125
  ));
126
-
127
- // $this->addColumn('status', array(
128
- // 'header' => Mage::helper('sales')->__('Status'),
129
- // 'index' => 'status',
130
- // 'type' => 'options',
131
- // 'width' => '70px',
132
- // 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
133
- // ));
134
-
135
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
136
- $this->addColumn('action',
137
- array(
138
- 'header' => Mage::helper('sales')->__('Action'),
139
- 'width' => '50px',
140
- 'type' => 'action',
141
- 'getter' => 'getId',
142
- 'actions' => array(
143
- array(
144
- 'caption' => Mage::helper('sales')->__('View'),
145
- 'url' => array('base'=>'adminhtml/sales_order/view'),
146
- 'field' => 'order_id',
147
- 'target'=>'_blank',
148
- )
149
- ),
150
- 'filter' => false,
151
- 'sortable' => false,
152
- 'index' => 'stores',
153
- 'is_system' => true,
154
- ));
155
- }
156
- // $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
157
-
158
- // $this->addExportType('adminhtml/sales_order/exportCsv', Mage::helper('sales')->__('CSV'));
159
- // $this->addExportType('adminhtml/sales_order/exportExcel', Mage::helper('sales')->__('Excel XML'));
160
-
161
  return parent::_prepareColumns();
162
  }
163
-
164
- protected function _prepareMassaction()
165
- {
166
- // $this->setMassactionIdField('entity_id');
167
- // $this->getMassactionBlock()->setFormFieldName('order_ids');
168
- // $this->getMassactionBlock()->setUseSelectAll(false);
169
- //
170
- // if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
171
- // $this->getMassactionBlock()->addItem('cancel_order', array(
172
- // 'label'=> Mage::helper('sales')->__('Cancel'),
173
- // 'url' => $this->getUrl('*/sales_order/massCancel'),
174
- // ));
175
- // }
176
- //
177
- // if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
178
- // $this->getMassactionBlock()->addItem('hold_order', array(
179
- // 'label'=> Mage::helper('sales')->__('Hold'),
180
- // 'url' => $this->getUrl('*/sales_order/massHold'),
181
- // ));
182
- // }
183
- //
184
- // if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
185
- // $this->getMassactionBlock()->addItem('unhold_order', array(
186
- // 'label'=> Mage::helper('sales')->__('Unhold'),
187
- // 'url' => $this->getUrl('*/sales_order/massUnhold'),
188
- // ));
189
- // }
190
- //
191
- // $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
192
- // 'label'=> Mage::helper('sales')->__('Print Invoices'),
193
- // 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
194
- // ));
195
- //
196
- // $this->getMassactionBlock()->addItem('pdfshipments_order', array(
197
- // 'label'=> Mage::helper('sales')->__('Print Packingslips'),
198
- // 'url' => $this->getUrl('*/sales_order/pdfshipments'),
199
- // ));
200
- //
201
- // $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
202
- // 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
203
- // 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
204
- // ));
205
- //
206
- // $this->getMassactionBlock()->addItem('pdfdocs_order', array(
207
- // 'label'=> Mage::helper('sales')->__('Print All'),
208
- // 'url' => $this->getUrl('*/sales_order/pdfdocs'),
209
- // ));
210
- //
211
- // $this->getMassactionBlock()->addItem('print_shipping_label', array(
212
- // 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
213
- // 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
214
- // ));
215
-
216
- return $this;
217
- }
218
-
219
- public function getRowUrl($row)
220
- {
221
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
222
- return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
223
- }
224
- return false;
225
- }
226
-
227
  public function getGridUrl()
228
  {
229
- return $this->getUrl('*/*/getcustomerhistory', array('_current'=>true));
230
  }
231
-
232
- }
1
  <?php
2
  /**
3
+ * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
+
11
  class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
  {
13
+ public function __construct()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  {
15
+ parent::__construct();
16
+ $this->setId('nanorep_order_grid');
17
+ $this->setDefaultSort('product_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ $this->setUseAjax(true);
21
  }
 
22
  protected function _prepareCollection()
23
  {
24
+ $collection = Mage::getResourceModel('nanorepwidgets/query_collection')
25
+ ->join(array('o' => 'sales/order'), 'main_table.order_id = o.entity_id')
26
+ ->join(array('p' => 'sales/order_item'), 'main_table.order_id = p.order_id', array(
27
+ 'product_name' => 'name',
28
+ 'qty_ordered' => 'qty_ordered'
29
+ ))
30
+ ->addExpressionFieldToSelect(
31
+ 'fullname',
32
+ 'CONCAT({{customer_firstname}}, \' \', {{customer_lastname}})',
33
+ array('customer_firstname' => 'o.customer_firstname', 'customer_lastname' => 'o.customer_lastname'))
34
+ ->addExpressionFieldToSelect(
35
+ 'shipping_fullname',
36
+ '(SELECT CONCAT({{shipping_customer_firstname}}, \' \', {{shipping_customer_lastname}})
37
+ FROM sales_flat_order_address a
38
+ WHERE o.shipping_address_id = a.entity_id)',
39
+ array('shipping_customer_firstname' => 'a.firstname', 'shipping_customer_lastname' => 'a.lastname'))
40
+ ->addExpressionFieldToSelect(
41
+ 'questions',
42
+ '(SELECT GROUP_CONCAT(DISTINCT {{questions}} ORDER BY date ASC SEPARATOR ", "))',
43
+ array('questions' => 'main_table.query'))
44
+ ->addExpressionFieldToSelect(
45
+ 'grouped_results',
46
+ '(SELECT GROUP_CONCAT(DISTINCT {{grouped_results}} ORDER BY date ASC SEPARATOR ":::"))',
47
+ array('grouped_results' => 'main_table.results'))
48
+ ;
49
+ $this->setCollection($collection);
50
+ $collection->getSelect()->group(array('main_table.product_id', 'main_table.order_id'));
51
+ $collection->getSelect()->order('main_table.product_id');
52
+ // echo $collection->getSelect();
53
+ parent::_prepareCollection();
54
+ return $this;
55
  }
 
56
  protected function _prepareColumns()
57
  {
58
+ $helper = Mage::helper('nanorepwidgets');
59
+ $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
60
+ $this->addColumn('product_id', array(
61
+ 'header' => $helper->__('Product #'),
62
+ 'index' => 'product_id',
63
+ ));
64
+ $this->addColumn('product_name', array(
65
+ 'header' => $helper->__('Products Purchased'),
66
+ 'index' => 'product_name',
67
+ 'filter' => false
68
+ ));
69
+ $this->addColumn('qty_ordered', array(
70
+ 'header' => $helper->__('Quantity'),
71
+ 'index' => 'qty_ordered',
72
+ ));
73
+ $this->addColumn('fullname', array(
74
+ 'header' => $helper->__('Bill to Name'),
75
+ 'index' => 'fullname',
76
+ 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)',
77
+ ));
78
+ $this->addColumn('shipping_fullname', array(
79
+ 'header' => $helper->__('Ship to Name'),
80
+ 'index' => 'shipping_fullname',
81
+ 'filter_index' => 'CONCAT(shipping_customer_firstname, \' \', shipping_customer_lastname)',
82
+ 'filter' => false,
83
+ 'sortable' => false
84
+ ));
85
+ $this->addColumn('grand_total', array(
86
+ 'header' => $helper->__('Purchased Price'),
87
+ 'index' => 'grand_total',
88
+ 'type' => 'currency',
89
+ 'currency_code' => $currency
90
  ));
 
 
 
 
 
 
 
 
 
 
91
 
92
+ //Question(s) asked prior the submission
93
+ $this->addColumn('questions', array(
94
+ 'header' => $helper->__('Question(s) asked prior the submission'),
95
+ 'index' => 'questions',
96
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions',
97
+ 'filter' => false,
98
+ 'sortable' => false
99
+ ));
 
 
 
 
 
 
100
 
101
+ $this->addColumn('grouped_results', array(
102
+ 'header' => $helper->__('Result(s) provided by nanoRep (Respectively)'),
103
+ 'index' => 'grouped_results',
104
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results',
105
+ 'filter' => false,
106
+ 'sortable' => false
107
  ));
108
+
109
+ $this->addColumn('purchased_on', array(
110
+ 'header' => $helper->__('Purchased On'),
111
+ 'type' => 'datetime',
112
+ 'index' => 'created_at',
113
+ 'filter' => false,
114
+ // 'sortable' => false
115
+
 
 
 
 
 
 
116
  ));
117
+ $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
118
+ $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  return parent::_prepareColumns();
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  public function getGridUrl()
122
  {
123
+ return $this->getUrl('*/*/grid', array('_current'=>true));
124
  }
125
+ }
 
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid/Export.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Order_Grid_Export extends Mage_Adminhtml_Block_Widget_Grid
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setId('nanorep_order_grid');
17
+ $this->setDefaultSort('product_id');
18
+ $this->setDefaultDir('DESC');
19
+ $this->setSaveParametersInSession(true);
20
+ $this->setUseAjax(true);
21
+ }
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getResourceModel('nanorepwidgets/query_collection')
25
+ ->join(array('o' => 'sales/order'), 'main_table.order_id = o.entity_id')
26
+ ->join(array('p' => 'sales/order_item'), 'main_table.order_id = p.order_id', array(
27
+ 'product_name' => 'name',
28
+ 'qty_ordered' => 'qty_ordered'
29
+ ))
30
+ ->addExpressionFieldToSelect(
31
+ 'fullname',
32
+ 'CONCAT({{customer_firstname}}, \' \', {{customer_lastname}})',
33
+ array('customer_firstname' => 'o.customer_firstname', 'customer_lastname' => 'o.customer_lastname'))
34
+ ->addExpressionFieldToSelect(
35
+ 'shipping_fullname',
36
+ '(SELECT CONCAT({{shipping_customer_firstname}}, \' \', {{shipping_customer_lastname}})
37
+ FROM sales_flat_order_address a
38
+ WHERE o.shipping_address_id = a.entity_id)',
39
+ array('shipping_customer_firstname' => 'a.firstname', 'shipping_customer_lastname' => 'a.lastname'))
40
+ ->addExpressionFieldToSelect(
41
+ 'questions',
42
+ 'GROUP_CONCAT(DISTINCT {{questions}} SEPARATOR ", ")',
43
+ array('questions' => 'main_table.query'))
44
+ ->addExpressionFieldToSelect(
45
+ 'grouped_results',
46
+ 'GROUP_CONCAT(DISTINCT {{grouped_results}} SEPARATOR ":::")',
47
+ array('grouped_results' => 'main_table.results'))
48
+ ;
49
+ $collection->getSelect()->order('date','DESC');
50
+ $this->setCollection($collection);
51
+ parent::_prepareCollection();
52
+ return $this;
53
+ }
54
+ protected function _prepareColumns()
55
+ {
56
+ $helper = Mage::helper('nanorepwidgets');
57
+ $currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
58
+ $this->addColumn('product_id', array(
59
+ 'header' => $helper->__('Product #'),
60
+ 'index' => 'product_id',
61
+ ));
62
+ $this->addColumn('product_name', array(
63
+ 'header' => $helper->__('Products Purchased'),
64
+ 'index' => 'product_name',
65
+ ));
66
+ $this->addColumn('qty_ordered', array(
67
+ 'header' => $helper->__('Quantity'),
68
+ 'index' => 'qty_ordered',
69
+ ));
70
+ $this->addColumn('fullname', array(
71
+ 'header' => $helper->__('Bill to Name'),
72
+ 'index' => 'fullname',
73
+ 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)'
74
+ ));
75
+ $this->addColumn('shipping_fullname', array(
76
+ 'header' => $helper->__('Ship to Name'),
77
+ 'index' => 'shipping_fullname',
78
+ 'filter_index' => 'CONCAT(shipping_customer_firstname, \' \', shipping_customer_lastname)'
79
+ ));
80
+ $this->addColumn('grand_total', array(
81
+ 'header' => $helper->__('Purchased Price'),
82
+ 'index' => 'grand_total',
83
+ 'type' => 'currency',
84
+ 'currency_code' => $currency
85
+ ));
86
+
87
+ //Question(s) asked prior the submission
88
+ $this->addColumn('questions', array(
89
+ 'header' => $helper->__('Question(s) asked prior the submission'),
90
+ 'index' => 'questions',
91
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions_Pretty'
92
+ ));
93
+
94
+ $this->addColumn('grouped_results', array(
95
+ 'header' => $helper->__('Result(s) provided by nanoRep (Respectively)'),
96
+ 'index' => 'grouped_results',
97
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results_Pretty'
98
+ ));
99
+
100
+ $this->addColumn('purchased_on', array(
101
+ 'header' => $helper->__('Purchased On'),
102
+ 'type' => 'datetime',
103
+ 'index' => 'created_at'
104
+ ));
105
+ $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
106
+ $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
107
+ return parent::_prepareColumns();
108
+ }
109
+ public function getGridUrl()
110
+ {
111
+ return $this->getUrl('*/*/grid', array('_current'=>true));
112
+ }
113
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/View/Queries.php CHANGED
@@ -166,7 +166,7 @@ class NanoRep_Widgets_Block_Adminhtml_Order_View_Queries extends Mage_Adminhtml_
166
  $order = Mage::registry('current_order');
167
  $queryResourceModel = Mage::getResourceModel('nanorepwidgets/query');
168
  $read = $queryResourceModel->getReadConnection();
169
- $queries = $read->fetchAll("SELECT query, date FROM nanorep_query WHERE order_id = '{$order->getId()}'");
170
  return $queries;
171
  }
172
  }
166
  $order = Mage::registry('current_order');
167
  $queryResourceModel = Mage::getResourceModel('nanorepwidgets/query');
168
  $read = $queryResourceModel->getReadConnection();
169
+ $queries = $read->fetchAll("SELECT query, date FROM nanorepwidgets_query WHERE order_id = '{$order->getId()}'");
170
  return $queries;
171
  }
172
  }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Body.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $out = array();
15
+ if($value != ""){
16
+ $out[] = '<a href="#" onclick="$(\'answer_body_'.$row->getAnswerId().'_place_holder\').toggle();">Toggle Body</a>';
17
+ $out[] = '<div id="answer_body_'.$row->getAnswerId().'_place_holder" style="display:none;">';
18
+ }
19
+ $out[] = htmlspecialchars_decode($value);
20
+ if($value != ""){
21
+ $out[] = '</div>';
22
+ }
23
+ return join('',$out);
24
+ }
25
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Body/Pretty.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body_Pretty extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ return strip_tags(preg_replace('#<br\s*/?>#', "\n", htmlspecialchars_decode($value)));
15
+ }
16
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Title.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $out = array();
15
+ if($value != ""){
16
+ $value_arr = explode(':::', $value);
17
+ if(count($value_arr) > 0){
18
+ if(count($value_arr) > 1 && $value_arr[0] == "<Unanswered questions>" && $value_arr[1] != ""){
19
+ $out[] = '<a href="#" onclick="$(\'answer_query_'.$row->getAnswerId().'_place_holder\').toggle();">';
20
+ }
21
+ $out[] = htmlspecialchars($value_arr[0]);
22
+ if(count($value_arr) > 1 && $value_arr[0] == "<Unanswered questions>" && $value_arr[1] != ""){
23
+ $out[] = '</a>';
24
+ $out[] = '<div id="answer_query_'.$row->getAnswerId().'_place_holder" style="display:none;">';
25
+ $queries_arr = explode("###", $value_arr[1]);
26
+ foreach($queries_arr as $query){
27
+ $out[] = $query;
28
+ $out[] = "<br/>";
29
+ }
30
+ array_pop($out);
31
+ $out[] = '</div>';
32
+ }
33
+ }
34
+ }
35
+ return join('',$out);
36
+ }
37
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Title/Pretty.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title_Pretty extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $out = array();
15
+ if($value != ""){
16
+ $value_arr = explode(':::', $value);
17
+ if(count($value_arr) > 0){
18
+ // if(count($value_arr) > 1 && $value_arr[1] != ""){
19
+ // $out[] = '<a href="#" onclick="$(\'answer_query_'.$row->getAnswerId().'_place_holder\').toggle();">';
20
+ // }
21
+ $out[] = htmlspecialchars($value_arr[0]);
22
+ if(count($value_arr) > 1 && $value_arr[1] != ""){
23
+ // $out[] = '</a>';
24
+ // $out[] = '<div id="answer_query_'.$row->getAnswerId().'_place_holder" style="display:none;">';
25
+ $queries_arr = explode("###", $value_arr[1]);
26
+ foreach($queries_arr as $query){
27
+ $out[] = "\t".$query;
28
+ $out[] = "\n";
29
+ }
30
+ array_pop($out);
31
+ // $out[] = '</div>';
32
+ }
33
+ }
34
+ }
35
+ return join('',$out);
36
+ }
37
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Questions.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $value_array = explode(', ', $value);
15
+ $out = array();
16
+ $limit = 5;
17
+ foreach ($value_array as $question) {
18
+ if($limit > 0){
19
+ $out[] = '<span style="font-style:italic">' . $question . '</span>';
20
+ $out[] = '<br/>';
21
+ $limit--;
22
+ }
23
+ }
24
+ array_pop($out);
25
+ return join('', $out);
26
+ }
27
+
28
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Questions/Pretty.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions_Pretty extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $value_array = explode(', ', $value);
15
+ $out = array();
16
+ $limit = 5;
17
+ foreach ($value_array as $question) {
18
+ if($limit > 0){
19
+ $out[] = addslashes(strip_tags($question));
20
+ $out[] = "\n";
21
+ $limit--;
22
+ }
23
+ }
24
+ array_pop($out);
25
+ return join('', $out);
26
+ }
27
+
28
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $value_array = explode(':::', $value);
15
+ $out = array();
16
+ $limit = 5;
17
+ foreach ($value_array as $results) {
18
+ if($results != ""){
19
+ if($limit > 0){
20
+ $results = unserialize(trim($results));
21
+ foreach ($results as $aid => $result) {
22
+ $title = "";
23
+ $body = "";
24
+ foreach ($result as $key => $value) {
25
+ if($key == "title"){
26
+ $title = $value;
27
+ }
28
+ if($key == "body"){
29
+ $body = $value;
30
+ }
31
+ }
32
+ if($title != "" && $body != ""){
33
+ $out[] = $title . ' <a href="#" onclick="$(\'answer_body_'.$row->getQueryId().'_place_holder\').toggle();">Toggle Body</a>';
34
+ $out[] = '<div id="answer_body_'.$row->getQueryId().'_place_holder" style="display:none;">';
35
+ $out[] = $body;
36
+ $out[] = '</div>';
37
+ $out[] = '<br/>';
38
+ // $out[] = '<span style="font-weight:bold; text-decoration:underline; color: blue;" onMouseOver="this.style[\'text-decoration\'] = \'none\';" onMouseOut="this.style[\'text-decoration\'] = \'underline\';" title="'.$body.'">'.$title.'</span>';
39
+ // $out[] = ', ';
40
+ }
41
+ }
42
+ array_pop($out);
43
+ $out[] = '<br/>';
44
+ $limit--;
45
+ }
46
+ }
47
+ }
48
+ array_pop($out);
49
+ return join('', $out);
50
+ }
51
+
52
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results/Pretty.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results_Pretty extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
12
+ public function render(Varien_Object $row) {
13
+ $value = $row -> getData($this -> getColumn() -> getIndex());
14
+ $value_array = explode(':::', $value);
15
+ $out = array();
16
+ $limit = 5;
17
+ foreach ($value_array as $results) {
18
+ if($results != ""){
19
+ if($limit > 0){
20
+ $results = unserialize(trim($results));
21
+ foreach ($results as $aid => $result) {
22
+ $title = "";
23
+ $body = "";
24
+ foreach ($result as $key => $value) {
25
+ if($key == "title"){
26
+ $title = $value;
27
+ }
28
+ if($key == "body"){
29
+ $body = $value;
30
+ }
31
+ }
32
+ if($title != "" && $body != ""){
33
+ $out[] = addslashes(strip_tags($title))."\n";
34
+ $out[] = "\t".addslashes(strip_tags($body));
35
+ $out[] = "\n";
36
+ }
37
+ }
38
+ $limit--;
39
+ }
40
+ array_pop($out);
41
+ $out[] = '\n';
42
+ }
43
+ }
44
+ array_pop($out);
45
+ return join('', $out);
46
+ }
47
+
48
+ }
app/code/local/NanoRep/Widgets/Block/Customerhistoryjson.php CHANGED
@@ -1,13 +1,12 @@
1
  <?php
2
- /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
-
11
  class NanoRep_Widgets_Block_Customerhistoryjson extends Mage_Core_Block_Template
12
  {
13
  /**
1
  <?php
2
+ /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
 
10
  class NanoRep_Widgets_Block_Customerhistoryjson extends Mage_Core_Block_Template
11
  {
12
  /**
app/code/local/NanoRep/Widgets/Block/{Support.php → Embed.php} RENAMED
@@ -3,12 +3,12 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
10
 
11
- class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
12
  {
13
  public function getXml($forProduct = false)
14
  {
@@ -16,13 +16,13 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
16
  $server = "my.nanorep.com";
17
  $username = $helper -> getUsername();
18
  $password = $helper -> getPassword();
19
- $kb = $helper -> getSupportWidgetKb();
20
- $skip = $helper -> getSupportWidgetSkip();
21
- $maxItems = $helper -> getSupportWidgetMaxItems();
22
- $labelId = $helper -> getSupportWidgetLabelId();
23
- $textFilter = $helper -> getSupportWidgetTextFilter();
24
- $days = $helper -> getSupportWidgetDays();
25
- $byPopularity = ($helper -> getSupportWidgetByPopularity()) ? "true" : "false";
26
  $context = null;
27
  $product = $this -> getProduct();
28
  if (is_null($product) && !is_null(Mage::registry('current_product'))){
@@ -31,32 +31,15 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
31
  if($forProduct){
32
  $context = null;
33
  if($product){
34
- $productID = "";
35
- $productIdAttribute = Mage::getStoreConfig('nanorepwidgets/account_settings/product_id_attribute');
36
- if($productIdAttribute == "id"){
37
- $productID = $product->getId();
38
- }
39
- elseif($productIdAttribute == "sku"){
40
- $productID = $product->getsku();
41
- }
42
-
43
- if($productID == ""){
44
- if($product->getData($productIdAttribute) != ""){
45
- $productID = $product->getData($productIdAttribute);
46
- }
47
- else{
48
- $productID = $product->getAttributeText($productIdAttribute);
49
- }
50
- if($productID == ""){
51
- $productID = $product->getId();
52
- }
53
- }
54
 
55
  $context = array();
56
  $context["ProductID"] = $productID;
 
57
  }
58
  }
59
- $cacheTime = $helper -> getSupportWidgetCacheTimeout(); // how long to store the data in the cache (seconds)
60
 
61
  //////////////////////////////////////////////////////////////////////////
62
  // do not edit below this line
@@ -84,7 +67,9 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
84
  }
85
  $url = "https://".$server."/common/api/kbExport.xml?byPopularity=".$byPopularity."&username=".$username."&pw=".$password."&kb=".$kb."&skip=".$skip."&maxItems=".$maxItems."&days=".$days."&labelId=".$labelId."&textFilter=".$textFilter."&context=".$contextStr;
86
 
87
- Mage::log($url, null, "nanorep-general.log");
 
 
88
 
89
  $cache_file = Mage::getBaseDir('cache') . "/nanorepcachekb.txt";
90
  if($forProduct){
@@ -107,6 +92,35 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
107
  $this->drawContents($cache_file, $forProduct, $product);
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  private function drawContents($cachefile, $forProduct, $product)
111
  {
112
  $fileContent = file_get_contents($cachefile);
@@ -120,6 +134,9 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
120
  $kb_id = $attributes["kb"];
121
  $items = $xml->xpath("article");
122
  $out = "";
 
 
 
123
  $items_out = "";
124
  if(count($items) > 0){
125
  if($forProduct){
@@ -205,6 +222,9 @@ class NanoRep_Widgets_Block_Support extends Mage_Core_Block_Template
205
  if(!empty($items_out)){
206
  $out .= $items_out;
207
  $out .= '</div>';
 
 
 
208
  echo $out;
209
  }
210
 
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
 
11
+ class NanoRep_Widgets_Block_Embed extends Mage_Core_Block_Template
12
  {
13
  public function getXml($forProduct = false)
14
  {
16
  $server = "my.nanorep.com";
17
  $username = $helper -> getUsername();
18
  $password = $helper -> getPassword();
19
+ $kb = $helper -> getEmbededWidgetKb();
20
+ $skip = $helper -> getEmbededWidgetSkip();
21
+ $maxItems = $helper -> getEmbededWidgetMaxItems();
22
+ $labelId = $helper -> getEmbededWidgetLabelId();
23
+ $textFilter = $helper -> getEmbededWidgetTextFilter();
24
+ $days = $helper -> getEmbededWidgetDays();
25
+ $byPopularity = ($helper -> getEmbededWidgetByPopularity()) ? "true" : "false";
26
  $context = null;
27
  $product = $this -> getProduct();
28
  if (is_null($product) && !is_null(Mage::registry('current_product'))){
31
  if($forProduct){
32
  $context = null;
33
  if($product){
34
+ $productID = $this->_getProductId($product);
35
+ $category = $this->_getProductCategory($product);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  $context = array();
38
  $context["ProductID"] = $productID;
39
+ $context["Category"] = $category;
40
  }
41
  }
42
+ $cacheTime = $helper -> getEmbededWidgetCacheTimeout(); // how long to store the data in the cache (seconds)
43
 
44
  //////////////////////////////////////////////////////////////////////////
45
  // do not edit below this line
67
  }
68
  $url = "https://".$server."/common/api/kbExport.xml?byPopularity=".$byPopularity."&username=".$username."&pw=".$password."&kb=".$kb."&skip=".$skip."&maxItems=".$maxItems."&days=".$days."&labelId=".$labelId."&textFilter=".$textFilter."&context=".$contextStr;
69
 
70
+ if(Mage::getStoreConfigFlag('nanorepwidgets/embed_widget/debug')){
71
+ Mage::log($url, null, "nanorep-embeded-debug.log");
72
+ }
73
 
74
  $cache_file = Mage::getBaseDir('cache') . "/nanorepcachekb.txt";
75
  if($forProduct){
92
  $this->drawContents($cache_file, $forProduct, $product);
93
  }
94
 
95
+ private function _getProductId($_product){
96
+ $productIdAttribute = Mage::getStoreConfig('nanorepwidgets/account_settings/product_id_attribute');
97
+ $productID = $_product->getId();
98
+ if($productIdAttribute != "" && $productIdAttribute != "id"){
99
+ if($_product->getData($productIdAttribute) != ""){
100
+ $productID = $_product->getData($productIdAttribute);
101
+ }
102
+ else{
103
+ $productID = $_product->getAttributeText($productIdAttribute);
104
+ }
105
+ }
106
+ elseif($productIdAttribute == "sku"){
107
+ $productID = $_product->getsku();
108
+ }
109
+ return $productID;
110
+ }
111
+
112
+ private function _getProductCategory($_product){
113
+ $categories = array();
114
+ if(!is_null($_product)){
115
+ $cats = $_product->getCategoryIds();
116
+ foreach ($_product->getCategoryIds() as $cat_id) {
117
+ $category = Mage::getModel('catalog/category')->load($cat_id);
118
+ $categories[] = $category->getId();
119
+ }
120
+ return join(" ", $categories);
121
+ }
122
+ }
123
+
124
  private function drawContents($cachefile, $forProduct, $product)
125
  {
126
  $fileContent = file_get_contents($cachefile);
134
  $kb_id = $attributes["kb"];
135
  $items = $xml->xpath("article");
136
  $out = "";
137
+ if(Mage::helper('nanorepwidgets')->isEmbededWidgetQuestionsHidden()){
138
+ $out .= "<noscript>";
139
+ }
140
  $items_out = "";
141
  if(count($items) > 0){
142
  if($forProduct){
222
  if(!empty($items_out)){
223
  $out .= $items_out;
224
  $out .= '</div>';
225
+ if(Mage::helper('nanorepwidgets')->isEmbededWidgetQuestionsHidden()){
226
+ $out .= "</noscript>";
227
+ }
228
  echo $out;
229
  }
230
 
app/code/local/NanoRep/Widgets/Block/Events.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
- /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
 
1
  <?php
2
+ /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
 
app/code/local/NanoRep/Widgets/Block/Float.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Float extends Mage_Core_Block_Template
12
+ {
13
+
14
+ }
app/code/local/NanoRep/Widgets/Block/General.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- /**
3
- * NanoRep Widgets Extension
4
- *
5
- * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
- * @author Dan Aharon-Shalom
9
- */
10
-
11
- class NanoRep_Widgets_Block_General extends Mage_Core_Block_Template
12
- {
13
-
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/NanoRep/Widgets/Block/Header.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+ class NanoRep_Widgets_Block_Header extends Mage_Core_Block_Template
12
+ {
13
+ protected function _prepareLayout()
14
+ {
15
+ if(is_null($this->getProduct())){
16
+ $this->setProduct(Mage::registry('current_product'));
17
+ }
18
+ $this->_setContext();
19
+ $this->_setCustomParams();
20
+
21
+ parent::_prepareLayout();
22
+ }
23
+
24
+ private function _setContext(){
25
+ $context = array();
26
+ $context["Website"] = $_SERVER['HTTP_HOST'];
27
+ $_product = $this->getProduct();
28
+ if(!is_null($_product)){
29
+ $context["ProductID"] = $this->_getProductId($_product);
30
+ $context["Manufacturer"] = $_product->getAttributeText('manufacturer');
31
+ }
32
+ $this->setContext(Zend_Json::encode($context));
33
+ }
34
+
35
+ private function _setCustomParams(){
36
+ $_customParams = array();
37
+ $_customParams["userLoggedIn"] = $this->_isUserLoggedIn();
38
+ $_customParams["orders"] = $this->_getCustomerOrdersStatuses();
39
+ /** @var Mage_Catalog_Model_Product */
40
+ $_product = $this->getProduct();
41
+ if(!is_null($_product)){
42
+ $_customParams["productName"] = htmlspecialchars($_product->getName());
43
+ $_customParams["ProductID"] = $this->_getProductId($_product);
44
+ if(count($_product->getTypeInstance(true)->getOrderOptions($_product)) == 0){
45
+ $_customParams["addToCartUrl"] = Mage::helper('checkout/cart')->getAddUrl($_product);
46
+ }
47
+ $_customParams["Category"] = $this->_getProductCategory($_product);
48
+ $_customParams["Price"] = Mage::helper('core')->currency($_product->getFinalPrice(), true, false);
49
+
50
+ $_customParams["relatedProducts"] = $this->_getProductRelatedProducts($_product);
51
+ $_customParams["upSellsProducts"] = $this->_getProductUpSellsProducts($_product);
52
+ $_customParams["crossSellsProducts"] = $this->_getProductCrossSellProducts($_product);
53
+ $_customParams["bundleProducts"] = $this->_getProductBundleItems($_product);
54
+ $_customParams = array_merge($_customParams, $this->_getProductAttributes($_product));
55
+ }
56
+ $this->setCustomParams(Zend_Json::encode($_customParams));
57
+ }
58
+
59
+ private function _isUserLoggedIn(){
60
+ $session = Mage::getSingleton('customer/session');
61
+ // $customer = $session->getCustomer();
62
+ if($session->isLoggedIn()){
63
+ return "true";
64
+ }
65
+ return "false";
66
+ }
67
+
68
+ private function _getCustomerOrdersStatuses(){
69
+ $session = Mage::getSingleton('customer/session');
70
+ $customer = $session->getCustomer();
71
+ if($customer){
72
+ if(Mage::getStoreConfigFlag('nanorepwidgets/orders_status/active')){
73
+ $orders = array();
74
+ $statuses = array(Mage_Sales_Model_Order::STATE_PROCESSING,Mage_Sales_Model_Order::STATE_NEW, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, "pending");
75
+ if(Mage::getStoreConfigFlag('nanorepwidgets/orders_status/active_pages')){
76
+ $module = $this->getRequest()->getModuleName();
77
+ if($module == 'customer' || $module == 'sales'){
78
+ $orderCollection = Mage::getModel('sales/order')->getCollection()
79
+ ->addFieldToFilter('customer_id', array('eq' => array($customer->getId())))
80
+ ->addFieldToFilter('status', array('in' => $statuses));
81
+ foreach($orderCollection AS $order_row){
82
+ $status = $order_row->getStatus();
83
+ $link = $this->getUrl('sales/order/view', array('order_id' =>$order_row->getId()));
84
+ $orders["orders"][] = array($order_row->getIncrementId() => array(
85
+ "status" => $status,
86
+ "link" => $link
87
+ ));
88
+ }
89
+ }
90
+ }
91
+ else{
92
+ $orderCollection = Mage::getModel('sales/order')->getCollection()
93
+ ->addFieldToFilter('customer_id', array('eq' => array($customer->getId())))
94
+ ->addFieldToFilter('status', array('in' => $statuses));
95
+ foreach($orderCollection AS $order_row){
96
+ $status = $order_row->getStatus();
97
+ $link = $this->getUrl('sales/order/view', array('order_id' =>$order_row->getId()));
98
+ $orders[] = array($order_row->getIncrementId() => array(
99
+ "status" => $status,
100
+ "link" => $link
101
+ ));
102
+ }
103
+ }
104
+ if(!empty($orders)){
105
+ return Zend_Json::encode($orders);
106
+ }
107
+
108
+ return "";
109
+ }
110
+ }
111
+ }
112
+
113
+ private function _getProductId($_product){
114
+ $productIdAttribute = Mage::getStoreConfig('nanorepwidgets/account_settings/product_id_attribute');
115
+ $productID = $_product->getId();
116
+ if($productIdAttribute != "" && $productIdAttribute != "id"){
117
+ if($_product->getData($productIdAttribute) != ""){
118
+ $productID = $_product->getData($productIdAttribute);
119
+ }
120
+ else{
121
+ $productID = $_product->getAttributeText($productIdAttribute);
122
+ }
123
+ }
124
+ elseif($productIdAttribute == "sku"){
125
+ $productID = $_product->getsku();
126
+ }
127
+ return $productID;
128
+ }
129
+
130
+ private function _getProductCategory($_product){
131
+ $categories = array();
132
+ if(!is_null($_product)){
133
+ $cats = $_product->getCategoryIds();
134
+ foreach ($_product->getCategoryIds() as $cat_id) {
135
+ $category = Mage::getModel('catalog/category')->load($cat_id);
136
+ $categories[] = $category->getId();
137
+ }
138
+ return join(" ", $categories);
139
+ }
140
+ }
141
+
142
+ private function _getProductRelatedProducts($product){
143
+ if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/related_products')){
144
+ $related_product_collection = $product->getRelatedProductCollection()->addAttributeToSelect("*");
145
+ if($related_product_collection->count() > 0){
146
+ $related_products = array();
147
+ foreach($related_product_collection as $_product){
148
+ $related_products[] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
149
+ }
150
+ return $related_products;
151
+ }
152
+ }
153
+ }
154
+
155
+ private function _getProductUpSellsProducts($product){
156
+ if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/upsells_products')){
157
+ $upsells_product_collection = $product->getUpSellProductCollection()->addAttributeToSelect("*");
158
+ if($upsells_product_collection->count() > 0){
159
+ $upsells_products = array();
160
+ foreach($upsells_product_collection as $_product){
161
+ $upsells_products[] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
162
+ }
163
+ return $upsells_products;
164
+ }
165
+ }
166
+ }
167
+
168
+ private function _getProductCrossSellProducts($product){
169
+ if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/crosssells_products')){
170
+ $crosssells_product_collection = $product->getCrossSellProductCollection()->addAttributeToSelect("*");
171
+ if($crosssells_product_collection->count() > 0){
172
+ $crosssells_products = array();
173
+ foreach($crosssells_product_collection as $_product){
174
+ $crosssells_products[] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
175
+ }
176
+ return $crosssells_products;
177
+ }
178
+ }
179
+ }
180
+
181
+ private function _getProductBundleItems($product){
182
+ $product_bundle_items = $product->getTypeInstance(true)->getChildrenIds($product->getId(), false);
183
+ if(!is_null($product_bundle_items) && count($product_bundle_items) > 0){
184
+ $bundle_products = array();
185
+ foreach($product_bundle_items as $_option){
186
+ foreach($_option as $_product_id){
187
+ $_product = Mage::getModel('catalog/product')->load($_product_id);
188
+ $bundle_products[] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
189
+ }
190
+ }
191
+ return $bundle_products;
192
+ }
193
+ }
194
+
195
+ private function _getProductAttributes($_product)
196
+ {
197
+ $output = array();
198
+ $attributes = $_product->getAttributes();
199
+ $total_attributes = 0;
200
+ $use_hidden_attributes = Mage::getStoreConfigFlag('nanorepwidgets/account_settings/hidden_attributes');
201
+ $selected_attributes = $this->helper('nanorepwidgets')->getAttributes();
202
+ foreach ($attributes as $attribute) {
203
+ if ($selected_attributes[0] == "all"){
204
+ if($attribute->getAttributeCode() != "price")
205
+ $total_attributes++;
206
+ }
207
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
208
+ $total_attributes++;
209
+ }
210
+ }
211
+ foreach ($attributes as $attribute) {
212
+ if ($selected_attributes[0] == "all"){
213
+ if($attribute->getAttributeCode() != "price"){
214
+ if(is_string($attribute->getFrontend()->getValue($_product))){
215
+ $output[$attribute->getAttributeCode()] = str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product))))))));
216
+ //echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product)))))))).'"';
217
+ // do something with $value here
218
+ //if($total_attributes > 1)
219
+ // echo ",\n";
220
+ }
221
+ $total_attributes--;
222
+ }
223
+ }
224
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
225
+ if(is_string($attribute->getFrontend()->getValue($_product))){
226
+ $output[$attribute->getAttributeCode()] = str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product))))))));
227
+ //echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product)))))))).'"';
228
+ // do something with $value here
229
+ //if($total_attributes > 1)
230
+ // echo ",\n";
231
+ }
232
+ $total_attributes--;
233
+ }
234
+ }
235
+ return $output;
236
+ }
237
+ }
app/code/local/NanoRep/Widgets/Block/Success.php CHANGED
@@ -3,10 +3,10 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
10
 
11
  class NanoRep_Widgets_Block_Success extends Mage_Core_Block_Template
12
  {
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
 
11
  class NanoRep_Widgets_Block_Success extends Mage_Core_Block_Template
12
  {
app/code/local/NanoRep/Widgets/Block/Top.php DELETED
@@ -1,169 +0,0 @@
1
- <?php
2
- /**
3
- * NanoRep Widgets Extension
4
- *
5
- * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
- * @author Dan Aharon-Shalom
9
- */
10
-
11
- class NanoRep_Widgets_Block_Top extends Mage_Core_Block_Template
12
- {
13
- public function getCustomerOrdersStatuses(){
14
- $session = Mage::getSingleton('customer/session');
15
- $customer = $session->getCustomer();
16
- if($customer){
17
- if(Mage::getStoreConfigFlag('nanorepwidgets/orders_status/active')){
18
- $orders = array();
19
- $statuses = array(Mage_Sales_Model_Order::STATE_PROCESSING,Mage_Sales_Model_Order::STATE_NEW, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, "pending");
20
- if(Mage::getStoreConfigFlag('nanorepwidgets/orders_status/active_pages')){
21
- $module = $this->getRequest()->getModuleName();
22
- if($module == 'customer' || $module == 'sales'){
23
- $orderCollection = Mage::getModel('sales/order')->getCollection()
24
- ->addFieldToFilter('customer_id', array('eq' => array($customer->getId())))
25
- ->addFieldToFilter('status', array('in' => $statuses));
26
- foreach($orderCollection AS $order_row){
27
- $status = $order_row->getStatus();
28
- $link = $this->getUrl('sales/order/view', array('order_id' =>$order_row->getId()));
29
- $orders["orders"][] = array($order_row->getIncrementId() => array(
30
- "status" => $status,
31
- "link" => $link
32
- ));
33
- }
34
- }
35
- }
36
- else{
37
- $orderCollection = Mage::getModel('sales/order')->getCollection()
38
- ->addFieldToFilter('customer_id', array('eq' => array($customer->getId())))
39
- ->addFieldToFilter('status', array('in' => $statuses));
40
- foreach($orderCollection AS $order_row){
41
- $status = $order_row->getStatus();
42
- $link = $this->getUrl('sales/order/view', array('order_id' =>$order_row->getId()));
43
- $orders["orders"][] = array($order_row->getIncrementId() => array(
44
- "status" => $status,
45
- "link" => $link
46
- ));
47
- }
48
- }
49
- if(!empty($orders)){
50
- echo substr(Zend_Json::encode($orders), 1, strlen(Zend_Json::encode($orders)) - 2) . ",";
51
- }
52
- }
53
- }
54
- }
55
-
56
- public function isUserLoggedIn(){
57
- $session = Mage::getSingleton('customer/session');
58
- // $customer = $session->getCustomer();
59
- if($session->isLoggedIn()){
60
- return "true";
61
- }
62
- return "false";
63
- }
64
-
65
- public function getCategory(){
66
- $_product = null;
67
- if(!is_null($this->getProduct())){
68
- $_product = $this->getProduct();
69
- }
70
- elseif(!is_null(Mage::registry('current_product'))) {
71
- $_product = Mage::registry('current_product');
72
- }
73
- else{
74
- $_product = null;
75
- }
76
- $categories = array();
77
- if(!is_null($_product)){
78
- $cats = $_product->getCategoryIds();
79
- foreach ($_product->getCategoryIds() as $cat_id) {
80
- $category = Mage::getModel('catalog/category')->load($cat_id);
81
- $categories[] = $category->getId();
82
- }
83
- echo '"Category": "'. join(",", $categories) . '",' . "\n";
84
- }
85
-
86
- // $category = Mage::registry('current_category');
87
- // if(!is_null($category)){
88
- // echo '"Category": "'. $category->getId() . '",';
89
- // }
90
- }
91
-
92
- public function getProductRelatedProducts($product){
93
- if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/related_products')){
94
- $related_product_collection = $product->getRelatedProductCollection()->addAttributeToSelect("*");
95
- if($related_product_collection->count() > 0){
96
- $related_products = array();
97
- foreach($related_product_collection as $_product){
98
- $related_products["relatedProducts"][] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
99
- }
100
- echo substr(Zend_Json::encode($related_products), 1, strlen(Zend_Json::encode($related_products)) - 2) . ",";
101
- }
102
- }
103
- }
104
-
105
- public function getProductUpSellsProducts($product){
106
- if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/upsells_products')){
107
- $upsells_product_collection = $product->getUpSellProductCollection()->addAttributeToSelect("*");
108
- if($upsells_product_collection->count() > 0){
109
- $upsells_products = array();
110
- foreach($upsells_product_collection as $_product){
111
- $upsells_products["upSellsProducts"][] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
112
- }
113
- echo substr(Zend_Json::encode($upsells_products), 1, strlen(Zend_Json::encode($upsells_products)) - 2) . ",";
114
- }
115
- }
116
- }
117
-
118
- public function getProductCrossSellProducts($product){
119
- if(Mage::getStoreConfigFlag('nanorepwidgets/account_settings/crosssells_products')){
120
- $crosssells_product_collection = $product->getCrossSellProductCollection()->addAttributeToSelect("*");
121
- if($crosssells_product_collection->count() > 0){
122
- $crosssells_products = array();
123
- foreach($crosssells_product_collection as $_product){
124
- $crosssells_products["crossSellsProducts"][] = array("name" => $_product->getName(), "short_description" => $_product->getShortDescription(), "image_url" => $_product->getImageUrl(), "url" => $_product->getProductUrl());
125
- }
126
- echo substr(Zend_Json::encode($crosssells_products), 1, strlen(Zend_Json::encode($crosssells_products)) - 2) . ",";
127
- }
128
- }
129
- }
130
-
131
- public function getProductAttributes($product)
132
- {
133
- $attributes = $product->getAttributes();
134
- $total_attributes = 0;
135
- $use_hidden_attributes = Mage::getStoreConfigFlag('nanorepwidgets/account_settings/hidden_attributes');
136
- $selected_attributes = $this->helper('nanorepwidgets')->getAttributes();
137
- foreach ($attributes as $attribute) {
138
- if ($selected_attributes[0] == "all"){
139
- if($attribute->getAttributeCode() != "price")
140
- $total_attributes++;
141
- }
142
- elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
143
- $total_attributes++;
144
- }
145
- }
146
- foreach ($attributes as $attribute) {
147
- if ($selected_attributes[0] == "all"){
148
- if($attribute->getAttributeCode() != "price"){
149
- if(is_string($attribute->getFrontend()->getValue($product))){
150
- echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($product)))))))).'"';
151
- // do something with $value here
152
- if($total_attributes > 1)
153
- echo ",\n";
154
- }
155
- $total_attributes--;
156
- }
157
- }
158
- elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
159
- if(is_string($attribute->getFrontend()->getValue($product))){
160
- echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($product)))))))).'"';
161
- // do something with $value here
162
- if($total_attributes > 1)
163
- echo ",\n";
164
- }
165
- $total_attributes--;
166
- }
167
- }
168
- }
169
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/NanoRep/Widgets/Helper/Data.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php
2
- /**
3
- * TravelersBox Api Extension
4
  *
5
- * @package TravelersBox_Api
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
 
10
 
11
  class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
12
  {
@@ -14,15 +15,16 @@ class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
14
  return Mage::getStoreConfig("nanorepwidgets/account_settings/account_name");
15
  }
16
 
17
- public function isFloatWidgetActive(){
18
  if(Mage::getStoreConfigFlag("nanorepwidgets/float_widget/active_pages")){
19
  $module = Mage::app()->getRequest()->getModuleName();
20
  $controller = Mage::app()->getRequest()->getControllerName();
21
- return(($module == 'catalog' && $controller == 'product') && Mage::getStoreConfigFlag("nanorepwidgets/float_widget/active"));
22
- }
23
- else{
24
- return Mage::getStoreConfigFlag("nanorepwidgets/float_widget/active");
25
  }
 
 
 
 
26
  }
27
 
28
  public function getUsername(){
@@ -37,73 +39,69 @@ class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
37
  return (is_null(Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"))) ? array(): explode(',', Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"));
38
  }
39
 
40
- public function isSupportWidgetEnabled(){
41
- return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/active");
42
  }
43
 
44
- public function isSupportWidgetQuestionsHidden(){
45
- return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/question_hidden");
46
  }
47
-
48
- // public function getSupportWidgetUsername(){
49
- // return Mage::getStoreConfig("nanorepwidgets/support_widget/username");
50
- // }
51
-
52
- // public function getSupportWidgetPassword(){
53
- // return Mage::getStoreConfig("nanorepwidgets/support_widget/password");
54
- // }
55
 
56
- public function getSupportWidgetWidth(){
57
- return Mage::getStoreConfig("nanorepwidgets/support_widget/width");
 
58
  }
59
 
60
- public function getSupportWidgetMaxHeight(){
61
- return Mage::getStoreConfig("nanorepwidgets/support_widget/max_height");
62
  }
63
 
 
 
 
64
 
65
- public function getSupportWidgetFaqNum(){
66
- return Mage::getStoreConfig("nanorepwidgets/support_widget/faq_num");
67
  }
68
 
69
- public function getSupportWidgetKb(){
70
- return Mage::getStoreConfig("nanorepwidgets/support_widget/kb");
71
  }
72
 
73
- public function getSupportWidgetSkip(){
74
- return Mage::getStoreConfig("nanorepwidgets/support_widget/skip");
75
  }
76
 
77
- public function getSupportWidgetByPopularity(){
78
- return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/by_popularity");
79
  }
80
 
81
- public function getSupportWidgetDays(){
82
- return Mage::getStoreConfig("nanorepwidgets/support_widget/days");
83
  }
84
 
85
- public function getSupportWidgetLabelId(){
86
- return Mage::getStoreConfig("nanorepwidgets/support_widget/label_id");
87
  }
88
 
89
- public function getSupportWidgetTextFilter(){
90
- return Mage::getStoreConfig("nanorepwidgets/support_widget/text_filter");
91
  }
92
 
93
- public function getSupportWidgetProductFaqHeadline(){
94
- return Mage::getStoreConfig("nanorepwidgets/support_widget/product_faq_headline");
95
  }
96
 
97
- // public function getSupportWidgetGeneralFaqHeadline(){
98
- // return Mage::getStoreConfig("nanorepwidgets/support_widget/general_faq_headline");
99
  // }
100
 
101
- public function getSupportWidgetMaxItems(){
102
- return Mage::getStoreConfig("nanorepwidgets/support_widget/max_items");
103
  }
104
 
105
- public function getSupportWidgetCacheTimeout(){
106
- return Mage::getStoreConfig("nanorepwidgets/support_widget/cache_timeout");
107
  }
108
 
109
  public function getStoreQueryInCookieUrl(){
1
  <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
+
11
 
12
  class NanoRep_Widgets_Helper_Data extends Mage_Core_Helper_Abstract
13
  {
15
  return Mage::getStoreConfig("nanorepwidgets/account_settings/account_name");
16
  }
17
 
18
+ public function isFloatWidgetActiveForCurrentPage(){
19
  if(Mage::getStoreConfigFlag("nanorepwidgets/float_widget/active_pages")){
20
  $module = Mage::app()->getRequest()->getModuleName();
21
  $controller = Mage::app()->getRequest()->getControllerName();
22
+ return($module == 'catalog' && $controller == 'product');
 
 
 
23
  }
24
+ else{
25
+ return true;
26
+ }
27
+
28
  }
29
 
30
  public function getUsername(){
39
  return (is_null(Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"))) ? array(): explode(',', Mage::getStoreConfig("nanorepwidgets/account_settings/attribute_select"));
40
  }
41
 
42
+ public function isEmbededWidgetEnabled(){
43
+ return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/active");
44
  }
45
 
46
+ public function isEmbededWidgetQuestionsHidden(){
47
+ return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/question_hidden");
48
  }
 
 
 
 
 
 
 
 
49
 
50
+
51
+ public function getEmbededWidgetWidth(){
52
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/width");
53
  }
54
 
55
+ public function getEmbededWidgetMaxHeight(){
56
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/max_height");
57
  }
58
 
59
+ public function getEmbededWidgetDivCss(){
60
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/div_css");
61
+ }
62
 
63
+ public function getEmbededWidgetFaqNum(){
64
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/faq_num");
65
  }
66
 
67
+ public function getEmbededWidgetKb(){
68
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/kb");
69
  }
70
 
71
+ public function getEmbededWidgetSkip(){
72
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/skip");
73
  }
74
 
75
+ public function getEmbededWidgetByPopularity(){
76
+ return Mage::getStoreConfigFlag("nanorepwidgets/embed_widget/by_popularity");
77
  }
78
 
79
+ public function getEmbededWidgetDays(){
80
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/days");
81
  }
82
 
83
+ public function getEmbededWidgetLabelId(){
84
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/label_id");
85
  }
86
 
87
+ public function getEmbededWidgetTextFilter(){
88
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/text_filter");
89
  }
90
 
91
+ public function getEmbededWidgetProductFaqHeadline(){
92
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/product_faq_headline");
93
  }
94
 
95
+ // public function getEmbededWidgetGeneralFaqHeadline(){
96
+ // return Mage::getStoreConfig("nanorepwidgets/embed_widget/general_faq_headline");
97
  // }
98
 
99
+ public function getEmbededWidgetMaxItems(){
100
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/max_items");
101
  }
102
 
103
+ public function getEmbededWidgetCacheTimeout(){
104
+ return Mage::getStoreConfig("nanorepwidgets/embed_widget/cache_timeout");
105
  }
106
 
107
  public function getStoreQueryInCookieUrl(){
app/code/local/NanoRep/Widgets/Model/Answer.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Model_Answer extends Mage_Core_Model_Abstract
11
+ {
12
+ /**
13
+ * Initialize resource model
14
+ */
15
+ protected function _construct()
16
+ {
17
+ $this->_init('nanorepwidgets/answer');
18
+ }
19
+ }
20
+
app/code/local/NanoRep/Widgets/Model/History.php CHANGED
@@ -3,8 +3,8 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
 
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
 
app/code/local/NanoRep/Widgets/Model/Mysql4/Setup.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- /**
3
- * NanoRep Widgets Extension
4
- *
5
- * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
- * @author Dan Aharon-Shalom
9
- */
10
-
11
- class NanoRep_Widgets_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup {
12
-
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/NanoRep/Widgets/Model/Observer.php CHANGED
@@ -3,8 +3,8 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
 
@@ -22,10 +22,6 @@ class NanoRep_Widgets_Model_Observer
22
  */
23
  public function setNanoRepWidgetOnOrderSuccessPageView(Varien_Event_Observer $observer)
24
  {
25
- // $orderIds = $observer->getEvent()->getOrderIds();
26
- // if (empty($orderIds) || !is_array($orderIds)) {
27
- // return;
28
- // }
29
  $block = Mage::app()->getFrontController()->getAction()->getLayout()->createBlock(
30
  'NanoRep_Widgets_Block_Success',
31
  'nanorep_success_widget');
@@ -36,17 +32,23 @@ class NanoRep_Widgets_Model_Observer
36
 
37
  if($this->_isThereNanoRepQueryInCustomerSession()){
38
  $queries = $this->_getNanorepQueries();
39
- foreach($queries as $query){
40
- $queryModel = Mage::getModel('nanorepwidgets/query');
41
- $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
42
- $order = Mage::getSingleton('sales/order');
43
- $order->load($lastOrderId);
44
- $queryModel->setOrderId($order->getId());
45
- $queryModel->setQuery($query);
46
- $queryModel->setDate(Mage::getModel('core/date')->timestamp(time()));
47
- $queryModel->save();
48
- $this->_session->clear();
 
 
 
 
 
49
  }
 
50
  }
51
  }
52
 
@@ -60,4 +62,6 @@ class NanoRep_Widgets_Model_Observer
60
  return $queries;
61
  }
62
 
 
 
63
  }
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
 
22
  */
23
  public function setNanoRepWidgetOnOrderSuccessPageView(Varien_Event_Observer $observer)
24
  {
 
 
 
 
25
  $block = Mage::app()->getFrontController()->getAction()->getLayout()->createBlock(
26
  'NanoRep_Widgets_Block_Success',
27
  'nanorep_success_widget');
32
 
33
  if($this->_isThereNanoRepQueryInCustomerSession()){
34
  $queries = $this->_getNanorepQueries();
35
+ foreach($queries as $product_id => $product_queries){
36
+ foreach ($product_queries as $query => $results) {
37
+ if(!is_null($query)){
38
+ $queryModel = Mage::getModel('nanorepwidgets/query');
39
+ $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
40
+ $order = Mage::getSingleton('sales/order');
41
+ $order->load($lastOrderId);
42
+ $queryModel->setProductId($product_id);
43
+ $queryModel->setOrderId($order->getId());
44
+ $queryModel->setQuery($query);
45
+ $queryModel->setResults($results);
46
+ $queryModel->setDate(Mage::getModel('core/date')->timestamp(time()));
47
+ $queryModel->save();
48
+ }
49
+ }
50
  }
51
+ $this->_session->clear();
52
  }
53
  }
54
 
62
  return $queries;
63
  }
64
 
65
+
66
+
67
  }
app/code/local/NanoRep/Widgets/Model/Query.php CHANGED
@@ -3,16 +3,19 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
- class NanoRep_Widgets_Model_Query extends Mage_Core_Model_Abstract {
 
 
11
  /**
12
- * Initialize resources
13
  */
14
  protected function _construct()
15
  {
16
  $this->_init('nanorepwidgets/query');
17
  }
18
- }
 
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
+
11
+ class NanoRep_Widgets_Model_Query extends Mage_Core_Model_Abstract
12
+ {
13
  /**
14
+ * Initialize resource model
15
  */
16
  protected function _construct()
17
  {
18
  $this->_init('nanorepwidgets/query');
19
  }
20
+ }
21
+
app/code/local/NanoRep/Widgets/Model/Resource/Answer.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Model_Resource_Answer extends Mage_Core_Model_Resource_Db_Abstract{
11
+ protected function _construct()
12
+ {
13
+ $this->_init('nanorepwidgets/answer', 'entity_id');
14
+ }
15
+ }
app/code/local/NanoRep/Widgets/Model/Resource/Answer/Collection.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Model_Resource_Answer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
11
+ {
12
+ /**
13
+ * Event prefix
14
+ *
15
+ * @var string
16
+ */
17
+ protected $_eventPrefix = 'nanorep_answer_collection';
18
+
19
+ /**
20
+ * Event object
21
+ *
22
+ * @var string
23
+ */
24
+ protected $_eventObject = 'answer_collection';
25
+
26
+ /**
27
+ * Model initialization
28
+ *
29
+ */
30
+ protected function _construct()
31
+ {
32
+ $this->_init('nanorepwidgets/answer');
33
+ $this
34
+ ->addFilterToMap('entity_id', 'main_table.entity_id')
35
+ ->addFilterToMap('product_id', 'main_table.product_id');
36
+ }
37
+ }
app/code/local/NanoRep/Widgets/Model/{Mysql4 → Resource}/Query.php RENAMED
@@ -3,11 +3,11 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
- class NanoRep_Widgets_Model_Mysql4_Query extends Mage_Core_Model_Mysql4_Abstract{
11
  protected function _construct()
12
  {
13
  $this->_init('nanorepwidgets/query', 'query_id');
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
+ class NanoRep_Widgets_Model_Resource_Query extends Mage_Core_Model_Resource_Db_Abstract{
11
  protected function _construct()
12
  {
13
  $this->_init('nanorepwidgets/query', 'query_id');
app/code/local/NanoRep/Widgets/Model/Resource/Query/Collection.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Sales
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Flat sales order collection
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Sales
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class NanoRep_Widgets_Model_Resource_Query_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
36
+ {
37
+ /**
38
+ * Event prefix
39
+ *
40
+ * @var string
41
+ */
42
+ protected $_eventPrefix = 'nanorep_query_collection';
43
+
44
+ /**
45
+ * Event object
46
+ *
47
+ * @var string
48
+ */
49
+ protected $_eventObject = 'query_collection';
50
+
51
+ /**
52
+ * Model initialization
53
+ *
54
+ */
55
+ protected function _construct()
56
+ {
57
+ $this->_init('nanorepwidgets/query');
58
+ $this
59
+ ->addFilterToMap('entity_id', 'main_table.query_id')
60
+ ->addFilterToMap('order_id', 'main_table.order_id')
61
+ ->addFilterToMap('product_id', 'main_table.product_id');
62
+ }
63
+ }
app/code/local/NanoRep/Widgets/Model/Resource/Setup.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+
12
+ class NanoRep_Widgets_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
13
+ {
14
+ }
app/code/local/NanoRep/Widgets/Model/Session.php CHANGED
@@ -1,27 +1,11 @@
1
  <?php
2
  /**
3
- * Magento
4
  *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Checkout
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
  */
26
 
27
 
1
  <?php
2
  /**
3
+ * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
 
11
 
app/code/local/NanoRep/Widgets/Model/{Adminhtml/System → System}/Config/Source/Attribute.php RENAMED
@@ -3,11 +3,11 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
10
- class NanoRep_Widgets_Model_Adminhtml_System_Config_Source_Attribute
11
  {
12
  protected $_options;
13
 
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Model_System_Config_Source_Attribute
11
  {
12
  protected $_options;
13
 
app/code/local/NanoRep/Widgets/Model/System/Config/Source/FloatWidgetActivePages.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * NanoRep Widgets Extension
4
  *
5
- * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
- * @author Dan Aharon-Shalom
9
- */
10
 
11
  class Nanorep_Widgets_Model_System_Config_Source_FloatWidgetActivePages {
12
  public function toOptionArray() {
2
  /**
3
  * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
 
11
  class Nanorep_Widgets_Model_System_Config_Source_FloatWidgetActivePages {
12
  public function toOptionArray() {
app/code/local/NanoRep/Widgets/Model/System/Config/Source/OrdersStatusActivePages.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * NanoRep Widgets Extension
4
  *
5
- * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
- * @author Dan Aharon-Shalom
9
- */
10
 
11
  class Nanorep_Widgets_Model_System_Config_Source_OrdersStatusActivePages {
12
  public function toOptionArray() {
2
  /**
3
  * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
 
11
  class Nanorep_Widgets_Model_System_Config_Source_OrdersStatusActivePages {
12
  public function toOptionArray() {
app/code/local/NanoRep/Widgets/Model/{Adminhtml/System → System}/Config/Source/ProductIdAttribute.php RENAMED
@@ -3,11 +3,11 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
10
- class NanoRep_Widgets_Model_Adminhtml_System_Config_Source_ProductIdAttribute
11
  {
12
  protected $_options;
13
 
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
+ class NanoRep_Widgets_Model_System_Config_Source_ProductIdAttribute
11
  {
12
  protected $_options;
13
 
app/code/local/NanoRep/Widgets/controllers/Adminhtml/AnswerController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class Nanorep_Widgets_Adminhtml_AnswerController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ public function indexAction()
13
+ {
14
+ $this->_title($this->__('Sales'))->_title($this->__('nanoRep search report'));
15
+ $this->loadLayout();
16
+ $this->_setActiveMenu('sales/sales');
17
+ $this->_addContent($this->getLayout()->createBlock('nanorepwidgets/adminhtml_answer'));
18
+ $this->renderLayout();
19
+ }
20
+ public function gridAction()
21
+ {
22
+ $this->loadLayout();
23
+ $this->getResponse()->setBody(
24
+ $this->getLayout()->createBlock('nanorepwidgets/adminhtml_answer_grid')->toHtml()
25
+ );
26
+ }
27
+ public function exportCsvAction()
28
+ {
29
+ $fileName = 'nanorep_search_report.csv';
30
+ $grid = $this->getLayout()->createBlock('nanorepwidgets/adminhtml_answer_grid_export');
31
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
32
+ }
33
+ public function exportExcelAction()
34
+ {
35
+ $fileName = 'nanorep_search_report.xls';
36
+ $grid = $this->getLayout()->createBlock('nanorepwidgets/adminhtml_answer_grid_export');
37
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
38
+ }
39
+ }
app/code/local/NanoRep/Widgets/controllers/Adminhtml/MynanorepController.php CHANGED
@@ -3,8 +3,8 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_Adminhtml_MynanorepController extends Mage_Adminhtml_Controller_Action
@@ -32,19 +32,4 @@ class NanoRep_Widgets_Adminhtml_MynanorepController extends Mage_Adminhtml_Contr
32
  // var_dump($grid);
33
  $this->renderLayout();
34
  }
35
-
36
- // public function getlinkAction(){
37
- // $email = $this->getRequest()->getParam("email");
38
- // $error = null;
39
- // $response = array();
40
- // if(is_null($email) || $email == "")
41
- // $error = "Missing customer email argument";
42
- //
43
- // if(!is_null($error)){
44
- // $this->getResponse()->setBody(Zend_Json::encode(array("error" => $error)));
45
- // }
46
- // else{
47
- // $this->getResponse()->setBody(Zend_Json::encode(array("url" => Mage::helper('adminhtml')->getUrl('*/*/getcustomerhistory', array("email" => $email)))));
48
- // }
49
- // }
50
  }
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_Adminhtml_MynanorepController extends Mage_Adminhtml_Controller_Action
32
  // var_dump($grid);
33
  $this->renderLayout();
34
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
app/code/local/NanoRep/Widgets/controllers/Adminhtml/OrderController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ class Nanorep_Widgets_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ public function indexAction()
13
+ {
14
+ $this->_title($this->__('Sales'))->_title($this->__('Purchases Assisted by nanoRep'));
15
+ $this->loadLayout();
16
+ $this->_setActiveMenu('sales/sales');
17
+ $this->_addContent($this->getLayout()->createBlock('nanorepwidgets/adminhtml_order'));
18
+ $this->renderLayout();
19
+ }
20
+ public function gridAction()
21
+ {
22
+ $this->loadLayout();
23
+ $this->getResponse()->setBody(
24
+ $this->getLayout()->createBlock('nanorepwidgets/adminhtml_order_grid')->toHtml()
25
+ );
26
+ }
27
+ public function exportCsvAction()
28
+ {
29
+ $fileName = 'nanorep_conversion_report.csv';
30
+ $grid = $this->getLayout()->createBlock('nanorepwidgets/adminhtml_order_grid_export');
31
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
32
+ }
33
+ public function exportExcelAction()
34
+ {
35
+ $fileName = 'nanorep_conversion_report.xls';
36
+ $grid = $this->getLayout()->createBlock('nanorepwidgets/adminhtml_order_grid_export');
37
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
38
+ }
39
+ }
app/code/local/NanoRep/Widgets/controllers/IndexController.php CHANGED
@@ -3,8 +3,8 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_IndexController extends Mage_Core_Controller_Front_Action
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_IndexController extends Mage_Core_Controller_Front_Action
app/code/local/NanoRep/Widgets/controllers/QueryController.php CHANGED
@@ -3,20 +3,59 @@
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_QueryController extends Mage_Core_Controller_Front_Action
11
  {
12
  public function storeQueryAction(){
13
  $query = $this->getRequest()->getPost('query');
 
14
  $session = Mage::helper('nanorepwidgets')->getSession();
 
 
 
 
15
  $queries = $session->getData('nanorep_queries');
16
- if(is_null($queries)) $queries = array();
17
- $queries[] = $query;
18
- $session->setData( 'nanorep_queries', $queries);
19
- $this->getResponse()->setBody(Zend_Json::encode($session->getData('nanorep_queries')));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  }
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
  */
10
  class NanoRep_Widgets_QueryController extends Mage_Core_Controller_Front_Action
11
  {
12
  public function storeQueryAction(){
13
  $query = $this->getRequest()->getPost('query');
14
+ $results = serialize(Zend_Json::decode($this->getRequest()->getPost('results')));
15
  $session = Mage::helper('nanorepwidgets')->getSession();
16
+ $product_id = $this->getRequest()->getPost('product_id');
17
+ if(is_null($product_id)){
18
+ $product_id = 0;
19
+ }
20
  $queries = $session->getData('nanorep_queries');
21
+ if(!is_null($query)){
22
+ if(is_null($queries)) $queries = array();
23
+ if(!key_exists($product_id, $queries)) $queries[$product_id] = array();
24
+ if(!key_exists($query, $queries[$product_id]) || (key_exists($query, $queries[$product_id]) && $queries[$product_id][$query] != $results)){
25
+ $queries[$product_id][$query] = $results;
26
+ }
27
+ $session->setData( 'nanorep_queries', $queries);
28
+
29
+ $answers = unserialize($results);
30
+ $date = Mage::getModel('core/date')->date('Y-m-d H:i:s');
31
+ if($product_id != 0){
32
+ if(!empty($answers)){
33
+ foreach($answers as $answerObject){
34
+ $answer = Mage::getModel('nanorepwidgets/answer');
35
+ $answer->setAnswerId($answerObject["answerId"])
36
+ ->setProductId($product_id)
37
+ ->setQuery($query)
38
+ ->setAnswerTitle($answerObject["title"])
39
+ ->setAnswerBody(htmlspecialchars($answerObject["body"]))
40
+ ->setDate($date)
41
+ ->save();
42
+ }
43
+ }
44
+ else{
45
+ $answer = Mage::getModel('nanorepwidgets/answer');
46
+ $answer->setAnswerId(0)
47
+ ->setProductId($product_id)
48
+ ->setQuery($query)
49
+ ->setAnswerTitle("<Unanswered questions>")
50
+ ->setAnswerBody("")
51
+ ->setDate($date)
52
+ ->save();
53
+ }
54
+ }
55
+
56
+ $this->getResponse()->setBody(Zend_Json::encode($session->getData('nanorep_queries')));
57
+ }
58
+
59
  }
60
 
61
  }
app/code/local/NanoRep/Widgets/etc/adminhtml.xml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NanoRep Widgets Extension
5
+ *
6
+ * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
+ * @author Dan Aharon-Shalom
10
+ */
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <nanorepwidgets translate="title" module="nanorepwidgets">
22
+ <title>nanoRep Widgets Account Settings Section</title>
23
+ </nanorepwidgets>
24
+ </children>
25
+ </config>
26
+ </children>
27
+ </system>
28
+ <nanorep translate="title" module="nanorepwidgets">
29
+ <title>nanoRep</title>
30
+ <sort_order>100</sort_order>
31
+ <children>
32
+ <mynanorep translate="nanorepwidgets">
33
+ <title>my.nanoRep</title>
34
+ </mynanorep>
35
+ <configuration translate="nanorepwidgets">
36
+ <title>Configuration</title>
37
+ </configuration>
38
+ </children>
39
+ </nanorep>
40
+ <sales>
41
+ <children>
42
+ <assisted_by_nanorep translate="title" module="nanorepwidgets">
43
+ <title>Purchases Assisted By nanoRep</title>
44
+ </assisted_by_nanorep>
45
+ </children>
46
+ </sales>
47
+ </children>
48
+ </admin>
49
+ </resources>
50
+ </acl>
51
+ <menu>
52
+ <nanorep translate="title" module="nanorepwidgets">
53
+ <title>nanoRep</title>
54
+ <sort_order>100</sort_order>
55
+ <action>nanorep/adminhtml_mynanorep/index</action>
56
+ <depends>
57
+ <module>NanoRep_Widgets</module>
58
+ </depends>
59
+ <children>
60
+ <mynanorep translate="title" module="nanorepwidgets">
61
+ <title>my.nanoRep</title>
62
+ <action>nanorep/adminhtml_mynanorep/index</action>
63
+ <sort_order>0</sort_order>
64
+ </mynanorep>
65
+ <configuration translate="title" module="nanorepwidgets">
66
+ <title>Configuration</title>
67
+ <action>adminhtml/system_config/edit/section/nanorepwidgets</action>
68
+ <sort_order>1</sort_order>
69
+ </configuration>
70
+ </children>
71
+ </nanorep>
72
+ <sales>
73
+ <children>
74
+ <assisted_by_nanorep translate="title" module="nanorepwidgets">
75
+ <title>Purchases Assisted By nanoRep</title>
76
+ <action>nanorep/adminhtml_order/index</action>
77
+ <sort_order>11</sort_order>
78
+ </assisted_by_nanorep>
79
+ <nanorep_actionable_bi translate="title" module="nanorepwidgets">
80
+ <title>nanoRep search report</title>
81
+ <action>nanorep/adminhtml_answer/index</action>
82
+ <sort_order>12</sort_order>
83
+ </nanorep_actionable_bi>
84
+ </children>
85
+ </sales>
86
+ </menu>
87
+ </config>
app/code/local/NanoRep/Widgets/etc/config.xml CHANGED
@@ -4,68 +4,55 @@
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
- * @company Omniscience Co.
8
- * @website http://www.omniscience.co.il
9
  * @author Dan Aharon-Shalom
10
- */
11
- -->
12
  <config>
13
  <modules>
14
  <NanoRep_Widgets>
15
- <version>1.5.0</version>
16
  </NanoRep_Widgets>
17
  </modules>
18
  <global>
19
  <blocks>
20
- <nanorepwidgets>
21
- <class>NanoRep_Widgets_Block</class>
22
- </nanorepwidgets>
23
- </blocks>
 
 
 
 
 
24
  <models>
25
- <nanorepwidgets>
26
- <class>NanoRep_Widgets_Model</class>
27
- <resourceModel>nanorepwidgets_mysql4</resourceModel>
28
- </nanorepwidgets>
29
-
30
-
31
- <nanorepwidgets_mysql4>
32
- <class>NanoRep_Widgets_Model_Mysql4</class>
33
- <entities>
34
- <query>
35
- <table>nanorep_query</table>
36
- </query>
37
- </entities>
38
- </nanorepwidgets_mysql4>
39
- </models>
40
- <helpers>
41
- <nanorepwidgets>
42
- <class>NanoRep_Widgets_Helper</class>
43
- </nanorepwidgets>
44
- </helpers>
45
-
46
- <resources>
47
- <nanorepwidgets_setup>
48
- <setup>
49
- <module>NanoRep_Widgets</module>
50
- <class>NanoRep_Widgets_Model_Mysql4_Setup</class>
51
- </setup>
52
- <connection>
53
- <use>core_setup</use>
54
- </connection>
55
- </nanorepwidgets_setup>
56
- <nanorepwidgets_write>
57
- <connection>
58
- <use>core_write</use>
59
- </connection>
60
- </nanorepwidgets_write>
61
- <nanorepwidgets_read>
62
- <connection>
63
- <use>core_read</use>
64
- </connection>
65
- </nanorepwidgets_read>
66
- </resources>
67
-
68
  </global>
 
69
  <admin>
70
  <routers>
71
  <nanorepwidgets>
@@ -73,10 +60,22 @@
73
  <args>
74
  <module>NanoRep_Widgets</module>
75
  <frontName>nanorep</frontName>
 
 
 
76
  </args>
77
  </nanorepwidgets>
78
  </routers>
79
  </admin>
 
 
 
 
 
 
 
 
 
80
  <frontend>
81
  <routers>
82
  <nanorepwidgets>
@@ -113,73 +112,6 @@
113
  </checkout_multishipping_controller_success_action>
114
  </events>
115
  </frontend>
116
-
117
- <adminhtml>
118
- <acl>
119
- <resources>
120
- <admin>
121
- <children>
122
- <system>
123
- <children>
124
- <config>
125
- <children>
126
- <nanorepwidgets translate="title" module="nanorepwidgets">
127
- <title>nanoRep Widgets Account Settings Section</title>
128
- </nanorepwidgets>
129
- <!-- <nanorepwidgets_management_system translate="title" module="nanorepwidgets"> -->
130
- <!-- <title>nanoRep Widgets Management System Section</title> -->
131
- <!-- </nanorepwidgets_management_system> -->
132
- </children>
133
- </config>
134
- </children>
135
- </system>
136
- <nanorep translate="title" module="nanorepwidgets">
137
- <title>nanoRep</title>
138
- <sort_order>100</sort_order>
139
- <children>
140
- <mynanorep translate="nanorepwidgets">
141
- <title>my.nanoRep</title>
142
- </mynanorep>
143
- <configuration translate="nanorepwidgets">
144
- <title>Configuration</title>
145
- </configuration>
146
- </children>
147
- </nanorep>
148
- </children>
149
- </admin>
150
- </resources>
151
- </acl>
152
- <menu>
153
- <nanorep translate="title" module="nanorepwidgets">
154
- <title>nanoRep</title>
155
- <sort_order>100</sort_order>
156
- <action>nanorep/adminhtml_mynanorep/index</action>
157
- <depends>
158
- <module>NanoRep_Widgets</module>
159
- </depends>
160
- <children>
161
- <mynanorep translate="title" module="nanorepwidgets">
162
- <title>my.nanoRep</title>
163
- <action>nanorep/adminhtml_mynanorep/index</action>
164
- <sort_order>0</sort_order>
165
- </mynanorep>
166
- <configuration translate="title" module="nanorepwidgets">
167
- <title>Configuration</title>
168
- <action>adminhtml/system_config/edit/section/nanorepwidgets</action>
169
- <sort_order>1</sort_order>
170
- </configuration>
171
- </children>
172
-
173
- </nanorep>
174
- </menu>
175
- <layout>
176
- <updates>
177
- <nanorepwidgets>
178
- <file>nanorepwidgets.xml</file>
179
- </nanorepwidgets>
180
- </updates>
181
- </layout>
182
- </adminhtml>
183
  <default>
184
  <nanorepwidgets>
185
  <account_settings>
@@ -193,7 +125,7 @@
193
  <active>0</active>
194
  <active_pages>0</active_pages>
195
  </float_widget>
196
- <support_widget>
197
  <active>1</active>
198
  <width>400</width>
199
  <max_height>310</max_height>
@@ -207,11 +139,11 @@
207
  <general_faq_headline></general_faq_headline>
208
  <question_hidden>1</question_hidden>
209
  <cache_timeout>30</cache_timeout>
210
- </support_widget>
211
  <orders_status>
212
  <active>1</active>
213
  <active_pages>0</active_pages>
214
  </orders_status>
215
  </nanorepwidgets>
216
  </default>
217
- </config>
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
  * @author Dan Aharon-Shalom
10
+ */
11
+ -->
12
  <config>
13
  <modules>
14
  <NanoRep_Widgets>
15
+ <version>2.0.0</version>
16
  </NanoRep_Widgets>
17
  </modules>
18
  <global>
19
  <blocks>
20
+ <nanorepwidgets>
21
+ <class>NanoRep_Widgets_Block</class>
22
+ </nanorepwidgets>
23
+ </blocks>
24
+ <helpers>
25
+ <nanorepwidgets>
26
+ <class>NanoRep_Widgets_Helper</class>
27
+ </nanorepwidgets>
28
+ </helpers>
29
  <models>
30
+ <nanorepwidgets>
31
+ <class>NanoRep_Widgets_Model</class>
32
+ <resourceModel>nanorepwidgets_resource</resourceModel>
33
+ </nanorepwidgets>
34
+ <nanorepwidgets_resource>
35
+ <class>NanoRep_Widgets_Model_Resource</class>
36
+ <entities>
37
+ <query>
38
+ <table>nanorepwidgets_query</table>
39
+ </query>
40
+ <answer>
41
+ <table>nanorepwidgets_answer</table>
42
+ </answer>
43
+ </entities>
44
+ </nanorepwidgets_resource>
45
+ </models>
46
+ <resources>
47
+ <nanorepwidgets_setup>
48
+ <setup>
49
+ <module>NanoRep_Widgets</module>
50
+ <class>NanoRep_Widgets_Model_Resource_Setup</class>
51
+ </setup>
52
+ </nanorepwidgets_setup>
53
+ </resources>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  </global>
55
+
56
  <admin>
57
  <routers>
58
  <nanorepwidgets>
60
  <args>
61
  <module>NanoRep_Widgets</module>
62
  <frontName>nanorep</frontName>
63
+ <modules>
64
+ <nanorepwidgets before="Mage_Adminhtml">Nanorep_Widgets_Adminhtml_Order</nanorepwidgets>
65
+ </modules>
66
  </args>
67
  </nanorepwidgets>
68
  </routers>
69
  </admin>
70
+ <adminhtml>
71
+ <layout>
72
+ <updates>
73
+ <nanorepwidgets>
74
+ <file>nanorepwidgets.xml</file>
75
+ </nanorepwidgets>
76
+ </updates>
77
+ </layout>
78
+ </adminhtml>
79
  <frontend>
80
  <routers>
81
  <nanorepwidgets>
112
  </checkout_multishipping_controller_success_action>
113
  </events>
114
  </frontend>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  <default>
116
  <nanorepwidgets>
117
  <account_settings>
125
  <active>0</active>
126
  <active_pages>0</active_pages>
127
  </float_widget>
128
+ <embed_widget>
129
  <active>1</active>
130
  <width>400</width>
131
  <max_height>310</max_height>
139
  <general_faq_headline></general_faq_headline>
140
  <question_hidden>1</question_hidden>
141
  <cache_timeout>30</cache_timeout>
142
+ </embed_widget>
143
  <orders_status>
144
  <active>1</active>
145
  <active_pages>0</active_pages>
146
  </orders_status>
147
  </nanorepwidgets>
148
  </default>
149
+ </config>
app/code/local/NanoRep/Widgets/etc/system.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- /**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
- * @company Omniscience Co.
8
- * @website http://www.omniscience.co.il
9
  * @author Dan Aharon-Shalom
10
- */
11
  -->
12
  <config>
13
  <tabs>
@@ -34,15 +34,6 @@
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
  <fields>
37
- <!-- <active translate="label"> -->
38
- <!-- <label>Enabled</label> -->
39
- <!-- <frontend_type>select</frontend_type> -->
40
- <!-- <source_model>adminhtml/system_config_source_yesno</source_model> -->
41
- <!-- <sort_order>1</sort_order> -->
42
- <!-- <show_in_default>1</show_in_default> -->
43
- <!-- <show_in_website>1</show_in_website> -->
44
- <!-- <show_in_store>1</show_in_store> -->
45
- <!-- </active> -->
46
  <account_name translate="label">
47
  <label>Account Name</label>
48
  <frontend_type>text</frontend_type>
@@ -71,7 +62,7 @@
71
  <attribute_select translate="label">
72
  <label>Select which attribute to send to nanoRep</label>
73
  <frontend_type>multiselect</frontend_type>
74
- <source_model>nanorepwidgets/adminhtml_system_config_source_attribute</source_model>
75
  <sort_order>4</sort_order>
76
  <show_in_default>1</show_in_default>
77
  <show_in_website>1</show_in_website>
@@ -80,7 +71,7 @@
80
  <product_id_attribute translate="label">
81
  <label>Define ProductID for nanoRep</label>
82
  <frontend_type>select</frontend_type>
83
- <source_model>nanorepwidgets/adminhtml_system_config_source_productIdAttribute</source_model>
84
  <sort_order>5</sort_order>
85
  <show_in_default>1</show_in_default>
86
  <show_in_website>1</show_in_website>
@@ -126,7 +117,7 @@
126
  <active translate="label">
127
  <label>Enabled</label>
128
  <frontend_type>select</frontend_type>
129
- <source_model>adminhtml/system_config_source_yesno</source_model>
130
  <sort_order>1</sort_order>
131
  <show_in_default>1</show_in_default>
132
  <show_in_website>1</show_in_website>
@@ -144,8 +135,8 @@
144
  </active_pages>
145
  </fields>
146
  </float_widget>
147
- <support_widget translate="label">
148
- <label>Support Widget</label>
149
  <frontend_type>text</frontend_type>
150
  <sort_order>5</sort_order>
151
  <show_in_default>1</show_in_default>
@@ -172,7 +163,7 @@
172
  <div_css translate="label">
173
  <label>Position Div CSS</label>
174
  <frontend_type>text</frontend_type>
175
- <sort_order>2</sort_order>
176
  <show_in_default>1</show_in_default>
177
  <show_in_website>1</show_in_website>
178
  <show_in_store>1</show_in_store>
@@ -196,7 +187,7 @@
196
  <faq_num translate="label">
197
  <label>Number of Questions</label>
198
  <frontend_type>text</frontend_type>
199
- <sort_order>4</sort_order>
200
  <show_in_default>1</show_in_default>
201
  <show_in_website>1</show_in_website>
202
  <show_in_store>1</show_in_store>
@@ -205,11 +196,11 @@
205
  <kb translate="label">
206
  <label>Knowledge Base</label>
207
  <frontend_type>text</frontend_type>
208
- <sort_order>5</sort_order>
209
  <show_in_default>1</show_in_default>
210
  <show_in_website>1</show_in_website>
211
  <show_in_store>1</show_in_store>
212
- <comment>The knowledge base to export from</comment>
213
  </kb>
214
  <max_items translate="label">
215
  <label>Max Items</label>
@@ -304,8 +295,17 @@
304
  <validate>validate-digits</validate>
305
  <comment>In secondes</comment>
306
  </cache_timeout>
 
 
 
 
 
 
 
 
 
307
  </fields>
308
- </support_widget>
309
  <orders_status translate="label">
310
  <label>Orders Status</label>
311
  <frontend_type>text</frontend_type>
1
  <?xml version="1.0"?>
2
  <!--
3
+ /**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
  * @author Dan Aharon-Shalom
10
+ */
11
  -->
12
  <config>
13
  <tabs>
34
  <show_in_website>1</show_in_website>
35
  <show_in_store>1</show_in_store>
36
  <fields>
 
 
 
 
 
 
 
 
 
37
  <account_name translate="label">
38
  <label>Account Name</label>
39
  <frontend_type>text</frontend_type>
62
  <attribute_select translate="label">
63
  <label>Select which attribute to send to nanoRep</label>
64
  <frontend_type>multiselect</frontend_type>
65
+ <source_model>nanorepwidgets/system_config_source_attribute</source_model>
66
  <sort_order>4</sort_order>
67
  <show_in_default>1</show_in_default>
68
  <show_in_website>1</show_in_website>
71
  <product_id_attribute translate="label">
72
  <label>Define ProductID for nanoRep</label>
73
  <frontend_type>select</frontend_type>
74
+ <source_model>nanorepwidgets/system_config_source_productIdAttribute</source_model>
75
  <sort_order>5</sort_order>
76
  <show_in_default>1</show_in_default>
77
  <show_in_website>1</show_in_website>
117
  <active translate="label">
118
  <label>Enabled</label>
119
  <frontend_type>select</frontend_type>
120
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
121
  <sort_order>1</sort_order>
122
  <show_in_default>1</show_in_default>
123
  <show_in_website>1</show_in_website>
135
  </active_pages>
136
  </fields>
137
  </float_widget>
138
+ <embed_widget translate="label">
139
+ <label>Embeded Widget</label>
140
  <frontend_type>text</frontend_type>
141
  <sort_order>5</sort_order>
142
  <show_in_default>1</show_in_default>
163
  <div_css translate="label">
164
  <label>Position Div CSS</label>
165
  <frontend_type>text</frontend_type>
166
+ <sort_order>4</sort_order>
167
  <show_in_default>1</show_in_default>
168
  <show_in_website>1</show_in_website>
169
  <show_in_store>1</show_in_store>
187
  <faq_num translate="label">
188
  <label>Number of Questions</label>
189
  <frontend_type>text</frontend_type>
190
+ <sort_order>5</sort_order>
191
  <show_in_default>1</show_in_default>
192
  <show_in_website>1</show_in_website>
193
  <show_in_store>1</show_in_store>
196
  <kb translate="label">
197
  <label>Knowledge Base</label>
198
  <frontend_type>text</frontend_type>
199
+ <sort_order>6</sort_order>
200
  <show_in_default>1</show_in_default>
201
  <show_in_website>1</show_in_website>
202
  <show_in_store>1</show_in_store>
203
+ <comment>The knowledge base to export from. note: knowledge-base name is case-sensitive</comment>
204
  </kb>
205
  <max_items translate="label">
206
  <label>Max Items</label>
295
  <validate>validate-digits</validate>
296
  <comment>In secondes</comment>
297
  </cache_timeout>
298
+ <debug translate="label">
299
+ <label>Debug Log</label>
300
+ <frontend_type>select</frontend_type>
301
+ <source_model>adminhtml/system_config_source_yesno</source_model>
302
+ <sort_order>45</sort_order>
303
+ <show_in_default>1</show_in_default>
304
+ <show_in_website>1</show_in_website>
305
+ <show_in_store>1</show_in_store>
306
+ </debug>
307
  </fields>
308
+ </embed_widget>
309
  <orders_status translate="label">
310
  <label>Orders Status</label>
311
  <frontend_type>text</frontend_type>
app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/install-2.0.0.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+
11
+
12
+
13
+ /** @var $installer NanoRep_Widgets_Model_Resource_Setup */
14
+
15
+ $installer = $this;
16
+ $installer->startSetup();
17
+
18
+ /**
19
+ * Create table 'nanorep_query'
20
+ */
21
+
22
+ $queryTable = $installer->getConnection()
23
+ ->newTable($installer->getTable('nanorepwidgets/query'))
24
+ ->addColumn('query_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
25
+ 'identity' => true,
26
+ 'unsigned' => true,
27
+ 'nullable' => false,
28
+ 'primary' => true,
29
+ ), 'Query id')
30
+ ->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
31
+ 'unsigned' => true,
32
+ 'nullable' => false,
33
+ 'default' => '0',
34
+ ), 'Order Id')
35
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
36
+ 'unsigned' => true,
37
+ 'nullable' => false,
38
+ 'default' => '0',
39
+ ), 'Product Id')
40
+ ->addColumn('query', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
41
+ 'nullable' => false,
42
+ ), 'Query')
43
+ ->addColumn('results', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
44
+ 'nullable' => false,
45
+ ), 'Results')
46
+ ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
47
+ 'nullable' => true,
48
+ ), 'Date');
49
+
50
+ $installer->getConnection()->createTable($queryTable);
51
+
52
+ $answerTable = $installer->getConnection()
53
+ ->newTable($installer->getTable('nanorepwidgets/answer'))
54
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
55
+ 'identity' => true,
56
+ 'unsigned' => true,
57
+ 'nullable' => false,
58
+ 'primary' => true,
59
+ ), 'pid')
60
+ ->addColumn('query', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
61
+ 'nullable' => false,
62
+ ), 'Query')
63
+ ->addColumn('answer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
64
+ 'unsigned' => true,
65
+ 'nullable' => false,
66
+ 'default' => '0',
67
+ ), 'Answer Id')
68
+ ->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
69
+ 'unsigned' => true,
70
+ 'nullable' => false,
71
+ 'default' => '0',
72
+ ), 'Product Id')
73
+ ->addColumn('answer_title', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
74
+ 'nullable' => false,
75
+ ), 'Answer Title')
76
+ ->addColumn('answer_body', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
77
+ 'nullable' => false,
78
+ ), 'Answer Body')
79
+ ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
80
+ 'nullable' => true,
81
+ ), 'Date');
82
+
83
+ $installer->getConnection()->createTable($answerTable);
84
+
85
+ $installer->endSetup();
app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-data-upgrade-1.2.2-1.2.3.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- $installer->run("
5
- ALTER TABLE `{$installer->getTable('nanorepwidgets/query')}` ADD date DATETIME;
6
- ");
7
- $installer->endSetup();
8
- ?>
 
 
 
 
 
 
 
 
app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-install-1.2.2.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- $installer = $this;
3
- $installer->startSetup();
4
- $installer->run("
5
- CREATE TABLE `{$installer->getTable('nanorepwidgets/query')}` (
6
- `query_id` int(11) NOT NULL auto_increment,
7
- `order_id` int(11) NOT NULL,
8
- `query` text,
9
- PRIMARY KEY (`query_id`)
10
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11
- ");
12
- $installer->endSetup();
13
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/nanorepwidgets.xml CHANGED
@@ -1,13 +1,13 @@
1
  <?xml version="1.0"?>
2
  <!--
3
- //**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
- * @company Omniscience Co.
8
- * @website http://www.omniscience.co.il
9
  * @author Dan Aharon-Shalom
10
- */
11
  -->
12
  <layout version="0.1.0">
13
  <nanorepwidgets_adminhtml_mynanorep_index>
@@ -16,6 +16,7 @@
16
  <block type="nanorepwidgets/adminhtml_mynanorep" name="my_nanorep" template="nanorepwidgets/mynanorep.phtml"/>
17
  </reference>
18
  </nanorepwidgets_adminhtml_mynanorep_index>
 
19
  <adminhtml_sales_order_view>
20
  <reference name="order_tab_info">
21
  <action method="setTemplate">
@@ -23,4 +24,4 @@
23
  </action>
24
  </reference>
25
  </adminhtml_sales_order_view>
26
- </layout>
1
  <?xml version="1.0"?>
2
  <!--
3
+ /**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
  * @author Dan Aharon-Shalom
10
+ */
11
  -->
12
  <layout version="0.1.0">
13
  <nanorepwidgets_adminhtml_mynanorep_index>
16
  <block type="nanorepwidgets/adminhtml_mynanorep" name="my_nanorep" template="nanorepwidgets/mynanorep.phtml"/>
17
  </reference>
18
  </nanorepwidgets_adminhtml_mynanorep_index>
19
+
20
  <adminhtml_sales_order_view>
21
  <reference name="order_tab_info">
22
  <action method="setTemplate">
24
  </action>
25
  </reference>
26
  </adminhtml_sales_order_view>
27
+ </layout>
app/design/adminhtml/default/default/template/nanorepwidgets/mynanorep.phtml CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
- /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
- * @company Omniscience Co.
7
- * @website http://www.omniscience.co.il
8
  * @author Dan Aharon-Shalom
9
- */
10
  ?>
11
  <script language="JavaScript">
12
  <!--
1
  <?php
2
+ /**
3
  * NanoRep Widgets Extension
4
  *
5
  * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
  * @author Dan Aharon-Shalom
9
+ */
10
  ?>
11
  <script language="JavaScript">
12
  <!--
app/design/adminhtml/default/default/template/nanorepwidgets/order/view/queries.phtml CHANGED
@@ -1,28 +1,12 @@
1
  <?php
2
- /**
3
- * Magento
4
  *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
  ?>
27
  <!--Order Information-->
28
  <div class="entry-edit">
1
  <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ?>
11
  <!--Order Information-->
12
  <div class="entry-edit">
app/design/adminhtml/default/default/template/nanorepwidgets/order/view/tab/info.phtml CHANGED
@@ -1,28 +1,12 @@
1
  <?php
2
- /**
3
- * Magento
4
  *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
  ?>
27
  <?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
28
  <?php $_order = $this->getOrder() ?>
1
  <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
  *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ?>
11
  <?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
12
  <?php $_order = $this->getOrder() ?>
app/design/frontend/default/default/layout/nanorepwidgets.xml CHANGED
@@ -1,32 +1,41 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- //**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
- * @company Omniscience Co.
8
- * @website http://www.omniscience.co.il
9
  * @author Dan Aharon-Shalom
10
- */
11
  -->
12
  <layout version="0.1.0">
13
  <default>
14
- <!-- NanoRep_Widgets -->
15
- <reference name="after_body_start">
16
- <block type="nanorepwidgets/top" name="nanorep_top_widget" as="nanorep_top_widget" template="nanorepwidgets/top.phtml" />
17
  </reference>
18
  <reference name="before_body_end">
19
- <block type="nanorepwidgets/general" name="nanorep_general_widget" as="nanorep_general_widget" template="nanorepwidgets/general.phtml" />
20
  <block type="nanorepwidgets/events" name="nanorep_events" as="nanorep_events" template="nanorepwidgets/events.phtml" />
21
- </reference>
22
  </default>
23
 
24
  <checkout_onepage_success>
25
  <reference name="after_body_end">
26
- <block type="nanorepwidgets/succuss" name="nanorep_success" as="nanorep_success" template="nanorepwidgets/success.phtml" />
27
  </reference>
28
  </checkout_onepage_success>
29
 
 
 
 
 
 
 
 
 
 
 
30
  <nanorepwidgets_index_getcustomerhistory>
31
  <block type="nanorepwidgets/adminhtml_order_grid" name="root" output="toHtml" />
32
  </nanorepwidgets_index_getcustomerhistory>
@@ -38,15 +47,4 @@
38
  <nanorepwidgets_index_cdc>
39
  <block type="core/template" name="root" output="toHtml" template="nanorepwidgets/cdc.phtml" />
40
  </nanorepwidgets_index_cdc>
41
-
42
- <catalog_product_view>
43
- <reference name="head">
44
- <action method="addItem"><type>skin_js</type><file>nanorepwidgets/head.js</file></action>
45
- <action method="addItem"><type>skin_css</type><file>nanorepwidgets/head.css</file></action>
46
- </reference>
47
- <reference name="content">
48
- <block type="nanorepwidgets/support" before="-" name="nanorep.support.widget" as="nanorep_support_widget" template="nanorepwidgets/support.phtml" />
49
- </reference>
50
- </catalog_product_view>
51
-
52
  </layout>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
  * NanoRep Widgets Extension
5
  *
6
  * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
  * @author Dan Aharon-Shalom
10
+ */
11
  -->
12
  <layout version="0.1.0">
13
  <default>
14
+ <reference name="after_body_start">
15
+ <block type="nanorepwidgets/header" name="nanorep_header_script" as="nanorep.header.script" template="nanorepwidgets/header.phtml" />
 
16
  </reference>
17
  <reference name="before_body_end">
18
+ <block type="nanorepwidgets/float" ifconfig="nanorepwidgets/float_widget/active" name="nanorep_float_widget" as="nanorep.float.widget" template="nanorepwidgets/float.phtml" />
19
  <block type="nanorepwidgets/events" name="nanorep_events" as="nanorep_events" template="nanorepwidgets/events.phtml" />
20
+ </reference>
21
  </default>
22
 
23
  <checkout_onepage_success>
24
  <reference name="after_body_end">
25
+ <block type="nanorepwidgets/success" name="nanorep_success" as="nanorep_success" template="nanorepwidgets/success.phtml" />
26
  </reference>
27
  </checkout_onepage_success>
28
 
29
+ <catalog_product_view>
30
+ <reference name="head">
31
+ <action method="addItem"><type>skin_js</type><file>nanorepwidgets/head.js</file></action>
32
+ <action method="addItem"><type>skin_css</type><file>nanorepwidgets/head.css</file></action>
33
+ </reference>
34
+ <reference name="content">
35
+ <block type="nanorepwidgets/embed" before="-" name="nanorep.embeded.widget" as="nanorep_embeded_widget" template="nanorepwidgets/embed.phtml" />
36
+ </reference>
37
+ </catalog_product_view>
38
+
39
  <nanorepwidgets_index_getcustomerhistory>
40
  <block type="nanorepwidgets/adminhtml_order_grid" name="root" output="toHtml" />
41
  </nanorepwidgets_index_getcustomerhistory>
47
  <nanorepwidgets_index_cdc>
48
  <block type="core/template" name="root" output="toHtml" template="nanorepwidgets/cdc.phtml" />
49
  </nanorepwidgets_index_cdc>
 
 
 
 
 
 
 
 
 
 
 
50
  </layout>
app/design/frontend/default/default/template/nanorepwidgets/cdc.phtml CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
  <head>
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12
  <html xmlns="http://www.w3.org/1999/xhtml">
13
  <head>
app/design/frontend/default/default/template/nanorepwidgets/embed.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <?php if($this->helper("nanorepwidgets")->isEmbededWidgetEnabled()):
12
+ ?>
13
+ <?php $this -> getXml(true); ?>
14
+ <script type='text/javascript'>
15
+ document.observe("dom:loaded", function() {
16
+ if($("nanoRepEmbedContainer") == undefined ){
17
+ <?php $div_css = $this -> helper("nanorepwidgets") -> getEmbededWidgetDivCss(); ?>
18
+ if($$('<?php echo $div_css; ?>').length > 0){
19
+ $$('<?php echo $div_css; ?>')[0].insert("<div aria-live='polite' id='nanoRepEmbedContainer'></div>");
20
+ }
21
+ else{
22
+ $$('.col-main')[0].insert("<div aria-live='polite' id='nanoRepEmbedContainer'></div>");
23
+ }
24
+ onloadFnc();
25
+ }
26
+ });
27
+
28
+ _nRepData['kb'] = '19047683';
29
+ /* API here */;
30
+ _nRepData['embed'] = {
31
+ account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
32
+ container : 'nanoRepEmbedContainer',
33
+ width : <?php echo $this -> helper("nanorepwidgets") -> getEmbededWidgetWidth(); ?>,
34
+ maxHeight : <?php echo $this -> helper("nanorepwidgets") -> getEmbededWidgetMaxHeight(); ?>,
35
+ dynamicSize : true,
36
+ cdcFrame : '<?php echo Mage::getBaseUrl() . 'nanorep/index/cdc'; ?>',
37
+ cdcVersion : 3,
38
+ scriptVersion : '2.40.1.60'
39
+ };
40
+ (function() {
41
+ var windowLoadFunc = function() {
42
+ var _nRepData = window._nRepData || [];
43
+ _nRepData['windowLoaded'] = true;
44
+ if ( typeof (_nRepData['windowOnload']) === 'function')
45
+ _nRepData['windowOnload']();
46
+ };
47
+ if (window.attachEvent)
48
+ window.attachEvent('onload', windowLoadFunc);
49
+ else if (window.addEventListener)
50
+ window.addEventListener('load', windowLoadFunc, false);
51
+ var sc = document.createElement('script');
52
+ sc.type = 'text/javascript';
53
+ sc.async = true;
54
+ sc.defer = true;
55
+ sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/embed.js?account=<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>';
56
+ var _head = document.getElementsByTagName('head')[0];
57
+ _head.appendChild(sc);
58
+ })();
59
+ </script>
60
+ <?php endif; ?>
app/design/frontend/default/default/template/nanorepwidgets/events.phtml CHANGED
@@ -1,4 +1,13 @@
1
-
 
 
 
 
 
 
 
 
 
2
  <?php
3
  if(!is_null($this->getProduct())){
4
  $_product = $this->getProduct();
@@ -11,24 +20,39 @@
11
  }
12
  ?>
13
 
14
- <?php if($this->helper("nanorepwidgets")->isFloatWidgetActive()): ?>
15
  <script type='text/javascript'>
16
  _nRepData["events"] =
17
  {
18
- query: function(query, isAutoQuestion){
19
- new Ajax.Request('<?php echo $this->helper('nanorepwidgets')->getStoreQueryInCookieUrl()?>', {
20
- method: "post",
21
- parameters: {
22
- 'query': query
23
- },
24
- onSuccess: function(response) {
25
- // Handle the response content...
26
- console.log(response);
27
- }
28
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
  };
32
 
33
  </script>
34
- <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
  <?php
12
  if(!is_null($this->getProduct())){
13
  $_product = $this->getProduct();
20
  }
21
  ?>
22
 
 
23
  <script type='text/javascript'>
24
  _nRepData["events"] =
25
  {
26
+ // query: function(query, isAutoQuestion){
27
+ //
28
+ // }
29
+
30
+ incomingSearchResults: function(hasResults, isAutoQuestion, query, results){
31
+
32
+ if(isAutoQuestion == false){
33
+ // if(query == null){
34
+ // query = "Test Question 1";
35
+ // }
36
+ // if(results == null){
37
+ // results = {1: {title: "Title 1", body: "Body 2"}, 2: {title: "Title 2", body: "Body 2"}};
38
+ // }
39
+ console.log(query);
40
+ console.log(results);
41
+ new Ajax.Request('<?php echo $this->helper('nanorepwidgets')->getStoreQueryInCookieUrl()?>', {
42
+ method: "post",
43
+ parameters: {
44
+ 'query': query,
45
+ 'results': JSON.stringify(results),
46
+ 'product_id': <?php echo (!is_null($_product)) ? $_product->getId() : 0; ?>
47
+ },
48
+ onSuccess: function(response) {
49
+ // Handle the response content...
50
+ // console.log(response);
51
+ }
52
+ });
53
+ }
54
  }
55
 
56
  };
57
 
58
  </script>
 
app/design/frontend/default/default/template/nanorepwidgets/{general.phtml → float.phtml} RENAMED
@@ -1,26 +1,23 @@
1
-
2
  <?php
3
- if(!is_null($this->getProduct())){
4
- $_product = $this->getProduct();
5
- }
6
- elseif(!is_null(Mage::registry('current_product'))) {
7
- $_product = Mage::registry('current_product');
8
- }
9
- else{
10
- $_product = null;
11
- }
12
  ?>
13
-
14
- <?php if($this->helper("nanorepwidgets")->isFloatWidgetActive()): ?>
15
- <div class='nanorep_loadingData' id='nanoRepProxyContainer' style='position:absolute;top:-500px;left:0px;'>
16
- <span>Loading nanoRep</span>
17
- </div>
18
  <script type='text/javascript'>
19
- _nRepData['kb'] = '825927';
20
  _nRepData['float'] = {
21
- account : '<?php echo $this->helper("nanorepwidgets")->getAccountName();?>',
22
  cdcVersion : 3,
23
- cdcFrame : '<?php echo Mage::getBaseUrl(). 'nanorep/index/cdc'; ?>'
 
24
  }
25
  /* API here */;
26
  (function() {
@@ -41,6 +38,6 @@
41
  sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/float.js';
42
  var _head = document.getElementsByTagName('head')[0];
43
  _head.appendChild(sc);
44
- })();
45
  </script>
46
  <?php endif; ?>
 
1
  <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
 
10
  ?>
11
+ <?php if(Mage::helper("nanorepwidgets")->isFloatWidgetActiveForCurrentPage()): ?>
12
+ <!--do not modify this script -->
13
+ <div class='nanorep_loadingData' id='nanoRepProxyContainer' aria-live='polite' style='position:absolute;top:-500px;left:0px;'></div>
 
 
14
  <script type='text/javascript'>
15
+ _nRepData['kb'] = '19047683';
16
  _nRepData['float'] = {
17
+ account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
18
  cdcVersion : 3,
19
+ cdcFrame : '<?php echo Mage::getBaseUrl() . 'nanorep/index/cdc'; ?>',
20
+ scriptVersion : '2.40.1.60'
21
  }
22
  /* API here */;
23
  (function() {
38
  sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/float.js';
39
  var _head = document.getElementsByTagName('head')[0];
40
  _head.appendChild(sc);
41
+ })();
42
  </script>
43
  <?php endif; ?>
app/design/frontend/default/default/template/nanorepwidgets/grid.phtml DELETED
@@ -1,229 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
- <?php
28
- /**
29
- * Template for Mage_Adminhtml_Block_Widget_Grid
30
- *
31
- * getId()
32
- * getCollection()
33
- * getColumns()
34
- * getPagerVisibility()
35
- * getVarNamePage()
36
- */
37
-
38
- $numColumns = sizeof($this->getColumns());
39
- ?>
40
- <?php if($this->getCollection()): ?>
41
- <?php if($this->canDisplayContainer()): ?>
42
- <?php if($this->getGridHeader()): ?>
43
- <div class="content-header">
44
- <table cellspacing="0">
45
- <tr>
46
- <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
47
- </tr>
48
- </table>
49
- </div>
50
- <?php endif ?>
51
-
52
- <div id="<?php echo $this->getId() ?>">
53
- <?php else: ?>
54
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
55
- <?php endif; ?>
56
- <?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
57
- <table cellspacing="0" class="actions">
58
- <tr>
59
- <?php if($this->getPagerVisibility()): ?>
60
- <td class="pager">
61
- <?php echo $this->__('Page') ?>
62
-
63
- <?php $_curPage = $this->getCollection()->getCurPage() ?>
64
- <?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
65
- <?php if($_curPage>1): ?>
66
- <a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
67
- <?php else: ?>
68
- <img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
69
- <?php endif; ?>
70
-
71
- <input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getJsObjectName() ?>.inputPage(event, '<?php echo $_lastPage ?>')"/>
72
-
73
- <?php if($_curPage < $_lastPage): ?>
74
- <a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
75
- <?php else: ?>
76
- <img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
77
- <?php endif; ?>
78
-
79
- <?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
80
- <span class="separator">|</span>
81
- <?php echo $this->__('View') ?>
82
- <select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
83
- <option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
84
- <option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
85
- <option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
86
- <option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
87
- <option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
88
- </select>
89
- <?php echo $this->__('per page') ?><span class="separator">|</span>
90
- <?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
91
- <span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
92
- <?php if($this->getRssLists()): ?>
93
- <?php foreach ($this->getRssLists() as $_rss): ?>
94
- <span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
95
- <?php endforeach ?>
96
- <?php endif; ?>
97
- </td>
98
- <?php endif ?>
99
- <?php if($this->getExportTypes()): ?>
100
- <td class="export a-right">
101
- <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
102
- <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
103
- <?php foreach ($this->getExportTypes() as $_type): ?>
104
- <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
105
- <?php endforeach; ?>
106
- </select>
107
- <?php echo $this->getExportButtonHtml() ?>
108
- </td>
109
- <?php endif; ?>
110
- <td class="filter-actions a-right">
111
- <?php echo $this->getMainButtonsHtml() ?>
112
- </td>
113
- </tr>
114
- </table>
115
- <?php endif; ?>
116
- <?php if($this->getMassactionBlock()->isAvailable()): ?>
117
- <?php echo $this->getMassactionBlockHtml() ?>
118
- <?php endif ?>
119
- <div class="grid">
120
- <div class="hor-scroll">
121
- <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
122
- <?php foreach ($this->getColumns() as $_column): ?>
123
- <col <?php echo $_column->getHtmlProperty() ?> />
124
- <?php endforeach; ?>
125
- <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
126
- <thead>
127
- <?php if ($this->getHeadersVisibility()): ?>
128
- <tr class="headings">
129
- <?php foreach ($this->getColumns() as $_column): ?>
130
- <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
131
- <?php endforeach; ?>
132
- </tr>
133
- <?php endif; ?>
134
- <?php if ($this->getFilterVisibility()): ?>
135
- <tr class="filter">
136
- <?php $i=0;foreach ($this->getColumns() as $_column): ?>
137
- <th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
138
- <?php endforeach; ?>
139
- </tr>
140
- <?php endif ?>
141
- </thead>
142
- <?php endif; ?>
143
- <?php if ($this->getCountTotals()): ?>
144
- <tfoot>
145
- <tr class="totals">
146
- <?php foreach ($this->getColumns() as $_column): ?>
147
- <th class="<?php echo $_column->getCssProperty() ?>"><?php echo ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?>&nbsp;</th>
148
- <?php endforeach; ?>
149
- </tr>
150
- </tfoot>
151
- <?php endif; ?>
152
-
153
- <tbody>
154
- <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
155
- <?php foreach ($this->getCollection() as $_index=>$_item): ?>
156
- <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
157
- <?php $i=0;foreach ($this->getColumns() as $_column): ?>
158
-
159
- <?php if ($this->shouldRenderCell($_item, $_column)):?>
160
- <?php $_rowspan = $this->getRowspan($_item, $_column);?>
161
- <td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
162
- <?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : '&nbsp;') ?>
163
- </td>
164
- <?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
165
- <td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
166
- <?php endif;?>
167
- <?php endif;?>
168
-
169
- <?php endforeach; ?>
170
- </tr>
171
- <?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
172
- <?php foreach ($_multipleRows as $_i):?>
173
- <tr>
174
- <?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
175
- <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
176
- <?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : '&nbsp;') ?>
177
- </td>
178
- <?php endforeach; ?>
179
- </tr>
180
- <?php endforeach;?>
181
- <?php endif;?>
182
-
183
- <?php if ($this->shouldRenderSubTotal($_item)): ?>
184
- <tr class="subtotals">
185
- <?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
186
- <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
187
- <?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
188
- $_column->getRowField($this->getSubTotalItem($_item))
189
- );
190
- ?>
191
- </td>
192
- <?php endforeach; ?>
193
- </tr>
194
- <?php endif; ?>
195
- <?php endforeach; ?>
196
- <?php elseif ($this->getEmptyText()): ?>
197
- <tr>
198
- <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="<?php echo $numColumns ?>"><?php echo $this->getEmptyText() ?></td>
199
- </tr>
200
- <?php endif; ?>
201
- </tbody>
202
-
203
- </table>
204
- </div>
205
- </div>
206
- <?php if($this->canDisplayContainer()): ?>
207
- </div>
208
- <script type="text/javascript">
209
- //<![CDATA[
210
- <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
211
- <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
212
- <?php if($this->getRowClickCallback()): ?>
213
- <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
214
- <?php endif; ?>
215
- <?php if($this->getCheckboxCheckCallback()): ?>
216
- <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
217
- <?php endif; ?>
218
- <?php if($this->getRowInitCallback()): ?>
219
- <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
220
- <?php echo $this->getJsObjectName() ?>.initGridRows();
221
- <?php endif; ?>
222
- <?php if($this->getMassactionBlock()->isAvailable()): ?>
223
- <?php echo $this->getMassactionBlock()->getJavaScript() ?>
224
- <?php endif ?>
225
- <?php echo $this->getAdditionalJavaScript(); ?>
226
- //]]>
227
- </script>
228
- <?php endif; ?>
229
- <?php endif ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/nanorepwidgets/{top.phtml → header.phtml} RENAMED
@@ -1,66 +1,17 @@
1
-
2
  <?php
3
- if(!is_null($this->getProduct())){
4
- $_product = $this->getProduct();
5
- }
6
- elseif(!is_null(Mage::registry('current_product'))) {
7
- $_product = Mage::registry('current_product');
8
- }
9
- else{
10
- $_product = null;
11
- }
12
  ?>
13
-
14
- <?php if($this->helper("nanorepwidgets")->isFloatWidgetActive()): ?>
15
- <div class='nanorep_loadingData' id='nanoRepProxyContainer' style='position:absolute;top:-500px;left:0px;'>
16
- </div>
17
- <?php endif; ?>
18
  <script type='text/javascript'>
19
- <?php
20
- if(!is_null($_product)){
21
- $productID = "";
22
- $productIdAttribute = Mage::getStoreConfig('nanorepwidgets/account_settings/product_id_attribute');
23
- if($productIdAttribute == "id"){
24
- $productID = $_product->getId();
25
- }
26
- elseif($productIdAttribute == "sku"){
27
- $productID = $_product->getsku();
28
- }
29
-
30
- if($productID == ""){
31
- if($_product->getData($productIdAttribute) != ""){
32
- $productID = $_product->getData($productIdAttribute);
33
- }
34
- else{
35
- $productID = $_product->getAttributeText($productIdAttribute);
36
- }
37
- }
38
- if($productID == ""){
39
- $productID = $_product->getId();
40
- }
41
- }
42
- ?>
43
  var _nRepData = _nRepData || [];
44
- _nRepData["context"] = {
45
- "Website" : "<?php echo $_SERVER['HTTP_HOST']; ?>"<?php if(!is_null($_product)): ?>,
46
- "ProductID" : "<?php echo $productID?>"<?php if($_product->getAttributeText('manufacturer') != ""): ?>,
47
- "Manufacturer" : "<?php echo $_product->getAttributeText('manufacturer'); ?>"<?php endif; ?><?php if(!is_null($_product->getCategory())): ?>,<?php endif; ?>
48
- <?php endif; ?>
49
- };
50
- _nRepData["customParams"] = {
51
- <?php $this->getCustomerOrdersStatuses(); ?>
52
- "userLoggedIn" : "<?php echo $this->isUserLoggedIn(); ?>",
53
- <?php if(!is_null($_product)): ?>
54
- "productName": "<?php echo htmlspecialchars($_product->getName()); ?>",
55
- <?php $this->getCategory(); ?>
56
- "ProductID" : "<?php echo $productID?>",
57
- "Price" : "<?php echo Mage::helper('core')->currency($_product->getFinalPrice(), true, false); ?>",
58
- <?php $this->getProductRelatedProducts($_product); ?>
59
- <?php $this->getProductUpSellsProducts($_product); ?>
60
- <?php $this->getProductCrossSellProducts($_product); ?>
61
- <?php $this->getProductAttributes($_product); ?>
62
- <?php endif; ?>
63
- };
64
 
65
  function parseOrdersNrepData(dataName, title)
66
  {
@@ -118,7 +69,7 @@
118
  s.push("</table>");
119
  _nRepData["customParams"]['orders_string'] = s.join('');
120
  }
121
- if (_nRepData["customParams"]['relatedProducts'])
122
  {
123
  parseOrdersNrepData('relatedProducts', "You may also be interested in the following product(s):");
124
  }
@@ -130,6 +81,10 @@
130
  {
131
  parseOrdersNrepData('crossSellsProducts', "You may also be interested in the following product(s):");
132
  }
 
 
 
 
133
  }
134
  })();
135
- </script>
 
1
  <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
 
10
  ?>
 
 
 
 
 
11
  <script type='text/javascript'>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  var _nRepData = _nRepData || [];
13
+ _nRepData["context"] = <?php echo $this->getContext(); ?>;
14
+ _nRepData["customParams"] = <?php echo $this->getCustomParams(); ?>;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  function parseOrdersNrepData(dataName, title)
17
  {
69
  s.push("</table>");
70
  _nRepData["customParams"]['orders_string'] = s.join('');
71
  }
72
+ if (_nRepData["customParams"]['relatedProducts'])
73
  {
74
  parseOrdersNrepData('relatedProducts', "You may also be interested in the following product(s):");
75
  }
81
  {
82
  parseOrdersNrepData('crossSellsProducts', "You may also be interested in the following product(s):");
83
  }
84
+ if (_nRepData["customParams"]['bundleProducts'])
85
+ {
86
+ parseOrdersNrepData('bundleProducts', "The following products are included:");
87
+ }
88
  }
89
  })();
90
+ </script>
app/design/frontend/default/default/template/nanorepwidgets/success.phtml CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
3
  $order = Mage::getSingleton('sales/order');
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
  <?php
12
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
13
  $order = Mage::getSingleton('sales/order');
app/design/frontend/default/default/template/nanorepwidgets/support.phtml DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- if (!is_null($this -> getProduct())) {
3
- $_product = $this -> getProduct();
4
- } elseif (!is_null(Mage::registry('current_product'))) {
5
- $_product = Mage::registry('current_product');
6
- } else {
7
- $_product = null;
8
- }
9
- ?>
10
-
11
- <?php if($this->helper("nanorepwidgets")->isSupportWidgetEnabled()):?>
12
- <!--do not modify this script -->
13
- <?php if($this->helper("nanorepwidgets")->isSupportWidgetQuestionsHidden()):?>
14
- <noscript>
15
- <?php endif; ?>
16
- <?php $this->getXml(true); ?>
17
- <?php if($this->helper("nanorepwidgets")->isSupportWidgetQuestionsHidden()):?>
18
- </noscript>
19
- <?php endif; ?>
20
- <script type='text/javascript'>
21
-
22
- document.observe("dom:loaded", function() {
23
- if($("nanoRepEmbedContainer") == undefined ){
24
- if($$('<?php echo Mage::getStoreConfig("nanorepwidgets/support_widget/div_css"); ?>').length > 0){
25
- $$('<?php echo Mage::getStoreConfig("nanorepwidgets/support_widget/div_css"); ?>')[0].insert("<div id='nanoRepEmbedContainer'></div>");
26
- //$('nanoRepEmbedContainer').insert($$('<?php echo Mage::getStoreConfig("nanorepwidgets/support_widget/div_css"); ?>')[0].descendants()[0]);
27
- }
28
- else{
29
- $$('.box-collateral.box-additional')[0].insert("<div id='nanoRepEmbedContainer'></div>");
30
- }
31
- onloadFnc();
32
- }
33
- });
34
-
35
- _nRepData['kb'] = '8331305';
36
- /* API here */;
37
- _nRepData['embed'] = {
38
- account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
39
- container : 'nanoRepEmbedContainer',
40
- width : <?php echo $this -> helper("nanorepwidgets") -> getSupportWidgetWidth(); ?>,
41
- maxHeight : <?php echo $this -> helper("nanorepwidgets") -> getSupportWidgetMaxHeight(); ?>,
42
- dynamicSize : true,
43
- cdcFrame : '',
44
- cdcVersion : 3,
45
- scriptVersion : '2.13.1.25'
46
- };
47
- (function() {
48
- var windowLoadFunc = function() {
49
- var _nRepData = window._nRepData || [];
50
- _nRepData['windowLoaded'] = true;
51
- if ( typeof (_nRepData['windowOnload']) === 'function')
52
- _nRepData['windowOnload']();
53
- };
54
- if (window.attachEvent)
55
- window.attachEvent('onload', windowLoadFunc);
56
- else if (window.addEventListener)
57
- window.addEventListener('load', windowLoadFunc, false);
58
- var sc = document.createElement('script');
59
- sc.type = 'text/javascript';
60
- sc.async = true;
61
- sc.defer = true;
62
- sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/embed.js?account=<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>';
63
- var _head = document.getElementsByTagName('head')[0];
64
- _head.appendChild(sc);
65
- })();
66
- </script>
67
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/rwd/default/layout/nanorepwidgets.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NanoRep Widgets Extension
5
+ *
6
+ * @package NanoRep_Widgets
7
+ * @company nanoRep.
8
+ * @website http://www.nanorep.com
9
+ * @author Dan Aharon-Shalom
10
+ */
11
+ -->
12
+ <layout version="0.1.0">
13
+ <default>
14
+ <reference name="after_body_start">
15
+ <block type="nanorepwidgets/header" name="nanorep_header_script" as="nanorep.header.script" template="nanorepwidgets/header.phtml" />
16
+ </reference>
17
+ <reference name="before_body_end">
18
+ <block type="nanorepwidgets/float" ifconfig="nanorepwidgets/float_widget/active" name="nanorep_float_widget" as="nanorep.float.widget" template="nanorepwidgets/float.phtml" />
19
+ <block type="nanorepwidgets/events" name="nanorep_events" as="nanorep_events" template="nanorepwidgets/events.phtml" />
20
+ </reference>
21
+ </default>
22
+
23
+ <checkout_onepage_success>
24
+ <reference name="after_body_end">
25
+ <block type="nanorepwidgets/success" name="nanorep_success" as="nanorep_success" template="nanorepwidgets/success.phtml" />
26
+ </reference>
27
+ </checkout_onepage_success>
28
+
29
+ <catalog_product_view>
30
+ <reference name="head">
31
+ <action method="addItem"><type>skin_js</type><file>nanorepwidgets/head.js</file></action>
32
+ <action method="addItem"><type>skin_css</type><file>nanorepwidgets/head.css</file></action>
33
+ </reference>
34
+ <reference name="content">
35
+ <block type="nanorepwidgets/embed" before="-" name="nanorep.embeded.widget" as="nanorep_embeded_widget" template="nanorepwidgets/embed.phtml" />
36
+ </reference>
37
+ </catalog_product_view>
38
+
39
+ <nanorepwidgets_index_getcustomerhistory>
40
+ <block type="nanorepwidgets/adminhtml_order_grid" name="root" output="toHtml" />
41
+ </nanorepwidgets_index_getcustomerhistory>
42
+
43
+ <nanorepwidgets_index_getcustomerhistoryjson>
44
+ <block type="nanorepwidgets/customerhistoryjson" name="root" output="toHtml"/>
45
+ </nanorepwidgets_index_getcustomerhistoryjson>
46
+
47
+ <nanorepwidgets_index_cdc>
48
+ <block type="core/template" name="root" output="toHtml" template="nanorepwidgets/cdc.phtml" />
49
+ </nanorepwidgets_index_cdc>
50
+ </layout>
app/design/frontend/rwd/default/template/nanorepwidgets/cdc.phtml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12
+ <html xmlns="http://www.w3.org/1999/xhtml">
13
+ <head>
14
+ <meta http-Equiv="Cache-Control" Content="no-cache, no-store, must-revalidate">
15
+ <meta http-Equiv="Pragma" Content="no-cache">
16
+ <meta http-Equiv="Expires" Content="0">
17
+
18
+ <title>nanoRep CDC Relay v3</title>
19
+ <script type="text/javascript">
20
+ window.scriptLoaded = false;
21
+ window.pageLoaded = false;
22
+ window.fileVersion = 3;
23
+
24
+ //////////////////////////////////////////////////////////////////////////
25
+ // handlers
26
+ window.onload = function ()
27
+ {
28
+ window.pageLoaded = true;
29
+ if (window.scriptLoaded) nanoRep.CDC.Relay.start();
30
+ }
31
+ var scriptLoaded_handler = function()
32
+ {
33
+ window.scriptLoaded = true;
34
+ if (window.pageLoaded) nanoRep.CDC.Relay.start();
35
+ }
36
+
37
+ //////////////////////////////////////////////////////////////////////////
38
+ // Loading cdc relay script
39
+ var s = document.createElement("script");
40
+ s.type = 'text/javascript';
41
+ s.async = true;
42
+ s.defer = true;
43
+
44
+ // non-ie browsers
45
+ if (navigator.appVersion.indexOf("MSIE") === -1)
46
+ {
47
+ s.onload = scriptLoaded_handler;
48
+ }
49
+ // ie browsers
50
+ else
51
+ {
52
+ s.onreadystatechange = function ()
53
+ {
54
+ if (this.readyState !== 'complete' && this.readyState !== 'loaded') return;
55
+ scriptLoaded_handler();
56
+ }
57
+ }
58
+ var args = window.location.search;
59
+ if (args)
60
+ {
61
+ args = args.substring(1);
62
+ var ndx = args.indexOf("srv=");
63
+ if (ndx !== -1)
64
+ {
65
+ args = args.substring(ndx+4);
66
+ var src, tag;
67
+ ndx = args.indexOf("&");
68
+ if (ndx === -1)
69
+ {
70
+ src = args + "/common/cdc/cdcRelay.js";
71
+ }
72
+ else
73
+ {
74
+ tag = args.substring(ndx + 1);
75
+ src = args.substring(0, ndx) + "/common/cdc/cdcRelay.js?" + tag;
76
+ }
77
+ s.src = src;
78
+ document.getElementsByTagName("head")[0].appendChild(s);
79
+ }
80
+ }
81
+ </script>
82
+ </head>
83
+ <body style='margin:0;padding:0'>
84
+ <div id='log' style='height:1050px'></div>
85
+ </body>
86
+ </html>
app/design/frontend/rwd/default/template/nanorepwidgets/embed.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <?php if($this->helper("nanorepwidgets")->isEmbededWidgetEnabled()):
12
+ ?>
13
+ <?php $this -> getXml(true); ?>
14
+ <script type='text/javascript'>
15
+ document.observe("dom:loaded", function() {
16
+ if($("nanoRepEmbedContainer") == undefined ){
17
+ <?php $div_css = $this -> helper("nanorepwidgets") -> getEmbededWidgetDivCss(); ?>
18
+ if($$('<?php echo $div_css; ?>').length > 0){
19
+ $$('<?php echo $div_css; ?>')[0].insert("<div aria-live='polite' id='nanoRepEmbedContainer'></div>");
20
+ }
21
+ else{
22
+ $$('.col-main')[0].insert("<div aria-live='polite' id='nanoRepEmbedContainer'></div>");
23
+ }
24
+ onloadFnc();
25
+ }
26
+ });
27
+
28
+ _nRepData['kb'] = '19047683';
29
+ /* API here */;
30
+ _nRepData['embed'] = {
31
+ account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
32
+ container : 'nanoRepEmbedContainer',
33
+ width : <?php echo $this -> helper("nanorepwidgets") -> getEmbededWidgetWidth(); ?>,
34
+ maxHeight : <?php echo $this -> helper("nanorepwidgets") -> getEmbededWidgetMaxHeight(); ?>,
35
+ dynamicSize : true,
36
+ cdcFrame : '<?php echo Mage::getBaseUrl() . 'nanorep/index/cdc'; ?>',
37
+ cdcVersion : 3,
38
+ scriptVersion : '2.40.1.60'
39
+ };
40
+ (function() {
41
+ var windowLoadFunc = function() {
42
+ var _nRepData = window._nRepData || [];
43
+ _nRepData['windowLoaded'] = true;
44
+ if ( typeof (_nRepData['windowOnload']) === 'function')
45
+ _nRepData['windowOnload']();
46
+ };
47
+ if (window.attachEvent)
48
+ window.attachEvent('onload', windowLoadFunc);
49
+ else if (window.addEventListener)
50
+ window.addEventListener('load', windowLoadFunc, false);
51
+ var sc = document.createElement('script');
52
+ sc.type = 'text/javascript';
53
+ sc.async = true;
54
+ sc.defer = true;
55
+ sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/embed.js?account=<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>';
56
+ var _head = document.getElementsByTagName('head')[0];
57
+ _head.appendChild(sc);
58
+ })();
59
+ </script>
60
+ <?php endif; ?>
app/design/frontend/rwd/default/template/nanorepwidgets/events.phtml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <?php
12
+ if(!is_null($this->getProduct())){
13
+ $_product = $this->getProduct();
14
+ }
15
+ elseif(!is_null(Mage::registry('current_product'))) {
16
+ $_product = Mage::registry('current_product');
17
+ }
18
+ else{
19
+ $_product = null;
20
+ }
21
+ ?>
22
+
23
+ <script type='text/javascript'>
24
+ _nRepData["events"] =
25
+ {
26
+ // query: function(query, isAutoQuestion){
27
+ //
28
+ // }
29
+
30
+ incomingSearchResults: function(hasResults, isAutoQuestion, query, results){
31
+
32
+ if(isAutoQuestion == false){
33
+ // if(query == null){
34
+ // query = "Test Question 1";
35
+ // }
36
+ // if(results == null){
37
+ // results = {1: {title: "Title 1", body: "Body 2"}, 2: {title: "Title 2", body: "Body 2"}};
38
+ // }
39
+ console.log(query);
40
+ console.log(results);
41
+ new Ajax.Request('<?php echo $this->helper('nanorepwidgets')->getStoreQueryInCookieUrl()?>', {
42
+ method: "post",
43
+ parameters: {
44
+ 'query': query,
45
+ 'results': JSON.stringify(results),
46
+ 'product_id': <?php echo (!is_null($_product)) ? $_product->getId() : 0; ?>
47
+ },
48
+ onSuccess: function(response) {
49
+ // Handle the response content...
50
+ // console.log(response);
51
+ }
52
+ });
53
+ }
54
+ }
55
+
56
+ };
57
+
58
+ </script>
app/design/frontend/rwd/default/template/nanorepwidgets/float.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <?php if(Mage::helper("nanorepwidgets")->isFloatWidgetActiveForCurrentPage()): ?>
12
+ <!--do not modify this script -->
13
+ <div class='nanorep_loadingData' id='nanoRepProxyContainer' aria-live='polite' style='position:absolute;top:-500px;left:0px;'></div>
14
+ <script type='text/javascript'>
15
+ _nRepData['kb'] = '19047683';
16
+ _nRepData['float'] = {
17
+ account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
18
+ cdcVersion : 3,
19
+ cdcFrame : '<?php echo Mage::getBaseUrl() . 'nanorep/index/cdc'; ?>',
20
+ scriptVersion : '2.40.1.60'
21
+ }
22
+ /* API here */;
23
+ (function() {
24
+ var windowLoadFunc = function() {
25
+ var _nRepData = window._nRepData || [];
26
+ _nRepData['windowLoaded'] = true;
27
+ if ( typeof (_nRepData['windowOnload']) === 'function')
28
+ _nRepData['windowOnload']();
29
+ };
30
+ if (window.attachEvent)
31
+ window.attachEvent('onload', windowLoadFunc);
32
+ else if (window.addEventListener)
33
+ window.addEventListener('load', windowLoadFunc, false);
34
+ var sc = document.createElement('script');
35
+ sc.type = 'text/javascript';
36
+ sc.async = true;
37
+ sc.defer = true;
38
+ sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/float.js';
39
+ var _head = document.getElementsByTagName('head')[0];
40
+ _head.appendChild(sc);
41
+ })();
42
+ </script>
43
+ <?php endif; ?>
app/design/frontend/rwd/default/template/nanorepwidgets/header.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <script type='text/javascript'>
12
+ var _nRepData = _nRepData || [];
13
+ _nRepData["context"] = <?php echo $this->getContext(); ?>;
14
+ _nRepData["customParams"] = <?php echo $this->getCustomParams(); ?>;
15
+
16
+ function parseOrdersNrepData(dataName, title)
17
+ {
18
+ var s = [];
19
+ var d = _nRepData["customParams"][dataName];
20
+ var col = 3;
21
+ var count = 0;
22
+ s.push("<table class='orderNRD' width='100%'><tr><td colspan='" + col + "' class='title'><b>" + title + "</b></td></tr><tr>");
23
+ for (var i in d)
24
+ {
25
+ var product = d[i];
26
+ if (typeof (product) != "object") continue;
27
+ if (count == col)
28
+ {
29
+ s.push("</tr><tr>");
30
+ count = 0;
31
+ }
32
+ s.push("<td class='product'>");
33
+ s.push("<div class='img'><img src='");
34
+ s.push(product.image_url);
35
+ s.push("' width='125' height='125'/></div><div class='link'><a href='");
36
+ s.push(product.url);
37
+ s.push("'>");
38
+ s.push(product.name);
39
+ s.push("</a></div></td>");
40
+ ++count;
41
+ }
42
+ s.push("</tr></table>");
43
+ _nRepData["customParams"][dataName + '_string'] = s.join('');
44
+ }
45
+ (function (){
46
+ if (_nRepData["customParams"])
47
+ {
48
+ if (_nRepData["customParams"]['orders'])
49
+ {
50
+ var s = [];
51
+ var d = _nRepData["customParams"]['orders'];
52
+ s.push("<table class='orderNRD' width='100%'><tr class='orders'><th>Order #</th><th>Status</th><th>Details</th></tr>");
53
+ for (var i in d)
54
+ {
55
+ for (var j in d[i])
56
+ {
57
+ if (isNaN(j)) continue;
58
+ var order = d[i][j];
59
+ if (typeof (order) != "object") continue;
60
+ s.push("<tr><td><b>");
61
+ s.push(j);
62
+ s.push("</b></td><td>");
63
+ s.push(order.status);
64
+ s.push("</td><td><a href='");
65
+ s.push(order.link);
66
+ s.push("'>Click for details</a></td></tr>");
67
+ }
68
+ }
69
+ s.push("</table>");
70
+ _nRepData["customParams"]['orders_string'] = s.join('');
71
+ }
72
+ if (_nRepData["customParams"]['relatedProducts'])
73
+ {
74
+ parseOrdersNrepData('relatedProducts', "You may also be interested in the following product(s):");
75
+ }
76
+ if (_nRepData["customParams"]['upSellsProducts'])
77
+ {
78
+ parseOrdersNrepData('upSellsProducts', "You may also be interested in the following product(s):");
79
+ }
80
+ if (_nRepData["customParams"]['crossSellsProducts'])
81
+ {
82
+ parseOrdersNrepData('crossSellsProducts', "You may also be interested in the following product(s):");
83
+ }
84
+ if (_nRepData["customParams"]['bundleProducts'])
85
+ {
86
+ parseOrdersNrepData('bundleProducts', "The following products are included:");
87
+ }
88
+ }
89
+ })();
90
+ </script>
app/design/frontend/rwd/default/template/nanorepwidgets/success.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NanoRep Widgets Extension
4
+ *
5
+ * @package NanoRep_Widgets
6
+ * @company nanoRep.
7
+ * @website http://www.nanorep.com
8
+ * @author Dan Aharon-Shalom
9
+ */
10
+ ?>
11
+ <?php
12
+ $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
13
+ $order = Mage::getSingleton('sales/order');
14
+ $order->load($lastOrderId);
15
+ $total = $order->getGrandTotal();
16
+ ?>
17
+ <script type='text/javascript' src='https://my.nanorep.com/~<?php echo $this -> helper("nanorepwidgets")->getAccountName(); ?>/common/API/trackConversion.js?account=<?php echo $this -> helper("nanorepwidgets")->getAccountName(); ?>&revenue=<?php echo $total ?>&orderId=<?php echo $order->getIncrementId() ?>'></script>
app/etc/modules/NanoRep_Widgets.xml CHANGED
@@ -1,19 +1,10 @@
1
  <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * NanoRep Widgets Extension
5
- *
6
- * @package NanoRep_Widgets
7
- * @company Omniscience Co.
8
- * @website http://www.omniscience.co.il
9
- * @author Dan Aharon-Shalom
10
- */
11
- -->
12
  <config>
13
  <modules>
14
  <NanoRep_Widgets>
15
  <active>true</active>
16
  <codePool>local</codePool>
 
17
  </NanoRep_Widgets>
18
  </modules>
19
- </config>
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
  <modules>
4
  <NanoRep_Widgets>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <depends></depends>
8
  </NanoRep_Widgets>
9
  </modules>
10
+ </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NanoRep_Widgets_1_1_0</name>
4
- <version>1.5.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
  <channel>community</channel>
@@ -45,11 +45,11 @@ Agents get a 360&#xD;
45
  degree view of customers&#x2019; activity before&#xD;
46
  working on cases.&#xD;
47
  </description>
48
- <notes>nanoRep JS fix</notes>
49
  <authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
50
- <date>2014-07-31</date>
51
- <time>18:04:36</time>
52
- <contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><file name="Mynanorep.php" hash="8d2fc0ec21bf7c5583c308e81d4cabd8"/><dir name="Order"><file name="Grid.php" hash="4c2d639873e7d5dd099c9cbaa2013a50"/><dir name="View"><file name="Queries.php" hash="87b00acce9293ff50893be42e27e0542"/></dir></dir></dir><file name="Customerhistoryjson.php" hash="fa7ce0515f0de6e479d669691f5b85b2"/><file name="Events.php" hash="3ed310081949aa73c80710b29d559413"/><file name="General.php" hash="0e591128716cdf4fafd71a69ce98c755"/><file name="Success.php" hash="6ae59952edefcd75006f5f8323444765"/><file name="Support.php" hash="66251177c5fbfc9e755e2a26c9094e1b"/><file name="Top.php" hash="1de4cef71976b8767df923d41c315280"/></dir><dir name="Helper"><file name="Data.php" hash="ea377f4c8590004eca92a98f5aa425f1"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Attribute.php" hash="170f0dfbdcfa9b67bc18b0d03494e23b"/><file name="ProductIdAttribute.php" hash="f61e5d9a386bc030a78c012f81e88c2d"/></dir></dir></dir></dir><file name="History.php" hash="99ed12e3dfcb7a563825fd8418a50e59"/><dir name="Mysql4"><file name="Query.php" hash="c5f69b8c5e93e7d06fc1ff16c873790d"/><file name="Setup.php" hash="be89f73150df986eb994ebcf3dc7416e"/></dir><file name="Observer.php" hash="ccb1fff903eabbc01711a9bed8111689"/><file name="Query.php" hash="9f0f7f077766745d88535ae2a1805cb5"/><file name="Session.php" hash="4cd0cfe4a67bade3eb710aac7f8cfb40"/><dir name="System"><dir name="Config"><dir name="Source"><file name="FloatWidgetActivePages.php" hash="8feb17fe6ee045cba82f481a0bf90d5d"/><file name="OrdersStatusActivePages.php" hash="6bd1beff14a6fa24b78e3393a03245a4"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MynanorepController.php" hash="6846f66016c3faddcd8f6f4fb2b9deca"/></dir><file name="IndexController.php" hash="fddc21b9390b15e04b0aa391919f3930"/><file name="QueryController.php" hash="35975131cad35dcea58801613b3ab960"/></dir><dir name="etc"><file name="config.xml" hash="9045f9e2e857977fea271c387e64bba4"/><file name="system.xml" hash="f5c8df021b8ee710d40a723363913247"/></dir><dir name="sql"><dir name="nanorepwidgets_setup"><file name="mysql4-data-upgrade-1.2.2-1.2.3.php" hash="feaf8b31078707d0df7ff6758ec7a5d6"/><file name="mysql4-install-1.2.2.php" hash="869d64ee7d1d121a3b617c22b875949b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NanoRep_Widgets.xml" hash="4fbaad20e02fa3ed2147ba15864c3cab"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="9904b156a71752e9b67ba78bc3394e1a"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="ccc4e010b3ee2b8229b36ca9b6a87c0b"/><file name="events.phtml" hash="cbdce563c3e4032c6bf23ed732485c7d"/><file name="general.phtml" hash="e5505af4b24fbb6d719962ca986cf589"/><file name="grid.phtml" hash="5d3d5cadd384525b13d4f5b8e1a40f22"/><file name="success.phtml" hash="cf302cde4d93a16ad099505f4f1dbe58"/><file name="support.phtml" hash="476093e6c822d86c97056718c9a7d52f"/><file name="top.phtml" hash="44acbf50987f9c8c10cc4b4e10d42ff8"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir><dir name="default"><dir name="default"><dir name="template"><dir name="nanorepwidgets"><file name="mynanorep.phtml" hash="270b613ddddc94ad3e617c397f1f53a1"/><dir name="order"><dir name="view"><file name="queries.phtml" hash="bfb44dd77bba62629277aae45239ea6b"/><dir name="tab"><file name="info.phtml" hash="6dde16c3fe3bdddb65ca977d99872811"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="d818dd9f9b17bedccba27a8f715b71dd"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="nanorepwidgets"><file name="head.css" hash="1779a092e2c2a771a0725e1cdd682a46"/><file name="head.js" hash="8bafa94d8432b42e2e6e7f6af91db39e"/></dir></dir></dir></dir></target></contents>
53
  <compatible/>
54
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
55
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NanoRep_Widgets_1_1_0</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
  <channel>community</channel>
45
  degree view of customers&#x2019; activity before&#xD;
46
  working on cases.&#xD;
47
  </description>
48
+ <notes>nanoRep 2.0.0</notes>
49
  <authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
50
+ <date>2014-08-20</date>
51
+ <time>20:24:45</time>
52
+ <contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><dir name="Answer"><dir name="Grid"><file name="Export.php" hash="3c934f7ff615029ebcee9736273c660e"/></dir><file name="Grid.php" hash="f0b826da23190d34ee50c586472c0086"/></dir><file name="Answer.php" hash="2c1b7c5dfdd1485b6c3cd8eb2c134bcd"/><file name="Mynanorep.php" hash="a7aea34f919bc75ca9a2d374a115b3fa"/><dir name="Order"><dir name="Grid"><file name="Export.php" hash="d2e9e76282057ff241fa31477e503f5f"/></dir><file name="Grid.php" hash="b2e2407527e4c9271d5ba20d3ccc786f"/><dir name="View"><file name="Queries.php" hash="7c1c21f3cc8abc848fdf091c8b05d4cf"/></dir></dir><file name="Order.php" hash="39ebfd2fe23db490046ae8e324901b72"/><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Answer"><dir name="Body"><file name="Pretty.php" hash="0a7d01f7ff96b9bace44256e82ab047e"/></dir><file name="Body.php" hash="32323c59c38fc206f2419818ff8e3b90"/><dir name="Title"><file name="Pretty.php" hash="8719656b201622b2609eaeb287ad25ca"/></dir><file name="Title.php" hash="ad8ab9c932c299b0ecf1289685cc8300"/></dir><dir name="Questions"><file name="Pretty.php" hash="3ffd9f82f2c5c2696eed0f35f7109b9e"/></dir><file name="Questions.php" hash="1a979d2272acde87c1e907aa29816c6c"/><dir name="Results"><file name="Pretty.php" hash="54da8e4d7dad33c6ce3ad0ced6e66089"/></dir><file name="Results.php" hash="7ed187664b1883e7ce9890a835e237d9"/></dir></dir></dir></dir></dir><file name="Customerhistoryjson.php" hash="2e6a8dc4c0e5c49639ff088ac3910009"/><file name="Embed.php" hash="d2308942918ab58b9052c4619118afa6"/><file name="Events.php" hash="5f5f965d626c8b73c072db1fca506d4c"/><file name="Float.php" hash="e51c028ad72498a96dcd1b38ae2f18f7"/><file name="Header.php" hash="740ec34301d3738cbd054ed502145868"/><file name="Success.php" hash="9383181f50edf203c457872412de7a0c"/></dir><dir name="Helper"><file name="Data.php" hash="f16dda0d1ce9c3e1c2b367c06c88c084"/></dir><dir name="Model"><file name="Answer.php" hash="3931d7299a746e0ac90a6cae4a154982"/><file name="History.php" hash="0ffa4f8d5366abc1f7702e101cc5a90f"/><file name="Observer.php" hash="dec7cbc2f825f40ec18737b6bead79aa"/><file name="Query.php" hash="c4eaf10c4bae492d782b552550570215"/><dir name="Resource"><dir name="Answer"><file name="Collection.php" hash="d48492102f2c1534f637675d523ffbd5"/></dir><file name="Answer.php" hash="0f79604579c93d4315b62cc23d595a53"/><dir name="Query"><file name="Collection.php" hash="8fd53665b19f3f1bc2cc5bd823aff5a1"/></dir><file name="Query.php" hash="ccc5ae9e2e2f144c37fef2245033911c"/><file name="Setup.php" hash="812ef9ae3c38fe84eda2c702890faac5"/></dir><file name="Session.php" hash="63b7e34c1782e8e376936e7f196b0353"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attribute.php" hash="03529194354c0557a881305a69158fa5"/><file name="FloatWidgetActivePages.php" hash="e1f7f28f4e3e13ba13e4293eed61a943"/><file name="OrdersStatusActivePages.php" hash="f098536503386289102acfcc19d016a6"/><file name="ProductIdAttribute.php" hash="03c69b051e8ba54e47f87b6f1495c19e"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AnswerController.php" hash="c78297d83f113e8e01cc6b39158bdc66"/><file name="MynanorepController.php" hash="b411ddc154ef98ca3f568daab73fd003"/><file name="OrderController.php" hash="b5484dde49a2ebbcc8b0933bcad4c0bb"/></dir><file name="IndexController.php" hash="0b89743031ac153c1e4e99e40f145c16"/><file name="QueryController.php" hash="58145cd9ff89c0bc7ff078c0d11b4d83"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6b796ffd37d982a516efac2d8870c4dc"/><file name="config.xml" hash="4a37edcc5e1cc6865ea4f6c06fd0ffa6"/><file name="system.xml" hash="22d7d892bb3c08dc416f38b64ad1c2eb"/></dir><dir name="sql"><dir name="nanorepwidgets_setup"><file name="install-2.0.0.php" hash="df808cb581bb4e2cf8a03687c2969d1b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NanoRep_Widgets.xml" hash="913abeaceca820e4026066729e8702aa"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="420bdca5200d6ada621629c3fb222035"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="ff40178eae7b67468f689543b9146c3a"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="496642ef60ea17dee20137da26179e5c"/><file name="success.phtml" hash="609ac352097e81029376c1791c24fbb1"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="420bdca5200d6ada621629c3fb222035"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="ff40178eae7b67468f689543b9146c3a"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="496642ef60ea17dee20137da26179e5c"/><file name="success.phtml" hash="609ac352097e81029376c1791c24fbb1"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir><dir name="default"><dir name="default"><dir name="template"><dir name="nanorepwidgets"><file name="mynanorep.phtml" hash="ecdbcbdfbe5c4e4ed18aaf74492b5adb"/><dir name="order"><dir name="view"><file name="queries.phtml" hash="0c4e8fdd10069b2c14bb2096585eb866"/><dir name="tab"><file name="info.phtml" hash="b7d4f357da6def4bf1d6889ee95f45bb"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="cc7420519fe49a85f9f93cec3064a835"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="nanorepwidgets"><file name="head.css" hash="1779a092e2c2a771a0725e1cdd682a46"/><file name="head.js" hash="8bafa94d8432b42e2e6e7f6af91db39e"/></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="nanorepwidgets"><file name="head.css" hash="1779a092e2c2a771a0725e1cdd682a46"/><file name="head.js" hash="8bafa94d8432b42e2e6e7f6af91db39e"/></dir></dir></dir></dir></target></contents>
53
  <compatible/>
54
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
55
  </package>
skin/frontend/rwd/default/nanorepwidgets/head.css ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .nR_title_cl {
2
+ background: url("https://my.nanorep.com/widget/skins/mp_sprites.png") no-repeat scroll 0 5px transparent;
3
+ padding: 0 0 0 18px;
4
+ }
5
+ .nR_title_op {
6
+ background: url("https://my.nanorep.com/widget/skins/mp_sprites.png") no-repeat scroll 0 -301px transparent;
7
+ padding: 0 0 0 18px;
8
+ }
9
+ .nR_title_text {
10
+ text-decoration: none;
11
+ font-size: 15px;
12
+ color: #090C69;
13
+ line-height: 24px;
14
+ cursor: pointer;
15
+ }
16
+ .nR_body {
17
+ display: none;
18
+ margin: 10px 18px;
19
+ font-size: 14px;
20
+ }
skin/frontend/rwd/default/nanorepwidgets/head.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var nrServer = 'https://my.nanorep.com';
2
+
3
+ // show/hide article text
4
+ function toggleArticle(id, account, kb, _event, el)
5
+ {
6
+ // ignore event if it didnt originate from span
7
+ var e = _event || window.event;
8
+ var target = e.target || e.srcElement;
9
+ if (target.parentNode != el && target.parentNode.parentNode != el) return;
10
+
11
+ var article = document.getElementById('article_' + id);
12
+ if (article.style.display == 'block')
13
+ {
14
+ el.className = 'nR_title_cl';
15
+ article.style.display = 'none';
16
+ }
17
+ else
18
+ {
19
+ el.className = 'nR_title_op';
20
+ article.style.display = 'block';
21
+
22
+ // request img
23
+ if (!el.statsRequested)
24
+ {
25
+ var url = new Array();
26
+ url.push(nrServer);
27
+ url.push('/~');
28
+ url.push(account);
29
+ url.push('/common/API/kbExportAnswer2.gif?rnd=');
30
+ url.push(Math.floor(Math.random() * 1000000));
31
+ url.push('&a=');
32
+ url.push(id);
33
+ url.push('&account=');
34
+ url.push(account);
35
+ url.push('&kb=');
36
+ url.push(kb);
37
+
38
+ downloadImage(url.join(''));
39
+ //document.body.appendChild(img);
40
+
41
+ el.statsRequested = true;
42
+ }
43
+ }
44
+ }
45
+ function downloadImage(url)
46
+ {
47
+ var img = new Image();
48
+ img.src = url;
49
+ img.style.width = '1px';
50
+ img.style.height = '1px';
51
+ img.style.display = 'none';
52
+ }
53
+ function onloadFnc(url)
54
+ {
55
+ downloadImage(nrServer + '/common/api/statshello.gif');
56
+ }