Diglin_Username - Version 1.1.0

Version Notes

Version 1.1.0: change the module name from Jfusion_Customer to Diglin_Username, fix bugs with checkout frontend and backend and with old customers
Version 1.0.0 - stable version
Version 1.0.1 - fix bug in sql query during installation on prefixed tables, add german translation, do package for Magento version prior to 1.5 and version 1.5.x
Version 1.0.2 - fix a bug with the installation

Download this release

Release Info

Developer Magento Core Team
Extension Diglin_Username
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

app/code/community/Diglin/Username/Block/Overwrite/Adminhtml/Edit/Tab/Account.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Block_Overwrite_Adminhtml_Edit_Tab_Account extends Mage_Adminhtml_Block_Customer_Edit_Tab_Account
27
+ {
28
+ /**
29
+ * Add the field 'is_active' to the edit tab form
30
+ *
31
+ * @see Mage_Adminhtml_Block_Widget_Form::_prepareForm()
32
+ */
33
+ protected function _prepareForm()
34
+ {
35
+ $customer = Mage::registry('current_customer');
36
+ $form = $this->getForm();
37
+ $fieldset = $form->getElements()->searchById('base_fieldset');
38
+ $fieldset->addField('is_active', 'select',
39
+ array(
40
+ 'name' => 'is_active',
41
+ 'label' => Mage::helper('adminhtml')->__('This account is'),
42
+ 'id' => 'is_active',
43
+ 'title' => Mage::helper('adminhtml')->__('Account status'),
44
+ 'class' => 'input-select',
45
+ 'required' => false,
46
+ 'style' => 'width: 80px',
47
+ 'value' => '1',
48
+ 'values' => array(
49
+ array(
50
+ 'label' => Mage::helper('adminhtml')->__('Active'),
51
+ 'value' => '1',
52
+ ),
53
+ array(
54
+ 'label' => Mage::helper('adminhtml')->__('Inactive'),
55
+ 'value' => '0',
56
+ ),
57
+ ),
58
+ )
59
+ );
60
+
61
+ $form->setValues($customer->getData());
62
+ $this->setForm($form);
63
+ return parent::_prepareForm();
64
+ }
65
+ }
app/code/community/Diglin/Username/Model/Customer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Model_Customer extends Mage_Customer_Model_Customer{
27
+
28
+ /**
29
+ * Authenticate customer
30
+ *
31
+ * @param string $login
32
+ * @param string $password
33
+ * @return true
34
+ * @throws Exception
35
+ */
36
+ public function authenticate($login, $password)
37
+ {
38
+ if(Zend_Validate::is($login, 'EmailAddress')){
39
+ $this->loadByEmail($login);
40
+ }else{
41
+ $this->loadByUsername($login);
42
+ }
43
+ if ($this->getConfirmation() && $this->isConfirmationRequired()) {
44
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
45
+ self::EXCEPTION_EMAIL_NOT_CONFIRMED
46
+ );
47
+ }
48
+ if (!$this->validatePassword($password)) {
49
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'),
50
+ self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
51
+ );
52
+ }
53
+ Mage::dispatchEvent('customer_customer_authenticated', array(
54
+ 'model' => $this,
55
+ 'password' => $password,
56
+ ));
57
+ return true;
58
+ }
59
+
60
+ /**
61
+ * Load customer by username
62
+ *
63
+ * @param string $customerUsername
64
+ * @return Mage_Customer_Model_Customer
65
+ */
66
+ public function loadByUsername($customerUsername)
67
+ {
68
+ $this->_getResource()->loadByUsername($this, $customerUsername);
69
+ return $this;
70
+ }
71
+
72
+ public function customerUsernameExists($username, $websiteId = null)
73
+ {
74
+ if(!is_null($websiteId)){
75
+ $this->setWebsiteId($websiteId);
76
+ }
77
+
78
+ $this->loadByUsername($username);
79
+ if ($this->getId()) {
80
+ return $this;
81
+ }
82
+ return false;
83
+ }
84
+ }
app/code/community/Diglin/Username/Model/Entity/Customer.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Model_Entity_Customer extends Mage_Customer_Model_Entity_Customer{
27
+
28
+ protected function _beforeSave(Varien_Object $customer)
29
+ {
30
+ parent::_beforeSave($customer);
31
+
32
+ if ($customer->getSharingConfig()->isWebsiteScope()) {
33
+ $websiteId = (int) $customer->getWebsiteId();
34
+ }else{
35
+ $websiteId = null;
36
+ }
37
+
38
+ $model = Mage::getModel('customer/customer');
39
+ $result = $model->customerUsernameExists($customer->getUsername(), $websiteId);
40
+ if ($result && $result->getId() != $customer->getId()) {
41
+ throw Mage::exception('Mage_Core', Mage::helper('customer')->__("Username already exists"));
42
+ }
43
+
44
+ return $this;
45
+ }
46
+
47
+ protected function _getDefaultAttributes(){
48
+ $attributes = parent::_getDefaultAttributes();
49
+ array_push($attributes, 'is_active');
50
+ return $attributes;
51
+ }
52
+
53
+ /**
54
+ * Load customer by username
55
+ *
56
+ * @param Mage_Customer_Model_Customer $customer
57
+ * @param string $username
58
+ * @param bool $testOnly
59
+ * @return Mage_Customer_Model_Entity_Customer
60
+ * @throws Mage_Core_Exception
61
+ */
62
+ public function loadByUsername(Mage_Customer_Model_Customer $customer, $username, $testOnly = false)
63
+ {
64
+ $select = $this->_getReadAdapter()->select()
65
+ ->from($this->getEntityTable(), array($this->getEntityIdField()))
66
+ ->joinNatural(array('cev' => $this->getTable('customer_entity_varchar')))
67
+ ->joinNatural(array('ea' => $this->getTable('eav_attribute')))
68
+ ->where('ea.attribute_code=\'username\' AND cev.value=?',$username);
69
+ if ($customer->getSharingConfig()->isWebsiteScope()) {
70
+ if (!$customer->hasData('website_id')) {
71
+ Mage::throwException(Mage::helper('customer')->__('Customer website ID must be specified when using the website scope.'));
72
+ }
73
+ $select->where('website_id=?', (int)$customer->getWebsiteId());
74
+ }
75
+
76
+ if ($id = $this->_getReadAdapter()->fetchOne($select, 'entity_id')) {
77
+ $this->load($customer, $id);
78
+ }
79
+ else {
80
+ $customer->setData(array());
81
+ }
82
+ return $this;
83
+ }
84
+ }
app/code/community/Diglin/Username/Model/Entity/Setup.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup{
27
+
28
+ public function getDefaultEntities(){
29
+ $entities = parent::getDefaultEntities();
30
+
31
+ $entities['customer']['attributes'] = array(
32
+ 'username' => array(
33
+ 'type' => 'varchar',
34
+ 'input' => 'text',
35
+ 'label' => 'Username',
36
+ 'sort_order' => 44,
37
+ )
38
+ );
39
+
40
+ return $entities;
41
+ }
42
+ }
app/code/community/Diglin/Username/Model/Form.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Model_Form extends Mage_Customer_Model_Form
27
+ {
28
+ public function validateData(array $data){
29
+
30
+ $errors = parent::validateData($data);
31
+
32
+ if(isset($data['username'])){
33
+ $model = Mage::getModel('customer/customer');
34
+
35
+ $customerId = Mage::app()->getFrontController()->getRequest()->getParam('customer_id');
36
+ if(!$customerId){
37
+ $customerId = Mage::app()->getFrontController()->getRequest()->getParam('id');
38
+ }
39
+
40
+ if (isset($data['website_id']) && $data['website_id'] !== false) {
41
+ $websiteId = $data['website_id'];
42
+ } elseif ($customerId) {
43
+ $customer = $model->load($customerId);
44
+ $websiteId = $customer->getWebsiteId();
45
+ if($customer->getUsername() == $data['username']){ // don't make any test if the user has already the username
46
+ return $errors;
47
+ }
48
+ } else {
49
+ $websiteId = Mage::app()->getWebsite()->getId();
50
+ }
51
+
52
+
53
+ $result = $model->customerUsernameExists($data['username'], $websiteId);
54
+ if($result && $result->getId() != Mage::app()->getFrontController()->getRequest()->getParam('id')
55
+ && $result->getId() != Mage::getSingleton('customer/session')->getCustomerId('id')){
56
+ $message = Mage::helper('customer')->__("Username already exists");
57
+ if($errors === true){
58
+ $errors = array();
59
+ }
60
+ $errors = array_merge($errors, array($message));
61
+ }
62
+ }
63
+
64
+ if (count($errors) == 0) {
65
+ return true;
66
+ }
67
+
68
+ return $errors;
69
+ }
70
+ }
app/code/community/Diglin/Username/Model/Observer.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ class Diglin_Username_Model_Observer extends Mage_Customer_Model_Observer {
27
+
28
+ public function isActive($observer)
29
+ {
30
+ $customer = $observer->getEvent()->getModel();
31
+ // Add the inactive option - rissip
32
+ if($customer->getIsActive () != '1' ){
33
+ throw new Mage_Core_Exception(Mage::helper('customer')->__('This account is disabled.'), 0);
34
+ }
35
+ }
36
+ }
app/code/community/Diglin/Username/etc/config.xml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Diglin_Username>
5
+ <version>1.1.0</version>
6
+ </Diglin_Username>
7
+ </modules>
8
+
9
+ <global>
10
+ <fieldsets>
11
+ <customer_account>
12
+ <username><create>1</create><update>1</update><to_order>customer_username</to_order><to_quote>customer_username</to_quote></username>
13
+ </customer_account>
14
+ <checkout_onepage_billing>
15
+ <username><to_customer>*</to_customer></username>
16
+ </checkout_onepage_billing>
17
+ <checkout_onepage_quote>
18
+ <customer_username><to_customer>username</to_customer></customer_username>
19
+ </checkout_onepage_quote>
20
+ <sales_convert_quote>
21
+ <customer_username><to_order>*</to_order></customer_username>
22
+ </sales_convert_quote>
23
+ <!-- sales_convert_quote_address>
24
+ <username><to_order_address>*</to_order_address><to_customer_address>*</to_customer_address></username>
25
+ </sales_convert_quote_address-->
26
+ <sales_convert_order>
27
+ <customer_username><to_quote>*</to_quote></customer_username>
28
+ </sales_convert_order>
29
+ </fieldsets>
30
+
31
+ <blocks>
32
+ <adminhtml>
33
+ <rewrite>
34
+ <customer_edit_tab_account>Diglin_Username_Block_Overwrite_Adminhtml_Edit_Tab_Account</customer_edit_tab_account>
35
+ </rewrite>
36
+ </adminhtml>
37
+ </blocks>
38
+ <models>
39
+ <customer>
40
+ <rewrite>
41
+ <customer>Diglin_Username_Model_Customer</customer>
42
+ <form>Diglin_Username_Model_Form</form>
43
+ <observer>Diglin_Username_Model_Observer</observer>
44
+ <setup>Diglin_Username_Model_Setup</setup>
45
+ </rewrite>
46
+ </customer>
47
+ <customer_entity>
48
+ <rewrite>
49
+ <customer>Diglin_Username_Model_Entity_Customer</customer>
50
+ </rewrite>
51
+ </customer_entity>
52
+ </models>
53
+
54
+ <resources>
55
+ <username_setup>
56
+ <setup>
57
+ <module>Diglin_Username</module>
58
+ <class>Diglin_Username_Model_Entity_Setup</class>
59
+ </setup>
60
+ <connection>
61
+ <use>default_setup</use>
62
+ </connection>
63
+ </username_setup>
64
+ </resources>
65
+
66
+ <events>
67
+ <customer_customer_authenticated>
68
+ <observers>
69
+ <customer_observer>
70
+ <type>singleton</type>
71
+ <class>customer/observer</class>
72
+ <method>isActive</method>
73
+ </customer_observer>
74
+ </observers>
75
+ </customer_customer_authenticated>
76
+ </events>
77
+ </global>
78
+
79
+ <frontend>
80
+ <translate>
81
+ <modules>
82
+ <Diglin_Username>
83
+ <files>
84
+ <default>Diglin_Username.csv</default>
85
+ </files>
86
+ </Diglin_Username>
87
+ </modules>
88
+ </translate>
89
+ <layout>
90
+ <updates>
91
+ <username>
92
+ <file>username.xml</file>
93
+ </username>
94
+ </updates>
95
+ </layout>
96
+ </frontend>
97
+ </config>
app/code/community/Diglin/Username/sql/username_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ $installer = $this;
27
+
28
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
29
+ $store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
30
+
31
+ /* @var $eavConfig Mage_Eav_Model_Config */
32
+ $eavConfig = Mage::getSingleton('eav/config');
33
+
34
+ $attribute = array(
35
+ 'label' => 'Username',
36
+ 'visible' => true,
37
+ 'required' => true,
38
+ 'type' => 'varchar',
39
+ 'input' => 'text',
40
+ 'sort_order' => 65,
41
+ 'validate_rules' => array(
42
+ 'max_text_length' => 30,
43
+ 'min_text_length' => 1
44
+ ),
45
+ 'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'),
46
+ );
47
+
48
+ $installer->addAttribute('customer','username', $attribute);
49
+
50
+ $attributes = array('username' => $attribute);
51
+
52
+ foreach ($attributes as $attributeCode => $data) {
53
+ $attribute = $eavConfig->getAttribute('customer', $attributeCode);
54
+ $attribute->setWebsite( (($store->getWebsite())?$store->getWebsite():0));
55
+ $attribute->addData($data);
56
+ if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) {
57
+ $usedInForms = array(
58
+ 'customer_account_create',
59
+ 'customer_account_edit',
60
+ 'checkout_register',
61
+ );
62
+ if (!empty($data['adminhtml_only'])) {
63
+ $usedInForms = array('adminhtml_customer');
64
+ } else {
65
+ $usedInForms[] = 'adminhtml_customer';
66
+ }
67
+ if (!empty($data['adminhtml_checkout'])) {
68
+ $usedInForms[] = 'adminhtml_checkout';
69
+ }else {
70
+ $usedInForms[] = 'adminhtml_checkout';
71
+ }
72
+
73
+ $attribute->setData('used_in_forms', $usedInForms);
74
+ }
75
+ $attribute->save();
76
+ }
77
+
78
+ $installer->startSetup();
79
+
80
+ $result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_quote')} like '%customer_username%'");
81
+ if(!in_array('customer_username', $result)){
82
+ $installer->run("
83
+ ALTER TABLE `{$this->getTable('sales_flat_quote')}`
84
+ ADD `customer_username` VARCHAR( 255 ) NULL AFTER `customer_taxvat`
85
+ ");
86
+ }
87
+
88
+ $installer->endSetup();
app/code/community/Diglin/Username/sql/username_setup/mysql4-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /* @var $installer Diglin_Username_Model_Entity_Setup */
28
+ $installer = $this;
29
+
30
+ /* @var $eavConfig Mage_Eav_Model_Config */
31
+ $eavConfig = Mage::getSingleton('eav/config');
32
+ $usernameAttribute = $eavConfig->getAttribute('customer', 'username');
33
+
34
+ $installer->startSetup();
35
+
36
+ $result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_order')} like '%customer_username%'");
37
+ if(!in_array('customer_username', $result)){
38
+ $installer->run("
39
+ ALTER TABLE `{$this->getTable('sales_flat_order')}`
40
+ ADD `customer_username` VARCHAR( 255 ) NULL AFTER `customer_taxvat`
41
+ ");
42
+ // can be a fix for bug of this module in Magento > 1.5
43
+ }
44
+
45
+
46
+ $select = new Zend_Db_Select($installer->getConnection());
47
+ $select->from(array('c' => $this->getTable('customer_entity')), 'email')
48
+ ->joinLeft(array('cev' => $this->getTable('customer_entity_varchar')), 'c.entity_id = cev.entity_id')
49
+ ->where("cev.entity_id NOT IN (SELECT entity_id FROM `{$this->getTable('customer_entity_varchar')}` WHERE attribute_id = 952)")
50
+ ->group('c.entity_id');
51
+
52
+ // Create username for old customers to prevent problem when creating an order
53
+ $customers = $installer->getConnection()->fetchAll($select);
54
+ foreach ($customers as $customer){
55
+ $customer['attribute_id'] = $usernameAttribute->getId();
56
+ $email = $customer['email'];
57
+ $pos = strpos($email, '@');
58
+ $customer['value'] = substr($email, 0, $pos) . substr(uniqid(), 0, 5);
59
+ unset($customer['email']);
60
+ unset($customer['value_id']);
61
+
62
+ $installer->getConnection()->insert($this->getTable('customer_entity_varchar'), $customer);
63
+ }
64
+
65
+ $installer->endSetup();
app/design/frontend/default/default/layout/username.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Diglin
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
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Diglin
23
+ * @package Diglin_Username
24
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <layout version="0.1.0">
29
+
30
+ <customer_account_login>
31
+ <reference name="customer_form_login">
32
+ <action method="setTemplate"><template>username/customer/form/login.phtml</template></action>
33
+ </reference>
34
+ </customer_account_login>
35
+
36
+ <customer_account_edit>
37
+ <reference name="customer_edit">
38
+ <action method="setTemplate"><template>username/customer/form/edit.phtml</template></action>
39
+ </reference>
40
+ </customer_account_edit>
41
+
42
+ <customer_account_create>
43
+ <reference name="customer_form_register">
44
+ <action method="setTemplate"><template>username/customer/form/register.phtml</template></action>
45
+ </reference>
46
+ </customer_account_create>
47
+
48
+ <checkout_onepage_index>
49
+ <reference name="checkout.onepage.billing">
50
+ <action method="setTemplate"><template>username/checkout/onepage/billing.phtml</template></action>
51
+ </reference>
52
+ <reference name="checkout.onepage.login">
53
+ <action method="setTemplate"><template>username/checkout/onepage/login.phtml</template></action>
54
+ </reference>
55
+ </checkout_onepage_index>
56
+ </layout>
app/design/frontend/default/default/template/username/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-billing-form" action="">
28
+ <fieldset>
29
+ <ul class="form-list">
30
+ <?php if ($this->customerHasAddresses()): ?>
31
+ <li class="wide">
32
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
33
+ <div class="input-box">
34
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
35
+ </div>
36
+ </li>
37
+ <?php endif; ?>
38
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
39
+ <fieldset>
40
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
41
+ <ul>
42
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
43
+ <li class="fields">
44
+ <div class="field">
45
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
46
+ <div class="input-box">
47
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
48
+ </div>
49
+ </div>
50
+ <?php if(!$this->isCustomerLoggedIn()): ?>
51
+ <div class="field">
52
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
55
+ </div>
56
+ </div>
57
+ <?php endif ?>
58
+ </li>
59
+ <?php if(!$this->isCustomerLoggedIn()): ?>
60
+ <li class="fields">
61
+ <div class="field">
62
+ <label for="billing:username" class="required"><em>*</em><?php echo $this->__('Username') ?></label>
63
+ <div class="input-box">
64
+ <input type="text" name="billing[username]" id="billing:username" value="<?php echo $this->htmlEscape($this->getAddress()->getUsername()) ?>" title="<?php echo $this->__('Username') ?>" class="input-text required-entry" />
65
+ </div>
66
+ </div>
67
+ <?php endif ?>
68
+ </li>
69
+ <li class="wide">
70
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
71
+ <div class="input-box">
72
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
73
+ </div>
74
+ </li>
75
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
76
+ <li class="wide">
77
+ <div class="input-box">
78
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
79
+ </div>
80
+ </li>
81
+ <?php endfor ?>
82
+ <li class="fields">
83
+ <div class="field">
84
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
85
+ <div class="input-box">
86
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
87
+ </div>
88
+ </div>
89
+ <div class="field">
90
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
91
+ <div class="input-box">
92
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
93
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
94
+ </select>
95
+ <script type="text/javascript">
96
+ //<![CDATA[
97
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
98
+ //]]>
99
+ </script>
100
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <li class="fields">
105
+ <div class="field">
106
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
107
+ <div class="input-box">
108
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
109
+ </div>
110
+ </div>
111
+ <div class="field">
112
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
113
+ <div class="input-box">
114
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
115
+ </div>
116
+ </div>
117
+ </li>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
121
+ <div class="input-box">
122
+ <input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="billing:telephone" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
127
+ <div class="input-box">
128
+ <input type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" />
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <?php if(!$this->isCustomerLoggedIn()): ?>
133
+
134
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
135
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
136
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
137
+ <li class="fields">
138
+ <?php if ($_dob->isEnabled()): ?>
139
+ <div class="field">
140
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
141
+ </div>
142
+ <?php endif; ?>
143
+ <?php if ($_gender->isEnabled()): ?>
144
+ <div class="field">
145
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
146
+ </div>
147
+ <?php endif ?>
148
+ </li>
149
+ <?php endif ?>
150
+
151
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
152
+ <?php if ($_taxvat->isEnabled()): ?>
153
+ <li>
154
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
155
+ </li>
156
+ <?php endif ?>
157
+
158
+ <li class="fields" id="register-customer-password">
159
+ <div class="field">
160
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
161
+ <div class="input-box">
162
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
163
+ </div>
164
+ </div>
165
+ <div class="field">
166
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
167
+ <div class="input-box">
168
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
169
+ </div>
170
+ </div>
171
+ </li>
172
+ <?php endif; ?>
173
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
174
+ <li class="control">
175
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
176
+ </li>
177
+ <?php else:?>
178
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
179
+ <?php endif; ?>
180
+ </ul>
181
+ </fieldset>
182
+ </li>
183
+ <?php if ($this->canShip()): ?>
184
+ <li class="control">
185
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
186
+ <li class="control">
187
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
188
+ </li>
189
+ <?php endif; ?>
190
+ </ul>
191
+ <?php if (!$this->canShip()): ?>
192
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
193
+ <?php endif; ?>
194
+ <div class="buttons-set" id="billing-buttons-container">
195
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
196
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
197
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
198
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
199
+ </span>
200
+ </div>
201
+ </fieldset>
202
+ </form>
203
+ <script type="text/javascript">
204
+ //<![CDATA[
205
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
206
+ var billingForm = new VarienForm('co-billing-form');
207
+
208
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
209
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
210
+
211
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
212
+ //]]>
213
+ </script>
app/design/frontend/default/default/template/username/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <div class="col2-set">
28
+ <?php echo $this->getChildHtml('login_before')?>
29
+ <div class="col-1">
30
+ <h3><?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?><?php echo $this->__('Checkout as a Guest or Register') ?><?php else: ?><?php echo $this->__('Register to Create an Account') ?><?php endif; ?></h3>
31
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
32
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
33
+ <?php else: ?>
34
+ <p><strong><?php echo $this->__('Register and save time!') ?></strong><br />
35
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
36
+ <ul>
37
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
38
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
39
+ </ul>
40
+ <?php endif; ?>
41
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
42
+ <ul class="form-list">
43
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
44
+ <li class="control">
45
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_GUEST): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
46
+ </li>
47
+ <?php endif; ?>
48
+ <li class="control">
49
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" /><label for="login:register"><?php echo $this->__('Register') ?></label>
50
+ </li>
51
+ </ul>
52
+ <h4><?php echo $this->__('Register and save time!') ?></h4>
53
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
54
+ <ul class="ul">
55
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
56
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
57
+ </ul>
58
+ <?php else: ?>
59
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
60
+ <?php endif; ?>
61
+ </div>
62
+ <div class="col-2">
63
+ <h3><?php echo $this->__('Login') ?></h3>
64
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
65
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
66
+ <fieldset>
67
+ <h4><?php echo $this->__('Already registered?') ?></h4>
68
+ <p><?php echo $this->__('Please log in below:') ?></p>
69
+ <ul class="form-list">
70
+ <li>
71
+ <label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address/Username') ?></label>
72
+ <div class="input-box">
73
+ <input type="text" class="input-text required-entry" id="login-email" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" />
74
+ </div>
75
+ </li>
76
+ <li>
77
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
78
+ <div class="input-box">
79
+ <input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
80
+ </div>
81
+ </li>
82
+ </ul>
83
+ </fieldset>
84
+ </form>
85
+ </div>
86
+ </div>
87
+ <div class="col2-set">
88
+ <div class="col-1">
89
+ <div class="buttons-set">
90
+ <p class="required">&nbsp;</p>
91
+ <button type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo ($this->getQuote()->isAllowedGuestCheckout() ? $this->__('Continue') : $this->__('Register')) ?></span></span></button>
92
+ </div>
93
+ </div>
94
+ <div class="col-2">
95
+ <div class="buttons-set">
96
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
97
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
98
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ <script type="text/javascript">
103
+ //<![CDATA[
104
+ var loginForm = new VarienForm('login-form', true);
105
+ $('login-email').observe('keypress', bindLoginPost);
106
+ $('login-password').observe('keypress', bindLoginPost);
107
+ function bindLoginPost(evt){
108
+ if (evt.keyCode == Event.KEY_RETURN) {
109
+ loginForm.submit();
110
+ }
111
+ }
112
+ function onepageLogin(button)
113
+ {
114
+ if(loginForm.validator && loginForm.validator.validate()){
115
+ button.disabled = true;
116
+ loginForm.submit();
117
+ }
118
+ }
119
+ //]]>
120
+ </script>
app/design/frontend/default/default/template/username/customer/form/edit.phtml ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <div class="page-title">
28
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
29
+ </div>
30
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
31
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
32
+ <div class="fieldset">
33
+ <?php echo $this->getBlockHtml('formkey')?>
34
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
35
+ <ul class="form-list">
36
+ <li class="fields">
37
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
38
+ </li>
39
+ <li>
40
+ <div class="field">
41
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
42
+ <div class="input-box">
43
+ <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
44
+ </div>
45
+ </div>
46
+ <div class="field">
47
+ <label for="username" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Username') ?></label>
48
+ <div class="input-box">
49
+ <input type="text" name="username" id="username" value="<?php echo $this->htmlEscape($this->getCustomer()->getUsername()) ?>" title="<?php echo Mage::helper('customer')->__('Username') ?>" class="input-text required-entry" />
50
+ </div>
51
+ </div>
52
+ </li>
53
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
54
+ <?php if ($_dob->isEnabled()): ?>
55
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
56
+ <?php endif ?>
57
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
58
+ <?php if ($_taxvat->isEnabled()): ?>
59
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
60
+ <?php endif ?>
61
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
62
+ <?php if ($_gender->isEnabled()): ?>
63
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
64
+ <?php endif ?>
65
+ <li class="control">
66
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('Change Password') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
67
+ </li>
68
+ </ul>
69
+ </div>
70
+ <div class="fieldset" style="display:none;">
71
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
72
+ <ul class="form-list">
73
+ <li>
74
+ <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
75
+ <div class="input-box">
76
+ <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" />
77
+ </div>
78
+ </li>
79
+ <li class="fields">
80
+ <div class="field">
81
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
82
+ <div class="input-box">
83
+ <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" />
84
+ </div>
85
+ </div>
86
+ <div class="field">
87
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
88
+ <div class="input-box">
89
+ <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
90
+ </div>
91
+ </div>
92
+ </li>
93
+ </ul>
94
+ </div>
95
+ <div class="buttons-set">
96
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
97
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
98
+ <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
99
+ </div>
100
+ </form>
101
+ <script type="text/javascript">
102
+ //<![CDATA[
103
+ var dataForm = new VarienForm('form-validate', true);
104
+ function setPasswordForm(arg){
105
+ if(arg){
106
+ $('current_password').up(3).show();
107
+ $('current_password').addClassName('required-entry');
108
+ $('password').addClassName('required-entry');
109
+ $('confirmation').addClassName('required-entry');
110
+
111
+ }else{
112
+ $('current_password').up(3).hide();
113
+ $('current_password').removeClassName('required-entry');
114
+ $('password').removeClassName('required-entry');
115
+ $('confirmation').removeClassName('required-entry');
116
+ }
117
+ }
118
+ <?php if($this->getCustomer()->getChangePassword()): ?>
119
+ setPasswordForm(true);
120
+ <?php endif; ?>
121
+ //]]>
122
+ </script>
app/design/frontend/default/default/template/username/customer/form/login.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer login form template
30
+ *
31
+ * @see Mage_Customer_Block_Form_Login
32
+ */
33
+ ?>
34
+ <div class="account-login">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Login or Create an Account') ?></h1>
37
+ </div>
38
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
39
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
40
+ <div class="col2-set">
41
+ <div class="col-1 new-users">
42
+ <div class="content">
43
+ <h2><?php echo $this->__('New Customers') ?></h2>
44
+ <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
45
+ </div>
46
+ </div>
47
+ <div class="col-2 registered-users">
48
+ <div class="content">
49
+ <h2><?php echo $this->__('Registered Customers') ?></h2>
50
+ <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
51
+ <ul class="form-list">
52
+ <li>
53
+ <label for="email" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Email Address/Username') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry" title="<?php echo Mage::helper('customer')->__('Email Address/Username') ?>" />
56
+ </div>
57
+ </li>
58
+ <li>
59
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
60
+ <div class="input-box">
61
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
62
+ </div>
63
+ </li>
64
+ </ul>
65
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <div class="col2-set">
70
+ <div class="col-1 new-users">
71
+ <div class="buttons-set">
72
+ <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo $this->getCreateAccountUrl() ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
73
+ </div>
74
+ </div>
75
+ <div class="col-2 registered-users">
76
+ <div class="buttons-set">
77
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
78
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </form>
83
+ <script type="text/javascript">
84
+ //<![CDATA[
85
+ var dataForm = new VarienForm('login-form', true);
86
+ //]]>
87
+ </script>
88
+ </div>
app/design/frontend/default/default/template/username/customer/form/register.phtml ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Diglin
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
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/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Diglin
22
+ * @package Diglin_Username
23
+ * @copyright Copyright (c) 2011 Diglin (http://www.diglin.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @see Mage_Customer_Block_Form_Register
32
+ */
33
+ ?>
34
+ <div class="account-create">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Create an Account') ?></h1>
37
+ </div>
38
+ <?php echo $this->getChildHtml('form_fields_before')?>
39
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
41
+ <div class="fieldset">
42
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
43
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
44
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
45
+ <ul class="form-list">
46
+ <li class="fields">
47
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
48
+ </li>
49
+ <li>
50
+ <div class="field">
51
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
52
+ <div class="input-box">
53
+ <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
54
+ </div>
55
+ </div>
56
+ <div class="field">
57
+ <label for="username" class="required"><em>*</em><?php echo Mage::helper('customer')->__('Username') ?></label>
58
+ <div class="input-box">
59
+ <input type="text" name="username" id="username" value="<?php echo $this->htmlEscape($this->getFormData()->getUsername()) ?>" title="<?php echo Mage::helper('customer')->__('Username') ?>" class="input-text required-entry" />
60
+ </div>
61
+ </div>
62
+ </li>
63
+ <?php if ($this->isNewsletterEnabled()): ?>
64
+ <li class="control">
65
+ <div class="input-box">
66
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
67
+ </div>
68
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
69
+ </li>
70
+ <?php endif ?>
71
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
72
+ <?php if ($_dob->isEnabled()): ?>
73
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
74
+ <?php endif ?>
75
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
76
+ <?php if ($_taxvat->isEnabled()): ?>
77
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
78
+ <?php endif ?>
79
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
80
+ <?php if ($_gender->isEnabled()): ?>
81
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
82
+ <?php endif ?>
83
+ </ul>
84
+ </div>
85
+ <?php if($this->getShowAddressFields()): ?>
86
+ <div class="fieldset">
87
+ <input type="hidden" name="create_address" value="1" />
88
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
89
+ <ul class="form-list">
90
+ <li class="fields">
91
+ <div class="field">
92
+ <label for="company"><?php echo $this->__('Company') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
95
+ </div>
96
+ </div>
97
+ <div class="field">
98
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
99
+ <div class="input-box">
100
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <li class="wide">
105
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
106
+ <div class="input-box">
107
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
108
+ </div>
109
+ </li>
110
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
111
+ <li class="wide">
112
+ <div class="input-box">
113
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
114
+ </div>
115
+ </li>
116
+ <?php endfor ?>
117
+ <li class="fields">
118
+ <div class="field">
119
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
120
+ <div class="input-box">
121
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
122
+ </div>
123
+ </div>
124
+ <div class="field">
125
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
126
+ <div class="input-box">
127
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
128
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
129
+ </select>
130
+ <script type="text/javascript">
131
+ //<![CDATA[
132
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
133
+ //]]>
134
+ </script>
135
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
136
+ </div>
137
+ </div>
138
+ </li>
139
+ <li class="fields">
140
+ <div class="field">
141
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
142
+ <div class="input-box">
143
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
144
+ </div>
145
+ </div>
146
+ <div class="field">
147
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
148
+ <div class="input-box">
149
+ <?php echo $this->getCountryHtmlSelect() ?>
150
+ </div>
151
+ </div>
152
+ </li>
153
+ </ul>
154
+ <input type="hidden" name="default_billing" value="1" />
155
+ <input type="hidden" name="default_shipping" value="1" />
156
+ </div>
157
+ <?php endif; ?>
158
+ <div class="fieldset">
159
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
160
+ <ul class="form-list">
161
+ <li class="fields">
162
+ <div class="field">
163
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
164
+ <div class="input-box">
165
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
166
+ </div>
167
+ </div>
168
+ <div class="field">
169
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
170
+ <div class="input-box">
171
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
172
+ </div>
173
+ </div>
174
+ </li>
175
+ </ul>
176
+ </div>
177
+ <div class="buttons-set">
178
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
179
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
180
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
181
+ </div>
182
+ </form>
183
+ <script type="text/javascript">
184
+ //<![CDATA[
185
+ var dataForm = new VarienForm('form-validate', true);
186
+ <?php if($this->getShowAddressFields()): ?>
187
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
188
+ <?php endif; ?>
189
+ //]]>
190
+ </script>
191
+ </div>
app/etc/modules/Diglin_Username.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Diglin_Username>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Customer />
9
+ </depends>
10
+ </Diglin_Username>
11
+ </modules>
12
+ </config>
app/locale/de_DE/Diglin_Username.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "This account is disabled.,""Dieses Benutzerkonto ist deaktiviert."""
2
+ "Username,""Benutzername"""
3
+ "Email Address/Username, ""E-Mail-Adresse/Benutzername"""
4
+ "Email/Username:',""'E-Mail-Adresse/Benutzername:'"""
app/locale/en_GB/Diglin_Username.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "This account is disabled.","This account is disabled."
2
+ "Username","Username"
3
+ "Email Address/Username", "Email Address/Username"
4
+ "'Email/Username:'","'Email/Username:'"
app/locale/en_US/Diglin_Username.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "This account is disabled.","This account is disabled."
2
+ "Username","Username"
3
+ "Email Address/Username", "Email Address/Username"
4
+ "'Email/Username:'","'Email/Username:'"
app/locale/fr_FR/Diglin_Username.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "This account is disabled.","Ce compte est désactivé"
2
+ "Username","Nom d'utilisateur"
3
+ "Email Address/Username", "Adresse email / Nom d'utilisateur"
4
+ "'Email/Username:'","'Adresse Email / Nom d\utilisateur:'"
package.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Diglin_Username</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Create and login to an account thanks to a username AND email address.&#xD;
10
+ Allow to disable an account from backend. The user will be blocked if the option in the customer backend is set to no</summary>
11
+ <description>This module allows you to:&#xD;
12
+ &#xD;
13
+ - login with a username, it can be done from frontend during checkout or getting access to the customer account&#xD;
14
+ - save a username from frontend (register account or checkout process) or from backend by editing a customer account&#xD;
15
+ - check that the username doesn't already exists&#xD;
16
+ - deactivate temporary customer account from Customer Management page (bonus functionnality). The user will be blocked if the option in the customer backend is set to no.&#xD;
17
+ - The default template override some customer and checkout views to adapt display for login pages, checkout process and account edition in frontend. If you have a customized template, please check the layout file username.xml and compare with your template to use or adapt to your situation.&#xD;
18
+ &#xD;
19
+ Compatible Magento version &gt;= 1.4.2</description>
20
+ <notes>Version 1.1.0: change the module name from Jfusion_Customer to Diglin_Username, fix bugs with checkout frontend and backend and with old customers&#xD;
21
+ Version 1.0.0 - stable version&#xD;
22
+ Version 1.0.1 - fix bug in sql query during installation on prefixed tables, add german translation, do package for Magento version prior to 1.5 and version 1.5.x&#xD;
23
+ Version 1.0.2 - fix a bug with the installation</notes>
24
+ <authors><author><name>diglin</name><user>auto-converted</user><email>sly@diglin.com</email></author></authors>
25
+ <date>2011-09-11</date>
26
+ <time>18:33:42</time>
27
+ <contents><target name="mageetc"><dir name="modules"><file name="Diglin_Username.xml" hash="79603fae3def6dd098d4be51897e1ec6"/></dir></target><target name="magecommunity"><dir name="Diglin"><dir name="Username"><dir name="Block"><dir name="Overwrite"><dir name="Adminhtml"><dir name="Edit"><dir name="Tab"><file name="Account.php" hash="a5269ed241e97fc94ea6585ddf89d41e"/></dir></dir></dir></dir></dir><dir name="Model"><dir name="Entity"><file name="Customer.php" hash="75871fbc0b7ba6283a9d00e1300d5687"/><file name="Setup.php" hash="52fb83e922217a03ec49a7e01ec4168d"/></dir><file name="Customer.php" hash="a3fa48726a43f267d1560a7b14574309"/><file name="Form.php" hash="8842ea13f59069341b20c86fae4e6986"/><file name="Observer.php" hash="4badcaa6ab91dc56270c31aa0dcab4f5"/></dir><dir name="etc"><file name="config.xml" hash="8ea71f8a25543e6e8355de06f7a8163c"/></dir><dir name="sql"><dir name="username_setup"><file name="mysql4-install-1.0.0.php" hash="139862c7d033b40808f2dd5c17c59d77"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="a6cdaceb3ae152b7ac2debe99022209b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="username"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="158561d558368712426b803b2f392a8b"/><file name="login.phtml" hash="057960b4b741b21657aed20a15278872"/></dir></dir><dir name="customer"><dir name="form"><file name="edit.phtml" hash="9db985e8451b66a7c09b8dc472fc9544"/><file name="login.phtml" hash="4b0be135d49e4098e093514bc0ddb88f"/><file name="register.phtml" hash="2808979c10df1b36dc0c74333490a50f"/></dir></dir></dir></dir><dir name="layout"><file name="username.xml" hash="5fdf86d9fbaa0da02b1de86d62bb2ef3"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_GB"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="en_US"><file name="Diglin_Username.csv" hash="2d18fb6bfc2c4c56f19cfe7ee6761f4b"/></dir><dir name="fr_FR"><file name="Diglin_Username.csv" hash="d8d025c852649fc8e9edd2aed5ab377a"/></dir><dir name="de_DE"><file name="Diglin_Username.csv" hash="7b82f7fe5e8775963956447f55954116"/></dir></target></contents>
28
+ <compatible/>
29
+ <dependencies/>
30
+ </package>