Custom_Attributemanager - Version 0.0.6

Version Notes

Manage customer attributes and collect more information from customers.

Download this release

Release Info

Developer Magento Core Team
Extension Custom_Attributemanager
Version 0.0.6
Comparing to
See all releases


Version 0.0.6

Files changed (27) hide show
  1. app/code/community/Custom/Attributemanager/Block/Adminhtml/Customer/Edit/Tab/Account.php +207 -0
  2. app/code/community/Custom/Attributemanager/Block/Attributemanager.php +24 -0
  3. app/code/community/Custom/Attributemanager/Block/Edit.php +108 -0
  4. app/code/community/Custom/Attributemanager/Block/Edit/Form.php +11 -0
  5. app/code/community/Custom/Attributemanager/Block/Edit/Tab/Front.php +72 -0
  6. app/code/community/Custom/Attributemanager/Block/Edit/Tab/Main.php +270 -0
  7. app/code/community/Custom/Attributemanager/Block/Edit/Tab/Options.php +152 -0
  8. app/code/community/Custom/Attributemanager/Block/Edit/Tab/System.php +103 -0
  9. app/code/community/Custom/Attributemanager/Block/Edit/Tabs.php +42 -0
  10. app/code/community/Custom/Attributemanager/Block/Grid.php +164 -0
  11. app/code/community/Custom/Attributemanager/Helper/Data.php +4 -0
  12. app/code/community/Custom/Attributemanager/Model/Attributemanager.php +44 -0
  13. app/code/community/Custom/Attributemanager/controllers/IndexController.php +270 -0
  14. app/code/community/Custom/Attributemanager/etc/config.xml +93 -0
  15. app/design/adminhtml/default/default/layout/attributemanager.xml +33 -0
  16. app/design/adminhtml/default/default/template/attributemanager/grid.phtml +179 -0
  17. app/design/adminhtml/default/default/template/attributemanager/index.phtml +21 -0
  18. app/design/adminhtml/default/default/template/attributemanager/js.phtml +274 -0
  19. app/design/adminhtml/default/default/template/attributemanager/new/created.phtml +54 -0
  20. app/design/adminhtml/default/default/template/attributemanager/options.phtml +178 -0
  21. app/design/frontend/default/default/layout/attributemanager.xml +32 -0
  22. app/design/frontend/default/default/template/customer/form/edit.phtml +199 -0
  23. app/design/frontend/default/default/template/customer/form/register.phtml +271 -0
  24. app/design/frontend/default/default/template/persistent/customer/form/edit.phtml +201 -0
  25. app/design/frontend/default/default/template/persistent/customer/form/register.phtml +268 -0
  26. app/etc/modules/Custom_Attributemanager.xml +9 -0
  27. package.xml +22 -0
app/code/community/Custom/Attributemanager/Block/Adminhtml/Customer/Edit/Tab/Account.php ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Adminhtml_Customer_Edit_Tab_Account extends Mage_Adminhtml_Block_Customer_Edit_Tab_Account
3
+ {
4
+ public function initForm()
5
+ {
6
+ $form = new Varien_Data_Form();
7
+ $form->setHtmlIdPrefix('_account');
8
+ $form->setFieldNameSuffix('account');
9
+
10
+ $customer = Mage::registry('current_customer');
11
+
12
+ /* @var $customerForm Mage_Customer_Model_Form */
13
+ $customerForm = Mage::getModel('customer/form');
14
+ $customerForm->setEntity($customer)
15
+ ->setFormCode('adminhtml_customer')
16
+ ->initDefaultValues();
17
+
18
+ $fieldset = $form->addFieldset('base_fieldset',
19
+ array('legend'=>Mage::helper('customer')->__('Account Information'))
20
+ );
21
+
22
+ $attributes = $customerForm->getAttributes();
23
+
24
+ foreach ($attributes as $attribute) {
25
+ $attribute->unsIsVisible();
26
+ }
27
+ $this->_setFieldset($attributes, $fieldset);
28
+
29
+ if ($customer->getId()) {
30
+ $form->getElement('website_id')->setDisabled('disabled');
31
+ $form->getElement('created_in')->setDisabled('disabled');
32
+ } else {
33
+ $fieldset->removeField('created_in');
34
+ }
35
+
36
+ if (Mage::app()->isSingleStoreMode()) {
37
+ $fieldset->removeField('website_id');
38
+ $fieldset->addField('website_id', 'hidden', array(
39
+ 'name' => 'website_id'
40
+ ));
41
+ $customer->setWebsiteId(Mage::app()->getStore(true)->getWebsiteId());
42
+ }
43
+
44
+ $customer_group_id = $customer->getGroupId();
45
+
46
+ $fieldsetcompany = $form->addFieldset('more_fieldset',
47
+ array('legend'=>Mage::helper('customer')->__('More Information'))
48
+ );
49
+
50
+ $js_arr = array();
51
+ foreach ($attributes as $attribute) {
52
+
53
+ if($attribute->getIsUserDefined()) {
54
+ // remove field from base fieldset
55
+ $fieldset->removeField($attribute->getAttributeCode());
56
+
57
+ // insert field in our custom fieldset
58
+ if($attribute->getFrontendInput() == 'boolean' || $attribute->getFrontendInput() == 'select' || $attribute->getFrontendInput() == 'checkbox') {
59
+
60
+ $element = $fieldsetcompany->addField($attribute->getAttributeCode(), $attribute->getFrontendInput(), array(
61
+ 'label' => $attribute->getFrontend()->getLabel(),
62
+ 'required' => $attribute->getIsRequired(),
63
+ 'name' => $attribute->getAttributeCode(),
64
+ 'values' => $attribute->getFrontend()->getAttribute()->getSource()->getAllOptions()
65
+ ));
66
+
67
+ } else {
68
+
69
+ $element = $fieldsetcompany->addField($attribute->getAttributeCode(), $attribute->getFrontendInput(), array(
70
+ 'label' => $attribute->getFrontend()->getLabel(),
71
+ 'required' => $attribute->getIsRequired(),
72
+ 'name' => $attribute->getAttributeCode()
73
+ ))
74
+ ->setEntityAttribute($attribute);
75
+
76
+ }
77
+
78
+ if ($attribute->getFrontendInput() == 'date') {
79
+ $element->setImage($this->getSkinUrl('images/grid-cal.gif'));
80
+ $element->setFormat(Mage::app()->getLocale()->getDateFormatWithLongYear());
81
+ }
82
+ if($attribute->getIsRequired())
83
+ $js_arr[] = $attribute->getAttributeCode();
84
+
85
+ }
86
+ }
87
+
88
+ $prefix = $form->getHtmlIdPrefix();
89
+ $total_elements = count($js_arr);
90
+ $add_class_js_script = '';
91
+ $remove_class_js_script = '';
92
+ for($j=0; $j<$total_elements; $j++) {
93
+ $add_class_js_script .= " $('{$prefix}". $js_arr[$j] ."').addClassName('required-entry') ;";
94
+ $remove_class_js_script .= " $('{$prefix}". $js_arr[$j] ."').removeClassName('required-entry') ;";
95
+ }
96
+
97
+ $customer_group = $form->getElement('group_id');
98
+
99
+ if ($customer->getId()) {
100
+ if (!$customer->isReadonly()) {
101
+ // add password management fieldset
102
+ $newFieldset = $form->addFieldset(
103
+ 'password_fieldset',
104
+ array('legend'=>Mage::helper('customer')->__('Password Management'))
105
+ );
106
+ // New customer password
107
+ $field = $newFieldset->addField('new_password', 'text',
108
+ array(
109
+ 'label' => Mage::helper('customer')->__('New Password'),
110
+ 'name' => 'new_password',
111
+ 'class' => 'validate-new-password'
112
+ )
113
+ );
114
+ $field->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass'));
115
+
116
+ // prepare customer confirmation control (only for existing customers)
117
+ $confirmationKey = $customer->getConfirmation();
118
+ if ($confirmationKey || $customer->isConfirmationRequired()) {
119
+ $confirmationAttribute = $customer->getAttribute('confirmation');
120
+ if (!$confirmationKey) {
121
+ $confirmationKey = $customer->getRandomConfirmationKey();
122
+ }
123
+ $element = $fieldset->addField('confirmation', 'select', array(
124
+ 'name' => 'confirmation',
125
+ 'label' => Mage::helper('customer')->__($confirmationAttribute->getFrontendLabel()),
126
+ ))->setEntityAttribute($confirmationAttribute)
127
+ ->setValues(array('' => 'Confirmed', $confirmationKey => 'Not confirmed'));
128
+
129
+ // prepare send welcome email checkbox, if customer is not confirmed
130
+ // no need to add it, if website id is empty
131
+ if ($customer->getConfirmation() && $customer->getWebsiteId()) {
132
+ $fieldset->addField('sendemail', 'checkbox', array(
133
+ 'name' => 'sendemail',
134
+ 'label' => Mage::helper('customer')->__('Send Welcome Email after Confirmation')
135
+ ));
136
+ $customer->setData('sendemail', '1');
137
+ }
138
+ }
139
+ }
140
+ } else {
141
+ $newFieldset = $form->addFieldset(
142
+ 'password_fieldset',
143
+ array('legend'=>Mage::helper('customer')->__('Password Management'))
144
+ );
145
+ $field = $newFieldset->addField('password', 'text',
146
+ array(
147
+ 'label' => Mage::helper('customer')->__('Password'),
148
+ 'class' => 'input-text required-entry validate-password',
149
+ 'name' => 'password',
150
+ 'required' => true
151
+ )
152
+ );
153
+ $field->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass'));
154
+
155
+ // prepare send welcome email checkbox
156
+ $fieldset->addField('sendemail', 'checkbox', array(
157
+ 'label' => Mage::helper('customer')->__('Send Welcome Email'),
158
+ 'name' => 'sendemail',
159
+ 'id' => 'sendemail',
160
+ ));
161
+ $customer->setData('sendemail', '1');
162
+ if (!Mage::app()->isSingleStoreMode()) {
163
+ $fieldset->addField('sendemail_store_id', 'select', array(
164
+ 'label' => $this->helper('customer')->__('Send From'),
165
+ 'name' => 'sendemail_store_id',
166
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()
167
+ ));
168
+ }
169
+ }
170
+
171
+ // make sendemail and sendmail_store_id disabled, if website_id has empty value
172
+ $isSingleMode = Mage::app()->isSingleStoreMode();
173
+ $sendEmailId = $isSingleMode ? 'sendemail' : 'sendemail_store_id';
174
+ $sendEmail = $form->getElement($sendEmailId);
175
+
176
+ $prefix = $form->getHtmlIdPrefix();
177
+ if ($sendEmail) {
178
+ $sendEmail->setAfterElementHtml(
179
+ '<script type="text/javascript">'
180
+ . "
181
+ $('{$prefix}website_id').disableSendemail = function() {
182
+ $('{$prefix}sendemail').disabled = ('' == this.value || '0' == this.value);".
183
+ ($isSingleMode ? "" : "$('{$prefix}sendemail_store_id').disabled = ('' == this.value || '0' == this.value);")
184
+ ."}.bind($('{$prefix}website_id'));
185
+ Event.observe('{$prefix}website_id', 'change', $('{$prefix}website_id').disableSendemail);
186
+ $('{$prefix}website_id').disableSendemail();
187
+ "
188
+ . '</script>'
189
+ );
190
+ }
191
+
192
+ if ($customer->isReadonly()) {
193
+ foreach ($customer->getAttributes() as $attribute) {
194
+ $element = $form->getElement($attribute->getAttributeCode());
195
+ if ($element) {
196
+ $element->setReadonly(true, true);
197
+ }
198
+ }
199
+ }
200
+
201
+ $form->setValues($customer->getData());
202
+ $this->setForm($form);
203
+
204
+ return $this;
205
+ }
206
+
207
+ }
app/code/community/Custom/Attributemanager/Block/Attributemanager.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Attributemanager extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->setTemplate('attributemanager/index.phtml');
13
+ $this->getAttributemanager();
14
+ }
15
+
16
+ public function getAttributemanager()
17
+ {
18
+ if (!$this->hasData('attributemanager/index')) {
19
+ $this->setData('attributemanager/index', Mage::registry('attributemanager/index'));
20
+ }
21
+
22
+ return $this->getData('attributemanager/index');
23
+ }
24
+ }
app/code/community/Custom/Attributemanager/Block/Edit.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_mode . '_form'));
7
+ return parent::_prepareLayout();
8
+ }
9
+
10
+ public function __construct()
11
+ {
12
+ $this->_objectId = 'attribute_id';
13
+ $this->_controller = 'index';
14
+ $this->_blockGroup = 'attributemanager';
15
+
16
+ parent::__construct();
17
+
18
+ //$this->_removeButton('back');
19
+
20
+ $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/index/customer') . '\')');
21
+
22
+ if($this->getRequest()->getParam('popup')) {
23
+ $this->_removeButton('back');
24
+ $this->_addButton(
25
+ 'close',
26
+ array(
27
+ 'label' => Mage::helper('catalog')->__('Close Window'),
28
+ 'class' => 'cancel',
29
+ 'onclick' => 'window.close()',
30
+ 'level' => -1
31
+ )
32
+ );
33
+ }
34
+
35
+ $this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save Attribute'));
36
+ /*$this->_addButton(
37
+ 'save_and_edit_button',
38
+ array(
39
+ 'label' => Mage::helper('catalog')->__('Save And Continue Edit'),
40
+ 'onclick' => 'saveAndContinueEdit()',
41
+ 'class' => 'save'
42
+ ),
43
+ 100
44
+ );*/
45
+
46
+ if (! Mage::registry('attributemanager_data')->getIsUserDefined()) {
47
+ $this->_removeButton('delete');
48
+ } else {
49
+ $this->_updateButton('delete', 'label', Mage::helper('catalog')->__('Delete Attribute'));
50
+ $this->_updateButton('delete', 'onclick', "deleteConfirm(
51
+ '".Mage::helper('adminhtml')->__('Are you sure you want to do this?')."',
52
+ '".$this->getUrl('*/*/delete/type/'.$this->getRequest()->getParam('type').'/attribute_id/'.$this->getRequest()->getParam('attribute_id')
53
+ )."')");
54
+ }
55
+ }
56
+
57
+ public function getHeaderText()
58
+ {
59
+ /* switch (){
60
+ case 'catalog_category':
61
+ $type="Category";
62
+ break;
63
+ case 'customer':
64
+ $type="Customer";
65
+ break;
66
+ case 'customer_address':
67
+ $type="Customer address";
68
+ break;
69
+ }*/
70
+
71
+ $types = array(
72
+ 'catalog_category' => 'Category',
73
+ 'customer' => 'Customer',
74
+ 'customer_address' => 'Customer address',
75
+ 'order' => 'Order',
76
+ 'order_address' => 'Order address',
77
+ 'order_item' => 'Order item',
78
+ 'order_payment' => 'Order payment',
79
+ 'order_status_history' => 'Order status history',
80
+ 'invoice' => 'Invoice',
81
+ 'invoice_item' => 'Invoice item',
82
+ 'invoice_comment' => 'Invoice comment',
83
+ );
84
+ $t = $this->getRequest()->getParam('type');
85
+ if(!isset($types[$t])) {
86
+ $type = 'Category';
87
+ } else {
88
+ $type = $types[$t];
89
+ }
90
+ if (Mage::registry('attributemanager_data')->getId()) {
91
+ return Mage::helper('attributemanager')->__('Edit %s Attribute "%s"', $type, $this->htmlEscape(Mage::registry('attributemanager_data')->getFrontendLabel()));
92
+ }
93
+ else {
94
+ return Mage::helper('attributemanager')->__('New %s Attribute', $type);
95
+ }
96
+
97
+ }
98
+
99
+ public function getValidationUrl()
100
+ {
101
+ return $this->getUrl('*/*/validate', array('_current'=>true));
102
+ }
103
+
104
+ public function getSaveUrl()
105
+ {
106
+ return $this->getUrl('*/'.$this->_controller.'/save', array('_current'=>true, 'back'=> '*/'.$this->_controller.'/customer'));
107
+ }
108
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Form.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
7
+ $form->setUseContainer(true);
8
+ $this->setForm($form);
9
+ return parent::_prepareForm();
10
+ }
11
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Tab/Front.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit_Tab_Front extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+ protected function _prepareForm()
5
+ {
6
+ $model = Mage::registry('attributemanager_data');
7
+
8
+ $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
9
+
10
+ $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('catalog')->__('Frontend Properties')));
11
+
12
+ $yesno = array(
13
+ array(
14
+ 'value' => 0,
15
+ 'label' => Mage::helper('catalog')->__('No')
16
+ ),
17
+ array(
18
+ 'value' => 1,
19
+ 'label' => Mage::helper('catalog')->__('Yes')
20
+ ));
21
+
22
+
23
+ $fieldset->addField('is_searchable', 'select', array(
24
+ 'name' => 'is_searchable',
25
+ 'label' => Mage::helper('catalog')->__('Use in quick search'),
26
+ 'title' => Mage::helper('catalog')->__('Use in quick search'),
27
+ 'values' => $yesno,
28
+ ));
29
+
30
+ $fieldset->addField('is_visible_in_advanced_search', 'select', array(
31
+ 'name' => 'is_visible_in_advanced_search',
32
+ 'label' => Mage::helper('catalog')->__('Use in advanced search'),
33
+ 'title' => Mage::helper('catalog')->__('Use in advanced search'),
34
+ 'values' => $yesno,
35
+ ));
36
+
37
+ $fieldset->addField('is_comparable', 'select', array(
38
+ 'name' => 'is_comparable',
39
+ 'label' => Mage::helper('catalog')->__('Comparable on Front-end'),
40
+ 'title' => Mage::helper('catalog')->__('Comparable on Front-end'),
41
+ 'values' => $yesno,
42
+ ));
43
+
44
+
45
+ $fieldset->addField('is_filterable', 'select', array(
46
+ 'name' => 'is_filterable',
47
+ 'label' => Mage::helper('catalog')->__("Use In Layered Navigation<br/>(Can be used only with catalog input type 'Dropdown')"),
48
+ 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'),
49
+ 'values' => array(
50
+ array('value' => '0', 'label' => Mage::helper('catalog')->__('No')),
51
+ array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')),
52
+ array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')),
53
+ ),
54
+ ));
55
+
56
+ // if ($model->getIsUserDefined() || !$model->getId()) {
57
+ $fieldset->addField('is_visible_on_front', 'select', array(
58
+ 'name' => 'is_visible_on_front',
59
+ 'label' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'),
60
+ 'title' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'),
61
+ 'values' => $yesno,
62
+ ));
63
+ // }
64
+
65
+ $form->setValues($model->getData());
66
+
67
+ $this->setForm($form);
68
+
69
+ return parent::_prepareForm();
70
+ }
71
+
72
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Tab/Main.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit_Tab_Main extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+
5
+ protected function _prepareForm()
6
+ {
7
+ $model = Mage::registry('attributemanager_data');
8
+
9
+ $form = new Varien_Data_Form(array(
10
+ 'id' => 'edit_form',
11
+ 'action' => $this->getData('action'),
12
+ 'method' => 'post'
13
+ ));
14
+
15
+ $fieldset = $form->addFieldset('base_fieldset',
16
+ array('legend'=>Mage::helper('catalog')->__('Attribute Properties'))
17
+ );
18
+ if ($model->getId()) {
19
+ $fieldset->addField('attribute_id', 'hidden', array(
20
+ 'name' => 'attribute_id',
21
+ ));
22
+ }
23
+
24
+ $this->_addElementTypes($fieldset);
25
+
26
+ $yesno = array(
27
+ array(
28
+ 'value' => 0,
29
+ 'label' => Mage::helper('catalog')->__('No')
30
+ ),
31
+ array(
32
+ 'value' => 1,
33
+ 'label' => Mage::helper('catalog')->__('Yes')
34
+ ));
35
+
36
+ $fieldset->addField('attribute_code', 'text', array(
37
+ 'name' => 'attribute_code',
38
+ 'label' => Mage::helper('catalog')->__('Attribute Code'),
39
+ 'title' => Mage::helper('catalog')->__('Attribute Code'),
40
+ 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'),
41
+ 'class' => 'validate-code',
42
+ 'required' => true,
43
+ ));
44
+
45
+ $scopes = array(
46
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('catalog')->__('Store View'),
47
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('catalog')->__('Website'),
48
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('catalog')->__('Global'),
49
+ );
50
+
51
+ if ($model->getAttributeCode() == 'status' || $model->getAttributeCode() == 'tax_class_id') {
52
+ unset($scopes[Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE]);
53
+ }
54
+
55
+ /* $fieldset->addField('is_global', 'select', array(
56
+ 'name' => 'is_global',
57
+ 'label' => Mage::helper('catalog')->__('Scope'),
58
+ 'title' => Mage::helper('catalog')->__('Scope'),
59
+ 'note' => Mage::helper('catalog')->__('Declare attribute value saving scope'),
60
+ 'values'=> $scopes
61
+ ));
62
+ */
63
+ $inputTypes = array(
64
+ array(
65
+ 'value' => 'text',
66
+ 'label' => Mage::helper('catalog')->__('Text Field')
67
+ ),
68
+ array(
69
+ 'value' => 'textarea',
70
+ 'label' => Mage::helper('catalog')->__('Text Area')
71
+ ),
72
+ array(
73
+ 'value' => 'date',
74
+ 'label' => Mage::helper('catalog')->__('Date')
75
+ ),
76
+ array(
77
+ 'value' => 'boolean',
78
+ 'label' => Mage::helper('catalog')->__('Yes/No')
79
+ ),
80
+ array(
81
+ 'value' => 'multiselect',
82
+ 'label' => Mage::helper('catalog')->__('Multiple Select')
83
+ ),
84
+ array(
85
+ 'value' => 'select',
86
+ 'label' => Mage::helper('catalog')->__('Dropdown')
87
+ ),
88
+ );
89
+ if($this->getRequest ()->getParam ( 'type' )==="catalog_category"){
90
+ $inputTypes[]= array(
91
+ 'value' => 'image',
92
+ 'label' => Mage::helper('catalog')->__('Image')
93
+
94
+ );
95
+ }
96
+
97
+ $response = new Varien_Object();
98
+ $response->setTypes(array());
99
+ //Mage::dispatchEvent('adminhtml_product_attribute_types', array('response'=>$response));
100
+
101
+ $_disabledTypes = array();
102
+ $_hiddenFields = array();
103
+ foreach ($response->getTypes() as $type) {
104
+ $inputTypes[] = $type;
105
+ if (isset($type['hide_fields'])) {
106
+ $_hiddenFields[$type['value']] = $type['hide_fields'];
107
+ }
108
+ if (isset($type['disabled_types'])) {
109
+ $_disabledTypes[$type['value']] = $type['disabled_types'];
110
+ }
111
+ }
112
+ Mage::register('attribute_type_hidden_fields', $_hiddenFields);
113
+ Mage::register('attribute_type_disabled_types', $_disabledTypes);
114
+
115
+
116
+ $fieldset->addField('frontend_input', 'select', array(
117
+ 'name' => 'frontend_input',
118
+ 'label' => Mage::helper('catalog')->__('Input Type'),
119
+ 'title' => Mage::helper('catalog')->__('Input Type'),
120
+ 'value' => 'text',
121
+ 'values'=> $inputTypes
122
+ ));
123
+
124
+ $fieldset->addField('entity_type_id', 'hidden', array(
125
+ 'name' => 'entity_type_id',
126
+ 'value' => Mage::getModel('eav/entity')->setType($this->getRequest ()->getParam ( 'type' ))->getTypeId()
127
+ ));
128
+
129
+
130
+
131
+ $fieldset->addField('is_user_defined', 'hidden', array(
132
+ 'name' => 'is_user_defined',
133
+ 'value' => 1
134
+ ));
135
+
136
+ $fieldset->addField('attribute_set_id', 'hidden', array(
137
+ 'name' => 'attribute_set_id',
138
+ 'value' => Mage::getModel('eav/entity')->setType($this->getRequest ()->getParam ( 'type' ))->getTypeId()
139
+ ));
140
+
141
+ $fieldset->addField('attribute_group_id', 'hidden', array(
142
+ 'name' => 'attribute_group_id',
143
+ 'value' => Mage::getModel('eav/entity')->setType($this->getRequest ()->getParam ( 'type' ))->getTypeId()
144
+ ));
145
+
146
+
147
+ /*******************************************************/
148
+ /* $fieldset->addField('is_unique', 'select', array(
149
+ 'name' => 'is_unique',
150
+ 'label' => Mage::helper('catalog')->__('Unique Value'),
151
+ 'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'),
152
+ 'note' => Mage::helper('catalog')->__('Not shared with other products'),
153
+ 'values' => $yesno,
154
+ ));
155
+ */
156
+ $fieldset->addField('is_required', 'select', array(
157
+ 'name' => 'is_required',
158
+ 'label' => Mage::helper('catalog')->__('Values Required'),
159
+ 'title' => Mage::helper('catalog')->__('Values Required'),
160
+ 'values' => $yesno,
161
+ ));
162
+
163
+ $fieldset->addField('frontend_class', 'select', array(
164
+ 'name' => 'frontend_class',
165
+ 'label' => Mage::helper('catalog')->__('Input Validation'),
166
+ 'title' => Mage::helper('catalog')->__('Input Validation'),
167
+ 'values'=> array(
168
+ array(
169
+ 'value' => '',
170
+ 'label' => Mage::helper('catalog')->__('None')
171
+ ),
172
+ array(
173
+ 'value' => 'validate-number',
174
+ 'label' => Mage::helper('catalog')->__('Decimal Number')
175
+ ),
176
+ array(
177
+ 'value' => 'validate-digits',
178
+ 'label' => Mage::helper('catalog')->__('Integer Number')
179
+ ),
180
+ array(
181
+ 'value' => 'validate-email',
182
+ 'label' => Mage::helper('catalog')->__('Email')
183
+ ),
184
+ array(
185
+ 'value' => 'validate-url',
186
+ 'label' => Mage::helper('catalog')->__('Url')
187
+ ),
188
+ array(
189
+ 'value' => 'validate-alpha',
190
+ 'label' => Mage::helper('catalog')->__('Letters')
191
+ ),
192
+ array(
193
+ 'value' => 'validate-alphanum',
194
+ 'label' => Mage::helper('catalog')->__('Letters(a-zA-Z) or Numbers(0-9)')
195
+ ),
196
+ )
197
+ ));
198
+
199
+ // -----
200
+
201
+
202
+ // frontend properties fieldset
203
+ $fieldset = $form->addFieldset('front_fieldset',
204
+ array('legend'=>Mage::helper('catalog')->__('Frontend Properties')));
205
+
206
+
207
+
208
+ /*$fieldset->addField('position', 'text', array(
209
+ 'name' => 'position',
210
+ 'label' => Mage::helper('catalog')->__('Position'),
211
+ 'title' => Mage::helper('catalog')->__('Position In Layered Navigation'),
212
+ 'note' => Mage::helper('catalog')->__('Position of attribute in layered navigation block'),
213
+ 'class' => 'validate-digits',
214
+ ));*/
215
+
216
+ /*if ($model->getIsUserDefined() || !$model->getId()) {
217
+ $fieldset->addField('is_visible_on_front', 'select', array(
218
+ 'name' => 'is_visible_on_front',
219
+ 'label' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'),
220
+ 'title' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'),
221
+ 'values' => $yesno,
222
+ ));
223
+ }*/
224
+
225
+ /* $fieldset->addField('show_in_frontend', 'select', array(
226
+ 'name' => 'show_in_frontend',
227
+ 'label' => Mage::helper('catalog')->__('Show in Frontend'),
228
+ 'title' => Mage::helper('catalog')->__('Show in Frontend'),
229
+ 'values' => $yesno,
230
+ ));
231
+ */
232
+ $fieldset->addField('sort_order', 'text', array(
233
+ 'name' => 'sort_order',
234
+ 'label' => Mage::helper('catalog')->__('Order'),
235
+ 'title' => Mage::helper('catalog')->__('Order in form'),
236
+ 'note' => Mage::helper('catalog')->__('order of attribute in form edit/create. Leave blank for form bottom.'),
237
+ 'class' => 'validate-digits',
238
+ 'value' => $model->getSortOrder()
239
+ ));
240
+
241
+
242
+ if ($model->getId()) {
243
+ $form->getElement('attribute_code')->setDisabled(1);
244
+ $form->getElement('frontend_input')->setDisabled(1);
245
+
246
+ if (isset($disableAttributeFields[$model->getAttributeCode()])) {
247
+ foreach ($disableAttributeFields[$model->getAttributeCode()] as $field) {
248
+ $form->getElement($field)->setDisabled(1);
249
+ }
250
+ }
251
+ }
252
+ /* if (!$model->getIsUserDefined() && $model->getId()) {
253
+ $form->getElement('is_unique')->setDisabled(1);
254
+ }
255
+ */
256
+ //var_dump($model->getData());exit;
257
+ $form->addValues($model->getData());
258
+
259
+ $this->setForm($form);
260
+
261
+ return parent::_prepareForm();
262
+ }
263
+
264
+ protected function _getAdditionalElementTypes()
265
+ {
266
+ return array(
267
+ 'apply' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_apply')
268
+ );
269
+ }
270
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Tab/Options.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit_Tab_Options extends Mage_Adminhtml_Block_Widget
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setTemplate('attributemanager/options.phtml');
8
+ }
9
+
10
+ protected function _prepareLayout()
11
+ {
12
+ $this->setChild('delete_button',
13
+ $this->getLayout()->createBlock('adminhtml/widget_button')
14
+ ->setData(array(
15
+ 'label' => Mage::helper('catalog')->__('Delete'),
16
+ 'class' => 'delete delete-option'
17
+ )));
18
+
19
+ $this->setChild('add_button',
20
+ $this->getLayout()->createBlock('adminhtml/widget_button')
21
+ ->setData(array(
22
+ 'label' => Mage::helper('catalog')->__('Add Option'),
23
+ 'class' => 'add',
24
+ 'id' => 'add_new_option_button'
25
+ )));
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getDeleteButtonHtml()
30
+ {
31
+ return $this->getChildHtml('delete_button');
32
+ }
33
+
34
+ public function getAddNewButtonHtml()
35
+ {
36
+ return $this->getChildHtml('add_button');
37
+ }
38
+
39
+ public function getStores()
40
+ {
41
+ $stores = $this->getData('stores');
42
+ if (is_null($stores)) {
43
+ $stores = Mage::getModel('core/store')
44
+ ->getResourceCollection()
45
+ ->setLoadDefault(true)
46
+ ->load();
47
+ $this->setData('stores', $stores);
48
+ }
49
+ return $stores;
50
+ }
51
+
52
+ public function getOptionValues()
53
+ {
54
+ $attributeType = $this->getAttributeObject()->getFrontendInput();
55
+ $defaultValues = $this->getAttributeObject()->getDefaultValue();
56
+ if ($attributeType == 'select' || $attributeType == 'multiselect') {
57
+ $defaultValues = explode(',', $defaultValues);
58
+ } else {
59
+ $defaultValues = array();
60
+ }
61
+
62
+ switch ($attributeType) {
63
+ case 'select':
64
+ $inputType = 'radio';
65
+ break;
66
+ case 'multiselect':
67
+ $inputType = 'checkbox';
68
+ break;
69
+ default:
70
+ $inputType = '';
71
+ break;
72
+ }
73
+
74
+ $values = $this->getData('option_values');
75
+ if (is_null($values)) {
76
+ $values = array();
77
+ $optionCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
78
+ ->setAttributeFilter($this->getAttributeObject()->getId())
79
+ ->setPositionOrder('desc', true)
80
+ ->load();
81
+
82
+ foreach ($optionCollection as $option) {
83
+ $value = array();
84
+ if (in_array($option->getId(), $defaultValues)) {
85
+ $value['checked'] = 'checked="checked"';
86
+ } else {
87
+ $value['checked'] = '';
88
+ }
89
+
90
+ $value['intype'] = $inputType;
91
+ $value['id'] = $option->getId();
92
+ $value['sort_order'] = $option->getSortOrder();
93
+ foreach ($this->getStores() as $store) {
94
+ $storeValues = $this->getStoreOptionValues($store->getId());
95
+ if (isset($storeValues[$option->getId()])) {
96
+ $value['store'.$store->getId()] = htmlspecialchars($storeValues[$option->getId()]);
97
+ }
98
+ else {
99
+ $value['store'.$store->getId()] = '';
100
+ }
101
+ }
102
+ $values[] = new Varien_Object($value);
103
+ }
104
+ $this->setData('option_values', $values);
105
+ }
106
+
107
+ return $values;
108
+ }
109
+
110
+ public function getLabelValues()
111
+ {
112
+ $values = array();
113
+ $values[0] = $this->getAttributeObject()->getFrontend()->getLabel();
114
+ // it can be array and cause bug
115
+ $frontendLabel = $this->getAttributeObject()->getFrontend()->getLabel();
116
+ if (is_array($frontendLabel)) {
117
+ $frontendLabel = array_shift($frontendLabel);
118
+ }
119
+ $translations = Mage::getModel('core/translate_string')
120
+ ->load(Mage_Catalog_Model_Entity_Attribute::MODULE_NAME.Mage_Core_Model_Translate::SCOPE_SEPARATOR.$frontendLabel)
121
+ ->getStoreTranslations();
122
+ foreach ($this->getStores() as $store) {
123
+ if ($store->getId() != 0) {
124
+ $values[$store->getId()] = isset($translations[$store->getId()]) ? $translations[$store->getId()] : '';
125
+ }
126
+ }
127
+ return $values;
128
+ }
129
+
130
+ public function getStoreOptionValues($storeId)
131
+ {
132
+ $values = $this->getData('store_option_values_'.$storeId);
133
+ if (is_null($values)) {
134
+ $values = array();
135
+ $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
136
+ ->setAttributeFilter($this->getAttributeObject()->getId())
137
+ ->setStoreFilter($storeId, false)
138
+ ->load();
139
+ foreach ($valuesCollection as $item) {
140
+ $values[$item->getId()] = $item->getValue();
141
+ }
142
+ $this->setData('store_option_values_'.$storeId, $values);
143
+ }
144
+ return $values;
145
+ }
146
+
147
+ public function getAttributeObject()
148
+ {
149
+ return Mage::registry('attributemanager_data');
150
+ }
151
+
152
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Tab/System.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Pol_Attributemanager_Block_Edit_Tab_System extends Mage_Adminhtml_Block_Widget_Form
3
+ {
4
+
5
+ protected function _prepareForm()
6
+ {
7
+ $model = Mage::registry('entity_attribute');
8
+
9
+ $form = new Varien_Data_Form();
10
+ $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('catalog')->__('System Properties')));
11
+
12
+ if ($model->getAttributeId()) {
13
+ $fieldset->addField('attribute_id', 'hidden', array(
14
+ 'name' => 'attribute_id',
15
+ ));
16
+ }
17
+
18
+ $yesno = array(
19
+ array(
20
+ 'value' => 0,
21
+ 'label' => Mage::helper('catalog')->__('No')
22
+ ),
23
+ array(
24
+ 'value' => 1,
25
+ 'label' => Mage::helper('catalog')->__('Yes')
26
+ ));
27
+
28
+ /*$fieldset->addField('attribute_model', 'text', array(
29
+ 'name' => 'attribute_model',
30
+ 'label' => Mage::helper('catalog')->__('Attribute Model'),
31
+ 'title' => Mage::helper('catalog')->__('Attribute Model'),
32
+ ));
33
+
34
+ $fieldset->addField('backend_model', 'text', array(
35
+ 'name' => 'backend_model',
36
+ 'label' => Mage::helper('catalog')->__('Backend Model'),
37
+ 'title' => Mage::helper('catalog')->__('Backend Model'),
38
+ ));*/
39
+
40
+ $fieldset->addField('backend_type', 'select', array(
41
+ 'name' => 'backend_type',
42
+ 'label' => Mage::helper('catalog')->__('Data Type for Saving in Database'),
43
+ 'title' => Mage::helper('catalog')->__('Data Type for Saving in Database'),
44
+ 'options' => array(
45
+ 'text' => Mage::helper('catalog')->__('Text'),
46
+ 'varchar' => Mage::helper('catalog')->__('Varchar'),
47
+ 'static' => Mage::helper('catalog')->__('Static'),
48
+ 'datetime' => Mage::helper('catalog')->__('Datetime'),
49
+ 'decimal' => Mage::helper('catalog')->__('Decimal'),
50
+ 'int' => Mage::helper('catalog')->__('Integer'),
51
+ ),
52
+ ));
53
+
54
+ /*$fieldset->addField('backend_table', 'text', array(
55
+ 'name' => 'backend_table',
56
+ 'label' => Mage::helper('catalog')->__('Backend Table'),
57
+ 'title' => Mage::helper('catalog')->__('Backend Table Title'),
58
+ ));
59
+
60
+ $fieldset->addField('frontend_model', 'text', array(
61
+ 'name' => 'frontend_model',
62
+ 'label' => Mage::helper('catalog')->__('Frontend Model'),
63
+ 'title' => Mage::helper('catalog')->__('Frontend Model'),
64
+ ));*/
65
+
66
+ /*$fieldset->addField('is_visible', 'select', array(
67
+ 'name' => 'is_visible',
68
+ 'label' => Mage::helper('catalog')->__('Visible'),
69
+ 'title' => Mage::helper('catalog')->__('Visible'),
70
+ 'values' => $yesno,
71
+ ));*/
72
+
73
+ /*$fieldset->addField('source_model', 'text', array(
74
+ 'name' => 'source_model',
75
+ 'label' => Mage::helper('catalog')->__('Source Model'),
76
+ 'title' => Mage::helper('catalog')->__('Source Model'),
77
+ ));*/
78
+
79
+ $fieldset->addField('is_global', 'select', array(
80
+ 'name' => 'is_global',
81
+ 'label' => Mage::helper('catalog')->__('Globally Editable'),
82
+ 'title' => Mage::helper('catalog')->__('Globally Editable'),
83
+ 'values'=> $yesno,
84
+ ));
85
+
86
+
87
+
88
+ $form->setValues($model->getData());
89
+
90
+ if ($model->getAttributeId()) {
91
+ $form->getElement('backend_type')->setDisabled(1);
92
+ if ($model->getIsGlobal()) {
93
+ #$form->getElement('is_global')->setDisabled(1);
94
+ }
95
+ } else {
96
+ }
97
+
98
+ $this->setForm($form);
99
+
100
+ return parent::_prepareForm();
101
+ }
102
+
103
+ }
app/code/community/Custom/Attributemanager/Block/Edit/Tabs.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('attributemanager_tabs');
9
+ $this->setDestElementId('edit_form');
10
+ $this->setTitle(Mage::helper('catalog')->__('Attribute Information'));
11
+ }
12
+
13
+ protected function _beforeToHtml()
14
+ {
15
+ $model = Mage::registry('attributemanager_data');
16
+
17
+ $this->addTab('main', array(
18
+ 'label' => Mage::helper('catalog')->__('Properties'),
19
+ 'title' => Mage::helper('catalog')->__('Properties'),
20
+ 'content' => $this->getLayout()->createBlock('attributemanager/edit_tab_main')->toHtml(),
21
+ 'active' => true
22
+ ));
23
+
24
+
25
+ $this->addTab('labels', array(
26
+ 'label' => Mage::helper('catalog')->__('Manage Label / Options'),
27
+ 'title' => Mage::helper('catalog')->__('Manage Label / Options'),
28
+ 'content' => $this->getLayout()->createBlock('attributemanager/edit_tab_options')->toHtml(),
29
+ ));
30
+
31
+ /*if ('select' == $model->getFrontendInput()) {
32
+ $this->addTab('options_section', array(
33
+ 'label' => Mage::helper('catalog')->__('Options Control'),
34
+ 'title' => Mage::helper('catalog')->__('Options Control'),
35
+ 'content' => $this->getLayout()->createBlock('attributemanager/edit_tab_options')->toHtml(),
36
+ ));
37
+ }*/
38
+
39
+ return parent::_beforeToHtml();
40
+ }
41
+
42
+ }
app/code/community/Custom/Attributemanager/Block/Grid.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Block_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+
8
+ $this->setId('attributemanagergrid');
9
+ $this->setDefaultSort('attribute_code');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setTemplate('attributemanager/grid.phtml');
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $model = 'catalog/category_attribute_collection';
18
+ $sUrl=$this->getUrl('*/*/*', array('_current'=>true));
19
+
20
+ $type='customer';
21
+ $model = 'customer/attribute_collection';
22
+
23
+ $this->type=$type;
24
+ $collection = Mage::getResourceModel($model)
25
+ ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
26
+ ->addFieldToFilter('is_system','0')
27
+ ->addVisibleFilter();
28
+
29
+ $this->setCollection($collection);
30
+ return parent::_prepareCollection();
31
+ }
32
+
33
+ protected function _prepareColumns()
34
+ {
35
+ $this->addColumn('attribute_code', array(
36
+ 'header'=>Mage::helper('catalog')->__('Attribute Code'),
37
+ 'sortable'=>true,
38
+ 'index'=>'attribute_code'
39
+ ));
40
+
41
+ $this->addColumn('frontend_label', array(
42
+ 'header'=>Mage::helper('catalog')->__('Attribute Label'),
43
+ 'sortable'=>true,
44
+ 'index'=>'frontend_label'
45
+ ));
46
+ /*
47
+ $this->addColumn('is_visible', array(
48
+ 'header'=>Mage::helper('catalog')->__('Visible'),
49
+ 'sortable'=>true,
50
+ 'index'=>'is_visible_on_front',
51
+ 'type' => 'options',
52
+ 'options' => array(
53
+ '1' => Mage::helper('catalog')->__('Yes'),
54
+ '0' => Mage::helper('catalog')->__('No'),
55
+ ),
56
+ 'align' => 'center',
57
+ ));
58
+
59
+ $this->addColumn('is_global', array(
60
+ 'header'=>Mage::helper('catalog')->__('Scope'),
61
+ 'sortable'=>true,
62
+ 'index'=>'is_global',
63
+ 'type' => 'options',
64
+ 'options' => array(
65
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('catalog')->__('Store View'),
66
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('catalog')->__('Website'),
67
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('catalog')->__('Global'),
68
+ ),
69
+ 'align' => 'center',
70
+ ));
71
+ */
72
+ $this->addColumn('is_required', array(
73
+ 'header'=>Mage::helper('catalog')->__('Required'),
74
+ 'sortable'=>true,
75
+ 'index'=>'is_required',
76
+ 'type' => 'options',
77
+ 'options' => array(
78
+ '1' => Mage::helper('catalog')->__('Yes'),
79
+ '0' => Mage::helper('catalog')->__('No'),
80
+ ),
81
+ 'align' => 'center',
82
+ ));
83
+ /*
84
+ $this->addColumn('show_in_frontend', array(
85
+ 'header'=>Mage::helper('catalog')->__('Show in Frontend'),
86
+ 'sortable'=>true,
87
+ 'index'=>'show_in_frontend',
88
+ 'type' => 'options',
89
+ 'align' => 'center',
90
+ 'options' => array(
91
+ '0' => Mage::helper('catalog')->__('Yes'),
92
+ '1' => Mage::helper('catalog')->__('No'),
93
+ ),
94
+ ));
95
+
96
+
97
+ $this->addColumn('is_user_defined', array(
98
+ 'header'=>Mage::helper('catalog')->__('System'),
99
+ 'sortable'=>true,
100
+ 'index'=>'is_user_defined',
101
+ 'type' => 'options',
102
+ 'align' => 'center',
103
+ 'options' => array(
104
+ '0' => Mage::helper('catalog')->__('Yes'),
105
+ '1' => Mage::helper('catalog')->__('No'),
106
+ ),
107
+ ));
108
+
109
+ $this->addColumn('is_searchable', array(
110
+ 'header'=>Mage::helper('catalog')->__('Searchable'),
111
+ 'sortable'=>true,
112
+ 'index'=>'is_searchable',
113
+ 'type' => 'options',
114
+ 'options' => array(
115
+ '1' => Mage::helper('catalog')->__('Yes'),
116
+ '0' => Mage::helper('catalog')->__('No'),
117
+ ),
118
+ 'align' => 'center',
119
+ ));
120
+
121
+ $this->addColumn('is_filterable', array(
122
+ 'header'=>Mage::helper('catalog')->__('Use In Layered Navigation'),
123
+ 'sortable'=>true,
124
+ 'index'=>'is_filterable',
125
+ 'type' => 'options',
126
+ 'options' => array(
127
+ '1' => Mage::helper('catalog')->__('Filterable (with results)'),
128
+ '2' => Mage::helper('catalog')->__('Filterable (no results)'),
129
+ '0' => Mage::helper('catalog')->__('No'),
130
+ ),
131
+ 'align' => 'center',
132
+ ));
133
+
134
+ $this->addColumn('is_comparable', array(
135
+ 'header'=>Mage::helper('catalog')->__('Comparable'),
136
+ 'sortable'=>true,
137
+ 'index'=>'is_comparable',
138
+ 'type' => 'options',
139
+ 'options' => array(
140
+ '1' => Mage::helper('catalog')->__('Yes'),
141
+ '0' => Mage::helper('catalog')->__('No'),
142
+ ),
143
+ 'align' => 'center',
144
+ ));
145
+ */
146
+ $this->addExportType('*/*/exportCsv', Mage::helper('attributemanager')->__('CSV'));
147
+ $this->addExportType('*/*/exportXml', Mage::helper('attributemanager')->__('XML'));
148
+
149
+ return parent::_prepareColumns();
150
+ }
151
+
152
+ public function addNewButton(){
153
+ return $this->getButtonHtml(
154
+ Mage::helper('attributemanager')->__('New Attribute'),
155
+ "setLocation('".$this->getUrl('*/*/new', array('type' => $this->type,'attribute_id'=>0))."')",
156
+ "scalable add"
157
+ );
158
+ }
159
+ public function getRowUrl($row)
160
+ {
161
+ return $this->getUrl('*/*/edit', array('type' => $this->type,'attribute_id' => $row->getAttributeId()));
162
+ }
163
+
164
+ }
app/code/community/Custom/Attributemanager/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/community/Custom/Attributemanager/Model/Attributemanager.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_attributemanager_Model_attributemanager extends Mage_Eav_Model_Entity_Attribute
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ }
8
+
9
+ protected function _beforeSave()
10
+ {
11
+ if ( $this->getFrontendInput()=="image"){
12
+ $this->setBackendModel('catalog/category_attribute_backend_image');
13
+ $this->setBackendType('varchar');
14
+ }
15
+
16
+ if ( $this->getFrontendInput()=="date"){
17
+ $this->setBackendModel('eav/entity_attribute_backend_datetime');
18
+ $this->setBackendType('datetime');
19
+ }
20
+
21
+ if ( $this->getFrontendInput()=="textarea" ){
22
+
23
+ $this->setBackendType('text');
24
+ }
25
+
26
+ if ( $this->getFrontendInput()=="text" ){
27
+
28
+ $this->setBackendType('varchar');
29
+ }
30
+
31
+ if ( ($this->getFrontendInput()=="multiselect" || $this->getFrontendInput()=="select") ){
32
+ $this->setData('source_model', 'eav/entity_attribute_source_table');
33
+ $this->setBackendType('varchar');
34
+ }
35
+
36
+ if ($this->getFrontendInput()=="boolean"){
37
+ $this->setData('source_model', 'eav/entity_attribute_source_boolean');
38
+ $this->setBackendType('int');
39
+ $this->setFrontendInput("select");
40
+ }
41
+
42
+ return parent::_beforeSave();
43
+ }
44
+ }
app/code/community/Custom/Attributemanager/controllers/IndexController.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Custom_Attributemanager_IndexController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ protected $_customerTypeId;
6
+ protected $_categoryTypeId;
7
+ protected $_customer_addressTypeId;
8
+ protected $_type;
9
+
10
+ public function preDispatch()
11
+ {
12
+ parent::preDispatch();
13
+ $this->_customerTypeId = Mage::getModel('eav/entity')->setType('customer')->getTypeId();
14
+ $this->_categoryTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
15
+ $this->_customer_addressTypeId = Mage::getModel('eav/entity')->setType('customer_address')->getTypeId();
16
+ if ($this->getRequest ()->getParam ( 'type' )){
17
+ switch ($this->getRequest ()->getParam ( 'type' )) {
18
+ case "customer" :
19
+ $this->_type = 'customer';
20
+ break;
21
+ }
22
+ }
23
+ }
24
+
25
+ protected function _initAction($ids=null) {
26
+ $this->loadLayout($ids);
27
+
28
+ return $this;
29
+ }
30
+
31
+ public function categoryAction()
32
+ {
33
+ $this->_initAction()
34
+ ->_setActiveMenu('customer/custom')
35
+ ->_addContent($this->getLayout()->createBlock('attributemanager/Grid'));
36
+ $this->renderLayout();
37
+ }
38
+
39
+ public function customerAction()
40
+ {
41
+ $this->_initAction()
42
+ ->_setActiveMenu('customer/custom')
43
+ ->_addContent($this->getLayout()->createBlock('attributemanager/Grid'));
44
+ $this->renderLayout();
45
+ }
46
+
47
+ public function addressAction()
48
+ {
49
+ $this->_initAction()
50
+ ->_setActiveMenu('customer/custom')
51
+ ->_addContent($this->getLayout()->createBlock('attributemanager/Grid'));
52
+ $this->renderLayout();
53
+ }
54
+
55
+ public function editAction() {
56
+ $id = $this->getRequest()->getParam('attribute_id');
57
+ $model = Mage::getModel('eav/entity_attribute');
58
+ $model->load($id);
59
+
60
+ /* if(0!==$id){
61
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
62
+ $model->setData("sort_order",$db->fetchOne("select sort_order from eav_entity_attribute where attribute_id=$id"));
63
+ }
64
+ */
65
+
66
+ if ($model->getId() || $id == 0) {
67
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
68
+ if (!empty($data)) {
69
+ $model->setData($data);
70
+ }
71
+
72
+ Mage::register('attributemanager_data', $model);
73
+
74
+ $this->loadLayout();
75
+ $this->_setActiveMenu('customer/custom');
76
+
77
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
78
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
79
+
80
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
81
+
82
+ $this
83
+ ->_addContent($this->getLayout()->createBlock('attributemanager/edit'))
84
+ ->_addLeft($this->getLayout()->createBlock('attributemanager/edit_tabs'))
85
+ ;
86
+
87
+ $this->renderLayout();
88
+ } else {
89
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Item does not exist'));
90
+ $this->_redirect('*/*/');
91
+ }
92
+ }
93
+
94
+ public function newAction() {
95
+ $this->_forward('edit');
96
+ }
97
+
98
+ public function validateAction()
99
+ {
100
+ $response = new Varien_Object();
101
+ $response->setError(false);
102
+
103
+ $attributeCode = $this->getRequest()->getParam('type');
104
+ $attributeId = $this->getRequest()->getParam('attribute_id');
105
+ switch ($attributeCode){
106
+ case "catalog_category":
107
+ $this->_entityTypeId=$this->_categoryTypeId;
108
+ break;
109
+
110
+ case "customer":
111
+ $this->_entityTypeId=$this->_customerTypeId;
112
+ break;
113
+
114
+ case "customer_address":
115
+ $this->_entityTypeId=$this->_customer_addressTypeId;
116
+ break;
117
+ }
118
+ $attribute = Mage::getModel('eav/entity_attribute')
119
+ ->loadByCode($this->_entityTypeId, $attributeCode);
120
+
121
+ if ($attribute->getId() && !$attributeId) {
122
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Attribute with the same code already exists'));
123
+ $this->_initLayoutMessages('adminhtml/session');
124
+ $response->setError(true);
125
+ $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
126
+ }
127
+
128
+ $this->getResponse()->setBody($response->toJson());
129
+ }
130
+
131
+ public function saveAction() {
132
+ if ($data = $this->getRequest()->getPost()) {
133
+
134
+ $model = Mage::getModel('attributemanager/attributemanager');
135
+ $model->setData($data);
136
+
137
+ if( $this->getRequest()->getParam('attribute_id') > 0 ) {
138
+ $model->setId($this->getRequest()->getParam('attribute_id'));
139
+ }
140
+
141
+ try {
142
+
143
+ if ($model->getCreatedTime() == NULL || $model->getUpdateTime() == NULL) {
144
+ $model->setCreatedTime(now())
145
+ ->setUpdateTime(now());
146
+ } else {
147
+ $model->setUpdateTime(now());
148
+ }
149
+
150
+ $model->save();
151
+
152
+ $id=$model->getId();
153
+
154
+ if($data['entity_type_id'] == '1' && $data['attribute_code']) {
155
+
156
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
157
+ $eavConfig = Mage::getSingleton('eav/config');
158
+ $attribute = $eavConfig->getAttribute('customer', $data['attribute_code']);
159
+
160
+ //if($data['show_in_frontend'] == '1') {
161
+ $attribute->setData('used_in_forms', array('customer_account_edit',
162
+ 'customer_account_create',
163
+ 'adminhtml_customer'));
164
+ /* } else {
165
+ $attribute->setData('used_in_forms', array('adminhtml_customer'));
166
+ } */
167
+
168
+ if($data['frontend_input'] == 'boolean') {
169
+ $attribute->setData('source_model', 'eav/entity_attribute_source_boolean');
170
+ }
171
+
172
+ $attribute->save();
173
+ }
174
+
175
+
176
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('attributemanager')->__('Item was successfully saved'));
177
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
178
+
179
+ if ($this->getRequest()->getParam('back')) {
180
+ $this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'), 'attribute_id' => $id));
181
+ return;
182
+ }
183
+
184
+ $this->_redirect('*/*/'.$this->_type.'/filter//');
185
+ return;
186
+ } catch (Exception $e) {
187
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
188
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
189
+ $this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'),'attribute_id' => $this->getRequest()->getParam('attribute_id')));
190
+ return;
191
+ }
192
+ }
193
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('attributemanager')->__('Unable to find item to save'));
194
+ $this->_redirect('*/*/'.$this->_type.'/filter//');
195
+ }
196
+
197
+ public function deleteAction() {
198
+ if( $this->getRequest()->getParam('attribute_id') > 0 ) {
199
+ try {
200
+ $model = Mage::getModel('eav/entity_attribute');
201
+
202
+ $model->setId($this->getRequest()->getParam('attribute_id'))
203
+ ->delete();
204
+
205
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
206
+ $this->_redirect('*/*/'.$this->_type.'/filter//');
207
+ } catch (Exception $e) {
208
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
209
+ $this->_redirect('*/*/edit', array('type'=>$this->getRequest()->getParam('type'),'attribute_id' => $this->getRequest()->getParam('attribute_id')));
210
+ }
211
+ }
212
+ $this->_redirect('*/*/'.$this->_type.'/filter//');
213
+ }
214
+
215
+ public function massDeleteAction() {
216
+ $categoriesattributesIds = $this->getRequest()->getParam('attributemanager');
217
+ if(!is_array($categoriesattributesIds)) {
218
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
219
+ } else {
220
+ try {
221
+ foreach ($categoriesattributesIds as $categoriesattributesId) {
222
+ $categoriesattributes = Mage::getModel('eav/entity_attribute')->load($categoriesattributesId);
223
+ $categoriesattributes->delete();
224
+ }
225
+ Mage::getSingleton('adminhtml/session')->addSuccess(
226
+ Mage::helper('adminhtml')->__(
227
+ 'Total of %d record(s) were successfully deleted', count($categoriesattributesIds)
228
+ )
229
+ );
230
+ } catch (Exception $e) {
231
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
232
+ }
233
+ }
234
+ $this->_redirect('*/*/'.$this->_type.'/filter//');
235
+ }
236
+
237
+ public function exportCsvAction()
238
+ {
239
+ $fileName = $this->_type.'attributes.csv';
240
+ $content = $this->getLayout()->createBlock('attributemanager/grid')
241
+ ->getCsv();
242
+
243
+ $this->_sendUploadResponse($fileName, $content);
244
+ }
245
+
246
+ public function exportXmlAction()
247
+ {
248
+ $fileName = $this->_type.'attributes.xml';
249
+ $content = $this->getLayout()->createBlock('attributemanager/grid')
250
+ ->getXml();
251
+
252
+ $this->_sendUploadResponse($fileName, $content);
253
+ }
254
+
255
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
256
+ {
257
+ $response = $this->getResponse();
258
+ $response->setHeader('HTTP/1.1 200 OK','');
259
+ $response->setHeader('Pragma', 'public', true);
260
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
261
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
262
+ $response->setHeader('Last-Modified', date('r'));
263
+ $response->setHeader('Accept-Ranges', 'bytes');
264
+ $response->setHeader('Content-Length', strlen($content));
265
+ $response->setHeader('Content-type', $contentType);
266
+ $response->setBody($content);
267
+ $response->sendResponse();
268
+ exit;
269
+ }
270
+ }
app/code/community/Custom/Attributemanager/etc/config.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Custom_Attributemanager>
5
+ <version>0.0.6</version>
6
+ </Custom_Attributemanager>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <attributemanager>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Custom_Attributemanager</module>
14
+ <frontName>attributemanager</frontName>
15
+ </args>
16
+ </attributemanager>
17
+ </routers>
18
+ </admin>
19
+
20
+ <adminhtml>
21
+ <menu>
22
+ <customer>
23
+ <children>
24
+ <attrmanager>
25
+ <title>Attribute Manager</title>
26
+ <sort_order>600</sort_order>
27
+ <children>
28
+ <customer translate="title" module="attributemanager">
29
+ <title>Customer's Attributes</title>
30
+ <action>attributemanager/index/customer/filter//</action>
31
+ </customer>
32
+ </children>
33
+ </attrmanager>
34
+ </children>
35
+ </customer>
36
+ </menu>
37
+ <acl>
38
+ <resources>
39
+ <all>
40
+ <title>Allow Everything</title>
41
+ </all>
42
+ <admin>
43
+ <children>
44
+ <Custom_Attributemanager>
45
+ <title>Attributemanager Module</title>
46
+ <sort_order>10</sort_order>
47
+ </Custom_Attributemanager>
48
+ </children>
49
+ </admin>
50
+ </resources>
51
+ </acl>
52
+ <layout>
53
+ <updates>
54
+ <attributemanager>
55
+ <file>attributemanager.xml</file>
56
+ </attributemanager>
57
+ </updates>
58
+ </layout>
59
+ </adminhtml>
60
+
61
+ <frontend>
62
+ <layout>
63
+ <updates>
64
+ <attributemanager>
65
+ <file>attributemanager.xml</file>
66
+ </attributemanager>
67
+ </updates>
68
+ </layout>
69
+ </frontend>
70
+
71
+ <global>
72
+ <models>
73
+ <attributemanager>
74
+ <class>Custom_Attributemanager_Model</class>
75
+ </attributemanager>
76
+ </models>
77
+ <blocks>
78
+ <attributemanager>
79
+ <class>Custom_Attributemanager_Block</class>
80
+ </attributemanager>
81
+ <adminhtml>
82
+ <rewrite>
83
+ <customer_edit_tab_account>Custom_Attributemanager_Block_Adminhtml_Customer_Edit_Tab_Account</customer_edit_tab_account>
84
+ </rewrite>
85
+ </adminhtml>
86
+ </blocks>
87
+ <helpers>
88
+ <attributemanager>
89
+ <class>Custom_Attributemanager_Helper</class>
90
+ </attributemanager>
91
+ </helpers>
92
+ </global>
93
+ </config>
app/design/adminhtml/default/default/layout/attributemanager.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <layout version="0.9.1.1">
3
+ <!-- informations concernant la page d'accueil du module -->
4
+ <attributemanager_index>
5
+ <!-- informations concernant le block content -->
6
+ <reference name="content">
7
+ <block type="attributemanager/index" name="attributemanager" as="attributemanager" template="attributemanager/index.phtml" />
8
+ </reference>
9
+ </attributemanager_index>
10
+
11
+
12
+ <attributemanager_category>
13
+ <reference name="content">
14
+ <block type="attributemanager/attributemanagergrid" name="attributemanagergrid" as="attributemanagergrid" template="attributemanager/grid.phtml" />
15
+ </reference>
16
+ </attributemanager_category>
17
+ <attributemanager_customer>
18
+ <reference name="content">
19
+ <block type="attributemanager/attributemanagergrid" name="attributemanagergrid" as="attributemanagergrid" template="attributemanager/grid.phtml" />
20
+ </reference>
21
+ </attributemanager_customer>
22
+ <attributemanager_address>
23
+ <reference name="content">
24
+ <block type="attributemanager/attributemanagergrid" name="attributemanagergrid" as="attributemanagergrid" template="attributemanager/grid.phtml" />
25
+ </reference>
26
+ </attributemanager_address>
27
+
28
+ <attributemanager_edit>
29
+ <reference name="content">
30
+ <block type="attributemanager/attributemanageredit" name="attributemanageredit" as="attributemanageredit" template="attributemanager/options.phtml" />
31
+ </reference>
32
+ </attributemanager_edit>
33
+ </layout>
app/design/adminhtml/default/default/template/attributemanager/grid.phtml ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('attributemanager')->__('Manage attributes') ?></h3></td>
5
+
6
+ <td class="form-buttons"><?php echo $this->addNewButton()
7
+ ?></td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ <div>
12
+
13
+ <?php
14
+
15
+ /**
16
+ * Template for Mage_Adminhtml_Block_Widget_Grid
17
+ *
18
+ * getId()
19
+ * getCollection()
20
+ * getColumns()
21
+ * getPagerVisibility()
22
+ * getVarNamePage()
23
+ */
24
+ $numColumns = sizeof($this->getColumns());
25
+ ?>
26
+ <?php if($this->getCollection()): ?>
27
+ <?php if($this->canDisplayContainer()): ?>
28
+ <?php if($this->getGridHeader()): ?>
29
+ <div class="content-header">
30
+ <table cellspacing="0">
31
+ <tr>
32
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
33
+ </tr>
34
+ </table>
35
+ </div>
36
+ <?php endif ?>
37
+
38
+ <div id="<?php echo $this->getId() ?>">
39
+ <?php else: ?>
40
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
+ <?php endif; ?>
42
+ <?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
43
+ <table cellspacing="0" class="actions">
44
+ <tr>
45
+ <?php if($this->getPagerVisibility()): ?>
46
+ <td class="pager">
47
+ <?php echo $this->__('Page') ?>
48
+
49
+ <?php $_curPage = $this->getCollection()->getCurPage() ?>
50
+ <?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
51
+ <?php if($_curPage>1): ?>
52
+ <a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
53
+ <?php else: ?>
54
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
55
+ <?php endif; ?>
56
+
57
+ <input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
58
+
59
+ <?php if($_curPage < $_lastPage): ?>
60
+ <a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
61
+ <?php else: ?>
62
+ <img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
63
+ <?php endif; ?>
64
+
65
+ <?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
66
+ <span class="separator">|</span>
67
+ <?php echo $this->__('View') ?>
68
+ <select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
69
+ <option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
70
+ <option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
71
+ <option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
72
+ <option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
73
+ <option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
74
+ </select>
75
+ <?php echo $this->__('per page') ?><span class="separator">|</span>
76
+ <?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
77
+ <span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
78
+ <?php if($this->getRssLists()): ?>
79
+ <?php foreach ($this->getRssLists() as $_rss): ?>
80
+ <span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
81
+ <?php endforeach ?>
82
+ <?php endif; ?>
83
+ </td>
84
+ <?php endif ?>
85
+ <?php if($this->getExportTypes()): ?>
86
+ <td class="export a-right">
87
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
88
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
89
+ <?php foreach ($this->getExportTypes() as $_type): ?>
90
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
91
+ <?php endforeach; ?>
92
+ </select>
93
+ <?php echo $this->getExportButtonHtml() ?>
94
+ </td>
95
+ <?php endif; ?>
96
+ <td class="filter-actions a-right">
97
+ <?php echo $this->getMainButtonsHtml() ?>
98
+ </td>
99
+ </tr>
100
+ </table>
101
+ <?php endif; ?>
102
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
103
+ <?php echo $this->getMassactionBlockHtml() ?>
104
+ <?php endif ?>
105
+ <div class="grid">
106
+ <div class="hor-scroll">
107
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
108
+ <?php foreach ($this->getColumns() as $_column): ?>
109
+ <col <?php echo $_column->getHtmlProperty() ?> />
110
+ <?php endforeach; ?>
111
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
112
+ <thead>
113
+ <?php if ($this->getHeadersVisibility()): ?>
114
+ <tr class="headings">
115
+ <?php foreach ($this->getColumns() as $_column): ?>
116
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
117
+ <?php endforeach; ?>
118
+ </tr>
119
+ <?php endif; ?>
120
+ <?php if ($this->getFilterVisibility()): ?>
121
+ <tr class="filter">
122
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
123
+ <th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
124
+ <?php endforeach; ?>
125
+ </tr>
126
+ <?php endif ?>
127
+ </thead>
128
+ <?php endif; ?>
129
+ <?php if ($this->getCountTotals()): ?>
130
+ <tfoot>
131
+ <tr>
132
+ <?php foreach ($this->getColumns() as $_column): ?>
133
+ <th class="<?php echo $_column->getCssProperty() ?>"><?php echo $_column->getRowField($_column->getGrid()->getTotals()) ?>&nbsp;</th>
134
+ <?php endforeach; ?>
135
+ </tr>
136
+ </tfoot>
137
+ <?php endif; ?>
138
+ <tbody>
139
+ <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
140
+ <?php foreach ($this->getCollection() as $_index=>$_item): ?>
141
+ <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
142
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
143
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : '&nbsp;') ?></td>
144
+ <?php endforeach; ?>
145
+ </tr>
146
+ <?php endforeach; ?>
147
+ <?php elseif ($this->getEmptyText()): ?>
148
+ <tr>
149
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
150
+ </tr>
151
+ <?php endif; ?>
152
+ </tbody>
153
+ </table>
154
+ </div>
155
+ </div>
156
+ <?php if($this->canDisplayContainer()): ?>
157
+ </div>
158
+ <script type="text/javascript">
159
+ //<![CDATA[
160
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
161
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
162
+ <?php if($this->getRowClickCallback()): ?>
163
+ <?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
164
+ <?php endif; ?>
165
+ <?php if($this->getCheckboxCheckCallback()): ?>
166
+ <?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
167
+ <?php endif; ?>
168
+ <?php if($this->getRowInitCallback()): ?>
169
+ <?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
170
+ <?php echo $this->getJsObjectName() ?>.rows.each(function(row){<?php echo $this->getRowInitCallback() ?>(<?php echo $this->getJsObjectName() ?>, row)});
171
+ <?php endif; ?>
172
+ <?php if($this->getMassactionBlock()->isAvailable()): ?>
173
+ <?php echo $this->getMassactionBlock()->getJavaScript() ?>
174
+ <?php endif ?>
175
+ //]]>
176
+ </script>
177
+ <?php endif; ?>
178
+ <?php endif ?>
179
+ </div>
app/design/adminhtml/default/default/template/attributemanager/index.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="content-header">
2
+ <table cellspacing="0">
3
+ <tr>
4
+ <td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('attributemanager')->__('Manage attributes') ?></h3></td>
5
+ <td class="a-right">
6
+ </td>
7
+ </tr>
8
+ </table>
9
+ </div>
10
+ <div>
11
+ <div align="center">
12
+ <h3 class="icon-head"><u><?php echo Mage::helper('attributemanager')->__('Choose attributes to manage') ?></u></h3>
13
+ <br/><br/>
14
+ <h3 class="icon-head">
15
+ <a href="<?php echo $this->getUrl('*');?>index/category/filter//"><?php echo Mage::helper('attributemanager')->__('Categories attributes') ?></a>
16
+ <br/>
17
+ <a href="<?php echo $this->getUrl('*');?>index/customer/filter//"><?php echo Mage::helper('attributemanager')->__('Customers attributes') ?></a>
18
+ <br/>
19
+ <a href="<?php echo $this->getUrl('*');?>index/address/filter//"><?php echo Mage::helper('attributemanager')->__('Customer\'s address attributes') ?></a></h3>
20
+ </div>
21
+ </div>
app/design/adminhtml/default/default/template/attributemanager/js.phtml ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.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
+ function saveAndContinueEdit(){
29
+ editForm.submit($('edit_form').action+'back/edit/tab/' + product_attribute_tabsJsTabs.activeTab.id);
30
+ }
31
+
32
+
33
+ function toggleApplyVisibility(select) {
34
+ if ($(select).value == 1) {
35
+ $(select).next('select').removeClassName('no-display');
36
+ $(select).next('select').removeClassName('ignore-validate');
37
+
38
+ } else {
39
+ $(select).next('select').addClassName('no-display');
40
+ $(select).next('select').addClassName('ignore-validate');
41
+ var options = $(select).next('select').options;
42
+ for( var i=0; i < options.length; i++) {
43
+ options[i].selected = false;
44
+ }
45
+ }
46
+ }
47
+
48
+ function checkOptionsPanelVisibility(){
49
+ if($('matage-options-panel')){
50
+ var panel = $('matage-options-panel');
51
+ if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect')){
52
+ panel.show();
53
+ }
54
+ else {
55
+ panel.hide();
56
+ }
57
+ }
58
+ }
59
+
60
+ function bindAttributeInputType()
61
+ {
62
+ checkOptionsPanelVisibility();
63
+ switchDefaultValueField();
64
+ checkIsConfigurableVisibility();
65
+ if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
66
+ if($('is_filterable')){
67
+ $('is_filterable').disabled = false;
68
+ }
69
+ if($('is_filterable_in_search')){
70
+ $('is_filterable_in_search').disabled = false;
71
+ }
72
+ if($('backend_type') && $('backend_type').options){
73
+ for(var i=0;i<$('backend_type').options.length;i++){
74
+ if($('backend_type').options[i].value=='int') $('backend_type').selectedIndex = i;
75
+ }
76
+ }
77
+ }
78
+ else {
79
+ if($('is_filterable')){
80
+ $('is_filterable').selectedIndex=0;
81
+ $('is_filterable').disabled = true;
82
+ }
83
+ if($('is_filterable_in_search')){
84
+ $('is_filterable_in_search').disabled = true;
85
+ }
86
+ }
87
+ switchIsFilterable();
88
+ }
89
+
90
+ function switchIsFilterable()
91
+ {
92
+ if ($('is_filterable')) {
93
+ if ($('is_filterable').selectedIndex == 0) {
94
+ $('position').disabled = true;
95
+ } else {
96
+ $('position').disabled = false;
97
+ }
98
+ }
99
+ }
100
+
101
+ function disableApplyToValue(value)
102
+ {
103
+ var applyToSelect = $('apply_to');
104
+ for (i=0;i<applyToSelect.options.length;i++) {
105
+ if (value == applyToSelect.options[i].value) {
106
+ applyToSelect.options[i].disabled = true;
107
+ applyToSelect.options[i].selected = false;
108
+ }
109
+ }
110
+ }
111
+
112
+ function switchDefaultValueField()
113
+ {
114
+ if (!$('frontend_input')) {
115
+ return;
116
+ }
117
+
118
+ var currentValue = $('frontend_input').value;
119
+
120
+ var defaultValueTextVisibility = false;
121
+ var defaultValueTextareaVisibility = false;
122
+ var defaultValueDateVisibility = false;
123
+ var defaultValueYesnoVisibility = false;
124
+ var scopeVisibility = true;
125
+
126
+ switch (currentValue) {
127
+ case 'select':
128
+ optionDefaultInputType = 'radio';
129
+ break;
130
+
131
+ case 'multiselect':
132
+ optionDefaultInputType = 'checkbox';
133
+ break;
134
+
135
+ case 'date':
136
+ defaultValueDateVisibility = true;
137
+ break;
138
+
139
+ case 'boolean':
140
+ defaultValueYesnoVisibility = true;
141
+ break;
142
+
143
+ case 'textarea':
144
+ defaultValueTextareaVisibility = true;
145
+ break;
146
+
147
+ case 'media_image':
148
+ defaultValueTextVisibility = false;
149
+ break;
150
+ case 'price':
151
+ scopeVisibility = false;
152
+ default:
153
+ defaultValueTextVisibility = true;
154
+ break;
155
+ }
156
+
157
+ var applyToSelect = $('apply_to');
158
+ switch (currentValue) {
159
+ <?php foreach (Mage::helper('catalog')->getAttributeDisabledTypes() as $type=>$disabled): ?>
160
+ case '<?php echo $type; ?>':
161
+ <?php foreach ($disabled as $one): ?>
162
+ disableApplyToValue('<?php echo $one; ?>');
163
+ <?php endforeach; ?>
164
+ break;
165
+ <?php endforeach; ?>
166
+ default:
167
+ for (i=0;i<applyToSelect.options.length;i++) {
168
+ applyToSelect.options[i].disabled = false;
169
+ }
170
+ break;
171
+ }
172
+
173
+ switch (currentValue) {
174
+ case 'media_image':
175
+ $('front_fieldset').previous().hide();
176
+ $('front_fieldset').hide();
177
+
178
+ setRowVisibility('is_required', false);
179
+ setRowVisibility('is_unique', false);
180
+ setRowVisibility('frontend_class', false);
181
+ break;
182
+
183
+ <?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?>
184
+ case '<?php echo $type; ?>':
185
+ <?php foreach ($fields as $one): ?>
186
+ <?php if ($one == '_front_fieldset'): ?>
187
+ $('front_fieldset').previous().hide();
188
+ $('front_fieldset').hide();
189
+ <?php elseif ($one == '_default_value'): ?>
190
+ defaultValueTextVisibility =
191
+ defaultValueTextareaVisibility =
192
+ defaultValueDateVisibility =
193
+ defaultValueYesnoVisibility = false;
194
+ <?php elseif ($one == '_scope'): ?>
195
+ scopeVisibility = false;
196
+ <?php else: ?>
197
+ setRowVisibility('<?php echo $one; ?>', false);
198
+ <?php endif; ?>
199
+ <?php endforeach; ?>
200
+ break;
201
+ <?php endforeach; ?>
202
+
203
+ default:
204
+ $('front_fieldset').previous().show();
205
+ $('front_fieldset').show();
206
+ setRowVisibility('is_required', true);
207
+ setRowVisibility('is_unique', true);
208
+ setRowVisibility('frontend_class', true);
209
+ setRowVisibility('is_configurable', true);
210
+ break;
211
+ }
212
+
213
+ setRowVisibility('default_value_text', defaultValueTextVisibility);
214
+ setRowVisibility('default_value_textarea', defaultValueTextareaVisibility);
215
+ setRowVisibility('default_value_date', defaultValueDateVisibility);
216
+ setRowVisibility('default_value_yesno', defaultValueYesnoVisibility);
217
+ setRowVisibility('is_global', scopeVisibility);
218
+
219
+ var elems = document.getElementsByName('default[]');
220
+ for (var i = 0; i < elems.length; i++) {
221
+ elems[i].type = optionDefaultInputType;
222
+ }
223
+ }
224
+
225
+ function setRowVisibility(id, isVisible)
226
+ {
227
+ if ($(id)) {
228
+ var td = $(id).parentNode;
229
+ var tr = $(td.parentNode);
230
+
231
+ if (isVisible) {
232
+ tr.show();
233
+ } else {
234
+ tr.blur();
235
+ tr.hide();
236
+ }
237
+ }
238
+ }
239
+
240
+ function checkIsConfigurableVisibility()
241
+ {
242
+ if (!$('is_configurable') || !$('is_global') || !$('frontend_input')) return;
243
+ if ($F('is_global')==1 && $F('frontend_input')=='select') {
244
+ setRowVisibility('is_configurable', true);
245
+ } else {
246
+ setRowVisibility('is_configurable', false);
247
+ }
248
+ }
249
+
250
+ function updateRequriedOptions()
251
+ {
252
+ if ($F('frontend_input')=='select' && $F('is_required')==1) {
253
+ $('option-count-check').addClassName('required-options-count');
254
+ } else {
255
+ $('option-count-check').removeClassName('required-options-count');
256
+ }
257
+ }
258
+
259
+ if($('frontend_input')){
260
+ Event.observe($('frontend_input'), 'change', updateRequriedOptions);
261
+ Event.observe($('frontend_input'), 'change', bindAttributeInputType);
262
+ Event.observe($('is_global'), 'change', checkIsConfigurableVisibility);
263
+ }
264
+
265
+ if ($('is_filterable')) {
266
+ Event.observe($('is_filterable'), 'change', switchIsFilterable);
267
+ }
268
+
269
+ if ($('is_required')) {
270
+ Event.observe($('is_required'), 'change', updateRequriedOptions);
271
+ }
272
+ bindAttributeInputType();
273
+
274
+ </script>
app/design/adminhtml/default/default/template/attributemanager/new/created.phtml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.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
+ var added = false;
29
+ function addAttribute(closeAfter) {
30
+ if(window.opener!=null && !added) {
31
+ window.opener.Product.AttributesBridge.addAttributeRow(<?php echo $this->getAttributesBlockJson() ?>);
32
+ added = true;
33
+ }
34
+
35
+ if(closeAfter)
36
+ {
37
+ closeWindow();
38
+ }
39
+ }
40
+
41
+ function closeWindow()
42
+ {
43
+ if (window.opener) {
44
+ window.opener.focus();
45
+ }
46
+ window.close();
47
+ }
48
+
49
+ addAttribute(false);
50
+ setTimeout(closeWindow, 3000);
51
+ </script>
52
+ <div class="a-center">
53
+ <?php echo $this->getCloseButtonHtml() ?>
54
+ </div>
app/design/adminhtml/default/default/template/attributemanager/options.phtml ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Attribute otions control
4
+ *
5
+ * @see Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Options
6
+ */
7
+ ?>
8
+ <div>
9
+ <ul class="messages">
10
+ <li class="notice-msg">
11
+ <ul>
12
+ <li><?php echo Mage::helper('catalog')->__('If you do not specify an option value for a store then the default value will be used.') ?></li>
13
+ </ul>
14
+ </li>
15
+ </ul>
16
+ </div>
17
+
18
+ <div class="entity-edit">
19
+ <div class="entry-edit-head">
20
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Manage Titles (Size, Color, etc.)') ?></h4>
21
+ </div>
22
+ <div class="box">
23
+ <div class="hor-scroll">
24
+ <table class="dynamic-grid" cellspacing="0" id="attribute-labels-table">
25
+ <tr>
26
+ <?php foreach ($this->getStores() as $_store): ?>
27
+ <th><?php echo $_store->getName() ?></th>
28
+ <?php endforeach; ?>
29
+ </tr>
30
+ <tr>
31
+ <?php $_labels = $this->getLabelValues() ?>
32
+ <?php foreach ($this->getStores() as $_store): ?>
33
+ <td>
34
+ <input class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->htmlEscape($_labels[$_store->getId()]) ?>" />
35
+ </td>
36
+ <?php endforeach; ?>
37
+ </tr>
38
+ </table>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <br/>
43
+ <div class="entity-edit" id="matage-options-panel">
44
+ <div class="entry-edit-head">
45
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Manage Options (values of your attribute)') ?></h4>
46
+ </div>
47
+ <div class="box">
48
+ <div class="hor-scroll">
49
+ <table class="dynamic-grid" cellspacing="0" cellpadding="0">
50
+ <tr id="attribute-options-table">
51
+ <?php foreach ($this->getStores() as $_store): ?>
52
+ <th><?php echo $_store->getName() ?></th>
53
+ <?php endforeach; ?>
54
+ <th><?php echo Mage::helper('catalog')->__('Position') ?></th>
55
+ <th class="nobr a-center"><?php echo Mage::helper('catalog')->__('Is Default') ?></th>
56
+ <th><?php echo $this->getAddNewButtonHtml() ?></th>
57
+ </tr>
58
+ <tr class="no-display template" id="row-template">
59
+ <?php foreach ($this->getStores() as $_store): ?>
60
+ <td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" /></td>
61
+ <?php endforeach; ?>
62
+ <td class="a-center"><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}" /></td>
63
+ <td><input class="input-radio" type="radio" name="default[]" value="{{id}}" /></td>
64
+ <td class="a-left">
65
+ <input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />
66
+ <?php echo $this->getDeleteButtonHtml() ?>
67
+ </td>
68
+ </tr>
69
+ </table>
70
+ </div>
71
+ <input type="hidden" id="option-count-check" value="" />
72
+ </div>
73
+ </div>
74
+ <script type="text/javascript">
75
+ //<![CDATA[
76
+ var optionDefaultInputType = 'radio';
77
+
78
+ // IE removes quotes from element.innerHTML whenever it thinks they're not needed, which breaks html.
79
+ var templateText =
80
+ '<tr class="option-row">'+
81
+ <?php foreach ($this->getStores() as $_store): ?>
82
+ '<td><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if($_store->getId()==0): ?> required-option<?php endif; ?>" type="text" /><\/td>'+
83
+ <?php endforeach; ?>
84
+ '<td><input class="input-text" type="text" name="option[order][{{id}}]" value="{{sort_order}}"><\/td>'+
85
+ '<td class="a-center"><input class="input-radio" type="{{intype}}" name="default[]" value="{{id}}" {{checked}} /><\/td>'+
86
+ '<td class="a-left">'+
87
+ '<input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" />'+
88
+ '<?php echo $this->getDeleteButtonHtml() ?>'+
89
+ '<\/td>'+
90
+ '<\/tr>';
91
+
92
+ var attributeOption = {
93
+ table : $('attribute-options-table'),
94
+ templateSyntax : /(^|.|\r|\n)({{(\w+)}})/,
95
+ templateText : templateText,
96
+ itemCount : 0,
97
+ totalItems : 0,
98
+ add : function(data) {
99
+ this.template = new Template(this.templateText, this.templateSyntax);
100
+ if(!data.id){
101
+ data = {};
102
+ data.id = 'option_'+this.itemCount;
103
+ }
104
+ if (!data.intype)
105
+ data.intype = optionDefaultInputType;
106
+
107
+ Element.insert(this.table, {after: this.template.evaluate(data)});
108
+ this.bindRemoveButtons();
109
+ this.itemCount++;
110
+ this.totalItems++;
111
+ this.updateItemsCountField();
112
+ },
113
+ remove : function(event){
114
+ var element = $(Event.findElement(event, 'tr')); // !!! Button already
115
+ // have table parent in safari
116
+ // Safari workaround
117
+ element.ancestors().each(function(parentItem){
118
+ if (parentItem.hasClassName('option-row')) {
119
+ element = parentItem;
120
+ throw $break;
121
+ } else if (parentItem.hasClassName('box')) {
122
+ throw $break;
123
+ }
124
+ });
125
+
126
+
127
+ if(element){
128
+ var elementFlags = element.getElementsByClassName('delete-flag');
129
+ if(elementFlags[0]){
130
+ elementFlags[0].value=1;
131
+ }
132
+
133
+ element.addClassName('no-display');
134
+ element.addClassName('template');
135
+ element.hide();
136
+ this.totalItems--;
137
+ this.updateItemsCountField();
138
+ }
139
+ },
140
+ updateItemsCountField: function() {
141
+ if (this.totalItems > 0) {
142
+ $('option-count-check').value = '1';
143
+ } else {
144
+ $('option-count-check').value = '';
145
+ }
146
+ },
147
+ bindRemoveButtons : function(){
148
+ var buttons = $$('.delete-option');
149
+ for(var i=0;i<buttons.length;i++){
150
+ if(!$(buttons[i]).binded){
151
+ $(buttons[i]).binded = true;
152
+ Event.observe(buttons[i], 'click', this.remove.bind(this));
153
+ }
154
+ }
155
+ }
156
+
157
+ }
158
+ if($('row-template')){
159
+ $('row-template').remove();
160
+ }
161
+ attributeOption.bindRemoveButtons();
162
+
163
+ if($('add_new_option_button')){
164
+ Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
165
+ }
166
+ Validation.addAllThese([
167
+ ['required-option', '<?php echo Mage::helper('catalog')->__('Failed') ?>', function(v) {
168
+ return !Validation.get('IsEmpty').test(v);
169
+ }]]);
170
+ Validation.addAllThese([
171
+ ['required-options-count', '<?php echo Mage::helper('catalog')->__('Options is required') ?>', function(v) {
172
+ return !Validation.get('IsEmpty').test(v);
173
+ }]]);
174
+ <?php foreach ($this->getOptionValues() as $_value): ?>
175
+ attributeOption.add(<?php echo $_value->toJson() ?>);
176
+ <?php endforeach; ?>
177
+ //]]>
178
+ </script>
app/design/frontend/default/default/layout/attributemanager.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ </default>
5
+
6
+ <customer_account_create translate="label">
7
+ <reference name="head">
8
+ <action method="addJs"><script>varien/product.js</script></action>
9
+ <action method="addJs"><script>varien/configurable.js</script></action>
10
+
11
+ <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/></action>
12
+ <action method="addItem"><type>js</type><name>calendar/calendar.js</name></action>
13
+ <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name></action>
14
+ </reference>
15
+ <reference name="before_body_end">
16
+ <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
17
+ </reference>
18
+ </customer_account_create>
19
+ <customer_account_edit translate="label">
20
+ <reference name="head">
21
+ <action method="addJs"><script>varien/product.js</script></action>
22
+ <action method="addJs"><script>varien/configurable.js</script></action>
23
+
24
+ <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/></action>
25
+ <action method="addItem"><type>js</type><name>calendar/calendar.js</name></action>
26
+ <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name></action>
27
+ </reference>
28
+ <reference name="before_body_end">
29
+ <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
30
+ </reference>
31
+ </customer_account_edit>
32
+ </layout>
app/design/frontend/default/default/template/customer/form/edit.phtml ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ </ul>
35
+ </div>
36
+
37
+ <div class="fieldset" style="display:none;">
38
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
39
+ <ul class="form-list">
40
+ <li>
41
+ <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
42
+ <div class="input-box">
43
+ <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" />
44
+ </div>
45
+ </li>
46
+ <li class="fields">
47
+ <div class="field">
48
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
49
+ <div class="input-box">
50
+ <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" />
51
+ </div>
52
+ </div>
53
+ <div class="field">
54
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
55
+ <div class="input-box">
56
+ <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
57
+ </div>
58
+ </div>
59
+ </li>
60
+ </ul>
61
+ </div>
62
+
63
+ <div class="fieldset" id="more_info">
64
+ <h2 class="legend"><?php echo $this->__('More Information') ?></h2>
65
+ <ul class="form-list">
66
+ <?php
67
+ $var_attrs = array();
68
+ $model = 'customer/attribute_collection';
69
+ $type='customer';
70
+ $collection = Mage::getResourceModel($model)
71
+ ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
72
+ ->addVisibleFilter()
73
+ ->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
74
+
75
+ foreach($collection as $attribute) {
76
+ $attr = $attribute->toArray();
77
+
78
+ if($attr['is_required'])
79
+ $var_attrs[] = $attr['attribute_code'];
80
+
81
+ echo '<li>';
82
+ $func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
83
+
84
+ //call_user_func(array(get_class($this->getFormData()), $func));
85
+
86
+ switch($attr['frontend_input']) {
87
+ case 'text':
88
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
89
+ echo '
90
+ <div class="input-box">
91
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getCustomer()->$func()) .'" />
92
+ </div>';
93
+ break;
94
+
95
+ case 'select':
96
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
97
+ echo '
98
+ <div class="input-box">';
99
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
100
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
101
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
102
+ }
103
+ echo '</select>';
104
+
105
+ echo '
106
+ </div>';
107
+ break;
108
+
109
+ case 'textarea':
110
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
111
+ echo '
112
+ <div class="input-box">
113
+ <textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getCustomer()->$func()) .'</textarea>
114
+ </div>';
115
+ break;
116
+
117
+ case 'multiselect':
118
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
119
+ echo '
120
+ <div class="input-box">';
121
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
122
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
123
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
124
+ }
125
+ echo '</select>';
126
+ break;
127
+
128
+ case 'date':
129
+ $date_element = new Varien_Data_Form_Element_Date();
130
+ $date_element->setValue($this->htmlEscape($this->getCustomer()->$func()));
131
+
132
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
133
+ echo '
134
+ <div class="input-box">
135
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $date_element->getValue(Mage::app()->getLocale()->getDateFormatWithLongYear()) .'" class="input-text" style="width:110px !important;" />
136
+ <img style="" title="'. $this->__('Select Date') .'" id="'.$attr['attribute_code'].'_trig" class="v-middle" alt="" src="'. $this->getSkinUrl('images/grid-cal.gif') .'">
137
+ <script type="text/javascript">
138
+ Calendar.setup({
139
+ inputField : "'.$attr['attribute_code'].'",
140
+ ifFormat : "'. Varien_Date::convertZendToStrFtime(Mage::app()->getLocale()->getDateFormatWithLongYear(), true, false) .'",
141
+ button : "'.$attr['attribute_code'].'_trig",
142
+ showsTime: false,
143
+ align : "Bl",
144
+ singleClick : true
145
+ });
146
+ </script>
147
+ </div>';
148
+ break;
149
+ }
150
+
151
+ echo '
152
+ </li>';
153
+ }
154
+ ?>
155
+ </ul>
156
+ </div>
157
+
158
+ <div class="buttons-set">
159
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
160
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
161
+ <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
162
+ </div>
163
+ </form>
164
+
165
+ <script type="text/javascript">
166
+ //<![CDATA[
167
+ var dataForm = new VarienForm('form-validate', true);
168
+ function setPasswordForm(arg){
169
+ if(arg){
170
+ $('current_password').up(3).show();
171
+ $('current_password').addClassName('required-entry');
172
+ $('password').addClassName('required-entry');
173
+ $('confirmation').addClassName('required-entry');
174
+ }else{
175
+ $('current_password').up(3).hide();
176
+ $('current_password').removeClassName('required-entry');
177
+ $('password').removeClassName('required-entry');
178
+ $('confirmation').removeClassName('required-entry');
179
+ }
180
+ }
181
+ <?php if($this->getCustomer()->getChangePassword()): ?>
182
+ setPasswordForm(true);
183
+ <?php endif; ?>
184
+
185
+ function setExtraValidation(arg){
186
+ <?php $total_attr=count($var_attrs); ?>
187
+ if(arg){
188
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
189
+ $('<?php echo $var_attrs[$cnt] ?>').addClassName('required-entry');
190
+ <?php } ?>
191
+ }else{
192
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
193
+ $('<?php echo $var_attrs[$cnt] ?>').removeClassName('required-entry');
194
+ <?php } ?>
195
+ }
196
+ }
197
+ setExtraValidation(true);
198
+ //]]>
199
+ </script>
app/design/frontend/default/default/template/customer/form/register.phtml ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create account form template
4
+ *
5
+ * @see Mage_Customer_Block_Form_Register
6
+ */
7
+ ?>
8
+ <div class="account-create">
9
+ <div class="page-title">
10
+ <h1><?php echo $this->__('Create an Account') ?></h1>
11
+ </div>
12
+ <?php echo $this->getChildHtml('form_fields_before')?>
13
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
14
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
15
+ <div class="fieldset">
16
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
17
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
18
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
19
+ <ul class="form-list">
20
+ <li class="fields">
21
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
22
+ </li>
23
+ <li>
24
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
25
+ <div class="input-box">
26
+ <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" />
27
+ </div>
28
+ </li>
29
+ <?php if ($this->isNewsletterEnabled()): ?>
30
+ <li class="control">
31
+ <div class="input-box">
32
+ <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" />
33
+ </div>
34
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
35
+ </li>
36
+ <?php endif ?>
37
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob'); ?>
38
+ <?php if ($_dob->isEnabled()): ?>
39
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
40
+ <?php endif ?>
41
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
42
+ <?php if ($_taxvat->isEnabled()): ?>
43
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
44
+ <?php endif ?>
45
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
46
+ <?php if ($_gender->isEnabled()): ?>
47
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
48
+ <?php endif ?>
49
+ <?php /*
50
+ <li class="control">
51
+ <div class="input-box">
52
+ <label for="customer_group" class="required"><em>*</em><?php echo $this->__('Account Type'); ?></label>
53
+ &nbsp;
54
+ <input type="radio" name="group_id" value="2" title="<?php echo $this->__('Wholesaler') ?>" <?php echo $this->getFormData()->getGroupId()=='2'?'checked="checked"':'' ?> onclick="setExtraValidation(true);" /> Wholesaler
55
+ &nbsp;
56
+ <input type="radio" name="group_id" id="radio_retail" value="3" title="<?php echo $this->__('Retailer') ?>" <?php echo $this->getFormData()->getGroupId()!='2'?'checked="checked"':'' ?> onclick="setExtraValidation(false);" /> Retailer
57
+ </div>
58
+ </li>
59
+ */ ?>
60
+ </ul>
61
+ </div>
62
+
63
+ <div class="fieldset">
64
+ <h2 class="legend"><?php echo $this->__('More Information') ?></h2>
65
+ <ul class="form-list">
66
+ <?php
67
+ $var_attrs = array(); // will be used in JS
68
+ $model = 'customer/attribute_collection';
69
+ $type='customer';
70
+ $collection = Mage::getResourceModel($model)
71
+ ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
72
+ ->addVisibleFilter()
73
+ ->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
74
+
75
+ foreach($collection as $attribute) {
76
+ $attr = $attribute->toArray();
77
+
78
+ if($attr['is_required'])
79
+ $var_attrs[] = $attr['attribute_code'];
80
+
81
+ echo '<li>';
82
+ $func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
83
+
84
+ //call_user_func(array(get_class($this->getFormData()), $func));
85
+
86
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
87
+ switch($attr['frontend_input']) {
88
+ case 'text':
89
+ echo '
90
+ <div class="input-box">
91
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getFormData()->$func()) .'" class="input-text" />
92
+ </div>';
93
+ break;
94
+
95
+ case 'select':
96
+ echo '
97
+ <div class="input-box">';
98
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
99
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
100
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
101
+ }
102
+ echo '</select>';
103
+
104
+ echo '
105
+ </div>';
106
+ break;
107
+
108
+ case 'textarea':
109
+ echo '
110
+ <div class="input-box">
111
+ <textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getFormData()->$func()) .'</textarea>
112
+ </div>';
113
+ break;
114
+
115
+ case 'multiselect':
116
+ echo '
117
+ <div class="input-box">';
118
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
119
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
120
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
121
+ }
122
+ echo '</select>';
123
+ break;
124
+
125
+ case 'date':
126
+ echo '
127
+ <div class="input-box">
128
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getFormData()->$func()) .'" class="input-text" style="width:110px !important;" />
129
+ <img style="" title="'. $this->__('Select Date') .'" id="'.$attr['attribute_code'].'_trig" class="v-middle" alt="" src="'. $this->getSkinUrl('images/grid-cal.gif') .'">
130
+ </div>';
131
+ echo '<script type="text/javascript">
132
+ Calendar.setup({
133
+ inputField : "'.$attr['attribute_code'].'",
134
+ ifFormat : "'. Varien_Date::convertZendToStrFtime(Mage::app()->getLocale()->getDateFormatWithLongYear(), true, false) .'",
135
+ button : "'.$attr['attribute_code'].'_trig",
136
+ showsTime: false,
137
+ align : "Bl",
138
+ singleClick : true
139
+ });
140
+ </script>';
141
+ break;
142
+ }
143
+
144
+ echo '
145
+ </li>';
146
+ }
147
+ ?>
148
+ </ul>
149
+ </div>
150
+ <?php if($this->getShowAddressFields()): ?>
151
+ <div class="fieldset">
152
+ <input type="hidden" name="create_address" value="1" />
153
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
154
+ <ul class="form-list">
155
+ <li class="fields">
156
+ <div class="field">
157
+ <label for="company"><?php echo $this->__('Company') ?></label>
158
+ <div class="input-box">
159
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
160
+ </div>
161
+ </div>
162
+ <div class="field">
163
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
164
+ <div class="input-box">
165
+ <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" />
166
+ </div>
167
+ </div>
168
+ </li>
169
+ <li class="wide">
170
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
171
+ <div class="input-box">
172
+ <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" />
173
+ </div>
174
+ </li>
175
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
176
+ <li class="wide">
177
+ <div class="input-box">
178
+ <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" />
179
+ </div>
180
+ </li>
181
+ <?php endfor ?>
182
+ <li class="fields">
183
+ <div class="field">
184
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
185
+ <div class="input-box">
186
+ <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" />
187
+ </div>
188
+ </div>
189
+ <div class="field">
190
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
191
+ <div class="input-box">
192
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
193
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
194
+ </select>
195
+ <script type="text/javascript">
196
+ //<![CDATA[
197
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
198
+ //]]>
199
+ </script>
200
+ <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;" />
201
+ </div>
202
+ </div>
203
+ </li>
204
+ <li class="fields">
205
+ <div class="field">
206
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
207
+ <div class="input-box">
208
+ <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" />
209
+ </div>
210
+ </div>
211
+ <div class="field">
212
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
213
+ <div class="input-box">
214
+ <?php echo $this->getCountryHtmlSelect() ?>
215
+ </div>
216
+ </div>
217
+ </li>
218
+ </ul>
219
+ <input type="hidden" name="default_billing" value="1" />
220
+ <input type="hidden" name="default_shipping" value="1" />
221
+ </div>
222
+ <?php endif; ?>
223
+ <div class="fieldset">
224
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
225
+ <ul class="form-list">
226
+ <li class="fields">
227
+ <div class="field">
228
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
229
+ <div class="input-box">
230
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
231
+ </div>
232
+ </div>
233
+ <div class="field">
234
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
235
+ <div class="input-box">
236
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
237
+ </div>
238
+ </div>
239
+ </li>
240
+ </ul>
241
+ </div>
242
+ <div class="buttons-set">
243
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
244
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
245
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
246
+ </div>
247
+ </form>
248
+ <script type="text/javascript">
249
+ //<![CDATA[
250
+ var dataForm = new VarienForm('form-validate', true);
251
+ <?php if($this->getShowAddressFields()): ?>
252
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
253
+ <?php endif; ?>
254
+
255
+ function setExtraValidation(arg){
256
+ <?php $total_attr=count($var_attrs); ?>
257
+ if(arg){
258
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
259
+ $('<?php echo $var_attrs[$cnt] ?>').addClassName('required-entry');
260
+ <?php } ?>
261
+ }else{
262
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
263
+ $('<?php echo $var_attrs[$cnt] ?>').removeClassName('required-entry');
264
+ <?php } ?>
265
+ }
266
+ }
267
+ setExtraValidation(true);
268
+
269
+ //]]>
270
+ </script>
271
+ </div>
app/design/frontend/default/default/template/persistent/customer/form/edit.phtml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ </ul>
35
+ </div>
36
+
37
+ <div class="fieldset" style="display:none;">
38
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
39
+ <ul class="form-list">
40
+ <li>
41
+ <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
42
+ <div class="input-box">
43
+ <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" />
44
+ </div>
45
+ </li>
46
+ <li class="fields">
47
+ <div class="field">
48
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
49
+ <div class="input-box">
50
+ <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" />
51
+ </div>
52
+ </div>
53
+ <div class="field">
54
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
55
+ <div class="input-box">
56
+ <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
57
+ </div>
58
+ </div>
59
+ </li>
60
+ </ul>
61
+ </div>
62
+
63
+ <div class="fieldset" id="more_info">
64
+ <h2 class="legend"><?php echo $this->__('More Information') ?></h2>
65
+ <ul class="form-list">
66
+ <?php
67
+ $var_attrs = array();
68
+ $model = 'customer/attribute_collection';
69
+ $type='customer';
70
+ $collection = Mage::getResourceModel($model)
71
+ ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
72
+ ->addVisibleFilter()
73
+ ->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
74
+
75
+ foreach($collection as $attribute) {
76
+ //echo get_class($attribute) . '<br />';
77
+ //echo '<pre>';
78
+ //print_r( get_class_methods( get_class( $attribute ) ) );
79
+ $attr = $attribute->toArray();
80
+
81
+
82
+ if($attr['is_required'])
83
+ $var_attrs[] = $attr['attribute_code'];
84
+
85
+ echo '<li>';
86
+ $func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
87
+
88
+ //call_user_func(array(get_class($this->getFormData()), $func));
89
+
90
+ switch($attr['frontend_input']) {
91
+ case 'text':
92
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
93
+ echo '
94
+ <div class="input-box">
95
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getCustomer()->$func()) .'" />
96
+ </div>';
97
+ break;
98
+
99
+ case 'select':
100
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
101
+ echo '
102
+ <div class="input-box">';
103
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
104
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
105
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
106
+ }
107
+ echo '</select>';
108
+
109
+ echo '
110
+ </div>';
111
+ break;
112
+
113
+ case 'textarea':
114
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
115
+ echo '
116
+ <div class="input-box">
117
+ <textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getCustomer()->$func()) .'</textarea>
118
+ </div>';
119
+ break;
120
+
121
+ case 'multiselect':
122
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
123
+ echo '
124
+ <div class="input-box">';
125
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
126
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
127
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
128
+ }
129
+ echo '</select>';
130
+ break;
131
+
132
+ case 'date':
133
+ $date_element = new Varien_Data_Form_Element_Date();
134
+ $date_element->setValue($this->htmlEscape($this->getCustomer()->$func()));
135
+
136
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
137
+ echo '
138
+ <div class="input-box">
139
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $date_element->getValue(Mage::app()->getLocale()->getDateFormatWithLongYear()) .'" class="input-text" style="width:110px !important;" />
140
+ <img style="" title="'. $this->__('Select Date') .'" id="'.$attr['attribute_code'].'_trig" class="v-middle" alt="" src="'. $this->getSkinUrl('images/grid-cal.gif') .'">
141
+ <script type="text/javascript">
142
+ Calendar.setup({
143
+ inputField : "'.$attr['attribute_code'].'",
144
+ ifFormat : "'. Varien_Date::convertZendToStrFtime(Mage::app()->getLocale()->getDateFormatWithLongYear(), true, false) .'",
145
+ button : "'.$attr['attribute_code'].'_trig",
146
+ showsTime: false,
147
+ align : "Bl",
148
+ singleClick : true
149
+ });
150
+ </script>
151
+ </div>';
152
+ break;
153
+ }
154
+
155
+ echo '
156
+ </li>';
157
+ }
158
+ ?>
159
+
160
+ </ul>
161
+ </div>
162
+ <div class="buttons-set">
163
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
164
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
165
+ <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
166
+ </div>
167
+ </form>
168
+ <script type="text/javascript">
169
+ //<![CDATA[
170
+ var dataForm = new VarienForm('form-validate', true);
171
+ function setPasswordForm(arg){
172
+ if(arg){
173
+ $('current_password').up(3).show();
174
+ $('current_password').addClassName('required-entry');
175
+ $('password').addClassName('required-entry');
176
+ $('confirmation').addClassName('required-entry');
177
+ }else{
178
+ $('current_password').up(3).hide();
179
+ $('current_password').removeClassName('required-entry');
180
+ $('password').removeClassName('required-entry');
181
+ $('confirmation').removeClassName('required-entry');
182
+ }
183
+ }
184
+ <?php if($this->getCustomer()->getChangePassword()): ?>
185
+ setPasswordForm(true);
186
+ <?php endif; ?>
187
+ function setExtraValidation(arg){
188
+ <?php $total_attr=count($var_attrs); ?>
189
+ if(arg){
190
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
191
+ $('<?php echo $var_attrs[$cnt] ?>').addClassName('required-entry');
192
+ <?php } ?>
193
+ }else{
194
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
195
+ $('<?php echo $var_attrs[$cnt] ?>').removeClassName('required-entry');
196
+ <?php } ?>
197
+ }
198
+ }
199
+ setExtraValidation(true);
200
+ //]]>
201
+ </script>
app/design/frontend/default/default/template/persistent/customer/form/register.phtml ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Create account form template
4
+ *
5
+ * @see Mage_Customer_Block_Form_Register
6
+ */
7
+ ?>
8
+ <div class="account-create">
9
+ <div class="page-title">
10
+ <h1><?php echo $this->__('Create an Account') ?></h1>
11
+ </div>
12
+ <?php echo $this->getChildHtml('form_fields_before')?>
13
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
14
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
15
+ <div class="fieldset">
16
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
17
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
18
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
19
+ <ul class="form-list">
20
+ <li class="fields">
21
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
22
+ </li>
23
+ <li>
24
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
25
+ <div class="input-box">
26
+ <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" />
27
+ </div>
28
+ </li>
29
+ <?php if ($this->isNewsletterEnabled()): ?>
30
+ <li class="control">
31
+ <div class="input-box">
32
+ <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" />
33
+ </div>
34
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
35
+ </li>
36
+ <?php endif ?>
37
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob'); ?>
38
+ <?php if ($_dob->isEnabled()): ?>
39
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
40
+ <?php endif ?>
41
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
42
+ <?php if ($_taxvat->isEnabled()): ?>
43
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
44
+ <?php endif ?>
45
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
46
+ <?php if ($_gender->isEnabled()): ?>
47
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
48
+ <?php endif ?>
49
+ <?php /*
50
+ <li class="control">
51
+ <div class="input-box">
52
+ <label for="customer_group" class="required"><em>*</em><?php echo $this->__('Account Type'); ?></label>
53
+ &nbsp;
54
+ <input type="radio" name="group_id" value="2" title="<?php echo $this->__('Wholesaler') ?>" <?php echo $this->getFormData()->getGroupId()=='2'?'checked="checked"':'' ?> onclick="setExtraValidation(true);" /> Wholesaler
55
+ &nbsp;
56
+ <input type="radio" name="group_id" id="radio_retail" value="3" title="<?php echo $this->__('Retailer') ?>" <?php echo $this->getFormData()->getGroupId()!='2'?'checked="checked"':'' ?> onclick="setExtraValidation(false);" /> Retailer
57
+ </div>
58
+ </li>
59
+ */ ?>
60
+ </ul>
61
+ </div>
62
+
63
+ <div class="fieldset">
64
+ <h2 class="legend"><?php echo $this->__('More Information') ?></h2>
65
+ <ul class="form-list">
66
+ <?php
67
+ $var_attrs = array(); // will be used in JS
68
+ $model = 'customer/attribute_collection';
69
+ $type='customer';
70
+ $collection = Mage::getResourceModel($model)
71
+ ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
72
+ ->addVisibleFilter()
73
+ ->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
74
+
75
+ foreach($collection as $attribute) {
76
+ $attr = $attribute->toArray();
77
+
78
+ if($attr['is_required'])
79
+ $var_attrs[] = $attr['attribute_code'];
80
+
81
+ echo '<li>';
82
+ $func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
83
+
84
+ //call_user_func(array(get_class($this->getFormData()), $func));
85
+ echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $attr['frontend_label'] ) . '</label>';
86
+ switch($attr['frontend_input']) {
87
+ case 'text':
88
+ echo '
89
+ <div class="input-box">
90
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getFormData()->$func()) .'" class="input-text" />
91
+ </div>';
92
+ break;
93
+
94
+ case 'select':
95
+ echo '
96
+ <div class="input-box">';
97
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
98
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
99
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
100
+ }
101
+ echo '</select>';
102
+
103
+ echo '
104
+ </div>';
105
+ break;
106
+
107
+ case 'textarea':
108
+ echo '
109
+ <div class="input-box">
110
+ <textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getFormData()->$func()) .'</textarea>
111
+ </div>';
112
+ break;
113
+
114
+ case 'multiselect':
115
+ echo '
116
+ <div class="input-box">';
117
+ echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
118
+ foreach ($attribute->getSource()->getAllOptions(true, true) as $instance) {
119
+ echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
120
+ }
121
+ echo '</select>';
122
+ break;
123
+
124
+ case 'date':
125
+ echo '
126
+ <div class="input-box">
127
+ <input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getFormData()->$func()) .'" class="input-text" style="width:110px !important;" />
128
+ <img style="" title="'. $this->__('Select Date') .'" id="'.$attr['attribute_code'].'_trig" class="v-middle" alt="" src="'. $this->getSkinUrl('images/grid-cal.gif') .'">
129
+ </div>';
130
+ echo '<script type="text/javascript">
131
+ Calendar.setup({
132
+ inputField : "'.$attr['attribute_code'].'",
133
+ ifFormat : "'. Varien_Date::convertZendToStrFtime(Mage::app()->getLocale()->getDateFormatWithLongYear(), true, false) .'",
134
+ button : "'.$attr['attribute_code'].'_trig",
135
+ showsTime: false,
136
+ align : "Bl",
137
+ singleClick : true
138
+ });
139
+ </script>';
140
+ break;
141
+ }
142
+
143
+ echo '
144
+ </li>';
145
+ }
146
+ ?>
147
+ </ul>
148
+ </div>
149
+ <?php if($this->getShowAddressFields()): ?>
150
+ <div class="fieldset">
151
+ <input type="hidden" name="create_address" value="1" />
152
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
153
+ <ul class="form-list">
154
+ <li class="fields">
155
+ <div class="field">
156
+ <label for="company"><?php echo $this->__('Company') ?></label>
157
+ <div class="input-box">
158
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
159
+ </div>
160
+ </div>
161
+ <div class="field">
162
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
163
+ <div class="input-box">
164
+ <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" />
165
+ </div>
166
+ </div>
167
+ </li>
168
+ <li class="wide">
169
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
170
+ <div class="input-box">
171
+ <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" />
172
+ </div>
173
+ </li>
174
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
175
+ <li class="wide">
176
+ <div class="input-box">
177
+ <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" />
178
+ </div>
179
+ </li>
180
+ <?php endfor ?>
181
+ <li class="fields">
182
+ <div class="field">
183
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
184
+ <div class="input-box">
185
+ <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" />
186
+ </div>
187
+ </div>
188
+ <div class="field">
189
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
190
+ <div class="input-box">
191
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
192
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
193
+ </select>
194
+ <script type="text/javascript">
195
+ //<![CDATA[
196
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
197
+ //]]>
198
+ </script>
199
+ <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;" />
200
+ </div>
201
+ </div>
202
+ </li>
203
+ <li class="fields">
204
+ <div class="field">
205
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
206
+ <div class="input-box">
207
+ <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" />
208
+ </div>
209
+ </div>
210
+ <div class="field">
211
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
212
+ <div class="input-box">
213
+ <?php echo $this->getCountryHtmlSelect() ?>
214
+ </div>
215
+ </div>
216
+ </li>
217
+ </ul>
218
+ <input type="hidden" name="default_billing" value="1" />
219
+ <input type="hidden" name="default_shipping" value="1" />
220
+ </div>
221
+ <?php endif; ?>
222
+ <div class="fieldset">
223
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
224
+ <ul class="form-list">
225
+ <li class="fields">
226
+ <div class="field">
227
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
228
+ <div class="input-box">
229
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
230
+ </div>
231
+ </div>
232
+ <div class="field">
233
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
234
+ <div class="input-box">
235
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
236
+ </div>
237
+ </div>
238
+ </li>
239
+ </ul>
240
+ </div>
241
+ <div class="buttons-set">
242
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
243
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
244
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
245
+ </div>
246
+ </form>
247
+ <script type="text/javascript">
248
+ //<![CDATA[
249
+ var dataForm = new VarienForm('form-validate', true);
250
+ <?php if($this->getShowAddressFields()): ?>
251
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
252
+ <?php endif; ?>
253
+ function setExtraValidation(arg){
254
+ <?php $total_attr=count($var_attrs); ?>
255
+ if(arg){
256
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
257
+ $('<?php echo $var_attrs[$cnt] ?>').addClassName('required-entry');
258
+ <?php } ?>
259
+ }else{
260
+ <?php for($cnt=0; $cnt<$total_attr; $cnt++) { ?>
261
+ $('<?php echo $var_attrs[$cnt] ?>').removeClassName('required-entry');
262
+ <?php } ?>
263
+ }
264
+ }
265
+ setExtraValidation(true);
266
+ //]]>
267
+ </script>
268
+ </div>
app/etc/modules/Custom_Attributemanager.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Custom_Attributemanager>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Custom_Attributemanager>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Custom_Attributemanager</name>
4
+ <version>0.0.6</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Get more information from customers</summary>
10
+ <description>Create and manage attributes of customers.&#xD;
11
+ &lt;br&gt;&#xD;
12
+ An admin interface to create/manage customer attributes. &#xD;
13
+ &lt;br&gt;&#xD;
14
+ Frontend register and account edit pages will automatically reflect attributes.</description>
15
+ <notes>Manage customer attributes and collect more information from customers.</notes>
16
+ <authors><author><name>Ankit</name><user>auto-converted</user><email>ankitce9@gmail.com</email></author></authors>
17
+ <date>2013-01-08</date>
18
+ <time>06:46:46</time>
19
+ <contents><target name="magecommunity"><dir name="Custom"><dir name="Attributemanager"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Account.php" hash="481405ec1c0f00add5469a2b85feb608"/></dir></dir></dir></dir><dir name="Edit"><dir name="Tab"><file name="Front.php" hash="2c99f0056100d663694e918655ba1a6e"/><file name="Main.php" hash="e54f6c7e1e963108b3879add105615af"/><file name="Options.php" hash="d5359d9a57d28359412d0ee60d6f62cd"/><file name="System.php" hash="7886c85dbfe78489d288781c06ed15ab"/></dir><file name="Form.php" hash="2d46039a5e9cdcd35541c836e24c81a8"/><file name="Tabs.php" hash="9dd66b4e1f960fa408e3699ef26cb0d0"/></dir><file name="Attributemanager.php" hash="f6aca64ddea7819205ffee10a36b3838"/><file name="Edit.php" hash="062fde1fa1675fe8e82a38ff63066bf9"/><file name="Grid.php" hash="40707645de55c57292a3906ccd9b41b4"/></dir><dir name="Helper"><file name="Data.php" hash="7c6b17fec5f73bbdba0c7ff74d552275"/></dir><dir name="Model"><file name="Attributemanager.php" hash="4427e20ae7614042d3ae9186a6f9f22f"/></dir><dir name="controllers"><file name="IndexController.php" hash="ba4deaa10fb5cfb4cfc82211e0a8abe8"/></dir><dir name="etc"><file name="config.xml" hash="816baaf1a233de4f1c1a19dac56148aa"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="attributemanager.xml" hash="9def95e84fc5df62f16f45d112ba7029"/></dir><dir name="template"><dir name="attributemanager"><dir name="new"><file name="created.phtml" hash="6221466a0afd2af66521244391f000d1"/></dir><file name="grid.phtml" hash="64f9821b3a83a80f0c4df62b1dcdac2d"/><file name="index.phtml" hash="f132317f55eb66a3a8f2062b1b570a1b"/><file name="js.phtml" hash="ceaf55fd2d77b197df0e4205e0cd7b14"/><file name="options.phtml" hash="cfa077b54985e1f4687d2d42f0cd266a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="customer"><dir name="form"><file name="edit.phtml" hash="d4bc760ffa6ae3fe1e64f7f806494e9d"/><file name="register.phtml" hash="ffcc0bbd436d4177e104411fd2844546"/></dir></dir><dir name="persistent"><dir name="customer"><dir name="form"><file name="edit.phtml" hash="cf53898ce3ae9e89da4351e9e9bde0bc"/><file name="register.phtml" hash="312767c65bb15501489f39d5ceaa0771"/></dir></dir></dir></dir><dir name="layout"><file name="attributemanager.xml" hash="51133e003149b1c594875ce9647676ab"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Custom_Attributemanager.xml" hash="138221f47562aaeca52becccadbc99d9"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies/>
22
+ </package>