NanoRep_Widgets_1_1_0 - Version 1.3.5

Version Notes

Minor bug fix

Download this release

Release Info

Developer Magento Core Team
Extension NanoRep_Widgets_1_1_0
Version 1.3.5
Comparing to
See all releases


Version 1.3.5

Files changed (43) hide show
  1. app/code/local/NanoRep/Widgets/Block/Adminhtml/Mynanorep.php +13 -0
  2. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid.php +232 -0
  3. app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/View/Queries.php +172 -0
  4. app/code/local/NanoRep/Widgets/Block/Customerhistoryjson.php +50 -0
  5. app/code/local/NanoRep/Widgets/Block/Events.php +14 -0
  6. app/code/local/NanoRep/Widgets/Block/General.php +14 -0
  7. app/code/local/NanoRep/Widgets/Block/Product.php +25 -0
  8. app/code/local/NanoRep/Widgets/Block/Success.php +18 -0
  9. app/code/local/NanoRep/Widgets/Block/SupportWidget.php +196 -0
  10. app/code/local/NanoRep/Widgets/Block/Top.php +88 -0
  11. app/code/local/NanoRep/Widgets/Helper/Data.php +112 -0
  12. app/code/local/NanoRep/Widgets/Model/Adminhtml/System/Config/Source/Attribute.php +38 -0
  13. app/code/local/NanoRep/Widgets/Model/History.php +15 -0
  14. app/code/local/NanoRep/Widgets/Model/Mysql4/Query.php +15 -0
  15. app/code/local/NanoRep/Widgets/Model/Mysql4/Setup.php +13 -0
  16. app/code/local/NanoRep/Widgets/Model/Observer.php +62 -0
  17. app/code/local/NanoRep/Widgets/Model/Query.php +18 -0
  18. app/code/local/NanoRep/Widgets/Model/Session.php +34 -0
  19. app/code/local/NanoRep/Widgets/Model/System/Config/Source/FloatWidgetActivePages.php +25 -0
  20. app/code/local/NanoRep/Widgets/Model/System/Config/Source/OrdersStatusActivePages.php +25 -0
  21. app/code/local/NanoRep/Widgets/controllers/Adminhtml/MynanorepController.php +50 -0
  22. app/code/local/NanoRep/Widgets/controllers/IndexController.php +55 -0
  23. app/code/local/NanoRep/Widgets/controllers/QueryController.php +22 -0
  24. app/code/local/NanoRep/Widgets/etc/config.xml +212 -0
  25. app/code/local/NanoRep/Widgets/etc/system.xml +296 -0
  26. app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-data-upgrade-1.2.2-1.2.3.php +8 -0
  27. app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-install-1.2.2.php +13 -0
  28. app/design/adminhtml/default/default/layout/nanorepwidgets.xml +26 -0
  29. app/design/adminhtml/default/default/template/nanorepwidgets/mynanorep.phtml +33 -0
  30. app/design/adminhtml/default/default/template/nanorepwidgets/order/view/queries.phtml +41 -0
  31. app/design/adminhtml/default/default/template/nanorepwidgets/order/view/tab/info.phtml +136 -0
  32. app/design/frontend/default/default/layout/nanorepwidgets.xml +45 -0
  33. app/design/frontend/default/default/template/nanorepwidgets/cdc.phtml +76 -0
  34. app/design/frontend/default/default/template/nanorepwidgets/events.phtml +34 -0
  35. app/design/frontend/default/default/template/nanorepwidgets/general.phtml +46 -0
  36. app/design/frontend/default/default/template/nanorepwidgets/grid.phtml +229 -0
  37. app/design/frontend/default/default/template/nanorepwidgets/success.phtml +9 -0
  38. app/design/frontend/default/default/template/nanorepwidgets/support.phtml +55 -0
  39. app/design/frontend/default/default/template/nanorepwidgets/top.phtml +75 -0
  40. app/etc/modules/NanoRep_Widgets.xml +19 -0
  41. package.xml +22 -0
  42. skin/frontend/default/default/nanorepwidgets/head.css +20 -0
  43. skin/frontend/default/default/nanorepwidgets/head.js +56 -0
app/code/local/NanoRep/Widgets/Block/Adminhtml/Mynanorep.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class NanoRep_Widgets_Block_Adminhtml_Mynanorep extends Mage_Adminhtml_Block_Abstract
11
+ {
12
+
13
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/Grid.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }
app/code/local/NanoRep/Widgets/Block/Adminhtml/Order/View/Queries.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Order history block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class NanoRep_Widgets_Block_Adminhtml_Order_View_Queries extends Mage_Adminhtml_Block_Sales_Order_Abstract
35
+ {
36
+ /**
37
+ * Retrieve required options from parent
38
+ */
39
+ protected function _beforeToHtml()
40
+ {
41
+ parent::_beforeToHtml();
42
+ }
43
+
44
+ public function getOrderStoreName()
45
+ {
46
+ if ($this->getOrder()) {
47
+ $storeId = $this->getOrder()->getStoreId();
48
+ if (is_null($storeId)) {
49
+ $deleted = Mage::helper('adminhtml')->__(' [deleted]');
50
+ return nl2br($this->getOrder()->getStoreName()) . $deleted;
51
+ }
52
+ $store = Mage::app()->getStore($storeId);
53
+ $name = array(
54
+ $store->getWebsite()->getName(),
55
+ $store->getGroup()->getName(),
56
+ $store->getName()
57
+ );
58
+ return implode('<br/>', $name);
59
+ }
60
+ return null;
61
+ }
62
+
63
+ public function getCustomerGroupName()
64
+ {
65
+ if ($this->getOrder()) {
66
+ return Mage::getModel('customer/group')->load((int)$this->getOrder()->getCustomerGroupId())->getCode();
67
+ }
68
+ return null;
69
+ }
70
+
71
+ public function getCustomerViewUrl()
72
+ {
73
+ if ($this->getOrder()->getCustomerIsGuest() || !$this->getOrder()->getCustomerId()) {
74
+ return false;
75
+ }
76
+ return $this->getUrl('*/customer/edit', array('id' => $this->getOrder()->getCustomerId()));
77
+ }
78
+
79
+ public function getViewUrl($orderId)
80
+ {
81
+ return $this->getUrl('*/sales_order/view', array('order_id'=>$orderId));
82
+ }
83
+
84
+ /**
85
+ * Find sort order for account data
86
+ * Sort Order used as array key
87
+ *
88
+ * @param array $data
89
+ * @param int $sortOrder
90
+ * @return int
91
+ */
92
+ protected function _prepareAccountDataSortOrder(array $data, $sortOrder)
93
+ {
94
+ if (isset($data[$sortOrder])) {
95
+ return $this->_prepareAccountDataSortOrder($data, $sortOrder + 1);
96
+ }
97
+ return $sortOrder;
98
+ }
99
+
100
+ /**
101
+ * Return array of additional account data
102
+ * Value is option style array
103
+ *
104
+ * @return array
105
+ */
106
+ public function getCustomerAccountData()
107
+ {
108
+ $accountData = array();
109
+
110
+ /* @var $config Mage_Eav_Model_Config */
111
+ $config = Mage::getSingleton('eav/config');
112
+ $entityType = 'customer';
113
+ $customer = Mage::getModel('customer/customer');
114
+ foreach ($config->getEntityAttributeCodes($entityType) as $attributeCode) {
115
+ /* @var $attribute Mage_Customer_Model_Attribute */
116
+ $attribute = $config->getAttribute($entityType, $attributeCode);
117
+ if (!$attribute->getIsVisible() || $attribute->getIsSystem()) {
118
+ continue;
119
+ }
120
+ $orderKey = sprintf('customer_%s', $attribute->getAttributeCode());
121
+ $orderValue = $this->getOrder()->getData($orderKey);
122
+ if ($orderValue != '') {
123
+ $customer->setData($attribute->getAttributeCode(), $orderValue);
124
+ $dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $customer);
125
+ $value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_HTML);
126
+ $sortOrder = $attribute->getSortOrder() + $attribute->getIsUserDefined() ? 200 : 0;
127
+ $sortOrder = $this->_prepareAccountDataSortOrder($accountData, $sortOrder);
128
+ $accountData[$sortOrder] = array(
129
+ 'label' => $attribute->getFrontendLabel(),
130
+ 'value' => $this->escapeHtml($value, array('br'))
131
+ );
132
+ }
133
+ }
134
+
135
+ ksort($accountData, SORT_NUMERIC);
136
+
137
+ return $accountData;
138
+ }
139
+
140
+ /**
141
+ * Get link to edit order address page
142
+ *
143
+ * @param Mage_Sales_Model_Order_Address $address
144
+ * @param string $label
145
+ * @return string
146
+ */
147
+ public function getAddressEditLink($address, $label='')
148
+ {
149
+ if (empty($label)) {
150
+ $label = $this->__('Edit');
151
+ }
152
+ $url = $this->getUrl('*/sales_order/address', array('address_id'=>$address->getId()));
153
+ return '<a href="'.$url.'">' . $label . '</a>';
154
+ }
155
+
156
+ /**
157
+ * Whether Customer IP address should be displayed on sales documents
158
+ * @return bool
159
+ */
160
+ public function shouldDisplayCustomerIp()
161
+ {
162
+ return !Mage::getStoreConfigFlag('sales/general/hide_customer_ip', $this->getOrder()->getStoreId());
163
+ }
164
+
165
+ public function getQueries(){
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
+ }
app/code/local/NanoRep/Widgets/Block/Customerhistoryjson.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
14
+ * Retrieve collection class
15
+ *
16
+ * @return string
17
+ */
18
+ protected function _getCollectionClass()
19
+ {
20
+ return 'sales/order_collection';
21
+ }
22
+
23
+ protected function _beforeToHtml(){
24
+
25
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
26
+ $historyModel = Mage::getSingleton('nanorepwidgets/history');
27
+ if(!is_null($historyModel->getEmail()) && $historyModel->getEmail() != ""){
28
+ $collection->addAttributeToFilter("customer_email", $historyModel->getEmail());
29
+ $this->setCollection($collection);
30
+ }
31
+
32
+ $orders = array();
33
+
34
+ foreach ($collection as $order) {
35
+ $link = $this->helper("adminhtml")->getUrl('adminhtml/sales_order/view', array("order_id" => $order->getId()));
36
+ $orders[] = array(
37
+ "id" => $order->getId(),
38
+ "created_at"=> $order->getData('created_at'),
39
+ "grand_total" => $order->getData('grand_total'),
40
+ "link" => $link
41
+ );
42
+ }
43
+ echo "orderHistory =" . Zend_Json::encode($orders) . ";";
44
+ if(!is_null($historyModel->getCallbackMethod()) && $historyModel->getCallbackMethod() != ""){
45
+ $callbackMethod = $historyModel->getCallbackMethod();
46
+ echo $callbackMethod."(orderHistory);";
47
+ }
48
+ }
49
+ }
50
+
app/code/local/NanoRep/Widgets/Block/Events.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Events extends Mage_Core_Block_Template
12
+ {
13
+
14
+ }
app/code/local/NanoRep/Widgets/Block/General.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/Product.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Product extends Mage_Core_Block_Template
12
+ {
13
+ private $_product = NULL;
14
+ private $category = NULL;
15
+
16
+ public function getProduct()
17
+ {
18
+ if(is_null($this->_product) && !is_null(Mage::registry("current_product")) ){
19
+ $this->_product = Mage::registry("current_product");
20
+ return $this->_product;
21
+ }
22
+
23
+ return false;
24
+ }
25
+ }
app/code/local/NanoRep/Widgets/Block/Success.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Success extends Mage_Core_Block_Template
12
+ {
13
+ public function __construct()
14
+ {
15
+ parent::__construct();
16
+ $this->setTemplate('nanorepwidgets/success.phtml');
17
+ }
18
+ }
app/code/local/NanoRep/Widgets/Block/SupportWidget.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_SupportWidget extends Mage_Core_Block_Template
12
+ {
13
+ public function getXml($forProduct = false)
14
+ {
15
+ $helper = $this -> helper("nanorepwidgets");
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'))){
29
+ $product = Mage::registry('current_product');
30
+ }
31
+ if($forProduct){
32
+ $context = null;
33
+ if($product){
34
+ $context = array();
35
+ $context["ProductID"] = $product->getId();
36
+ }
37
+ }
38
+ $cacheTime = $helper -> getSupportWidgetCacheTimeout(); // how long to store the data in the cache (seconds)
39
+
40
+ //////////////////////////////////////////////////////////////////////////
41
+ // do not edit below this line
42
+ //////////////////////////////////////////////////////////////////////////
43
+ $contextStr = "";
44
+ $replace = array("=", "+");
45
+ $replacer = array("_", "|");
46
+
47
+ if($textFilter != null)
48
+ {
49
+ $textFilter = base64_encode($textFilter);
50
+ $textFilter = str_replace($replace, $replacer, $textFilter);
51
+ }
52
+ if($context != null)
53
+ {
54
+ $contextStr = "";
55
+ foreach($context as $key=>$val)
56
+ {
57
+ if(strlen($contextStr) > 0)
58
+ $contextStr .= ',';
59
+ $contextStr .= $key.':'.$val;
60
+ }
61
+ $contextStr = base64_encode($contextStr);
62
+ $contextStr = str_replace($replace, $replacer, $contextStr);
63
+ }
64
+ $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;
65
+ $cache_file = Mage::getBaseDir('cache') . "/nanorepcachekb.txt";
66
+ if($forProduct){
67
+ $cache_file = Mage::getBaseDir('cache') . "/nanorepcachekb-p".$product->getId().".txt";
68
+ }
69
+
70
+
71
+ if(!file_exists($cache_file) || time() - $cacheTime > filemtime($cache_file) || strlen(file_get_contents($cache_file)) == 0)
72
+ {
73
+ $ch = curl_init($url);
74
+ $fp = fopen($cache_file, "w");
75
+
76
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
77
+ curl_setopt($ch, CURLOPT_FILE, $fp);
78
+ curl_setopt($ch, CURLOPT_HEADER, 0);
79
+ curl_exec($ch);
80
+ curl_close($ch);
81
+ fclose($fp);
82
+ }
83
+ $this->drawContents($cache_file, $forProduct, $product);
84
+ }
85
+
86
+ private function drawContents($cachefile, $forProduct, $product)
87
+ {
88
+ $fileContent = file_get_contents($cachefile);
89
+ if(strlen($fileContent) != 0)
90
+ {
91
+ try
92
+ {
93
+ $xml = new SimpleXMLElement($fileContent);
94
+ $attributes = $xml->attributes();
95
+ $account = $attributes["account"];
96
+ $kb_id = $attributes["kb"];
97
+ $items = $xml->xpath("article");
98
+ $out = "";
99
+ $items_out = "";
100
+ if(count($items) > 0){
101
+ if($forProduct){
102
+ $out .= '<div id="nanoRepProductFaq">';
103
+ if(Mage::getStoreConfig('nanorepwidgets/support_widget/product_faq_headline') != ""){
104
+ $out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/product_faq_headline') . '</h3>';
105
+ }
106
+ }
107
+ else{
108
+ $out .= '<div id="nanoRepGeneralFaq">';
109
+ if(Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') != ""){
110
+ $out .= '<h3>' . Mage::getStoreConfig('nanorepwidgets/support_widget/general_faq_headline') . '</h3>';
111
+ }
112
+ }
113
+ foreach($items as $item)
114
+ {
115
+ $product_attributes = array();
116
+ $product_attributes["productName"] = htmlspecialchars($product->getName());
117
+ $product_attributes["Price"] = $product->getFinalPrice();
118
+ //$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_id');
119
+ $attributes = $product->getAttributes();
120
+ $total_attributes = 0;
121
+ $use_hidden_attributes = Mage::getStoreConfigFlag('nanorepwidgets/account_settings/hidden_attributes');
122
+ $selected_attributes = $this->helper('nanorepwidgets')->getAttributes();
123
+ foreach ($attributes as $attribute) {
124
+ if ($selected_attributes[0] == "all"){
125
+ if($attribute->getAttributeCode() != "price")
126
+ $total_attributes++;
127
+ }
128
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
129
+ $total_attributes++;
130
+ }
131
+ }
132
+ foreach ($attributes as $attribute) {
133
+ if ($selected_attributes[0] == "all"){
134
+ if($attribute->getAttributeCode() != "price"){
135
+ if(is_string($attribute->getFrontend()->getValue($product))){
136
+ $product_attributes[$attribute->getAttributeCode()] = str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($product))))))));
137
+ }
138
+ $total_attributes--;
139
+ }
140
+ }
141
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
142
+ if(is_string($attribute->getFrontend()->getValue($product))){
143
+ $product_attributes[$attribute->getAttributeCode()] = str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($product))))))));
144
+ }
145
+ $total_attributes--;
146
+ }
147
+ }
148
+ $product_attributes_codes = array_keys($product_attributes);
149
+ $value = (string)$item->body;
150
+ $context = $item->contextInfo->context["id"];
151
+ $tokens = array();
152
+ $itemVisible = true;
153
+ if($context == "ProductID" && !$forProduct){
154
+ $itemVisible = false;
155
+ }
156
+ if(preg_match_all("/\{\{(.*?)\}\}/i",$value, $matches)){
157
+ for ($i = 0; $i < count($matches[0]); $i++) {
158
+ $tokens[] =$matches[1][$i];
159
+ }
160
+ if(!empty($tokens)){
161
+ foreach($tokens as $code){
162
+ if(in_array($code, $product_attributes_codes)){
163
+ $value = preg_replace("/\{\{".$code."\}\}/i", $product_attributes[$code], (string)$item->body);
164
+ }
165
+ else{
166
+ $itemVisible = false;
167
+ }
168
+ }
169
+ }
170
+
171
+ }
172
+ if($itemVisible){
173
+ $items_out .= '<div class="nR_title_cl" onclick="toggleArticle(\''.$item["id"].'\', \''.$account.'\', \''.$kb_id.'\', event, this)">
174
+ <span class="nR_title_text">'.$item->title.'</span>
175
+ </div>';
176
+ $items_out .= '<div class="nR_body" id="article_'.$item["id"].'">';
177
+ $items_out .= $value;
178
+ $items_out .= '</div>';
179
+ }
180
+ }
181
+ if(!empty($items_out)){
182
+ $out .= $items_out;
183
+ $out .= '</div>';
184
+ echo $out;
185
+ }
186
+
187
+ }
188
+ }
189
+ catch(Exception $ex)
190
+ {
191
+ echo $fileContent;
192
+ }
193
+ }
194
+ }
195
+
196
+ }
app/code/local/NanoRep/Widgets/Block/Top.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ echo substr(Zend_Json::encode($orders), 1, strlen(Zend_Json::encode($orders)) - 2) . ",";
50
+ }
51
+ }
52
+ }
53
+
54
+ public function isUserLoggedIn(){
55
+ $session = Mage::getSingleton('customer/session');
56
+ // $customer = $session->getCustomer();
57
+ if($session->isLoggedIn()){
58
+ return "true";
59
+ }
60
+ return "false";
61
+ }
62
+
63
+ public function getCategory(){
64
+ // $_product = null;
65
+ // if(!is_null($this->getProduct())){
66
+ // $_product = $this->getProduct();
67
+ // }
68
+ // elseif(!is_null(Mage::registry('current_product'))) {
69
+ // $_product = Mage::registry('current_product');
70
+ // }
71
+ // else{
72
+ // $_product = null;
73
+ // }
74
+ // $categories = array();
75
+ // if(!is_null($_product)){
76
+ // foreach ($_product->getCategoryIds() as $cat_id) {
77
+ // $category = Mage::getModel('catalog/category')->load($cat_id);
78
+ // $categories[] = $category->getName();
79
+ // }
80
+ // echo '"Category": '. Zend_Json::encode($categories) . ',';
81
+ // }
82
+
83
+ $category = Mage::registry('current_category');
84
+ if(!is_null($category)){
85
+ echo '"Category": "'. $category->getId() . '",';
86
+ }
87
+ }
88
+ }
app/code/local/NanoRep/Widgets/Helper/Data.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
13
+ public function getAccountName(){
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(){
29
+ return Mage::getStoreConfig("nanorepwidgets/account_settings/username") . '@'. Mage::getStoreConfig("nanorepwidgets/account_settings/account_name");
30
+ }
31
+
32
+ public function getPassword(){
33
+ return Mage::getStoreConfig("nanorepwidgets/account_settings/password");
34
+ }
35
+
36
+ public function getAttributes(){
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 getSupportWidgetUsername(){
45
+ // return Mage::getStoreConfig("nanorepwidgets/support_widget/username");
46
+ // }
47
+
48
+ // public function getSupportWidgetPassword(){
49
+ // return Mage::getStoreConfig("nanorepwidgets/support_widget/password");
50
+ // }
51
+
52
+ public function getSupportWidgetWidth(){
53
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/width");
54
+ }
55
+
56
+ public function getSupportWidgetMaxHeight(){
57
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/max_height");
58
+ }
59
+
60
+
61
+ public function getSupportWidgetFaqNum(){
62
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/faq_num");
63
+ }
64
+
65
+ public function getSupportWidgetKb(){
66
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/kb");
67
+ }
68
+
69
+ public function getSupportWidgetSkip(){
70
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/skip");
71
+ }
72
+
73
+ public function getSupportWidgetByPopularity(){
74
+ return Mage::getStoreConfigFlag("nanorepwidgets/support_widget/by_popularity");
75
+ }
76
+
77
+ public function getSupportWidgetDays(){
78
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/days");
79
+ }
80
+
81
+ public function getSupportWidgetLabelId(){
82
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/label_id");
83
+ }
84
+
85
+ public function getSupportWidgetTextFilter(){
86
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/text_filter");
87
+ }
88
+
89
+ public function getSupportWidgetProductFaqHeadline(){
90
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/product_faq_headline");
91
+ }
92
+
93
+ public function getSupportWidgetGeneralFaqHeadline(){
94
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/general_faq_headline");
95
+ }
96
+
97
+ public function getSupportWidgetMaxItems(){
98
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/max_items");
99
+ }
100
+
101
+ public function getSupportWidgetCacheTimeout(){
102
+ return Mage::getStoreConfig("nanorepwidgets/support_widget/cache_timeout");
103
+ }
104
+
105
+ public function getStoreQueryInCookieUrl(){
106
+ return Mage::getBaseUrl() . 'nanorep/query/storeQuery';
107
+ }
108
+
109
+ public function getSession(){
110
+ return Mage::getSingleton('nanorepwidgets/session');
111
+ }
112
+ }
app/code/local/NanoRep/Widgets/Model/Adminhtml/System/Config/Source/Attribute.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class NanoRep_Widgets_Model_Adminhtml_System_Config_Source_Attribute
11
+ {
12
+ protected $_options;
13
+
14
+ public function toOptionArray($isMultiselect=false)
15
+ {
16
+ if (!$this->_options) {
17
+ $attributes = Mage::getSingleton('eav/config')
18
+ ->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
19
+ $this->_options[] = array('value'=>"all", 'label'=> Mage::helper('adminhtml')->__('--All--'));
20
+ foreach ($attributes as $attr) {
21
+ $label = $attr->getStoreLabel() ? $attr->getStoreLabel() . " (".$attr->getAttributeCode().")" : $attr->getFrontendLabel() . " (".$attr->getAttributeCode().")";
22
+ $value = $attr->getAttributeCode();
23
+ if ($value != "price"){
24
+ if($label != ""){
25
+ $this->_options[] = array('value'=>$value, 'label'=> $label);
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ $options = $this->_options;
32
+ if(!$isMultiselect){
33
+ array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
34
+ }
35
+
36
+ return $options;
37
+ }
38
+ }
app/code/local/NanoRep/Widgets/Model/History.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_History extends Varien_Object
12
+ {
13
+
14
+ }
15
+
app/code/local/NanoRep/Widgets/Model/Mysql4/Query.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class NanoRep_Widgets_Model_Mysql4_Query extends Mage_Core_Model_Mysql4_Abstract{
11
+ protected function _construct()
12
+ {
13
+ $this->_init('nanorepwidgets/query', 'query_id');
14
+ }
15
+ }
app/code/local/NanoRep/Widgets/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Observer
12
+ {
13
+ private $session;
14
+
15
+ public function __construct(){
16
+ $this->_session = Mage::helper('nanorepwidgets')->getSession();
17
+ }
18
+ /**
19
+ * Add order information into NanoRep Widget block to render on checkout success pages
20
+ *
21
+ * @param Varien_Event_Observer $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');
32
+ if ($block) {
33
+ $body = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('before_body_end');
34
+ $body->append($block);
35
+ }
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
+
53
+ private function _isThereNanoRepQueryInCustomerSession(){
54
+ $queries = $this->_session->getData('nanorep_queries');
55
+ return (!is_null($queries) && !empty($queries)) ? true: false;
56
+ }
57
+
58
+ private function _getNanorepQueries(){
59
+ $queries = $this->_session->getData('nanorep_queries');
60
+ return $queries;
61
+ }
62
+ }
app/code/local/NanoRep/Widgets/Model/Query.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 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
+ }
app/code/local/NanoRep/Widgets/Model/Session.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
28
+ class NanoRep_Widgets_Model_Session extends Mage_Core_Model_Session_Abstract
29
+ {
30
+ public function __construct()
31
+ {
32
+ $this->init('nanorepwidgets');
33
+ }
34
+ }
app/code/local/NanoRep/Widgets/Model/System/Config/Source/FloatWidgetActivePages.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_System_Config_Source_FloatWidgetActivePages {
12
+ public function toOptionArray() {
13
+ return array(
14
+ array(
15
+ 'value' => 0,
16
+ 'label' => Mage::helper('nanorepwidgets') -> __('All Pages')
17
+ ),
18
+ array(
19
+ 'value' => 1,
20
+ 'label' => Mage::helper('nanorepwidgets') -> __('Product Pages Only')
21
+ )
22
+ );
23
+ }
24
+
25
+ }
app/code/local/NanoRep/Widgets/Model/System/Config/Source/OrdersStatusActivePages.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_System_Config_Source_OrdersStatusActivePages {
12
+ public function toOptionArray() {
13
+ return array(
14
+ array(
15
+ 'value' => 0,
16
+ 'label' => Mage::helper('nanorepwidgets') -> __('All Pages')
17
+ ),
18
+ array(
19
+ 'value' => 1,
20
+ 'label' => Mage::helper('nanorepwidgets') -> __('Customer Account Pages')
21
+ )
22
+ );
23
+ }
24
+
25
+ }
app/code/local/NanoRep/Widgets/controllers/Adminhtml/MynanorepController.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class NanoRep_Widgets_Adminhtml_MynanorepController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ protected function _construct()
13
+ {
14
+ // Define module dependent translate
15
+ $this->setUsedModuleName('NanoRep_Widgets');
16
+ }
17
+
18
+ public function indexAction()
19
+ {
20
+ $this->_title($this->__('my.nanoRep'));
21
+
22
+ $this->loadLayout();
23
+ $this->_setActiveMenu('nanorep/mynanorep');
24
+ $this->renderLayout();
25
+ }
26
+
27
+ public function getcustomerhistoryAction(){
28
+ $email = $this->getRequest()->getParam("email");
29
+ $this->loadLayout();
30
+ $grid = Mage::getSingleton("nanorepwidgets/grid");
31
+ $grid->setEmail($email);
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
+ }
app/code/local/NanoRep/Widgets/controllers/IndexController.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class NanoRep_Widgets_IndexController extends Mage_Core_Controller_Front_Action
11
+ {
12
+ private $admin_logged_in = false;
13
+
14
+ public function preDispatch(){
15
+ // Ensure we're in the admin session namespace for checking the admin user..
16
+ Mage::getSingleton('core/session', array('name' => 'adminhtml'))->start();
17
+
18
+ $this->admin_logged_in = Mage::getSingleton('admin/session', array('name' => 'adminhtml'))->isLoggedIn();
19
+
20
+ // ..get back to the original.
21
+ Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
22
+
23
+ parent::preDispatch();
24
+ }
25
+
26
+ public function getcustomerhistoryAction(){
27
+ if($this->admin_logged_in){
28
+ $email = $this->getRequest()->getParam("email");
29
+ $this->loadLayout();
30
+ $historyModel = Mage::getSingleton("nanorepwidgets/history");
31
+ $historyModel->setEmail($email);
32
+ // var_dump($grid);
33
+ $this->renderLayout();
34
+ }
35
+ }
36
+
37
+ public function getcustomerhistoryjsonAction(){
38
+ if($this->admin_logged_in){
39
+ $email = $this->getRequest()->getParam("email");
40
+ $callbackMethod = $this->getRequest()->getParam("callback_method");
41
+ $this->loadLayout();
42
+ $historyModel = Mage::getSingleton("nanorepwidgets/history");
43
+ $historyModel->setEmail($email);
44
+ if(!is_null($callbackMethod) && $callbackMethod != "")
45
+ $historyModel->setCallbackMethod($callbackMethod);
46
+ $this->renderLayout();
47
+ }
48
+ }
49
+
50
+ public function cdcAction(){
51
+ $this->loadLayout();
52
+ $this->renderLayout();
53
+ }
54
+
55
+ }
app/code/local/NanoRep/Widgets/controllers/QueryController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ 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
+ }
app/code/local/NanoRep/Widgets/etc/config.xml ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <version>1.3.5</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>
72
+ <use>admin</use>
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>
83
+ <use>standard</use>
84
+ <args>
85
+ <module>NanoRep_Widgets</module>
86
+ <frontName>nanorep</frontName>
87
+ </args>
88
+ </nanorepwidgets>
89
+ </routers>
90
+ <layout>
91
+ <updates>
92
+ <nanorepwidgets>
93
+ <file>nanorepwidgets.xml</file>
94
+ </nanorepwidgets>
95
+ </updates>
96
+ </layout>
97
+ <events>
98
+ <checkout_onepage_controller_success_action>
99
+ <observers>
100
+ <nanorepwidgets_order_success>
101
+ <class>nanorepwidgets/observer</class>
102
+ <method>setNanoRepWidgetOnOrderSuccessPageView</method>
103
+ </nanorepwidgets_order_success>
104
+ </observers>
105
+ </checkout_onepage_controller_success_action>
106
+ <checkout_multishipping_controller_success_action>
107
+ <observers>
108
+ <nanorepwidgets_order_success>
109
+ <class>nanorepwidgets/observer</class>
110
+ <method>setNanoRepWidgetOnOrderSuccessPageView</method>
111
+ </nanorepwidgets_order_success>
112
+ </observers>
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>
186
+ <attribute_select>all</attribute_select>
187
+ </account_settings>
188
+ <float_widget>
189
+ <active>0</active>
190
+ <active_pages>0</active_pages>
191
+ </float_widget>
192
+ <support_widget>
193
+ <active>1</active>
194
+ <width>400</width>
195
+ <max_height>310</max_height>
196
+ <kb>English</kb>
197
+ <faq_num>5</faq_num>
198
+ <max_items>20</max_items>
199
+ <skip>0</skip>
200
+ <by_popularity>1</by_popularity>
201
+ <days>200</days>
202
+ <product_faq_headline>Popular questions by other visitors:</product_faq_headline>
203
+ <general_faq_headline></general_faq_headline>
204
+ <cache_timeout>86400</cache_timeout>
205
+ </support_widget>
206
+ <orders_status>
207
+ <active>1</active>
208
+ <active_pages>0</active_pages>
209
+ </orders_status>
210
+ </nanorepwidgets>
211
+ </default>
212
+ </config>
app/code/local/NanoRep/Widgets/etc/system.xml ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
14
+ <nanorep translate="label" module="nanorepwidgets">
15
+ <label>nanoRep Widgets</label>
16
+ <sort_order>300</sort_order>
17
+ </nanorep>
18
+ </tabs>
19
+ <sections>
20
+ <nanorepwidgets translate="label" module="nanorepwidgets">
21
+ <label>Account Settings</label>
22
+ <tab>nanorep</tab>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>0</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <groups>
29
+ <account_settings translate="label">
30
+ <label>Account Settings</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>0</sort_order>
33
+ <show_in_default>1</show_in_default>
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>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </account_name>
54
+ <username translate="label">
55
+ <label>Username</label>
56
+ <frontend_type>text</frontend_type>
57
+ <sort_order>2</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </username>
62
+ <password translate="label">
63
+ <label>my.nanoRep Password</label>
64
+ <frontend_type>password</frontend_type>
65
+ <sort_order>3</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </password>
70
+ <attribute_select translate="label">
71
+ <label>Select which attribute to send to nanoRep</label>
72
+ <frontend_type>multiselect</frontend_type>
73
+ <source_model>nanorepwidgets/adminhtml_system_config_source_attribute</source_model>
74
+ <sort_order>4</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </attribute_select>
79
+ <!-- <hidden_attributes translate="label"> -->
80
+ <!-- <label>Use Hidden Product Attributes in Script</label> -->
81
+ <!-- <frontend_type>select</frontend_type> -->
82
+ <!-- <source_model>adminhtml/system_config_source_yesno</source_model> -->
83
+ <!-- <sort_order>4</sort_order> -->
84
+ <!-- <show_in_default>1</show_in_default> -->
85
+ <!-- <show_in_website>1</show_in_website> -->
86
+ <!-- <show_in_store>1</show_in_store> -->
87
+ <!-- </hidden_attributes> -->
88
+ </fields>
89
+ </account_settings>
90
+ <float_widget translate="label">
91
+ <label>Floating Widget</label>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>0</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ <fields>
98
+ <active translate="label">
99
+ <label>Enabled</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>adminhtml/system_config_source_yesno</source_model>
102
+ <sort_order>1</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </active>
107
+ <active_pages translate="label">
108
+ <label>Active for pages</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>nanorepwidgets/system_config_source_floatWidgetActivePages</source_model>
111
+ <sort_order>5</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ <depends><active>1</active></depends>
116
+ </active_pages>
117
+ </fields>
118
+ </float_widget>
119
+ <support_widget translate="label">
120
+ <label>Support Widget</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>5</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ <fields>
127
+ <active translate="label">
128
+ <label>Enabled</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>1</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </active>
136
+ <!-- <password translate="label"> -->
137
+ <!-- <label>Password</label> -->
138
+ <!-- <frontend_type>password</frontend_type> -->
139
+ <!-- <sort_order>3</sort_order> -->
140
+ <!-- <show_in_default>1</show_in_default> -->
141
+ <!-- <show_in_website>1</show_in_website> -->
142
+ <!-- <show_in_store>1</show_in_store> -->
143
+ <!-- </password> -->
144
+ <width translate="label">
145
+ <label>Widget Width</label>
146
+ <frontend_type>text</frontend_type>
147
+ <sort_order>2</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </width>
152
+ <max_height translate="label">
153
+ <label>Widget Height</label>
154
+ <frontend_type>text</frontend_type>
155
+ <sort_order>3</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ </max_height>
160
+ <faq_num translate="label">
161
+ <label>Number of Questions</label>
162
+ <frontend_type>text</frontend_type>
163
+ <sort_order>4</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ <validate>validate-digits</validate>
168
+ </faq_num>
169
+ <kb translate="label">
170
+ <label>Knowledge Base</label>
171
+ <frontend_type>text</frontend_type>
172
+ <sort_order>5</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ <comment>The knowledge base to export from</comment>
177
+ </kb>
178
+ <max_items translate="label">
179
+ <label>Max Items</label>
180
+ <frontend_type>text</frontend_type>
181
+ <sort_order>10</sort_order>
182
+ <show_in_default>1</show_in_default>
183
+ <show_in_website>1</show_in_website>
184
+ <show_in_store>1</show_in_store>
185
+ <validate>validate-digits</validate>
186
+ </max_items>
187
+ <skip translate="label">
188
+ <label>Skip</label>
189
+ <frontend_type>text</frontend_type>
190
+ <sort_order>10</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>
194
+ <validate>validate-digits</validate>
195
+ <comment>The place in the list from which to start fetching. E.g., use 10 to start fetching the list from the 11th item</comment>
196
+ </skip>
197
+ <by_popularity translate="label">
198
+ <label>By Popularity</label>
199
+ <frontend_type>select</frontend_type>
200
+ <source_model>adminhtml/system_config_source_yesno</source_model>
201
+ <sort_order>15</sort_order>
202
+ <show_in_default>1</show_in_default>
203
+ <show_in_website>1</show_in_website>
204
+ <show_in_store>1</show_in_store>
205
+ <comment>If you use true(recommended), the most popular articles will show up first in the search result</comment>
206
+ </by_popularity>
207
+ <days translate="label">
208
+ <label>Days</label>
209
+ <frontend_type>text</frontend_type>
210
+ <sort_order>20</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ <validate>validate-digits</validate>
215
+ <depends><by_popularity>1</by_popularity></depends>
216
+ <comment>Use this to show the most popular answers given by the nanoRep widget during the last X days.</comment>
217
+ </days>
218
+ <label_id translate="label">
219
+ <label>Label ID</label>
220
+ <frontend_type>text</frontend_type>
221
+ <sort_order>25</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ <comment>Use this to show answers froim a specifc label only. you can find this information in the nanoRep console when editing a label.</comment>
226
+ </label_id>
227
+ <text_filter translate="label">
228
+ <label>Text Filter</label>
229
+ <frontend_type>text</frontend_type>
230
+ <sort_order>30</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>1</show_in_store>
234
+ <comment>Use this to show answers that contain a certain word or phrase</comment>
235
+ </text_filter>
236
+ <product_faq_headline translate="label">
237
+ <label>Product FAQ Label</label>
238
+ <frontend_type>text</frontend_type>
239
+ <sort_order>35</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </product_faq_headline>
244
+ <general_faq_headline translate="label">
245
+ <label>General FAQ Label</label>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>35</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ </general_faq_headline>
252
+ <cache_timeout translate="label">
253
+ <label>Cache Update Every</label>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>40</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ <validate>validate-digits</validate>
260
+ <comment>In secondes</comment>
261
+ </cache_timeout>
262
+ </fields>
263
+ </support_widget>
264
+ <orders_status translate="label">
265
+ <label>Orders Status</label>
266
+ <frontend_type>text</frontend_type>
267
+ <sort_order>10</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ <fields>
272
+ <active translate="label">
273
+ <label>Enabled</label>
274
+ <frontend_type>select</frontend_type>
275
+ <source_model>adminhtml/system_config_source_yesno</source_model>
276
+ <sort_order>1</sort_order>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>1</show_in_store>
280
+ </active>
281
+ <active_pages translate="label">
282
+ <label>Active for pages</label>
283
+ <frontend_type>select</frontend_type>
284
+ <source_model>nanorepwidgets/system_config_source_ordersStatusActivePages</source_model>
285
+ <sort_order>20</sort_order>
286
+ <show_in_default>1</show_in_default>
287
+ <show_in_website>1</show_in_website>
288
+ <show_in_store>1</show_in_store>
289
+ <depends><active>1</active></depends>
290
+ </active_pages>
291
+ </fields>
292
+ </orders_status>
293
+ </groups>
294
+ </nanorepwidgets>
295
+ </sections>
296
+ </config>
app/code/local/NanoRep/Widgets/sql/nanorepwidgets_setup/mysql4-data-upgrade-1.2.2-1.2.3.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
14
+ <remove name="footer" />
15
+ <reference name="content">
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">
22
+ <template>nanorepwidgets/order/view/tab/info.phtml</template>
23
+ </action>
24
+ </reference>
25
+ </adminhtml_sales_order_view>
26
+ </layout>
app/design/adminhtml/default/default/template/nanorepwidgets/mynanorep.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <!--
13
+ document.body.onload = function(){
14
+ var viewport = document.viewport.getDimensions();
15
+ //var width = screen.availWidth - Object($$('.footer')[0]).positionedOffset().left;
16
+ var height = viewport.height;
17
+ //$('mynanorepiframe').setAttribute('width', width + 'px');
18
+ $('mynanorepiframe').setAttribute('height', height + 'px');
19
+ };
20
+
21
+ Event.observe(window, 'resize', function() {
22
+ var viewport = document.viewport.getDimensions();
23
+ //var width = screen.availWidth - Object($$('.footer')[0]).positionedOffset().left;
24
+ var height = viewport.height;
25
+ //$('mynanorepiframe').setAttribute('width', width + 'px');
26
+ $('mynanorepiframe').setAttribute('height', height + 'px');
27
+ });
28
+ //-->
29
+ </script>
30
+ <style>
31
+ .middle { padding: 0; }
32
+ </style>
33
+ <iframe src="https://my.nanorep.com/console/login.html?username=<?php echo $this->helper('nanorepwidgets')->getUsername();?>&pw=<?php echo $this->helper('nanorepwidgets')->getPassword();?>" id="mynanorepiframe" width="100%" height="600px" ></iframe>
app/design/adminhtml/default/default/template/nanorepwidgets/order/view/queries.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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">
29
+ <div class="entry-edit-head">
30
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('NanoRep Queries') ?></h4>
31
+ </div>
32
+ <div class="fieldset">
33
+ <table cellspacing="0" class="form-list">
34
+ <?php if(count($this->getQueries()) > 0): ?>
35
+ <?php foreach ($this->getQueries() as $query):?>
36
+ <tr><td width="92%"><?php echo $query["query"]?></td><td><?php echo $query["date"]?></td></tr>
37
+ <?php endforeach;?>
38
+ <?php endif;?>
39
+ </table>
40
+ </div>
41
+ </div>
app/design/adminhtml/default/default/template/nanorepwidgets/order/view/tab/info.phtml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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() ?>
29
+ <div>
30
+ <div id="order-messages">
31
+ <?php echo $this->getChildHtml('order_messages') ?>
32
+ </div>
33
+ <?php echo $this->getChildHtml('order_info') ?>
34
+ <?php echo $this->getLayout()->createBlock('nanorepwidgets/adminhtml_order_view_queries')->setTemplate('nanorepwidgets/order/view/queries.phtml')->toHtml(); ?>
35
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
36
+ <?php if ($_order->getIsVirtual()): ?>
37
+ <div class="box-right">
38
+ <?php else: ?>
39
+ <div class="box-left">
40
+ <?php endif; ?>
41
+ <!--Payment Method-->
42
+ <div class="entry-edit">
43
+ <div class="entry-edit-head">
44
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
45
+ </div>
46
+ <fieldset>
47
+ <?php echo $this->getPaymentHtml() ?>
48
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
49
+ </fieldset>
50
+ </div>
51
+ </div>
52
+ <?php if (!$_order->getIsVirtual()): ?>
53
+ <div class="box-right">
54
+ <!--Shipping Method-->
55
+ <div class="entry-edit">
56
+ <div class="entry-edit-head">
57
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
58
+ </div>
59
+ <fieldset>
60
+ <?php if ($_order->getTracksCollection()->count()) : ?>
61
+ <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
62
+ <br/>
63
+ <?php endif; ?>
64
+ <?php if ($_order->getShippingDescription()): ?>
65
+ <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
66
+
67
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
68
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
69
+ <?php else: ?>
70
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
71
+ <?php endif; ?>
72
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
73
+
74
+ <?php echo $_excl; ?>
75
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
76
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
77
+ <?php endif; ?>
78
+ <?php else: ?>
79
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
80
+ <?php endif; ?>
81
+ </fieldset>
82
+ </div>
83
+ </div>
84
+ <?php endif; ?>
85
+ <div class="clear"></div>
86
+ <?php echo $this->getGiftOptionsHtml() ?>
87
+ <div class="clear"></div>
88
+ <div class="entry-edit">
89
+ <div class="entry-edit-head">
90
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
91
+ </div>
92
+ </div>
93
+ <?php echo $this->getItemsHtml() ?>
94
+ <div class="clear"></div>
95
+
96
+ <div class="box-left">
97
+ <div class="entry-edit">
98
+ <div class="entry-edit-head">
99
+ <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
100
+ </div>
101
+ <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
102
+ </div>
103
+ </div>
104
+ <div class="box-right entry-edit">
105
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
106
+ <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
107
+ </div>
108
+ <div class="clear"></div>
109
+ </div>
110
+
111
+ <?php echo $this->getChildHtml('popup_window');?>
112
+ <script type="text/javascript">
113
+ //<![CDATA[
114
+ /**
115
+ * Retrieve gift options tooltip content
116
+ */
117
+ function getGiftOptionsTooltipContent(itemId) {
118
+ var contentLines = [];
119
+ var headerLine = null;
120
+ var contentLine = null;
121
+
122
+ $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
123
+ if (element.down(0)) {
124
+ headerLine = element.down(0).innerHTML;
125
+ contentLine = element.down(0).next().innerHTML;
126
+ if (contentLine.length > 30) {
127
+ contentLine = contentLine.slice(0,30) + '...';
128
+ }
129
+ contentLines.push(headerLine + ' ' + contentLine);
130
+ }
131
+ });
132
+ return contentLines.join('<br/>');
133
+ }
134
+ giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
135
+ //]]>
136
+ </script>
app/design/frontend/default/default/layout/nanorepwidgets.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <nanorepwidgets_index_getcustomerhistory>
25
+ <block type="nanorepwidgets/adminhtml_order_grid" name="root" output="toHtml" />
26
+ </nanorepwidgets_index_getcustomerhistory>
27
+
28
+ <nanorepwidgets_index_getcustomerhistoryjson>
29
+ <block type="nanorepwidgets/customerhistoryjson" name="root" output="toHtml"/>
30
+ </nanorepwidgets_index_getcustomerhistoryjson>
31
+
32
+ <nanorepwidgets_index_cdc>
33
+ <block type="core/template" name="root" output="toHtml" template="nanorepwidgets/cdc.phtml" />
34
+ </nanorepwidgets_index_cdc>
35
+
36
+ <catalog_product_view>
37
+ <reference name="head">
38
+ <action method="addItem"><type>skin_js</type><file>nanorepwidgets/head.js</file></action>
39
+ <action method="addItem"><type>skin_css</type><file>nanorepwidgets/head.css</file></action>
40
+ </reference>
41
+ <reference name="product.info.additional">
42
+ <block type="nanorepwidgets/supportWidget" before="-" name="nanorep.support.widget" as="nanorep_support_widget" template="nanorepwidgets/support.phtml" />
43
+ </reference>
44
+ </catalog_product_view>
45
+ </layout>
app/design/frontend/default/default/template/nanorepwidgets/cdc.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
4
+ <meta http-Equiv="Cache-Control" Content="no-cache, no-store, must-revalidate">
5
+ <meta http-Equiv="Pragma" Content="no-cache">
6
+ <meta http-Equiv="Expires" Content="0">
7
+
8
+ <title>nanoRep CDC Relay v3</title>
9
+ <script type="text/javascript">
10
+ window.scriptLoaded = false;
11
+ window.pageLoaded = false;
12
+ window.fileVersion = 3;
13
+
14
+ //////////////////////////////////////////////////////////////////////////
15
+ // handlers
16
+ window.onload = function ()
17
+ {
18
+ window.pageLoaded = true;
19
+ if (window.scriptLoaded) nanoRep.CDC.Relay.start();
20
+ }
21
+ var scriptLoaded_handler = function()
22
+ {
23
+ window.scriptLoaded = true;
24
+ if (window.pageLoaded) nanoRep.CDC.Relay.start();
25
+ }
26
+
27
+ //////////////////////////////////////////////////////////////////////////
28
+ // Loading cdc relay script
29
+ var s = document.createElement("script");
30
+ s.type = 'text/javascript';
31
+ s.async = true;
32
+ s.defer = true;
33
+
34
+ // non-ie browsers
35
+ if (navigator.appVersion.indexOf("MSIE") === -1)
36
+ {
37
+ s.onload = scriptLoaded_handler;
38
+ }
39
+ // ie browsers
40
+ else
41
+ {
42
+ s.onreadystatechange = function ()
43
+ {
44
+ if (this.readyState !== 'complete' && this.readyState !== 'loaded') return;
45
+ scriptLoaded_handler();
46
+ }
47
+ }
48
+ var args = window.location.search;
49
+ if (args)
50
+ {
51
+ args = args.substring(1);
52
+ var ndx = args.indexOf("srv=");
53
+ if (ndx !== -1)
54
+ {
55
+ args = args.substring(ndx+4);
56
+ var src, tag;
57
+ ndx = args.indexOf("&");
58
+ if (ndx === -1)
59
+ {
60
+ src = args + "/common/cdc/cdcRelay.js";
61
+ }
62
+ else
63
+ {
64
+ tag = args.substring(ndx + 1);
65
+ src = args.substring(0, ndx) + "/common/cdc/cdcRelay.js?" + tag;
66
+ }
67
+ s.src = src;
68
+ document.getElementsByTagName("head")[0].appendChild(s);
69
+ }
70
+ }
71
+ </script>
72
+ </head>
73
+ <body style='margin:0;padding:0'>
74
+ <div id='log' style='height:1050px'></div>
75
+ </body>
76
+ </html>
app/design/frontend/default/default/template/nanorepwidgets/events.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <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; ?>
app/design/frontend/default/default/template/nanorepwidgets/general.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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() {
27
+ var windowLoadFunc = function() {
28
+ var _nRepData = window._nRepData || [];
29
+ _nRepData['windowLoaded'] = true;
30
+ if ( typeof (_nRepData['windowOnload']) === 'function')
31
+ _nRepData['windowOnload']();
32
+ };
33
+ if (window.attachEvent)
34
+ window.attachEvent('onload', windowLoadFunc);
35
+ else if (window.addEventListener)
36
+ window.addEventListener('load', windowLoadFunc, false);
37
+ var sc = document.createElement('script');
38
+ sc.type = 'text/javascript';
39
+ sc.async = true;
40
+ sc.defer = true;
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; ?>
app/design/frontend/default/default/template/nanorepwidgets/grid.phtml ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/success.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php if($this->helper("nanorepwidgets")->isActive()): ?>
2
+ <?php
3
+ $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
4
+ $order = Mage::getSingleton('sales/order');
5
+ $order->load($lastOrderId);
6
+ $total = $order->getGrandTotal();
7
+ ?>
8
+ <script type='text/javascript' src='https://my.nanorep.com/common/API/conversionUpdate.js?account=<?php echo $this -> helper("nanorepwidgets")->getAccountName(); ?>&revenue=<?php echo $total ?>&conversionTag=<?php echo $lastOrderId ?>'></script>
9
+ <?php endif; ?>
app/design/frontend/default/default/template/nanorepwidgets/support.phtml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <div id='nanoRepEmbedContainer'></div>
14
+ <?php $this->getXml(true); ?>
15
+ <?php $this->getXml(); ?>
16
+ <script type='text/javascript'>
17
+
18
+ document.observe("dom:loaded", function() {
19
+ onloadFnc();
20
+ });
21
+
22
+ var _nRepData = _nRepData || [];
23
+ _nRepData['kb'] = '8331305';
24
+ /* API here */;
25
+ _nRepData['embed'] = {
26
+ account : '<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>',
27
+ container : 'nanoRepEmbedContainer',
28
+ width : <?php echo $this -> helper("nanorepwidgets") -> getSupportWidgetWidth(); ?>,
29
+ maxHeight : <?php echo $this -> helper("nanorepwidgets") -> getSupportWidgetMaxHeight(); ?>,
30
+ dynamicSize : true,
31
+ cdcFrame : '',
32
+ cdcVersion : 3,
33
+ scriptVersion : '2.13.1.25'
34
+ };
35
+ (function() {
36
+ var windowLoadFunc = function() {
37
+ var _nRepData = window._nRepData || [];
38
+ _nRepData['windowLoaded'] = true;
39
+ if ( typeof (_nRepData['windowOnload']) === 'function')
40
+ _nRepData['windowOnload']();
41
+ };
42
+ if (window.attachEvent)
43
+ window.attachEvent('onload', windowLoadFunc);
44
+ else if (window.addEventListener)
45
+ window.addEventListener('load', windowLoadFunc, false);
46
+ var sc = document.createElement('script');
47
+ sc.type = 'text/javascript';
48
+ sc.async = true;
49
+ sc.defer = true;
50
+ sc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'my.nanorep.com/widget/scripts/embed.js?account=<?php echo $this -> helper("nanorepwidgets") -> getAccountName(); ?>';
51
+ var _head = document.getElementsByTagName('head')[0];
52
+ _head.appendChild(sc);
53
+ })();
54
+ </script>
55
+ <?php endif; ?>
app/design/frontend/default/default/template/nanorepwidgets/top.phtml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <script type='text/javascript'>
18
+ var _nRepData = _nRepData || [];
19
+ _nRepData["context"] = {
20
+ "Website" : "<?php echo $_SERVER['HTTP_HOST']; ?>"<?php if(!is_null($_product)): ?>,
21
+ "ProductID" : "<?php echo $_product->getId(); ?>"<?php if($_product->getAttributeText('manufacturer') != ""): ?>,
22
+ "Manufacturer" : "<?php echo $_product->getAttributeText('manufacturer'); ?>"<?php endif; ?><?php if(!is_null($_product->getCategory())): ?>,
23
+ <?php endif; ?>
24
+ <?php endif; ?>
25
+ };
26
+ _nRepData["customParams"] = {
27
+ <?php $this->getCustomerOrdersStatuses(); ?>
28
+ "userLoggedIn" : "<?php echo $this->isUserLoggedIn(); ?>",
29
+ <?php if(!is_null($_product)): ?>
30
+ "productName": "<?php echo htmlspecialchars($_product->getName()); ?>",
31
+ <?php $this->getCategory(); ?>
32
+ "ProductID" : "<?php echo $_product->getId(); ?>",
33
+ "Price" : "<?php echo $_product->getFinalPrice(); ?>",
34
+ <?php
35
+ //$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_id');
36
+ $attributes = $_product->getAttributes();
37
+ $total_attributes = 0;
38
+ $use_hidden_attributes = Mage::getStoreConfigFlag('nanorepwidgets/account_settings/hidden_attributes');
39
+ $selected_attributes = $this->helper('nanorepwidgets')->getAttributes();
40
+ foreach ($attributes as $attribute) {
41
+ if ($selected_attributes[0] == "all"){
42
+ if($attribute->getAttributeCode() != "price")
43
+ $total_attributes++;
44
+ }
45
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
46
+ $total_attributes++;
47
+ }
48
+ }
49
+ foreach ($attributes as $attribute) {
50
+ if ($selected_attributes[0] == "all"){
51
+ if($attribute->getAttributeCode() != "price"){
52
+ if(is_string($attribute->getFrontend()->getValue($_product))){
53
+ echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product)))))))).'"';
54
+ // do something with $value here
55
+ if($total_attributes > 1)
56
+ echo ",\n";
57
+ }
58
+ $total_attributes--;
59
+ }
60
+ }
61
+ elseif (in_array($attribute->getAttributeCode(), $selected_attributes)){
62
+ if(is_string($attribute->getFrontend()->getValue($_product))){
63
+ echo '"'.$attribute->getAttributeCode().'" : "'.str_replace("\\", "\\\\", str_replace("\r", ' ', str_replace("\n", ' ', str_replace('"','',htmlentities(trim(strip_tags($attribute->getFrontend()->getValue($_product)))))))).'"';
64
+ // do something with $value here
65
+ if($total_attributes > 1)
66
+ echo ",\n";
67
+ }
68
+ $total_attributes--;
69
+ }
70
+ }
71
+ ?>
72
+ <?php endif; ?>
73
+ };
74
+ </script>
75
+ <?php endif; ?>
app/etc/modules/NanoRep_Widgets.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>NanoRep_Widgets_1_1_0</name>
4
+ <version>1.3.5</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl.html">GPL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Increases online sales</summary>
10
+ <description>The nanoRep solution improves customer&#xD;
11
+ experience and significantly increases&#xD;
12
+ conversion and online sales. nanoRep is&#xD;
13
+ your virtual shopping assistant &#x2013; it&#xD;
14
+ answers questions, offers rewards</description>
15
+ <notes>Minor bug fix</notes>
16
+ <authors><author><name>NanoRep</name><user>auto-converted</user><email>aviv@nanorep.com</email></author></authors>
17
+ <date>2013-11-09</date>
18
+ <time>19:05:49</time>
19
+ <contents><target name="magelocal"><dir name="NanoRep"><dir name="Widgets"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><dir name="View"><file name="Queries.php" hash="87b00acce9293ff50893be42e27e0542"/></dir><file name="Grid.php" hash="4c2d639873e7d5dd099c9cbaa2013a50"/></dir><file name="Mynanorep.php" hash="8d2fc0ec21bf7c5583c308e81d4cabd8"/></dir><file name="Customerhistoryjson.php" hash="fa7ce0515f0de6e479d669691f5b85b2"/><file name="Events.php" hash="3ed310081949aa73c80710b29d559413"/><file name="General.php" hash="0e591128716cdf4fafd71a69ce98c755"/><file name="Product.php" hash="f245e0d0c01e8757a98da1cb6fabb205"/><file name="Success.php" hash="6ae59952edefcd75006f5f8323444765"/><file name="SupportWidget.php" hash="62d9851aba363b867fa0d7ffbe30282e"/><file name="Top.php" hash="eb6c3384fa48dbeb3d569de0f52fcbd2"/></dir><dir name="Helper"><file name="Data.php" hash="34982e32e23953ccba4d48905f0203c5"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Attribute.php" hash="170f0dfbdcfa9b67bc18b0d03494e23b"/></dir></dir></dir></dir><dir name="Mysql4"><file name="Query.php" hash="c5f69b8c5e93e7d06fc1ff16c873790d"/><file name="Setup.php" hash="be89f73150df986eb994ebcf3dc7416e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="FloatWidgetActivePages.php" hash="8feb17fe6ee045cba82f481a0bf90d5d"/><file name="OrdersStatusActivePages.php" hash="6bd1beff14a6fa24b78e3393a03245a4"/></dir></dir></dir><file name="History.php" hash="99ed12e3dfcb7a563825fd8418a50e59"/><file name="Observer.php" hash="edb358cbed835123f8e53b2e57d5960c"/><file name="Query.php" hash="9f0f7f077766745d88535ae2a1805cb5"/><file name="Session.php" hash="4cd0cfe4a67bade3eb710aac7f8cfb40"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MynanorepController.php" hash="6846f66016c3faddcd8f6f4fb2b9deca"/></dir><file name="IndexController.php" hash="4a839856473e3b98fef28739d5d611cc"/><file name="QueryController.php" hash="35975131cad35dcea58801613b3ab960"/></dir><dir name="etc"><file name="config.xml" hash="e9656e8c4ecc346ec50a2cbbd7551d37"/><file name="system.xml" hash="8529f48fb0b98a6680a13704c0731910"/></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="16c6579ca7bcc1faba74ed8efca20dd8"/></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="0233a9e467fa602c1692bb286716e63c"/><file name="support.phtml" hash="c98da8432e6722cdf1a7762770873ab5"/><file name="top.phtml" hash="9dddd35c07fd68a4fd311c98619072a0"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="nanorepwidgets"><dir name="order"><dir name="view"><dir name="tab"><file name="info.phtml" hash="6dde16c3fe3bdddb65ca977d99872811"/></dir><file name="queries.phtml" hash="bfb44dd77bba62629277aae45239ea6b"/></dir></dir><file name="mynanorep.phtml" hash="270b613ddddc94ad3e617c397f1f53a1"/></dir></dir><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>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>
skin/frontend/default/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/default/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
+ }