Netgo_Gwishlist - Version 1.0.0

Version Notes

First Preview Release

Download this release

Release Info

Developer NetGo
Extension Netgo_Gwishlist
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (31) hide show
  1. User_Manual.pdf +0 -0
  2. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist.php +42 -0
  3. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit.php +82 -0
  4. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Form.php +52 -0
  5. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tab/Form.php +117 -0
  6. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tab/Stores.php +58 -0
  7. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tabs.php +87 -0
  8. app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Grid.php +267 -0
  9. app/code/community/Netgo/Gwishlist/Block/Customer/Account/Navigation.php +31 -0
  10. app/code/community/Netgo/Gwishlist/Block/Gwishlist/Links.php +60 -0
  11. app/code/community/Netgo/Gwishlist/Block/Gwishlist/List.php +73 -0
  12. app/code/community/Netgo/Gwishlist/Controller/Adminhtml/Gwishlist.php +60 -0
  13. app/code/community/Netgo/Gwishlist/Helper/Data.php +68 -0
  14. app/code/community/Netgo/Gwishlist/Helper/Gwishlist.php +59 -0
  15. app/code/community/Netgo/Gwishlist/Model/Gwishlist.php +104 -0
  16. app/code/community/Netgo/Gwishlist/Model/Observer.php +81 -0
  17. app/code/community/Netgo/Gwishlist/Model/Resource/Gwishlist.php +133 -0
  18. app/code/community/Netgo/Gwishlist/Model/Resource/Gwishlist/Collection.php +136 -0
  19. app/code/community/Netgo/Gwishlist/Model/Resource/Setup.php +26 -0
  20. app/code/community/Netgo/Gwishlist/controllers/Adminhtml/Gwishlist/GwishlistController.php +328 -0
  21. app/code/community/Netgo/Gwishlist/controllers/GwishlistController.php +476 -0
  22. app/code/community/Netgo/Gwishlist/etc/adminhtml.xml +61 -0
  23. app/code/community/Netgo/Gwishlist/etc/config.xml +140 -0
  24. app/code/community/Netgo/Gwishlist/etc/system.xml +68 -0
  25. app/code/community/Netgo/Gwishlist/sql/netgo_gwishlist_setup/install-1.0.0.php +140 -0
  26. app/design/frontend/base/default/layout/netgo_gwishlist.xml +55 -0
  27. app/design/frontend/base/default/template/netgo_gwishlist/gwishlist/addtogwishlist.phtml +67 -0
  28. app/design/frontend/base/default/template/netgo_gwishlist/gwishlist/list.phtml +116 -0
  29. app/etc/modules/Netgo_Gwishlist.xml +29 -0
  30. package.xml +25 -0
  31. readme.txt +26 -0
User_Manual.pdf ADDED
Binary file
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist admin block
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author NetGo
32
+ */
33
+ public function __construct()
34
+ {
35
+ $this->_controller = 'adminhtml_gwishlist';
36
+ $this->_blockGroup = 'netgo_gwishlist';
37
+ parent::__construct();
38
+ $this->_headerText = Mage::helper('netgo_gwishlist')->__('Gwishlist');
39
+ $this->_updateButton('add', 'label', Mage::helper('netgo_gwishlist')->__('Add Gwishlist'));
40
+
41
+ }
42
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist admin edit form
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @return void
31
+ * @author NetGo
32
+ */
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_blockGroup = 'netgo_gwishlist';
37
+ $this->_controller = 'adminhtml_gwishlist';
38
+ $this->_updateButton(
39
+ 'save',
40
+ 'label',
41
+ Mage::helper('netgo_gwishlist')->__('Save Gwishlist')
42
+ );
43
+ $this->_updateButton(
44
+ 'delete',
45
+ 'label',
46
+ Mage::helper('netgo_gwishlist')->__('Delete Gwishlist')
47
+ );
48
+ $this->_addButton(
49
+ 'saveandcontinue',
50
+ array(
51
+ 'label' => Mage::helper('netgo_gwishlist')->__('Save And Continue Edit'),
52
+ 'onclick' => 'saveAndContinueEdit()',
53
+ 'class' => 'save',
54
+ ),
55
+ -100
56
+ );
57
+ $this->_formScripts[] = "
58
+ function saveAndContinueEdit() {
59
+ editForm.submit($('edit_form').action+'back/edit/');
60
+ }
61
+ ";
62
+ }
63
+
64
+ /**
65
+ * get the edit form header
66
+ *
67
+ * @access public
68
+ * @return string
69
+ * @author NetGo
70
+ */
71
+ public function getHeaderText()
72
+ {
73
+ if (Mage::registry('current_gwishlist') && Mage::registry('current_gwishlist')->getId()) {
74
+ return Mage::helper('netgo_gwishlist')->__(
75
+ "Edit Gwishlist '%s'",
76
+ $this->escapeHtml(Mage::registry('current_gwishlist')->getGwishlistData())
77
+ );
78
+ } else {
79
+ return Mage::helper('netgo_gwishlist')->__('Add Gwishlist');
80
+ }
81
+ }
82
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Form.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist edit form
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare form
28
+ *
29
+ * @access protected
30
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Form
31
+ * @author NetGo
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form(
36
+ array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl(
39
+ '*/*/save',
40
+ array(
41
+ 'id' => $this->getRequest()->getParam('id')
42
+ )
43
+ ),
44
+ 'method' => 'post',
45
+ 'enctype' => 'multipart/form-data'
46
+ )
47
+ );
48
+ $form->setUseContainer(true);
49
+ $this->setForm($form);
50
+ return parent::_prepareForm();
51
+ }
52
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tab/Form.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist edit form tab
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tab_Form
31
+ * @author NetGo
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setHtmlIdPrefix('gwishlist_');
37
+ $form->setFieldNameSuffix('gwishlist');
38
+ $this->setForm($form);
39
+ $fieldset = $form->addFieldset(
40
+ 'gwishlist_form',
41
+ array('legend' => Mage::helper('netgo_gwishlist')->__('Gwishlist'))
42
+ );
43
+
44
+ $fieldset->addField(
45
+ 'product_id',
46
+ 'text',
47
+ array(
48
+ 'label' => Mage::helper('netgo_gwishlist')->__('Product ID'),
49
+ 'name' => 'product_id',
50
+ 'required' => true,
51
+ 'class' => 'required-entry',
52
+
53
+ )
54
+ );
55
+
56
+ $fieldset->addField(
57
+ 'gwishlist_data',
58
+ 'text',
59
+ array(
60
+ 'label' => Mage::helper('netgo_gwishlist')->__('Data'),
61
+ 'name' => 'gwishlist_data',
62
+
63
+ )
64
+ );
65
+
66
+ $fieldset->addField(
67
+ 'guest_ip',
68
+ 'text',
69
+ array(
70
+ 'label' => Mage::helper('netgo_gwishlist')->__('Guest IP'),
71
+ 'name' => 'guest_ip',
72
+
73
+ )
74
+ );
75
+ $fieldset->addField(
76
+ 'status',
77
+ 'select',
78
+ array(
79
+ 'label' => Mage::helper('netgo_gwishlist')->__('Status'),
80
+ 'name' => 'status',
81
+ 'values' => array(
82
+ array(
83
+ 'value' => 1,
84
+ 'label' => Mage::helper('netgo_gwishlist')->__('Enabled'),
85
+ ),
86
+ array(
87
+ 'value' => 0,
88
+ 'label' => Mage::helper('netgo_gwishlist')->__('Disabled'),
89
+ ),
90
+ ),
91
+ )
92
+ );
93
+ if (Mage::app()->isSingleStoreMode()) {
94
+ $fieldset->addField(
95
+ 'store_id',
96
+ 'hidden',
97
+ array(
98
+ 'name' => 'stores[]',
99
+ 'value' => Mage::app()->getStore(true)->getId()
100
+ )
101
+ );
102
+ Mage::registry('current_gwishlist')->setStoreId(Mage::app()->getStore(true)->getId());
103
+ }
104
+ $formValues = Mage::registry('current_gwishlist')->getDefaultValues();
105
+ if (!is_array($formValues)) {
106
+ $formValues = array();
107
+ }
108
+ if (Mage::getSingleton('adminhtml/session')->getGwishlistData()) {
109
+ $formValues = array_merge($formValues, Mage::getSingleton('adminhtml/session')->getGwishlistData());
110
+ Mage::getSingleton('adminhtml/session')->setGwishlistData(null);
111
+ } elseif (Mage::registry('current_gwishlist')) {
112
+ $formValues = array_merge($formValues, Mage::registry('current_gwishlist')->getData());
113
+ }
114
+ $form->setValues($formValues);
115
+ return parent::_prepareForm();
116
+ }
117
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tab/Stores.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * store selection tab
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tab_Stores extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * prepare the form
28
+ *
29
+ * @access protected
30
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tab_Stores
31
+ * @author NetGo
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $form = new Varien_Data_Form();
36
+ $form->setFieldNameSuffix('gwishlist');
37
+ $this->setForm($form);
38
+ $fieldset = $form->addFieldset(
39
+ 'gwishlist_stores_form',
40
+ array('legend' => Mage::helper('netgo_gwishlist')->__('Store views'))
41
+ );
42
+ $field = $fieldset->addField(
43
+ 'store_id',
44
+ 'multiselect',
45
+ array(
46
+ 'name' => 'stores[]',
47
+ 'label' => Mage::helper('netgo_gwishlist')->__('Store Views'),
48
+ 'title' => Mage::helper('netgo_gwishlist')->__('Store Views'),
49
+ 'required' => true,
50
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
51
+ )
52
+ );
53
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
54
+ $field->setRenderer($renderer);
55
+ $form->addValues(Mage::registry('current_gwishlist')->getData());
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Edit/Tabs.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist admin edit tabs
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
+ {
26
+ /**
27
+ * Initialize Tabs
28
+ *
29
+ * @access public
30
+ * @author NetGo
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('gwishlist_tabs');
36
+ $this->setDestElementId('edit_form');
37
+ $this->setTitle(Mage::helper('netgo_gwishlist')->__('Gwishlist'));
38
+ }
39
+
40
+ /**
41
+ * before render html
42
+ *
43
+ * @access protected
44
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Edit_Tabs
45
+ * @author NetGo
46
+ */
47
+ protected function _beforeToHtml()
48
+ {
49
+ $this->addTab(
50
+ 'form_gwishlist',
51
+ array(
52
+ 'label' => Mage::helper('netgo_gwishlist')->__('Gwishlist'),
53
+ 'title' => Mage::helper('netgo_gwishlist')->__('Gwishlist'),
54
+ 'content' => $this->getLayout()->createBlock(
55
+ 'netgo_gwishlist/adminhtml_gwishlist_edit_tab_form'
56
+ )
57
+ ->toHtml(),
58
+ )
59
+ );
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addTab(
62
+ 'form_store_gwishlist',
63
+ array(
64
+ 'label' => Mage::helper('netgo_gwishlist')->__('Store views'),
65
+ 'title' => Mage::helper('netgo_gwishlist')->__('Store views'),
66
+ 'content' => $this->getLayout()->createBlock(
67
+ 'netgo_gwishlist/adminhtml_gwishlist_edit_tab_stores'
68
+ )
69
+ ->toHtml(),
70
+ )
71
+ );
72
+ }
73
+ return parent::_beforeToHtml();
74
+ }
75
+
76
+ /**
77
+ * Retrieve gwishlist entity
78
+ *
79
+ * @access public
80
+ * @return Netgo_Gwishlist_Model_Gwishlist
81
+ * @author NetGo
82
+ */
83
+ public function getGwishlist()
84
+ {
85
+ return Mage::registry('current_gwishlist');
86
+ }
87
+ }
app/code/community/Netgo/Gwishlist/Block/Adminhtml/Gwishlist/Grid.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist admin grid block
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+ /**
27
+ * constructor
28
+ *
29
+ * @access public
30
+ * @author NetGo
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $this->setId('gwishlistGrid');
36
+ $this->setDefaultSort('entity_id');
37
+ $this->setDefaultDir('ASC');
38
+ $this->setSaveParametersInSession(true);
39
+ $this->setUseAjax(true);
40
+ }
41
+
42
+ /**
43
+ * prepare collection
44
+ *
45
+ * @access protected
46
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid
47
+ * @author NetGo
48
+ */
49
+ protected function _prepareCollection()
50
+ {
51
+ $collection = Mage::getModel('netgo_gwishlist/gwishlist')
52
+ ->getCollection();
53
+
54
+ $this->setCollection($collection);
55
+ return parent::_prepareCollection();
56
+ }
57
+
58
+ /**
59
+ * prepare grid collection
60
+ *
61
+ * @access protected
62
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid
63
+ * @author NetGo
64
+ */
65
+ protected function _prepareColumns()
66
+ {
67
+ $this->addColumn(
68
+ 'entity_id',
69
+ array(
70
+ 'header' => Mage::helper('netgo_gwishlist')->__('Id'),
71
+ 'index' => 'entity_id',
72
+ 'type' => 'number'
73
+ )
74
+ );
75
+ $this->addColumn(
76
+ 'gwishlist_data',
77
+ array(
78
+ 'header' => Mage::helper('netgo_gwishlist')->__('Data'),
79
+ 'align' => 'left',
80
+ 'index' => 'gwishlist_data',
81
+ )
82
+ );
83
+
84
+ $this->addColumn(
85
+ 'status',
86
+ array(
87
+ 'header' => Mage::helper('netgo_gwishlist')->__('Status'),
88
+ 'index' => 'status',
89
+ 'type' => 'options',
90
+ 'options' => array(
91
+ '1' => Mage::helper('netgo_gwishlist')->__('Enabled'),
92
+ '0' => Mage::helper('netgo_gwishlist')->__('Disabled'),
93
+ )
94
+ )
95
+ );
96
+ $this->addColumn(
97
+ 'product_id',
98
+ array(
99
+ 'header' => Mage::helper('netgo_gwishlist')->__('Product ID'),
100
+ 'index' => 'product_id',
101
+ 'type'=> 'text',
102
+
103
+ )
104
+ );
105
+ $this->addColumn(
106
+ 'guest_ip',
107
+ array(
108
+ 'header' => Mage::helper('netgo_gwishlist')->__('Guest IP'),
109
+ 'index' => 'guest_ip',
110
+ 'type'=> 'text',
111
+
112
+ )
113
+ );
114
+ if (!Mage::app()->isSingleStoreMode() && !$this->_isExport) {
115
+ $this->addColumn(
116
+ 'store_id',
117
+ array(
118
+ 'header' => Mage::helper('netgo_gwishlist')->__('Store Views'),
119
+ 'index' => 'store_id',
120
+ 'type' => 'store',
121
+ 'store_all' => true,
122
+ 'store_view' => true,
123
+ 'sortable' => false,
124
+ 'filter_condition_callback'=> array($this, '_filterStoreCondition'),
125
+ )
126
+ );
127
+ }
128
+ $this->addColumn(
129
+ 'created_at',
130
+ array(
131
+ 'header' => Mage::helper('netgo_gwishlist')->__('Created at'),
132
+ 'index' => 'created_at',
133
+ 'width' => '120px',
134
+ 'type' => 'datetime',
135
+ )
136
+ );
137
+ $this->addColumn(
138
+ 'updated_at',
139
+ array(
140
+ 'header' => Mage::helper('netgo_gwishlist')->__('Updated at'),
141
+ 'index' => 'updated_at',
142
+ 'width' => '120px',
143
+ 'type' => 'datetime',
144
+ )
145
+ );
146
+ $this->addColumn(
147
+ 'action',
148
+ array(
149
+ 'header' => Mage::helper('netgo_gwishlist')->__('Action'),
150
+ 'width' => '100',
151
+ 'type' => 'action',
152
+ 'getter' => 'getId',
153
+ 'actions' => array(
154
+ array(
155
+ 'caption' => Mage::helper('netgo_gwishlist')->__('Edit'),
156
+ 'url' => array('base'=> '*/*/edit'),
157
+ 'field' => 'id'
158
+ )
159
+ ),
160
+ 'filter' => false,
161
+ 'is_system' => true,
162
+ 'sortable' => false,
163
+ )
164
+ );
165
+ $this->addExportType('*/*/exportCsv', Mage::helper('netgo_gwishlist')->__('CSV'));
166
+ $this->addExportType('*/*/exportExcel', Mage::helper('netgo_gwishlist')->__('Excel'));
167
+ $this->addExportType('*/*/exportXml', Mage::helper('netgo_gwishlist')->__('XML'));
168
+ return parent::_prepareColumns();
169
+ }
170
+
171
+ /**
172
+ * prepare mass action
173
+ *
174
+ * @access protected
175
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid
176
+ * @author NetGo
177
+ */
178
+ protected function _prepareMassaction()
179
+ {
180
+ $this->setMassactionIdField('entity_id');
181
+ $this->getMassactionBlock()->setFormFieldName('gwishlist');
182
+ $this->getMassactionBlock()->addItem(
183
+ 'delete',
184
+ array(
185
+ 'label'=> Mage::helper('netgo_gwishlist')->__('Delete'),
186
+ 'url' => $this->getUrl('*/*/massDelete'),
187
+ 'confirm' => Mage::helper('netgo_gwishlist')->__('Are you sure?')
188
+ )
189
+ );
190
+ $this->getMassactionBlock()->addItem(
191
+ 'status',
192
+ array(
193
+ 'label' => Mage::helper('netgo_gwishlist')->__('Change status'),
194
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
195
+ 'additional' => array(
196
+ 'status' => array(
197
+ 'name' => 'status',
198
+ 'type' => 'select',
199
+ 'class' => 'required-entry',
200
+ 'label' => Mage::helper('netgo_gwishlist')->__('Status'),
201
+ 'values' => array(
202
+ '1' => Mage::helper('netgo_gwishlist')->__('Enabled'),
203
+ '0' => Mage::helper('netgo_gwishlist')->__('Disabled'),
204
+ )
205
+ )
206
+ )
207
+ )
208
+ );
209
+ return $this;
210
+ }
211
+
212
+ /**
213
+ * get the row url
214
+ *
215
+ * @access public
216
+ * @param Netgo_Gwishlist_Model_Gwishlist
217
+ * @return string
218
+ * @author NetGo
219
+ */
220
+ public function getRowUrl($row)
221
+ {
222
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
223
+ }
224
+
225
+ /**
226
+ * get the grid url
227
+ *
228
+ * @access public
229
+ * @return string
230
+ * @author NetGo
231
+ */
232
+ public function getGridUrl()
233
+ {
234
+ return $this->getUrl('*/*/grid', array('_current'=>true));
235
+ }
236
+
237
+ /**
238
+ * after collection load
239
+ *
240
+ * @access protected
241
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid
242
+ * @author NetGo
243
+ */
244
+ protected function _afterLoadCollection()
245
+ {
246
+ $this->getCollection()->walk('afterLoad');
247
+ parent::_afterLoadCollection();
248
+ }
249
+
250
+ /**
251
+ * filter store column
252
+ *
253
+ * @access protected
254
+ * @param Netgo_Gwishlist_Model_Resource_Gwishlist_Collection $collection
255
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
256
+ * @return Netgo_Gwishlist_Block_Adminhtml_Gwishlist_Grid
257
+ * @author NetGo
258
+ */
259
+ protected function _filterStoreCondition($collection, $column)
260
+ {
261
+ if (!$value = $column->getFilter()->getValue()) {
262
+ return;
263
+ }
264
+ $collection->addStoreFilter($value);
265
+ return $this;
266
+ }
267
+ }
app/code/community/Netgo/Gwishlist/Block/Customer/Account/Navigation.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist front contrller
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ //class Netgo_Gwishlist_GwishlistController extends Mage_Core_Controller_Front_Action
25
+ class Netgo_Gwishlist_Block_Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation
26
+ {
27
+ public function removeLinkByName($name) {
28
+ die('comes');
29
+ unset($this->_links[$name]);
30
+ }
31
+ }
app/code/community/Netgo/Gwishlist/Block/Gwishlist/Links.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class Netgo_Gwishlist_Block_Gwishlist_Links extends Mage_Core_Block_Template
18
+ {
19
+
20
+ public function addGwishlistLink()
21
+ {
22
+ $parentBlock = $this->getParentBlock();
23
+
24
+ if(!Mage::getSingleton('customer/session')->isLoggedIn()){
25
+
26
+ $parentBlock->removeLinkBlock('wishlist_link');
27
+
28
+
29
+
30
+ $data = unserialize($_COOKIE['gwishlist']);
31
+
32
+ if( $data=='')
33
+ {
34
+ $count=0;
35
+ }else
36
+ {
37
+ $count=count($data) ;
38
+ }
39
+ if ($count == 1) {
40
+ $text = $this->__('My Wishlist (%s item)', $count);
41
+ } elseif ($count > 0) {
42
+ $text = $this->__('My Wishlist(%s items)', $count);
43
+ } else {
44
+ $text = $this->__('My Wishlist');
45
+ }
46
+
47
+
48
+ $parentBlock->addLink($text, 'netgo_gwishlist/gwishlist', $text, true, array(), 11, null, 'class="top-link-gwlnk"');
49
+
50
+
51
+ }
52
+
53
+
54
+
55
+
56
+ return $this;
57
+ }
58
+
59
+
60
+ }
app/code/community/Netgo/Gwishlist/Block/Gwishlist/List.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist list block
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Block_Gwishlist_List extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * initialize
28
+ *
29
+ * @access public
30
+ * @author NetGo
31
+ */
32
+ public function __construct()
33
+ {
34
+ parent::__construct();
35
+ $gwishlists = Mage::getResourceModel('netgo_gwishlist/gwishlist_collection')
36
+ ->addStoreFilter(Mage::app()->getStore())
37
+ ->addFieldToFilter('status', 1);
38
+ $gwishlists->setOrder('gwishlist_data', 'asc');
39
+ $this->setGwishlists($gwishlists);
40
+ }
41
+
42
+ /**
43
+ * prepare the layout
44
+ *
45
+ * @access protected
46
+ * @return Netgo_Gwishlist_Block_Gwishlist_List
47
+ * @author NetGo
48
+ */
49
+ protected function _prepareLayout()
50
+ {
51
+ parent::_prepareLayout();
52
+ $pager = $this->getLayout()->createBlock(
53
+ 'page/html_pager',
54
+ 'netgo_gwishlist.gwishlist.html.pager'
55
+ )
56
+ ->setCollection($this->getGwishlists());
57
+ $this->setChild('pager', $pager);
58
+ $this->getGwishlists()->load();
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * get the pager html
64
+ *
65
+ * @access public
66
+ * @return string
67
+ * @author NetGo
68
+ */
69
+ public function getPagerHtml()
70
+ {
71
+ return $this->getChildHtml('pager');
72
+ }
73
+ }
app/code/community/Netgo/Gwishlist/Controller/Adminhtml/Gwishlist.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * module base admin controller
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Controller_Adminhtml_Gwishlist extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * upload file and get the uploaded name
28
+ *
29
+ * @access public
30
+ * @param string $input
31
+ * @param string $destinationFolder
32
+ * @param array $data
33
+ * @return string
34
+ * @author NetGo
35
+ */
36
+ protected function _uploadAndGetName($input, $destinationFolder, $data)
37
+ {
38
+ try {
39
+ if (isset($data[$input]['delete'])) {
40
+ return '';
41
+ } else {
42
+ $uploader = new Varien_File_Uploader($input);
43
+ $uploader->setAllowRenameFiles(true);
44
+ $uploader->setFilesDispersion(true);
45
+ $uploader->setAllowCreateFolders(true);
46
+ $result = $uploader->save($destinationFolder);
47
+ return $result['file'];
48
+ }
49
+ } catch (Exception $e) {
50
+ if ($e->getCode() != Varien_File_Uploader::TMP_NAME_EMPTY) {
51
+ throw $e;
52
+ } else {
53
+ if (isset($data[$input]['value'])) {
54
+ return $data[$input]['value'];
55
+ }
56
+ }
57
+ }
58
+ return '';
59
+ }
60
+ }
app/code/community/Netgo/Gwishlist/Helper/Data.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist default helper
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ /**
27
+ * convert array to options
28
+ *
29
+ * @access public
30
+ * @param $options
31
+ * @return array
32
+ * @author NetGo
33
+ */
34
+
35
+
36
+ public function convertOptions($options)
37
+ {
38
+ $converted = array();
39
+ foreach ($options as $option) {
40
+ if (isset($option['value']) && !is_array($option['value']) &&
41
+ isset($option['label']) && !is_array($option['label'])) {
42
+ $converted[$option['value']] = $option['label'];
43
+ }
44
+ }
45
+ return $converted;
46
+ }
47
+
48
+ public function getUrl($product)
49
+ {
50
+ $whlsturl='';
51
+ if(Mage::getStoreConfig('netgo_gwishlist/gwishlist/enable')==1)
52
+ {
53
+ if(!Mage::getSingleton('customer/session')->isLoggedIn()):
54
+
55
+ $whislisturl=Mage::getBaseUrl().'gwishlist/gwishlist/add/product/'.$product->getId();
56
+ $whlsturl= '<li><a href="'.$whislisturl.'" class="link-wishlist">Add to Wishlist</a></li>';
57
+ else:
58
+ if (Mage::helper('wishlist')->isAllow()) :
59
+
60
+ $whislisturl = Mage::helper('wishlist')->getAddUrl($product);
61
+ $whlsturl= '<li><a href="'.$whislisturl.'" class="link-wishlist">Add to Wishlist</a></li>';
62
+ endif;
63
+ endif;
64
+
65
+ }
66
+ return $whlsturl;
67
+ }
68
+ }
app/code/community/Netgo/Gwishlist/Helper/Gwishlist.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist helper
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Helper_Gwishlist extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+ /**
28
+ * get the url to the gwishlists list page
29
+ *
30
+ * @access public
31
+ * @return string
32
+ * @author NetGo
33
+ */
34
+ public function getGwishlistsUrl()
35
+ {
36
+ if ($listKey = Mage::getStoreConfig('netgo_gwishlist/gwishlist/url_rewrite_list')) {
37
+ return Mage::getUrl('', array('_direct'=>$listKey));
38
+ }
39
+ return Mage::getUrl('netgo_gwishlist/gwishlist/index');
40
+ }
41
+
42
+ public function checkGwishlists()
43
+ {
44
+ die('ram');
45
+ return 0;
46
+ }
47
+
48
+ /**
49
+ * check if breadcrumbs can be used
50
+ *
51
+ * @access public
52
+ * @return bool
53
+ * @author NetGo
54
+ */
55
+ public function getUseBreadcrumbs()
56
+ {
57
+ return Mage::getStoreConfigFlag('netgo_gwishlist/gwishlist/breadcrumbs');
58
+ }
59
+ }
app/code/community/Netgo/Gwishlist/Model/Gwishlist.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist model
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Model_Gwishlist extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Entity code.
28
+ * Can be used as part of method name for entity processing
29
+ */
30
+ const ENTITY = 'netgo_gwishlist_gwishlist';
31
+ const CACHE_TAG = 'netgo_gwishlist_gwishlist';
32
+
33
+ /**
34
+ * Prefix of model events names
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_eventPrefix = 'netgo_gwishlist_gwishlist';
39
+
40
+ /**
41
+ * Parameter name in event
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_eventObject = 'gwishlist';
46
+
47
+ /**
48
+ * constructor
49
+ *
50
+ * @access public
51
+ * @return void
52
+ * @author NetGo
53
+ */
54
+ public function _construct()
55
+ {
56
+ parent::_construct();
57
+ $this->_init('netgo_gwishlist/gwishlist');
58
+ }
59
+
60
+ /**
61
+ * before save gwishlist
62
+ *
63
+ * @access protected
64
+ * @return Netgo_Gwishlist_Model_Gwishlist
65
+ * @author NetGo
66
+ */
67
+ protected function _beforeSave()
68
+ {
69
+ parent::_beforeSave();
70
+ $now = Mage::getSingleton('core/date')->gmtDate();
71
+ if ($this->isObjectNew()) {
72
+ $this->setCreatedAt($now);
73
+ }
74
+ $this->setUpdatedAt($now);
75
+ return $this;
76
+ }
77
+
78
+ /**
79
+ * save gwishlist relation
80
+ *
81
+ * @access public
82
+ * @return Netgo_Gwishlist_Model_Gwishlist
83
+ * @author NetGo
84
+ */
85
+ protected function _afterSave()
86
+ {
87
+ return parent::_afterSave();
88
+ }
89
+
90
+ /**
91
+ * get default values
92
+ *
93
+ * @access public
94
+ * @return array
95
+ * @author NetGo
96
+ */
97
+ public function getDefaultValues()
98
+ {
99
+ $values = array();
100
+ $values['status'] = 1;
101
+ return $values;
102
+ }
103
+
104
+ }
app/code/community/Netgo/Gwishlist/Model/Observer.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist model
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author Netgo
23
+ */
24
+
25
+
26
+ class Netgo_Gwishlist_Model_Observer{
27
+
28
+ public function addCustomerWishlist(Varien_Event_Observer $observer){
29
+ $customer = $observer->getEvent()->getData();
30
+ $customerId = $customer['customer']->getEntityId();
31
+
32
+ $predata=$data = unserialize($_COOKIE['gwishlist']);
33
+ $wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true);
34
+ Mage::register('wishlist', $wishlist);
35
+
36
+ if($data!='')
37
+ {
38
+ foreach($data as $gwishlistProdcut)
39
+ {
40
+ $productId=$gwishlistProdcut['product_id'];
41
+ $prodcutOption=unserialize($gwishlistProdcut['options']);
42
+
43
+
44
+
45
+ try {
46
+ $product = Mage::getModel('catalog/product')->load($productId);
47
+
48
+ $buyRequest = new Varien_Object($prodcutOption);
49
+
50
+ $result = $wishlist->addNewItem($product, $buyRequest);
51
+ $wishlist->save();
52
+
53
+ Mage::dispatchEvent(
54
+ 'wishlist_add_product',
55
+ array(
56
+ 'wishlist' => $wishlist,
57
+ 'product' => $product,
58
+ 'item' => $result
59
+ )
60
+ );
61
+
62
+ Mage::helper('wishlist')->calculate();
63
+
64
+
65
+
66
+
67
+ } catch (Mage_Core_Exception $e) {
68
+ Mage::getSingleton('core/session')->addError($e->getMessage());
69
+
70
+ }
71
+ catch (Exception $e) {
72
+ Mage::getSingleton('core/session')->addError($e->getMessage());
73
+
74
+ }
75
+ }
76
+ Mage::getSingleton('core/session')->addSuccess('Items moved in wishlist');
77
+ setcookie("gwishlist",serialize($predata),time()-1, "/");
78
+ }
79
+
80
+ }
81
+ }
app/code/community/Netgo/Gwishlist/Model/Resource/Gwishlist.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist resource model
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Model_Resource_Gwishlist extends Mage_Core_Model_Resource_Db_Abstract
25
+ {
26
+
27
+ /**
28
+ * constructor
29
+ *
30
+ * @access public
31
+ * @author NetGo
32
+ */
33
+ public function _construct()
34
+ {
35
+ $this->_init('netgo_gwishlist/gwishlist', 'entity_id');
36
+ }
37
+
38
+ /**
39
+ * Get store ids to which specified item is assigned
40
+ *
41
+ * @access public
42
+ * @param int $gwishlistId
43
+ * @return array
44
+ * @author NetGo
45
+ */
46
+ public function lookupStoreIds($gwishlistId)
47
+ {
48
+ $adapter = $this->_getReadAdapter();
49
+ $select = $adapter->select()
50
+ ->from($this->getTable('netgo_gwishlist/gwishlist_store'), 'store_id')
51
+ ->where('gwishlist_id = ?', (int)$gwishlistId);
52
+ return $adapter->fetchCol($select);
53
+ }
54
+
55
+ /**
56
+ * Perform operations after object load
57
+ *
58
+ * @access public
59
+ * @param Mage_Core_Model_Abstract $object
60
+ * @return Netgo_Gwishlist_Model_Resource_Gwishlist
61
+ * @author NetGo
62
+ */
63
+ protected function _afterLoad(Mage_Core_Model_Abstract $object)
64
+ {
65
+ if ($object->getId()) {
66
+ $stores = $this->lookupStoreIds($object->getId());
67
+ $object->setData('store_id', $stores);
68
+ }
69
+ return parent::_afterLoad($object);
70
+ }
71
+
72
+ /**
73
+ * Retrieve select object for load object data
74
+ *
75
+ * @param string $field
76
+ * @param mixed $value
77
+ * @param Netgo_Gwishlist_Model_Gwishlist $object
78
+ * @return Zend_Db_Select
79
+ */
80
+ protected function _getLoadSelect($field, $value, $object)
81
+ {
82
+ $select = parent::_getLoadSelect($field, $value, $object);
83
+ if ($object->getStoreId()) {
84
+ $storeIds = array(Mage_Core_Model_App::ADMIN_STORE_ID, (int)$object->getStoreId());
85
+ $select->join(
86
+ array('gwishlist_gwishlist_store' => $this->getTable('netgo_gwishlist/gwishlist_store')),
87
+ $this->getMainTable() . '.entity_id = gwishlist_gwishlist_store.gwishlist_id',
88
+ array()
89
+ )
90
+ ->where('gwishlist_gwishlist_store.store_id IN (?)', $storeIds)
91
+ ->order('gwishlist_gwishlist_store.store_id DESC')
92
+ ->limit(1);
93
+ }
94
+ return $select;
95
+ }
96
+
97
+ /**
98
+ * Assign gwishlist to store views
99
+ *
100
+ * @access protected
101
+ * @param Mage_Core_Model_Abstract $object
102
+ * @return Netgo_Gwishlist_Model_Resource_Gwishlist
103
+ * @author NetGo
104
+ */
105
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
106
+ {
107
+ $oldStores = $this->lookupStoreIds($object->getId());
108
+ $newStores = (array)$object->getStores();
109
+ if (empty($newStores)) {
110
+ $newStores = (array)$object->getStoreId();
111
+ }
112
+ $table = $this->getTable('netgo_gwishlist/gwishlist_store');
113
+ $insert = array_diff($newStores, $oldStores);
114
+ $delete = array_diff($oldStores, $newStores);
115
+ if ($delete) {
116
+ $where = array(
117
+ 'gwishlist_id = ?' => (int) $object->getId(),
118
+ 'store_id IN (?)' => $delete
119
+ );
120
+ $this->_getWriteAdapter()->delete($table, $where);
121
+ }
122
+ if ($insert) {
123
+ $data = array();
124
+ foreach ($insert as $storeId) {
125
+ $data[] = array(
126
+ 'gwishlist_id' => (int) $object->getId(),
127
+ 'store_id' => (int) $storeId
128
+ );
129
+ }
130
+ $this->_getWriteAdapter()->insertMultiple($table, $data);
131
+ }
132
+ return parent::_afterSave($object);
133
+ }}
app/code/community/Netgo/Gwishlist/Model/Resource/Gwishlist/Collection.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist collection resource model
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Model_Resource_Gwishlist_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
+ {
26
+ protected $_joinedFields = array();
27
+
28
+ /**
29
+ * constructor
30
+ *
31
+ * @access public
32
+ * @return void
33
+ * @author NetGo
34
+ */
35
+ protected function _construct()
36
+ {
37
+ parent::_construct();
38
+ $this->_init('netgo_gwishlist/gwishlist');
39
+ $this->_map['fields']['store'] = 'store_table.store_id';
40
+ }
41
+
42
+ /**
43
+ * Add filter by store
44
+ *
45
+ * @access public
46
+ * @param int|Mage_Core_Model_Store $store
47
+ * @param bool $withAdmin
48
+ * @return Netgo_Gwishlist_Model_Resource_Gwishlist_Collection
49
+ * @author NetGo
50
+ */
51
+ public function addStoreFilter($store, $withAdmin = true)
52
+ {
53
+ if (!isset($this->_joinedFields['store'])) {
54
+ if ($store instanceof Mage_Core_Model_Store) {
55
+ $store = array($store->getId());
56
+ }
57
+ if (!is_array($store)) {
58
+ $store = array($store);
59
+ }
60
+ if ($withAdmin) {
61
+ $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
62
+ }
63
+ $this->addFilter('store', array('in' => $store), 'public');
64
+ $this->_joinedFields['store'] = true;
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Join store relation table if there is store filter
71
+ *
72
+ * @access protected
73
+ * @return Netgo_Gwishlist_Model_Resource_Gwishlist_Collection
74
+ * @author NetGo
75
+ */
76
+ protected function _renderFiltersBefore()
77
+ {
78
+ if ($this->getFilter('store')) {
79
+ $this->getSelect()->join(
80
+ array('store_table' => $this->getTable('netgo_gwishlist/gwishlist_store')),
81
+ 'main_table.entity_id = store_table.gwishlist_id',
82
+ array()
83
+ )
84
+ ->group('main_table.entity_id');
85
+ /*
86
+ * Allow analytic functions usage because of one field grouping
87
+ */
88
+ $this->_useAnalyticFunction = true;
89
+ }
90
+ return parent::_renderFiltersBefore();
91
+ }
92
+
93
+ /**
94
+ * get gwishlists as array
95
+ *
96
+ * @access protected
97
+ * @param string $valueField
98
+ * @param string $labelField
99
+ * @param array $additional
100
+ * @return array
101
+ * @author NetGo
102
+ */
103
+ protected function _toOptionArray($valueField='entity_id', $labelField='gwishlist_data', $additional=array())
104
+ {
105
+ return parent::_toOptionArray($valueField, $labelField, $additional);
106
+ }
107
+
108
+ /**
109
+ * get options hash
110
+ *
111
+ * @access protected
112
+ * @param string $valueField
113
+ * @param string $labelField
114
+ * @return array
115
+ * @author NetGo
116
+ */
117
+ protected function _toOptionHash($valueField='entity_id', $labelField='gwishlist_data')
118
+ {
119
+ return parent::_toOptionHash($valueField, $labelField);
120
+ }
121
+
122
+ /**
123
+ * Get SQL for get record count.
124
+ * Extra GROUP BY strip added.
125
+ *
126
+ * @access public
127
+ * @return Varien_Db_Select
128
+ * @author NetGo
129
+ */
130
+ public function getSelectCountSql()
131
+ {
132
+ $countSelect = parent::getSelectCountSql();
133
+ $countSelect->reset(Zend_Db_Select::GROUP);
134
+ return $countSelect;
135
+ }
136
+ }
app/code/community/Netgo/Gwishlist/Model/Resource/Setup.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist setup
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
25
+ {
26
+ }
app/code/community/Netgo/Gwishlist/controllers/Adminhtml/Gwishlist/GwishlistController.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist admin controller
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_Adminhtml_Gwishlist_GwishlistController extends Netgo_Gwishlist_Controller_Adminhtml_Gwishlist
25
+ {
26
+ /**
27
+ * init the gwishlist
28
+ *
29
+ * @access protected
30
+ * @return Netgo_Gwishlist_Model_Gwishlist
31
+ */
32
+ protected function _initGwishlist()
33
+ {
34
+ $gwishlistId = (int) $this->getRequest()->getParam('id');
35
+ $gwishlist = Mage::getModel('netgo_gwishlist/gwishlist');
36
+ if ($gwishlistId) {
37
+ $gwishlist->load($gwishlistId);
38
+ }
39
+ Mage::register('current_gwishlist', $gwishlist);
40
+ return $gwishlist;
41
+ }
42
+
43
+ /**
44
+ * default action
45
+ *
46
+ * @access public
47
+ * @return void
48
+ * @author NetGo
49
+ */
50
+ public function indexAction()
51
+ {
52
+ $this->loadLayout();
53
+ $this->_title(Mage::helper('netgo_gwishlist')->__('Guest Wish List'))
54
+ ->_title(Mage::helper('netgo_gwishlist')->__('Gwishlists'));
55
+ $this->renderLayout();
56
+ }
57
+
58
+ /**
59
+ * grid action
60
+ *
61
+ * @access public
62
+ * @return void
63
+ * @author NetGo
64
+ */
65
+ public function gridAction()
66
+ {
67
+ $this->loadLayout()->renderLayout();
68
+ }
69
+
70
+ /**
71
+ * edit gwishlist - action
72
+ *
73
+ * @access public
74
+ * @return void
75
+ * @author NetGo
76
+ */
77
+ public function editAction()
78
+ {
79
+ $gwishlistId = $this->getRequest()->getParam('id');
80
+ $gwishlist = $this->_initGwishlist();
81
+ if ($gwishlistId && !$gwishlist->getId()) {
82
+ $this->_getSession()->addError(
83
+ Mage::helper('netgo_gwishlist')->__('This gwishlist no longer exists.')
84
+ );
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ $data = Mage::getSingleton('adminhtml/session')->getGwishlistData(true);
89
+ if (!empty($data)) {
90
+ $gwishlist->setData($data);
91
+ }
92
+ Mage::register('gwishlist_data', $gwishlist);
93
+ $this->loadLayout();
94
+ $this->_title(Mage::helper('netgo_gwishlist')->__('Guest Wish List'))
95
+ ->_title(Mage::helper('netgo_gwishlist')->__('Gwishlists'));
96
+ if ($gwishlist->getId()) {
97
+ $this->_title($gwishlist->getGwishlistData());
98
+ } else {
99
+ $this->_title(Mage::helper('netgo_gwishlist')->__('Add gwishlist'));
100
+ }
101
+ if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
102
+ $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
103
+ }
104
+ $this->renderLayout();
105
+ }
106
+
107
+ /**
108
+ * new gwishlist action
109
+ *
110
+ * @access public
111
+ * @return void
112
+ * @author NetGo
113
+ */
114
+ public function newAction()
115
+ {
116
+ $this->_forward('edit');
117
+ }
118
+
119
+ /**
120
+ * save gwishlist - action
121
+ *
122
+ * @access public
123
+ * @return void
124
+ * @author NetGo
125
+ */
126
+ public function saveAction()
127
+ {
128
+ if ($data = $this->getRequest()->getPost('gwishlist')) {
129
+ try {
130
+ $gwishlist = $this->_initGwishlist();
131
+ $gwishlist->addData($data);
132
+ $gwishlist->save();
133
+ Mage::getSingleton('adminhtml/session')->addSuccess(
134
+ Mage::helper('netgo_gwishlist')->__('Gwishlist was successfully saved')
135
+ );
136
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
137
+ if ($this->getRequest()->getParam('back')) {
138
+ $this->_redirect('*/*/edit', array('id' => $gwishlist->getId()));
139
+ return;
140
+ }
141
+ $this->_redirect('*/*/');
142
+ return;
143
+ } catch (Mage_Core_Exception $e) {
144
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
145
+ Mage::getSingleton('adminhtml/session')->setGwishlistData($data);
146
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
147
+ return;
148
+ } catch (Exception $e) {
149
+ Mage::logException($e);
150
+ Mage::getSingleton('adminhtml/session')->addError(
151
+ Mage::helper('netgo_gwishlist')->__('There was a problem saving the gwishlist.')
152
+ );
153
+ Mage::getSingleton('adminhtml/session')->setGwishlistData($data);
154
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
155
+ return;
156
+ }
157
+ }
158
+ Mage::getSingleton('adminhtml/session')->addError(
159
+ Mage::helper('netgo_gwishlist')->__('Unable to find gwishlist to save.')
160
+ );
161
+ $this->_redirect('*/*/');
162
+ }
163
+
164
+ /**
165
+ * delete gwishlist - action
166
+ *
167
+ * @access public
168
+ * @return void
169
+ * @author NetGo
170
+ */
171
+ public function deleteAction()
172
+ {
173
+ if ( $this->getRequest()->getParam('id') > 0) {
174
+ try {
175
+ $gwishlist = Mage::getModel('netgo_gwishlist/gwishlist');
176
+ $gwishlist->setId($this->getRequest()->getParam('id'))->delete();
177
+ Mage::getSingleton('adminhtml/session')->addSuccess(
178
+ Mage::helper('netgo_gwishlist')->__('Gwishlist was successfully deleted.')
179
+ );
180
+ $this->_redirect('*/*/');
181
+ return;
182
+ } catch (Mage_Core_Exception $e) {
183
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
184
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
185
+ } catch (Exception $e) {
186
+ Mage::getSingleton('adminhtml/session')->addError(
187
+ Mage::helper('netgo_gwishlist')->__('There was an error deleting gwishlist.')
188
+ );
189
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
190
+ Mage::logException($e);
191
+ return;
192
+ }
193
+ }
194
+ Mage::getSingleton('adminhtml/session')->addError(
195
+ Mage::helper('netgo_gwishlist')->__('Could not find gwishlist to delete.')
196
+ );
197
+ $this->_redirect('*/*/');
198
+ }
199
+
200
+ /**
201
+ * mass delete gwishlist - action
202
+ *
203
+ * @access public
204
+ * @return void
205
+ * @author NetGo
206
+ */
207
+ public function massDeleteAction()
208
+ {
209
+ $gwishlistIds = $this->getRequest()->getParam('gwishlist');
210
+ if (!is_array($gwishlistIds)) {
211
+ Mage::getSingleton('adminhtml/session')->addError(
212
+ Mage::helper('netgo_gwishlist')->__('Please select gwishlists to delete.')
213
+ );
214
+ } else {
215
+ try {
216
+ foreach ($gwishlistIds as $gwishlistId) {
217
+ $gwishlist = Mage::getModel('netgo_gwishlist/gwishlist');
218
+ $gwishlist->setId($gwishlistId)->delete();
219
+ }
220
+ Mage::getSingleton('adminhtml/session')->addSuccess(
221
+ Mage::helper('netgo_gwishlist')->__('Total of %d gwishlists were successfully deleted.', count($gwishlistIds))
222
+ );
223
+ } catch (Mage_Core_Exception $e) {
224
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
225
+ } catch (Exception $e) {
226
+ Mage::getSingleton('adminhtml/session')->addError(
227
+ Mage::helper('netgo_gwishlist')->__('There was an error deleting gwishlists.')
228
+ );
229
+ Mage::logException($e);
230
+ }
231
+ }
232
+ $this->_redirect('*/*/index');
233
+ }
234
+
235
+ /**
236
+ * mass status change - action
237
+ *
238
+ * @access public
239
+ * @return void
240
+ * @author NetGo
241
+ */
242
+ public function massStatusAction()
243
+ {
244
+ $gwishlistIds = $this->getRequest()->getParam('gwishlist');
245
+ if (!is_array($gwishlistIds)) {
246
+ Mage::getSingleton('adminhtml/session')->addError(
247
+ Mage::helper('netgo_gwishlist')->__('Please select gwishlists.')
248
+ );
249
+ } else {
250
+ try {
251
+ foreach ($gwishlistIds as $gwishlistId) {
252
+ $gwishlist = Mage::getSingleton('netgo_gwishlist/gwishlist')->load($gwishlistId)
253
+ ->setStatus($this->getRequest()->getParam('status'))
254
+ ->setIsMassupdate(true)
255
+ ->save();
256
+ }
257
+ $this->_getSession()->addSuccess(
258
+ $this->__('Total of %d gwishlists were successfully updated.', count($gwishlistIds))
259
+ );
260
+ } catch (Mage_Core_Exception $e) {
261
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
262
+ } catch (Exception $e) {
263
+ Mage::getSingleton('adminhtml/session')->addError(
264
+ Mage::helper('netgo_gwishlist')->__('There was an error updating gwishlists.')
265
+ );
266
+ Mage::logException($e);
267
+ }
268
+ }
269
+ $this->_redirect('*/*/index');
270
+ }
271
+
272
+ /**
273
+ * export as csv - action
274
+ *
275
+ * @access public
276
+ * @return void
277
+ * @author NetGo
278
+ */
279
+ public function exportCsvAction()
280
+ {
281
+ $fileName = 'gwishlist.csv';
282
+ $content = $this->getLayout()->createBlock('netgo_gwishlist/adminhtml_gwishlist_grid')
283
+ ->getCsv();
284
+ $this->_prepareDownloadResponse($fileName, $content);
285
+ }
286
+
287
+ /**
288
+ * export as MsExcel - action
289
+ *
290
+ * @access public
291
+ * @return void
292
+ * @author NetGo
293
+ */
294
+ public function exportExcelAction()
295
+ {
296
+ $fileName = 'gwishlist.xls';
297
+ $content = $this->getLayout()->createBlock('netgo_gwishlist/adminhtml_gwishlist_grid')
298
+ ->getExcelFile();
299
+ $this->_prepareDownloadResponse($fileName, $content);
300
+ }
301
+
302
+ /**
303
+ * export as xml - action
304
+ *
305
+ * @access public
306
+ * @return void
307
+ * @author NetGo
308
+ */
309
+ public function exportXmlAction()
310
+ {
311
+ $fileName = 'gwishlist.xml';
312
+ $content = $this->getLayout()->createBlock('netgo_gwishlist/adminhtml_gwishlist_grid')
313
+ ->getXml();
314
+ $this->_prepareDownloadResponse($fileName, $content);
315
+ }
316
+
317
+ /**
318
+ * Check if admin has permissions to visit related pages
319
+ *
320
+ * @access protected
321
+ * @return boolean
322
+ * @author NetGo
323
+ */
324
+ protected function _isAllowed()
325
+ {
326
+ return Mage::getSingleton('admin/session')->isAllowed('netgo_gwishlist/gwishlist');
327
+ }
328
+ }
app/code/community/Netgo/Gwishlist/controllers/GwishlistController.php ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist front contrller
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ class Netgo_Gwishlist_GwishlistController extends Mage_Core_Controller_Front_Action
25
+ {
26
+
27
+ /**
28
+ * default action
29
+ *
30
+ * @access public
31
+ * @return void
32
+ * @author NetGo
33
+ */
34
+ public function indexAction()
35
+ {
36
+ $this->loadLayout();
37
+ $this->_initLayoutMessages('catalog/session');
38
+ $this->_initLayoutMessages('customer/session');
39
+ $this->_initLayoutMessages('checkout/session');
40
+ if (Mage::helper('netgo_gwishlist/gwishlist')->getUseBreadcrumbs()) {
41
+ if ($breadcrumbBlock = $this->getLayout()->getBlock('breadcrumbs')) {
42
+ $breadcrumbBlock->addCrumb(
43
+ 'home',
44
+ array(
45
+ 'label' => Mage::helper('netgo_gwishlist')->__('Home'),
46
+ 'link' => Mage::getUrl(),
47
+ )
48
+ );
49
+ $breadcrumbBlock->addCrumb(
50
+ 'gwishlists',
51
+ array(
52
+ 'label' => Mage::helper('netgo_gwishlist')->__('Gwishlists'),
53
+ 'link' => '',
54
+ )
55
+ );
56
+ }
57
+ }
58
+ $headBlock = $this->getLayout()->getBlock('head');
59
+ if ($headBlock) {
60
+ $headBlock->addLinkRel('canonical', Mage::helper('netgo_gwishlist/gwishlist')->getGwishlistsUrl());
61
+ }
62
+ $this->renderLayout();
63
+ }
64
+
65
+ public function addAction(){
66
+
67
+ $postData = $this->getRequest()->getPost();
68
+
69
+
70
+ $qty = $postData['qty'];
71
+
72
+
73
+ $prid= (int)$this->getRequest()->getParam('product');
74
+
75
+
76
+ if(empty($postData) and $prid >0)
77
+ {
78
+ $postData['product']=$prid;
79
+ $postData['qty']=1;
80
+ $qty=1;
81
+
82
+ }
83
+ if($qty=='')
84
+ {
85
+ $qty=1;
86
+ }
87
+ $product_id = $postData['product'];
88
+
89
+ $product = Mage::getModel('catalog/product')->load($product_id);
90
+
91
+ $product_type = $product->getTypeID();
92
+ $super_attribute = $postData['super_attribute'];
93
+ $options = $postData['options'];
94
+
95
+ $gwishlistData['entity_id'] = time();
96
+ $gwishlistData['product_id'] = $product_id;
97
+ $gwishlistData['type'] = $product_type;
98
+ $gwishlistData['options'] = serialize($postData);
99
+ $gwishlistData['qty'] = $qty;
100
+
101
+ $cookie_name = "gwishlist";
102
+
103
+ $product_info = array();
104
+ $product_info = unserialize($_COOKIE['gwishlist']);
105
+
106
+
107
+ if(isset($postData) && count($postData) > 0){
108
+ if(!array_key_exists($gwishlistData['entity_id'] , $product_info)){
109
+ $product_info[$gwishlistData['entity_id'] ] = $gwishlistData;
110
+ setcookie($cookie_name, serialize($product_info), time() + (86400 * 30), "/"); // 86400 = 1 day
111
+ }
112
+ }
113
+ $data = unserialize($_COOKIE['gwishlist']);
114
+
115
+ Mage::getSingleton('core/session')->addSuccess($product->getName()." has been added in wishlist");
116
+
117
+ $url=Mage::getBaseUrl().'gwishlist/gwishlist/';
118
+ $this->_redirectUrl($url);
119
+
120
+ }
121
+ public function removeitemAction(){
122
+
123
+ $productData=$this->getRequest()->getParams();
124
+ $itemId=$productData['item'];
125
+ $predata= $data = unserialize($_COOKIE['gwishlist']);
126
+
127
+ unset($data[$itemId]);
128
+
129
+ $cookie_name = "gwishlist";
130
+ Mage::setIsDeveloperMode(true);
131
+
132
+ setcookie("gwishlist",serialize($predata),time()-1, "/");
133
+ setcookie($cookie_name, serialize($data), time() + (86400 * 30), "/"); // 86400 = 1 day
134
+
135
+ // die('stopnnn');
136
+ Mage::getSingleton('core/session')->addSuccess("Item was successfully deleted");
137
+ $url=Mage::getBaseUrl().'gwishlist/gwishlist/';
138
+
139
+ $this->_redirectUrl($url);
140
+
141
+
142
+
143
+ }
144
+
145
+ public function configureAction()
146
+ {
147
+
148
+ $id = (int) $this->getRequest()->getParam('wlid');
149
+
150
+
151
+ $data = unserialize($_COOKIE['gwishlist']);
152
+
153
+ $prodcutId=$data[$id]['product_id'];
154
+ $bRequest=unserialize($data[$id]['options']);
155
+
156
+ try {
157
+
158
+ $_product = Mage::getModel('catalog/product')->load($prodcutId);
159
+
160
+ $params = new Varien_Object();
161
+ $params->setCategoryId(false);
162
+ $params->setConfigureMode(true);
163
+
164
+ $buyRequest = new Varien_Object($bRequest);
165
+
166
+ $params->setBuyRequest($buyRequest);
167
+
168
+
169
+ Mage::helper('catalog/product_view')->prepareAndRender($_product->getId(), $this, $params);
170
+ } catch (Mage_Core_Exception $e) {
171
+ Mage::getSingleton('core/session')->addError($e->getMessage());
172
+ die($e->getMessage());
173
+
174
+ } catch (Exception $e) {
175
+ Mage::getSingleton('core/session')->addError($this->__('Cannot configure product'));
176
+ Mage::logException($e);
177
+
178
+ $this->_redirect('*');
179
+ return;
180
+ }
181
+
182
+ }
183
+
184
+
185
+ public function additemAction(){
186
+
187
+ $productData=$this->getRequest()->getParams();
188
+
189
+
190
+ $itemId=$productData['item'];
191
+ $data = unserialize($_COOKIE['gwishlist']);
192
+
193
+ $prodcutId=$data[$itemId]['product_id'];
194
+ $prodcutOption=unserialize($data[$itemId]['options']);
195
+
196
+ $options=$prodcutOption['options'];
197
+
198
+
199
+ $_product = Mage::getModel('catalog/product')->load($prodcutId);
200
+
201
+
202
+ $cart = Mage::getSingleton('checkout/cart');
203
+ $cart->init();
204
+
205
+
206
+
207
+ $productType=$data[$itemId]['type'];
208
+ try {
209
+
210
+ if($productType=='simple' or $productType=='configurable')
211
+ {
212
+
213
+ $product_super_attribute=$prodcutOption['super_attribute'];
214
+ $qty=$prodcutOption['qty'];
215
+ $cart->addProduct($_product ,
216
+ array( 'product_id' => $prodcutId,
217
+ 'qty' => $qty,
218
+ 'super_attribute' => $product_super_attribute,
219
+ 'options' => $options));
220
+
221
+ }elseif($productType=='downloadable')
222
+ {
223
+
224
+ $links=$prodcutOption['links'];
225
+ $qty=$prodcutOption['qty'];
226
+
227
+ $cart->addProduct($_product ,
228
+ array( 'product_id' => $prodcutId,
229
+ 'qty' => $qty,
230
+ 'links' => $links,
231
+ 'options' => $options));
232
+ }
233
+ elseif($productType=='bundle')
234
+ {
235
+
236
+ $bundle_option=$prodcutOption['bundle_option'];
237
+ $qty=$prodcutOption['qty'];
238
+
239
+ $cart->addProduct($_product ,
240
+ array( 'product_id' => $prodcutId,
241
+ 'qty' => $qty,
242
+ 'bundle_option' => $bundle_option,
243
+ 'options' => $options));
244
+ }
245
+ elseif($productType=='virtual')
246
+ {
247
+
248
+
249
+ $qty=$prodcutOption['qty'];
250
+
251
+ $cart->addProduct($_product ,
252
+ array( 'product_id' => $prodcutId,
253
+ 'qty' => $qty,
254
+ 'options' => $options));
255
+ }elseif($productType=='grouped')
256
+ {
257
+ $super_group=$prodcutOption['super_group'];
258
+ $qty=$prodcutOption['qty'];
259
+
260
+ $cart->addProduct($_product ,
261
+ array( 'product_id' => $prodcutId,
262
+ 'qty' => $qty,
263
+ 'super_group' => $super_group));
264
+ }
265
+
266
+
267
+ $cart->save();
268
+ $url=Mage::getBaseUrl().'checkout/cart/';
269
+ }catch (Exception $e) {
270
+
271
+ Mage::getSingleton('core/session')->addError($e->getMessage());
272
+
273
+ $url=Mage::getBaseUrl().'gwishlist/gwishlist/configure/wlid/'.$itemId;
274
+
275
+
276
+
277
+ }
278
+
279
+
280
+
281
+ $this->_redirectUrl($url);
282
+
283
+
284
+
285
+
286
+
287
+ }
288
+
289
+ public function updateAction(){
290
+
291
+ $post_data=$this->getRequest()->getPost();
292
+
293
+ $qty=$post_data['qty'];
294
+
295
+ try {
296
+
297
+
298
+ $predata= $data = unserialize($_COOKIE['gwishlist']);
299
+
300
+
301
+ foreach($qty as $wlid=>$prqty)
302
+ {
303
+
304
+
305
+ $data[$wlid]['qty']=$prqty;
306
+ $dataOpt = unserialize($data[$wlid]['options']);
307
+ $dataOpt['qty']=$prqty;
308
+ $data[$wlid]['options']=serialize($dataOpt);
309
+
310
+
311
+ }
312
+
313
+ $cookie_name = "gwishlist";
314
+ Mage::setIsDeveloperMode(true);
315
+ setcookie("gwishlist",serialize($predata),time()-1, "/");
316
+ setcookie($cookie_name, serialize($data), time() + (86400 * 30), "/"); // 86400 = 1 day
317
+
318
+
319
+ Mage::getSingleton('core/session')->addSuccess('Item was updated');
320
+ }
321
+ catch (Exception $e) {
322
+
323
+ Mage::getSingleton('core/session')->addError($e->getMessage());
324
+
325
+
326
+ }
327
+
328
+
329
+ $url=Mage::getBaseUrl().'gwishlist/gwishlist/';
330
+ $this->_redirectUrl($url);
331
+
332
+ }
333
+
334
+ public function addallitemAction(){
335
+
336
+ $post_data=$this->getRequest()->getPost();
337
+
338
+ $data = unserialize($_COOKIE['gwishlist']);
339
+
340
+
341
+
342
+ foreach($data as $gwishlistProdcut)
343
+ {
344
+ $prodcutId=$gwishlistProdcut['product_id'];
345
+ $prodcutOption=unserialize($gwishlistProdcut['options']);
346
+
347
+ $options=$prodcutOption['options'];
348
+
349
+ $_product = Mage::getModel('catalog/product')->load($prodcutId);
350
+ $cart = Mage::getSingleton('checkout/cart');
351
+ $cart->init();
352
+ $productType=$gwishlistProdcut['type'];
353
+ try {
354
+
355
+ if($productType=='simple' or $productType=='configurable')
356
+ {
357
+
358
+ $product_super_attribute=$prodcutOption['super_attribute'];
359
+ $qty=$prodcutOption['qty'];
360
+ $cart->addProduct($_product ,
361
+ array( 'product_id' => $prodcutId,
362
+ 'qty' => $qty,
363
+ 'super_attribute' => $product_super_attribute,
364
+ 'options' => $options));
365
+
366
+ }elseif($productType=='downloadable')
367
+ {
368
+
369
+ $links=$prodcutOption['links'];
370
+ $qty=$prodcutOption['qty'];
371
+
372
+ $cart->addProduct($_product ,
373
+ array( 'product_id' => $prodcutId,
374
+ 'qty' => $qty,
375
+ 'links' => $links,
376
+ 'options' => $options));
377
+ }
378
+ elseif($productType=='bundle')
379
+ {
380
+
381
+ $bundle_option=$prodcutOption['bundle_option'];
382
+ $qty=$prodcutOption['qty'];
383
+
384
+ $cart->addProduct($_product ,
385
+ array( 'product_id' => $prodcutId,
386
+ 'qty' => $qty,
387
+ 'bundle_option' => $bundle_option,
388
+ 'options' => $options));
389
+ }
390
+ elseif($productType=='virtual')
391
+ {
392
+
393
+
394
+ $qty=$prodcutOption['qty'];
395
+
396
+ $cart->addProduct($_product ,
397
+ array( 'product_id' => $prodcutId,
398
+ 'qty' => $qty,
399
+ 'options' => $options));
400
+ }elseif($productType=='grouped')
401
+ {
402
+ $super_group=$prodcutOption['super_group'];
403
+ $qty=$prodcutOption['qty'];
404
+
405
+ $cart->addProduct($_product ,
406
+ array( 'product_id' => $prodcutId,
407
+ 'qty' => $qty,
408
+ 'super_group' => $super_group));
409
+ }
410
+
411
+
412
+ $cart->save();
413
+ $url=Mage::getBaseUrl().'checkout/cart/';
414
+ }catch (Exception $e) {
415
+
416
+ Mage::getSingleton('core/session')->addError($e->getMessage());
417
+
418
+ $url=$_product->getUrl();
419
+
420
+
421
+
422
+ }
423
+
424
+
425
+
426
+ }
427
+
428
+
429
+ $this->_redirectUrl($url);
430
+ }
431
+
432
+
433
+ public function updategwishlistAction() {
434
+
435
+
436
+ $post_data=$this->getRequest()->getPost();
437
+ $wlid= $this->getRequest()->getParam("item");
438
+
439
+
440
+
441
+ if ($post_data) {
442
+
443
+ try {
444
+
445
+ $predata= $data = unserialize($_COOKIE['gwishlist']);
446
+ $qty= $post_data['qty'];
447
+
448
+ $data[$wlid]['options']=serialize($post_data);
449
+ $data[$wlid]['qty']= $qty ;
450
+
451
+ $cookie_name = "gwishlist";
452
+ Mage::setIsDeveloperMode(true);
453
+ setcookie("gwishlist",serialize($predata),time()-1, "/");
454
+ setcookie($cookie_name, serialize($data), time() + (86400 * 30), "/");
455
+
456
+
457
+ Mage::getSingleton('core/session')->addSuccess('Item was updated');
458
+
459
+ $url=Mage::getBaseUrl().'gwishlist/gwishlist/';
460
+
461
+ }
462
+ catch (Exception $e) {
463
+ $url=Mage::getBaseUrl();
464
+ return;
465
+ }
466
+
467
+ }
468
+
469
+
470
+
471
+ $this->_redirectUrl($url);
472
+
473
+
474
+ }
475
+
476
+ }
app/code/community/Netgo/Gwishlist/etc/adminhtml.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Netgo_Gwishlist extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Netgo
14
+ * @package Netgo_Gwishlist
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <acl>
21
+ <resources>
22
+ <admin>
23
+ <children>
24
+ <system>
25
+ <children>
26
+ <config>
27
+ <children>
28
+ <netgo_gwishlist translate="title" module="netgo_gwishlist">
29
+ <title>Gwishlist</title>
30
+ </netgo_gwishlist>
31
+ </children>
32
+ </config>
33
+ </children>
34
+ </system>
35
+ <netgo_gwishlist translate="title" module="netgo_gwishlist">
36
+ <title>Guest Wish List</title>
37
+ <children>
38
+ <gwishlist translate="title" module="netgo_gwishlist">
39
+ <title>Gwishlist</title>
40
+ <sort_order>0</sort_order>
41
+ </gwishlist>
42
+ </children>
43
+ </netgo_gwishlist>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+ <menu>
49
+ <netgo_gwishlist translate="title" module="netgo_gwishlist">
50
+ <title>Guest Wish List</title>
51
+ <sort_order>37</sort_order>
52
+ <children>
53
+ <gwishlist translate="title" module="netgo_gwishlist">
54
+ <title>Gwishlist</title>
55
+ <action>adminhtml/gwishlist_gwishlist</action>
56
+ <sort_order>0</sort_order>
57
+ </gwishlist>
58
+ </children>
59
+ </netgo_gwishlist>
60
+ </menu>
61
+ </config>
app/code/community/Netgo/Gwishlist/etc/config.xml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Netgo_Gwishlist extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Netgo
14
+ * @package Netgo_Gwishlist
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Netgo_Gwishlist>
22
+ <version>1.0.0</version>
23
+ </Netgo_Gwishlist>
24
+ </modules>
25
+ <global>
26
+ <resources>
27
+ <netgo_gwishlist_setup>
28
+ <setup>
29
+ <module>Netgo_Gwishlist</module>
30
+ <class>Netgo_Gwishlist_Model_Resource_Setup</class>
31
+ </setup>
32
+ </netgo_gwishlist_setup>
33
+ </resources>
34
+ <blocks>
35
+ <netgo_gwishlist>
36
+ <class>Netgo_Gwishlist_Block</class>
37
+ </netgo_gwishlist>
38
+ <customer>
39
+ <rewrite>
40
+ <account_navigation>Netgo_Gwishlist_Block_Customer_Account_Navigation</account_navigation>
41
+ </rewrite>
42
+ </customer>
43
+ </blocks>
44
+ <helpers>
45
+ <netgo_gwishlist>
46
+ <class>Netgo_Gwishlist_Helper</class>
47
+ </netgo_gwishlist>
48
+ </helpers>
49
+ <models>
50
+ <netgo_gwishlist>
51
+ <class>Netgo_Gwishlist_Model</class>
52
+ <resourceModel>netgo_gwishlist_resource</resourceModel>
53
+ </netgo_gwishlist>
54
+ <netgo_gwishlist_resource>
55
+ <class>Netgo_Gwishlist_Model_Resource</class>
56
+ <entities>
57
+ <gwishlist>
58
+ <table>netgo_gwishlist_gwishlist</table>
59
+ </gwishlist>
60
+ <gwishlist_store>
61
+ <table>netgo_gwishlist_gwishlist_store</table>
62
+ </gwishlist_store>
63
+ </entities>
64
+ </netgo_gwishlist_resource>
65
+ </models>
66
+ </global>
67
+ <adminhtml>
68
+ <layout>
69
+ <updates>
70
+ <netgo_gwishlist>
71
+ <file>netgo_gwishlist.xml</file>
72
+ </netgo_gwishlist>
73
+ </updates>
74
+ </layout>
75
+ <translate>
76
+ <modules>
77
+ <Netgo_Gwishlist>
78
+ <files>
79
+ <default>Netgo_Gwishlist.csv</default>
80
+ </files>
81
+ </Netgo_Gwishlist>
82
+ </modules>
83
+ </translate>
84
+ </adminhtml>
85
+ <admin>
86
+ <routers>
87
+ <adminhtml>
88
+ <args>
89
+ <modules>
90
+ <Netgo_Gwishlist before="Mage_Adminhtml">Netgo_Gwishlist_Adminhtml</Netgo_Gwishlist>
91
+ </modules>
92
+ </args>
93
+ </adminhtml>
94
+ </routers>
95
+ </admin>
96
+ <frontend>
97
+ <routers>
98
+ <netgo_gwishlist>
99
+ <use>standard</use>
100
+ <args>
101
+ <module>Netgo_Gwishlist</module>
102
+ <frontName>gwishlist</frontName>
103
+ </args>
104
+ </netgo_gwishlist>
105
+ </routers>
106
+ <events>
107
+ <customer_login>
108
+ <observers>
109
+ <netgo_gwishlist>
110
+ <class>netgo_gwishlist/observer</class>
111
+ <method>addCustomerWishlist</method>
112
+ </netgo_gwishlist>
113
+ </observers>
114
+ </customer_login>
115
+ </events>
116
+ <layout>
117
+ <updates>
118
+ <netgo_gwishlist>
119
+ <file>netgo_gwishlist.xml</file>
120
+ </netgo_gwishlist>
121
+ </updates>
122
+ </layout>
123
+ <translate>
124
+ <modules>
125
+ <Netgo_Gwishlist>
126
+ <files>
127
+ <default>Netgo_Gwishlist.csv</default>
128
+ </files>
129
+ </Netgo_Gwishlist>
130
+ </modules>
131
+ </translate>
132
+ </frontend>
133
+ <default>
134
+ <netgo_gwishlist>
135
+ <gwishlist>
136
+ <breadcrumbs>1</breadcrumbs>
137
+ </gwishlist>
138
+ </netgo_gwishlist>
139
+ </default>
140
+ </config>
app/code/community/Netgo/Gwishlist/etc/system.xml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Netgo_Gwishlist extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Netgo
14
+ * @package Netgo_Gwishlist
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <tabs>
21
+ <netgo translate="label" module="netgo_gwishlist">
22
+ <label>Netgo</label>
23
+ <sort_order>0</sort_order>
24
+ </netgo>
25
+ </tabs>
26
+ <sections>
27
+ <netgo_gwishlist translate="label" module="netgo_gwishlist">
28
+ <class>separator-top</class>
29
+ <label>Guest Wish List</label>
30
+ <tab>netgo</tab>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>100</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
+ <groups>
37
+ <gwishlist translate="label" module="netgo_gwishlist">
38
+ <label>Gwishlist</label>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>0</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
+ <fields>
45
+ <breadcrumbs translate="label">
46
+ <label>Use Breadcrumbs</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>11</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </breadcrumbs>
54
+ <enable translate="label">
55
+ <label>Enable</label>
56
+ <frontend_type>select</frontend_type>
57
+ <source_model>adminhtml/system_config_source_yesno</source_model>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </enable>
63
+ </fields>
64
+ </gwishlist>
65
+ </groups>
66
+ </netgo_gwishlist>
67
+ </sections>
68
+ </config>
app/code/community/Netgo/Gwishlist/sql/netgo_gwishlist_setup/install-1.0.0.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Gwishlist module install script
19
+ *
20
+ * @category Netgo
21
+ * @package Netgo_Gwishlist
22
+ * @author NetGo
23
+ */
24
+ $this->startSetup();
25
+ $table = $this->getConnection()
26
+ ->newTable($this->getTable('netgo_gwishlist/gwishlist'))
27
+ ->addColumn(
28
+ 'entity_id',
29
+ Varien_Db_Ddl_Table::TYPE_INTEGER,
30
+ null,
31
+ array(
32
+ 'identity' => true,
33
+ 'nullable' => false,
34
+ 'primary' => true,
35
+ ),
36
+ 'Gwishlist ID'
37
+ )
38
+ ->addColumn(
39
+ 'product_id',
40
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
41
+ array(
42
+ 'nullable' => false,
43
+ ),
44
+ 'Product ID'
45
+ )
46
+ ->addColumn(
47
+ 'gwishlist_data',
48
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
49
+ array(
50
+ 'nullable' => false,
51
+ ),
52
+ 'Data'
53
+ )
54
+ ->addColumn(
55
+ 'guest_ip',
56
+ Varien_Db_Ddl_Table::TYPE_TEXT, 255,
57
+ array(),
58
+ 'Guest IP'
59
+ )
60
+ ->addColumn(
61
+ 'status',
62
+ Varien_Db_Ddl_Table::TYPE_SMALLINT, null,
63
+ array(),
64
+ 'Enabled'
65
+ )
66
+ ->addColumn(
67
+ 'updated_at',
68
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
69
+ null,
70
+ array(),
71
+ 'Gwishlist Modification Time'
72
+ )
73
+ ->addColumn(
74
+ 'created_at',
75
+ Varien_Db_Ddl_Table::TYPE_TIMESTAMP,
76
+ null,
77
+ array(),
78
+ 'Gwishlist Creation Time'
79
+ )
80
+ ->setComment('Gwishlist Table');
81
+ $this->getConnection()->createTable($table);
82
+ $table = $this->getConnection()
83
+ ->newTable($this->getTable('netgo_gwishlist/gwishlist_store'))
84
+ ->addColumn(
85
+ 'gwishlist_id',
86
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
87
+ null,
88
+ array(
89
+ 'nullable' => false,
90
+ 'primary' => true,
91
+ ),
92
+ 'Gwishlist ID'
93
+ )
94
+ ->addColumn(
95
+ 'store_id',
96
+ Varien_Db_Ddl_Table::TYPE_SMALLINT,
97
+ null,
98
+ array(
99
+ 'unsigned' => true,
100
+ 'nullable' => false,
101
+ 'primary' => true,
102
+ ),
103
+ 'Store ID'
104
+ )
105
+ ->addIndex(
106
+ $this->getIdxName(
107
+ 'netgo_gwishlist/gwishlist_store',
108
+ array('store_id')
109
+ ),
110
+ array('store_id')
111
+ )
112
+ ->addForeignKey(
113
+ $this->getFkName(
114
+ 'netgo_gwishlist/gwishlist_store',
115
+ 'gwishlist_id',
116
+ 'netgo_gwishlist/gwishlist',
117
+ 'entity_id'
118
+ ),
119
+ 'gwishlist_id',
120
+ $this->getTable('netgo_gwishlist/gwishlist'),
121
+ 'entity_id',
122
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
123
+ Varien_Db_Ddl_Table::ACTION_CASCADE
124
+ )
125
+ ->addForeignKey(
126
+ $this->getFkName(
127
+ 'netgo_gwishlist/gwishlist_store',
128
+ 'store_id',
129
+ 'core/store',
130
+ 'store_id'
131
+ ),
132
+ 'store_id',
133
+ $this->getTable('core/store'),
134
+ 'store_id',
135
+ Varien_Db_Ddl_Table::ACTION_CASCADE,
136
+ Varien_Db_Ddl_Table::ACTION_CASCADE
137
+ )
138
+ ->setComment('Gwishlists To Store Linkage Table');
139
+ $this->getConnection()->createTable($table);
140
+ $this->endSetup();
app/design/frontend/base/default/layout/netgo_gwishlist.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Netgo_Gwishlist extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Netgo
14
+ * @package Netgo_Gwishlist
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <layout>
20
+ <default>
21
+ <reference name="top.links">
22
+
23
+ <block type="netgo_gwishlist/gwishlist_links" name="gwishlist_link" >
24
+ <action method="addGwishlistLink" ifconfig="netgo_gwishlist/gwishlist/enable"></action>
25
+ </block>
26
+
27
+
28
+ </reference>
29
+ </default>
30
+ <netgo_gwishlist_gwishlist_index translate="label" module="netgo_gwishlist">
31
+ <label>Gwishlists list</label>
32
+ <update handle="page_two_columns_left" />
33
+ <reference name="content">
34
+ <block type="netgo_gwishlist/gwishlist_list" name="gwishlist_list" template="netgo_gwishlist/gwishlist/list.phtml" />
35
+ </reference>
36
+ </netgo_gwishlist_gwishlist_index>
37
+ <catalog_product_view translate="label">
38
+ <reference name="product.info.addto">
39
+ <action method="setTemplate" ifconfig="netgo_gwishlist/gwishlist/enable">
40
+ <template>netgo_gwishlist/gwishlist/addtogwishlist.phtml</template>
41
+ </action>
42
+ </reference>
43
+ </catalog_product_view>
44
+
45
+ <netgo_gwishlist_gwishlist_configure translate="label">
46
+ <label>Configure favouritelist Item</label>
47
+ <update handle="catalog_product_view" />
48
+ <reference name="product.info.options.wrapper.bottom">
49
+ <action method="unsetChild"><name>product.info.addto</name></action>
50
+ <action method="append"><block>product.info.addto</block></action>
51
+ </reference>
52
+
53
+ </netgo_gwishlist_gwishlist_configure>
54
+
55
+ </layout>
app/design/frontend/base/default/template/netgo_gwishlist/gwishlist/addtogwishlist.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ ?>
18
+ <?php $_product = $this->getProduct(); ?>
19
+ <?php $_wishlistSubmitUrl = $this->helper('wishlist')->getAddUrl($_product); ?>
20
+
21
+ <ul class="add-to-links">
22
+
23
+
24
+ <?php
25
+ if(!Mage::getSingleton('customer/session')->isLoggedIn()):
26
+ $wlid = (int) $this->getRequest()->getParam('wlid');
27
+
28
+ ?>
29
+ <li>
30
+ <?php
31
+ if($wlid > 0){
32
+
33
+ ?>
34
+ <a href="<?php echo Mage::getBaseUrl().'gwishlist/gwishlist/updategwishlist'; ?>/item/<?php echo $wlid; ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-favourite"><?php echo $this->__('Update To Wishlist') ?></a>
35
+
36
+ <?php
37
+ }else
38
+ {
39
+ ?>
40
+ <a href="<?php echo Mage::getBaseUrl().'gwishlist/gwishlist/add'; ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-favourite"><?php echo $this->__('Add To Wishlist') ?></a>
41
+ <?php
42
+ }
43
+ ?>
44
+ </li>
45
+
46
+ <?php
47
+ else:
48
+ ?>
49
+
50
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
51
+ <li>
52
+ <a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
53
+ </li>
54
+ <?php endif; ?>
55
+
56
+ <?php endif; ?>
57
+ <?php
58
+ $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
59
+ ?>
60
+ <?php if($_compareUrl) : ?>
61
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
62
+ <?php endif; ?>
63
+
64
+
65
+ </ul>
66
+
67
+
app/design/frontend/base/default/template/netgo_gwishlist/gwishlist/list.phtml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Netgo_Gwishlist extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Netgo
13
+ * @package Netgo_Gwishlist
14
+ * @copyright Copyright (c) 2015
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ $favouritelist = $data = unserialize($_COOKIE['gwishlist']);
18
+ ?>
19
+ <div class="my-account">
20
+ <div class="my-favouritelist">
21
+ <div class="page-title title-buttons">
22
+ <h1>My Wishlist</h1>
23
+ </div>
24
+ <?php
25
+ if(count($favouritelist) > 0 and $favouritelist!=''){ ?>
26
+ <form method="post" action="<?php echo Mage::getBaseUrl(); ?>gwishlist/gwishlist/update" id="favouritelist-view-form">
27
+ <div class="fieldset">
28
+ <table id="favouritelist-table" class="clean-table linearize-table">
29
+ <thead>
30
+ <tr class="first last">
31
+ <th class="customer-favouritelist-item-image"></th>
32
+ <th class="customer-favouritelist-item-info"></th>
33
+ <th class="customer-favouritelist-item-quantity">Qty</th>
34
+ <th class="customer-favouritelist-item-price">Price</th>
35
+ <th class="customer-favouritelist-item-cart"></th>
36
+ <th class="customer-favouritelist-item-remove"></th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <?php
41
+ foreach($favouritelist as $k=>$v){
42
+
43
+
44
+ if($v['product_id'] != ''){
45
+ $_product = Mage::getModel('catalog/product')->load($v['product_id']); ?>
46
+ <tr id="item_<?php echo $v['product_id']; ?>" class="first odd">
47
+ <td class="favouritelist-cell0 customer-favouritelist-item-image">
48
+ <a title="Simple Product01" href="<?php echo $_product->getProductUrl(); ?>" class="product-image">
49
+ <img width="113" height="113" alt="Simple Product01" src="<?php echo Mage::helper('catalog/image')->init($_product , 'thumbnail');?>">
50
+ </a>
51
+ </td>
52
+ <td class="favouritelist-cell1 customer-favouritelist-item-info">
53
+ <h3 class="product-name">
54
+ <a title="Simple Product01" href="<?php echo $_product->getProductUrl();?>">
55
+ <?php echo $_product->getName();?></a>
56
+ </h3>
57
+ <div class="favouritelist-sku">
58
+ <span><?php echo $_product->getSku();?></span>
59
+ </div>
60
+ </td>
61
+ <td data-rwd-label="Qty" class="favouritelist-cell2 customer-favouritelist-item-quantity">
62
+ <div class="cart-cell">
63
+ <div class="add-to-cart-alt">
64
+ <input type="text" value="<?php echo $v['qty'] ?>" name="qty[<?php echo $v['entity_id']; ?>]" class="input-text qty validate-not-negative-number" pattern="\d*">
65
+ </div>
66
+ </div>
67
+ </td>
68
+ <td data-rwd-label="Price" class="favouritelist-cell3 customer-favouritelist-item-price">
69
+ <div class="cart-cell">
70
+ <div class="price-box">
71
+ <span id="product-price-1" class="regular-price">
72
+ <span class="price">
73
+ <?php
74
+ echo Mage::helper('core')->currency($_product->getPrice(), true, false);
75
+ ?>
76
+ </span>
77
+ </span>
78
+ </div>
79
+ </div>
80
+ </td>
81
+ <td class="favouritelist-cell4 customer-favouritelist-item-cart">
82
+ <div class="cart-cell">
83
+ <button class="button btn-cart" onclick="setLocation('<?php echo Mage::getBaseUrl(); ?>gwishlist/gwishlist/additem/item/<?php echo $v['entity_id'];?>');" title="Add to Cart" type="button">
84
+ <span><span>Add to Cart</span></span>
85
+ </button>
86
+ </div>
87
+ <p>
88
+ <a href="<?php echo Mage::getBaseUrl() ?>gwishlist/gwishlist/configure/wlid/<?php echo $v['entity_id'];?>" class="link-edit button button-secondary">Edit</a>
89
+ </p>
90
+ </td>
91
+ <td class="favouritelist-cell5 customer-favouritelist-item-remove last">
92
+ <a class="btn-remove btn-remove2" title="Remove Item" onclick="return confirmRemoveFavouritelist();" href="<?php echo Mage::getBaseUrl(); ?>gwishlist/gwishlist/removeitem/item/<?php echo $v['entity_id'];;?>">Remove item</a>
93
+ </td>
94
+ </tr>
95
+ <?php }} ?>
96
+ </tbody>
97
+ </table>
98
+ <script type="text/javascript">decorateTable('favouritelist-table')</script>
99
+ <div class="buttons-set buttons-set2">
100
+ <button class="button btn-add" onclick="setLocation('<?php echo Mage::getBaseUrl(); ?>gwishlist/gwishlist/addallitem'); return false;" title="Add All to Cart" type="button"><span><span>Add All to Cart</span></span></button>
101
+ <button class="button btn-update button-secondary" title="Update favouritelist" name="do" type="submit"><span><span>Update GWishlist</span></span></button>
102
+ </div>
103
+ </div>
104
+ </form>
105
+ <?php }else{ ?>
106
+ <div class="fieldset">
107
+ <p class="favouritelist-empty">You have no items in your Wishlist.</p>
108
+ </div>
109
+ <?php } ?>
110
+ </div>
111
+ </div>
112
+ <script>
113
+ function confirmRemoveFavouritelist() {
114
+ return confirm('Are you sure you want to remove this product from your favouritelist?');
115
+ }
116
+ </script>
app/etc/modules/Netgo_Gwishlist.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Netgo_Gwishlist extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Netgo
14
+ * @package Netgo_Gwishlist
15
+ * @copyright Copyright (c) 2015
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Netgo_Gwishlist>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ <depends>
25
+ <Mage_Core />
26
+ </depends>
27
+ </Netgo_Gwishlist>
28
+ </modules>
29
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Netgo_Gwishlist</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension is specifically for the feature of enabling wishlist for the customer even though they are log in or not.</summary>
10
+ <description>This extension is specifically for the feature of enabling wishlist for the customer even though they are log in or not. &#xD;
11
+ &#xD;
12
+ Through this extension, any not logged in user can also add any product to the wishlist and also lead them to ADD TO CART. &#xD;
13
+ &#xD;
14
+ The wish-listed items of a non logged in user will remain for a month in the browser and will only be affected if cookies are deleted.&#xD;
15
+ &#xD;
16
+ &#xD;
17
+ After adding the items to wishlist, if any user logs in the account then this wishlist items are merged with wish list items in the account. From here it works as default wish list of Magento.</description>
18
+ <notes>First Preview Release</notes>
19
+ <authors><author><name>NetGo</name><user>NetGo</user><email>netattingomails@gmail.com</email></author></authors>
20
+ <date>2015-08-15</date>
21
+ <time>07:26:53</time>
22
+ <contents><target name="magecommunity"><dir name="Netgo"><dir name="Gwishlist"><dir name="Block"><dir name="Adminhtml"><dir name="Gwishlist"><dir name="Edit"><file name="Form.php" hash="3e059046e0d194d4a012637b58667b46"/><dir name="Tab"><file name="Form.php" hash="24773e2dbcfb3d4389c1d2258fa1c271"/><file name="Stores.php" hash="3cdfc5a841e47237ce654cd1a8097578"/></dir><file name="Tabs.php" hash="0a170695f9f6712a597ba89a443fa3e9"/></dir><file name="Edit.php" hash="5fe78e7b341989f52333316c1ad0b68f"/><file name="Grid.php" hash="e639c83a1cd31a7b2cebbbc93067579f"/></dir><file name="Gwishlist.php" hash="6e6fcfa6a6301097fd6711e344961418"/></dir><dir name="Customer"><dir name="Account"><file name="Navigation.php" hash="90a81a43756bf3b948c46398d701fe78"/></dir></dir><dir name="Gwishlist"><file name="Links.php" hash="e2aa951a33f5c2ecc66e581d581da25c"/><file name="List.php" hash="5a4a58da3f1724111b57f9cc69bb0bab"/></dir></dir><dir name="Controller"><dir name="Adminhtml"><file name="Gwishlist.php" hash="39639d3c9a96aca86a7c62c7a6455a22"/></dir></dir><dir name="Helper"><file name="Data.php" hash="acbe1e5e031720198bc6eb798c7e0723"/><file name="Gwishlist.php" hash="f9785d54294e6090ceeb6721fa8b4d46"/></dir><dir name="Model"><file name="Gwishlist.php" hash="fd283f75505ff23fe40cb4ab022f9044"/><file name="Observer.php" hash="285b98992000b82fa5ce53ffcc351839"/><dir name="Resource"><dir name="Gwishlist"><file name="Collection.php" hash="92ebbcb8e52050a1e661e64f77b9c3a2"/></dir><file name="Gwishlist.php" hash="5878323cab074f0d1ee8ea60026fd5f9"/><file name="Setup.php" hash="75dcc6b9b9d66275b7251403883f53fb"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Gwishlist"><file name="GwishlistController.php" hash="f938f586ab2a2060b126dbfbe228eb3b"/></dir></dir><file name="GwishlistController.php" hash="68552c6cf7dc00ff25fbae71ddef619e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f4c972930eb337af9e90b8d70743f819"/><file name="config.xml" hash="51be92eac7f33d4dde46f3e5af42f914"/><file name="system.xml" hash="32dfcafebe5894ce6ae44bee31ddc00e"/></dir><dir name="sql"><dir name="netgo_gwishlist_setup"><file name="install-1.0.0.php" hash="109fc0df0c2f7537e71154a000b5e69d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="netgo_gwishlist.xml" hash="d3c1ab2a1adbc35373e0667b3103486e"/></dir><dir name="template"><dir name="netgo_gwishlist"><dir name="gwishlist"><file name="addtogwishlist.phtml" hash="2beb1d61fd3085ffe81f866e6b5daf71"/><file name="list.phtml" hash="5cae5156c052706e6212106e0467ac4b"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="User_Manual.pdf" hash="d708ac701ce537ea9bba8d97573ec22f"/><file name="readme.txt" hash="516ad57543926c116fc4fbb09ab895ec"/></dir></target><target name="mageetc"><dir name="modules"><file name="Netgo_Gwishlist.xml" hash="a6a43d095bf1bc356485f9787d13db8a"/></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
25
+ </package>
readme.txt ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *****************
2
+ Usage in CMS page
3
+ *****************
4
+
5
+
6
+ 1) Open app/design/frontend/YourThemePackage/YourThemeName/template/catalog/product/list.phtml file:
7
+
8
+ 2) Find the wishlist code:
9
+
10
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
11
+
12
+ <li>
13
+ <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>"
14
+
15
+ <?php echo $this->__('Add to Wishlist') ?>
16
+
17
+ </a>
18
+ </li>
19
+
20
+ <?php endif; ?>
21
+
22
+ 3) Replace the above code with this one:
23
+
24
+ <?php echo Mage::helper('netgo_gwishlist')->getUrl($_product); ?>
25
+
26
+