Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7441015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:56:32+00:00 2026-05-29T10:56:32+00:00

I created a new attribute (multiple select) with some values, everything works fine but

  • 0

I created a new attribute (multiple select) with some values, everything works fine but when I want to delete all the selected values for a product, I get the message “The product attribute has been saved.” but the values are still selected.

Notes:

  • I press Ctrl + Click to unselect the last value before I save.
  • I set the parameter Value Required of my attribute to No
  • If I save a product without any value selected yet, then no values get selected
  • My Indexes are properly refreshed
  • See below two screens, on the left the parameters of my attribute and on the right my multiple select.

enter image description here

I’m running out of ideas so thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:56:33+00:00Added an answer on May 29, 2026 at 10:56 am

    This is a known (annoying) behaviour of the Magento Adminhtml forms.
    The problem is that if no value is selected for the multiselect, no value for that attribute is posted when the form is submitted.

    On the server side Magento then loads the model, sets all the posted attribute values on the model and saves it.
    Because no value was posted the original value that was loaded on the model wasn’t updated.

    As a solution for attributes with a custom source model I tend to provide an empty option with a special option value (e.g. -1). That value must not be 0 or an empty string.

    Then I specify a backend model for that attribute that checks for that special value in the _beforeSave() method. If it is found the backend model unsets the attribute on the model instance.

    Here is an example:

    Source Model:

    class Your_Module_Model_Entity_Attribute_Source_Example
        extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
    {
        const EMPTY = '-1';
    
        public function getAllOptions()
            $options = array(
                array('value' => 1, 'label' => 'One'),
                array('value' => 2, 'label' => 'Two'),
                array('value' => 3, 'label' => 'Three')
            );
            if ($this->getAttribute()->getFrontendInput() === 'multiselect')
            {
                array_unshift($options, array('value' => self::EMPTY, 'label' => ''));
            }
            return $options;
        }
    }
    

    Backend Model:

    class Your_Module_Model_Entity_Attribute_Backend_Example
        extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
    {
        public function beforeSave($object)
        {
            $code = $this->getAttribute()->getAttributeCode();
            $value = $object->getData($code);
            if ($value == Your_Module_Model_Entity_Attribute_Source_Example::EMPTY)
            {
                $object->unsetData($code);
            }
            return parent::beforeSave($object);
        }
    }
    

    If you find a better workaround please let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a simple custom attribute on the sales/order entity. Now, for new orders,
I've created new db via phpMyAdmin and while editing db privilages clicked delete localhost
In python, it is illegal to create new attribute for an object instance like
I created a new SharePoint portal for testing purposes using a manually added HOSTS
I created a new email box for general support questions. When I try to
I created a new HalloWorld Makefile Project. There is a HalloWorld.cpp with my main
I created a new ASP.NET MVC application. The home page looks like this: I
I created a new project with the following code segment: char* strange = (Strange??);
I created a new Visual Studio Setup project with VS 2008. I use it
I created a new View (LogView) in Infrastructure.Module project. This view will be used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.