NanoRep_Widgets_1_1_0 - Version 2.0.3

Version Notes

Bug fix: "orders" customParam is not a array of objects
Bug fix: "Purchases assisted by nanoRep" shows incorrect product purchases
Bug fix: "nanoRep search report", same issue as before, toggling an answer opens another one
Bug fix: "Purchases assisted by nanoRep": only the first answer is presented.
Bug fix: sorting / column filtering
New Feature: HTML page to be placed as an iframe inside a nanoRep answer

Download this release

Release Info

Developer NanoRep
Extension NanoRep_Widgets_1_1_0
Version 2.0.3
Comparing to
See all releases


Code changes from version 2.0.2 to 2.0.3

app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid.php CHANGED
@@ -28,68 +28,64 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid extends Mage_Adminhtml_Block_W
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', 'main_table.product_id'));
91
 
92
- $filter = $this->getParam($this->getVarNameFilter(), null);
93
 
94
  if (is_string($filter)) {
95
  $data = $this->helper('adminhtml')->prepareFilterString($filter);
@@ -99,48 +95,47 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid extends Mage_Adminhtml_Block_W
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'),
@@ -152,6 +147,7 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid extends Mage_Adminhtml_Block_W
152
  'header' => $helper->__('Count'),
153
  'index' => 'answer_count',
154
  'filter' => false,
 
155
  ));
156
  $this->addColumn('date', array(
157
  'header' => Mage::helper('sales')->__('Date'),
@@ -165,19 +161,59 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid extends Mage_Adminhtml_Block_W
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
  }
28
  return Mage::app()->getStore($storeId);
29
  }
30
 
31
+ public function getAttributeId($name) {
32
+ $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
33
+ $code = $eavAttribute->getIdByCode('catalog_product', $name);
34
+ return $code;
35
+ }
36
+
37
  protected function _prepareCollection()
38
  {
39
  $store = $this->_getStore();
40
+ $collection = Mage::getResourceModel('nanorepwidgets/answer_collection');
41
+
42
+ $name_id = $this->getAttributeId('name');
43
+ $price_id = $this->getAttributeId('price');
44
+
45
+ $adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
46
+ // $adapter is your Zend_Db_Adapter...
47
+ $joinConditionName = 'at_name.entity_id = e.entity_id'
48
+ . $adapter->quoteInto(' AND at_name.attribute_id = ?', $name_id)
49
+ . $adapter->quoteInto(' AND at_name.store_id = ?', $store->getId());
50
+ $subQueryName = new Varien_Db_Select($adapter);
51
+ $subQueryName->from(array('e' => 'catalog_product_entity'),
52
+ array('e.entity_id'))
53
+ ->join(
54
+ array('at_name' => 'catalog_product_entity_varchar'),
55
+ $joinConditionName,
56
+ array('name' => 'at_name.value')
57
+ );
58
+
59
+ $joinConditionPrice = 'at_price.entity_id = e.entity_id'
60
+ . $adapter->quoteInto(' AND at_price.attribute_id = ?', $price_id)
61
+ . $adapter->quoteInto(' AND at_price.store_id = ?', $store->getId());
62
+ $subQueryPrice = new Varien_Db_Select($adapter);
63
+ $subQueryPrice->from(array('e' => 'catalog_product_entity'),
64
+ array('e.entity_id'))
65
+ ->join(
66
+ array('at_price' => 'catalog_product_entity_decimal'),
67
+ $joinConditionPrice,
68
+ array('price' => 'at_price.value')
69
+ );
 
 
70
 
 
 
 
 
 
 
71
 
72
+ // and then the main query
73
+ $query = new Varien_Db_Select($adapter);
74
+ $answerWithQuerySql = 'CONCAT(`answer_title`, ":::", GROUP_CONCAT(DISTINCT `query` SEPARATOR "###"))';
75
+ $query->from(array('main_table' => 'nanorepwidgets_answer'),
76
+ array('main_table.*', 'answer_count' => 'COUNT(`answer_id`)', 'answer_title_with_query' => $answerWithQuerySql))
77
+ ->joinLeft(array('product_name_table' => $subQueryName),
78
+ 'main_table.product_id = product_name_table.entity_id',
79
+ array('product_name' => 'product_name_table.name'))
80
+ ->joinLeft(array('product_price_table' => $subQueryPrice),
81
+ 'main_table.product_id = product_price_table.entity_id',
82
+ array('product_price' => 'product_price_table.price'));
83
+ $query->group(array('main_table.answer_id', 'main_table.product_id'));
84
+ $query->order(array('answer_id ASC', 'date DESC'));
85
 
86
+ $collection->setSelect($query);
 
 
 
 
 
 
 
 
 
 
 
87
 
88
+ $filter = $this->getParam($this->getVarNameFilter(), null);
89
 
90
  if (is_string($filter)) {
91
  $data = $this->helper('adminhtml')->prepareFilterString($filter);
95
  $this->_setFilterValues($filter);
96
  }
97
 
98
+ // echo $collection->getSelect();
99
+ $this->setCollection($collection);
100
+ parent::_prepareCollection();
101
+
102
  return $this;
103
  }
104
+
105
  protected function _prepareColumns()
106
  {
107
  $helper = Mage::helper('nanorepwidgets');
108
  $this->addColumn('product_id', array(
109
  'header' => $helper->__('Product #'),
110
  'index' => 'product_id',
111
+ 'order_callback' => array($this, '_sort')
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
+ 'order_callback' => array($this, '_sort')
 
 
119
  ));
120
  $this->addColumn('product_price', array(
121
  'header' => $helper->__('Product Price'),
122
+ 'type' => 'price',
123
  'index' => 'product_price',
124
+ 'filter_condition_callback' => array($this, '_productPriceFilter'),
125
+ 'order_callback' => array($this, '_sort')
126
  ));
 
 
 
 
 
127
  $this->addColumn('answer_id', array(
128
  'header' => $helper->__('Answer Id'),
129
  'index' => 'answer_id',
130
+ 'order_callback' => array($this, '_sort')
131
  ));
132
  $this->addColumn('answer_title_with_query', array(
133
  'header' => $helper->__('Answer Title'),
134
  'index' => 'answer_title_with_query',
135
+ 'filter_condition_callback' => array($this, '_answerTitleFilter'),
136
+ 'filter_index' => 'CONCAT(`answer_title`, ":::", GROUP_CONCAT(DISTINCT `query` SEPARATOR "###"))',
137
  'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title',
138
+ 'order_callback' => array($this, '_sort')
139
  ));
140
  $this->addColumn('answer_body', array(
141
  'header' => $helper->__('Answer Body'),
147
  'header' => $helper->__('Count'),
148
  'index' => 'answer_count',
149
  'filter' => false,
150
+ 'order_callback' => array($this, '_sort')
151
  ));
152
  $this->addColumn('date', array(
153
  'header' => Mage::helper('sales')->__('Date'),
161
  $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
162
  return parent::_prepareColumns();
163
  }
164
+
165
+ /**
166
+ * Sets sorting order by some column
167
+ *
168
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
169
+ *
170
+ * @return Mage_Adminhtml_Block_Widget_Grid
171
+ */
172
+ protected function _setCollectionOrder($column)
173
+ {
174
+ if ($column->getOrderCallback()) {
175
+ call_user_func($column->getOrderCallback(), $this->getCollection(), $column);
176
+
177
+ return $this;
178
+ }
179
+
180
+ return parent::_setCollectionOrder($column);
181
+ }
182
+
183
  public function getGridUrl()
184
  {
185
  return $this->getUrl('*/*/grid', array('_current'=>true));
186
  }
187
 
188
+ protected function _productNameFilter($collection, $column)
189
+ {
190
+ if (!$value = $column->getFilter()->getValue()) {
191
+ return $this;
192
+ }
193
+ $collection->getSelect()->where("`product_name_table`.`name` LIKE '%".$value."%'");
194
+ return $this;
195
+ }
196
+
197
+ protected function _productPriceFilter($collection, $column)
198
+ {
199
+ if (!$value = $column->getFilter()->getValue()) {
200
+ return $this;
201
+ }
202
+ $collection->getSelect()->where("`product_price_table`.`price` < ".$value["to"]." AND `product_price_table`.`price` > ".$value["from"]);
203
+ return $this;
204
+ }
205
+
206
+ protected function _answerTitleFilter($collection, $column){
207
+ if (!$value = $column->getFilter()->getValue()) {
208
+ return $this;
209
+ }
210
+ $collection->getSelect()->where("`query` LIKE '%".$value."%'");;
211
+ return $this;
212
+ }
213
+
214
+ protected function _sort($collection, $column){
215
+ $collection->getSelect()->reset( Zend_Db_Select::ORDER );
216
+ $collection->getSelect()->order(array($column->getIndex() . ' ' . strtoupper($column->getDir()), 'date DESC'));
217
+ return $this;
218
+ }
219
  }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Answer/Grid/Export.php CHANGED
@@ -26,64 +26,77 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid_Export extends Mage_Adminhtml_
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()
@@ -92,51 +105,111 @@ class NanoRep_Widgets_Block_Adminhtml_Answer_Grid_Export extends Mage_Adminhtml_
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
  }
26
  return Mage::app()->getStore($storeId);
27
  }
28
 
29
+ public function getAttributeId($name) {
30
+ $eavAttribute = new Mage_Eav_Model_Mysql4_Entity_Attribute();
31
+ $code = $eavAttribute->getIdByCode('catalog_product', $name);
32
+ return $code;
33
+ }
34
+
35
  protected function _prepareCollection()
36
  {
37
  $store = $this->_getStore();
38
+ $collection = Mage::getResourceModel('nanorepwidgets/answer_collection');
39
+
40
+ $name_id = $this->getAttributeId('name');
41
+ $price_id = $this->getAttributeId('price');
42
+
43
+ $adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
44
+ // $adapter is your Zend_Db_Adapter...
45
+ $joinConditionName = 'at_name.entity_id = e.entity_id'
46
+ . $adapter->quoteInto(' AND at_name.attribute_id = ?', $name_id)
47
+ . $adapter->quoteInto(' AND at_name.store_id = ?', $store->getId());
48
+ $subQueryName = new Varien_Db_Select($adapter);
49
+ $subQueryName->from(array('e' => 'catalog_product_entity'),
50
+ array('e.entity_id'))
51
+ ->join(
52
+ array('at_name' => 'catalog_product_entity_varchar'),
53
+ $joinConditionName,
54
+ array('name' => 'at_name.value')
55
+ );
56
+
57
+ $joinConditionPrice = 'at_price.entity_id = e.entity_id'
58
+ . $adapter->quoteInto(' AND at_price.attribute_id = ?', $price_id)
59
+ . $adapter->quoteInto(' AND at_price.store_id = ?', $store->getId());
60
+ $subQueryPrice = new Varien_Db_Select($adapter);
61
+ $subQueryPrice->from(array('e' => 'catalog_product_entity'),
62
+ array('e.entity_id'))
63
+ ->join(
64
+ array('at_price' => 'catalog_product_entity_decimal'),
65
+ $joinConditionPrice,
66
+ array('price' => 'at_price.value')
67
+ );
68
+
69
+
70
+ // and then the main query
71
+ $query = new Varien_Db_Select($adapter);
72
+ $answerWithQuerySql = 'CONCAT(`answer_title`, ":::", GROUP_CONCAT(DISTINCT `query` SEPARATOR "###"))';
73
+ $query->from(array('main_table' => 'nanorepwidgets_answer'),
74
+ array('main_table.*', 'answer_count' => 'COUNT(`answer_id`)', 'answer_title_with_query' => $answerWithQuerySql))
75
+ ->joinLeft(array('product_name_table' => $subQueryName),
76
+ 'main_table.product_id = product_name_table.entity_id',
77
+ array('product_name' => 'product_name_table.name'))
78
+ ->joinLeft(array('product_price_table' => $subQueryPrice),
79
+ 'main_table.product_id = product_price_table.entity_id',
80
+ array('product_price' => 'product_price_table.price'));
81
+ $query->group(array('main_table.answer_id', 'main_table.product_id'));
82
+ $query->order(array('answer_id ASC', 'date DESC'));
83
 
84
+ $collection->setSelect($query);
 
 
 
 
85
 
86
+ $filter = $this->getParam($this->getVarNameFilter(), null);
87
+
88
+ if (is_string($filter)) {
89
+ $data = $this->helper('adminhtml')->prepareFilterString($filter);
90
+ $this->_setFilterValues($data);
91
+ }
92
+ else if ($filter && is_array($filter)) {
93
+ $this->_setFilterValues($filter);
94
+ }
95
 
96
+ // echo $collection->getSelect();
97
+ $this->setCollection($collection);
98
+ parent::_prepareCollection();
 
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  return $this;
101
  }
102
  protected function _prepareColumns()
105
  $this->addColumn('product_id', array(
106
  'header' => $helper->__('Product #'),
107
  'index' => 'product_id',
108
+ 'order_callback' => array($this, '_sort')
109
+ // 'sortable' => false
110
  ));
111
  $this->addColumn('product_name', array(
112
  'header' => $helper->__('Product Name'),
113
  'index' => 'product_name',
114
+ 'filter_condition_callback' => array($this, '_productNameFilter'),
115
+ 'order_callback' => array($this, '_sort')
116
  ));
117
  $this->addColumn('product_price', array(
118
  'header' => $helper->__('Product Price'),
119
+ 'type' => 'price',
120
  'index' => 'product_price',
121
+ 'filter_condition_callback' => array($this, '_productPriceFilter'),
122
+ 'order_callback' => array($this, '_sort')
123
  ));
 
 
 
 
 
124
  $this->addColumn('answer_id', array(
125
  'header' => $helper->__('Answer Id'),
126
  'index' => 'answer_id',
127
+ 'order_callback' => array($this, '_sort')
128
  ));
129
  $this->addColumn('answer_title_with_query', array(
130
  'header' => $helper->__('Answer Title'),
131
  'index' => 'answer_title_with_query',
132
+ 'filter_condition_callback' => array($this, '_answerTitleFilter'),
133
+ 'filter_index' => 'CONCAT(`answer_title`, ":::", GROUP_CONCAT(DISTINCT `query` SEPARATOR "###"))',
134
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title_Pretty',
135
+ 'order_callback' => array($this, '_sort')
136
  ));
137
  $this->addColumn('answer_body', array(
138
  'header' => $helper->__('Answer Body'),
139
  'index' => 'answer_body',
140
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body_Pretty',
141
+ 'sortable' => false
142
  ));
143
  $this->addColumn('answer_count', array(
144
  'header' => $helper->__('Count'),
145
  'index' => 'answer_count',
146
+ 'filter' => false,
147
+ 'order_callback' => array($this, '_sort')
148
  ));
149
  $this->addColumn('date', array(
150
  'header' => Mage::helper('sales')->__('Date'),
151
  'index' => 'date',
152
  'type' => 'datetime',
153
  'width' => '100px',
154
+ 'sortable' => false
155
  ));
156
 
157
  $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
158
  $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
159
  return parent::_prepareColumns();
160
  }
161
+ /**
162
+ * Sets sorting order by some column
163
+ *
164
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
165
+ *
166
+ * @return Mage_Adminhtml_Block_Widget_Grid
167
+ */
168
+ protected function _setCollectionOrder($column)
169
+ {
170
+ if ($column->getOrderCallback()) {
171
+ call_user_func($column->getOrderCallback(), $this->getCollection(), $column);
172
+
173
+ return $this;
174
+ }
175
+
176
+ return parent::_setCollectionOrder($column);
177
+ }
178
+
179
  public function getGridUrl()
180
  {
181
  return $this->getUrl('*/*/grid', array('_current'=>true));
182
  }
183
+
184
+ protected function _productNameFilter($collection, $column)
185
+ {
186
+ if (!$value = $column->getFilter()->getValue()) {
187
+ return $this;
188
+ }
189
+ $collection->getSelect()->where("`product_name_table`.`name` LIKE '%".$value."%'");
190
+ return $this;
191
+ }
192
+
193
+ protected function _productPriceFilter($collection, $column)
194
+ {
195
+ if (!$value = $column->getFilter()->getValue()) {
196
+ return $this;
197
+ }
198
+ $collection->getSelect()->where("`product_price_table`.`price` < ".$value["to"]." AND `product_price_table`.`price` > ".$value["from"]);
199
+ return $this;
200
+ }
201
+
202
+ protected function _answerTitleFilter($collection, $column){
203
+ if (!$value = $column->getFilter()->getValue()) {
204
+ return $this;
205
+ }
206
+ $collection->getSelect()->where("`query` LIKE '%".$value."%'");;
207
+ return $this;
208
+ }
209
+
210
+ protected function _sort($collection, $column){
211
+ $collection->getSelect()->reset( Zend_Db_Select::ORDER );
212
+ $collection->getSelect()->order(array($column->getIndex() . ' ' . strtoupper($column->getDir()), 'date DESC'));
213
+ return $this;
214
+ }
215
  }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid.php CHANGED
@@ -23,8 +23,13 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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(
@@ -33,23 +38,22 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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
  }
@@ -60,33 +64,39 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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
@@ -94,7 +104,7 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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
 
@@ -102,7 +112,7 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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
 
@@ -110,7 +120,7 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
110
  'header' => $helper->__('Purchased On'),
111
  'type' => 'datetime',
112
  'index' => 'created_at',
113
- 'filter' => false,
114
  // 'sortable' => false
115
 
116
  ));
@@ -118,8 +128,82 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Wi
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
  }
23
  {
24
  $collection = Mage::getResourceModel('nanorepwidgets/query_collection')
25
  ->join(array('o' => 'sales/order'), 'main_table.order_id = o.entity_id')
26
+ ->join(array('s' => 'sales/order_address'), 'main_table.order_id = s.parent_id', array(
27
+ 'shipping_firstname' => 'firstname',
28
+ 'shipping_lastname' => 'lastname'
29
+ ))
30
+ ->join(array('p' => 'sales/order_item'), 'main_table.order_id = p.order_id AND main_table.product_id = p.product_id', array(
31
  'product_name' => 'name',
32
+ 'product_price' => 'row_total_incl_tax',
33
  'qty_ordered' => 'qty_ordered'
34
  ))
35
  ->addExpressionFieldToSelect(
38
  array('customer_firstname' => 'o.customer_firstname', 'customer_lastname' => 'o.customer_lastname'))
39
  ->addExpressionFieldToSelect(
40
  'shipping_fullname',
41
+ 'CONCAT({{shipping_customer_firstname}}, \' \', {{shipping_customer_lastname}})',
42
+ array('shipping_customer_firstname' => 's.firstname', 'shipping_customer_lastname' => 's.lastname'))
 
 
43
  ->addExpressionFieldToSelect(
44
  'questions',
45
+ 'GROUP_CONCAT(DISTINCT {{questions}} ORDER BY date ASC SEPARATOR ", ")',
46
  array('questions' => 'main_table.query'))
47
  ->addExpressionFieldToSelect(
48
  'grouped_results',
49
+ 'GROUP_CONCAT(DISTINCT {{grouped_results}} ORDER BY date ASC SEPARATOR ":::")',
50
  array('grouped_results' => 'main_table.results'))
51
  ;
52
+ $collection->getSelect()->where('s.address_type = "shipping"');
53
+ $collection->getSelect()->where('p.row_total_incl_tax IS NOT NULL');
54
  $this->setCollection($collection);
55
  $collection->getSelect()->group(array('main_table.product_id', 'main_table.order_id'));
56
+ $collection->getSelect()->order(array('main_table.product_id DESC'));
 
57
  parent::_prepareCollection();
58
  return $this;
59
  }
64
  $this->addColumn('product_id', array(
65
  'header' => $helper->__('Product #'),
66
  'index' => 'product_id',
67
+ 'order_callback' => array($this, '_sort')
68
  ));
69
  $this->addColumn('product_name', array(
70
  'header' => $helper->__('Products Purchased'),
71
  'index' => 'product_name',
72
+ 'filter_condition_callback' => array($this, '_productNameFilter'),
73
+ 'order_callback' => array($this, '_sort')
74
+ // 'filter' => false
75
  ));
76
  $this->addColumn('qty_ordered', array(
77
  'header' => $helper->__('Quantity'),
78
  'index' => 'qty_ordered',
79
+ 'order_callback' => array($this, '_sort')
80
  ));
81
  $this->addColumn('fullname', array(
82
  'header' => $helper->__('Bill to Name'),
83
  'index' => 'fullname',
84
  'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)',
85
+ 'order_callback' => array($this, '_sort')
86
  ));
87
  $this->addColumn('shipping_fullname', array(
88
  'header' => $helper->__('Ship to Name'),
89
  'index' => 'shipping_fullname',
90
+ 'filter_condition_callback' => array($this, '_shippingNameFilter'),
91
+ 'order_callback' => array($this, '_sort')
92
+ // 'sortable' => false
93
  ));
94
+ $this->addColumn('product_price', array(
95
  'header' => $helper->__('Purchased Price'),
96
+ 'index' => 'product_price',
97
  'type' => 'currency',
98
+ 'currency_code' => $currency,
99
+ 'order_callback' => array($this, '_sort')
100
  ));
101
 
102
  //Question(s) asked prior the submission
104
  'header' => $helper->__('Question(s) asked prior the submission'),
105
  'index' => 'questions',
106
  'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions',
107
+ 'filter_condition_callback' => array($this, '_queryFilter'),
108
  'sortable' => false
109
  ));
110
 
112
  'header' => $helper->__('Result(s) provided by nanoRep (Respectively)'),
113
  'index' => 'grouped_results',
114
  'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results',
115
+ 'filter_condition_callback' => array($this, '_resultFilter'),
116
  'sortable' => false
117
  ));
118
 
120
  'header' => $helper->__('Purchased On'),
121
  'type' => 'datetime',
122
  'index' => 'created_at',
123
+ 'filter_condition_callback' => array($this, '_createdAtFilter'),
124
  // 'sortable' => false
125
 
126
  ));
128
  $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
129
  return parent::_prepareColumns();
130
  }
131
+
132
+ /**
133
+ * Sets sorting order by some column
134
+ *
135
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
136
+ *
137
+ * @return Mage_Adminhtml_Block_Widget_Grid
138
+ */
139
+ protected function _setCollectionOrder($column)
140
+ {
141
+ if ($column->getOrderCallback()) {
142
+ call_user_func($column->getOrderCallback(), $this->getCollection(), $column);
143
+
144
+ return $this;
145
+ }
146
+
147
+ return parent::_setCollectionOrder($column);
148
+ }
149
+
150
  public function getGridUrl()
151
  {
152
  return $this->getUrl('*/*/grid', array('_current'=>true));
153
  }
154
+
155
+ protected function _productNameFilter($collection, $column)
156
+ {
157
+ if (!$value = $column->getFilter()->getValue()) {
158
+ return $this;
159
+ }
160
+ $collection->getSelect()->where("`p`.`name` LIKE '%".$value."%'");
161
+ return $this;
162
+ }
163
+
164
+ protected function _shippingNameFilter($collection, $column)
165
+ {
166
+ if (!$value = $column->getFilter()->getValue()) {
167
+ return $this;
168
+ }
169
+ $collection->getSelect()->where("CONCAT(s.firstname, ' ', s.lastname) LIKE '%".$value."%'");
170
+ return $this;
171
+ }
172
+
173
+ protected function _resultFilter($collection, $column)
174
+ {
175
+ if (!$value = $column->getFilter()->getValue()) {
176
+ return $this;
177
+ }
178
+ $collection->getSelect()->where("results LIKE '%".$value."%'");
179
+ return $this;
180
+ }
181
+
182
+ protected function _queryFilter($collection, $column)
183
+ {
184
+ if (!$value = $column->getFilter()->getValue()) {
185
+ return $this;
186
+ }
187
+ $collection->getSelect()->where("query LIKE '%".$value."%'");
188
+ return $this;
189
+ }
190
+
191
+ protected function _createdAtFilter($collection, $column)
192
+ {
193
+ if (!$value = $column->getFilter()->getValue()) {
194
+ return $this;
195
+ }
196
+ $to = Mage::getModel('core/date')->timestamp(strtotime($value["to"])); //Magento's timestamp function makes a usage of timezone and converts it to timestamp
197
+ $to = date('Y-m-d', $to);
198
+ $from = Mage::getModel('core/date')->timestamp(strtotime($value["from"])); //Magento's timestamp function makes a usage of timezone and converts it to timestamp
199
+ $from = date('Y-m-d', $from);
200
+ $collection->getSelect()->where("o.created_at < '".$to."' AND o.created_at > '".$from."'");
201
+ return $this;
202
+ }
203
+
204
+ protected function _sort($collection, $column){
205
+ $collection->getSelect()->reset( Zend_Db_Select::ORDER );
206
+ $collection->getSelect()->order(array($column->getIndex() . ' ' . strtoupper($column->getDir())));
207
+ return $this;
208
+ }
209
  }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid/Export.php CHANGED
@@ -23,8 +23,13 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid_Export extends Mage_Adminhtml_B
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(
@@ -33,21 +38,22 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid_Export extends Mage_Adminhtml_B
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
  }
@@ -58,56 +64,146 @@ class NanoRep_Widgets_Block_Adminhtml_Order_Grid_Export extends Mage_Adminhtml_B
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
  }
23
  {
24
  $collection = Mage::getResourceModel('nanorepwidgets/query_collection')
25
  ->join(array('o' => 'sales/order'), 'main_table.order_id = o.entity_id')
26
+ ->join(array('s' => 'sales/order_address'), 'main_table.order_id = s.parent_id', array(
27
+ 'shipping_firstname' => 'firstname',
28
+ 'shipping_lastname' => 'lastname'
29
+ ))
30
+ ->join(array('p' => 'sales/order_item'), 'main_table.order_id = p.order_id AND main_table.product_id = p.product_id', array(
31
  'product_name' => 'name',
32
+ 'product_price' => 'row_total_incl_tax',
33
  'qty_ordered' => 'qty_ordered'
34
  ))
35
  ->addExpressionFieldToSelect(
38
  array('customer_firstname' => 'o.customer_firstname', 'customer_lastname' => 'o.customer_lastname'))
39
  ->addExpressionFieldToSelect(
40
  'shipping_fullname',
41
+ 'CONCAT({{shipping_customer_firstname}}, \' \', {{shipping_customer_lastname}})',
42
+ array('shipping_customer_firstname' => 's.firstname', 'shipping_customer_lastname' => 's.lastname'))
 
 
43
  ->addExpressionFieldToSelect(
44
  'questions',
45
+ 'GROUP_CONCAT(DISTINCT {{questions}} ORDER BY date ASC SEPARATOR ", ")',
46
  array('questions' => 'main_table.query'))
47
  ->addExpressionFieldToSelect(
48
  'grouped_results',
49
+ 'GROUP_CONCAT(DISTINCT {{grouped_results}} ORDER BY date ASC SEPARATOR ":::")',
50
  array('grouped_results' => 'main_table.results'))
51
  ;
52
+ $collection->getSelect()->where('s.address_type = "shipping"');
53
+ $collection->getSelect()->where('p.row_total_incl_tax IS NOT NULL');
54
  $this->setCollection($collection);
55
+ $collection->getSelect()->group(array('main_table.product_id', 'main_table.order_id'));
56
+ $collection->getSelect()->order(array('main_table.product_id DESC'));
57
  parent::_prepareCollection();
58
  return $this;
59
  }
64
  $this->addColumn('product_id', array(
65
  'header' => $helper->__('Product #'),
66
  'index' => 'product_id',
67
+ 'order_callback' => array($this, '_sort')
68
  ));
69
  $this->addColumn('product_name', array(
70
  'header' => $helper->__('Products Purchased'),
71
  'index' => 'product_name',
72
+ 'filter_condition_callback' => array($this, '_productNameFilter'),
73
+ 'order_callback' => array($this, '_sort')
74
+ // 'filter' => false
75
  ));
76
  $this->addColumn('qty_ordered', array(
77
  'header' => $helper->__('Quantity'),
78
  'index' => 'qty_ordered',
79
+ 'order_callback' => array($this, '_sort')
80
  ));
81
  $this->addColumn('fullname', array(
82
  'header' => $helper->__('Bill to Name'),
83
  'index' => 'fullname',
84
+ 'filter_index' => 'CONCAT(customer_firstname, \' \', customer_lastname)',
85
+ 'order_callback' => array($this, '_sort')
86
  ));
87
  $this->addColumn('shipping_fullname', array(
88
  'header' => $helper->__('Ship to Name'),
89
  'index' => 'shipping_fullname',
90
+ 'filter_condition_callback' => array($this, '_shippingNameFilter'),
91
+ 'order_callback' => array($this, '_sort')
92
+ // 'sortable' => false
93
  ));
94
+ $this->addColumn('product_price', array(
95
  'header' => $helper->__('Purchased Price'),
96
+ 'index' => 'product_price',
97
  'type' => 'currency',
98
+ 'currency_code' => $currency,
99
+ 'order_callback' => array($this, '_sort')
100
  ));
101
 
102
  //Question(s) asked prior the submission
103
  $this->addColumn('questions', array(
104
  'header' => $helper->__('Question(s) asked prior the submission'),
105
  'index' => 'questions',
106
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Questions_Pretty',
107
+ 'filter_condition_callback' => array($this, '_queryFilter'),
108
+ 'sortable' => false
109
  ));
110
 
111
  $this->addColumn('grouped_results', array(
112
  'header' => $helper->__('Result(s) provided by nanoRep (Respectively)'),
113
  'index' => 'grouped_results',
114
+ 'renderer' => 'NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results_Pretty',
115
+ 'filter_condition_callback' => array($this, '_resultFilter'),
116
+ 'sortable' => false
117
  ));
118
 
119
  $this->addColumn('purchased_on', array(
120
  'header' => $helper->__('Purchased On'),
121
  'type' => 'datetime',
122
+ 'index' => 'created_at',
123
+ 'filter_condition_callback' => array($this, '_createdAtFilter'),
124
+ // 'sortable' => false
125
+
126
  ));
127
  $this->addExportType('*/*/exportCsv', $helper->__('CSV'));
128
  $this->addExportType('*/*/exportExcel', $helper->__('Excel XLS'));
129
  return parent::_prepareColumns();
130
  }
131
+
132
+ /**
133
+ * Sets sorting order by some column
134
+ *
135
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
136
+ *
137
+ * @return Mage_Adminhtml_Block_Widget_Grid
138
+ */
139
+ protected function _setCollectionOrder($column)
140
+ {
141
+ if ($column->getOrderCallback()) {
142
+ call_user_func($column->getOrderCallback(), $this->getCollection(), $column);
143
+
144
+ return $this;
145
+ }
146
+
147
+ return parent::_setCollectionOrder($column);
148
+ }
149
+
150
  public function getGridUrl()
151
  {
152
  return $this->getUrl('*/*/grid', array('_current'=>true));
153
  }
154
+
155
+ protected function _productNameFilter($collection, $column)
156
+ {
157
+ if (!$value = $column->getFilter()->getValue()) {
158
+ return $this;
159
+ }
160
+ $collection->getSelect()->where("`p`.`name` LIKE '%".$value."%'");
161
+ return $this;
162
+ }
163
+
164
+ protected function _shippingNameFilter($collection, $column)
165
+ {
166
+ if (!$value = $column->getFilter()->getValue()) {
167
+ return $this;
168
+ }
169
+ $collection->getSelect()->where("CONCAT(s.firstname, ' ', s.lastname) LIKE '%".$value."%'");
170
+ return $this;
171
+ }
172
+
173
+ protected function _resultFilter($collection, $column)
174
+ {
175
+ if (!$value = $column->getFilter()->getValue()) {
176
+ return $this;
177
+ }
178
+ $collection->getSelect()->where("results LIKE '%".$value."%'");
179
+ return $this;
180
+ }
181
+
182
+ protected function _queryFilter($collection, $column)
183
+ {
184
+ if (!$value = $column->getFilter()->getValue()) {
185
+ return $this;
186
+ }
187
+ $collection->getSelect()->where("query LIKE '%".$value."%'");
188
+ return $this;
189
+ }
190
+
191
+ protected function _createdAtFilter($collection, $column)
192
+ {
193
+ if (!$value = $column->getFilter()->getValue()) {
194
+ return $this;
195
+ }
196
+ $to = Mage::getModel('core/date')->timestamp(strtotime($value["to"])); //Magento's timestamp function makes a usage of timezone and converts it to timestamp
197
+ $to = date('Y-m-d', $to);
198
+ $from = Mage::getModel('core/date')->timestamp(strtotime($value["from"])); //Magento's timestamp function makes a usage of timezone and converts it to timestamp
199
+ $from = date('Y-m-d', $from);
200
+ $collection->getSelect()->where("o.created_at < '".$to."' AND o.created_at > '".$from."'");
201
+ return $this;
202
+ }
203
+
204
+ protected function _sort($collection, $column){
205
+ $collection->getSelect()->reset( Zend_Db_Select::ORDER );
206
+ $collection->getSelect()->order(array($column->getIndex() . ' ' . strtoupper($column->getDir())));
207
+ return $this;
208
+ }
209
  }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Body.php CHANGED
@@ -13,8 +13,8 @@ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Body ex
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 != ""){
13
  $value = $row -> getData($this -> getColumn() -> getIndex());
14
  $out = array();
15
  if($value != ""){
16
+ $out[] = '<a href="#" onclick="$(\'answer_body_'.$row->getEntityId().'_place_holder\').toggle();">Toggle Body</a>';
17
+ $out[] = '<div id="answer_body_'.$row->getEntityId().'_place_holder" style="display:none;">';
18
  }
19
  $out[] = htmlspecialchars_decode($value);
20
  if($value != ""){
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Answer/Title/Pretty.php CHANGED
@@ -18,7 +18,7 @@ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Answer_Title_P
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;">';
18
  // if(count($value_arr) > 1 && $value_arr[1] != ""){
19
  // $out[] = '<a href="#" onclick="$(\'answer_query_'.$row->getAnswerId().'_place_holder\').toggle();">';
20
  // }
21
+ $out[] = str_replace('&lt;', "<", str_replace('&gt;', ">", 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;">';
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results.php CHANGED
@@ -21,6 +21,7 @@ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results extend
21
  foreach ($results as $aid => $result) {
22
  $title = "";
23
  $body = "";
 
24
  foreach ($result as $key => $value) {
25
  if($key == "title"){
26
  $title = $value;
@@ -28,10 +29,13 @@ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results extend
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/>';
21
  foreach ($results as $aid => $result) {
22
  $title = "";
23
  $body = "";
24
+ $answer_id = "";
25
  foreach ($result as $key => $value) {
26
  if($key == "title"){
27
  $title = $value;
29
  if($key == "body"){
30
  $body = $value;
31
  }
32
+ if($key == "answerId"){
33
+ $answer_id = $value;
34
+ }
35
  }
36
+ if($title != "" && $body != "" && $answer_id != ""){
37
+ $out[] = $title . ' <a href="#" onclick="$(\'answer_body_'.$answer_id.'-'.$row->getQueryId().'_place_holder\').toggle();">Toggle Body</a>';
38
+ $out[] = '<div id="answer_body_'.$answer_id.'-'.$row->getQueryId().'_place_holder" style="display:none;">';
39
  $out[] = $body;
40
  $out[] = '</div>';
41
  $out[] = '<br/>';
app/code/local/NanoRep/Widgets/Block/Adminhtml/Widget/Grid/Column/Renderer/Results/Pretty.php CHANGED
@@ -30,15 +30,15 @@ class NanoRep_Widgets_Block_Adminhtml_Widget_Grid_Column_Renderer_Results_Pretty
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);
30
  }
31
  }
32
  if($title != "" && $body != ""){
33
+ $out[] = addslashes(strip_tags($title))."\r\n";
34
  $out[] = "\t".addslashes(strip_tags($body));
35
+ $out[] = "\r\n";
36
  }
37
  }
38
  $limit--;
39
  }
40
  array_pop($out);
41
+ $out[] = "\r\n";
42
  }
43
  }
44
  array_pop($out);
app/code/local/NanoRep/Widgets/Model/Resource/Answer/Collection.php CHANGED
@@ -34,4 +34,30 @@ class NanoRep_Widgets_Model_Resource_Answer_Collection extends Mage_Core_Model_R
34
  ->addFilterToMap('entity_id', 'main_table.entity_id')
35
  ->addFilterToMap('product_id', 'main_table.product_id');
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
 
34
  ->addFilterToMap('entity_id', 'main_table.entity_id')
35
  ->addFilterToMap('product_id', 'main_table.product_id');
36
  }
37
+
38
+ public function setSelect($select){
39
+ $this->_select = $select;
40
+ }
41
+
42
+ /**
43
+ * Get SQL for get record count
44
+ *
45
+ * @return Varien_Db_Select
46
+ */
47
+ public function getSelectCountSql()
48
+ {
49
+ $this->_renderFilters();
50
+
51
+ $countSelect = clone $this->getSelect();
52
+ $countSelect->reset(Zend_Db_Select::ORDER);
53
+ $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
54
+ $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
55
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
56
+
57
+ $countSelect->columns('COUNT(*)');
58
+ $countSelect = 'SELECT COUNT(*) FROM ('.$countSelect.') AS A';
59
+ return $countSelect;
60
+ }
61
+
62
  }
63
+
app/code/local/NanoRep/Widgets/Model/Resource/Query/Collection.php CHANGED
@@ -60,4 +60,28 @@ class NanoRep_Widgets_Model_Resource_Query_Collection extends Mage_Core_Model_Re
60
  ->addFilterToMap('order_id', 'main_table.order_id')
61
  ->addFilterToMap('product_id', 'main_table.product_id');
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
60
  ->addFilterToMap('order_id', 'main_table.order_id')
61
  ->addFilterToMap('product_id', 'main_table.product_id');
62
  }
63
+
64
+ public function setSelect($select){
65
+ $this->_select = $select;
66
+ }
67
+
68
+ /**
69
+ * Get SQL for get record count
70
+ *
71
+ * @return Varien_Db_Select
72
+ */
73
+ public function getSelectCountSql()
74
+ {
75
+ $this->_renderFilters();
76
+
77
+ $countSelect = clone $this->getSelect();
78
+ $countSelect->reset(Zend_Db_Select::ORDER);
79
+ $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
80
+ $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
81
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
82
+
83
+ $countSelect->columns('COUNT(*)');
84
+ $countSelect = 'SELECT COUNT(*) FROM ('.$countSelect.') AS A';
85
+ return $countSelect;
86
+ }
87
  }
app/code/local/NanoRep/Widgets/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <NanoRep_Widgets>
15
- <version>2.0.2</version>
16
  </NanoRep_Widgets>
17
  </modules>
18
  <global>
12
  <config>
13
  <modules>
14
  <NanoRep_Widgets>
15
+ <version>2.0.3</version>
16
  </NanoRep_Widgets>
17
  </modules>
18
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NanoRep_Widgets_1_1_0</name>
4
- <version>2.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
  <channel>community</channel>
@@ -45,12 +45,16 @@ Agents get a 360&#xD;
45
  degree view of customers&#x2019; activity before&#xD;
46
  working on cases.&#xD;
47
  </description>
48
- <notes>new feature: get order status in answer.&#xD;
49
- </notes>
 
 
 
 
50
  <authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
51
- <date>2014-09-10</date>
52
- <time>08:08:13</time>
53
- <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="e9a6ba6dd9d946784ec710cfeddf9c09"/></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="115ee0a85937406fa07e8d439f1e3dbb"/></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="88fbe58d72982d15434f4b0d1462942e"/><file name="Login.php" hash="9f9e488dd549d89d68add413bd5c07a4"/><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"><file name="AccountController.php" hash="a9853f1e00a0f9429b2e66d20f8a5c16"/><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="a88b39a8ee27925df32be3c57f95cbf6"/><file name="OrderController.php" hash="5f0920c026a25aceee8a72770f30bbe2"/><file name="QueryController.php" hash="58145cd9ff89c0bc7ff078c0d11b4d83"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6b796ffd37d982a516efac2d8870c4dc"/><file name="config.xml" hash="1aab3e88b581c4ae67de61e0db7bec02"/><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="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="229541d50121a5699b3da610921ff9af"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><file name="success.phtml" hash="609ac352097e81029376c1791c24fbb1"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="229541d50121a5699b3da610921ff9af"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><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>
54
  <compatible/>
55
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
56
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>NanoRep_Widgets_1_1_0</name>
4
+ <version>2.0.3</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>Bug fix: "orders" customParam is not a array of objects&#xD;
49
+ Bug fix: "Purchases assisted by nanoRep" shows incorrect product purchases&#xD;
50
+ Bug fix: "nanoRep search report", same issue as before, toggling an answer opens another one&#xD;
51
+ Bug fix: "Purchases assisted by nanoRep": only the first answer is presented.&#xD;
52
+ Bug fix: sorting / column filtering&#xD;
53
+ New Feature: HTML page to be placed as an iframe inside a nanoRep answer</notes>
54
  <authors><author><name>NanoRep</name><user>avivnanore</user><email>aviv@nanorep.com</email></author></authors>
55
+ <date>2014-09-23</date>
56
+ <time>10:37:12</time>
57
+ <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="98bed6330628da0056b9281cd0044ab1"/></dir><file name="Grid.php" hash="bda00ac3e4e1d85327eac227949e7bb5"/></dir><file name="Answer.php" hash="2c1b7c5dfdd1485b6c3cd8eb2c134bcd"/><file name="Mynanorep.php" hash="a7aea34f919bc75ca9a2d374a115b3fa"/><dir name="Order"><dir name="Grid"><file name="Export.php" hash="13bc156b3331c9b2dacde70e8483a909"/></dir><file name="Grid.php" hash="a78d4a0d35b0f1575763af33bb7c03e4"/><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="89f497faa6a03cac040834804439a8d2"/><dir name="Title"><file name="Pretty.php" hash="b47a584daaed1c1e55545877b097f75b"/></dir><file name="Title.php" hash="115ee0a85937406fa07e8d439f1e3dbb"/></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="f0c8ba45e792f4cfee6ce4a22a3898fa"/></dir><file name="Results.php" hash="d08aa0325398bc23b335df26ca48c53c"/></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="88fbe58d72982d15434f4b0d1462942e"/><file name="Login.php" hash="9f9e488dd549d89d68add413bd5c07a4"/><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="febae104bf1dd741119b8cf6f168b21d"/></dir><file name="Answer.php" hash="0f79604579c93d4315b62cc23d595a53"/><dir name="Query"><file name="Collection.php" hash="ab7cd2f853a4f21d216ee24748a9b1c8"/></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"><file name="AccountController.php" hash="a9853f1e00a0f9429b2e66d20f8a5c16"/><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="a88b39a8ee27925df32be3c57f95cbf6"/><file name="OrderController.php" hash="5f0920c026a25aceee8a72770f30bbe2"/><file name="QueryController.php" hash="58145cd9ff89c0bc7ff078c0d11b4d83"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6b796ffd37d982a516efac2d8870c4dc"/><file name="config.xml" hash="0cc4f4a8a2a8d4dcc1a41b690c2f8468"/><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="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="229541d50121a5699b3da610921ff9af"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><file name="success.phtml" hash="609ac352097e81029376c1791c24fbb1"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="nanorepwidgets.xml" hash="cb0c460f77b9ff6f9387043a9847ebf5"/></dir><dir name="template"><dir name="nanorepwidgets"><file name="cdc.phtml" hash="587dab4d48df5773746b7ddff0a0165b"/><file name="embed.phtml" hash="aa5aa60733402579a3e15ca08098075d"/><file name="events.phtml" hash="32c2e2b9f798104fb47db6a1a104783c"/><file name="float.phtml" hash="f0ede0529726201e76f94263a62222d5"/><file name="header.phtml" hash="229541d50121a5699b3da610921ff9af"/><file name="login.phtml" hash="614a1e232dc084e781eae2ce2a4e8bf8"/><dir name="order"><file name="list.phtml" hash="83009ccc06d76eacea13c96caaf77c44"/></dir><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>
58
  <compatible/>
59
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
60
  </package>