1993 - Version 1.0.0

Version Notes

Beta release

Download this release

Release Info

Developer Vlad
Extension 1993
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (30) hide show
  1. app/code/community/IWD/Ces/Block/Frontend/Ces.php +5 -0
  2. app/code/community/IWD/Ces/Block/Frontend/View/Product.php +246 -0
  3. app/code/community/IWD/Ces/Block/Frontend/View/Success.php +68 -0
  4. app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Documentations.php +8 -0
  5. app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Extensions.php +9 -0
  6. app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Import/Button.php +17 -0
  7. app/code/community/IWD/Ces/Controller/Router.php +81 -0
  8. app/code/community/IWD/Ces/Helper/Curl.php +31 -0
  9. app/code/community/IWD/Ces/Helper/Data.php +5 -0
  10. app/code/community/IWD/Ces/Helper/Settings.php +59 -0
  11. app/code/community/IWD/Ces/Model/Ces.php +10 -0
  12. app/code/community/IWD/Ces/Model/Observer.php +15 -0
  13. app/code/community/IWD/Ces/Model/Resource/Ces.php +11 -0
  14. app/code/community/IWD/Ces/Model/Resource/Ces/Collection.php +12 -0
  15. app/code/community/IWD/Ces/controllers/Adminhtml/CesController.php +113 -0
  16. app/code/community/IWD/Ces/controllers/Frontend/IndexController.php +14 -0
  17. app/code/community/IWD/Ces/etc/adminhtml.xml +26 -0
  18. app/code/community/IWD/Ces/etc/config.xml +116 -0
  19. app/code/community/IWD/Ces/etc/system.xml +188 -0
  20. app/code/community/IWD/Ces/sql/ces_setup/install-0.0.1.php +21 -0
  21. app/design/adminhtml/default/default/layout/iwd_ces.xml +8 -0
  22. app/design/frontend/base/default/layout/iwd_ces.xml +42 -0
  23. app/design/frontend/base/default/template/iwd/ces/list.phtml +61 -0
  24. app/design/frontend/base/default/template/iwd/ces/product.phtml +143 -0
  25. app/design/frontend/base/default/template/iwd/ces/success.phtml +39 -0
  26. app/design/frontend/base/default/template/iwd/ces/widget.phtml +69 -0
  27. app/etc/modules/IWD_Ces.xml +9 -0
  28. package.xml +18 -0
  29. skin/adminhtml/default/default/iwd/ces/ces_admin.css +12 -0
  30. skin/frontend/base/default/css/iwd/ces/ces_style.css +248 -0
app/code/community/IWD/Ces/Block/Frontend/Ces.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Block_Ces extends Mage_Core_Block_Template
3
+ {
4
+
5
+ }
app/code/community/IWD/Ces/Block/Frontend/View/Product.php ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Block_Frontend_View_Product extends Mage_Catalog_Block_Product_View {
3
+
4
+ protected $_type;
5
+
6
+ protected function sendCurl($url) {
7
+ if ($curl = curl_init()) {
8
+ curl_setopt($curl, CURLOPT_URL, $url);
9
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
10
+ $data = curl_exec($curl);
11
+ $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
12
+ curl_close($curl);
13
+ }
14
+ return $code != 200 ? null : json_decode($data, true);
15
+ }
16
+
17
+ public function getFeatureRequestStatusesArray() {
18
+ return [
19
+ 'IN_REVIEW' => 1,
20
+ 'COMING_SOON' => 2,
21
+ 'COMPLETED' => 3,
22
+ ];
23
+ }
24
+
25
+ public function getDomain() {
26
+ return Mage::helper('iwd_ces/settings')->getDomain();
27
+ }
28
+
29
+ function _construct() {
30
+ if (!Mage::registry('current_product') || !Mage::registry('product')) {
31
+ if ($product = $this->getProduct()) {
32
+ Mage::register('current_product', $product);
33
+ Mage::register('product', $product);
34
+ $this->setProduct($product);
35
+ }
36
+ }
37
+ parent::_construct();
38
+ }
39
+
40
+ public function getProduct() {
41
+ if ($product_id = Mage::app()->getRequest()->getParam('id')) {
42
+ $product = Mage::getModel('catalog/product')->load($product_id);
43
+ if ($product) { return $product; }
44
+ }
45
+ return null;
46
+ }
47
+
48
+ public function getWidgetId($type = null) {
49
+ $type = $type ? $type : $this->getWidgetType();
50
+ switch($type) {
51
+ case 'questions':
52
+ if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_QUESTIONS_ANSWERS)) {
53
+ return Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_QA_WIDGET_ID);
54
+ }
55
+ break;
56
+ case 'requests':
57
+ if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_FEATURE_REQUEST)) {
58
+ return Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_FR_WIDGET_ID);
59
+ }
60
+ break;
61
+ case 'reviews':
62
+ if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_REVIEWS)) {
63
+ return Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_REVIEWS_WIDGET_ID);
64
+ }
65
+ break;
66
+ }
67
+ return null;
68
+ }
69
+
70
+ public function getCount($type, $status = null) {
71
+ if ($product = $this->getProduct()) {
72
+ $sku = $product->getSku();
73
+ $widget = $this->getWidgetId($type);
74
+ $domain = $this->getDomain();
75
+ $url = "https://$domain/product-suite/api/products/$sku/widget/$widget/$type-count";
76
+ if ($status) {
77
+ $url .= '?status=' . (string)$status;
78
+ }
79
+ return $this->sendCurl($url);
80
+ }
81
+ return null;
82
+ }
83
+
84
+ public function getReviewsRating() {
85
+ if ($product = $this->getProduct()) {
86
+ $sku = $product->getSku();
87
+ $widget = $this->getWidgetId('reviews');
88
+ $domain = $this->getDomain();
89
+ $url = "https://$domain/product-suite/api/products/$sku/widget/$widget/reviews-rating";
90
+
91
+ return $this->sendCurl($url);
92
+ }
93
+ return null;
94
+ }
95
+
96
+ public function getProductUrlStr() {
97
+ // get request string
98
+ if (Mage::app()->getRequest()->getParam('category')) {
99
+ $p = $this->getProduct();
100
+ $id_path = 'product/' . $p->getId();
101
+ $r_path = Mage::getModel('core/url_rewrite')
102
+ ->setStoreId(Mage::app()->getStore()->getStoreId())
103
+ ->loadByIdPath($id_path);
104
+ $str = $r_path->getRequestPath();
105
+ } else $str = Mage::app()->getRequest()->getRequestString();
106
+ $path = explode('/', $str);
107
+ if (count($path) > 0) {
108
+ // get original str without .html
109
+ $res = explode('.', $path[count($path) - 1]);
110
+ if (count($res) > 0) {
111
+ return $res[0];
112
+ }
113
+ }
114
+ }
115
+
116
+ public function getFilter() {
117
+ if ($filter = Mage::app()->getRequest()->getParam('filter')) {
118
+ if ($filter == 'feature-requests') {
119
+ return 'requests';
120
+ }
121
+ return $filter;
122
+ }
123
+ return 'questions';
124
+ }
125
+
126
+ public function getUrlKey() {
127
+ if ($key = Mage::app()->getRequest()->getParam('url_key')) {
128
+ return $key;
129
+ }
130
+ return null;
131
+ }
132
+
133
+ public function getPage() {
134
+ return Mage::app()->getRequest()->getParam('page');
135
+ }
136
+
137
+ public function getPerPage() {
138
+ return Mage::app()->getRequest()->getParam('per-page');
139
+ }
140
+
141
+ public function getWidgetType() {
142
+ if (!$this->_type) {
143
+ $_filter = $this->getFilter();
144
+ $this->_type = $_filter == 'questions'
145
+ || $_filter == 'requests'
146
+ || $_filter == 'reviews' ?
147
+ $_filter :
148
+ $this->requestForType($_filter)['type'];
149
+ // transform to one type
150
+ if ($this->_type == 'featurerequest') {
151
+ $this->_type = 'requests';
152
+ } else if ($this->_type == 'review') {
153
+ $this->_type = 'reviews';
154
+ }
155
+ }
156
+ return $this->_type;
157
+ }
158
+
159
+ public function requestForType($id) {
160
+ if ($product = $this->getProduct()) {
161
+ $sku = $product->getSku();
162
+ $domain = $this->getDomain();
163
+ return $this->sendCurl("https://$domain/product-suite/api/products/$sku/get-type/$id");
164
+ }
165
+
166
+ return null;
167
+ }
168
+
169
+ public function getFeatureRequestStatus() {
170
+ $status_array = $this->getFeatureRequestStatusesArray();
171
+ if ($this->getWidgetType() == 'requests') {
172
+ if ($status = Mage::app()->getRequest()->get('status')) {
173
+ return array_key_exists((string)$status, $status_array) ? (string)$status_array[(string)$status] : 1;
174
+ }
175
+ }
176
+ return null;
177
+ }
178
+
179
+ public function getSorting() {
180
+ return Mage::app()->getRequest()->getParam('sort');
181
+ }
182
+
183
+ public function getWidgetBody($data = []) {
184
+ if (!empty($data)) {
185
+ $product = $this->getProduct();
186
+ // default product option with needed
187
+ $product_options = [
188
+ 'product_id' => $product->getSku(),
189
+ 'product_name' => $product->getName(),
190
+ 'product_alias' => $product->getSku(),
191
+ ];
192
+
193
+ if ($sort = $this->getSorting()) {
194
+ $product_options['sort'] = $sort;
195
+ }
196
+
197
+ $data = array_merge($data, $product_options);
198
+ $url = 'https://' . $this->getDomain() . "/product-suite/frontend-widget/batch";
199
+ $options = [
200
+ 'ssl' => [
201
+ 'verify_peer' => false,
202
+ 'verify_peer_name' => false,
203
+ ],
204
+ 'http' => [
205
+ 'protocol_version' => 1.1,
206
+ 'header' => [
207
+ 'Content-type: application/x-www-form-urlencoded',
208
+ 'Connection: close',
209
+ ],
210
+ 'method' => 'POST',
211
+ 'request_fulluri' => true,
212
+ 'content' => http_build_query($data),
213
+ ]
214
+ ];
215
+ $context = stream_context_create($options);
216
+ $result = file_get_contents($url, false, $context);
217
+ // Parsing the response
218
+ $response = @json_decode($result, true);
219
+ return $response;
220
+ }
221
+ }
222
+
223
+ public function mathRating($rating, $round = false, $stars_count = 5) {
224
+ $ratings = [];
225
+ $rating = round($rating, 2);
226
+ for($i = 1; $i <= $stars_count; $i++) {
227
+ if(!$round) {
228
+ if($rating > (($i - 1) + 0.33) && $rating < (($i - 1) + 0.67))
229
+ $ratings[$i] = '1/2';
230
+ else if($rating < $i - 0.33) {
231
+ $ratings[$i] = '0';
232
+ }
233
+ else
234
+ $ratings[$i] = '1';
235
+ }
236
+ else {
237
+ if($rating < $i) {
238
+ $ratings[$i] = '0';
239
+ }
240
+ else
241
+ $ratings[$i] = '1';
242
+ }
243
+ }
244
+ return $ratings;
245
+ }
246
+ }
app/code/community/IWD/Ces/Block/Frontend/View/Success.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Block_Frontend_View_Success extends Mage_Checkout_Block_Onepage_Success
4
+ {
5
+ public function __construct() {
6
+ parent::__construct();
7
+ }
8
+
9
+ public function getOrderAmount() {
10
+ $order = $this->getOrder();
11
+ if ($order != null) {
12
+ return $order->getSubtotal();
13
+ }
14
+ }
15
+
16
+ public function getOrderCurrency() {
17
+ $order = $this->getOrder();
18
+ if ($order != null) {
19
+ return $order->getOrderCurrency()->getCode();
20
+ }
21
+ }
22
+
23
+ public function getOrder() {
24
+ $last_order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
25
+ return Mage::getModel('sales/order')->load($last_order_id);
26
+ }
27
+
28
+ public function getUsersEmail() {
29
+ if ($order = $this->getOrder()) {
30
+ return $order->getCustomerEmail();
31
+ }
32
+ }
33
+
34
+ public function getUsersName() {
35
+ if ($order = $this->getOrder()) {
36
+ return $order->getCustomerName();
37
+ }
38
+ }
39
+
40
+ public function getStoreName() {
41
+ return Mage::app()->getStore()->getFrontendName();
42
+ }
43
+
44
+ /**
45
+ * @return null|string
46
+ * get all products from current order , sort them and return sku
47
+ * of product with biggest price
48
+ */
49
+ public function getProductSku() {
50
+ if ($order = $this->getOrder()) {
51
+ if ($orderedItems = $order->getAllVisibleItems()) {
52
+ if (is_array($orderedItems) && count($orderedItems) > 0) {
53
+ $price_array = [];
54
+ foreach ($orderedItems as $item) {
55
+ $price_array[$item->getProductId()] = $item->getPrice();
56
+ }
57
+ arsort($price_array);
58
+ $id = key($price_array);
59
+ //$id = $price_array[0]->getProductId(); // getting first product sku
60
+ if ($product = Mage::getModel('catalog/product')->load($id)) {
61
+ return $product->getSku();
62
+ }
63
+ }
64
+ }
65
+ }
66
+ return null;
67
+ }
68
+ }
app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Documentations.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Block_System_Config_Form_Fieldset_Documentations extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ return '<span class="notice"><a href="https://www.iwdagency.com/help/customer-engagement-suite" target="_blank">Customer Engagement Suite</span>';
7
+ }
8
+ }
app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Extensions.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Block_System_Config_Form_Fieldset_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $version = Mage::getConfig()->getModuleConfig("IWD_Ces")->version;
7
+ return '<span class="notice">' . $version . '</span>';
8
+ }
9
+ }
app/code/community/IWD/Ces/Block/System/Config/Form/Fieldset/Import/Button.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Block_System_Config_Form_Fieldset_Import_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $import_title = Mage::helper('iwd_ces')->__("Import");
7
+
8
+ $_secure = Mage::app()->getStore()->isCurrentlySecure();
9
+ $import_link = Mage::helper("adminhtml")->getUrl('adminhtml/ces/import', ['_secure' => $_secure]);
10
+
11
+ $model = Mage::getModel('iwd_ces/ces');
12
+
13
+ $isBlocked = count($model->getCollection()) > 0;
14
+ $block = $isBlocked ? 'class=\'blocked-button\' disabled' : '';
15
+ return '<button '.$block.' type="button" onclick="setLocation(\''.$import_link.'\')">'.$import_title.'</button>';
16
+ }
17
+ }
app/code/community/IWD/Ces/Controller/Router.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard {
4
+
5
+ const MODULE = 'IWD_Ces_Frontend';
6
+ const INDEX_CONTROLLER = 'index';
7
+
8
+ const INDEX_ACTION = 'index';
9
+ const VIEW_ACTION = 'view';
10
+
11
+ public function match(Zend_Controller_Request_Http $request)
12
+ {
13
+ if(!Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_GENERAL_ENABLED)) {
14
+ return false;
15
+ }
16
+ $path = explode('/', trim($request->getPathInfo(), '/'));
17
+
18
+ $r_path = Mage::getModel('core/url_rewrite')
19
+ ->setStoreId(Mage::app()->getStore()->getStoreId())
20
+ ->loadByRequestPath($path[0] . '.html'); // not good code, but who care?
21
+
22
+ $model = Mage::getModel('catalog/product');
23
+ if ($arr = $r_path->getIdPath()) {
24
+ $r = explode('/', $arr);
25
+ $id = isset($r[1]) ? $r[1] : null; // id is second
26
+ }
27
+ $product = isset($id) ? $model->load($id) : $model->loadByAttribute('url_key', $path[0]);
28
+
29
+ // If path doesn't match your module requirements
30
+ if (count($path) != 2) {
31
+ return false;
32
+ }
33
+ // if product isn't exist
34
+ if (!$product) {
35
+ return false;
36
+ }
37
+ // if isset filter - set filter, if not - set default
38
+ $questions_filter = isset($path[1]) ? explode('&', $path[1])[0] : 'questions';
39
+
40
+ $realModule = self::MODULE;
41
+ $controller = self::INDEX_CONTROLLER;
42
+ $action = self::VIEW_ACTION;
43
+ $controllerClassName = $this->_validateControllerClassName(
44
+ $realModule,
45
+ $controller
46
+ );
47
+ // If controller was not found
48
+ if (!$controllerClassName) {
49
+ return false;
50
+ }
51
+ // Instantiate controller class
52
+ $controllerInstance = Mage::getControllerInstance(
53
+ $controllerClassName,
54
+ $request,
55
+ $this->getFront()->getResponse()
56
+ );
57
+ // If action is not found
58
+ if (!$controllerInstance->hasAction($action)) {
59
+ return false;
60
+ }
61
+ // Set request data
62
+ $request->setModuleName($realModule);
63
+ $request->setControllerName($controller);
64
+ $request->setActionName($action);
65
+ $request->setControllerModule($realModule);
66
+ // Set your custom request parameter
67
+ $request->setParam('id', $product->getId());
68
+ $request->setParam('filter', $questions_filter);
69
+ $request->setParam('url_key', $path[0]);
70
+ $page_path = explode('&', $path[1]);
71
+ if (isset($page_path[1])) {
72
+ $get_param = explode('=', $page_path[1]);
73
+ $request->setParam($get_param[0], $get_param[1]);
74
+ }
75
+ // dispatch action
76
+ $request->setDispatched(true);
77
+ $controllerInstance->dispatch($action);
78
+ // Indicate that our route was dispatched
79
+ return true;
80
+ }
81
+ }
app/code/community/IWD/Ces/Helper/Curl.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Helper_Curl extends Mage_Core_Helper_Abstract
4
+ {
5
+ const TYPE_GET = 'get';
6
+ const TYPE_POST = 'post';
7
+
8
+ public function post($url, $body = []) {
9
+ return $this->send($url, self::TYPE_POST, $body);
10
+ }
11
+ public function get($url, $body = []) {
12
+ return $this->send($url, self::TYPE_GET, $body);
13
+ }
14
+
15
+ private function send($url, $type, $body = []) {
16
+ if ($curl = curl_init()) {
17
+ if ($type == self::TYPE_GET) {
18
+ $url .= http_build_query($body);
19
+ }
20
+ curl_setopt($curl, CURLOPT_URL, $url);
21
+ if ($type == self::TYPE_POST) {
22
+ curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($body));
23
+ }
24
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
25
+ $data = curl_exec($curl);
26
+ $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
27
+ curl_close($curl);
28
+ }
29
+ return $code != 200 ? null : json_decode($data, true);
30
+ }
31
+ }
app/code/community/IWD/Ces/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ }
app/code/community/IWD/Ces/Helper/Settings.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Helper_Settings extends Mage_Core_Helper_Abstract
3
+ {
4
+ const XML_PATH_GENERAL_ENABLED = "iwd_ces/general_extension/enabled";
5
+ const XML_PATH_QA_WIDGET_ID = "iwd_ces/questions_answers/qa_widget_id";
6
+ const XML_PATH_FR_WIDGET_ID = "iwd_ces/feature_requests/feature_request_widget_id";
7
+ const XML_PATH_REVIEWS_WIDGET_ID = "iwd_ces/reviews/reviews_widget_id";
8
+ const XML_PATH_SHOW_BREADCRUMBS = "iwd_ces/other/show_breadcrumbs";
9
+ const XML_PATH_SHOW_QUESTIONS_ANSWERS = "iwd_ces/questions_answers/show_questions_answers";
10
+ const XML_PATH_SHOW_FEATURE_REQUEST = "iwd_ces/feature_requests/show_feature_request";
11
+ const XML_PATH_SHOW_REVIEWS = "iwd_ces/reviews/show_reviews";
12
+
13
+ public function isEnabled() {
14
+ return Mage::getStoreConfig(self::XML_PATH_GENERAL_ENABLED);
15
+ }
16
+
17
+ public function getQAWidgetId() {
18
+ return Mage::getStoreConfig(self::XML_PATH_QA_WIDGET_ID);
19
+ }
20
+
21
+ public function getFRWidgetId() {
22
+ return Mage::getStoreConfig(self::XML_PATH_FR_WIDGET_ID);
23
+ }
24
+
25
+ public function getReviewsWidgetId() {
26
+ return Mage::getStoreConfig(self::XML_PATH_REVIEWS_WIDGET_ID);
27
+ }
28
+
29
+ public function showBreadCrumbs() {
30
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_BREADCRUMBS);
31
+ }
32
+
33
+ public function showQAWidget() {
34
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_QUESTIONS_ANSWERS);
35
+ }
36
+
37
+ public function showFRWidget() {
38
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_FEATURE_REQUEST);
39
+ }
40
+
41
+ public function showReviewsWidget() {
42
+ return Mage::getStoreConfig(self::XML_PATH_SHOW_REVIEWS);
43
+ }
44
+
45
+ public function getDomain() {
46
+ // const
47
+ $base_url = 'www.iwdagency.com';
48
+ // block for local development
49
+ $crnt_url = $_SERVER['HTTP_HOST'];
50
+ if ($crnt_url == 'dev.weeetail.com'
51
+ || $crnt_url == 'staging.weeetail.com') {
52
+ $base_url = $crnt_url;
53
+ }
54
+ if ($crnt_url == 'local-dev-weeetail.com') {
55
+ $base_url = 'dev.weeetail.com';
56
+ }
57
+ return $base_url;
58
+ }
59
+ }
app/code/community/IWD/Ces/Model/Ces.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Model_Ces extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('iwd_ces/ces');
9
+ }
10
+ }
app/code/community/IWD/Ces/Model/Observer.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class IWD_Ces_Model_Observer {
3
+
4
+ public function disableCache(Varien_Event_Observer $observer)
5
+ {
6
+ $action = $observer->getEvent()->getControllerAction();
7
+
8
+ //if ($action instanceof IWD_Ces_Frontend_IndexController) { // eg. Mage_Catalog_ProductController
9
+ $request = $action->getRequest();
10
+ $cache = Mage::app()->getCacheInstance();
11
+ $cache->banUse('full_page');
12
+ $cache->banUse(Mage_Core_Block_Abstract::CACHE_GROUP);
13
+ //}
14
+ }
15
+ }
app/code/community/IWD/Ces/Model/Resource/Ces.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Model_Resource_Ces extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ $this->_init('iwd_ces/table_iwd_ces', 'id');
9
+ }
10
+
11
+ }
app/code/community/IWD/Ces/Model/Resource/Ces/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Model_Resource_Ces_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->_init('iwd_ces/ces');
10
+ }
11
+
12
+ }
app/code/community/IWD/Ces/controllers/Adminhtml/CesController.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Adminhtml_CesController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function importAction()
6
+ {
7
+ $session = $this->_getSession();
8
+
9
+ $model = Mage::getModel('iwd_ces/ces');
10
+
11
+ if (count($model->getCollection()) > 0) {
12
+ $session->addNotice('Can\'t import, already done');
13
+ return $this->_redirect('adminhtml/system_config/edit/section/iwd_ces');
14
+ }
15
+
16
+ $activeReviews = Mage::getModel('review/review')
17
+ ->getResourceCollection()
18
+ ->addStoreFilter(Mage::app()->getStore()->getId())
19
+ ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
20
+ ->setDateOrder()
21
+ ->addRateVotes();
22
+
23
+ $pendingReviews = Mage::getModel('review/review')
24
+ ->getResourceCollection()
25
+ ->addStoreFilter(Mage::app()->getStore()->getId())
26
+ ->addStatusFilter(Mage_Review_Model_Review::STATUS_PENDING)
27
+ ->setDateOrder()
28
+ ->addRateVotes();
29
+
30
+ $notApprovedReviews = Mage::getModel('review/review')
31
+ ->getResourceCollection()
32
+ ->addStoreFilter(Mage::app()->getStore()->getId())
33
+ ->addStatusFilter(Mage_Review_Model_Review::STATUS_NOT_APPROVED)
34
+ ->setDateOrder()
35
+ ->addRateVotes();
36
+ try {
37
+ $this->sendData($activeReviews, Mage_Review_Model_Review::STATUS_APPROVED);
38
+ $this->sendData($pendingReviews, Mage_Review_Model_Review::STATUS_PENDING);
39
+ $this->sendData($notApprovedReviews, Mage_Review_Model_Review::STATUS_NOT_APPROVED);;
40
+ $model->setImported(1);
41
+ $model->save();
42
+ $session->addSuccess('Your reviews were successfully imported');
43
+ } catch (Exception $e) {
44
+ $session->addError($e->getMessage());
45
+ }
46
+ return $this->_redirect('adminhtml/system_config/edit/section/iwd_ces');
47
+ }
48
+
49
+
50
+ private function sendData(&$reviews, $status) {
51
+ $domain = Mage::helper('iwd_ces/settings')->getDomain();
52
+ $url = "https://$domain/product-suite/api/review/import";
53
+ $widgetId = Mage::helper('iwd_ces/settings')->getReviewsWidgetId();
54
+
55
+ foreach ($reviews as $review) {
56
+ $product = Mage::getModel('catalog/product')->load($review->getEntityPkValue());
57
+
58
+ $counter = 0;
59
+ $cumulative = 0;
60
+ foreach($review->getRatingVotes() as $vote) {
61
+ $cumulative += $vote->getPercent();
62
+ $counter++;
63
+ }
64
+ $finalPercentage = 0;
65
+ if ($cumulative != 0) {
66
+ $finalPercentage = ($cumulative / $counter);
67
+ }
68
+
69
+ $st = null;
70
+ switch ($status) {
71
+ case Mage_Review_Model_Review::STATUS_APPROVED:
72
+ $st = 'approved';
73
+ break;
74
+ case Mage_Review_Model_Review::STATUS_NOT_APPROVED:
75
+ $st = 'not-approved';
76
+ break;
77
+ case Mage_Review_Model_Review::STATUS_PENDING:
78
+ $st = 'pending';
79
+ break;
80
+ default:
81
+ $st = 'undefined';
82
+ break;
83
+ }
84
+
85
+ $data = [
86
+ 'widget_id' => $widgetId,
87
+ 'product_sku' => $product->getSku(),
88
+ 'product_id' => $product->getId(),
89
+ 'product_url' => $product->getProductUrl(),
90
+ 'product_name' => $product->getName(),
91
+ 'title' => $review->getTitle(),
92
+ 'detail' => $review->getDetail(),
93
+ 'name' => $review->getNickname(),
94
+ 'percent' => $finalPercentage,
95
+ 'status' => $st,
96
+ ];
97
+
98
+ $customerId = $review->getCustomerId();
99
+ if ($customerId) {
100
+ $customerData = Mage::getModel('customer/customer')->load($customerId);
101
+ $data['email'] = $customerData->getEmail();
102
+ }
103
+
104
+ $result = Mage::helper('iwd_ces/curl')->post($url, $data);
105
+ if (!$result) {
106
+ $errorText = Mage::helper('iwd_ces')
107
+ ->__('You have some error. Try again later please');
108
+ throw new Exception($errorText);
109
+ }
110
+ }
111
+
112
+ }
113
+ }
app/code/community/IWD/Ces/controllers/Frontend/IndexController.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class IWD_Ces_Frontend_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function viewAction()
6
+ {
7
+ $this->loadLayout(['default', 'iwd_ces_index_view']);
8
+ // get breadcrumbs block
9
+ if (!Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_BREADCRUMBS)) {
10
+ $this->getLayout()->getBlock('root')->unsetChild('breadcrumbs');
11
+ }
12
+ $this->renderLayout();
13
+ }
14
+ }
app/code/community/IWD/Ces/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+
5
+ </menu>
6
+ <acl>
7
+ <resources>
8
+ <all>Allow everything</all>
9
+ <admin>
10
+ <children>
11
+ <system>
12
+ <children>
13
+ <config>
14
+ <children>
15
+ <iwd_ces translate="title" module="iwd_ces">
16
+ <title>IWD Ces</title>
17
+ </iwd_ces>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/IWD/Ces/etc/config.xml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <IWD_Ces>
5
+ <version>0.0.1</version>
6
+ </IWD_Ces>
7
+ </modules>
8
+
9
+ <global>
10
+ <helpers>
11
+ <iwd_ces>
12
+ <class>IWD_Ces_Helper</class>
13
+ </iwd_ces>
14
+ </helpers>
15
+ <blocks>
16
+ <iwd_ces>
17
+ <class>IWD_Ces_Block</class>
18
+ </iwd_ces>
19
+ </blocks>
20
+ <models>
21
+ <iwd_ces>
22
+ <class>IWD_Ces_Model</class>
23
+ <resourceModel>iwd_ces_resource</resourceModel>
24
+ </iwd_ces>
25
+ <iwd_ces_resource>
26
+ <class>IWD_Ces_Model_Resource</class>
27
+ <entities>
28
+ <table_iwd_ces>
29
+ <table>iwd_ces</table>
30
+ </table_iwd_ces>
31
+ </entities>
32
+ </iwd_ces_resource>
33
+ </models>
34
+ <resources>
35
+ <ces_setup>
36
+ <setup>
37
+ <module>IWD_Ces</module>
38
+ </setup>
39
+ </ces_setup>
40
+ </resources>
41
+ </global>
42
+ <frontend>
43
+ <layout>
44
+ <updates>
45
+ <iwd_ces>
46
+ <file>iwd_ces.xml</file>
47
+ </iwd_ces>
48
+ </updates>
49
+ </layout>
50
+ <routers>
51
+ <iwd_ces>
52
+ <use>iwd_ces_router</use>
53
+ <args>
54
+ <module>IWD_Ces_Frontend</module>
55
+ <frontName>ces</frontName>
56
+ </args>
57
+ </iwd_ces>
58
+ </routers>
59
+ <events>
60
+ <controller_action_predispatch>
61
+ <observers>
62
+ <iwd_ces_cache_clean>
63
+ <class>iwd_ces/observer</class>
64
+ <method>disableCache</method>
65
+ </iwd_ces_cache_clean>
66
+ </observers>
67
+ </controller_action_predispatch>
68
+ </events>
69
+ </frontend>
70
+ <default>
71
+ <web>
72
+ <routers>
73
+ <iwd_ces_router>
74
+ <area>frontend</area>
75
+ <class>IWD_Ces_Controller_Router</class>
76
+ </iwd_ces_router>
77
+ </routers>
78
+ </web>
79
+ <iwd_ces>
80
+ <questions_answers>
81
+ <show_questions_answers>1</show_questions_answers>
82
+ </questions_answers>
83
+ <other>
84
+ <show_breadcrumbs>0</show_breadcrumbs>
85
+ </other>
86
+ <feature_requests>
87
+ <show_feature_request>1</show_feature_request>
88
+ </feature_requests>
89
+ <reviews>
90
+ <show_reviews>1</show_reviews>
91
+ </reviews>
92
+ </iwd_ces>
93
+ </default>
94
+ <adminhtml>
95
+ <layout>
96
+ <updates>
97
+ <iwd_ces>
98
+ <file>iwd_ces.xml</file>
99
+ </iwd_ces>
100
+ </updates>
101
+ </layout>
102
+ </adminhtml>
103
+
104
+ <admin>
105
+ <routers>
106
+ <adminhtml>
107
+ <args>
108
+ <modules>
109
+ <iwd_ces before="Mage_Adminhtml">IWD_Ces_Adminhtml</iwd_ces>
110
+ </modules>
111
+ </args>
112
+ </adminhtml>
113
+ </routers>
114
+ </admin>
115
+
116
+ </config>
app/code/community/IWD/Ces/etc/system.xml ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <iwdall>
5
+ <label>IWD Extensions</label>
6
+ <sort_order>100</sort_order>
7
+ <class>iwd-block</class>
8
+ </iwdall>
9
+ </tabs>
10
+ <sections>
11
+ <iwd_ces translate="label" module="iwd_ces">
12
+ <label>Customer Engagement Suite</label>
13
+ <tab>iwdall</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <general_extension>
21
+ <label>General</label>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <version>
28
+ <label>Version</label>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>0</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <frontend_model>iwd_ces/system_config_form_fieldset_extensions</frontend_model>
35
+ <comment><![CDATA[]]></comment>
36
+ </version>
37
+ <link>
38
+ <label>Documentation</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <frontend_model>iwd_ces/system_config_form_fieldset_documentations</frontend_model>
45
+ </link>
46
+ <enabled translate="label">
47
+ <label>Enable View All &amp; Single Pages</label>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <comment><![CDATA[Allow user to view page with all QA, Requests or Reviews for one product. Also allow user to view a single QA, Request or Review.]]></comment>
55
+ </enabled>
56
+ </fields>
57
+ </general_extension>
58
+ <widget>
59
+ <sort_order>10</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ <label>Options</label>
64
+ <fields>
65
+ <questions_answers type="group" translate="label">
66
+ <label>Questions &amp; Answers</label>
67
+ <sort_order>10</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ <fields>
72
+ <show_questions_answers translate="label">
73
+ <label>Enable</label>
74
+ <frontend_type>select</frontend_type>
75
+ <source_model>adminhtml/system_config_source_yesno</source_model>
76
+ <sort_order>10</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ <comment><![CDATA[]]></comment>
81
+ </show_questions_answers>
82
+ <qa_widget_id translate="label">
83
+ <label>ID</label>
84
+ <frontend_type>text</frontend_type>
85
+ <sort_order>20</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <validate>required-entry</validate>
90
+ <comment><![CDATA[]]></comment>
91
+ </qa_widget_id>
92
+ </fields>
93
+ </questions_answers>
94
+ <feature_requests type="group" translate="label">
95
+ <label>Requested Features</label>
96
+ <sort_order>20</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ <fields>
101
+ <show_feature_request translate="label">
102
+ <label>Enable</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_yesno</source_model>
105
+ <sort_order>10</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ <comment><![CDATA[]]></comment>
110
+ </show_feature_request>
111
+ <feature_request_widget_id translate="label">
112
+ <label>ID</label>
113
+ <frontend_type>text</frontend_type>
114
+ <sort_order>20</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ <validate>required-entry</validate>
119
+ <comment><![CDATA[]]></comment>
120
+ </feature_request_widget_id>
121
+ </fields>
122
+ </feature_requests>
123
+ <reviews type="group" translate="label">
124
+ <label>Reviews</label>
125
+ <sort_order>30</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ <fields>
130
+ <show_reviews translate="label">
131
+ <label>Enable</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>10</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ <comment><![CDATA[]]></comment>
139
+ </show_reviews>
140
+ <reviews_widget_id translate="label">
141
+ <label>ID</label>
142
+ <frontend_type>text</frontend_type>
143
+ <sort_order>20</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ <validate>required-entry</validate>
148
+ <comment><![CDATA[]]></comment>
149
+ </reviews_widget_id>
150
+ </fields>
151
+ </reviews>
152
+ <other type="group" translate="label">
153
+ <label>Other</label>
154
+ <sort_order>40</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ <fields>
159
+ <show_breadcrumbs translate="label">
160
+ <label>Show breadcrumbs</label>
161
+ <frontend_type>select</frontend_type>
162
+ <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>10</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
+ <comment><![CDATA[]]></comment>
168
+ </show_breadcrumbs>
169
+
170
+ <import_reviews>
171
+ <label>Use existing Magento Reviews</label>
172
+ <frontend_type>button</frontend_type>
173
+ <sort_order>20</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ <frontend_model>iwd_ces/system_config_form_fieldset_import_button</frontend_model>
178
+ <comment><![CDATA[]]></comment>
179
+ </import_reviews>
180
+
181
+ </fields>
182
+ </other>
183
+ </fields>
184
+ </widget>
185
+ </groups>
186
+ </iwd_ces>
187
+ </sections>
188
+ </config>
app/code/community/IWD/Ces/sql/ces_setup/install-0.0.1.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $table = $installer->getTable('iwd_ces');
5
+
6
+ $installer->startSetup();
7
+
8
+ $installer->getConnection()->dropTable($table);
9
+ $table = $installer->getConnection()
10
+ ->newTable($table)
11
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [
12
+ 'identity' => true,
13
+ 'nullable' => false,
14
+ 'primary' => true,
15
+ ])
16
+ ->addColumn('imported', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [
17
+ 'nullable' => false,
18
+ ]);
19
+ $installer->getConnection()->createTable($table);
20
+
21
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/iwd_ces.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss"><name>iwd/ces/ces_admin.css</name></action>
6
+ </reference>
7
+ </default>
8
+ </layout>
app/design/frontend/base/default/layout/iwd_ces.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+
3
+ <layout>
4
+ <iwd_ces_layout_handle>
5
+ <remove name="right" />
6
+ <remove name="left" />
7
+ <reference name="head">
8
+ <action method="addCss"><stylesheet>css/iwd/ces/ces_style.css</stylesheet></action>
9
+ </reference>
10
+ <reference name="root">
11
+ <action method="setTemplate">
12
+ <template>page/1column.phtml</template>
13
+ </action>
14
+ </reference>
15
+ </iwd_ces_layout_handle>
16
+ <iwd_ces_index_index>
17
+ <update handle="iwd_ces_layout_handle"/>
18
+ <reference name="content">
19
+ <block type="core/template" template="iwd/ces/index.phtml" />
20
+ </reference>
21
+ </iwd_ces_index_index>
22
+ <iwd_ces_index_view>
23
+ <update handle="iwd_ces_layout_handle"/>
24
+ <reference name="content">
25
+ <block type="iwd_ces/frontend_view_product" template="iwd/ces/product.phtml" />
26
+ </reference>
27
+ </iwd_ces_index_view>
28
+ <catalog_product_view>
29
+ <update handle="iwd_ces_layout_handle"/>
30
+ <reference name="product.info.additional">
31
+ <block type="iwd_ces/frontend_view_product" name="iwd_ces" template="iwd/ces/widget.phtml" after="-"/>
32
+ </reference>
33
+ <reference name="product.info">
34
+ <block type="iwd_ces/frontend_view_product" name="iwd_ces_list" as="iwd_list" before="-" template="iwd/ces/list.phtml" />
35
+ </reference>
36
+ </catalog_product_view>
37
+ <checkout_onepage_success>
38
+ <reference name="before_body_end">
39
+ <block type="iwd_ces/frontend_view_success" name="iwd_ces_tracking" template="iwd/ces/success.phtml" />
40
+ </reference>
41
+ </checkout_onepage_success>
42
+ </layout>
app/design/frontend/base/default/template/iwd/ces/list.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_REVIEWS)): ?>
2
+ <a href="#ces-reviews" class="ces-all-reviews ces-all" itemprop="review" itemscope="" itemtype="http://data-vocabulary.org/Review-aggregate">
3
+ <?php $product = $this->getProduct() ?>
4
+ <?php $ratingsValue = 0; ?>
5
+ <?php $reviewsCount = $this->getCount("reviews"); ?>
6
+ <?php $reviewsRating = $this->getReviewsRating() ?>
7
+ <?php $ratings = $this->mathRating($reviewsRating, false, 5) ?>
8
+
9
+ <?php foreach ($ratings as $key => $value): ?>
10
+ <?php if ($value == '1'): ?>
11
+ <?php $ratingsValue++; ?>
12
+ <i class="psw-fa psw-fa-star" aria-hidden="true"></i>
13
+ <?php elseif ($value == '1/2'): ?>
14
+ <?php $ratingsValue = $ratingsValue + 0.5; ?>
15
+ <i class="psw-fa psw-fa-star-half-o" aria-hidden="true"></i>
16
+ <?php else: ?>
17
+ <i class="psw-fa psw-fa-star-o" aria-hidden="true"></i>
18
+ <?php endif; ?>
19
+ <?php endforeach; ?>
20
+ <span class="ces-text">
21
+ <?php if ($reviewsCount > 0): ?>
22
+ <meta itemprop="itemreviewed" content="<?php echo $product->getName(); ?>">
23
+ <meta itemprop="rating" content="<?php echo $ratingsValue; ?>">
24
+ <meta itemprop="count" content="<?php echo $reviewsCount ?>">
25
+ <?php echo $reviewsCount ?>
26
+ <?php echo $reviewsCount != 1 ? $this->__('Reviews') : $this->__('Review'); ?>
27
+ <?php else: ?>
28
+ <?php echo $this->__('Add a Review') ?>
29
+ <?php endif; ?>
30
+ </span>
31
+
32
+ </a>
33
+ <?php endif; ?>
34
+ <?php if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_QUESTIONS_ANSWERS)): ?>
35
+ <a href="#ces-product-questions" class="ces-all-questions ces-all">
36
+ <?php $questionsCount = $this->getCount("questions", 'answered'); ?>
37
+ <i class="psw-fa psw-fa-question-circle" aria-hidden="true"></i>
38
+ <span class="ces-text">
39
+ <?php if ($questionsCount > 0) : ?>
40
+ <?php echo $questionsCount ?>
41
+ <?php echo $questionsCount != 1 ? $this->__('Answers') : $this->__('Answer'); ?>
42
+ <?php else: ?>
43
+ <?php echo $this->__('Ask a Question') ?>
44
+ <?php endif; ?>
45
+ </span>
46
+ </a>
47
+ <?php endif; ?>
48
+ <?php if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_FEATURE_REQUEST)): ?>
49
+ <a href="#ces-requests" class="ces-all-requests ces-all">
50
+ <?php $requestsCount = $this->getCount("requests"); ?>
51
+ <i class="psw-fa psw-fa-commenting" aria-hidden="true"></i>
52
+ <span class="ces-text">
53
+ <?php if ($requestsCount > 0) : ?>
54
+ <?php echo $requestsCount ?>
55
+ <?php echo $requestsCount != 1 ? $this->__('Requests') : $this->__('Request'); ?>
56
+ <?php else: ?>
57
+ <?php echo $this->__('Request a Feature') ?>
58
+ <?php endif ?>
59
+ </span>
60
+ </a>
61
+ <?php endif; ?>
app/design/frontend/base/default/template/iwd/ces/product.phtml ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php //if(Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_GENERAL_ENABLED)): ?>
2
+ <?php $product = $this->getProduct(); ?>
3
+ <?php $filter = $this->getFilter(); ?>
4
+ <?php $type = $this->getWidgetType() ?>
5
+ <?php $count = $this->getCount($type); ?>
6
+ <?php $domain = $this->getDomain() ?>
7
+ <?php $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $this->getUrlKey() ?>
8
+
9
+ <div class="ces-product-wrapper product-wrapper" itemscope itemtype="http://schema.org/Product">
10
+ <?php if ($product && !empty($product)): ?>
11
+ <?php $price = $product->getPrice(); ?>
12
+ <?php $formatted = Mage::helper('core')->currency($price, true, false); ?>
13
+ <?php $product_url = $product->getProductUrl(); ?>
14
+ <div class="product-info">
15
+ <div class="product-img-box">
16
+ <img class="product-image" src="<?php echo Mage::helper('catalog/image')->init($product, 'small_image'); ?>" itemprop="image" >
17
+ </div>
18
+ <div class="product-shop">
19
+ <a class="product-name" href="<?php echo $product_url ?>">
20
+ <span itemprop="name"> <?php echo $product->getName(); ?> </span>
21
+ </a> <br/>
22
+ <?php echo $this->getPriceHtml($product); ?>
23
+ </div>
24
+ <?php if ($type == 'questions'): ?>
25
+ <div class="block all-questions">
26
+ <?php if ($filter == 'questions'): ?>
27
+ <span class="text">
28
+ <?php echo isset($count) ? (string)$count : 0; ?>
29
+ <?php if (isset($count) && $count == 1): ?>question<?php else: ?>questions<?php endif; ?>
30
+ </span>
31
+ <?php else: ?>
32
+ <a class="text" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $this->getUrlKey() . '/questions' ?>">
33
+ View all questions (<?php echo isset($count) ? (string)$count : 0; ?>)
34
+ </a>
35
+ <?php endif; ?>
36
+ </div>
37
+ <?php elseif ($type == 'requests'): ?>
38
+ <?php $all_href = $base_url . '/feature-requests'; ?>
39
+
40
+ <?php if ($in_review_count = $this->getCount($type, 'in_review')): ?>
41
+ <div class="block all-questions in-review">
42
+ <?php if ($filter == 'requests'): ?>
43
+ <span class="text">
44
+ <?php echo isset($in_review_count) ? (string)$in_review_count : 0; ?>
45
+ <?php echo 'IN REVIEW' ?>
46
+ </span>
47
+ <?php else : ?>
48
+ <a class="text" href="<?php echo $all_href . '?status=IN_REVIEW' ?>">
49
+ <?php echo isset($in_review_count) ? (string)$in_review_count : 0; ?>
50
+ <?php echo 'IN REVIEW' ?>
51
+ </a>
52
+ <?php endif; ?>
53
+ </div>
54
+ <?php endif; ?>
55
+ <?php if ($coming_soon_count = $this->getCount($type, 'coming_soon')): ?>
56
+ <div class="block all-questions coming-soon">
57
+ <?php if ($filter == 'requests'): ?>
58
+ <span class="text">
59
+ <?php echo isset($coming_soon_count) ? (string)$coming_soon_count : 0; ?>
60
+
61
+ <?php echo 'COMING SOON' ?>
62
+ </span>
63
+ <?php else : ?>
64
+ <a class="text" href="<?php echo $all_href . '?status=COMING_SOON' ?>">
65
+ <?php echo isset($coming_soon_count) ? (string)$coming_soon_count : 0; ?>
66
+
67
+ <?php echo 'COMING SOON' ?>
68
+ </a>
69
+ <?php endif; ?>
70
+ </div>
71
+ <?php endif; ?>
72
+ <?php if ($completed_count = $this->getCount($type, 'completed')): ?>
73
+ <div class="block all-questions completed">
74
+ <?php if ($filter == 'requests'): ?>
75
+ <span class="text">
76
+ <?php echo isset($completed_count) ? (string)$completed_count : 0; ?>
77
+ <?php echo 'COMPLETED' ?>
78
+ </span>
79
+ <?php else : ?>
80
+ <a class="text" href="<?php echo $all_href . '?status=COMPLETED' ?>">
81
+ <?php echo isset($completed_count) ? (string)$completed_count : 0; ?>
82
+ <?php echo 'COMPLETED' ?>
83
+ </a>
84
+ <?php endif; ?>
85
+ </div>
86
+ <?php endif; ?>
87
+ <?php elseif ($type == 'reviews'): ?>
88
+ <div class="block all-questions" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
89
+ <meta itemprop="ratingValue" content = "<?php echo $this->getReviewsRating() ?>">
90
+ <meta itemprop="reviewCount" content = "<?php echo $count ?>">
91
+
92
+ <?php if ($filter == 'reviews'): ?>
93
+ <span class="text">
94
+ <?php echo isset($count) ? (string)$count : 0; ?>
95
+ <?php if (isset($count) && $count == 1): ?>review<?php else: ?>reviews<?php endif; ?>
96
+ </span>
97
+ <?php else: ?>
98
+ <a class="text" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $this->getUrlKey() . '/reviews' ?>">
99
+ View all reviews (<?php echo isset($count) ? (string)$count : 0; ?>)
100
+ </a>
101
+ <?php endif; ?>
102
+ </div>
103
+ <?php endif; ?>
104
+
105
+
106
+ <div class="clear"></div>
107
+ </div>
108
+ <?php if ($this->getWidgetId()) : ?>
109
+ <div class="upper <?php echo (string)$type; ?>"></div>
110
+ <?php
111
+ $data = [
112
+ 'widget_id' => $this->getWidgetId(),
113
+ 'base_url' => $base_url,
114
+ 'question_id' => ($filter == 'questions' || $filter == 'requests' || $filter == 'reviews') ? null : $filter,
115
+ 'product_url' => $product_url,
116
+ 'pagination' => true,
117
+ 'per_page' => $this->getPerPage(),
118
+ 'page' => $this->getPage() ? $this->getPage() : 1,
119
+ 'default_status' => $type == 'requests' ? $this->getFeatureRequestStatus() : null,
120
+ 'product_url' => $product->getProductUrl(),
121
+ // 'show_header' => false, // just for reviews widget for now
122
+ ];
123
+
124
+ if ($type == 'reviews' and $filter == $type) {
125
+ $data['header_text'] = 'View all reviews';
126
+ }
127
+
128
+ if ($filter == 'requests') {
129
+ $filter = 'feature-requests';
130
+ }
131
+
132
+ $data['pagination_url'] = $base_url . '/' . $filter;
133
+
134
+ $response = $this->getWidgetBody($data);
135
+ echo isset($response['widget']) ? $response['widget'] : '';
136
+ ?>
137
+ <?php endif; ?>
138
+
139
+ <?php else: ?>
140
+ <p>Product not found</p>
141
+ <?php endif; ?>
142
+ </div>
143
+ <?php //endif; ?>
app/design/frontend/base/default/template/iwd/ces/success.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php //if(Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_GENERAL_ENABLED)): ?>
2
+
3
+ <?php if (Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_REVIEWS)): ?>
4
+ <?php $base = Mage::helper('iwd_ces/settings')->getDomain(); ?>
5
+ <script>
6
+ var xhr = new XMLHttpRequest(),
7
+ orderId = '<?php echo $this->getOrderId() ?>',
8
+ orderAmount = '<?php echo $this->getOrderAmount() ?>',
9
+ orderCurrency = '<?php echo $this->getOrderCurrency() ?>',
10
+ userEmail = '<?php echo $this->getUsersEmail() ?>',
11
+ userName = '<?php echo $this->getUsersName() ?>',
12
+ storeName = '<?php echo $this->getStoreName() ?>',
13
+ productSku = '<?php echo $this->getProductSku() ?>',
14
+ widgetId = '<?php echo Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_REVIEWS_WIDGET_ID) ?>',
15
+ url = 'https://<?php echo $base ?>/customer-engagement-suite/api/users/verify_buyer';
16
+
17
+ url += '?order_id=' + orderId;
18
+ url += '&order_amount=' + orderAmount;
19
+ url += '&order_currency=' + orderCurrency;
20
+ url += '&user_name=' + userName;
21
+ url += '&user_email=' + userEmail;
22
+ url += '&store_name=' + storeName;
23
+ url += '&sku=' + productSku;
24
+ url += '&widget_id=' + widgetId;
25
+
26
+ xhr.open('GET', url, true);
27
+
28
+ xhr.send();
29
+
30
+ xhr.onreadystatechange = function() {
31
+ if (this.readyState != 4) return;
32
+
33
+ if (this.status != 200) {
34
+ console.error('Error: ' + (this.status ? this.statusText : 'undefined'));
35
+ return;
36
+ }
37
+ }
38
+ </script>
39
+ <?php endif; ?>
app/design/frontend/base/default/template/iwd/ces/widget.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php //if(Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_GENERAL_ENABLED)): ?>
2
+ <?php $showQA = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_QUESTIONS_ANSWERS) ?>
3
+ <?php $showFR = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_FEATURE_REQUEST) ?>
4
+ <?php $showReviews = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_SHOW_REVIEWS) ?>
5
+ <?php $isEnabled = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_GENERAL_ENABLED) ?>
6
+ <div class="ces-widget-wrapper">
7
+ <div class="ces-widget-header">
8
+ <?php if ($showQA): ?>
9
+ <div class="separator"></div>
10
+ <?php endif; ?>
11
+ </div>
12
+ <div class="ces-widget-content">
13
+ <?php $product = $this->getProduct() ?>
14
+ <?php $widget_id = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_QA_WIDGET_ID) ?>
15
+ <?php $domain = $this->getDomain() ?>
16
+ <?php if ($product): ?>
17
+ <?php
18
+ $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $this->getProductUrlStr();
19
+ //Building the batch data
20
+ $data['widget_id'] = "$widget_id";
21
+ if ($isEnabled) {
22
+ $optionsArray = [
23
+ 'base_url' => $base_url,
24
+ 'view_all_url' => $base_url . '/' . $this->getFilter(),
25
+ 'product_alias' => $product->getId(),
26
+ ];
27
+ $data = array_merge($data, $optionsArray);
28
+ }
29
+
30
+ ?>
31
+ <?php if ($showQA): ?>
32
+ <?php
33
+ $widget = $this->getWidgetBody($data);
34
+ echo isset($widget['widget']) ? $widget['widget'] : ''; ?>
35
+ <?php endif; ?>
36
+ <?php if ($showFR): ?>
37
+ <div class="ces-widget-separator"></div>
38
+ <?php
39
+ $data['widget_id'] = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_FR_WIDGET_ID);
40
+ if ($isEnabled) {
41
+ $data['view_all_url'] = $base_url . '/feature-requests';
42
+ }
43
+
44
+ $widget = $this->getWidgetBody($data);
45
+ echo isset($widget['widget']) ? $widget['widget'] : '';
46
+ ?>
47
+ <?php endif; ?>
48
+ <?php if ($showReviews): ?>
49
+ <?php
50
+ $data['widget_id'] = Mage::getStoreConfig(IWD_Ces_Helper_Settings::XML_PATH_REVIEWS_WIDGET_ID);
51
+ if ($isEnabled) {
52
+ $optionsArray = [
53
+ 'view_all_url' => $base_url . '/reviews',
54
+ 'product_url' => $product->getProductUrl(),
55
+ 'base_url' => $base_url,
56
+ 'product_alias' => $product->getId(),
57
+ ];
58
+ $data = array_merge($data, $optionsArray);
59
+ }
60
+ $r_response = $this->getWidgetBody($data);
61
+
62
+ echo isset($r_response['widget']) ? $r_response['widget'] : '';
63
+ ?>
64
+ <?php endif; ?>
65
+
66
+ <?php endif; ?>
67
+ </div>
68
+ </div>
69
+ <?php //endif; ?>
app/etc/modules/IWD_Ces.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <IWD_Ces>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </IWD_Ces>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>1993</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>MIT license</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>IWD CES</summary>
10
+ <description>IWD Ces integration</description>
11
+ <notes>Beta release</notes>
12
+ <authors><author><name>Vlad</name><user>Piontkivskyi</user><email>info@iwdagency.com</email></author></authors>
13
+ <date>2016-10-28</date>
14
+ <time>07:21:54</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="IWD_Ces.xml" hash="0b1cb87c27edc5e4c312671a4e15e6e6"/></dir></target><target name="magecommunity"><dir name="IWD"><dir name="Ces"><dir name="Block"><dir name="Frontend"><file name="Ces.php" hash="1f0ba54d6cd5e614687f7cade8d50516"/><dir name="View"><file name="Product.php" hash="c493401328890ab2c4f7dcfea0f9541b"/><file name="Success.php" hash="3c79539f1157f66fb9182d2ebbc9195f"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><file name="Documentations.php" hash="60aba22c2dcc20c22ef78856df650c10"/><file name="Extensions.php" hash="901f43bcddd5b7a36c3cb18f0ddb2426"/><dir name="Import"><file name="Button.php" hash="28b3c6a513ee85f91c0f78859033350b"/></dir></dir></dir></dir></dir></dir><dir name="Controller"><file name="Router.php" hash="11b852aaac91b4f9a7a8d34f8e23a681"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CesController.php" hash="19e3b051429e2e2aa0d55a141f419fb6"/></dir><dir name="Frontend"><file name="IndexController.php" hash="4cf3af630f8ce70ed398174944fbea73"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="1feace9c911649ae9d96dfd082b870fd"/><file name="config.xml" hash="b75739673527a6fd321beccd0fbe1ba8"/><file name="system.xml" hash="444d3ad6df5b0fb482e6748c9d426e19"/></dir><dir name="Helper"><file name="Curl.php" hash="bb98f108ea01588ccf286c7813579de1"/><file name="Data.php" hash="7c3722d293f9fb0c20066b54247d83a1"/><file name="Settings.php" hash="4e003d063e017058db63e09244b669f1"/></dir><dir name="Model"><file name="Ces.php" hash="7c3fb72336eaa81d14453f2f3566bb69"/><file name="Observer.php" hash="253712650b0fc7ceea416568af8f80e0"/><dir name="Resource"><dir name="Ces"><file name="Collection.php" hash="bb21749a051019767f408a8e5364f66e"/></dir><file name="Ces.php" hash="33ed1b6290104956966c41566646ebf8"/></dir></dir><dir name="sql"><dir name="ces_setup"><file name="install-0.0.1.php" hash="a362009e0316a3cae05baae8e4a4ac4e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iwd_ces.xml" hash="c903d29e62e75bcf6ad77b252a294e57"/></dir><dir name="template"><dir name="iwd"><dir name="ces"><file name="list.phtml" hash="7d1d0329b9b6046dad9e94f70a7d8eef"/><file name="product.phtml" hash="e4234f337f1fbe8f73a068112f762d60"/><file name="success.phtml" hash="692be926f6d700181c364e4d027e1565"/><file name="widget.phtml" hash="d1e9703038751843afa2ee12664eab18"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iwd_ces.xml" hash="ed5f79baa83b55a8fceb99e119f3a8a1"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="iwd"><dir name="ces"><file name="ces_style.css" hash="1532586abdfc4d05e18367437c3b3615"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iwd"><dir name="ces"><file name="ces_admin.css" hash="8abb46340bb80baa5981ba98e5a0a53e"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.4.0</min><max>8.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/iwd/ces/ces_admin.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #iwd_ces_widget .form-list {
2
+ width: 100%;
3
+ }
4
+
5
+ .blocked-button, .blocked-button:hover {
6
+ background: #7a7a7a;
7
+ background: -moz-linear-gradient(45deg, #7a7a7a 0%, #a0a0a0 100%);
8
+ background: -webkit-linear-gradient(45deg, #7a7a7a 0%,#a0a0a0 100%);
9
+ background: linear-gradient(45deg, #7a7a7a 0%,#a0a0a0 100%);
10
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7a7a7a', endColorstr='#a0a0a0',GradientType=1 );
11
+ border: none;
12
+ }
skin/frontend/base/default/css/iwd/ces/ces_style.css ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .block {
2
+ display: block;
3
+ }
4
+ .ces-product-wrapper {
5
+ margin-top: 46px;
6
+ }
7
+ .ces-product-wrapper .product-info {
8
+ padding: 0;
9
+ margin: 0 50px;
10
+ font-family: "Open Sans";
11
+ height: auto;
12
+ }
13
+ .ces-product-wrapper .product-info .product-img-box {
14
+ width: 195px;
15
+ max-width: 185px; /* 195px; */
16
+ float: left;
17
+ }
18
+ .ces-product-wrapper .product-info .product-shop {
19
+ /*float: left;*/
20
+ }
21
+ .ces-product-wrapper .product-info .product-image {
22
+ display: block;
23
+ width: 142px; /* 150px */
24
+ height: 142px; /* 150px */
25
+ }
26
+ .ces-product-wrapper .product-info .all-questions {
27
+ border: 1px solid #e2e2e2 !important;
28
+ padding: 8px 25px 7px !important;
29
+ /* padding: 12px 25px 14px !important; */
30
+ font-size: 16px !important;
31
+ margin: 42px 25px 27px 3px;
32
+ /*margin: 22px 25px 27px 3px;*/
33
+ float: left !important;
34
+ height: 23px !important;
35
+ /*left: 245px;*/
36
+ box-sizing: content-box;
37
+ }
38
+ .ces-product-wrapper .product-info .all-questions .text {
39
+ color: #008a99;
40
+ text-align: center;
41
+ font-weight: bold;
42
+ font-size: 16px;
43
+ text-transform: uppercase;
44
+ }
45
+ .ces-product-wrapper .product-info .all-questions:hover {
46
+ background: #008a99;
47
+ }
48
+ .ces-product-wrapper .product-info .all-questions:hover .text {
49
+ color: white;
50
+ text-decoration: none;
51
+ }
52
+ .ces-product-wrapper .product-info .clear {
53
+ clear: both;
54
+ }
55
+ .ces-product-wrapper .product-info .product-shop .product-name {
56
+ color: #2693a1;
57
+ font-size: 22px;
58
+ text-transform: uppercase;
59
+ position: relative;
60
+ top: -8px;
61
+ text-decoration: none;
62
+ }
63
+ .ces-product-wrapper .product-info .product-shop .price {
64
+ position: relative;
65
+ color: #000000;
66
+ font-size: 22px;
67
+ letter-spacing: -1px;
68
+ top: 2px;
69
+ }
70
+ .ces-product-wrapper .product-info .product-shop .old {
71
+ /*text-decoration: line-through;*/
72
+ margin-right: 6px;
73
+ }
74
+ .ces-product-wrapper .product-info .product-shop .old::after {
75
+ content: ' ';
76
+ display: block;
77
+ position: absolute;
78
+ width: 100%;
79
+ height: 1px;
80
+ top: 50%;
81
+ background: black;
82
+ }
83
+ .ces-product-wrapper .upper {
84
+ clear: both;
85
+ text-align: center;
86
+ padding-bottom: 21px; /* 50px; */
87
+ margin-bottom: -6px;
88
+ border-bottom: 1px #b0b0b0 solid;
89
+ }
90
+ .ces-product-wrapper .view-all, .ces-widget-wrapper .ces-widget-header .header {
91
+ font-size: 31.88px;
92
+ text-align: center;
93
+ font-family: "Open Sans";
94
+ width: 100%;
95
+ margin: 36px auto 0;
96
+ right: 30px;
97
+ position: relative;
98
+ top: 6px;
99
+ color: #000000;
100
+ font-weight: 400;
101
+ text-transform: uppercase;
102
+ }
103
+ .ces-widget-wrapper {
104
+ width: 100%;
105
+ }
106
+ .ces-widget-wrapper .ces-widget-header .separator {
107
+ margin: 30px auto;
108
+ display: block;
109
+ height: 1px;
110
+ width: 100%;
111
+ background: grey;
112
+ }
113
+ .ces-all {
114
+ display: inline;
115
+ padding: 0 10px;
116
+ font-size: 15px;
117
+ color: #008a99;
118
+ }
119
+ .ces-text {
120
+ padding-left: 2px;
121
+ }
122
+ @media (min-width: 678px) and (max-width: 900px) {
123
+ .product-info {
124
+ margin: 0 30px;
125
+ }
126
+ .product-info .all-questions {
127
+ left: 225px;
128
+ }
129
+ .view-all, .ces-widget-wrapper .ces-widget-header .header {
130
+ right: 0;
131
+ }
132
+ .upper {
133
+ padding-bottom: 49px;
134
+ }
135
+ .upper.reviews {
136
+ padding-bottom: 21px;
137
+ }
138
+ }
139
+ @media (min-width: 768px) and (max-width: 956px) {
140
+ .ces-product-wrapper .product-info {
141
+ margin: 0 30px;
142
+ }
143
+ .ces-product-wrapper .product-info .all-questions.completed {
144
+ margin: 0;
145
+ margin-left: 188px;
146
+ }
147
+ .ces-product-wrapper .upper {
148
+ padding-bottom: 49px;
149
+ }
150
+ .ces-product-wrapper .upper.reviews {
151
+ padding-bottom: 21px;
152
+ }
153
+ }
154
+ @media (min-width: 768px) and (max-width: 956px) {
155
+ .ces-product-wrapper .product-info {
156
+ margin: 0 30px;
157
+ }
158
+ .ces-product-wrapper .product-info .all-questions.completed {
159
+ margin: 0;
160
+ margin-left: 188px;
161
+ }
162
+ .ces-product-wrapper .upper {
163
+ padding-bottom: 49px;
164
+ }
165
+ }
166
+ @media (max-width: 767px) {
167
+ .container {
168
+ width: 94%;
169
+ padding-left: 2%;
170
+ padding-right: 2%;
171
+ }
172
+ .ces-product-wrapper .product-info {
173
+ margin: 0 15px;
174
+ padding: 0;
175
+ }
176
+ .ces-product-wrapper .product-info .product-img-box {
177
+ width: 90px;
178
+ height: 90px;
179
+ float: left;
180
+ margin-right: 28px;
181
+ }
182
+ .ces-product-wrapper .product-info .product-img-box > img {
183
+ width: 100%;
184
+ height: 100%;
185
+ display: block;
186
+ padding: 0 22px 0 0px;
187
+ }
188
+ .ces-product-wrapper .product-info .product-shop .product-name {
189
+ top: -5px;
190
+ font-size: 15px;
191
+ margin-left: -5px;
192
+ line-height: 1.55;
193
+ }
194
+ .ces-product-wrapper .price {
195
+ font-size: 15px !important;
196
+ }
197
+ .ces-product-wrapper .product-info .product-shop .price {
198
+ right: 5px;
199
+ top: 8px;
200
+ }
201
+ .ces-product-wrapper .view-all, .ces-widget-wrapper .ces-widget-header .header {
202
+ right: 0;
203
+ top: 33px;
204
+ padding-bottom: 25px;
205
+ }
206
+ .ces-product-wrapper .product-info .all-questions {
207
+ position: relative;
208
+ padding: 7px 0 !important;
209
+ width: 100%;
210
+ left: 0;
211
+ text-align: center !important;
212
+ top: 73px;
213
+ max-width: 290px;
214
+ margin: auto !important;
215
+ float: none !important;
216
+ margin-bottom: 27px !important;
217
+ }
218
+ .ces-product-wrapper .upper {
219
+ border: none;
220
+ padding-bottom: 0px; /* 40px; */
221
+ }
222
+ .ces-all {
223
+ display: block;
224
+ }
225
+ }
226
+ @media (max-width: 768px) {
227
+ /* .container {
228
+ width: 90%;
229
+ padding-left: 2%;
230
+ padding-right: 2%;
231
+ } */
232
+ .ces-product-wrapper .product-info .all-questions {
233
+ left: 0;
234
+ top: 25px;
235
+ max-width: 100%;
236
+ float: left !important;
237
+ }
238
+ .ces-product-wrapper .view-all, .ces-widget-wrapper .ces-widget-header .header {
239
+ top: -7px;
240
+ padding-bottom: 0;
241
+ }
242
+ }
243
+ .ces-widget-separator {
244
+ margin: 50px 0;
245
+ width: 100%;
246
+ border-top: 1px #000 solid;
247
+ display: block;
248
+ }