Version Notes
Manage customer attributes and collect more information from customers.
Create fields for
- Registration form
- Account edit form
- Admin -> customer account information form
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Custom_Attributemanager |
| Version | 1.0.6 |
| Comparing to | |
| See all releases | |
Code changes from version 0.0.6 to 1.0.6
- app/code/community/Custom/Attributemanager/Block/Adminhtml/Customer/Edit/Tab/Account.php +0 -207
- app/code/community/Custom/Attributemanager/Block/Edit/Tab/Options.php +5 -1
- app/code/community/Custom/Attributemanager/controllers/IndexController.php +1 -1
- app/code/community/Custom/Attributemanager/etc/config.xml +1 -6
- app/design/adminhtml/default/default/template/attributemanager/options.phtml +1 -1
- app/design/frontend/default/default/layout/attributemanager.xml +10 -0
- app/design/frontend/default/default/template/{customer → attributemanager/customer}/form/edit.phtml +14 -11
- app/design/frontend/default/default/template/{customer → attributemanager/customer}/form/register.phtml +13 -5
- app/design/frontend/default/default/template/{persistent → attributemanager/persistent}/customer/form/edit.phtml +13 -11
- app/design/frontend/default/default/template/{persistent → attributemanager/persistent}/customer/form/register.phtml +14 -6
- package.xml +15 -10
app/code/community/Custom/Attributemanager/Block/Adminhtml/Customer/Edit/Tab/Account.php
DELETED
|
@@ -1,207 +0,0 @@
|
|
| 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/Edit/Tab/Options.php
CHANGED
|
@@ -116,6 +116,7 @@ class Custom_Attributemanager_Block_Edit_Tab_Options extends Mage_Adminhtml_Bloc
|
|
| 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();
|
|
@@ -124,12 +125,14 @@ class Custom_Attributemanager_Block_Edit_Tab_Options extends Mage_Adminhtml_Bloc
|
|
| 124 |
$values[$store->getId()] = isset($translations[$store->getId()]) ? $translations[$store->getId()] : '';
|
| 125 |
}
|
| 126 |
}
|
| 127 |
-
|
|
|
|
| 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')
|
|
@@ -141,6 +144,7 @@ class Custom_Attributemanager_Block_Edit_Tab_Options extends Mage_Adminhtml_Bloc
|
|
| 141 |
}
|
| 142 |
$this->setData('store_option_values_'.$storeId, $values);
|
| 143 |
}
|
|
|
|
| 144 |
return $values;
|
| 145 |
}
|
| 146 |
|
| 116 |
if (is_array($frontendLabel)) {
|
| 117 |
$frontendLabel = array_shift($frontendLabel);
|
| 118 |
}
|
| 119 |
+
|
| 120 |
$translations = Mage::getModel('core/translate_string')
|
| 121 |
->load(Mage_Catalog_Model_Entity_Attribute::MODULE_NAME.Mage_Core_Model_Translate::SCOPE_SEPARATOR.$frontendLabel)
|
| 122 |
->getStoreTranslations();
|
| 125 |
$values[$store->getId()] = isset($translations[$store->getId()]) ? $translations[$store->getId()] : '';
|
| 126 |
}
|
| 127 |
}
|
| 128 |
+
|
| 129 |
+
return ($this->getAttributeObject()->getStoreLabels() + $values);
|
| 130 |
}
|
| 131 |
|
| 132 |
public function getStoreOptionValues($storeId)
|
| 133 |
{
|
| 134 |
$values = $this->getData('store_option_values_'.$storeId);
|
| 135 |
+
|
| 136 |
if (is_null($values)) {
|
| 137 |
$values = array();
|
| 138 |
$valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
| 144 |
}
|
| 145 |
$this->setData('store_option_values_'.$storeId, $values);
|
| 146 |
}
|
| 147 |
+
|
| 148 |
return $values;
|
| 149 |
}
|
| 150 |
|
app/code/community/Custom/Attributemanager/controllers/IndexController.php
CHANGED
|
@@ -168,7 +168,7 @@ class Custom_Attributemanager_IndexController extends Mage_Adminhtml_Controller_
|
|
| 168 |
if($data['frontend_input'] == 'boolean') {
|
| 169 |
$attribute->setData('source_model', 'eav/entity_attribute_source_boolean');
|
| 170 |
}
|
| 171 |
-
|
| 172 |
$attribute->save();
|
| 173 |
}
|
| 174 |
|
| 168 |
if($data['frontend_input'] == 'boolean') {
|
| 169 |
$attribute->setData('source_model', 'eav/entity_attribute_source_boolean');
|
| 170 |
}
|
| 171 |
+
|
| 172 |
$attribute->save();
|
| 173 |
}
|
| 174 |
|
app/code/community/Custom/Attributemanager/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Custom_Attributemanager>
|
| 5 |
-
<version>
|
| 6 |
</Custom_Attributemanager>
|
| 7 |
</modules>
|
| 8 |
<admin>
|
|
@@ -78,11 +78,6 @@
|
|
| 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>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Custom_Attributemanager>
|
| 5 |
+
<version>1.0.6</version>
|
| 6 |
</Custom_Attributemanager>
|
| 7 |
</modules>
|
| 8 |
<admin>
|
| 78 |
<attributemanager>
|
| 79 |
<class>Custom_Attributemanager_Block</class>
|
| 80 |
</attributemanager>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
</blocks>
|
| 82 |
<helpers>
|
| 83 |
<attributemanager>
|
app/design/adminhtml/default/default/template/attributemanager/options.phtml
CHANGED
|
@@ -28,7 +28,7 @@
|
|
| 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()]) ?>" />
|
| 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()]) ?>" />
|
app/design/frontend/default/default/layout/attributemanager.xml
CHANGED
|
@@ -12,6 +12,11 @@
|
|
| 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>
|
|
@@ -25,6 +30,11 @@
|
|
| 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>
|
| 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 |
+
|
| 16 |
+
<block name="customer_form_register">
|
| 17 |
+
<action method="setTemplate"><template>attributemanager/customer/form/register.phtml</template></action>
|
| 18 |
+
</block>
|
| 19 |
+
|
| 20 |
<reference name="before_body_end">
|
| 21 |
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
| 22 |
</reference>
|
| 30 |
<action method="addItem"><type>js</type><name>calendar/calendar.js</name></action>
|
| 31 |
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name></action>
|
| 32 |
</reference>
|
| 33 |
+
|
| 34 |
+
<block name="customer_edit">
|
| 35 |
+
<action method="setTemplate"><template>attributemanager/customer/form/edit.phtml</template></action>
|
| 36 |
+
</block>
|
| 37 |
+
|
| 38 |
<reference name="before_body_end">
|
| 39 |
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
| 40 |
</reference>
|
app/design/frontend/default/default/template/{customer → attributemanager/customer}/form/edit.phtml
RENAMED
|
@@ -71,6 +71,8 @@
|
|
| 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();
|
|
@@ -78,14 +80,15 @@
|
|
| 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 |
-
|
| 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()) .'" />
|
|
@@ -93,11 +96,10 @@
|
|
| 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(
|
| 101 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 102 |
}
|
| 103 |
echo '</select>';
|
|
@@ -107,7 +109,6 @@
|
|
| 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>
|
|
@@ -115,12 +116,15 @@
|
|
| 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 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
}
|
| 125 |
echo '</select>';
|
| 126 |
break;
|
|
@@ -129,7 +133,6 @@
|
|
| 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;" />
|
| 71 |
->setEntityTypeFilter( Mage::getModel('eav/entity')->setType($type)->getTypeId() )
|
| 72 |
->addVisibleFilter()
|
| 73 |
->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
|
| 74 |
+
|
| 75 |
+
$store_id = Mage::app()->getStore()->getId();
|
| 76 |
|
| 77 |
foreach($collection as $attribute) {
|
| 78 |
$attr = $attribute->toArray();
|
| 80 |
if($attr['is_required'])
|
| 81 |
$var_attrs[] = $attr['attribute_code'];
|
| 82 |
|
| 83 |
+
$store_labels = $attribute->getStoreLabels();
|
| 84 |
+
$label = $store_labels[$store_id] ? $store_labels[$store_id] : $attr['frontend_label'];
|
| 85 |
+
|
| 86 |
echo '<li>';
|
| 87 |
$func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
|
| 88 |
|
| 89 |
+
echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $label ) . '</label>';
|
|
|
|
| 90 |
switch($attr['frontend_input']) {
|
| 91 |
case 'text':
|
|
|
|
| 92 |
echo '
|
| 93 |
<div class="input-box">
|
| 94 |
<input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getCustomer()->$func()) .'" />
|
| 96 |
break;
|
| 97 |
|
| 98 |
case 'select':
|
|
|
|
| 99 |
echo '
|
| 100 |
<div class="input-box">';
|
| 101 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 102 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 103 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 104 |
}
|
| 105 |
echo '</select>';
|
| 109 |
break;
|
| 110 |
|
| 111 |
case 'textarea':
|
|
|
|
| 112 |
echo '
|
| 113 |
<div class="input-box">
|
| 114 |
<textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getCustomer()->$func()) .'</textarea>
|
| 116 |
break;
|
| 117 |
|
| 118 |
case 'multiselect':
|
|
|
|
| 119 |
echo '
|
| 120 |
<div class="input-box">';
|
| 121 |
+
|
| 122 |
+
$multi_values = explode(',', $this->htmlEscape($this->getCustomer()->$func()));
|
| 123 |
+
|
| 124 |
+
echo '<select name="'. $attr['attribute_code'] .'[]" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 125 |
+
|
| 126 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 127 |
+
echo '<option value="'.$instance['value'].'" '. (in_array($instance['value'], $multi_values) ? 'selected="selected"' : '') .'>' . $instance['label'] . '</option>';
|
| 128 |
}
|
| 129 |
echo '</select>';
|
| 130 |
break;
|
| 133 |
$date_element = new Varien_Data_Form_Element_Date();
|
| 134 |
$date_element->setValue($this->htmlEscape($this->getCustomer()->$func()));
|
| 135 |
|
|
|
|
| 136 |
echo '
|
| 137 |
<div class="input-box">
|
| 138 |
<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;" />
|
app/design/frontend/default/default/template/{customer → attributemanager/customer}/form/register.phtml
RENAMED
|
@@ -72,18 +72,23 @@
|
|
| 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->__( $
|
| 87 |
switch($attr['frontend_input']) {
|
| 88 |
case 'text':
|
| 89 |
echo '
|
|
@@ -96,7 +101,7 @@
|
|
| 96 |
echo '
|
| 97 |
<div class="input-box">';
|
| 98 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 99 |
-
foreach ($attribute->getSource()->getAllOptions(
|
| 100 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 101 |
}
|
| 102 |
echo '</select>';
|
|
@@ -115,9 +120,12 @@
|
|
| 115 |
case 'multiselect':
|
| 116 |
echo '
|
| 117 |
<div class="input-box">';
|
| 118 |
-
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
| 121 |
}
|
| 122 |
echo '</select>';
|
| 123 |
break;
|
| 72 |
->addVisibleFilter()
|
| 73 |
->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
|
| 74 |
|
| 75 |
+
$store_id = Mage::app()->getStore()->getId();
|
| 76 |
+
|
| 77 |
foreach($collection as $attribute) {
|
| 78 |
$attr = $attribute->toArray();
|
| 79 |
|
| 80 |
if($attr['is_required'])
|
| 81 |
$var_attrs[] = $attr['attribute_code'];
|
| 82 |
|
| 83 |
+
$store_labels = $attribute->getStoreLabels();
|
| 84 |
+
$label = $store_labels[$store_id] ? $store_labels[$store_id] : $attr['frontend_label'];
|
| 85 |
+
|
| 86 |
echo '<li>';
|
| 87 |
$func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
|
| 88 |
|
| 89 |
//call_user_func(array(get_class($this->getFormData()), $func));
|
| 90 |
|
| 91 |
+
echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $label ) . '</label>';
|
| 92 |
switch($attr['frontend_input']) {
|
| 93 |
case 'text':
|
| 94 |
echo '
|
| 101 |
echo '
|
| 102 |
<div class="input-box">';
|
| 103 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 104 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 105 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 106 |
}
|
| 107 |
echo '</select>';
|
| 120 |
case 'multiselect':
|
| 121 |
echo '
|
| 122 |
<div class="input-box">';
|
| 123 |
+
echo '<select name="'. $attr['attribute_code'] .'[]" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 124 |
+
|
| 125 |
+
$multi_values = explode(',', $this->htmlEscape($this->getFormData()->$func()));
|
| 126 |
+
|
| 127 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 128 |
+
echo '<option value="'.$instance['value'].'" '. (in_array($instance['value'], $multi_values) ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 129 |
}
|
| 130 |
echo '</select>';
|
| 131 |
break;
|
app/design/frontend/default/default/template/{persistent → attributemanager/persistent}/customer/form/edit.phtml
RENAMED
|
@@ -72,24 +72,28 @@
|
|
| 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()) .'" />
|
|
@@ -97,11 +101,10 @@
|
|
| 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(
|
| 105 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 106 |
}
|
| 107 |
echo '</select>';
|
|
@@ -111,7 +114,6 @@
|
|
| 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>
|
|
@@ -119,12 +121,13 @@
|
|
| 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 |
-
|
| 127 |
-
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
echo '</select>';
|
| 130 |
break;
|
|
@@ -133,7 +136,6 @@
|
|
| 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;" />
|
|
@@ -151,7 +153,7 @@
|
|
| 151 |
</div>';
|
| 152 |
break;
|
| 153 |
}
|
| 154 |
-
|
| 155 |
echo '
|
| 156 |
</li>';
|
| 157 |
}
|
| 72 |
->addVisibleFilter()
|
| 73 |
->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
|
| 74 |
|
| 75 |
+
$store_id = Mage::app()->getStore()->getId();
|
| 76 |
+
|
| 77 |
foreach($collection as $attribute) {
|
| 78 |
//echo get_class($attribute) . '<br />';
|
| 79 |
//echo '<pre>';
|
| 80 |
//print_r( get_class_methods( get_class( $attribute ) ) );
|
| 81 |
$attr = $attribute->toArray();
|
| 82 |
|
|
|
|
| 83 |
if($attr['is_required'])
|
| 84 |
$var_attrs[] = $attr['attribute_code'];
|
| 85 |
|
| 86 |
+
$store_labels = $attribute->getStoreLabels();
|
| 87 |
+
$label = $store_labels[$store_id] ? $store_labels[$store_id] : $attr['frontend_label'];
|
| 88 |
+
|
| 89 |
echo '<li>';
|
| 90 |
$func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
|
| 91 |
|
| 92 |
//call_user_func(array(get_class($this->getFormData()), $func));
|
| 93 |
|
| 94 |
+
echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $label ) . '</label>';
|
| 95 |
switch($attr['frontend_input']) {
|
| 96 |
case 'text':
|
|
|
|
| 97 |
echo '
|
| 98 |
<div class="input-box">
|
| 99 |
<input type="text" name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" value="'. $this->htmlEscape($this->getCustomer()->$func()) .'" />
|
| 101 |
break;
|
| 102 |
|
| 103 |
case 'select':
|
|
|
|
| 104 |
echo '
|
| 105 |
<div class="input-box">';
|
| 106 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 107 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 108 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getCustomer()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 109 |
}
|
| 110 |
echo '</select>';
|
| 114 |
break;
|
| 115 |
|
| 116 |
case 'textarea':
|
|
|
|
| 117 |
echo '
|
| 118 |
<div class="input-box">
|
| 119 |
<textarea name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >'. $this->htmlEscape($this->getCustomer()->$func()) .'</textarea>
|
| 121 |
break;
|
| 122 |
|
| 123 |
case 'multiselect':
|
|
|
|
| 124 |
echo '
|
| 125 |
<div class="input-box">';
|
| 126 |
+
echo '<select name="'. $attr['attribute_code'] .'[]" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 127 |
+
|
| 128 |
+
$multi_values = explode(',', $this->htmlEscape($this->getCustomer()->$func()));
|
| 129 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 130 |
+
echo '<option value="'.$instance['value'].'" '. (in_array($instance['value'], $multi_values) ? 'selected="selected"' : '') .'>' . $instance['label'] . '</option>';
|
| 131 |
}
|
| 132 |
echo '</select>';
|
| 133 |
break;
|
| 136 |
$date_element = new Varien_Data_Form_Element_Date();
|
| 137 |
$date_element->setValue($this->htmlEscape($this->getCustomer()->$func()));
|
| 138 |
|
|
|
|
| 139 |
echo '
|
| 140 |
<div class="input-box">
|
| 141 |
<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;" />
|
| 153 |
</div>';
|
| 154 |
break;
|
| 155 |
}
|
| 156 |
+
|
| 157 |
echo '
|
| 158 |
</li>';
|
| 159 |
}
|
app/design/frontend/default/default/template/{persistent → attributemanager/persistent}/customer/form/register.phtml
RENAMED
|
@@ -72,17 +72,22 @@
|
|
| 72 |
->addVisibleFilter()
|
| 73 |
->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
|
| 74 |
|
| 75 |
-
|
|
|
|
|
|
|
| 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->__( $
|
| 86 |
switch($attr['frontend_input']) {
|
| 87 |
case 'text':
|
| 88 |
echo '
|
|
@@ -95,7 +100,7 @@
|
|
| 95 |
echo '
|
| 96 |
<div class="input-box">';
|
| 97 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 98 |
-
foreach ($attribute->getSource()->getAllOptions(
|
| 99 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 100 |
}
|
| 101 |
echo '</select>';
|
|
@@ -114,9 +119,12 @@
|
|
| 114 |
case 'multiselect':
|
| 115 |
echo '
|
| 116 |
<div class="input-box">';
|
| 117 |
-
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
echo '</select>';
|
| 122 |
break;
|
| 72 |
->addVisibleFilter()
|
| 73 |
->addFilter('is_user_defined', 1)->setOrder('sort_order', 'ASC');
|
| 74 |
|
| 75 |
+
$store_id = Mage::app()->getStore()->getId();
|
| 76 |
+
|
| 77 |
+
foreach($collection as $attribute) {
|
| 78 |
$attr = $attribute->toArray();
|
| 79 |
|
| 80 |
if($attr['is_required'])
|
| 81 |
$var_attrs[] = $attr['attribute_code'];
|
| 82 |
|
| 83 |
+
$store_labels = $attribute->getStoreLabels();
|
| 84 |
+
$label = $store_labels[$store_id] ? $store_labels[$store_id] : $attr['frontend_label'];
|
| 85 |
+
|
| 86 |
echo '<li>';
|
| 87 |
$func = 'get'. str_replace(' ', '', ucwords(str_replace('_', ' ', $attr['attribute_code'])) );
|
| 88 |
|
| 89 |
//call_user_func(array(get_class($this->getFormData()), $func));
|
| 90 |
+
echo '<label for="'. $attr['attribute_code'] .'" '. ($attr['is_required']?'class="required"><em>*</em>':'>') . $this->__( $label ) . '</label>';
|
| 91 |
switch($attr['frontend_input']) {
|
| 92 |
case 'text':
|
| 93 |
echo '
|
| 100 |
echo '
|
| 101 |
<div class="input-box">';
|
| 102 |
echo '<select name="'. $attr['attribute_code'] .'" id="'. $attr['attribute_code'] .'" >';
|
| 103 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 104 |
echo '<option value="'.$instance['value'].'" '. ($this->htmlEscape($this->getFormData()->$func()) == $instance['value'] ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 105 |
}
|
| 106 |
echo '</select>';
|
| 119 |
case 'multiselect':
|
| 120 |
echo '
|
| 121 |
<div class="input-box">';
|
| 122 |
+
echo '<select name="'. $attr['attribute_code'] .'[]" id="'. $attr['attribute_code'] .'" multiple="multiple" >';
|
| 123 |
+
|
| 124 |
+
$multi_values = explode(',', $this->htmlEscape($this->getFormData()->$func()));
|
| 125 |
+
|
| 126 |
+
foreach ($attribute->getSource()->getAllOptions((!$attr['is_required']), false) as $instance) {
|
| 127 |
+
echo '<option value="'.$instance['value'].'" '. (in_array($instance['value'], $multi_values) ? 'selected' : '') .'>' . $instance['label'] . '</option>';
|
| 128 |
}
|
| 129 |
echo '</select>';
|
| 130 |
break;
|
package.xml
CHANGED
|
@@ -1,22 +1,27 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Custom_Attributemanager</name>
|
| 4 |
-
<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
|
| 10 |
-
<description>Create and manage attributes of customers.
|
| 11 |
-
<br>
|
| 12 |
-
An admin interface to create/manage customer attributes. 
|
| 13 |
-
<br>
|
| 14 |
Frontend register and account edit pages will automatically reflect attributes.</description>
|
| 15 |
-
<notes>Manage customer attributes and collect more information from customers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<authors><author><name>Ankit</name><user>auto-converted</user><email>ankitce9@gmail.com</email></author></authors>
|
| 17 |
-
<date>2013-
|
| 18 |
-
<time>
|
| 19 |
-
<contents><target name="magecommunity"><dir name="Custom"><dir name="Attributemanager"><dir name="Block"><dir name="
|
| 20 |
<compatible/>
|
| 21 |
<dependencies/>
|
| 22 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Custom_Attributemanager</name>
|
| 4 |
+
<version>1.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.

|
| 11 |
+
<br>

|
| 12 |
+
An admin interface to create/manage customer attributes. 

|
| 13 |
+
<br>

|
| 14 |
Frontend register and account edit pages will automatically reflect attributes.</description>
|
| 15 |
+
<notes>Manage customer attributes and collect more information from customers.
|
| 16 |
+
<br>
|
| 17 |
+
Create fields for
|
| 18 |
+
- Registration form
|
| 19 |
+
- Account edit form
|
| 20 |
+
- Admin -> customer account information form</notes>
|
| 21 |
<authors><author><name>Ankit</name><user>auto-converted</user><email>ankitce9@gmail.com</email></author></authors>
|
| 22 |
+
<date>2013-06-28</date>
|
| 23 |
+
<time>11:32:20</time>
|
| 24 |
+
<contents><target name="magecommunity"><dir name="Custom"><dir name="Attributemanager"><dir name="Block"><dir name="Edit"><dir name="Tab"><file name="Front.php" hash="2c99f0056100d663694e918655ba1a6e"/><file name="Main.php" hash="e54f6c7e1e963108b3879add105615af"/><file name="Options.php" hash="0cf9bb8dd3fc7a5a7ef61af260d206f1"/><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="fea2517def42ad42604cd45c9a03a3bf"/></dir><dir name="etc"><file name="config.xml" hash="e9e0cc9ec8d6d3f8e3bb87e00341484d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="attributemanager"><dir name="customer"><dir name="form"><file name="edit.phtml" hash="edf5ade055e29e2a7132e2cd8e70fd92"/><file name="register.phtml" hash="3f6773f6e6c4b9a5cdbcdf7fefcaccda"/></dir></dir><dir name="persistent"><dir name="customer"><dir name="form"><file name="edit.phtml" hash="019fceb526338efea9280f191db6de14"/><file name="register.phtml" hash="190b79a8e917a03c3a2505f46855c582"/></dir></dir></dir></dir></dir><dir name="layout"><file name="attributemanager.xml" hash="849a3fa1c10129370600da32ddd8e7e3"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><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="9b11cf8e72e7675c8edf8c6028c19467"/></dir></dir><dir name="layout"><file name="attributemanager.xml" hash="9def95e84fc5df62f16f45d112ba7029"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Custom_Attributemanager.xml" hash="138221f47562aaeca52becccadbc99d9"/></dir></target></contents>
|
| 25 |
<compatible/>
|
| 26 |
<dependencies/>
|
| 27 |
</package>
|
