feedback_company_feedback_request - Version 1.0.0

Version Notes

First public release

Download this release

Release Info

Developer Magento Core Team
Extension feedback_company_feedback_request
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Feedback/Request/Block/Feedback.php ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Feedback_Request_Block_Feedback extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getMtsmartmenu()
10
+ {
11
+ if (!$this->hasData('feedback')) {
12
+ $this->setData('feedback', Mage::registry('feedback'));
13
+ }
14
+ return $this->getData('feedback');
15
+
16
+ }
17
+ protected $_categoryInstance = null;
18
+
19
+ protected function _construct()
20
+ {
21
+ $this->addData(array(
22
+ 'cache_lifetime' => false,
23
+ 'cache_tags' => array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Core_Model_Store_Group::CACHE_TAG),
24
+ ));
25
+ }
26
+
27
+ /**
28
+ * Retrieve Key for caching block content
29
+ *
30
+ * @return string
31
+ */
32
+ public function getCacheKey()
33
+ {
34
+ return 'CATALOG_NAVIGATION_' . Mage::app()->getStore()->getId()
35
+ . '_' . Mage::getDesign()->getPackageName()
36
+ . '_' . Mage::getDesign()->getTheme('template')
37
+ . '_' . Mage::getSingleton('customer/session')->getCustomerGroupId()
38
+ . '_' . md5($this->getTemplate() . $this->getCurrenCategoryKey());
39
+ }
40
+
41
+ public function getCurrenCategoryKey()
42
+ {
43
+ if ($category = Mage::registry('current_category')) {
44
+ return $category->getPath();
45
+ } else {
46
+ return Mage::app()->getStore()->getRootCategoryId();
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Get catagories of current store
52
+ *
53
+ * @return Varien_Data_Tree_Node_Collection
54
+ */
55
+ public function getStoreCategories()
56
+ {
57
+ $helper = Mage::helper('catalog/category');
58
+ return $helper->getStoreCategories();
59
+ }
60
+
61
+ /**
62
+ * Retrieve child categories of current category
63
+ *
64
+ * @return Varien_Data_Tree_Node_Collection
65
+ */
66
+ public function getCurrentChildCategories()
67
+ {
68
+ $layer = Mage::getSingleton('catalog/layer');
69
+ $category = $layer->getCurrentCategory();
70
+ /* @var $category Mage_Catalog_Model_Category */
71
+ $categories = $category->getChildrenCategories();
72
+ $productCollection = Mage::getResourceModel('catalog/product_collection');
73
+ $layer->prepareProductCollection($productCollection);
74
+ $productCollection->addCountToCategories($categories);
75
+ return $categories;
76
+ }
77
+
78
+ /**
79
+ * Checkin activity of category
80
+ *
81
+ * @param Varien_Object $category
82
+ * @return bool
83
+ */
84
+ public function isCategoryActive($category)
85
+ {
86
+ if ($this->getCurrentCategory()) {
87
+ return in_array($category->getId(), $this->getCurrentCategory()->getPathIds());
88
+ }
89
+ return false;
90
+ }
91
+
92
+ protected function _getCategoryInstance()
93
+ {
94
+ if (is_null($this->_categoryInstance)) {
95
+ $this->_categoryInstance = Mage::getModel('catalog/category');
96
+ }
97
+ return $this->_categoryInstance;
98
+ }
99
+
100
+ /**
101
+ * Get url for category data
102
+ *
103
+ * @param Mage_Catalog_Model_Category $category
104
+ * @return string
105
+ */
106
+ public function getCategoryUrl($category)
107
+ {
108
+ if ($category instanceof Mage_Catalog_Model_Category) {
109
+ $url = $category->getUrl();
110
+ } else {
111
+ $url = $this->_getCategoryInstance()
112
+ ->setData($category->getData())
113
+ ->getUrl();
114
+ }
115
+
116
+ return $url;
117
+ }
118
+
119
+ /**
120
+ * Enter description here...
121
+ *
122
+ * @param Mage_Catalog_Model_Category $category
123
+ * @param int $level
124
+ * @param boolean $last
125
+ * @return string
126
+ */
127
+ public function drawItem($category, $level=0, $last=false)
128
+ {
129
+ $html = '';
130
+ if (!$category->getIsActive()) {
131
+ return $html;
132
+ }
133
+ if (Mage::helper('catalog/category_flat')->isEnabled()) {
134
+ $children = $category->getChildrenNodes();
135
+ $childrenCount = count($children);
136
+ } else {
137
+ $children = $category->getChildren();
138
+ $childrenCount = $children->count();
139
+ }
140
+ $hasChildren = $children && $childrenCount;
141
+ $html.= '<li';
142
+ if ($hasChildren) {
143
+ $html.= ' onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)"';
144
+ }
145
+
146
+ $html.= ' class="level'.$level;
147
+ $html.= ' nav-'.str_replace('/', '-', Mage::helper('catalog/category')->getCategoryUrlPath($category->getRequestPath()));
148
+ if ($this->isCategoryActive($category)) {
149
+ $html.= ' active';
150
+ }
151
+ if ($last) {
152
+ $html .= ' last';
153
+ }
154
+ if ($hasChildren) {
155
+ $cnt = 0;
156
+ foreach ($children as $child) {
157
+ if ($child->getIsActive()) {
158
+ $cnt++;
159
+ }
160
+ }
161
+ if ($cnt > 0) {
162
+ $html .= ' parent';
163
+ }
164
+ }
165
+ $html.= '">'."\n";
166
+ if($level==0)
167
+ {
168
+ $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a><span class="head"><a href="#" style="float:right;"></a></span>'."\n";
169
+ }
170
+ else
171
+ {
172
+ $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
173
+ }
174
+ if ($hasChildren){
175
+
176
+ $j = 0;
177
+ $htmlChildren = '';
178
+ foreach ($children as $child) {
179
+ if ($child->getIsActive()) {
180
+ $htmlChildren.= $this->drawItem($child, $level+1, ++$j >= $cnt);
181
+ }
182
+ }
183
+
184
+ if (!empty($htmlChildren)) {
185
+ $html.= '<ul class="level' . $level . '">'."\n"
186
+ .$htmlChildren
187
+ .'</ul>';
188
+ }
189
+
190
+ }
191
+ $html.= '</li>'."\n";
192
+ return $html;
193
+ }
194
+
195
+ /**
196
+ * Enter description here...
197
+ *
198
+ * @return Mage_Catalog_Model_Category
199
+ */
200
+ public function getCurrentCategory()
201
+ {
202
+ if (Mage::getSingleton('catalog/layer')) {
203
+ return Mage::getSingleton('catalog/layer')->getCurrentCategory();
204
+ }
205
+ return false;
206
+ }
207
+
208
+ /**
209
+ * Enter description here...
210
+ *
211
+ * @return string
212
+ */
213
+ public function getCurrentCategoryPath()
214
+ {
215
+ if ($this->getCurrentCategory()) {
216
+ return explode(',', $this->getCurrentCategory()->getPathInStore());
217
+ }
218
+ return array();
219
+ }
220
+
221
+ /**
222
+ * Enter description here...
223
+ *
224
+ * @param Mage_Catalog_Model_Category $category
225
+ * @return string
226
+ */
227
+ public function drawOpenCategoryItem($category) {
228
+ $html = '';
229
+ if (!$category->getIsActive()) {
230
+ return $html;
231
+ }
232
+
233
+ $html.= '<li';
234
+
235
+ if ($this->isCategoryActive($category)) {
236
+ $html.= ' class="active"';
237
+ }
238
+
239
+ $html.= '>'."\n";
240
+ $html.= '<a href="'.$this->getCategoryUrl($category).'"><span>'.$this->htmlEscape($category->getName()).'</span></a>'."\n";
241
+
242
+ if (in_array($category->getId(), $this->getCurrentCategoryPath())){
243
+ $children = $category->getChildren();
244
+ $hasChildren = $children && $children->count();
245
+
246
+ if ($hasChildren) {
247
+ $htmlChildren = '';
248
+ foreach ($children as $child) {
249
+ $htmlChildren.= $this->drawOpenCategoryItem($child);
250
+ }
251
+
252
+ if (!empty($htmlChildren)) {
253
+ $html.= '<ul>'."\n"
254
+ .$htmlChildren
255
+ .'</ul>';
256
+ }
257
+ }
258
+ }
259
+ $html.= '</li>'."\n";
260
+ return $html;
261
+ }
262
+
263
+ // render item category
264
+ protected function _renderCategoryMenuItemHtml($category, $level = 0, $isLast = false, $isFirst = false,
265
+ $isOutermost = false, $outermostItemClass = '', $childrenWrapClass = '', $noEventAttributes = false)
266
+ {
267
+ if (!$category->getIsActive()) {
268
+ return '';
269
+ }
270
+ $html = array();
271
+
272
+ // get all children
273
+ if (Mage::helper('catalog/category_flat')->isEnabled()) {
274
+ $children = (array)$category->getChildrenNodes();
275
+ $childrenCount = count($children);
276
+ } else {
277
+ $children = $category->getChildren();
278
+ $childrenCount = $children->count();
279
+ }
280
+ $hasChildren = ($children && $childrenCount);
281
+
282
+ // select active children
283
+ $activeChildren = array();
284
+ foreach ($children as $child) {
285
+ if ($child->getIsActive()) {
286
+ $activeChildren[] = $child;
287
+ }
288
+ }
289
+ $activeChildrenCount = count($activeChildren);
290
+ $hasActiveChildren = ($activeChildrenCount > 0);
291
+
292
+ // prepare list item html classes
293
+ $classes = array();
294
+ $classes[] = 'level' . $level;
295
+ $classes[] = 'nav-' . $this->_getItemPosition($level);
296
+ $linkClass = '';
297
+ if ($isOutermost && $outermostItemClass) {
298
+ $classes[] = $outermostItemClass;
299
+ $linkClass = ' class="'.$outermostItemClass.'"';
300
+ }
301
+ if ($this->isCategoryActive($category)) {
302
+ $classes[] = 'active';
303
+ }
304
+ if ($isFirst) {
305
+ $classes[] = 'first';
306
+ }
307
+ if ($isLast) {
308
+ $classes[] = 'last';
309
+ }
310
+ if ($hasActiveChildren) {
311
+ $classes[] = 'parent';
312
+ }
313
+
314
+ // prepare list item attributes
315
+ $attributes = array();
316
+ if (count($classes) > 0) {
317
+ $attributes['class'] = implode(' ', $classes);
318
+ }
319
+ if ($hasActiveChildren && !$noEventAttributes) {
320
+ $attributes['onmouseover'] = 'toggleMenu(this,1)';
321
+ $attributes['onmouseout'] = 'toggleMenu(this,0)';
322
+ }
323
+
324
+ // assemble list item with attributes
325
+ $htmlLi = '<li';
326
+ foreach ($attributes as $attrName => $attrValue) {
327
+ $htmlLi .= ' ' . $attrName . '="' . str_replace('"', '\"', $attrValue) . '"';
328
+ }
329
+ $htmlLi .= '>';
330
+ $html[] = $htmlLi;
331
+
332
+ $html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
333
+ $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
334
+ $html[] = '</a>';
335
+
336
+ // render children
337
+
338
+ $htmlChildren = '';
339
+ $j = 0;
340
+ foreach ($activeChildren as $child) {
341
+ $htmlChildren .= $this->_renderCategoryMenuItemHtml(
342
+ $child,
343
+ ($level + 1),
344
+ ($j == $activeChildrenCount - 1),
345
+ ($j == 0),
346
+ false,
347
+ $outermostItemClass,
348
+ $childrenWrapClass,
349
+ $noEventAttributes
350
+ );
351
+ $j++;
352
+ }
353
+ if (!empty($htmlChildren)) {
354
+ if ($childrenWrapClass) {
355
+ $html[] = '<div class="' . $childrenWrapClass . '">';
356
+ }
357
+ $html[] = '<ul class="level' . $level . '">';
358
+ $html[] = $htmlChildren;
359
+ $html[] = '</ul>';
360
+ if ($childrenWrapClass) {
361
+ $html[] = '</div>';
362
+ }
363
+ }
364
+
365
+ $html[] = '</li>';
366
+
367
+ $html = implode("\n", $html);
368
+ return $html;
369
+ }
370
+ public function mtdrawItem($category, $level = 0, $last = false)
371
+ {
372
+ return $this->_renderCategoryMenuItemHtml($category, $level, $last);
373
+ }
374
+
375
+ protected function _getItemPosition($level)
376
+ {
377
+ if ($level == 0) {
378
+ $zeroLevelPosition = isset($this->_itemLevelPositions[$level]) ? $this->_itemLevelPositions[$level] + 1 : 1;
379
+ $this->_itemLevelPositions = array();
380
+ $this->_itemLevelPositions[$level] = $zeroLevelPosition;
381
+ } elseif (isset($this->_itemLevelPositions[$level])) {
382
+ $this->_itemLevelPositions[$level]++;
383
+ } else {
384
+ $this->_itemLevelPositions[$level] = 1;
385
+ }
386
+
387
+ $position = array();
388
+ for($i = 0; $i <= $level; $i++) {
389
+ if (isset($this->_itemLevelPositions[$i])) {
390
+ $position[] = $this->_itemLevelPositions[$i];
391
+ }
392
+ }
393
+ return implode('-', $position);
394
+ }
395
+ //get config data
396
+ public function getConfig($att)
397
+ {
398
+ $config = Mage::getStoreConfig('feedback');
399
+ if (isset($config['feedback_config']) ) {
400
+ $value = $config['feedback_config'][$att];
401
+ return $value;
402
+ } else {
403
+ throw new Exception($att.' value not set');
404
+ }
405
+ }
406
+ }
app/code/local/Feedback/Request/Block/Info.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Feedback_Request_Block_Info extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
3
+ {
4
+ public function render(Varien_Data_Form_Element_Abstract $element)
5
+ {
6
+ $html = $this->_getHeaderHtml($element);
7
+ $html.= $this->_getFieldHtml($element);
8
+ $html .= $this->_getFooterHtml($element);
9
+ return $html;
10
+ }
11
+ protected function _getFieldHtml($fieldset)
12
+ {
13
+ $content = 'This extension is developed by <a href="http://www.Professionele-Webshop.nl" title="Professionele-Webshop">Professionele-Webshop.nl</a>';
14
+ return $content;
15
+ }
16
+ }
app/code/local/Feedback/Request/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Feedback_Request_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/Feedback/Request/Model/Config/Delay.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Feedback_Request_Model_Config_Delay
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('Select Value')),
9
+ array('value'=>'1', 'label'=>Mage::helper('adminhtml')->__('1')),
10
+ array('value'=>'2', 'label'=>Mage::helper('adminhtml')->__('2')),
11
+ array('value'=>'3', 'label'=>Mage::helper('adminhtml')->__('3')),
12
+ array('value'=>'4', 'label'=>Mage::helper('adminhtml')->__('4')),
13
+ array('value'=>'5', 'label'=>Mage::helper('adminhtml')->__('5')),
14
+ array('value'=>'6', 'label'=>Mage::helper('adminhtml')->__('6')),
15
+ array('value'=>'7', 'label'=>Mage::helper('adminhtml')->__('7')),
16
+ array('value'=>'8', 'label'=>Mage::helper('adminhtml')->__('8')),
17
+ array('value'=>'9', 'label'=>Mage::helper('adminhtml')->__('9')),
18
+ array('value'=>'10', 'label'=>Mage::helper('adminhtml')->__('10')),
19
+ array('value'=>'14', 'label'=>Mage::helper('adminhtml')->__('14')),
20
+ array('value'=>'28', 'label'=>Mage::helper('adminhtml')->__('28')),
21
+ );
22
+ }
23
+
24
+ }
app/code/local/Feedback/Request/Model/Config/Reminddelay.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Feedback_Request_Model_Config_Reminddelay
3
+ {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array('value'=>'-1', 'label'=>Mage::helper('adminhtml')->__('Select Value')),
9
+ array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('0')),
10
+ array('value'=>'1', 'label'=>Mage::helper('adminhtml')->__('1')),
11
+ array('value'=>'2', 'label'=>Mage::helper('adminhtml')->__('2')),
12
+ array('value'=>'3', 'label'=>Mage::helper('adminhtml')->__('3')),
13
+ array('value'=>'4', 'label'=>Mage::helper('adminhtml')->__('4')),
14
+ array('value'=>'5', 'label'=>Mage::helper('adminhtml')->__('5')),
15
+ array('value'=>'6', 'label'=>Mage::helper('adminhtml')->__('6')),
16
+ array('value'=>'7', 'label'=>Mage::helper('adminhtml')->__('7')),
17
+ array('value'=>'8', 'label'=>Mage::helper('adminhtml')->__('8')),
18
+ array('value'=>'9', 'label'=>Mage::helper('adminhtml')->__('9')),
19
+ array('value'=>'10', 'label'=>Mage::helper('adminhtml')->__('10')),
20
+ array('value'=>'14', 'label'=>Mage::helper('adminhtml')->__('14')),
21
+ array('value'=>'28', 'label'=>Mage::helper('adminhtml')->__('28')),
22
+ );
23
+ }
24
+
25
+ }
app/code/local/Feedback/Request/controllers/OnepageController.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 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
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
28
+ class Feedback_Request_OnepageController extends Mage_Checkout_OnepageController
29
+ {
30
+
31
+ public function successAction()
32
+ {
33
+ // echo "success";exit;
34
+ $login = Mage::getStoreConfig('feedback/feedback_config/login');
35
+ // echo "<br>";
36
+ $action = Mage::getStoreConfig('feedback/feedback_config/action');
37
+ $connector = Mage::getStoreConfig('feedback/feedback_config/connector');
38
+ $delay = Mage::getStoreConfig('feedback/feedback_config/delay');
39
+ $remindDelay = Mage::getStoreConfig('feedback/feedback_config/remindDelay');
40
+ $resendIfDouble = Mage::getStoreConfig('feedback/feedback_config/resendIfDouble');
41
+
42
+
43
+ $session = $this->getOnepage()->getCheckout();
44
+ if (!$session->getLastSuccessQuoteId()) {
45
+ $this->_redirect('checkout/cart');
46
+ return;
47
+ }
48
+
49
+ $lastQuoteId = $session->getLastQuoteId();
50
+ $lastOrderId = $session->getLastOrderId();
51
+
52
+ $order = Mage::getModel('sales/order')->load($lastOrderId);
53
+ $email_new = $order->getCustomerEmail();
54
+
55
+ $new_url = "http://www.webwinkelvergelijker.nl/feedback?action=".$action."&connector=".$connector."&user=".$email_new."&delay=".$delay."&remindDelay=".$remindDelay."&resendIfDouble=".$resendIfDouble;
56
+ Mage::log('$new_url: '.$new_url);
57
+ $new_curl = curl_init($new_url);
58
+ curl_setopt($new_curl, CURLOPT_VERBOSE, 1);
59
+ curl_setopt($new_curl, CURLOPT_FAILONERROR, false);
60
+ curl_setopt($new_curl, CURLOPT_HEADER, 0);
61
+ curl_setopt($new_curl, CURLOPT_FOLLOWLOCATION,1);
62
+ curl_setopt($new_curl, CURLOPT_RETURNTRANSFER, 1);
63
+ $new_res = curl_exec($new_curl);
64
+ Mage::log('$new_res: '.$new_res);
65
+ curl_close($new_curl);
66
+
67
+ /************* mushir *************/
68
+ if($login == 1){
69
+ $file_name = $_SERVER['DOCUMENT_ROOT']."/response-file/response.csv";
70
+ $data = 'Response,Current Date,URL'."\n";
71
+ $new_res = preg_replace('/\s\s+/', ' ', $new_res);
72
+ $result = trim($new_res).','.date('Y-m-d H:i:s').','.$new_url."\n";
73
+
74
+ $data .= $result;
75
+ $fh = fopen($file_name, 'w');
76
+ fwrite($fh, $data);
77
+ fclose($fh);
78
+ }
79
+ //exit;
80
+ /************* mushir *************/
81
+
82
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
83
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
84
+ $this->_redirect('checkout/cart');
85
+ return;
86
+ }
87
+
88
+ $session->clear();
89
+ $this->loadLayout();
90
+ $this->_initLayoutMessages('checkout/session');
91
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
92
+ $this->renderLayout();
93
+ }
94
+
95
+ public function failureAction()
96
+ {
97
+ $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
98
+ $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
99
+
100
+ if (!$lastQuoteId || !$lastOrderId) {
101
+ $this->_redirect('checkout/cart');
102
+ return;
103
+ }
104
+
105
+ $this->loadLayout();
106
+ $this->renderLayout();
107
+ }
108
+
109
+
110
+ }
app/code/local/Feedback/Request/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <feedback>
12
+ <title>Feedback Request</title>
13
+ </feedback>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/local/Feedback/Request/etc/config.xml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Feedback_Request>
5
+ <version>1.4.2.0</version>
6
+ </Feedback_Request>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <feedback>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Feedback_Request</module>
14
+ <frontName>feedback</frontName>
15
+ </args>
16
+ </feedback>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <feedback>
21
+ <file>feedback.xml</file>
22
+ </feedback>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <feedback>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Feedback_Request</module>
32
+ <frontName>feedback</frontName>
33
+ </args>
34
+ </feedback>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+
39
+ <acl>
40
+ <resources>
41
+ <all>
42
+ <title>Allow Everything</title>
43
+ </all>
44
+ <admin>
45
+ <children>
46
+ <Feedback_Request>
47
+ <title>Feedback Request</title>
48
+ <sort_order>10</sort_order>
49
+ </Feedback_Request>
50
+ </children>
51
+ </admin>
52
+ </resources>
53
+ </acl>
54
+ <layout>
55
+ <updates>
56
+ <feedback>
57
+ <file>feedback.xml</file>
58
+ </feedback>
59
+ </updates>
60
+ </layout>
61
+ </adminhtml>
62
+ <global>
63
+ <models>
64
+ <feedback>
65
+ <class>Feedback_Request_Model</class>
66
+ <resourceModel>feedback_mysql4</resourceModel>
67
+ </feedback>
68
+ <feedback_mysql4>
69
+ <class>Feedback_Request_Model_Mysql4</class>
70
+ <entities>
71
+ <feedback>
72
+ <table>feedback</table>
73
+ </feedback>
74
+ </entities>
75
+ </feedback_mysql4>
76
+ </models>
77
+ <rewrite>
78
+ <Feedback_Request_onepage>
79
+ <from><![CDATA[#^/checkout/onepage/#]]></from>
80
+ <to>/feedback/onepage/</to>
81
+ </Feedback_Request_onepage>
82
+ </rewrite>
83
+ <resources>
84
+ <feedback_setup>
85
+ <setup>
86
+ <module>Feedback_Request</module>
87
+ </setup>
88
+ <connection>
89
+ <use>core_setup</use>
90
+ </connection>
91
+ </feedback_setup>
92
+ <feedback_write>
93
+ <connection>
94
+ <use>core_write</use>
95
+ </connection>
96
+ </feedback_write>
97
+ <feedback_read>
98
+ <connection>
99
+ <use>core_read</use>
100
+ </connection>
101
+ </feedback_read>
102
+ </resources>
103
+ <blocks>
104
+ <feedback>
105
+ <class>Feedback_Request_Block</class>
106
+ </feedback>
107
+ </blocks>
108
+ <helpers>
109
+ <feedback>
110
+ <class>Feedback_Request_Helper</class>
111
+ </feedback>
112
+ </helpers>
113
+ </global>
114
+ </config>
app/code/local/Feedback/Request/etc/system.xml ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <feedback translate="label" module="feedback">
5
+ <label>Feedback Company</label>
6
+ <sort_order>205</sort_order>
7
+ </feedback>
8
+ </tabs>
9
+ <sections>
10
+ <feedback translate="label" module="feedback">
11
+ <label>Feedback Request</label>
12
+ <tab>feedback</tab>
13
+ <sort_order>130</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <feedback_config translate="label">
19
+ <label>Request Config</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <enabled translate="label comment">
27
+ <label>Enabled module:</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>
30
+ adminhtml/system_config_source_yesno
31
+ </source_model>
32
+ <sort_order>10</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
+ </enabled>
37
+ <login translate="label comment">
38
+ <label>Enable/Disable Logging:</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>
41
+ adminhtml/system_config_source_yesno
42
+ </source_model>
43
+ <sort_order>10</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment><![CDATA[Wanneer ingeschakeld worden de requests gelogd in het bestand /response-file/response.csv]]></comment>
48
+ </login>
49
+ <action translate="label">
50
+ <label>Action: </label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>20</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </action>
57
+ <connector translate="label">
58
+ <label>Connector: </label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>30</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment><![CDATA[Code voor de webshop (verkregen vanuit The Feedback Company)]]></comment>
65
+ </connector>
66
+ <delay translate="label">
67
+ <label>Delay: </label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>
70
+ feedback/config_delay
71
+ </source_model>
72
+ <sort_order>40</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <comment><![CDATA[Aantal dagen na nu waarop uitnodiging moet worden verstuurd.]]></comment>
77
+ </delay>
78
+ <remindDelay translate="label">
79
+ <label>Remind Delay: </label>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>
82
+ feedback/config_reminddelay
83
+ </source_model>
84
+ <sort_order>50</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <comment><![CDATA[Aantal dagen na nu waarop een herinnering moet worden verstuurd indien de klant nog geen review heeft ingevuld.
89
+ De waarde moet ten minste groter zijn dan ‘delay’, of 0 voor geen herinnering.]]></comment>
90
+ </remindDelay>
91
+ <resendIfDouble translate="label">
92
+ <label>Resend If Double: </label>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>
95
+ adminhtml/system_config_source_yesno
96
+ </source_model>
97
+ <sort_order>60</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ <comment><![CDATA[Geeft aan of een uitnodiging moet worden verstuurd indien het een klant betreft die reeds voor een eerdere bestelling al een uitnodiging heeft ontvangen.]]></comment>
102
+ </resendIfDouble>
103
+ <!--<menustyle translate="label">
104
+ <label>Menu Style: </label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>
107
+ feedback/config_style
108
+ </source_model>
109
+ <sort_order>30</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ </menustyle>-->
114
+ </fields>
115
+ </feedback_config>
116
+ <!--<info translate="label">
117
+ <label>Info</label>
118
+ <frontend_type>text</frontend_type>
119
+ <frontend_model>feedback/info</frontend_model>
120
+ <sort_order>30</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </info> -->
125
+ </groups>
126
+ </feedback>
127
+ </sections>
128
+ </config>
129
+
130
+
app/code/local/Feedback/Request/sql/feedback_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->setConfigData('feedback/feedback_config/enabled',1);
5
+ $installer->setConfigData('feedback/feedback_config/login',0);
6
+ $installer->setConfigData('feedback/feedback_config/action','sendInvitation');
7
+ $installer->setConfigData('feedback/feedback_config/connector','');
8
+ $installer->setConfigData('feedback/feedback_config/delay','7');
9
+ $installer->setConfigData('feedback/feedback_config/remindDelay','0');
10
+ $installer->setConfigData('feedback/feedback_config/resendIfDouble',1);
11
+ $installer->endSetup();
app/etc/modules/Feedback_Request.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Feedback_Request>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Feedback_Request>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>feedback_company_feedback_request</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Link your webshop to the Feeback Company</summary>
10
+ <description>Link your webshop to the Feeback Company</description>
11
+ <notes>First public release</notes>
12
+ <authors><author><name>Professionele-webshop.nl</name><user>auto-converted</user><email>info@professionele-webshop.nl</email></author></authors>
13
+ <date>2011-08-12</date>
14
+ <time>07:47:16</time>
15
+ <contents><target name="magelocal"><dir name="Feedback"><dir name="Request"><dir name="Block"><file name="Feedback.php" hash="b78185d8383b19d1885e01fc231ec6ff"/><file name="Info.php" hash="3c15ea9b599c30a9612dd928053b697a"/></dir><dir name="controllers"><file name="OnepageController.php" hash="7e6eb140221703040e7f601805263528"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c82b463291038c251bda13760a8154c0"/><file name="config.xml" hash="b999154c41c67476182ab6165ae59899"/><file name="system.xml" hash="eabc64d083b2920569d1265204c88158"/></dir><dir name="Helper"><file name="Data.php" hash="451ca69fd2a27e9bb148f276ccd773e4"/></dir><dir name="Model"><dir name="Config"><file name="Delay.php" hash="875c57cb9118efd16dd86d236facc4b4"/><file name="Reminddelay.php" hash="12b85673bfcfe5380c473b1a048477db"/></dir></dir><dir name="sql"><dir name="feedback_setup"><file name="mysql4-install-0.1.0.php" hash="4a26c4df1ec0fec41b63549e6941a54a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Feedback_Request.xml" hash="ba26a80006c5c4da395c8f7faad91812"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>