Ralab_Guest - Version 1.0.0

Version Notes

- Ability to automatically convert guest users into registered users.

- Added feature to auto-generates password for the new guest users and sends welcome email to these users

Download this release

Release Info

Developer Kalpesh Balar
Extension Ralab_Guest
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Ralab/Guest/Helper/Data.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Data helper
4
+ *
5
+ * @category Ralab
6
+ * @package Ralab_Guest
7
+ * @author Kalpesh Balar <kalpesh.balar@gmail.com>
8
+ * @copyright Ralab (http://ralab.in)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Ralab_Guest_Helper_Data extends Mage_Core_Helper_Abstract
12
+ {
13
+ }
app/code/community/Ralab/Guest/Model/Config.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ralab Register Config
4
+ *
5
+ * @category Ralab
6
+ * @package Ralab_Guest
7
+ * @author Kalpesh Balar <kalpesh.balar@gmail.com>
8
+ * @copyright Ralab (http://ralab.in)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+ class Ralab_Guest_Model_Config
12
+ {
13
+ const XML_PATH_ENABLED = 'customer/guestregister/enabled';
14
+
15
+ public function isEnabled($storeId=null)
16
+ {
17
+ if( Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId))
18
+ {
19
+ return true;
20
+ }
21
+
22
+ return false;
23
+ }
24
+ }
app/code/community/Ralab/Guest/Model/Observer.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ralab Register Observer
4
+ *
5
+ * @category Ralab
6
+ * @package Ralab_Guest
7
+ * @author Kalpesh Balar <kalpesh.balar@gmail.com>
8
+ * @copyright Ralab (http://ralab.in)
9
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
+ */
11
+
12
+ class Ralab_Guest_Model_Observer
13
+ {
14
+ public function registerGuestUser($observer)
15
+ {
16
+ if (!Mage::getSingleton('guest/config')->isEnabled()) {
17
+ return;
18
+ }
19
+
20
+ $order = $observer->getEvent()->getOrder();
21
+
22
+ $autoregister_array["customerSaved"] = false;
23
+ $email = $order->getCustomerEmail();
24
+ $firstname = $order->getCustomerFirstname();
25
+ $lastname = $order->getCustomerLastname();
26
+
27
+ $customer = Mage::getModel('customer/customer');
28
+
29
+ $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
30
+
31
+ if (!$customer->getId()) {
32
+
33
+ $randomPassword = $customer->generatePassword(12);
34
+ $customer->setId(null)
35
+ ->setSkipConfirmationIfEmail($email)
36
+ ->setFirstname($firstname)
37
+ ->setLastname($lastname)
38
+ ->setEmail($email)
39
+ ->setPassword($randomPassword)
40
+ ->setConfirmation($randomPassword);
41
+ ->setPasswordConfirmation($randomPassword);
42
+
43
+ $errors = array();
44
+ $validationCustomer = $customer->validate();
45
+
46
+ if (is_array($validationCustomer)) {
47
+ $errors = array_merge($validationCustomer, $errors);
48
+ }
49
+
50
+ $validationResult = count($errors) == 0;
51
+
52
+ if (true === $validationResult) {
53
+ $customer->save();
54
+ $autoregister_array["customerSaved"] = true;
55
+ $customer->sendNewAccountEmail();
56
+ } else {
57
+ Mage::log($errors);
58
+ }
59
+ }
60
+ }
61
+ }
app/code/community/Ralab/Guest/etc/config.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ralab_Guest>
5
+ <version>1.0.0</version>
6
+ </Ralab_Guest>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <guest>
11
+ <class>Ralab_Guest_Model</class>
12
+ </guest>
13
+ </models>
14
+ <helpers>
15
+ <guest>
16
+ <class>Ralab_Guest_Helper</class>
17
+ </guest>
18
+ </helpers>
19
+ <events>
20
+ <sales_order_place_after>
21
+ <observers>
22
+ <guest>
23
+ <class>guest/observer</class>
24
+ <method>registerGuestUser</method>
25
+ </guest>
26
+ </observers>
27
+ </sales_order_place_after>
28
+ </events>
29
+ </global>
30
+ </config>
app/code/community/Ralab/Guest/etc/system.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * @category Ralab
5
+ * @package Ralab_Guest
6
+ * @author Kalpesh Balar <kalpesh.balar@gmail.com>
7
+ * @copyright Ralab (http://ralab.in)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <sections>
13
+ <customer>
14
+ <groups>
15
+ <guestregister translate="label" module="guest">
16
+ <label>Guest User Registraton</label>
17
+ <frontend_type>text</frontend_type>
18
+ <sort_order>100</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ <fields>
23
+ <enabled translate="label">
24
+ <label>Enabled</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </enabled>
32
+ </fields>
33
+ </guestregister>
34
+ </groups>
35
+ </customer>
36
+ </sections>
37
+ </config>
app/etc/modules/Ralab_Guest.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ralab_Guest>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ralab_Guest>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ralab_Guest</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>Adds the ability convert all guest users into registered customers. </summary>
10
+ <description>Features Overview&#xD;
11
+ &#xD;
12
+ - Ability to automatically convert guest users into registered users.&#xD;
13
+ &#xD;
14
+ - This extension auto-generates password for the new guest users and sends welcome email to these users&#xD;
15
+ &#xD;
16
+ </description>
17
+ <notes>- Ability to automatically convert guest users into registered users.&#xD;
18
+ &#xD;
19
+ - Added feature to auto-generates password for the new guest users and sends welcome email to these users</notes>
20
+ <authors><author><name>Kalpesh Balar</name><user>kalpeshbalar</user><email>kalpeshbalar@gmail.com</email></author></authors>
21
+ <date>2015-04-09</date>
22
+ <time>10:55:50</time>
23
+ <contents><target name="magecommunity"><dir name="Ralab"><dir name="Guest"><dir name="Helper"><file name="Data.php" hash="16b0e4fd585dbdfb24b0b61b1991d7a4"/></dir><dir name="Model"><file name="Config.php" hash="61ed3d30d3825c060e1169ceceef46c9"/><file name="Observer.php" hash="9496a05ad83df344f613a2d5b410aaef"/></dir><dir name="etc"><file name="config.xml" hash="24704c1c4e5ae10abe259f8f59590b78"/><file name="system.xml" hash="a72ce5512f3d87da4a0517438b8be2da"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ralab_Guest.xml" hash="ee56818ba74d61f7833f601bdf25a741"/></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
26
+ </package>