ng_customer - Version 1.0.2

Version Notes

Added ability to enable/ disable my account links

Download this release

Release Info

Developer NG
Extension ng_customer
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/NG/Customer/Block/Account/Navigation.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category MagePsycho
4
+ * @package MagePsycho_Xmllinks
5
+ * @author magepsycho@gmail.com
6
+ * @website http://www.magepsycho.com
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ class NG_Customer_Block_Account_Navigation extends Mage_Customer_Block_Account_Navigation
10
+ {
11
+ public function removeLinkByName($name)
12
+ {
13
+ foreach ($this->_links as $k => $v) {
14
+ if ($v->getName() == $name) {
15
+ unset($this->_links[$k]);
16
+ }
17
+ }
18
+ return $this;
19
+ }
20
+ }
app/code/community/NG/Customer/Block/System/Config/Label.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category MagePsycho
4
+ * @package MagePsycho_Xmllinks
5
+ * @author magepsycho@gmail.com
6
+ * @website http://www.magepsycho.com
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ class NG_Customer_Block_System_Config_Label extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
10
+ {
11
+ /**
12
+ * Render element html
13
+ *
14
+ * @param Varien_Data_Form_Element_Abstract $element
15
+ * @return string
16
+ */
17
+ public function render(Varien_Data_Form_Element_Abstract $element)
18
+ {
19
+ return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
20
+ $element->getHtmlId(), $element->getLabel()
21
+ );
22
+ }
23
+ }
app/code/community/NG/Customer/Helper/Data.php CHANGED
@@ -18,7 +18,7 @@
18
  class NG_Customer_Helper_Data extends Mage_Core_Helper_Abstract {
19
 
20
  public function getLinkLabel() {
21
- return ucwords(Mage::getStoreConfig('ng_customer/link/name'));
22
  }
23
 
24
  }
18
  class NG_Customer_Helper_Data extends Mage_Core_Helper_Abstract {
19
 
20
  public function getLinkLabel() {
21
+ return ucwords(Mage::getStoreConfig('ng_customer/ng_account_navigation/name'));
22
  }
23
 
24
  }
app/code/community/NG/Customer/Model/System/Config/Source/Yesno.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category MagePsycho
4
+ * @package MagePsycho_Xmllinks
5
+ * @author magepsycho@gmail.com
6
+ * @website http://www.magepsycho.com
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ class NG_Customer_Model_System_Config_Source_Yesno
10
+ {
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array('value' => 0, 'label'=>Mage::helper('ng_customer')->__('Enabled')),
15
+ array('value' => 1, 'label'=>Mage::helper('ng_customer')->__('Disabled')),
16
+ );
17
+ }
18
+ }
app/code/community/NG/Customer/etc/config.xml CHANGED
@@ -47,5 +47,27 @@
47
  <class>NG_Customer_Helper</class>
48
  </ng_customer>
49
  </helpers>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </global>
 
 
 
 
 
 
 
51
  </config>
47
  <class>NG_Customer_Helper</class>
48
  </ng_customer>
49
  </helpers>
50
+ <blocks>
51
+ <ng_customer>
52
+ <class>NG_Customer_Block</class>
53
+ </ng_customer>
54
+ <customer>
55
+ <rewrite>
56
+ <account_navigation>NG_Customer_Block_Account_Navigation</account_navigation>
57
+ </rewrite>
58
+ </customer>
59
+ </blocks>
60
+ <models>
61
+ <ng_customer>
62
+ <class>NG_Customer_Model</class>
63
+ </ng_customer>
64
+ </models>
65
  </global>
66
+ <default>
67
+ <ng_customer>
68
+ <ng_account_navigation>
69
+ <name>Test Link</name>
70
+ </ng_account_navigation>
71
+ </ng_customer>
72
+ </default>
73
  </config>
app/code/community/NG/Customer/etc/system.xml CHANGED
@@ -33,33 +33,160 @@
33
  <show_in_website>1</show_in_website>
34
  <show_in_store>1</show_in_store>
35
  <groups>
36
- <link translate="label" module="ng_customer">
37
- <label>Settings</label>
38
  <frontend_type>text</frontend_type>
39
- <sort_order>0</sort_order>
40
  <show_in_default>1</show_in_default>
41
  <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  <enable translate="label">
45
- <label>Enable</label>
46
  <frontend_type>select</frontend_type>
47
  <source_model>adminhtml/system_config_source_yesno</source_model>
48
- <sort_order>1</sort_order>
49
  <show_in_default>1</show_in_default>
50
  <show_in_website>1</show_in_website>
51
  <show_in_store>1</show_in_store>
52
- </enable>
 
53
  <name translate="label">
54
  <label>Link Name</label>
55
  <frontend_type>text</frontend_type>
56
- <sort_order>2</sort_order>
 
 
 
 
 
 
 
 
 
 
57
  <show_in_default>1</show_in_default>
58
  <show_in_website>1</show_in_website>
59
  <show_in_store>1</show_in_store>
60
- </name>
 
61
  </fields>
62
- </link>
63
  </groups>
64
  </ng_customer>
65
  </sections>
33
  <show_in_website>1</show_in_website>
34
  <show_in_store>1</show_in_store>
35
  <groups>
36
+ <ng_account_navigation translate="label">
37
+ <label>My Account Navigation</label>
38
  <frontend_type>text</frontend_type>
39
+ <sort_order>40</sort_order>
40
  <show_in_default>1</show_in_default>
41
  <show_in_website>1</show_in_website>
42
  <show_in_store>1</show_in_store>
43
  <fields>
44
+ <account_dashboard translate="label">
45
+ <label>Account Dashboard</label>
46
+ <frontend_type>select</frontend_type>
47
+ <source_model>ng_customer/system_config_source_yesno</source_model>
48
+ <sort_order>20</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ </account_dashboard>
53
+ <account_information translate="label">
54
+ <label>Account Information</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>ng_customer/system_config_source_yesno</source_model>
57
+ <sort_order>30</sort_order>
58
+ <show_in_default>1</show_in_default>
59
+ <show_in_website>1</show_in_website>
60
+ <show_in_store>1</show_in_store>
61
+ </account_information>
62
+ <address_book translate="label">
63
+ <label>Address Book</label>
64
+ <frontend_type>select</frontend_type>
65
+ <source_model>ng_customer/system_config_source_yesno</source_model>
66
+ <sort_order>40</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </address_book>
71
+ <my_orders translate="label">
72
+ <label>My Orders</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>ng_customer/system_config_source_yesno</source_model>
75
+ <sort_order>50</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </my_orders>
80
+ <billing_agreements translate="label">
81
+ <label>Billing Agreements</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>ng_customer/system_config_source_yesno</source_model>
84
+ <sort_order>60</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </billing_agreements>
89
+ <recurring_profiles translate="label">
90
+ <label>Recurring Profiles</label>
91
+ <frontend_type>select</frontend_type>
92
+ <source_model>ng_customer/system_config_source_yesno</source_model>
93
+ <sort_order>70</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </recurring_profiles>
98
+ <my_product_reviews translate="label">
99
+ <label>My Product Reviews</label>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>ng_customer/system_config_source_yesno</source_model>
102
+ <sort_order>80</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </my_product_reviews>
107
+ <my_tags translate="label">
108
+ <label>My Tags</label>
109
+ <frontend_type>select</frontend_type>
110
+ <source_model>ng_customer/system_config_source_yesno</source_model>
111
+ <sort_order>90</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </my_tags>
116
+ <my_wishlist translate="label">
117
+ <label>My Wishlist</label>
118
+ <frontend_type>select</frontend_type>
119
+ <source_model>ng_customer/system_config_source_yesno</source_model>
120
+ <sort_order>100</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </my_wishlist>
125
+ <my_applications translate="label">
126
+ <label>My Applications</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>ng_customer/system_config_source_yesno</source_model>
129
+ <sort_order>101</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ </my_applications>
134
+ <my_downloadable_products translate="label">
135
+ <label>My Downloadable Products</label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>ng_customer/system_config_source_yesno</source_model>
138
+ <sort_order>110</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ </my_downloadable_products>
143
+ <newsletter_subscriptions translate="label">
144
+ <label>Newsletter Subscriptions</label>
145
+ <frontend_type>select</frontend_type>
146
+ <source_model>ng_customer/system_config_source_yesno</source_model>
147
+ <sort_order>120</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </newsletter_subscriptions>
152
+ <add_link translate="label">
153
+ <label>Add New Link</label>
154
+ <frontend_model>ng_customer/system_config_label</frontend_model>
155
+ <sort_order>130</sort_order>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>1</show_in_website>
158
+ </add_link>
159
  <enable translate="label">
160
+ <label>Add New Link</label>
161
  <frontend_type>select</frontend_type>
162
  <source_model>adminhtml/system_config_source_yesno</source_model>
163
+ <sort_order>140</sort_order>
164
  <show_in_default>1</show_in_default>
165
  <show_in_website>1</show_in_website>
166
  <show_in_store>1</show_in_store>
167
+ <tooltip><![CDATA[Select yes to add new link at the bottom of My Account Navigation.]]></tooltip>
168
+ </enable>
169
  <name translate="label">
170
  <label>Link Name</label>
171
  <frontend_type>text</frontend_type>
172
+ <sort_order>150</sort_order>
173
+ <show_in_default>1</show_in_default>
174
+ <show_in_website>1</show_in_website>
175
+ <show_in_store>1</show_in_store>
176
+ <tooltip><![CDATA[Entered name will add link "Test Link" at the bottom of My Account Navigation and corresponding page.]]></tooltip>
177
+ </name>
178
+ <logout translate="label">
179
+ <label>Add "Log Out"</label>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>adminhtml/system_config_source_yesno</source_model>
182
+ <sort_order>160</sort_order>
183
  <show_in_default>1</show_in_default>
184
  <show_in_website>1</show_in_website>
185
  <show_in_store>1</show_in_store>
186
+ <tooltip><![CDATA[Enabling this option will add 'Log Out' link at the bottom of My Account Navigation.]]></tooltip>
187
+ </logout>
188
  </fields>
189
+ </ng_account_navigation>
190
  </groups>
191
  </ng_customer>
192
  </sections>
app/design/frontend/base/default/layout/ng_customer.xml CHANGED
@@ -19,7 +19,7 @@
19
  <layout>
20
  <customer_account>
21
  <reference name="customer_account_navigation">
22
- <action method="addLink" ifconfig="ng_customer/link/enable">
23
  <name>custom_module_section</name>
24
  <path>ng_customer/index/index</path>
25
  <label helper="ng_customer/data/getLinkLabel" />
@@ -33,4 +33,50 @@
33
  <block type="core/template" name="ng_customer_content" template="Customer/link.phtml"/>
34
  </reference>
35
  </ng_customer_index_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  </layout>
19
  <layout>
20
  <customer_account>
21
  <reference name="customer_account_navigation">
22
+ <action method="addLink" ifconfig="ng_customer/ng_account_navigation/enable">
23
  <name>custom_module_section</name>
24
  <path>ng_customer/index/index</path>
25
  <label helper="ng_customer/data/getLinkLabel" />
33
  <block type="core/template" name="ng_customer_content" template="Customer/link.phtml"/>
34
  </reference>
35
  </ng_customer_index_index>
36
+
37
+ <customer_account>
38
+ <reference name="customer_account_navigation">
39
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/account_dashboard">
40
+ <name>account</name>
41
+ </action>
42
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/account_information">
43
+ <name>account_edit</name>
44
+ </action>
45
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/address_book">
46
+ <name>address_book</name>
47
+ </action>
48
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_orders">
49
+ <name>orders</name>
50
+ </action>
51
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_tags">
52
+ <name>tags</name>
53
+ </action>
54
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_wishlist">
55
+ <name>wishlist</name>
56
+ </action>
57
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_applications">
58
+ <name>OAuth Customer Tokens</name>
59
+ </action>
60
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/recurring_profiles">
61
+ <name>recurring_profiles</name>
62
+ </action>
63
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/billing_agreements">
64
+ <name>billing_agreements</name>
65
+ </action>
66
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_downloadable_products">
67
+ <name>downloadable_products</name>
68
+ </action>
69
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/my_product_reviews">
70
+ <name>reviews</name>
71
+ </action>
72
+ <action method="removeLinkByName" ifconfig="ng_customer/ng_account_navigation/newsletter_subscriptions">
73
+ <name>newsletter</name>
74
+ </action>
75
+ <action method="addLink" translate="label" module="ng_customer" ifconfig="ng_customer/ng_account_navigation/logout" after="-">
76
+ <name>logout</name>
77
+ <path>customer/account/logout</path>
78
+ <label>Log Out</label>
79
+ </action>
80
+ </reference>
81
+ </customer_account>
82
  </layout>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ng_customer</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>MIT</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension is related to add new link in my account left navigation bar and add its respective page.</summary>
10
- <description>This extension is related to add new link in my account left navigation bar and add its respective page.</description>
11
- <notes>First Release</notes>
12
- <authors><author><name>NG</name><user>gargneeraj98</user><email>gargneeraj98@gmail.com</email></author></authors>
13
- <date>2014-12-06</date>
14
- <time>16:21:26</time>
15
- <contents><target name="magecommunity"><dir name="NG"><dir name="Customer"><dir name="Helper"><file name="Data.php" hash="7e4137b3e38ef81c527a5da03982b592"/></dir><dir name="controllers"><file name="IndexController.php" hash="6204bfc42db6e2913c95fd44f0ee391f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aac5d5bd7f02b23d561fd3775702ae05"/><file name="config.xml" hash="095ca191150f6bdd98c67645eb2c06ee"/><file name="system.xml" hash="71e78ae61a42f4f857efccdb155fb870"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ng_customer.xml" hash="00df09add768e9556d4432ab4c623a9d"/></dir><dir name="template"><dir name="Customer"><file name="link.phtml" hash="35905cc0abbad056ec78bd9124817c6b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NG_Customer.xml" hash="c0d9e8763a6504de4d034553f4d4b270"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ng_customer</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>MIT</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension is related to add new link in my account left navigation bar and add its respective page.</summary>
10
+ <description>This extension is related to add new link in my account left navigation bar and add its respective page.It has ability to Enable and disable links in left navigation bar</description>
11
+ <notes>Added ability to enable/ disable my account links</notes>
12
+ <authors><author><name>NG</name><user>extensionsng</user><email>extensionsng@gmail.com</email></author></authors>
13
+ <date>2015-03-01</date>
14
+ <time>18:21:39</time>
15
+ <contents><target name="magecommunity"><dir name="NG"><dir name="Customer"><dir name="Block"><dir name="Account"><file name="Navigation.php" hash="5276c3563791f47ee939e500d139e3bd"/></dir><dir name="System"><dir name="Config"><file name="Label.php" hash="cd4a3c408fcfdf4bca0edae91727f667"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5378f719e3cdb23eaff362dc3af1138a"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Yesno.php" hash="aeb0e125442e2e8511b26230513551fc"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="6204bfc42db6e2913c95fd44f0ee391f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="aac5d5bd7f02b23d561fd3775702ae05"/><file name="config.xml" hash="a3100924249efdb444a71512578e8133"/><file name="system.xml" hash="2050404dcad81531da579d37f46f5ee7"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ng_customer.xml" hash="558b64bb8b1457db83ab24060c1d2ce9"/></dir><dir name="template"><dir name="Customer"><file name="link.phtml" hash="35905cc0abbad056ec78bd9124817c6b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NG_Customer.xml" hash="c0d9e8763a6504de4d034553f4d4b270"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>