-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI to edit "Customer Attributes" and "Customer Address Attributes" #2260
Conversation
I have a similar custom extension, including the Manage Attribute Sets for organizing the attributes for different customer groups. |
For a long time I have not seen pieces of code that bring new features. Unfortunately, editing Customer Attributes and Customer Address Attributes were missing from Magento and I appreciate that you came up sharing the code. |
|
||
if (!empty($data['option']) && !empty($data['option']['value']) && is_array($data['option']['value'])) { | ||
$allowableTags = isset($data['is_html_allowed_on_front']) && $data['is_html_allowed_on_front'] | ||
? sprintf('<%s>', implode('><', $this->_getAllowedTags())) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_getAllowedTags
is missing in this controller:
/**
* Get list of allowed text formatted as array
*
* @return array
*/
protected function _getAllowedTags()
{
return explode(',', Mage::getStoreConfig(self::XML_PATH_ALLOWED_TAGS));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I've added the method, but it uses a constant that's const XML_PATH_ALLOWED_TAGS = 'system/catalog/frontend/allowed_html_tags_list';
so what should we do with that? change it to system/customer/frontend/allowed_html_tags_list
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'm not sure if we ever need that for the customer attributes, I don't think any of them allow html. I'll have to look into that.
app/code/core/Mage/Adminhtml/controllers/Customer/AttributeController.php
Show resolved
Hide resolved
app/code/core/Mage/Adminhtml/controllers/Customer/AttributeController.php
Show resolved
Hide resolved
setRowVisibility('frontend_class', false); | ||
break; | ||
|
||
<?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method reads a value with key attribute_type_hidden_fields
from registry, but from what I see it's not set anywhere in customer pages.
setRowVisibility('frontend_class', false); | ||
break; | ||
|
||
<?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before.
app/code/core/Mage/Adminhtml/controllers/Customer/AttributeController.php
Outdated
Show resolved
Hide resolved
$fieldset = $form->addFieldset('front_fieldset', [ | ||
'legend' => $helper->__('Frontend Properties') | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also add is_visible
field to be editable here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this missing feature. I will test it at production level and deploy it!
|
||
parent::__construct(); | ||
|
||
if($this->getRequest()->getParam('popup')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have forgotten a space.
$this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save Attribute')); | ||
$this->_updateButton('save', 'onclick', 'saveAttribute()'); | ||
|
||
if (! Mage::registry('entity_attribute')->getIsUserDefined()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have added a extra space.
@@ -0,0 +1,12 @@ | |||
<?php | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have forgotten the copy comment (you have added it elsewhere).
@@ -0,0 +1,71 @@ | |||
<?php | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have forgotten the copy comment (you have added it elsewhere).
Why was this PR closed? |
because there's the new one from @justinbeaty |
Since the beginning of time we always had to rely on commercial modules (or developers) to add/edit/delete "customer attributes" or "customer address attributes". This PR aims to fix this and give the users the power to manage "customer attributes" the same way they do with "product attributes".
This feature was developed mostly using the code of the "product attributes" edit feature, that's why I've copied the license in the file header.
It's a big PR so suggestions/fixes/additions are welcome.
Manual testing scenarios (*)
Screenshots
The new menus
Customer attributes grid
Add/Edit customer attribute
For customer address it's the same thing so I'll not post screenshots of that.