Version Notes
First Preview Release
Download this release
Release Info
Developer | NetGo |
Extension | Netgo_UserandMobile |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Netgo/UserandMobile/Block/Adminhtml/UserandMobilebackend.php +15 -0
- app/code/community/Netgo/UserandMobile/Block/Index.php +15 -0
- app/code/community/Netgo/UserandMobile/Block/Left.php +15 -0
- app/code/community/Netgo/UserandMobile/Helper/Data.php +44 -0
- app/code/community/Netgo/UserandMobile/controllers/Adminhtml/UserandmobilebackendController.php +21 -0
- app/code/community/Netgo/UserandMobile/controllers/Customer/AccountController.php +68 -0
- app/code/community/Netgo/UserandMobile/controllers/IndexController.php +33 -0
- app/code/community/Netgo/UserandMobile/etc/adminhtml.xml +36 -0
- app/code/community/Netgo/UserandMobile/etc/config.xml +137 -0
- app/code/community/Netgo/UserandMobile/etc/system.xml +55 -0
- app/code/community/Netgo/UserandMobile/sql/userandmobile_setup/install-0.1.0.php +75 -0
- app/code/community/Netgo/UserandMobile/sql/userandmobile_setup/install-0.1.0.php-- +66 -0
- app/etc/modules/Netgo_UserandMobile.xml +23 -0
- package.xml +22 -0
- readme.txt +29 -0
app/code/community/Netgo/UserandMobile/Block/Adminhtml/UserandMobilebackend.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_Block_Adminhtml_UserandMobilebackend extends Mage_Adminhtml_Block_Template {
|
14 |
+
|
15 |
+
}
|
app/code/community/Netgo/UserandMobile/Block/Index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_Block_Index extends Mage_Core_Block_Template{
|
14 |
+
|
15 |
+
}
|
app/code/community/Netgo/UserandMobile/Block/Left.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_Block_Left extends Mage_Core_Block_Template{
|
14 |
+
|
15 |
+
}
|
app/code/community/Netgo/UserandMobile/Helper/Data.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_Helper_Data extends Mage_Core_Helper_Abstract
|
14 |
+
{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Gets allowed ip-addresses from configuration
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
public function getAllowedIps()
|
21 |
+
{
|
22 |
+
$ipsList = array();
|
23 |
+
$ipsText = '127.0.0.1,43.252.34.12'; // Comma separated list of allowed IP
|
24 |
+
$ipsList = explode(',', $ipsText);
|
25 |
+
$ipsList = array_map('trim', $ipsList);
|
26 |
+
|
27 |
+
return $ipsList;
|
28 |
+
}
|
29 |
+
/**
|
30 |
+
* Checks if remote ip is allowed
|
31 |
+
* @param array $allowedList
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
+
public function checkAllowedIp($allowedList)
|
35 |
+
{
|
36 |
+
if (count($allowedList) > 0) {
|
37 |
+
$remoteIp = Mage::helper('core/http')->getRemoteAddr();
|
38 |
+
if (in_array($remoteIp, $allowedList))
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
app/code/community/Netgo/UserandMobile/controllers/Adminhtml/UserandmobilebackendController.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_Adminhtml_UserandmobilebackendController extends Mage_Adminhtml_Controller_Action
|
14 |
+
{
|
15 |
+
public function indexAction()
|
16 |
+
{
|
17 |
+
$this->loadLayout();
|
18 |
+
$this->_title($this->__("Backend Page Title"));
|
19 |
+
$this->renderLayout();
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Netgo/UserandMobile/controllers/Customer/AccountController.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
require_once "Mage/Customer/controllers/AccountController.php";
|
14 |
+
class Netgo_UserandMobile_Customer_AccountController extends Mage_Customer_AccountController{
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Processes login action
|
18 |
+
* @return bool
|
19 |
+
* @throws Exception
|
20 |
+
*/
|
21 |
+
public function loginPostAction()
|
22 |
+
{
|
23 |
+
$session = $this->_getSession();
|
24 |
+
|
25 |
+
$collection = Mage::getModel('customer/customer')->getCollection();
|
26 |
+
$username = $this->getRequest()->getPost();
|
27 |
+
$usermobile = $username['login']['username'];
|
28 |
+
$website_id = Mage::app()->getWebsite()->getId();
|
29 |
+
$collection->addAttributeToFilter('mobile', array('eq' =>$username['login']['username']));
|
30 |
+
$custData = $collection->getData();
|
31 |
+
$email = trim($custData[0]['email']);
|
32 |
+
$customerId = (int) trim($custData[0]['entity_id']);
|
33 |
+
try{
|
34 |
+
$authenticateUser = Mage::getModel('customer/customer')->setWebsiteId($website_id)->authenticate($email, $username['login']['password']);
|
35 |
+
}catch( Exception $e ){
|
36 |
+
$session->addError('Invalid Login Detail');
|
37 |
+
$this->_redirect('customer/account');
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
try{
|
42 |
+
if($authenticateUser && $customerId){
|
43 |
+
|
44 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
45 |
+
$session->setCustomerAsLoggedIn($customer);
|
46 |
+
$message = $this->__('You are now logged in as %s', $customer->getName());
|
47 |
+
$session->addSuccess($message);
|
48 |
+
Mage::log($message);
|
49 |
+
}else{
|
50 |
+
throw new Exception ($this->__('The login attempt was unsuccessful. Some parameter is missing Or wrong data '));
|
51 |
+
}
|
52 |
+
}catch (Exception $e){
|
53 |
+
$session->addError($e->getMessage());
|
54 |
+
}
|
55 |
+
$this->_redirect('customer/account');
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Gets customer session
|
61 |
+
* @return Mage_Core_Model_Abstract
|
62 |
+
*/
|
63 |
+
protected function _getSession()
|
64 |
+
{
|
65 |
+
return Mage::getSingleton('customer/session');
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
app/code/community/Netgo/UserandMobile/controllers/IndexController.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
class Netgo_UserandMobile_IndexController extends Mage_Core_Controller_Front_Action{
|
14 |
+
public function IndexAction() {
|
15 |
+
|
16 |
+
$this->loadLayout();
|
17 |
+
$this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
|
18 |
+
$breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
|
19 |
+
$breadcrumbs->addCrumb("home", array(
|
20 |
+
"label" => $this->__("Home Page"),
|
21 |
+
"title" => $this->__("Home Page"),
|
22 |
+
"link" => Mage::getBaseUrl()
|
23 |
+
));
|
24 |
+
|
25 |
+
$breadcrumbs->addCrumb("titlename", array(
|
26 |
+
"label" => $this->__("Titlename"),
|
27 |
+
"title" => $this->__("Titlename")
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->renderLayout();
|
31 |
+
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Netgo/UserandMobile/etc/adminhtml.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Login With Mobile Number Extension ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_UserandMobile
|
10 |
+
* @author Vipin
|
11 |
+
* @dev 77vips@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<acl>
|
17 |
+
<resources>
|
18 |
+
<admin>
|
19 |
+
<children>
|
20 |
+
<system>
|
21 |
+
<children>
|
22 |
+
<config>
|
23 |
+
<children>
|
24 |
+
<userandmobile translate="title" module="userandmobile">
|
25 |
+
<title>Username and Mobile Section</title>
|
26 |
+
<sort_order>0</sort_order>
|
27 |
+
</userandmobile>
|
28 |
+
</children>
|
29 |
+
</config>
|
30 |
+
</children>
|
31 |
+
</system>
|
32 |
+
</children>
|
33 |
+
</admin>
|
34 |
+
</resources>
|
35 |
+
</acl>
|
36 |
+
</config>
|
app/code/community/Netgo/UserandMobile/etc/config.xml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Login With Mobile Number Extension ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_UserandMobile
|
10 |
+
* @author Vipin
|
11 |
+
* @dev 77vips@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<modules>
|
17 |
+
<Netgo_UserandMobile>
|
18 |
+
<version>0.1.0</version>
|
19 |
+
</Netgo_UserandMobile>
|
20 |
+
</modules>
|
21 |
+
<frontend>
|
22 |
+
<routers>
|
23 |
+
<userandmobile>
|
24 |
+
<use>standard</use>
|
25 |
+
<args>
|
26 |
+
<module>Netgo_UserandMobile</module>
|
27 |
+
<frontName>userandmobile</frontName>
|
28 |
+
</args>
|
29 |
+
</userandmobile>
|
30 |
+
</routers>
|
31 |
+
<!--<layout>
|
32 |
+
<updates>
|
33 |
+
<userandmobile>
|
34 |
+
<file>userandmobile.xml</file>
|
35 |
+
</userandmobile>
|
36 |
+
</updates>
|
37 |
+
</layout>-->
|
38 |
+
</frontend>
|
39 |
+
<global>
|
40 |
+
<rewrite>
|
41 |
+
<netgo_userandmobile_customer_accountcontroller>
|
42 |
+
<from><![CDATA[#^/customer/account/#]]></from> <!-- Mage_Customer_AccountController -->
|
43 |
+
<to>/userandmobile/customer_account/</to> <!-- Netgo_UserandMobile_Customer_AccountController -->
|
44 |
+
</netgo_userandmobile_customer_accountcontroller>
|
45 |
+
</rewrite>
|
46 |
+
<helpers>
|
47 |
+
<userandmobile>
|
48 |
+
<class>Netgo_UserandMobile_Helper</class>
|
49 |
+
</userandmobile>
|
50 |
+
</helpers>
|
51 |
+
<blocks>
|
52 |
+
<userandmobile>
|
53 |
+
<class>Netgo_UserandMobile_Block</class>
|
54 |
+
</userandmobile>
|
55 |
+
</blocks>
|
56 |
+
<models>
|
57 |
+
<userandmobile>
|
58 |
+
<class>Netgo_UserandMobile_Model</class>
|
59 |
+
<resourceModel>userandmobile_mysql4</resourceModel>
|
60 |
+
</userandmobile>
|
61 |
+
</models>
|
62 |
+
<resources>
|
63 |
+
<userandmobile_setup>
|
64 |
+
<setup>
|
65 |
+
<module>Netgo_UserandMobile</module>
|
66 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
67 |
+
</setup>
|
68 |
+
<connection>
|
69 |
+
<use>core_setup</use>
|
70 |
+
</connection>
|
71 |
+
</userandmobile_setup>
|
72 |
+
<userandmobile_write>
|
73 |
+
<connection>
|
74 |
+
<use>core_write</use>
|
75 |
+
</connection>
|
76 |
+
</userandmobile_write>
|
77 |
+
<userandmobile_read>
|
78 |
+
<connection>
|
79 |
+
<use>core_read</use>
|
80 |
+
</connection>
|
81 |
+
</userandmobile_read>
|
82 |
+
</resources>
|
83 |
+
</global>
|
84 |
+
<admin>
|
85 |
+
<routers>
|
86 |
+
<userandmobile>
|
87 |
+
<use>admin</use>
|
88 |
+
<args>
|
89 |
+
<module>Netgo_UserandMobile</module>
|
90 |
+
<frontName>admin_userandmobile</frontName>
|
91 |
+
</args>
|
92 |
+
</userandmobile>
|
93 |
+
</routers>
|
94 |
+
</admin>
|
95 |
+
<adminhtml>
|
96 |
+
<!--<menu>
|
97 |
+
<userandmobile module="userandmobile">
|
98 |
+
<title>UserandMobile</title>
|
99 |
+
<sort_order>100</sort_order>
|
100 |
+
<children>
|
101 |
+
<userandmobilebackend module="userandmobile">
|
102 |
+
<title>Backend Page Title</title>
|
103 |
+
<sort_order>0</sort_order>
|
104 |
+
<action>admin_userandmobile/adminhtml_userandmobilebackend</action>
|
105 |
+
</userandmobilebackend>
|
106 |
+
</children>
|
107 |
+
</userandmobile>
|
108 |
+
</menu>-->
|
109 |
+
<acl>
|
110 |
+
<resources>
|
111 |
+
<all>
|
112 |
+
<title>Allow Everything</title>
|
113 |
+
</all>
|
114 |
+
<admin>
|
115 |
+
<children>
|
116 |
+
<userandmobile translate="title" module="userandmobile">
|
117 |
+
<title>UserandMobile</title>
|
118 |
+
<sort_order>1000</sort_order>
|
119 |
+
<children>
|
120 |
+
<userandmobilebackend translate="title">
|
121 |
+
<title>Backend Page Title</title>
|
122 |
+
</userandmobilebackend>
|
123 |
+
</children>
|
124 |
+
</userandmobile>
|
125 |
+
</children>
|
126 |
+
</admin>
|
127 |
+
</resources>
|
128 |
+
</acl>
|
129 |
+
<!--<layout>
|
130 |
+
<updates>
|
131 |
+
<userandmobile>
|
132 |
+
<file>userandmobile.xml</file>
|
133 |
+
</userandmobile>
|
134 |
+
</updates>
|
135 |
+
</layout>-->
|
136 |
+
</adminhtml>
|
137 |
+
</config>
|
app/code/community/Netgo/UserandMobile/etc/system.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Login With Mobile Number Extension ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_UserandMobile
|
10 |
+
* @author Vipin
|
11 |
+
* @dev 77vips@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<tabs>
|
17 |
+
<netgo translate="label" module="userandmobile">
|
18 |
+
<label>Netgo</label>
|
19 |
+
<sort_order>0</sort_order>
|
20 |
+
</netgo>
|
21 |
+
</tabs>
|
22 |
+
<sections>
|
23 |
+
<userandmobile translate="label" module="userandmobile">
|
24 |
+
<label>Username and Mobile</label>
|
25 |
+
<tab>customer</tab>
|
26 |
+
<frontend_type>text</frontend_type>
|
27 |
+
<sort_order>0</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 |
+
<groups>
|
32 |
+
<usermobile translate="label">
|
33 |
+
<label>Manage Username and Mobile</label>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>0</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
<fields>
|
40 |
+
<enable translate="label">
|
41 |
+
<label>Enable/Disable</label>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
+
<sort_order>0</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<comment>Please enable/disable module</comment>
|
49 |
+
</enable>
|
50 |
+
</fields>
|
51 |
+
</usermobile>
|
52 |
+
</groups>
|
53 |
+
</userandmobile>
|
54 |
+
</sections>
|
55 |
+
</config>
|
app/code/community/Netgo/UserandMobile/sql/userandmobile_setup/install-0.1.0.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************
|
3 |
+
*** Login With Mobile Number Extension ***
|
4 |
+
***************************************
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2015
|
7 |
+
* @company NetAttingo Technologies
|
8 |
+
* @package Netgo_UserandMobile
|
9 |
+
* @author Vipin
|
10 |
+
* @dev 77vips@gmail.com
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
|
14 |
+
$installer = $this;
|
15 |
+
|
16 |
+
$store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
17 |
+
|
18 |
+
$eavConfig = Mage::getSingleton('eav/config');
|
19 |
+
$attribute = array(
|
20 |
+
'label' => 'mobile',
|
21 |
+
'visible' => true,
|
22 |
+
'required' => false,
|
23 |
+
'type' => 'varchar',
|
24 |
+
'input' => 'text',
|
25 |
+
'sort_order' => 65,
|
26 |
+
'validate_rules' => array(
|
27 |
+
'max_text_length' => 30,
|
28 |
+
'min_text_length' => 1
|
29 |
+
),
|
30 |
+
'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'),
|
31 |
+
);
|
32 |
+
|
33 |
+
$installer->addAttribute('customer','mobile', $attribute);
|
34 |
+
|
35 |
+
$attributes = array('mobile' => $attribute);
|
36 |
+
|
37 |
+
foreach ($attributes as $attributeCode => $data) {
|
38 |
+
$attribute = $eavConfig->getAttribute('customer', $attributeCode);
|
39 |
+
$attribute->setWebsite( (($store->getWebsite())?$store->getWebsite():0));
|
40 |
+
$attribute->addData($data);
|
41 |
+
if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) {
|
42 |
+
$usedInForms = array(
|
43 |
+
'customer_account_create',
|
44 |
+
'customer_account_edit',
|
45 |
+
'checkout_register',
|
46 |
+
);
|
47 |
+
if (!empty($data['adminhtml_only'])) {
|
48 |
+
$usedInForms = array('adminhtml_customer');
|
49 |
+
} else {
|
50 |
+
$usedInForms[] = 'adminhtml_customer';
|
51 |
+
}
|
52 |
+
if (!empty($data['adminhtml_checkout'])) {
|
53 |
+
$usedInForms[] = 'adminhtml_checkout';
|
54 |
+
}else {
|
55 |
+
$usedInForms[] = 'adminhtml_checkout';
|
56 |
+
}
|
57 |
+
|
58 |
+
$attribute->setData('used_in_forms', $usedInForms);
|
59 |
+
}
|
60 |
+
$attribute->save();
|
61 |
+
}
|
62 |
+
|
63 |
+
$installer->startSetup();
|
64 |
+
|
65 |
+
$result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_quote')} like '%customer_mobile%'");
|
66 |
+
if(!is_array($result) || !in_array('customer_mobile', $result)){
|
67 |
+
$installer->run("
|
68 |
+
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
69 |
+
ADD `customer_mobile` VARCHAR( 255 ) NULL AFTER `customer_taxvat`
|
70 |
+
");
|
71 |
+
}
|
72 |
+
|
73 |
+
$installer->endSetup();
|
74 |
+
|
75 |
+
?>
|
app/code/community/Netgo/UserandMobile/sql/userandmobile_setup/install-0.1.0.php--
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
|
4 |
+
/* @var $installer Diglin_Username_Model_Entity_Setup */
|
5 |
+
$store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
6 |
+
|
7 |
+
/* @var $eavConfig Mage_Eav_Model_Config */
|
8 |
+
$eavConfig = Mage::getSingleton('eav/config');
|
9 |
+
|
10 |
+
$attribute = array(
|
11 |
+
'label' => 'Username',
|
12 |
+
'visible' => true,
|
13 |
+
'required' => true,
|
14 |
+
'type' => 'varchar',
|
15 |
+
'input' => 'text',
|
16 |
+
'sort_order' => 65,
|
17 |
+
'validate_rules' => array(
|
18 |
+
'max_text_length' => 30,
|
19 |
+
'min_text_length' => 1
|
20 |
+
),
|
21 |
+
'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'),
|
22 |
+
);
|
23 |
+
|
24 |
+
$installer->addAttribute('customer','username1', $attribute);
|
25 |
+
|
26 |
+
$attributes = array('username1' => $attribute);
|
27 |
+
|
28 |
+
foreach ($attributes as $attributeCode => $data) {
|
29 |
+
$attribute = $eavConfig->getAttribute('customer', $attributeCode);
|
30 |
+
$attribute->setWebsite( (($store->getWebsite())?$store->getWebsite():0));
|
31 |
+
$attribute->addData($data);
|
32 |
+
if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) {
|
33 |
+
$usedInForms = array(
|
34 |
+
'customer_account_create',
|
35 |
+
'customer_account_edit',
|
36 |
+
'checkout_register',
|
37 |
+
);
|
38 |
+
if (!empty($data['adminhtml_only'])) {
|
39 |
+
$usedInForms = array('adminhtml_customer');
|
40 |
+
} else {
|
41 |
+
$usedInForms[] = 'adminhtml_customer';
|
42 |
+
}
|
43 |
+
if (!empty($data['adminhtml_checkout'])) {
|
44 |
+
$usedInForms[] = 'adminhtml_checkout';
|
45 |
+
}else {
|
46 |
+
$usedInForms[] = 'adminhtml_checkout';
|
47 |
+
}
|
48 |
+
|
49 |
+
$attribute->setData('used_in_forms', $usedInForms);
|
50 |
+
}
|
51 |
+
$attribute->save();
|
52 |
+
}
|
53 |
+
|
54 |
+
$installer->startSetup();
|
55 |
+
|
56 |
+
$result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_quote')} like '%customer_username%'");
|
57 |
+
if(!is_array($result) || !in_array('customer_username', $result)){
|
58 |
+
$installer->run("
|
59 |
+
ALTER TABLE `{$this->getTable('sales_flat_quote')}`
|
60 |
+
ADD `customer_username` VARCHAR( 255 ) NULL AFTER `customer_taxvat`
|
61 |
+
");
|
62 |
+
}
|
63 |
+
|
64 |
+
$installer->endSetup();
|
65 |
+
|
66 |
+
?>
|
app/etc/modules/Netgo_UserandMobile.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/***************************************
|
4 |
+
*** Login With Mobile Number Extension ***
|
5 |
+
***************************************
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2015
|
8 |
+
* @company NetAttingo Technologies
|
9 |
+
* @package Netgo_UserandMobile
|
10 |
+
* @author Vipin
|
11 |
+
* @dev 77vips@gmail.com
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
-->
|
15 |
+
<config>
|
16 |
+
<modules>
|
17 |
+
<Netgo_UserandMobile>
|
18 |
+
<active>true</active>
|
19 |
+
<codePool>community</codePool>
|
20 |
+
<version>0.1.0</version>
|
21 |
+
</Netgo_UserandMobile>
|
22 |
+
</modules>
|
23 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Netgo_UserandMobile</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>Allows customer to login by mobile number</summary>
|
10 |
+
<description>This extension covers on the issue to solve if any user do not have email id or remember it. As an alternative to this, we have used Mobile number which is common now a days in use. This technological invention is found easily with every individual and taking advantage of this, we used Mobile number as field for log in.
|
11 |
+

|
12 |
+
Additionally, we have implemented such functionality that this extension will not effect front end files. This will not hamper any design or development in website or overwrite the files.
|
13 |
+

|
14 |
+
To manage this user need to give a code manually as per the instruction mentioned. We will provide the code too.</description>
|
15 |
+
<notes>First Preview Release</notes>
|
16 |
+
<authors><author><name>Vipin</name><user>Netgo</user><email>77vips@gmail.com</email></author></authors>
|
17 |
+
<date>2015-07-22</date>
|
18 |
+
<time>02:33:08</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Netgo"><dir name="UserandMobile"><dir name="Block"><dir name="Adminhtml"><file name="UserandMobilebackend.php" hash="2326928140c84b2abede730f45b4efd1"/></dir><file name="Index.php" hash="2dd9b40c75f9a34d3c32c2da0c9c511f"/><file name="Left.php" hash="27724da5d2012ae5e57bd64e2e0d79c6"/></dir><dir name="Helper"><file name="Data.php" hash="98f97f2a4babb0341cc427af59a36e11"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="UserandmobilebackendController.php" hash="3b7c156702bc890fea0443836a4b8a44"/></dir><dir name="Customer"><file name="AccountController.php" hash="b3dcc1301a052b15130f8066928a0a13"/></dir><file name="IndexController.php" hash="ba582b96acc3868cbf946f6b09697df3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="728bfd3d158f0cb25a661c47809c39d3"/><file name="config.xml" hash="d0007c7b3f50b81adfa79585fce45883"/><file name="system.xml" hash="a4e8feda0115f6c0b46559a09537ccd7"/></dir><dir name="sql"><dir name="userandmobile_setup"><file name="install-0.1.0.php" hash="74e0a57068c6958d7dfb0147a6e3e669"/><file name="install-0.1.0.php--" hash="d8e87b6948cb22ce785df83c6abc90fd"/></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="readme.txt" hash="bb035cdd5a9a6fe53e34034d35ec6873"/></dir></target><target name="mageetc"><dir name="modules"><file name="Netgo_UserandMobile.xml" hash="ec9d2fc4c023d6d23af1db61cb5ebd9a"/></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|
readme.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/************************
|
2 |
+
*** How to Use ***
|
3 |
+
************************/
|
4 |
+
|
5 |
+
1) Install this extension using Magento Connect.
|
6 |
+
|
7 |
+
2) Open "app/design/frontend/your theme package/default or your theme name/template/persistent/customer/form/register.phtml"
|
8 |
+
|
9 |
+
3) Put following code just after email.
|
10 |
+
|
11 |
+
<div class="field mobile">
|
12 |
+
<label for="mobile" class="required"><em>*</em>Mobile</label>
|
13 |
+
<div class="input-box">
|
14 |
+
<input type="text" id="mobile" name="mobile" value="" title="Mobile Number" maxlength="20" class="input-text required-entry">
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
4) Now open app/design/frontend/your theme package/default or your theme name/template/persistent/customer/form/login.phtml
|
19 |
+
|
20 |
+
5) Comment the email html and put following code just after email html you commented.
|
21 |
+
|
22 |
+
<li>
|
23 |
+
<label for="mobile" class="required"><em>*</em>Mobile Number</label>
|
24 |
+
<div class="input-box">
|
25 |
+
<input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
|
26 |
+
</div>
|
27 |
+
</li>
|
28 |
+
|
29 |
+
6) Now register yourself and login by mobile number.
|