ip_redirection - Version 1.0.0.0

Version Notes

Custom Redirection after Login, Logged Out and signup into the website.

Download this release

Release Info

Developer iPragmatech
Extension ip_redirection
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

app/code/local/Ip/Redirection/Controller/Observer.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ip_Redirection_Controller_Observer
4
+ {
5
+
6
+ }
app/code/local/Ip/Redirection/Helper/Data.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ip_Redirection_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const XML_CONFIG_PATH = 'redirection/settings/';
5
+
6
+ public function getConfigValue($key, $ipobject = '')
7
+ {
8
+ return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key, $ipobject);
9
+ }
10
+
11
+ /*method for login redirection */
12
+ public function setRedirectOnLogin(){
13
+ $_path = (string) $this->_getConfigValue('path_redirect');
14
+ return Mage::getUrl($_path);
15
+ }
16
+
17
+ /*method for Signup redirection */
18
+ public function setRedirectOnSignup(){
19
+ $_path = (string) $this->_getConfigValue('signup_path_redirect');
20
+ return Mage::getUrl($_path);
21
+ }
22
+
23
+ /*method for Logpout redirection */
24
+ public function setRedirectOnLogout(){
25
+ $_path = (string) $this->_getConfigValue('logout_path_redirect');
26
+ return $_path;
27
+ }
28
+
29
+ public function isEnabled()
30
+ {
31
+ return (bool) $this->_getConfigValue('enabled');
32
+ }
33
+
34
+ public function isoptionEnabled($value)
35
+ {
36
+ return (bool) $this->_getConfigValue($value);
37
+ }
38
+
39
+ protected function _getConfigValue($key)
40
+ {
41
+ return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key);
42
+ }
43
+ }
app/code/local/Ip/Redirection/Model/Observer/Customer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ip_Redirection_Model_Observer_Customer extends Varien_Event_Observer
3
+ {
4
+ /*method for Login Redirection*/
5
+ public function customerLogin(Varien_Event_Observer $observer)
6
+ {
7
+ if (Mage::helper('redirection')->isEnabled()){
8
+ $lasturl = Mage::getSingleton('core/session')->getLastUrl();
9
+ if (strpos(Mage::helper('core/http')->getHttpReferer(), 'checkout') === false){
10
+ if (! preg_match("#customer/account/create#", $lasturl) && Mage::helper('redirection')->isoptionEnabled('login_redirection')) {
11
+ if($this->_CustomerGroup()) {
12
+ $_session = $this->_getSession();
13
+ $_session->setBeforeAuthUrl(Mage::helper('redirection')->setRedirectOnLogin());
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+
20
+ /*method for SignUp Redirection*/
21
+ public function customerRegistration(Varien_Event_Observer $observer)
22
+ {
23
+ if (Mage::helper('redirection')->isEnabled() && Mage::helper('redirection')->isoptionEnabled('registration_redirection')) {
24
+ $_session = $this->_getSession();
25
+ $_session->setBeforeAuthUrl(Mage::helper('redirection')->setRedirectOnSignup());
26
+ }
27
+ }
28
+
29
+ /*method for Logout Redirection*/
30
+ public function customerLogout(Varien_Event_Observer $observer)
31
+ {
32
+ if (Mage::helper('redirection')->isEnabled() && Mage::helper('redirection')->isoptionEnabled('logout_redirection')) {
33
+ if($this->_CustomerGroup()) {
34
+ $observer->getControllerAction()
35
+ ->setRedirectWithCookieCheck(Mage::helper('redirection')->setRedirectOnLogout());
36
+ }
37
+ }
38
+ }
39
+
40
+ /*check the customer group*/
41
+ protected function _CustomerGroup()
42
+ {
43
+ $customer = $this->_getSession()->getCustomer();
44
+ $group_id = Mage::helper('redirection')->getConfigValue('group');
45
+ if($customer) {
46
+ if($customer->getGroupId() == $group_id) {
47
+ return TRUE;
48
+ }
49
+ }
50
+
51
+ /*redirect for all General/Retailer and Wholeseller*/
52
+ if($group_id == ''){
53
+ return true;
54
+ }
55
+ }
56
+
57
+ protected function _getSession()
58
+ {
59
+ return Mage::getSingleton('customer/session');
60
+ }
61
+
62
+
63
+
64
+
65
+ }
app/code/local/Ip/Redirection/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Custom Redirection</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <redirection translate="title">
15
+ <title>Custom Redirection</title>
16
+ </redirection>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/local/Ip/Redirection/etc/config.xml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ip_Redirection>
5
+ <version>1.0.0</version>
6
+ </Ip_Redirection>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <redirection>
11
+ <class>Ip_Redirection_Helper</class>
12
+ </redirection>
13
+ </helpers>
14
+
15
+ <models>
16
+ <redirection>
17
+ <class>Ip_Redirection_Model</class>
18
+ </redirection>
19
+ </models>
20
+
21
+ </global>
22
+ <frontend>
23
+ <routers>
24
+ <redirection>
25
+ <use>standard</use>
26
+ <args>
27
+ <module>Ip_Redirection</module>
28
+ <frontName>redirection</frontName>
29
+ </args>
30
+ </redirection>
31
+ </routers>
32
+ <events>
33
+ <customer_login>
34
+ <observers>
35
+ <redirection>
36
+ <class>redirection/observer_customer</class>
37
+ <method>customerLogin</method>
38
+ </redirection>
39
+ </observers>
40
+ </customer_login>
41
+ <customer_register_success>
42
+ <observers>
43
+ <redirection>
44
+ <class>redirection/observer_customer</class>
45
+ <method>customerRegistration</method>
46
+ </redirection>
47
+ </observers>
48
+ </customer_register_success>
49
+ <controller_action_postdispatch_customer_account_logout>
50
+ <observers>
51
+ <redirection>
52
+ <class>redirection/observer_customer</class>
53
+ <method>customerLogout</method>
54
+ </redirection>
55
+ </observers>
56
+ </controller_action_postdispatch_customer_account_logout>
57
+ </events>
58
+ </frontend>
59
+ </config>
app/code/local/Ip/Redirection/etc/system.xml ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <iPragmatech translate="label" module="redirection">
5
+ <label>iPragmatech Extension</label>
6
+ <sort_order>300</sort_order>
7
+ </iPragmatech>
8
+ </tabs>
9
+ <sections>
10
+ <redirection translate="label">
11
+ <label>Custom Redirection</label>
12
+ <tab>iPragmatech</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1001</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <settings translate="label">
20
+ <label>Custom Redirection Setting</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>100</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label comment">
28
+ <label>Redirection Setting</label>
29
+ <!-- <comment><![CDATA[]]></comment> -->
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabled>
37
+ <group translate="label comment">
38
+ <label>Customer Group</label>
39
+ <comment>
40
+ <![CDATA[
41
+ <div style="width: 257px;margin-top:3px;padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
42
+ Please select the Customer Group on which you want to apply redirection.
43
+ If not select any Customer Group then Redirection will apply for all Customer.
44
+ </div>
45
+ ]]>
46
+ </comment>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
49
+ <sort_order>2</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <depends>
54
+ <enabled>1</enabled>
55
+ </depends>
56
+ </group>
57
+ <login_redirection>
58
+ <label>Login Redirection</label>
59
+ <!-- <comment><![CDATA[]]></comment> -->
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>3</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <depends>
67
+ <enabled>1</enabled>
68
+ </depends>
69
+ </login_redirection>
70
+ <path_redirect>
71
+ <label>Path Redirect</label>
72
+ <comment>
73
+ <![CDATA[
74
+ <div style="width: 257px;margin-top:3px;padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
75
+ Please Enter the Custom Url Redirection after Login.
76
+ <b><br />Example: <br />
77
+ customer/account
78
+ <br />catalog/seo_sitemap/category </b>
79
+ </div>
80
+ ]]>
81
+ </comment>
82
+ <frontend_type>text</frontend_type>
83
+ <validate>validate-text</validate>
84
+ <sort_order>4</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
+ <depends>
89
+ <login_redirection>1</login_redirection>
90
+ <enabled>1</enabled>
91
+ </depends>
92
+ </path_redirect>
93
+ <logout_redirection>
94
+ <label>Logout Redirection</label>
95
+ <!-- <comment><![CDATA[]]></comment> -->
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <sort_order>5</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ <depends>
103
+ <enabled>1</enabled>
104
+ </depends>
105
+ </logout_redirection>
106
+ <logout_path_redirect>
107
+ <label>Logout Path Redirect</label>
108
+ <comment>
109
+ <![CDATA[
110
+ <div style="width: 257px;margin-top:3px;padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
111
+ Please Enter the Custom Url Redirection after Logout.
112
+ <b><br />Example: <br />
113
+ customer/account
114
+ <br />catalog/seo_sitemap/category </b>
115
+ </div>
116
+ ]]>
117
+ </comment>
118
+ <frontend_type>text</frontend_type>
119
+ <validate>validate-text</validate>
120
+ <sort_order>6</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
+ <depends>
125
+ <logout_redirection>1</logout_redirection>
126
+ <enabled>1</enabled>
127
+ </depends>
128
+ </logout_path_redirect>
129
+ <registration_redirection>
130
+ <label>SignUp Redirection</label>
131
+ <!-- <comment><![CDATA[]]></comment> -->
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>7</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ <depends>
139
+ <enabled>1</enabled>
140
+ </depends>
141
+ </registration_redirection>
142
+ <signup_path_redirect>
143
+ <label>SignUp Path Redirect</label>
144
+ <comment>
145
+ <![CDATA[
146
+ <div style="width: 257px;margin-top:3px;padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
147
+ Please Enter the Custom Url Redirection after Signup.
148
+ <b><br />Example: <br />
149
+ customer/account
150
+ <br />catalog/seo_sitemap/category </b>
151
+ </div>
152
+ ]]>
153
+ </comment>
154
+ <frontend_type>text</frontend_type>
155
+ <validate>validate-text</validate>
156
+ <sort_order>8</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ <depends>
161
+ <registration_redirection>1</registration_redirection>
162
+ <enabled>1</enabled>
163
+ </depends>
164
+ </signup_path_redirect>
165
+ </fields>
166
+ </settings>
167
+ </groups>
168
+ </redirection>
169
+ </sections>
170
+ </config>
app/etc/modules/Ip_Redirection.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Phoenix
17
+ * @package Phoenix_Moneybookers
18
+ * @copyright Copyright (c) 2014 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Ip_Redirection>
25
+ <active>true</active>
26
+ <codePool>local</codePool>
27
+ </Ip_Redirection>
28
+ </modules>
29
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ip_redirection</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public Licence (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Custom Redirection after Login, Logged Out and signup into the website.</summary>
10
+ <description>Custom Redirection after Login, Logged Out and signup into the website.</description>
11
+ <notes>Custom Redirection after Login, Logged Out and signup into the website.</notes>
12
+ <authors><author><name>iPragmatech</name><user>iPragmatech</user><email>info@ipragmatech.com</email></author></authors>
13
+ <date>2014-11-16</date>
14
+ <time>12:54:18</time>
15
+ <contents><target name="magelocal"><dir name="Ip"><dir name="Redirection"><dir name="Controller"><file name="Observer.php" hash="6e7b3415242233316fd355eab6df5b0c"/></dir><dir name="Helper"><file name="Data.php" hash="c5d3bc6c7c0cf0b585aa1c51de622d64"/></dir><dir name="Model"><dir name="Observer"><file name="Customer.php" hash="cf58b706dd6b06dbfffa9c42a5affab9"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4424bcfa0900076ebebdbcd2da71def2"/><file name="config.xml" hash="71aa30bf9e51c9c8febad768444adc0e"/><file name="system.xml" hash="84d02bc1a940c9819b361de2f8143470"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ip_Redirection.xml" hash="24b4c0043c79fb9b10818fcec9bfb5fd"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>