Skip to content
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

Closed
wants to merge 17 commits into from
Closed

GUI to edit "Customer Attributes" and "Customer Address Attributes" #2260

wants to merge 17 commits into from

Conversation

fballiano
Copy link
Contributor

@fballiano fballiano commented Jun 28, 2022

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 (*)

  1. open the backend
  2. open the menu "Customers -> Attributes"
  3. Use the two new masks to add, edit or delete customer attributes or customer address attributes

Screenshots

The new menus
Schermata 2022-06-28 alle 23 50 12

Customer attributes grid
Schermata 2022-06-28 alle 23 51 34

Add/Edit customer attribute
Schermata 2022-06-28 alle 23 52 02

For customer address it's the same thing so I'll not post screenshots of that.

@github-actions github-actions bot added Component: Adminhtml Relates to Mage_Adminhtml Component: Customer Relates to Mage_Customer Template : admin Relates to admin template labels Jun 28, 2022
@kiatng
Copy link
Contributor

kiatng commented Jun 29, 2022

I have a similar custom extension, including the Manage Attribute Sets for organizing the attributes for different customer groups.

@addison74
Copy link
Contributor

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;
Copy link
Member

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));
}

Copy link
Contributor Author

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?

Copy link
Member

@elidrissidev elidrissidev Jul 4, 2022

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.

setRowVisibility('frontend_class', false);
break;

<?php foreach (Mage::helper('catalog')->getAttributeHiddenFields() as $type=>$fields): ?>
Copy link
Member

@elidrissidev elidrissidev Jul 4, 2022

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): ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before.

Comment on lines +16 to +18
$fieldset = $form->addFieldset('front_fieldset', [
'legend' => $helper->__('Frontend Properties')
]);
Copy link
Member

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

@github-actions github-actions bot added the translations Relates to app/locale label Jul 4, 2022
Copy link
Contributor

@luigifab luigifab left a 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')) {
Copy link
Contributor

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()) {
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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).

@elidrissidev
Copy link
Member

Why was this PR closed?

@fballiano
Copy link
Contributor Author

because there's the new one from @justinbeaty

@fballiano fballiano deleted the customer_attributes branch August 4, 2022 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml Component: Customer Relates to Mage_Customer Template : admin Relates to admin template translations Relates to app/locale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants