Amar_Profile - Version 0.2.0

Version Notes

This Extension helps to create the customer attribute and provides the backend control to create and manage and create attribute will be used in customer general information

Download this release

Release Info

Developer AmarInfotech
Extension Amar_Profile
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.0 to 0.2.0

Files changed (38) hide show
  1. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute.php +24 -0
  2. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit.php +90 -0
  3. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Form.php +46 -0
  4. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/Main.php +130 -0
  5. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/Options.php +36 -0
  6. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/System.php +134 -0
  7. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tabs.php +73 -0
  8. app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Grid.php +153 -0
  9. app/code/community/Amar/Profile/Block/Customer/Account/Create.php +242 -0
  10. app/code/{local → community}/Amar/Profile/Block/Profile.php +0 -0
  11. app/code/community/Amar/Profile/Helper/Data.php +32 -0
  12. app/code/community/Amar/Profile/Helper/Product.php +64 -0
  13. app/code/community/Amar/Profile/Model/Customer/Attribute.php +51 -0
  14. app/code/community/Amar/Profile/Model/Mysql4/Customer/Attribute/Collection.php +21 -0
  15. app/code/community/Amar/Profile/Model/Mysql4/Profile.php +25 -0
  16. app/code/community/Amar/Profile/Model/Mysql4/Profile/Collection.php +24 -0
  17. app/code/community/Amar/Profile/Model/Mysql4/Setup.php +18 -0
  18. app/code/community/Amar/Profile/Model/Profile.php +23 -0
  19. app/code/community/Amar/Profile/controllers/Adminhtml/Customer/AttributeController.php +382 -0
  20. app/code/{local → community}/Amar/Profile/controllers/IndexController.php +0 -0
  21. app/code/community/Amar/Profile/etc/adminhtml.xml +46 -0
  22. app/code/{local → community}/Amar/Profile/etc/config.xml +48 -55
  23. app/code/community/Amar/Profile/sql/profile_setup/mysql4-install-0.2.0.php +16 -0
  24. app/code/local/Amar/Profile/Helper/Data.php +0 -6
  25. app/code/local/Amar/Profile/Model/Entity/School.php +0 -29
  26. app/code/local/Amar/Profile/sql/profile_setup/mysql4-install-0.1.0.php +0 -44
  27. app/design/adminhtml/default/default/layout/profile.xml +36 -0
  28. app/design/adminhtml/default/default/template/profile/customer/attribute/js.phtml +329 -0
  29. app/design/frontend/base/default/layout/profile.xml +34 -0
  30. app/design/frontend/base/default/template/profile/customer/account/create.phtml +50 -0
  31. app/design/frontend/base/default/template/profile/customer/account/edit.phtml +51 -0
  32. app/design/frontend/default/default/layout/profile.xml +0 -20
  33. app/design/frontend/default/default/template/profile/customer/form/edit.phtml +0 -104
  34. app/design/frontend/default/default/template/profile/persistent/checkout/onepage/billing.phtml +0 -215
  35. app/design/frontend/default/default/template/profile/persistent/customer/form/register.phtml +0 -171
  36. app/etc/modules/Amar_Profile.xml +1 -1
  37. js/profile/conflictAttribute.js +48 -0
  38. package.xml +9 -15
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Attribute
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute extends Mage_Adminhtml_Block_Widget_Grid_Container
14
+ {
15
+ public function __construct() {
16
+ $this->_blockGroup = "profile";
17
+ $this->_controller = "adminhtml_customer_attribute";
18
+ $this->_addButtonLabel = $this->__('Add New Attribute');
19
+ $this->_headerText = $this->__("Manage Customer Attributes");
20
+ parent::__construct();
21
+ }
22
+ }
23
+
24
+ ?>
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Edit
10
+ *
11
+ * @author root
12
+ */
13
+
14
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
15
+ {
16
+
17
+ public function __construct()
18
+ {
19
+ $this->_objectId = 'attribute_id';
20
+ $this->_controller = 'adminhtml_customer_attribute';
21
+ $this->_blockGroup ='profile';
22
+
23
+ parent::__construct();
24
+
25
+ if($this->getRequest()->getParam('popup')) {
26
+ $this->_removeButton('back');
27
+ $this->_addButton(
28
+ 'close',
29
+ array(
30
+ 'label' => Mage::helper('profile')->__('Close Window'),
31
+ 'class' => 'cancel',
32
+ 'onclick' => 'window.close()',
33
+ 'level' => -1
34
+ )
35
+ );
36
+ } else {
37
+ $this->_addButton(
38
+ 'save_and_edit_button',
39
+ array(
40
+ 'label' => Mage::helper('profile')->__('Save and Continue Edit'),
41
+ 'onclick' => 'saveAndContinueEdit()',
42
+ 'class' => 'save'
43
+ ),
44
+ 100
45
+ );
46
+ }
47
+
48
+ $this->_updateButton('save', 'label', Mage::helper('profile')->__('Save Attribute'));
49
+ $this->_updateButton('save', 'onclick', 'saveAttribute()');
50
+
51
+ if (! Mage::registry('entity_attribute')->getIsUserDefined())
52
+ {
53
+ $this->_removeButton('delete');
54
+ if(Mage::registry('entity_attribute')->getAttributeId() != "")
55
+ {
56
+ $this->_removeButton('save_and_edit_button');
57
+ $this->_removeButton('save');
58
+ $this->_removeButton('reset');
59
+ }
60
+ }
61
+ else
62
+ {
63
+ $this->_updateButton('delete', 'label', Mage::helper('profile')->__('Delete Attribute'));
64
+ }
65
+ }
66
+
67
+ public function getHeaderText()
68
+ {
69
+ if (Mage::registry('entity_attribute')->getId()) {
70
+ $frontendLabel = Mage::registry('entity_attribute')->getFrontendLabel();
71
+ if (is_array($frontendLabel)) {
72
+ $frontendLabel = $frontendLabel[0];
73
+ }
74
+ return Mage::helper('profile')->__('Edit Customer Attribute "%s"', $this->escapeHtml($frontendLabel));
75
+ }
76
+ else {
77
+ return Mage::helper('profile')->__('New Customer Attribute');
78
+ }
79
+ }
80
+
81
+ public function getValidationUrl()
82
+ {
83
+ return $this->getUrl('*/*/validate', array('_current'=>true));
84
+ }
85
+
86
+ public function getSaveUrl()
87
+ {
88
+ return $this->getUrl('*/'.$this->_controller.'/save', array('_current'=>true, 'back'=>null));
89
+ }
90
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Form.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product attribute add/edit form block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+
38
+ protected function _prepareForm()
39
+ {
40
+ $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
41
+ $form->setUseContainer(true);
42
+ $this->setForm($form);
43
+ return parent::_prepareForm();
44
+ }
45
+
46
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/Main.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Product attribute add/edit form main tab
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Adminhtml
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit_Tab_Main extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
36
+ {
37
+ /**
38
+ * Adding product form elements for editing attribute
39
+ *
40
+ * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ parent::_prepareForm();
45
+ $attributeObject = $this->getAttributeObject();
46
+ /* @var $form Varien_Data_Form */
47
+ $form = $this->getForm();
48
+ /* @var $fieldset Varien_Data_Form_Element_Fieldset */
49
+ $fieldset = $form->getElement('base_fieldset');
50
+
51
+ $frontendInputElm = $form->getElement('frontend_input');
52
+ $additionalTypes = array();
53
+
54
+
55
+ $response = new Varien_Object();
56
+ $response->setTypes(array());
57
+ Mage::dispatchEvent('adminhtml_customer_attribute_types', array('response'=>$response));
58
+ $_disabledTypes = array();
59
+ $_hiddenFields = array();
60
+
61
+ foreach ($response->getTypes() as $type) {
62
+ $additionalTypes[] = $type;
63
+ if (isset($type['hide_fields'])) {
64
+ $_hiddenFields[$type['value']] = $type['hide_fields'];
65
+ }
66
+ if (isset($type['disabled_types'])) {
67
+ $_disabledTypes[$type['value']] = $type['disabled_types'];
68
+ }
69
+ }
70
+
71
+
72
+
73
+ Mage::register('attribute_type_hidden_fields', $_hiddenFields);
74
+ Mage::register('attribute_type_disabled_types', $_disabledTypes);
75
+
76
+ $frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
77
+
78
+ foreach($frontendInputValues as $key => $_frontendInput)
79
+ {
80
+ if($_frontendInput["value"] == 'multiselect')
81
+ {
82
+ unset($frontendInputValues[$key]);
83
+ }
84
+ }
85
+
86
+ $frontendInputElm->setValues($frontendInputValues);
87
+ $frontendInputElm->setLabel(Mage::helper("profile")->__("Input Type for Store Owner"));
88
+ $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
89
+
90
+ $scopes = array(
91
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('profile')->__('Store View'),
92
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('profile')->__('Website'),
93
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('profile')->__('Global'),
94
+ );
95
+
96
+ if ($attributeObject->getAttributeCode() == 'status' || $attributeObject->getAttributeCode() == 'tax_class_id') {
97
+ unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
98
+ }
99
+
100
+ $fieldset->addField('is_global', 'select', array(
101
+ 'name' => 'is_global',
102
+ 'label' => Mage::helper('profile')->__('Scope'),
103
+ 'title' => Mage::helper('profile')->__('Scope'),
104
+ 'note' => Mage::helper('profile')->__('Declare attribute value saving scope'),
105
+ 'values'=> $scopes
106
+ ), 'attribute_code');
107
+
108
+ // frontend properties fieldset
109
+
110
+
111
+
112
+ // define field dependencies
113
+ $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
114
+ ->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
115
+ ->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
116
+ ->addFieldMap("frontend_input", 'frontend_input_type')
117
+ ->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')
118
+ ->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0')
119
+ );
120
+
121
+ Mage::dispatchEvent('adminhtml_catalog_product_attribute_edit_prepare_form', array(
122
+ 'form' => $form,
123
+ 'attribute' => $attributeObject
124
+ ));
125
+
126
+ return $this;
127
+ }
128
+
129
+
130
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/Options.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product attribute add/edit form options tab
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit_Tab_Options extends Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
35
+ {
36
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tab/System.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Product attribute add/edit form system tab
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit_Tab_System extends Mage_Adminhtml_Block_Widget_Form
36
+ {
37
+
38
+ protected function _prepareForm()
39
+ {
40
+ $model = Mage::registry('entity_attribute');
41
+
42
+ $form = new Varien_Data_Form();
43
+ $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('profile')->__('System Properties')));
44
+
45
+ if ($model->getAttributeId()) {
46
+ $fieldset->addField('attribute_id', 'hidden', array(
47
+ 'name' => 'attribute_id',
48
+ ));
49
+ }
50
+
51
+ $yesno = array(
52
+ array(
53
+ 'value' => 0,
54
+ 'label' => Mage::helper('profile')->__('No')
55
+ ),
56
+ array(
57
+ 'value' => 1,
58
+ 'label' => Mage::helper('profile')->__('Yes')
59
+ ));
60
+
61
+ /*$fieldset->addField('attribute_model', 'text', array(
62
+ 'name' => 'attribute_model',
63
+ 'label' => Mage::helper('catalog')->__('Attribute Model'),
64
+ 'title' => Mage::helper('catalog')->__('Attribute Model'),
65
+ ));
66
+
67
+ $fieldset->addField('backend_model', 'text', array(
68
+ 'name' => 'backend_model',
69
+ 'label' => Mage::helper('catalog')->__('Backend Model'),
70
+ 'title' => Mage::helper('catalog')->__('Backend Model'),
71
+ ));*/
72
+
73
+ $fieldset->addField('backend_type', 'select', array(
74
+ 'name' => 'backend_type',
75
+ 'label' => Mage::helper('profile')->__('Data Type for Saving in Database'),
76
+ 'title' => Mage::helper('profile')->__('Data Type for Saving in Database'),
77
+ 'options' => array(
78
+ 'text' => Mage::helper('profile')->__('Text'),
79
+ 'varchar' => Mage::helper('profile')->__('Varchar'),
80
+ 'static' => Mage::helper('profile')->__('Static'),
81
+ 'datetime' => Mage::helper('profile')->__('Datetime'),
82
+ 'decimal' => Mage::helper('profile')->__('Decimal'),
83
+ 'int' => Mage::helper('profile')->__('Integer'),
84
+ ),
85
+ ));
86
+
87
+ /*$fieldset->addField('backend_table', 'text', array(
88
+ 'name' => 'backend_table',
89
+ 'label' => Mage::helper('catalog')->__('Backend Table'),
90
+ 'title' => Mage::helper('catalog')->__('Backend Table Title'),
91
+ ));
92
+
93
+ $fieldset->addField('frontend_model', 'text', array(
94
+ 'name' => 'frontend_model',
95
+ 'label' => Mage::helper('catalog')->__('Frontend Model'),
96
+ 'title' => Mage::helper('catalog')->__('Frontend Model'),
97
+ ));*/
98
+
99
+ /*$fieldset->addField('is_visible', 'select', array(
100
+ 'name' => 'is_visible',
101
+ 'label' => Mage::helper('catalog')->__('Visible'),
102
+ 'title' => Mage::helper('catalog')->__('Visible'),
103
+ 'values' => $yesno,
104
+ ));*/
105
+
106
+ /*$fieldset->addField('source_model', 'text', array(
107
+ 'name' => 'source_model',
108
+ 'label' => Mage::helper('catalog')->__('Source Model'),
109
+ 'title' => Mage::helper('catalog')->__('Source Model'),
110
+ ));*/
111
+
112
+ $fieldset->addField('is_global', 'select', array(
113
+ 'name' => 'is_global',
114
+ 'label' => Mage::helper('profile')->__('Globally Editable'),
115
+ 'title' => Mage::helper('profile')->__('Globally Editable'),
116
+ 'values'=> $yesno,
117
+ ));
118
+
119
+ $form->setValues($model->getData());
120
+
121
+ if ($model->getAttributeId()) {
122
+ $form->getElement('backend_type')->setDisabled(1);
123
+ if ($model->getIsGlobal()) {
124
+ #$form->getElement('is_global')->setDisabled(1);
125
+ }
126
+ } else {
127
+ }
128
+
129
+ $this->setForm($form);
130
+
131
+ return parent::_prepareForm();
132
+ }
133
+
134
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Edit/Tabs.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml product attribute edit page tabs
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
35
+ {
36
+
37
+ public function __construct()
38
+ {
39
+ parent::__construct();
40
+ $this->setId('customer_attribute_tabs');
41
+ $this->setDestElementId('edit_form');
42
+ $this->setTitle(Mage::helper('profile')->__('Attribute Information'));
43
+ }
44
+
45
+ protected function _beforeToHtml()
46
+ {
47
+ $this->addTab('main', array(
48
+ 'label' => Mage::helper('profile')->__('Properties'),
49
+ 'title' => Mage::helper('profile')->__('Properties'),
50
+ 'content' => $this->getLayout()->createBlock('profile/adminhtml_customer_attribute_edit_tab_main')->toHtml(),
51
+ 'active' => true
52
+ ));
53
+
54
+ $model = Mage::registry('entity_attribute');
55
+
56
+ $this->addTab('labels', array(
57
+ 'label' => Mage::helper('profile')->__('Manage Label / Options'),
58
+ 'title' => Mage::helper('profile')->__('Manage Label / Options'),
59
+ 'content' => $this->getLayout()->createBlock('profile/adminhtml_customer_attribute_edit_tab_options')->toHtml(),
60
+ ));
61
+
62
+ /*if ('select' == $model->getFrontendInput()) {
63
+ $this->addTab('options_section', array(
64
+ 'label' => Mage::helper('catalog')->__('Options Control'),
65
+ 'title' => Mage::helper('catalog')->__('Options Control'),
66
+ 'content' => $this->getLayout()->createBlock('adminhtml/catalog_product_attribute_edit_tab_options')->toHtml(),
67
+ ));
68
+ }*/
69
+
70
+ return parent::_beforeToHtml();
71
+ }
72
+
73
+ }
app/code/community/Amar/Profile/Block/Adminhtml/Customer/Attribute/Grid.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Grid
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Block_Adminhtml_Customer_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid
14
+ {
15
+ public function __construct()
16
+ {
17
+ parent::__construct();
18
+ $this->setId('attributeGrid');
19
+ $this->setDefaultSort('id');
20
+ $this->setDefaultDir('DESC');
21
+ $this->setSaveParametersInSession(true);
22
+ $this->setUseAjax(true);
23
+ $this->setVarNameFilter('attribute_filter');
24
+
25
+ }
26
+
27
+
28
+
29
+ protected function _prepareCollection()
30
+ {
31
+ $collection = Mage::getModel('profile/customer_attribute')->getCollection();
32
+ $collection->addFilterToMap('id', 'main_table.attribute_id', 'fields');
33
+ $this->setCollection($collection);
34
+ parent::_prepareCollection();
35
+
36
+ return $this;
37
+ }
38
+
39
+
40
+
41
+ protected function _prepareColumns()
42
+ {
43
+ $this->addColumn('id',
44
+ array(
45
+ 'header'=> Mage::helper('profile')->__('Attribute ID'),
46
+ 'width' => '50px',
47
+ 'type' => 'number',
48
+ 'index' => 'id',
49
+ ));
50
+
51
+ $this->addColumn('frontend_label',
52
+ array(
53
+ 'header'=> Mage::helper('profile')->__('Attribute Label'),
54
+ 'index' => 'frontend_label',
55
+ ));
56
+
57
+
58
+
59
+ $this->addColumn('attribute_code', array(
60
+ 'header' => Mage::helper('profile')->__('Attribute Code'),
61
+ 'width' => '150px',
62
+ 'align' =>'left',
63
+ 'index' => 'attribute_code',
64
+ ));
65
+
66
+ $this->addColumn('frontend_input', array(
67
+ 'header' => Mage::helper('profile')->__('Frontend Control'),
68
+ 'width' => '150px',
69
+ 'align' =>'left',
70
+ 'index' => 'frontend_input',
71
+ ));
72
+
73
+
74
+ $this->addColumn('is_unique', array(
75
+ 'header' => Mage::helper('profile')->__('Is Unique ?'),
76
+ 'align' => 'left',
77
+ 'width' => '80px',
78
+ 'index' => 'is_unique',
79
+ 'type' => 'options',
80
+ 'options' => array(
81
+ 1 => 'Yes',
82
+ 0 => 'No',
83
+ )
84
+ ));
85
+
86
+
87
+ $this->addColumn('is_visible', array(
88
+ 'header' => Mage::helper('profile')->__('Is Visible ?'),
89
+ 'align' => 'left',
90
+ 'width' => '80px',
91
+ 'index' => 'is_visible',
92
+ 'type' => 'options',
93
+ 'options' => array(
94
+ 1 => 'Yes',
95
+ 0 => 'No',
96
+ )
97
+ ));
98
+
99
+ $this->addColumn('is_system', array(
100
+ 'header' => Mage::helper('profile')->__('Is System Defined ?'),
101
+ 'align' => 'left',
102
+ 'width' => '80px',
103
+ 'index' => 'is_system',
104
+ 'type' => 'options',
105
+ 'options' => array(
106
+ 1 => 'Yes',
107
+ 0 => 'No',
108
+ )
109
+ ));
110
+
111
+ $this->addColumn('sort_order',
112
+ array(
113
+ 'header'=> Mage::helper('profile')->__('Sort Order'),
114
+ 'index' => 'sort_order',
115
+ 'width' => '80px',
116
+ ));
117
+
118
+ $this->addColumn('is_required', array(
119
+ 'header' => Mage::helper('profile')->__('Is Required ?'),
120
+ 'align' => 'left',
121
+ 'width' => '80px',
122
+ 'index' => 'is_required',
123
+ 'type' => 'options',
124
+ 'options' => array(
125
+ 1 => 'Yes',
126
+ 0 => 'No',
127
+ )
128
+ ));
129
+
130
+
131
+
132
+
133
+ return parent::_prepareColumns();
134
+ }
135
+
136
+
137
+
138
+
139
+ public function getGridUrl()
140
+ {
141
+ return $this->getUrl('*/*/grid', array('_current'=>true));
142
+ }
143
+
144
+ public function getRowUrl($row)
145
+ {
146
+ return $this->getUrl('*/*/edit', array(
147
+ 'store'=>$this->getRequest()->getParam('store'),
148
+ 'code'=>$row->getAttributeCode())
149
+ );
150
+ }
151
+ }
152
+
153
+ ?>
app/code/community/Amar/Profile/Block/Customer/Account/Create.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Create
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Block_Customer_Account_Create extends Mage_Core_Block_Template
14
+ {
15
+ //put your code here
16
+
17
+ protected $_attributeCodes = array();
18
+
19
+ /*
20
+ * Array
21
+ (
22
+ [website_id] => 1
23
+ [entity_id] => 6
24
+ [entity_type_id] => 1
25
+ [attribute_set_id] => 0
26
+ [email] => ram@laxman.com
27
+ [group_id] => 1
28
+ [increment_id] =>
29
+ [store_id] => 1
30
+ [created_at] => 2014-05-15T10:53:55-07:00
31
+ [updated_at] => 2014-05-15 10:53:56
32
+ [is_active] => 1
33
+ [disable_auto_group_change] => 0
34
+ [firstname] => Ram
35
+ [lastname] => Laxman
36
+ [password_hash] => 57578ce3dacad6d2c917c418ff1351fc:gIBdC68v81WlzykfTGxFQm0Y6TABrlWG
37
+ [created_in] => English
38
+ [exname] => AAACCC
39
+ [flower] => 128
40
+ [metal] => 131
41
+ [yn] => 1
42
+ [ydate] => 2014-07-18 00:00:00
43
+ [ytestarea] => SURESH
44
+ [tax_class_id] => 3
45
+ )
46
+ */
47
+ protected $_customerData = array();
48
+
49
+ protected $_idPrefix = "";
50
+ protected $_namePrefix = "";
51
+ protected $_nameSufix = "";
52
+
53
+
54
+ public function __construct()
55
+ {
56
+ parent::__construct();
57
+
58
+ $this->_attributeCodes = $this->fetchAttributes();
59
+ $this->_customerData = $this->getCustomerData();
60
+ }
61
+
62
+ protected function _beforeToHtml() {
63
+ $mode= $this->getMode();
64
+
65
+ if($mode != "")
66
+ {
67
+ $this->_idPrefix = $mode.':';
68
+ $this->_namePrefix = $mode.'[';
69
+ $this->_nameSufix = ']';
70
+ }
71
+
72
+ /*if($this->getStep() == "onepage")
73
+ {
74
+ $checkout = Mage::getSingleton('checkout/session')->getQuote();
75
+ $billAddressData = $checkout->getBillingAddress()->getData();
76
+
77
+ foreach($billAddressData as $key=> $value)
78
+ {
79
+ if($value == "")
80
+ {
81
+ $billAddressData[$key] = $this->_customerData[$key];
82
+ }
83
+ }
84
+ $this->_customerData = $billAddressData;
85
+ }*/
86
+
87
+ parent::_beforeToHtml();
88
+ }
89
+
90
+ public function getCustomerData()
91
+ {
92
+ if(Mage::getSingleton("customer/session")->isLoggedIn())
93
+ {
94
+ return Mage::getSingleton("customer/session")->getCustomer()->getData();
95
+ }
96
+ }
97
+
98
+
99
+
100
+ protected function fetchAttributes()
101
+ {
102
+ $attributeCodes = array();
103
+
104
+ $profileAttributeCollection = Mage::getModel("profile/profile")->getCollection();
105
+
106
+ foreach($profileAttributeCollection as $profile_id => $_profile)
107
+ {
108
+ $attributeCodes[] = $_profile->getAttributeCode();
109
+ }
110
+
111
+ return $attributeCodes;
112
+
113
+ }
114
+
115
+
116
+ public function getAttributeCodes()
117
+ {
118
+ if(empty($this->_attributeCodes))
119
+ {
120
+ $this->_attributeCodes = $this->fetchAttributes();
121
+ }
122
+
123
+ return $this->_attributeCodes;
124
+
125
+ }
126
+
127
+ /*
128
+ * Array
129
+ (
130
+ [attribute_id] => 962
131
+ [entity_type_id] => 1
132
+ [attribute_code] => flower
133
+ [attribute_model] =>
134
+ [backend_model] =>
135
+ [backend_type] => int
136
+ [backend_table] =>
137
+ [frontend_model] =>
138
+ [frontend_input] => select
139
+ [frontend_label] => Flower
140
+ [frontend_class] =>
141
+ [source_model] => eav/entity_attribute_source_table
142
+ [is_required] => 0
143
+ [is_user_defined] => 1
144
+ [default_value] => 127
145
+ [is_unique] => 0
146
+ [note] =>
147
+ [is_visible] => 1
148
+ [input_filter] =>
149
+ [multiline_count] => 1
150
+ [validate_rules] =>
151
+ [is_system] => 0
152
+ [sort_order] => 0
153
+ [data_model] =>
154
+ )
155
+ */
156
+ public function getAttributeFrontendHtmlControl($attributeCode)
157
+ {
158
+ $attribute = Mage::getModel("profile/customer_attribute")->loadByCode($attributeCode);
159
+
160
+ $html ='<label for="'.$this->_idPrefix.$attribute->getAttributeCode().'" class="'.(($attribute->getIsRequired() == true)?"required":"").'">';
161
+ $html .= (($attribute->getIsRequired() == true)?"<em>*</em>":"").$this->__($attribute->getFrontendLabel());
162
+ $html .='</label>';
163
+ $html .='<div class="input-box">';
164
+
165
+ if($attribute->getFrontendInput() == 'select')
166
+ {
167
+ $html .= ' <select name="'.$this->_namePrefix.$attribute->getAttributeCode().$this->_nameSufix.'" id="'.$this->_idPrefix.$attribute->getAttributeCode().'" class="'.$attribute->getValidationRules().' '.(($attribute->getIsRequired() == true)?"required-entry":"").'">';
168
+ $html .=' <option value="">'.$this->__('Choose Option..').'</option>';
169
+ $options = $attribute->getSource()->getAllOptions(false);
170
+ foreach($options as $_option)
171
+ {
172
+ $html .='<option value="'.$_option['value'].'" '.(((($this->_customerData[$attribute->getAttributeCode()] == "")?$attribute->getDefaultValue():$this->_customerData[$attribute->getAttributeCode()]) == $_option['value'])?"selected=\"selected\"":"").'>'.$this->__($_option['label']).'</option>';
173
+ }
174
+ $html .=' </select>';
175
+ }
176
+ elseif($attribute->getFrontendInput() == 'boolean')
177
+ {
178
+ $html .= ' <select name="'.$this->_namePrefix.$attribute->getAttributeCode().$this->_nameSufix.'" id="'.$this->_idPrefix.$attribute->getAttributeCode().'" class="'.$attribute->getValidationRules().' '.(($attribute->getIsRequired() == true)?"required-entry":"").'">';
179
+ $html .=' <option value="">'.$this->__('Choose Option..').'</option>';
180
+ $options = $attribute->getSource()->getAllOptions(false);
181
+ foreach($options as $_option)
182
+ {
183
+ $html .='<option value="'.$_option['value'].'" '.(((($this->_customerData[$attribute->getAttributeCode()] == "")?$attribute->getDefaultValue():$this->_customerData[$attribute->getAttributeCode()]) == $_option['value'])?"selected=\"selected\"":"").'>'.$this->__($_option['label']).'</option>';
184
+ }
185
+ $html .=' </select>';
186
+ }
187
+ elseif($attribute->getFrontendInput() == "date")
188
+ {
189
+ if(Mage::registry("calender_added") == null)
190
+ {
191
+ $html .='<link rel="stylesheet" type="text/css" href="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).'/calendar/calendar-win2k-1.css" />
192
+ <script type="text/javascript" src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).'/calendar/calendar.js"></script>
193
+ <script type="text/javascript" src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS).'/calendar/calendar-setup.js"></script>';
194
+
195
+ $html .= $this->getLayout()->createBlock(
196
+ 'Mage_Core_Block_Html_Calendar',
197
+ 'html_calendar',
198
+ array('template' => 'page/js/calendar.phtml')
199
+ )->toHtml();
200
+ Mage::register("calender_added",1);
201
+
202
+ }
203
+
204
+
205
+ $html .='<input type="text" style="width:110px !important;" class="'.$attribute->getValidationRules().' '.(($attribute->getIsRequired() == true)?"required-entry":"").' input-text" value="'.date('m/d/Y',strtotime((($this->_customerData[$attribute->getAttributeCode()] == "")?$attribute->getDefaultValue():$this->_customerData[$attribute->getAttributeCode()]))).'" id="'.$this->_idPrefix.$attribute->getAttributeCode().'" name="'.$this->_namePrefix.$attribute->getAttributeCode().$this->_nameSufix.'">
206
+ <img style="" title="'.$this->__('Select Date').'" id="'.$attribute->getAttributeCode().'_trig" class="v-middle" alt="" src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'/adminhtml/default/default/images/grid-cal.gif">
207
+ <script type="text/javascript">
208
+ //&lt;![CDATA[
209
+ document.observe("dom:loaded",function(){
210
+ setTimeout(function(){
211
+ Calendar.setup({
212
+ inputField: "'.$attribute->getAttributeCode().'",
213
+ ifFormat: "%m/%e/%Y",
214
+ showsTime: false,
215
+ button: "'.$attribute->getAttributeCode().'_trig",
216
+ align: "Bl",
217
+ singleClick : true,
218
+ date :new Date()
219
+ });
220
+ },3000);
221
+ });
222
+ //]]&gt;
223
+ </script>';
224
+
225
+ }
226
+ elseif($attribute->getFrontendInput() == "textarea")
227
+ {
228
+ $html.='<textarea cols="15" rows="2" class="'.$attribute->getValidationRules().' '.(($attribute->getIsRequired() == true)?"required-entry":"").' textarea" name="'.$this->_namePrefix.$attribute->getAttributeCode().$this->_nameSufix.'" id="'.$this->_idPrefix.$attribute->getAttributeCode().'">'.(($this->_customerData[$attribute->getAttributeCode()] == "")?$attribute->getDefaultValue():$this->_customerData[$attribute->getAttributeCode()]).'</textarea>';
229
+ }
230
+ elseif($attribute->getFrontendInput() == "text")
231
+ {
232
+ $html .='<input type="text" class="'.$attribute->getValidationRules().' '.(($attribute->getIsRequired() == true)?"required-entry":"").' input-text" value="'.(($this->_customerData[$attribute->getAttributeCode()] == "")?$attribute->getDefaultValue():$this->_customerData[$attribute->getAttributeCode()]).'" name="'.$this->_namePrefix.$attribute->getAttributeCode().$this->_nameSufix.'" id="'.$this->_idPrefix.$attribute->getAttributeCode().'">';
233
+ }
234
+ $html .='</div>';
235
+
236
+ return $html;
237
+ }
238
+
239
+
240
+ }
241
+
242
+ ?>
app/code/{local → community}/Amar/Profile/Block/Profile.php RENAMED
File without changes
app/code/community/Amar/Profile/Helper/Data.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Amar_Profile_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ /**
6
+ * Retrieve attribute hidden fields
7
+ *
8
+ * @return array
9
+ */
10
+ public function getAttributeHiddenFields()
11
+ {
12
+ if (Mage::registry('attribute_type_hidden_fields')) {
13
+ return Mage::registry('attribute_type_hidden_fields');
14
+ } else {
15
+ return array();
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Retrieve attribute disabled types
21
+ *
22
+ * @return array
23
+ */
24
+ public function getAttributeDisabledTypes()
25
+ {
26
+ if (Mage::registry('attribute_type_disabled_types')) {
27
+ return Mage::registry('attribute_type_disabled_types');
28
+ } else {
29
+ return array();
30
+ }
31
+ }
32
+ }
app/code/community/Amar/Profile/Helper/Product.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Amar_Profile_Helper_Product extends Mage_Core_Helper_Url
4
+ {
5
+ /**
6
+ * Return information array of product attribute input types
7
+ * Only a small number of settings returned, so we won't break anything in current dataflow
8
+ * As soon as development process goes on we need to add there all possible settings
9
+ *
10
+ * @param string $inputType
11
+ * @return array
12
+ */
13
+ public function getAttributeInputTypes($inputType = null)
14
+ {
15
+ /**
16
+ * @todo specify there all relations for properties depending on input type
17
+ */
18
+ $inputTypes = array(
19
+ 'multiselect' => array(
20
+ 'backend_model' => 'eav/entity_attribute_backend_array'
21
+ ),
22
+ 'boolean' => array(
23
+ 'source_model' => 'eav/entity_attribute_source_boolean'
24
+ )
25
+ );
26
+
27
+ if (is_null($inputType)) {
28
+ return $inputTypes;
29
+ } else if (isset($inputTypes[$inputType])) {
30
+ return $inputTypes[$inputType];
31
+ }
32
+ return array();
33
+ }
34
+
35
+ /**
36
+ * Return default attribute backend model by input type
37
+ *
38
+ * @param string $inputType
39
+ * @return string|null
40
+ */
41
+ public function getAttributeBackendModelByInputType($inputType)
42
+ {
43
+ $inputTypes = $this->getAttributeInputTypes();
44
+ if (!empty($inputTypes[$inputType]['backend_model'])) {
45
+ return $inputTypes[$inputType]['backend_model'];
46
+ }
47
+ return null;
48
+ }
49
+
50
+ /**
51
+ * Return default attribute source model by input type
52
+ *
53
+ * @param string $inputType
54
+ * @return string|null
55
+ */
56
+ public function getAttributeSourceModelByInputType($inputType)
57
+ {
58
+ $inputTypes = $this->getAttributeInputTypes();
59
+ if (!empty($inputTypes[$inputType]['source_model'])) {
60
+ return $inputTypes[$inputType]['source_model'];
61
+ }
62
+ return null;
63
+ }
64
+ }
app/code/community/Amar/Profile/Model/Customer/Attribute.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Attribute
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Customer_Attribute extends Mage_Eav_Model_Entity_Attribute
14
+ {
15
+ /**
16
+ *
17
+ * @category this method returns the attribute collection of the cuzstomer only
18
+ * @return Mage_Eav_Model_Resource_Entity_Attribute_Collection
19
+ */
20
+
21
+
22
+ public function _construct() {
23
+ parent::_construct();
24
+ $this->setEntityTypeId(Mage::getModel('eav/entity')->setType("customer")->getTypeId());
25
+ }
26
+ public function getCollection()
27
+ {
28
+ $collection = $this->getResourceCollection()
29
+ ->addFieldToSelect('attribute_id','id')
30
+ ->addFieldToSelect('frontend_label')
31
+ ->addFieldToSelect('attribute_code')
32
+ ->addFieldToSelect('frontend_input')
33
+ ->addFieldToSelect('is_unique')
34
+ ->addFieldToSelect('is_required')
35
+ ->setEntityTypeFilter(1);
36
+ return $collection;
37
+ }
38
+
39
+
40
+ public function loadByCode($code)
41
+ {
42
+ if($code != "")
43
+ parent::loadByCode(1, $code);
44
+ else
45
+ $this->setEntityTypeId(Mage::getModel('eav/entity')->setType("customer")->getTypeId());
46
+ return $this;
47
+ }
48
+
49
+ }
50
+
51
+ ?>
app/code/community/Amar/Profile/Model/Mysql4/Customer/Attribute/Collection.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Collection
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Mysql4_Customer_Attribute_Collection extends Mage_Eav_Model_Resource_Entity_Attribute_Collection
14
+ {
15
+ protected function _construct()
16
+ {
17
+ parent::_construct();
18
+ }
19
+ }
20
+
21
+ ?>
app/code/community/Amar/Profile/Model/Mysql4/Profile.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Profile
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Mysql4_Profile extends Mage_Core_Model_Mysql4_Abstract
14
+ {
15
+ //put your code here
16
+ protected $mainTable = "profile/profile";
17
+ protected $idFieldName = "id";
18
+
19
+
20
+ protected function _construct() {
21
+ $this->_init($this->mainTable, $this->idFieldName);
22
+ }
23
+ }
24
+
25
+ ?>
app/code/community/Amar/Profile/Model/Mysql4/Profile/Collection.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Collection
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Mysql4_Profile_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
14
+ {
15
+ //put your code here
16
+
17
+ protected $model = "profile/profile";
18
+
19
+ protected function _construct() {
20
+ $this->_init($this->model);
21
+ }
22
+ }
23
+
24
+ ?>
app/code/community/Amar/Profile/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Setup
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
14
+ {
15
+ //put your code here
16
+ }
17
+
18
+ ?>
app/code/community/Amar/Profile/Model/Profile.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of Profile
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Model_Profile extends Mage_Core_Model_Abstract
14
+ {
15
+ //put your code here
16
+ protected $_resourceModel = "profile/profile";
17
+
18
+ protected function _construct() {
19
+ $this->_init($this->_resourceModel);
20
+ }
21
+ }
22
+
23
+ ?>
app/code/community/Amar/Profile/controllers/Adminhtml/Customer/AttributeController.php ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+
8
+ /**
9
+ * Description of AttributeController
10
+ *
11
+ * @author root
12
+ */
13
+ class Amar_Profile_Adminhtml_Customer_AttributeController extends Mage_Adminhtml_Controller_Action
14
+ {
15
+
16
+ protected $_entityTypeId;
17
+
18
+ public function preDispatch()
19
+ {
20
+ parent::preDispatch();
21
+ $this->_entityTypeId = Mage::getModel('eav/entity')->setType("customer")->getTypeId();
22
+ }
23
+
24
+ public function indexAction()
25
+ {
26
+ $this->_initAction();
27
+ $this->renderLayout();
28
+ }
29
+
30
+ public function gridAction()
31
+ {
32
+ $this->loadLayout();
33
+ $this->renderLayout();
34
+ }
35
+
36
+
37
+
38
+ protected function _initAction()
39
+ {
40
+ $this->_title($this->__('Customers'))
41
+ ->_title($this->__('Customer Attributes'))
42
+ ->_title($this->__('Manage Customer Attributes'));
43
+
44
+ if($this->getRequest()->getParam('popup')) {
45
+ $this->loadLayout('popup');
46
+ } else {
47
+ $this->loadLayout()
48
+ ->_setActiveMenu('customer/customer_attrubute')
49
+ ->_addBreadcrumb(Mage::helper('profile')->__('Customers'), Mage::helper('profile')->__('Customers'))
50
+ ->_addBreadcrumb(
51
+ Mage::helper('profile')->__('Manage Customer Attributes'),
52
+ Mage::helper('profile')->__('Manage Customer Attributes'))
53
+ ;
54
+ }
55
+ return $this;
56
+ }
57
+
58
+
59
+
60
+ public function newAction()
61
+ {
62
+ $this->_forward('edit');
63
+ }
64
+
65
+ public function editAction()
66
+ {
67
+ $requested_attribute_code = $this->getRequest()->getParam("code");
68
+ $model = Mage::getModel('profile/customer_attribute')->loadByCode($requested_attribute_code);
69
+ $this->getRequest()->setParam("attribute_id",$model->getAttributeId());
70
+ $id = $model->getId();
71
+ if ($id) {
72
+ $model->load($id);
73
+
74
+ if (! $model->getId()) {
75
+ Mage::getSingleton('adminhtml/session')->addError(
76
+ Mage::helper('profile')->__('This attribute no longer exists'));
77
+ $this->_redirect('*/*/');
78
+ return;
79
+ }
80
+
81
+ // entity type check
82
+ if ($model->getEntityTypeId() != $this->_entityTypeId) {
83
+ Mage::getSingleton('adminhtml/session')->addError(
84
+ Mage::helper('profile')->__('This attribute cannot be edited.'));
85
+ $this->_redirect('*/*/');
86
+ return;
87
+ }
88
+ }
89
+
90
+ // set entered data if was error when we do save
91
+ $data = Mage::getSingleton('adminhtml/session')->getAttributeData(true);
92
+ if (! empty($data)) {
93
+ $model->addData($data);
94
+ }
95
+
96
+ Mage::register('entity_attribute', $model);
97
+
98
+ $this->_initAction();
99
+
100
+ $this->_title($id ? $model->getName() : $this->__('New Attribute'));
101
+
102
+ $item = $id ? Mage::helper('profile')->__('Edit Customer Attribute')
103
+ : Mage::helper('profile')->__('New Customer Attribute');
104
+
105
+ $this->_addBreadcrumb($item, $item);
106
+
107
+ $this->getLayout()->getBlock('attribute_edit_js')
108
+ ->setIsPopup((bool)$this->getRequest()->getParam('popup'));
109
+
110
+ $this->renderLayout();
111
+
112
+ }
113
+
114
+
115
+
116
+
117
+ public function validateAction()
118
+ {
119
+ $response = new Varien_Object();
120
+ $response->setError(false);
121
+
122
+ $attributeCode = $this->getRequest()->getParam('attribute_code');
123
+ $attributeId = $this->getRequest()->getParam('attribute_id');
124
+ $attribute = Mage::getModel('profile/customer_attribute')->loadByCode($attributeCode);
125
+
126
+ if ($attribute->getId() && !$attributeId) {
127
+ Mage::getSingleton('adminhtml/session')->addError(
128
+ Mage::helper('profile')->__('Attribute with the same code already exists'));
129
+ $this->_initLayoutMessages('adminhtml/session');
130
+ $response->setError(true);
131
+ $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
132
+ }
133
+
134
+ $this->getResponse()->setBody($response->toJson());
135
+ }
136
+
137
+ /**
138
+ * Filter post data
139
+ *
140
+ * @param array $data
141
+ * @return array
142
+ */
143
+ protected function _filterPostData($data)
144
+ {
145
+ if ($data) {
146
+ /** @var $helperCatalog Mage_Catalog_Helper_Data */
147
+ $helperProfile = Mage::helper('profile');
148
+ //labels
149
+ foreach ($data['frontend_label'] as & $value) {
150
+ if ($value) {
151
+ $value = $helperProfile->stripTags($value);
152
+ }
153
+ }
154
+ }
155
+ return $data;
156
+ }
157
+
158
+ public function saveAction()
159
+ {
160
+ $data = $this->getRequest()->getPost();
161
+ if ($data) {
162
+ /** @var $session Mage_Admin_Model_Session */
163
+ $session = Mage::getSingleton('adminhtml/session');
164
+
165
+ $redirectBack = $this->getRequest()->getParam('back', false);
166
+ /* @var $model Amar_Profile_Model_Customer_Attribute */
167
+ $model = Mage::getModel('profile/customer_attribute');
168
+ /* @var $helper Amar_Profile_Helper_Product */
169
+ $helper = Mage::helper('profile/product');
170
+
171
+ $id = $this->getRequest()->getParam('attribute_id');
172
+
173
+ //validate attribute_code
174
+ if (isset($data['attribute_code'])) {
175
+ $validatorAttrCode = new Zend_Validate_Regex(array('pattern' => '/^[a-z][a-z_0-9]{1,254}$/'));
176
+ if (!$validatorAttrCode->isValid($data['attribute_code'])) {
177
+ $session->addError(
178
+ Mage::helper('catalog')->__('Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.')
179
+ );
180
+ if($id)
181
+ $this->_redirect('*/*/edit', array('code' => $data['attribute_code'], '_current' => true));
182
+ else
183
+ $this->_redirect('*/*/edit', array('code' => '', '_current' => true));
184
+ return;
185
+ }
186
+ }
187
+
188
+
189
+ //validate frontend_input
190
+ if (isset($data['frontend_input'])) {
191
+ /** @var $validatorInputType Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator */
192
+ $validatorInputType = Mage::getModel('eav/adminhtml_system_config_source_inputtype_validator');
193
+ if (!$validatorInputType->isValid($data['frontend_input'])) {
194
+ foreach ($validatorInputType->getMessages() as $message) {
195
+ $session->addError($message);
196
+ }
197
+ if($id)
198
+ $this->_redirect('*/*/edit', array('code' => $data['attribute_code'], '_current' => true));
199
+ else
200
+ $this->_redirect('*/*/edit', array('code' => '', '_current' => true));
201
+ return;
202
+ }
203
+ }
204
+
205
+ if ($id) {
206
+ $model->load($id);
207
+
208
+ if (!$model->getId()) {
209
+ $session->addError(
210
+ Mage::helper('profile')->__('This Attribute no longer exists'));
211
+ $this->_redirect('*/*/');
212
+ return;
213
+ }
214
+
215
+ // entity type check
216
+ if ($model->getEntityTypeId() != $this->_entityTypeId) {
217
+ $session->addError(
218
+ Mage::helper('catalog')->__('This attribute cannot be updated.'));
219
+ $session->setAttributeData($data);
220
+ $this->_redirect('*/*/');
221
+ return;
222
+ }
223
+
224
+ $data['attribute_code'] = $model->getAttributeCode();
225
+ $data['is_user_defined'] = $model->getIsUserDefined();
226
+ $data['frontend_input'] = $model->getFrontendInput();
227
+ } else {
228
+ /**
229
+ * @todo add to helper and specify all relations for properties
230
+ */
231
+ $data['source_model'] = $helper->getAttributeSourceModelByInputType($data['frontend_input']);
232
+ $data['backend_model'] = $helper->getAttributeBackendModelByInputType($data['frontend_input']);
233
+ }
234
+
235
+ if (!isset($data['is_configurable'])) {
236
+ $data['is_configurable'] = 0;
237
+ }
238
+ if (!isset($data['is_filterable'])) {
239
+ $data['is_filterable'] = 0;
240
+ }
241
+ if (!isset($data['is_filterable_in_search'])) {
242
+ $data['is_filterable_in_search'] = 0;
243
+ }
244
+
245
+ if (is_null($model->getIsUserDefined()) || $model->getIsUserDefined() != 0) {
246
+ $data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
247
+ }
248
+
249
+ $defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
250
+ if ($defaultValueField) {
251
+ $data['default_value'] = $this->getRequest()->getParam($defaultValueField);
252
+ }
253
+
254
+
255
+
256
+ //filter
257
+ $data = $this->_filterPostData($data);
258
+ $model->addData($data);
259
+
260
+ if (!$id) {
261
+ $model->setEntityTypeId($this->_entityTypeId);
262
+ $model->setIsUserDefined(1);
263
+ }
264
+
265
+
266
+ $customer = Mage::getModel('customer/customer');
267
+ $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
268
+
269
+ $model->setAttributeSetId($attrSetId);
270
+ $model->setAttributeGroupId('General');
271
+
272
+
273
+ try {
274
+ $model->save();
275
+
276
+ //code to update the data of profile
277
+ $profileCollection = Mage::getModel("profile/profile")->getCollection()
278
+ ->addFieldtoFilter("attribute_code",$model->getAttributeCode())
279
+ ->addFieldtoFilter("attribute_id",$model->getAttributeId());
280
+
281
+ if($profileCollection->getSize() == 0)
282
+ {
283
+ Mage::getModel("profile/profile")->setAttributeCode($model->getAttributeCode())->setAttributeId($model->getAttributeId())->save();
284
+ }
285
+
286
+ //code to update the data of the profile ends here
287
+
288
+ Mage::getSingleton('eav/config')
289
+ ->getAttribute('customer', $model->getAttributeCode())
290
+ ->setData('used_in_forms', array(
291
+ 'adminhtml_customer',
292
+ 'customer_account_create',
293
+ 'customer_account_edit',
294
+ 'checkout_register'
295
+ )
296
+ )->save();
297
+
298
+
299
+ $session->addSuccess(
300
+ Mage::helper('catalog')->__('The customer attribute has been saved.'));
301
+
302
+ /**
303
+ * Clear translation cache because attribute labels are stored in translation
304
+ */
305
+ Mage::app()->cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));
306
+ $session->setAttributeData(false);
307
+ if ($redirectBack) {
308
+ $this->_redirect('*/*/edit', array('code' => $model->getAttributeCode(),'_current'=>true));
309
+ } else {
310
+ $this->_redirect('*/*/', array());
311
+ }
312
+ return;
313
+ } catch (Exception $e) {
314
+ $session->addError($e->getMessage());
315
+ $session->setAttributeData($data);
316
+ if($id)
317
+ $this->_redirect('*/*/edit', array('code' => $model->getAttributeCode(), '_current' => true));
318
+ else
319
+ $this->_redirect('*/*/edit', array('code' => '', '_current' => true));
320
+ return;
321
+ }
322
+ }
323
+ $this->_redirect('*/*/');
324
+ }
325
+
326
+
327
+
328
+ public function deleteAction()
329
+ {
330
+ if ($id = $this->getRequest()->getParam('attribute_id'))
331
+ {
332
+ //$code = $this->getRequest()->getParam('attribute_code');
333
+ $model = Mage::getModel('profile/customer_attribute')->load($id);
334
+
335
+ // entity type check
336
+
337
+ if ($model->getEntityTypeId() != $this->_entityTypeId) {
338
+ Mage::getSingleton('adminhtml/session')->addError(
339
+ Mage::helper('profile')->__('This attribute cannot be deleted.'));
340
+ $this->_redirect('*/*/');
341
+ return;
342
+ }
343
+
344
+ try {
345
+ $model->delete();
346
+
347
+ //code to update the data of profile
348
+
349
+ $profileCollection = Mage::getModel("profile/profile")->getCollection()
350
+ ->addFieldtoFilter("attribute_code",$model->getAttributeCode())
351
+ ->addFieldtoFilter("attribute_id",$model->getAttributeId());
352
+
353
+ if($profileCollection->getSize() > 0)
354
+ {
355
+ foreach($profileCollection as $_profile)
356
+ {
357
+ $_profile->delete();
358
+ }
359
+ }
360
+
361
+ //code to update the data of the profile ends here
362
+
363
+ Mage::getSingleton('adminhtml/session')->addSuccess(
364
+ Mage::helper('profile')->__('The customer attribute has been deleted.'));
365
+ $this->_redirect('*/*/');
366
+ return;
367
+ }
368
+ catch (Exception $e) {
369
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
370
+ $this->_redirect('*/*/edit', array('code' => $this->getRequest()->getParam('attribute_code')));
371
+ return;
372
+ }
373
+ }
374
+ Mage::getSingleton('adminhtml/session')->addError(
375
+ Mage::helper('profile')->__('Unable to find an attribute to delete.'));
376
+ $this->_redirect('*/*/');
377
+ }
378
+
379
+
380
+ }
381
+
382
+ ?>
app/code/{local → community}/Amar/Profile/controllers/IndexController.php RENAMED
File without changes
app/code/community/Amar/Profile/etc/adminhtml.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-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 Mage
23
+ * @package Mage_Checkout
24
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <menu>
30
+ <customer>
31
+ <children>
32
+ <customer_attrubute translate="title" module="checkout">
33
+ <sort_order>2</sort_order>
34
+ <title>Customer Attributes</title>
35
+ <children>
36
+ <manage_customer_attrubute translate="title" module="checkout">
37
+ <sort_order>1</sort_order>
38
+ <title>Manage Customer Attributes</title>
39
+ <action>profile/adminhtml_customer_attribute/index/</action>
40
+ </manage_customer_attrubute>
41
+ </children>
42
+ </customer_attrubute>
43
+ </children>
44
+ </customer>
45
+ </menu>
46
+ </config>
app/code/{local → community}/Amar/Profile/etc/config.xml RENAMED
@@ -2,59 +2,10 @@
2
  <config>
3
  <modules>
4
  <Amar_Profile>
5
- <version>0.1.0</version>
6
  </Amar_Profile>
7
  </modules>
8
- <frontend>
9
- <routers>
10
- <profile>
11
- <use>standard</use>
12
- <args>
13
- <module>Amar_Profile</module>
14
- <frontName>profile</frontName>
15
- </args>
16
- </profile>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <profile>
21
- <file>profile.xml</file>
22
- </profile>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <admin>
27
- <routers>
28
- <profile>
29
- <use>admin</use>
30
- <args>
31
- <module>Amar_Profile</module>
32
- <frontName>profile</frontName>
33
- </args>
34
- </profile>
35
- </routers>
36
- </admin>
37
- <global>
38
- <fieldsets>
39
- <checkout_onepage_quote>
40
- <customer_school>
41
- <to_customer>school</to_customer>
42
- </customer_school>
43
- </checkout_onepage_quote>
44
- <customer_account>
45
- <school>
46
- <to_quote>customer_school</to_quote>
47
- </school>
48
- </customer_account>
49
- </fieldsets>
50
- </global>
51
- <global>
52
- <fieldsets>
53
- <customer_account>
54
- <school><create>1</create><update>1</update><name>1</name></school>
55
- </customer_account>
56
- </fieldsets>
57
- </global>
58
  <global>
59
  <models>
60
  <profile>
@@ -65,7 +16,7 @@
65
  <class>Amar_Profile_Model_Mysql4</class>
66
  <entities>
67
  <profile>
68
- <table>profile</table>
69
  </profile>
70
  </entities>
71
  </profile_mysql4>
@@ -73,9 +24,9 @@
73
  <resources>
74
  <profile_setup>
75
  <setup>
76
- <module>Amar_Profile</module>
77
- <class>Mage_Customer_Model_Entity_Setup</class>
78
- </setup>
79
  <connection>
80
  <use>core_setup</use>
81
  </connection>
@@ -102,4 +53,46 @@
102
  </profile>
103
  </helpers>
104
  </global>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  </config>
2
  <config>
3
  <modules>
4
  <Amar_Profile>
5
+ <version>0.2.0</version>
6
  </Amar_Profile>
7
  </modules>
8
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  <global>
10
  <models>
11
  <profile>
16
  <class>Amar_Profile_Model_Mysql4</class>
17
  <entities>
18
  <profile>
19
+ <table>amar_profile</table>
20
  </profile>
21
  </entities>
22
  </profile_mysql4>
24
  <resources>
25
  <profile_setup>
26
  <setup>
27
+ <module>Amar_Profile</module>
28
+ <class>Amar_Profile_Model_Mysql4_Setup</class>
29
+ </setup>
30
  <connection>
31
  <use>core_setup</use>
32
  </connection>
53
  </profile>
54
  </helpers>
55
  </global>
56
+
57
+ <frontend>
58
+ <routers>
59
+ <profile>
60
+ <use>standard</use>
61
+ <args>
62
+ <module>Amar_Profile</module>
63
+ <frontName>profile</frontName>
64
+ </args>
65
+ </profile>
66
+ </routers>
67
+ <layout>
68
+ <updates>
69
+ <profile>
70
+ <file>profile.xml</file>
71
+ </profile>
72
+ </updates>
73
+ </layout>
74
+ </frontend>
75
+
76
+
77
+ <admin>
78
+ <routers>
79
+ <profile>
80
+ <use>admin</use>
81
+ <args>
82
+ <module>Amar_Profile</module>
83
+ <frontName>profile</frontName>
84
+ </args>
85
+ </profile>
86
+ </routers>
87
+ </admin>
88
+
89
+ <adminhtml>
90
+ <layout>
91
+ <updates>
92
+ <profile>
93
+ <file>profile.xml</file>
94
+ </profile>
95
+ </updates>
96
+ </layout>
97
+ </adminhtml>
98
  </config>
app/code/community/Amar/Profile/sql/profile_setup/mysql4-install-0.2.0.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+
8
+ $installer->run("CREATE TABLE IF NOT EXISTS `".$this->getTable("profile/profile")."` (
9
+ `id` int unsigned NOT NULL auto_increment,
10
+ `attribute_id` int ,
11
+ `attribute_code` varchar(200) NOT NULL,
12
+ PRIMARY KEY (`id`)
13
+ ) ENGINE=INNODB charset=utf8 COLLATE=utf8_unicode_ci COMMENT='this table is for storing the attribute code created by profile extension'");
14
+
15
+
16
+ $installer->endSetup();
app/code/local/Amar/Profile/Helper/Data.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Amar_Profile_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- }
 
 
 
 
 
 
app/code/local/Amar/Profile/Model/Entity/School.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- class Amar_Profile_Model_Entity_School extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
3
- {
4
- public function getAllOptions()
5
- {
6
- if ($this->_options === null) {
7
- $this->_options = array();
8
- $this->_options[] = array(
9
- 'value' => '',
10
- 'label' => 'Choose Option..'
11
- );
12
- $this->_options[] = array(
13
- 'value' => 1,
14
- 'label' => 'School1'
15
- );
16
- $this->_options[] = array(
17
- 'value' => 2,
18
- 'label' => 'School2'
19
- );
20
- $this->_options[] = array(
21
- 'value' => 3,
22
- 'label' => 'School3'
23
- );
24
-
25
- }
26
-
27
- return $this->_options;
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Amar/Profile/sql/profile_setup/mysql4-install-0.1.0.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
-
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
- $setup = Mage::getModel('customer/entity_setup', 'core_setup');
7
- $setup->addAttribute('customer', 'school', array(
8
- 'type' => 'int',
9
- 'input' => 'select',
10
- 'label' => 'School',
11
- 'global' => 1,
12
- 'visible' => 1,
13
- 'required' => 0,
14
- 'user_defined' => 1,
15
- 'default' => '0',
16
- 'visible_on_front' => 1,
17
- 'source' => 'profile/entity_school',
18
- ));
19
-
20
-
21
- if (version_compare(Mage::getVersion(), '1.6.0', '<='))
22
- {
23
- $customer = Mage::getModel('customer/customer');
24
- $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
25
- $setup->addAttributeToSet('customer', $attrSetId, 'General', 'school');
26
- }
27
-
28
- if (version_compare(Mage::getVersion(), '1.4.2', '>='))
29
- {
30
- Mage::getSingleton('eav/config')
31
- ->getAttribute('customer', 'school')
32
- ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
33
- ->save();
34
-
35
- }
36
-
37
- $tablequote = $this->getTable('sales/quote');
38
- $installer->run("
39
- ALTER TABLE $tablequote ADD `customer_school` INT NOT NULL
40
- ");
41
-
42
-
43
-
44
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/profile.xml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ To change this template, choose Tools | Templates
4
+ and open the template in the editor.
5
+ -->
6
+ <layout version="0.1.0">
7
+ <default>
8
+ </default>
9
+ <profile_adminhtml_customer_attribute_index>
10
+ <reference name="content">
11
+ <block type="profile/adminhtml_customer_attribute" name="profile.customer.attribute" />
12
+ </reference>
13
+ </profile_adminhtml_customer_attribute_index>
14
+
15
+ <profile_adminhtml_customer_attribute_grid>
16
+ <block type="core/text_list" name="root" output="toHtml">
17
+ <block type="profile/adminhtml_customer_attribute_grid" name="profile.customer.attribute.grid"/>
18
+ </block>
19
+ </profile_adminhtml_customer_attribute_grid>
20
+
21
+ <profile_adminhtml_customer_attribute_edit>
22
+ <reference name="head">
23
+ <action method="addJs"><name>profile/conflictAttribute.js</name></action>
24
+ </reference>
25
+ <reference name="left">
26
+ <block type="profile/adminhtml_customer_attribute_edit_tabs" name="attribute_edit_tabs"></block>
27
+ </reference>
28
+ <reference name="content">
29
+ <block type="profile/adminhtml_customer_attribute_edit" name="customer_attribute_edit_content"></block>
30
+ </reference>
31
+ <reference name="js">
32
+ <block type="adminhtml/template" name="attribute_edit_js" template="profile/customer/attribute/js.phtml"></block>
33
+ </reference>
34
+ </profile_adminhtml_customer_attribute_edit>
35
+
36
+ </layout>
app/design/adminhtml/default/default/template/profile/customer/attribute/js.phtml ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+ function saveAndContinueEdit(){
30
+ disableElements('save');
31
+ var activeTab = customer_attribute_tabsJsTabs.activeTab.id;
32
+ if (editForm.submit($('edit_form').action+'back/edit/tab/' + activeTab) == false) {
33
+ enableElements('save');
34
+ }
35
+ varienGlobalEvents.attachEventHandler('formValidateAjaxComplete', function (){
36
+ enableElements('save');
37
+ });
38
+ }
39
+
40
+ function saveAttribute(){
41
+ disableElements('save');
42
+ if (editForm.submit() == false){
43
+ enableElements('save');
44
+ }
45
+ varienGlobalEvents.attachEventHandler('formValidateAjaxComplete', function (){
46
+ enableElements('save');
47
+ });
48
+ }
49
+
50
+ function toggleApplyVisibility(select) {
51
+ if ($(select).value == 1) {
52
+ $(select).next('select').removeClassName('no-display');
53
+ $(select).next('select').removeClassName('ignore-validate');
54
+
55
+ } else {
56
+ $(select).next('select').addClassName('no-display');
57
+ $(select).next('select').addClassName('ignore-validate');
58
+ var options = $(select).next('select').options;
59
+ for( var i=0; i < options.length; i++) {
60
+ options[i].selected = false;
61
+ }
62
+ }
63
+ }
64
+
65
+ function checkOptionsPanelVisibility(){
66
+ if($('matage-options-panel')){
67
+ var panel = $('matage-options-panel');
68
+ if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect')){
69
+ panel.show();
70
+ }
71
+ else {
72
+ panel.hide();
73
+ }
74
+ }
75
+ }
76
+
77
+ function bindAttributeInputType()
78
+ {
79
+ checkOptionsPanelVisibility();
80
+ switchDefaultValueField();
81
+ checkIsConfigurableVisibility();
82
+ if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
83
+ if($('is_filterable') && !$('is_filterable').getAttribute('readonly')){
84
+ $('is_filterable').disabled = false;
85
+ }
86
+ if($('is_filterable_in_search') && !$('is_filterable_in_search').getAttribute('readonly')){
87
+ $('is_filterable_in_search').disabled = false;
88
+ }
89
+ if($('backend_type') && $('backend_type').options){
90
+ for(var i=0;i<$('backend_type').options.length;i++){
91
+ if($('backend_type').options[i].value=='int') $('backend_type').selectedIndex = i;
92
+ }
93
+ }
94
+ }
95
+ else {
96
+ if($('is_filterable')){
97
+ $('is_filterable').selectedIndex=0;
98
+ $('is_filterable').disabled = true;
99
+ }
100
+ if($('is_filterable_in_search')){
101
+ $('is_filterable_in_search').disabled = true;
102
+ }
103
+ }
104
+
105
+ if ($('frontend_input') && ($('frontend_input').value=='multiselect'
106
+ || $('frontend_input').value=='gallery'
107
+ || $('frontend_input').value=='textarea')) {
108
+ if ($('used_for_sort_by')) {
109
+ $('used_for_sort_by').disabled = true;
110
+ }
111
+ }
112
+ else {
113
+ if ($('used_for_sort_by') && !$('used_for_sort_by').getAttribute('readonly')) {
114
+ $('used_for_sort_by').disabled = false;
115
+ }
116
+ }
117
+
118
+ setRowVisibility('is_wysiwyg_enabled', false);
119
+ setRowVisibility('is_html_allowed_on_front', false);
120
+
121
+ switch ($('frontend_input').value) {
122
+ case 'textarea':
123
+ /*setRowVisibility('is_wysiwyg_enabled', true);
124
+ if($('is_wysiwyg_enabled').value == '0'){
125
+ setRowVisibility('is_html_allowed_on_front', true);
126
+ //$('is_html_allowed_on_front').disabled = false;
127
+ }*/
128
+ $('frontend_class').value = '';
129
+ $('frontend_class').disabled = true;
130
+ break;
131
+ case 'text':
132
+ /*setRowVisibility('is_html_allowed_on_front', true);
133
+ $('is_html_allowed_on_front').disabled = false;
134
+ */
135
+ if (!$('frontend_class').getAttribute('readonly')) {
136
+ $('frontend_class').disabled = false;
137
+ }
138
+ break;
139
+ case 'select':
140
+ case 'multiselect':
141
+ /*setRowVisibility('is_html_allowed_on_front', true);
142
+ $('is_html_allowed_on_front').disabled = false;*/
143
+ break;
144
+ default:
145
+ $('frontend_class').value = '';
146
+ $('frontend_class').disabled = true;
147
+ }
148
+
149
+ switchIsFilterable();
150
+ }
151
+
152
+ function switchIsFilterable()
153
+ {
154
+ if ($('is_filterable')) {
155
+ if ($('is_filterable').selectedIndex == 0) {
156
+ $('position').disabled = true;
157
+ } else {
158
+ if (!$('position').getAttribute('readonly')){
159
+ $('position').disabled = false;
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ function disableApplyToValue(value)
166
+ {
167
+ var applyToSelect = $('apply_to');
168
+ for (i=0;i<applyToSelect.options.length;i++) {
169
+ if (value == applyToSelect.options[i].value) {
170
+ applyToSelect.options[i].disabled = true;
171
+ applyToSelect.options[i].selected = false;
172
+ }
173
+ }
174
+ }
175
+
176
+ function switchDefaultValueField()
177
+ {
178
+ if (!$('frontend_input')) {
179
+ return;
180
+ }
181
+
182
+ var currentValue = $('frontend_input').value;
183
+
184
+ var defaultValueTextVisibility = false;
185
+ var defaultValueTextareaVisibility = false;
186
+ var defaultValueDateVisibility = false;
187
+ var defaultValueYesnoVisibility = false;
188
+ var scopeVisibility = true;
189
+
190
+ switch (currentValue) {
191
+ case 'select':
192
+ optionDefaultInputType = 'radio';
193
+ break;
194
+
195
+ case 'multiselect':
196
+ optionDefaultInputType = 'checkbox';
197
+ break;
198
+
199
+ case 'date':
200
+ defaultValueDateVisibility = true;
201
+ break;
202
+
203
+ case 'boolean':
204
+ defaultValueYesnoVisibility = true;
205
+ break;
206
+
207
+ case 'textarea':
208
+ defaultValueTextareaVisibility = true;
209
+ break;
210
+
211
+ case 'media_image':
212
+ defaultValueTextVisibility = false;
213
+ break;
214
+ case 'price':
215
+ scopeVisibility = false;
216
+ default:
217
+ defaultValueTextVisibility = true;
218
+ break;
219
+ }
220
+
221
+
222
+
223
+ switch (currentValue) {
224
+ case 'media_image':
225
+ $('base_fieldset').previous().hide();
226
+ $('base_fieldset').hide();
227
+
228
+ setRowVisibility('is_required', false);
229
+ setRowVisibility('is_unique', false);
230
+ setRowVisibility('frontend_class', false);
231
+ break;
232
+
233
+ <?php foreach (Mage::helper('profile')->getAttributeHiddenFields() as $type=>$fields): ?>
234
+ case '<?php echo $type; ?>':
235
+ <?php foreach ($fields as $one): ?>
236
+ <?php if ($one == '_base_fieldset'): ?>
237
+ $('base_fieldset').previous().hide();
238
+ $('base_fieldset').hide();
239
+ <?php elseif ($one == '_default_value'): ?>
240
+ defaultValueTextVisibility =
241
+ defaultValueTextareaVisibility =
242
+ defaultValueDateVisibility =
243
+ defaultValueYesnoVisibility = false;
244
+ <?php elseif ($one == '_scope'): ?>
245
+ scopeVisibility = false;
246
+ <?php else: ?>
247
+ setRowVisibility('<?php echo $one; ?>', false);
248
+ <?php endif; ?>
249
+ <?php endforeach; ?>
250
+ break;
251
+ <?php endforeach; ?>
252
+
253
+ default:
254
+ $('base_fieldset').previous().show();
255
+ $('base_fieldset').show();
256
+ setRowVisibility('is_required', true);
257
+ setRowVisibility('is_unique', true);
258
+ setRowVisibility('frontend_class', true);
259
+ setRowVisibility('is_configurable', true);
260
+ break;
261
+ }
262
+
263
+ setRowVisibility('default_value_text', defaultValueTextVisibility);
264
+ setRowVisibility('default_value_textarea', defaultValueTextareaVisibility);
265
+ setRowVisibility('default_value_date', defaultValueDateVisibility);
266
+ setRowVisibility('default_value_yesno', defaultValueYesnoVisibility);
267
+ setRowVisibility('is_global', scopeVisibility);
268
+
269
+ var elems = document.getElementsByName('default[]');
270
+ for (var i = 0; i < elems.length; i++) {
271
+ elems[i].type = optionDefaultInputType;
272
+ }
273
+ }
274
+
275
+ function setRowVisibility(id, isVisible)
276
+ {
277
+ if ($(id)) {
278
+ var td = $(id).parentNode;
279
+ var tr = $(td.parentNode);
280
+
281
+ if (isVisible) {
282
+ tr.show();
283
+ } else {
284
+ tr.blur();
285
+ tr.hide();
286
+ }
287
+ }
288
+ }
289
+
290
+ function checkIsConfigurableVisibility()
291
+ {
292
+ if (!$('is_configurable') || !$('is_global') || !$('frontend_input')) return;
293
+ if ($F('is_global')==1 && $F('frontend_input')=='select') {
294
+ setRowVisibility('is_configurable', true);
295
+ } else {
296
+ setRowVisibility('is_configurable', false);
297
+ }
298
+ }
299
+
300
+ function updateRequriedOptions()
301
+ {
302
+ if ($F('frontend_input')=='select' && $F('is_required')==1) {
303
+ $('option-count-check').addClassName('required-options-count');
304
+ } else {
305
+ $('option-count-check').removeClassName('required-options-count');
306
+ }
307
+ }
308
+
309
+ if($('frontend_input')){
310
+ Event.observe($('frontend_input'), 'change', updateRequriedOptions);
311
+ Event.observe($('frontend_input'), 'change', bindAttributeInputType);
312
+ Event.observe($('is_global'), 'change', checkIsConfigurableVisibility);
313
+ }
314
+
315
+ if ($('is_filterable')) {
316
+ Event.observe($('is_filterable'), 'change', switchIsFilterable);
317
+ }
318
+
319
+ if ($('is_required')) {
320
+ Event.observe($('is_required'), 'change', updateRequriedOptions);
321
+ }
322
+ bindAttributeInputType();
323
+ //]]>
324
+
325
+
326
+
327
+
328
+
329
+ </script>
app/design/frontend/base/default/layout/profile.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customer_account_create>
6
+ <reference name="form.additional.info">
7
+ <block type="profile/customer_account_create" name="profile.form.additional.info" template="profile/customer/account/create.phtml" before="captcha" after="-" />
8
+ </reference>
9
+ </customer_account_create>
10
+ <customer_account_edit>
11
+ <reference name='content'>
12
+ <block type="profile/customer_account_create" name="profile.form.additional.info" template="profile/customer/account/edit.phtml" />
13
+ </reference>
14
+ </customer_account_edit>
15
+
16
+ <!--
17
+ <checkout_onepage_index>
18
+ <reference name="checkout.onepage.billing">
19
+ <reference name="form.additional.info">
20
+ <block type="profile/customer_account_create" name="profile.form.additional.info" template="profile/customer/account/edit.phtml" >
21
+ <action method="setData">
22
+ <name>mode</name>
23
+ <value>billing</value>
24
+ </action>
25
+ <action method="setData">
26
+ <name>step</name>
27
+ <value>onepage</value>
28
+ </action>
29
+ </block>
30
+ </reference>
31
+ </reference>
32
+ </checkout_onepage_index>
33
+ -->
34
+ </layout>
app/design/frontend/base/default/template/profile/customer/account/create.phtml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+ ?>
8
+ <?php
9
+ foreach($this->getAttributeCodes() as $_attributeCode)
10
+ {
11
+ ?>
12
+ <li class="fields amar-profile">
13
+ <?php echo $this->getAttributeFrontendHtmlControl($_attributeCode); ?>
14
+ </li>
15
+ <?php
16
+ }
17
+ ?>
18
+
19
+ <script type="text/javascript">
20
+ document.observe("dom:loaded",function(){
21
+ var amarProfileLis = $$('li.amar-profile');
22
+
23
+ $$("div.fieldset").each(function(ele,index){
24
+ if(ele.down("h2.legend",0).textContent == '<?php echo $this->__('Personal Information') ?>')
25
+ {
26
+ var ulElement = ele.down("ul.form-list",0);
27
+ amarProfileLis.each(function(el,ind){
28
+ var liElement = new Element("li");
29
+ liElement.addClassName("fields");
30
+ liElement.innerHTML = el.innerHTML;
31
+
32
+ if(ulElement.select("li.control").length > 0)
33
+ {
34
+ ulElement.select("li.control").each(function(e,i){
35
+ if(i == 0)
36
+ {
37
+ e.insert({"before":liElement});
38
+ }
39
+ });
40
+ }
41
+ else
42
+ {
43
+ ulElement.insert({"bottom":liElement});
44
+ }
45
+ el.remove();
46
+ });
47
+ }
48
+ });
49
+ });
50
+ </script>
app/design/frontend/base/default/template/profile/customer/account/edit.phtml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this template, choose Tools | Templates
5
+ * and open the template in the editor.
6
+ */
7
+ ?>
8
+ <?php
9
+
10
+ foreach($this->getAttributeCodes() as $_attributeCode)
11
+ {
12
+ ?>
13
+ <li class="fields amar-profile">
14
+ <?php echo $this->getAttributeFrontendHtmlControl($_attributeCode); ?>
15
+ </li>
16
+ <?php
17
+ }
18
+ ?>
19
+
20
+ <script type="text/javascript">
21
+ document.observe("dom:loaded",function(){
22
+ var amarProfileLis = $$('li.amar-profile');
23
+
24
+ $$("div.fieldset").each(function(ele,index){
25
+ if(ele.down("h2.legend",0).textContent == '<?php echo $this->__('Account Information') ?>')
26
+ {
27
+ var ulElement = ele.down("ul.form-list",0);
28
+ amarProfileLis.each(function(el,ind){
29
+ var liElement = new Element("li");
30
+ liElement.addClassName("fields");
31
+ liElement.innerHTML = el.innerHTML;
32
+
33
+ if(ulElement.select("li.control").length > 0)
34
+ {
35
+ ulElement.select("li.control").each(function(e,i){
36
+ if(i == 0)
37
+ {
38
+ e.insert({"before":liElement});
39
+ }
40
+ });
41
+ }
42
+ else
43
+ {
44
+ ulElement.insert({"bottom":liElement});
45
+ }
46
+ el.remove();
47
+ });
48
+ }
49
+ });
50
+ });
51
+ </script>
app/design/frontend/default/default/layout/profile.xml DELETED
@@ -1,20 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- </default>
5
- <customer_account_create>
6
- <reference name="customer_form_register">
7
- <action method="setTemplate"><template>profile/persistent/customer/form/register.phtml</template></action>
8
- </reference>
9
- </customer_account_create>
10
- <customer_account_edit>
11
- <reference name='customer_edit'>
12
- <action method="setTemplate"><template>profile/customer/form/edit.phtml</template></action>
13
- </reference>
14
- </customer_account_edit>
15
- <checkout_onepage_index>
16
- <reference name="checkout.onepage.billing">
17
- <action method="setTemplate"><template>profile/persistent/checkout/onepage/billing.phtml</template></action>
18
- </reference>
19
- </checkout_onepage_index>
20
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/profile/customer/form/edit.phtml DELETED
@@ -1,104 +0,0 @@
1
- <div class="page-title">
2
- <h1><?php echo $this->__('Edit Account Information') ?></h1>
3
- </div>
4
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
5
- <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
6
- <div class="fieldset">
7
- <?php echo $this->getBlockHtml('formkey')?>
8
- <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
9
- <ul class="form-list">
10
- <li class="fields">
11
- <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
12
- </li>
13
- <li>
14
- <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
15
- <div class="input-box">
16
- <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" />
17
- </div>
18
- </li>
19
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
20
- <?php if ($_dob->isEnabled()): ?>
21
- <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
22
- <?php endif ?>
23
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
24
- <?php if ($_taxvat->isEnabled()): ?>
25
- <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
26
- <?php endif ?>
27
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
28
- <?php if ($_gender->isEnabled()): ?>
29
- <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
30
- <?php endif ?>
31
- <li class="control">
32
- <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>
33
- </li>
34
- <li>
35
- <?php
36
- $attribute = Mage::getModel('eav/config')->getAttribute('customer','school');
37
- ?>
38
- <label for="is_active" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('School') ?></label>
39
- <div class="input-box">
40
- <select name="school" id="school" class="<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>">
41
- <?php
42
- $options = $attribute->getSource()->getAllOptions();
43
- foreach($options as $option){
44
- ?>
45
- <option value='<?php echo $option['value']?>' <?php if($this->getCustomer()->getSchool() == $option['value']){ echo 'selected="selected"';}?>><?php echo $this->__($option['label'])?></option>
46
- <?php } ?>
47
- </select>
48
- </div>
49
- </li>
50
- </ul>
51
- </div>
52
- <div class="fieldset" style="display:none;">
53
- <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
54
- <ul class="form-list">
55
- <li>
56
- <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
57
- <div class="input-box">
58
- <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" />
59
- </div>
60
- </li>
61
- <li class="fields">
62
- <div class="field">
63
- <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
64
- <div class="input-box">
65
- <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" />
66
- </div>
67
- </div>
68
- <div class="field">
69
- <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
70
- <div class="input-box">
71
- <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
72
- </div>
73
- </div>
74
- </li>
75
- </ul>
76
- </div>
77
- <div class="buttons-set">
78
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
79
- <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
80
- <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
81
- </div>
82
- </form>
83
- <script type="text/javascript">
84
- //<![CDATA[
85
- var dataForm = new VarienForm('form-validate', true);
86
- function setPasswordForm(arg){
87
- if(arg){
88
- $('current_password').up(3).show();
89
- $('current_password').addClassName('required-entry');
90
- $('password').addClassName('required-entry');
91
- $('confirmation').addClassName('required-entry');
92
-
93
- }else{
94
- $('current_password').up(3).hide();
95
- $('current_password').removeClassName('required-entry');
96
- $('password').removeClassName('required-entry');
97
- $('confirmation').removeClassName('required-entry');
98
- }
99
- }
100
- <?php if($this->getCustomer()->getChangePassword()): ?>
101
- setPasswordForm(true);
102
- <?php endif; ?>
103
- //]]>
104
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/profile/persistent/checkout/onepage/billing.phtml DELETED
@@ -1,215 +0,0 @@
1
- <form id="co-billing-form" action="">
2
- <fieldset>
3
- <ul class="form-list">
4
- <?php if ($this->customerHasAddresses()): ?>
5
- <li class="wide">
6
- <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
7
- <div class="input-box">
8
- <?php echo $this->getAddressesHtmlSelect('billing') ?>
9
- </div>
10
- </li>
11
- <?php endif; ?>
12
- <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
13
- <fieldset>
14
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
15
- <ul>
16
- <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>
17
- <li class="fields">
18
- <div class="field">
19
- <label for="billing:company"><?php echo $this->__('Company') ?></label>
20
- <div class="input-box">
21
- <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" />
22
- </div>
23
- </div>
24
- <?php if(!$this->isCustomerLoggedIn()): ?>
25
- <div class="field">
26
- <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
27
- <div class="input-box">
28
- <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" />
29
- </div>
30
- </div>
31
- <?php endif ?>
32
- </li>
33
- <li class="wide">
34
- <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
35
- <div class="input-box">
36
- <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" />
37
- </div>
38
- </li>
39
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
40
- <li class="wide">
41
- <div class="input-box">
42
- <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" />
43
- </div>
44
- </li>
45
- <?php endfor ?>
46
- <li class="fields">
47
- <div class="field">
48
- <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
49
- <div class="input-box">
50
- <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" />
51
- </div>
52
- </div>
53
- <div class="field">
54
- <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
55
- <div class="input-box">
56
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
57
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
58
- </select>
59
- <script type="text/javascript">
60
- //<![CDATA[
61
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
62
- //]]>
63
- </script>
64
- <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;" />
65
- </div>
66
- </div>
67
- </li>
68
- <li class="fields">
69
- <div class="field">
70
- <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
71
- <div class="input-box">
72
- <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" />
73
- </div>
74
- </div>
75
- <div class="field">
76
- <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
77
- <div class="input-box">
78
- <?php echo $this->getCountryHtmlSelect('billing') ?>
79
- </div>
80
- </div>
81
- </li>
82
- <li class="fields">
83
- <div class="field">
84
- <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
85
- <div class="input-box">
86
- <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" />
87
- </div>
88
- </div>
89
- <div class="field">
90
- <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
91
- <div class="input-box">
92
- <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" />
93
- </div>
94
- </div>
95
- </li>
96
-
97
-
98
- <?php if(!$this->isCustomerLoggedIn()): ?>
99
-
100
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
101
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
102
- <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
103
- <li class="fields">
104
- <?php if ($_dob->isEnabled()): ?>
105
- <div class="field">
106
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
107
- </div>
108
- <?php endif; ?>
109
- <?php if ($_gender->isEnabled()): ?>
110
- <div class="field">
111
- <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
112
- </div>
113
- <?php endif ?>
114
- </li>
115
- <?php endif ?>
116
-
117
- <?php if ($this->isTaxvatEnabled()):?>
118
- <li><?php echo $this->getTaxvatHtml() ?></li>
119
- <?php endif; ?>
120
-
121
- <li>
122
- <?php
123
- $attribute = Mage::getModel('eav/config')->getAttribute('customer','school');
124
- ?>
125
- <label for="school" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('School') ?></label>
126
- <div class="input-box">
127
- <select name="billing[school]" id="school" class="<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>">
128
- <?php
129
- $options = $attribute->getSource()->getAllOptions();
130
- foreach($options as $option){
131
- ?>
132
- <option value='<?php echo $option['value']?>'><?php echo $this->__($option['label'])?></option>
133
- <?php } ?>
134
- </select>
135
- </div>
136
- </li>
137
-
138
- <li class="fields" id="register-customer-password">
139
- <div class="field">
140
- <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
141
- <div class="input-box">
142
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
143
- </div>
144
- </div>
145
- <div class="field">
146
- <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
147
- <div class="input-box">
148
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
149
- </div>
150
- </div>
151
- </li>
152
- <?php echo $this->getChildHtml('persistent.remember.me'); ?>
153
- <?php endif; ?>
154
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
155
- <li class="control">
156
- <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>
157
- </li>
158
- <?php else:?>
159
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
160
- <?php endif; ?>
161
- </ul>
162
- <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
163
- </fieldset>
164
- </li>
165
- <li class="fields">
166
- <div class="field">
167
- <label for="billing:ssn" class="required"><em>*</em><?php echo $this->__('SSN') ?></label>
168
- <div class="input-box">
169
- <input type="text" name="custom[ssn]" value="<?php echo $this->htmlEscape($this->getQuote()->getSsn()) ?>" title="<?php echo $this->__('SSN') ?>" class="input-text required-entry" id="billing:ssn" />
170
- </div>
171
- </div>
172
-
173
- </li>
174
- <?php if ($this->canShip()): ?>
175
- <li class="control">
176
- <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>
177
- <li class="control">
178
- <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>
179
- </li>
180
- <?php endif; ?>
181
- </ul>
182
- <?php if (!$this->canShip()): ?>
183
- <input type="hidden" name="billing[use_for_shipping]" value="1" />
184
- <?php endif; ?>
185
- <div class="buttons-set" id="billing-buttons-container">
186
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
187
- <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
188
- <span class="please-wait" id="billing-please-wait" style="display:none;">
189
- <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...') ?>
190
- </span>
191
- </div>
192
- </fieldset>
193
- </form>
194
- <script type="text/javascript">
195
- //<![CDATA[
196
- var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
197
- var billingForm = new VarienForm('co-billing-form');
198
-
199
- //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
200
- $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
201
-
202
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
203
- Event.observe($('onepage-guest-register-button'), 'click', function(event) {
204
- var billingRememberMe = $$('#billing-new-address-form li #remember-me-box');
205
- if(billingRememberMe.length > 0) {
206
- billingRememberMe = $(billingRememberMe[0].parentNode);
207
- if ($('login:guest') && $('login:guest').checked) {
208
- billingRememberMe.hide();
209
- } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
210
- billingRememberMe.show();
211
- }
212
- }
213
- })
214
- //]]>
215
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/profile/persistent/customer/form/register.phtml DELETED
@@ -1,171 +0,0 @@
1
- <div class="account-create">
2
- <div class="page-title">
3
- <h1><?php echo $this->__('Create an Account') ?></h1>
4
- </div>
5
- <?php echo $this->getChildHtml('form_fields_before')?>
6
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
7
- <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
8
- <div class="fieldset">
9
- <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
10
- <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
11
- <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
12
- <ul class="form-list">
13
- <li class="fields">
14
- <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
15
- </li>
16
- <li>
17
- <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
18
- <div class="input-box">
19
- <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
20
- </div>
21
- </li>
22
- <?php if ($this->isNewsletterEnabled()): ?>
23
- <li class="control">
24
- <div class="input-box">
25
- <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" />
26
- </div>
27
- <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
28
- </li>
29
- <?php endif ?>
30
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
- <?php if ($_dob->isEnabled()): ?>
32
- <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
33
- <?php endif ?>
34
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
- <?php if ($_taxvat->isEnabled()): ?>
36
- <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
37
- <?php endif ?>
38
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
- <?php if ($_gender->isEnabled()): ?>
40
- <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
41
- <?php endif ?>
42
- <li>
43
- <?php
44
- $attribute = Mage::getModel('eav/config')->getAttribute('customer','school');
45
- ?>
46
- <label for="school" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('School') ?></label>
47
- <div class="input-box">
48
- <select name="school" id="school" class="<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>">
49
- <?php
50
- $options = $attribute->getSource()->getAllOptions();
51
- foreach($options as $option){
52
- ?>
53
- <option value='<?php echo $option['value']?>' <?php if($this->getFormData()->getSchool() == $option['value']){ echo 'selected="selected"';}?>><?php echo $this->__($option['label'])?></option>
54
- <?php } ?>
55
- </select>
56
- </div>
57
- </li>
58
- </ul>
59
- </div>
60
- <?php if($this->getShowAddressFields()): ?>
61
- <div class="fieldset">
62
- <input type="hidden" name="create_address" value="1" />
63
- <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
64
- <ul class="form-list">
65
- <li class="fields">
66
- <div class="field">
67
- <label for="company"><?php echo $this->__('Company') ?></label>
68
- <div class="input-box">
69
- <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
70
- </div>
71
- </div>
72
- <div class="field">
73
- <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
74
- <div class="input-box">
75
- <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" />
76
- </div>
77
- </div>
78
- </li>
79
- <li class="wide">
80
- <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
81
- <div class="input-box">
82
- <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" />
83
- </div>
84
- </li>
85
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
86
- <li class="wide">
87
- <div class="input-box">
88
- <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" />
89
- </div>
90
- </li>
91
- <?php endfor ?>
92
- <li class="fields">
93
- <div class="field">
94
- <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
95
- <div class="input-box">
96
- <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" />
97
- </div>
98
- </div>
99
- <div class="field">
100
- <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
101
- <div class="input-box">
102
- <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
103
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
104
- </select>
105
- <script type="text/javascript">
106
- //<![CDATA[
107
- $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
108
- //]]>
109
- </script>
110
- <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;" />
111
- </div>
112
- </div>
113
- </li>
114
- <li class="fields">
115
- <div class="field">
116
- <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
117
- <div class="input-box">
118
- <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" />
119
- </div>
120
- </div>
121
- <div class="field">
122
- <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
123
- <div class="input-box">
124
- <?php echo $this->getCountryHtmlSelect() ?>
125
- </div>
126
- </div>
127
- </li>
128
- </ul>
129
- <input type="hidden" name="default_billing" value="1" />
130
- <input type="hidden" name="default_shipping" value="1" />
131
- </div>
132
- <?php endif; ?>
133
- <div class="fieldset">
134
- <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
135
- <ul class="form-list">
136
- <li class="fields">
137
- <div class="field">
138
- <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
139
- <div class="input-box">
140
- <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
141
- </div>
142
- </div>
143
- <div class="field">
144
- <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
145
- <div class="input-box">
146
- <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
147
- </div>
148
- </div>
149
- </li>
150
- <?php echo $this->getChildHtml('persistent.remember.me'); ?>
151
- </ul>
152
- <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
153
- </div>
154
- <div class="buttons-set">
155
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
156
- <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
157
- <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
158
- </div>
159
- <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
160
- <input name="context" type="hidden" value="checkout" />
161
- <?php endif; ?>
162
- </form>
163
- <script type="text/javascript">
164
- //<![CDATA[
165
- var dataForm = new VarienForm('form-validate', true);
166
- <?php if($this->getShowAddressFields()): ?>
167
- new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
168
- <?php endif; ?>
169
- //]]>
170
- </script>
171
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Amar_Profile.xml CHANGED
@@ -3,7 +3,7 @@
3
  <modules>
4
  <Amar_Profile>
5
  <active>true</active>
6
- <codePool>local</codePool>
7
  </Amar_Profile>
8
  </modules>
9
  </config>
3
  <modules>
4
  <Amar_Profile>
5
  <active>true</active>
6
+ <codePool>community</codePool>
7
  </Amar_Profile>
8
  </modules>
9
  </config>
js/profile/conflictAttribute.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+
7
+
8
+ FormElementDependenceController.prototype.trackChange = function(e, idTo, valuesFrom)
9
+ {
10
+ // define whether the target should show up
11
+ var shouldShowUp = true;
12
+ for (var idFrom in valuesFrom) {
13
+ var from = $(idFrom);
14
+ if (valuesFrom[idFrom] instanceof Array) {
15
+ if (!from || valuesFrom[idFrom].indexOf(from.value) == -1) {
16
+ shouldShowUp = false;
17
+ }
18
+ } else {
19
+ if (!from || from.value != valuesFrom[idFrom]) {
20
+ shouldShowUp = false;
21
+ }
22
+ }
23
+ }
24
+ // toggle target row
25
+ if($(idTo) != null)
26
+ {
27
+ if (shouldShowUp) {
28
+ var currentConfig = this._config;
29
+ $(idTo).up(this._config.levels_up).select('input', 'select', 'td').each(function (item) {
30
+ // don't touch hidden inputs (and Use Default inputs too), bc they may have custom logic
31
+ if ((!item.type || item.type != 'hidden') && !($(item.id+'_inherit') && $(item.id+'_inherit').checked)
32
+ && !(currentConfig.can_edit_price != undefined && !currentConfig.can_edit_price)) {
33
+ item.disabled = false;
34
+ }
35
+ });
36
+ $(idTo).up(this._config.levels_up).show();
37
+ } else {
38
+ $(idTo).up(this._config.levels_up).select('input', 'select', 'td').each(function (item){
39
+ // don't touch hidden inputs (and Use Default inputs too), bc they may have custom logic
40
+ if ((!item.type || item.type != 'hidden') && !($(item.id+'_inherit') && $(item.id+'_inherit').checked)) {
41
+ item.disabled = true;
42
+ }
43
+ });
44
+ $(idTo).up(this._config.levels_up).hide();
45
+ }
46
+ }
47
+ }
48
+
package.xml CHANGED
@@ -1,24 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Amar_Profile</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>This is extension to add new fields to customer account pages.</summary>
10
- <description>This is extension to add new fields to customer account pages i.e registration,edit profile, checkout and admin manage customer.&#xD;
11
- &#xD;
12
- version : 0.1.0&#xD;
13
- stability : stable</description>
14
- <notes>This is extension to add new fields to customer account pages i.e registration,edit profile, checkout and admin manage customer.&#xD;
15
- &#xD;
16
- version : 0.1.0&#xD;
17
- stability : stable</notes>
18
- <authors><author><name>Chirag</name><user>auto-converted</user><email>info@amarinfotech.com</email></author></authors>
19
- <date>2012-07-04</date>
20
- <time>10:23:09</time>
21
- <contents><target name="magelocal"><dir name="Amar"><dir name="Profile"><dir name="Block"><file name="Profile.php" hash="f64035ee37649dd45ad77720cc8226db"/></dir><dir name="Helper"><file name="Data.php" hash="da3cf1e92e2444417475cfea8d6341ac"/></dir><dir name="Model"><dir name="Entity"><file name="School.php" hash="c1641144aaef0390915f8671584e5f8e"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="84f1bc97bba2242ed1319b4315ea62ff"/></dir><dir name="etc"><file name="config.xml" hash="0b54ad52e507a5238c01afe38373c438"/></dir><dir name="sql"><dir name="profile_setup"><file name="mysql4-install-0.1.0.php" hash="ba93987c41e326ae38c26f42204fd18f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="profile"><dir name="customer"><dir name="form"><file name="edit.phtml" hash="9d2e737eca300810b5615b943da62321"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="b54846854877bfcadcfeaafba3925d57"/></dir></dir><dir name="customer"><dir name="form"><file name="register.phtml" hash="7c71b0c8518c40320aafc1eafc59ced6"/></dir></dir></dir></dir></dir><dir name="layout"><file name="profile.xml" hash="273fd1631aadf27966292be5068b219c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amar_Profile.xml" hash="437354baf6756c1ae88ee3cf10826748"/></dir></target></contents>
22
  <compatible/>
23
- <dependencies/>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Amar_Profile</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>This Extension helps to create the customer attribute and provides the backend control to create and manage and create attribute will be used in customer general information.</summary>
10
+ <description>This Extension helps to create the customer attribute and provides the backend control to create and manage and create attribute will be used in customer general information.</description>
11
+ <notes>This Extension helps to create the customer attribute and provides the backend control to create and manage and create attribute will be used in customer general information</notes>
12
+ <authors><author><name>AmarInfotech</name><user>Amar</user><email>info@amarinfotech.com</email></author></authors>
13
+ <date>2014-05-22</date>
14
+ <time>12:58:30</time>
15
+ <contents><target name="magecommunity"><dir name="Amar"><dir name="Profile"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Attribute"><dir name="Edit"><file name="Form.php" hash="bc8725fc0ed75bfa0741eb38e6c77faf"/><dir name="Tab"><file name="Main.php" hash="de003fabb3f4c8a11e66f4b39ce89c26"/><file name="Options.php" hash="f8a9b18c7acf71ddf34b6f23ca24a57c"/><file name="System.php" hash="50d582b0f580a5a524700b6c59029bc5"/></dir><file name="Tabs.php" hash="c6680da61dda70e123412c47224919e5"/></dir><file name="Edit.php" hash="b0ec4086b79c6cd1fe43444523b9d2be"/><file name="Grid.php" hash="72120452b25513d160493c76403bce4d"/></dir><file name="Attribute.php" hash="ea0c9db354e9826536857059a84e14e7"/></dir></dir><dir name="Customer"><dir name="Account"><file name="Create.php" hash="0a8fdd9007f9bc1ea033c6ff835cfdbe"/></dir></dir><file name="Profile.php" hash="f64035ee37649dd45ad77720cc8226db"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Customer"><file name="AttributeController.php" hash="0e37edc5c370f2d3107fd860ab7f0313"/></dir></dir><file name="IndexController.php" hash="84f1bc97bba2242ed1319b4315ea62ff"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c0937f0cf17ab2a47d20027836b3a1cc"/><file name="config.xml" hash="5b38c4cd2d3ec758466873969295a7a7"/></dir><dir name="Helper"><file name="Data.php" hash="178a285868201245fb3081568b47d748"/><file name="Product.php" hash="5bbeb6168666b6298c0a8b6cf0da1f62"/></dir><dir name="Model"><dir name="Customer"><file name="Attribute.php" hash="d8eaeb270892965ab6f3515f6cf7d7c1"/></dir><dir name="Mysql4"><dir name="Customer"><dir name="Attribute"><file name="Collection.php" hash="7649220d3fbc1609540e8da38b5c5dbf"/></dir></dir><dir name="Profile"><file name="Collection.php" hash="cf117bb9387b6585138459e5e4893aab"/></dir><file name="Profile.php" hash="52e2360f0bd30ed858dd2cc7ef724a51"/><file name="Setup.php" hash="3ec40b3b2d0d7149503f2ab2f3683169"/></dir><file name="Profile.php" hash="ce2bc5a09bdb4fe4bec277462e6ac3f6"/></dir><dir name="sql"><dir name="profile_setup"><file name="mysql4-install-0.2.0.php" hash="d8834258f80ec582edb79d558bd747ae"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amar_Profile.xml" hash="413caa965c13cb857187e5975a6a3015"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="profile.xml" hash="f8a396e7610ec278706485316bf2771a"/></dir><dir name="template"><dir name="profile"><dir name="customer"><dir name="attribute"><file name="js.phtml" hash="58c136f2c9a5408eff512b2c8ba6fc59"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="profile.xml" hash="5b5d2d7ba00c3e24584715074e6bf543"/></dir><dir name="template"><dir name="profile"><dir name="customer"><dir name="account"><file name="create.phtml" hash="6d809f0a3afb7b24caff55de79fb8367"/><file name="edit.phtml" hash="68932091cccd0dba2655638df0ff1d3d"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="profile"><file name="conflictAttribute.js" hash="429061ff085844228016d377843929e8"/></dir></dir></target></contents>
 
 
 
 
 
 
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Amar_Profile</name><channel>community</channel><min>1.6</min><max>1.9</max></package></required></dependencies>
18
  </package>