Update is_required for Existing Attribute CodeRemove last name in billing address?Avoid invalidating product...

A curious equality of integrals involving the prime counting function?

What does it mean for a caliber to be flat shooting?

Dilemma of explaining to interviewer that he is the reason for declining second interview

Does Skippy chunky peanut butter contain trans fat?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act (2019 S.130)?

SET NOCOUNT Error in handling SQL call after upgrade

Is there a Linux system call to create a “view” of a range of a file?

How would an AI self awareness kill switch work?

How can I get my players to come to the game session after agreeing to a date?

Should I reinstall Linux when changing the laptop's CPU?

How does Leonard in "Memento" remember reading and writing?

Play Zip, Zap, Zop

What are the exceptions to Natural Selection?

Salesforce package error error “You can't specify version for namespace sf_com_apps because this namespace is not installed to your organization.”

Gear reduction on large turbofans

Non-Cancer terminal illness that can affect young (age 10-13) girls?

How can my powered armor quickly replace its ceramic plates?

Do authors have to be politically correct in article-writing?

Citing paywalled articles accessed via illegal web sharing

What are "industrial chops"?

It took me a lot of time to make this, pls like. (YouTube Comments #1)

Why did the villain in the first Men in Black movie care about Earth's Cockroaches?

Am I a Rude Number?

What is the purpose of easy combat scenarios that don't need resource expenditure?



Update is_required for Existing Attribute Code


Remove last name in billing address?Avoid invalidating product flat table reindexing upon product attribute value saveFailed to Load Node From ConfigHow get existing attribute groups?Switching attribute code for two attributesUpdate date attribute for all productsMagento 2 : Upgrade Existing Custom Customer AttributeScript update attribute for all productsHow to update the attribute type in Magento 2?Unable to update custom product attribute value programaticallyLayered Navigation: Create Attribute Options for Drop Down During New Product Import













7















I am thinking to update is_required data to "1" for existing "Region" attribute code.



select * From eav_attribute where attribute_id = '28'


However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.










share|improve this question

























  • Which region attribute? for order or address?

    – Bijal Bhavsar
    Jan 24 '14 at 10:43











  • for order and address =)

    – Leongelis
    Jan 27 '14 at 3:24











  • ok I have already added code in below answer :)

    – Bijal Bhavsar
    Jan 28 '14 at 5:53
















7















I am thinking to update is_required data to "1" for existing "Region" attribute code.



select * From eav_attribute where attribute_id = '28'


However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.










share|improve this question

























  • Which region attribute? for order or address?

    – Bijal Bhavsar
    Jan 24 '14 at 10:43











  • for order and address =)

    – Leongelis
    Jan 27 '14 at 3:24











  • ok I have already added code in below answer :)

    – Bijal Bhavsar
    Jan 28 '14 at 5:53














7












7








7


3






I am thinking to update is_required data to "1" for existing "Region" attribute code.



select * From eav_attribute where attribute_id = '28'


However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.










share|improve this question
















I am thinking to update is_required data to "1" for existing "Region" attribute code.



select * From eav_attribute where attribute_id = '28'


However, I am wondering what is the practice here. Is it simply creating SQL statement and update that specific record in setup script fine? Or perhaps there may be a better way.







attributes upgrade






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 10 mins ago









Teja Bhagavan Kollepara

2,96341847




2,96341847










asked Jan 24 '14 at 10:21









LeongelisLeongelis

370721




370721













  • Which region attribute? for order or address?

    – Bijal Bhavsar
    Jan 24 '14 at 10:43











  • for order and address =)

    – Leongelis
    Jan 27 '14 at 3:24











  • ok I have already added code in below answer :)

    – Bijal Bhavsar
    Jan 28 '14 at 5:53



















  • Which region attribute? for order or address?

    – Bijal Bhavsar
    Jan 24 '14 at 10:43











  • for order and address =)

    – Leongelis
    Jan 27 '14 at 3:24











  • ok I have already added code in below answer :)

    – Bijal Bhavsar
    Jan 28 '14 at 5:53

















Which region attribute? for order or address?

– Bijal Bhavsar
Jan 24 '14 at 10:43





Which region attribute? for order or address?

– Bijal Bhavsar
Jan 24 '14 at 10:43













for order and address =)

– Leongelis
Jan 27 '14 at 3:24





for order and address =)

– Leongelis
Jan 27 '14 at 3:24













ok I have already added code in below answer :)

– Bijal Bhavsar
Jan 28 '14 at 5:53





ok I have already added code in below answer :)

– Bijal Bhavsar
Jan 28 '14 at 5:53










6 Answers
6






active

oldest

votes


















10














Create sql script to update region attribute



$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', true);

/*** Update order address attributes*/
$installer->updateAttribute('order_address', 'region', 'is_required', true);
$installer->endSetup();


I hope above code will help






share|improve this answer


























  • Can you please explain it in deep with example.

    – Ami Kamboj
    Jun 20 '14 at 10:13



















4














I am writing this updates is simply sharing my research and hope could help someone out there.



config.xml



<config>
<modules>
<Package_Module>
<version>0.0.2</version>
</Package_Module>
</modules>
<global>
<resources>
<module_setup>
<setup>
<module>Package_Module</module>
<!--
Create a Switchable Installer Script
This class is incredibly handy in case you need different setup classes
-->
<class>Package_Module_Model_Resource_Setup</class>
</setup>
</module_setup>
</resources>
</global>
<config>


Custom Setup Class: Package_Module_Model_Resource_Setup



class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
public function getCatalogResourceSetup()
{
return new Mage_Catalog_Model_Resource_Setup('module_setup');
}
public function getCustomerResourceSetup()
{
return new Mage_Customer_Model_Resource_Setup('module_setup');
}
public function getCustomerEntitySetup()
{
return new Mage_Customer_Model_Entity_Setup('module_setup');
}
}


Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php



<?php
/* @var $installer Package_Module_Model_Resource_Setup */
$installer = $this->getCustomerEntitySetup();

$installer->startSetup();
/*** Update customer address attributes*/
$installer->updateAttribute('customer_address', 'region', 'is_required', 1);

$installer->endSetup();


Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net






share|improve this answer































    0














    Create sql update script and run updateAttribute function.



    $installer = $this;
    $installer->startSetup();
    $installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
    $installer->endSetup();


    With this function you can update any attribute's property.






    share|improve this answer

































      0














      I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.

      $installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);






      share|improve this answer































        0














        Below code will update attribute using sql script



        $installer = $this;
        $this->updateAttribute('customer_address', 'region', 'is_required' ,1);





        share|improve this answer































          0














          you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f13775%2fupdate-is-required-for-existing-attribute-code%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            6 Answers
            6






            active

            oldest

            votes








            6 Answers
            6






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            10














            Create sql script to update region attribute



            $installer->startSetup();
            /*** Update customer address attributes*/
            $installer->updateAttribute('customer_address', 'region', 'is_required', true);

            /*** Update order address attributes*/
            $installer->updateAttribute('order_address', 'region', 'is_required', true);
            $installer->endSetup();


            I hope above code will help






            share|improve this answer


























            • Can you please explain it in deep with example.

              – Ami Kamboj
              Jun 20 '14 at 10:13
















            10














            Create sql script to update region attribute



            $installer->startSetup();
            /*** Update customer address attributes*/
            $installer->updateAttribute('customer_address', 'region', 'is_required', true);

            /*** Update order address attributes*/
            $installer->updateAttribute('order_address', 'region', 'is_required', true);
            $installer->endSetup();


            I hope above code will help






            share|improve this answer


























            • Can you please explain it in deep with example.

              – Ami Kamboj
              Jun 20 '14 at 10:13














            10












            10








            10







            Create sql script to update region attribute



            $installer->startSetup();
            /*** Update customer address attributes*/
            $installer->updateAttribute('customer_address', 'region', 'is_required', true);

            /*** Update order address attributes*/
            $installer->updateAttribute('order_address', 'region', 'is_required', true);
            $installer->endSetup();


            I hope above code will help






            share|improve this answer















            Create sql script to update region attribute



            $installer->startSetup();
            /*** Update customer address attributes*/
            $installer->updateAttribute('customer_address', 'region', 'is_required', true);

            /*** Update order address attributes*/
            $installer->updateAttribute('order_address', 'region', 'is_required', true);
            $installer->endSetup();


            I hope above code will help







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 7 '18 at 16:04









            Michael Poppinger

            1035




            1035










            answered Jan 24 '14 at 11:01









            Bijal BhavsarBijal Bhavsar

            1,133926




            1,133926













            • Can you please explain it in deep with example.

              – Ami Kamboj
              Jun 20 '14 at 10:13



















            • Can you please explain it in deep with example.

              – Ami Kamboj
              Jun 20 '14 at 10:13

















            Can you please explain it in deep with example.

            – Ami Kamboj
            Jun 20 '14 at 10:13





            Can you please explain it in deep with example.

            – Ami Kamboj
            Jun 20 '14 at 10:13













            4














            I am writing this updates is simply sharing my research and hope could help someone out there.



            config.xml



            <config>
            <modules>
            <Package_Module>
            <version>0.0.2</version>
            </Package_Module>
            </modules>
            <global>
            <resources>
            <module_setup>
            <setup>
            <module>Package_Module</module>
            <!--
            Create a Switchable Installer Script
            This class is incredibly handy in case you need different setup classes
            -->
            <class>Package_Module_Model_Resource_Setup</class>
            </setup>
            </module_setup>
            </resources>
            </global>
            <config>


            Custom Setup Class: Package_Module_Model_Resource_Setup



            class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
            {
            public function getCatalogResourceSetup()
            {
            return new Mage_Catalog_Model_Resource_Setup('module_setup');
            }
            public function getCustomerResourceSetup()
            {
            return new Mage_Customer_Model_Resource_Setup('module_setup');
            }
            public function getCustomerEntitySetup()
            {
            return new Mage_Customer_Model_Entity_Setup('module_setup');
            }
            }


            Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php



            <?php
            /* @var $installer Package_Module_Model_Resource_Setup */
            $installer = $this->getCustomerEntitySetup();

            $installer->startSetup();
            /*** Update customer address attributes*/
            $installer->updateAttribute('customer_address', 'region', 'is_required', 1);

            $installer->endSetup();


            Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net






            share|improve this answer




























              4














              I am writing this updates is simply sharing my research and hope could help someone out there.



              config.xml



              <config>
              <modules>
              <Package_Module>
              <version>0.0.2</version>
              </Package_Module>
              </modules>
              <global>
              <resources>
              <module_setup>
              <setup>
              <module>Package_Module</module>
              <!--
              Create a Switchable Installer Script
              This class is incredibly handy in case you need different setup classes
              -->
              <class>Package_Module_Model_Resource_Setup</class>
              </setup>
              </module_setup>
              </resources>
              </global>
              <config>


              Custom Setup Class: Package_Module_Model_Resource_Setup



              class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
              {
              public function getCatalogResourceSetup()
              {
              return new Mage_Catalog_Model_Resource_Setup('module_setup');
              }
              public function getCustomerResourceSetup()
              {
              return new Mage_Customer_Model_Resource_Setup('module_setup');
              }
              public function getCustomerEntitySetup()
              {
              return new Mage_Customer_Model_Entity_Setup('module_setup');
              }
              }


              Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php



              <?php
              /* @var $installer Package_Module_Model_Resource_Setup */
              $installer = $this->getCustomerEntitySetup();

              $installer->startSetup();
              /*** Update customer address attributes*/
              $installer->updateAttribute('customer_address', 'region', 'is_required', 1);

              $installer->endSetup();


              Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net






              share|improve this answer


























                4












                4








                4







                I am writing this updates is simply sharing my research and hope could help someone out there.



                config.xml



                <config>
                <modules>
                <Package_Module>
                <version>0.0.2</version>
                </Package_Module>
                </modules>
                <global>
                <resources>
                <module_setup>
                <setup>
                <module>Package_Module</module>
                <!--
                Create a Switchable Installer Script
                This class is incredibly handy in case you need different setup classes
                -->
                <class>Package_Module_Model_Resource_Setup</class>
                </setup>
                </module_setup>
                </resources>
                </global>
                <config>


                Custom Setup Class: Package_Module_Model_Resource_Setup



                class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
                {
                public function getCatalogResourceSetup()
                {
                return new Mage_Catalog_Model_Resource_Setup('module_setup');
                }
                public function getCustomerResourceSetup()
                {
                return new Mage_Customer_Model_Resource_Setup('module_setup');
                }
                public function getCustomerEntitySetup()
                {
                return new Mage_Customer_Model_Entity_Setup('module_setup');
                }
                }


                Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php



                <?php
                /* @var $installer Package_Module_Model_Resource_Setup */
                $installer = $this->getCustomerEntitySetup();

                $installer->startSetup();
                /*** Update customer address attributes*/
                $installer->updateAttribute('customer_address', 'region', 'is_required', 1);

                $installer->endSetup();


                Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net






                share|improve this answer













                I am writing this updates is simply sharing my research and hope could help someone out there.



                config.xml



                <config>
                <modules>
                <Package_Module>
                <version>0.0.2</version>
                </Package_Module>
                </modules>
                <global>
                <resources>
                <module_setup>
                <setup>
                <module>Package_Module</module>
                <!--
                Create a Switchable Installer Script
                This class is incredibly handy in case you need different setup classes
                -->
                <class>Package_Module_Model_Resource_Setup</class>
                </setup>
                </module_setup>
                </resources>
                </global>
                <config>


                Custom Setup Class: Package_Module_Model_Resource_Setup



                class Package_Module_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
                {
                public function getCatalogResourceSetup()
                {
                return new Mage_Catalog_Model_Resource_Setup('module_setup');
                }
                public function getCustomerResourceSetup()
                {
                return new Mage_Customer_Model_Resource_Setup('module_setup');
                }
                public function getCustomerEntitySetup()
                {
                return new Mage_Customer_Model_Entity_Setup('module_setup');
                }
                }


                Upgrade Script: mysql4-upgrade-0.0.1-0.0.2.php



                <?php
                /* @var $installer Package_Module_Model_Resource_Setup */
                $installer = $this->getCustomerEntitySetup();

                $installer->startSetup();
                /*** Update customer address attributes*/
                $installer->updateAttribute('customer_address', 'region', 'is_required', 1);

                $installer->endSetup();


                Hereby a great article that shared about 'Switchable Installer Script'. Source link: inchoo.net







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 26 '14 at 2:31









                LeongelisLeongelis

                370721




                370721























                    0














                    Create sql update script and run updateAttribute function.



                    $installer = $this;
                    $installer->startSetup();
                    $installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
                    $installer->endSetup();


                    With this function you can update any attribute's property.






                    share|improve this answer






























                      0














                      Create sql update script and run updateAttribute function.



                      $installer = $this;
                      $installer->startSetup();
                      $installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
                      $installer->endSetup();


                      With this function you can update any attribute's property.






                      share|improve this answer




























                        0












                        0








                        0







                        Create sql update script and run updateAttribute function.



                        $installer = $this;
                        $installer->startSetup();
                        $installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
                        $installer->endSetup();


                        With this function you can update any attribute's property.






                        share|improve this answer















                        Create sql update script and run updateAttribute function.



                        $installer = $this;
                        $installer->startSetup();
                        $installer->updateAttribute('entity_type', 'your_attribute_id', 'required', 1);
                        $installer->endSetup();


                        With this function you can update any attribute's property.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Jan 24 '14 at 11:09

























                        answered Jan 24 '14 at 10:49









                        oleksii.svarychevskyioleksii.svarychevskyi

                        4,80111022




                        4,80111022























                            0














                            I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.

                            $installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);






                            share|improve this answer




























                              0














                              I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.

                              $installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);






                              share|improve this answer


























                                0












                                0








                                0







                                I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.

                                $installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);






                                share|improve this answer













                                I was trying some scripts found, but the attribute still was required. The correct parameter is 'is_required' and not 'required'.

                                $installer->updateAttribute('entity_type', 'your_attribute_id', 'is_required', 1);







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 26 '14 at 17:51









                                Antonio PediciniAntonio Pedicini

                                5981029




                                5981029























                                    0














                                    Below code will update attribute using sql script



                                    $installer = $this;
                                    $this->updateAttribute('customer_address', 'region', 'is_required' ,1);





                                    share|improve this answer




























                                      0














                                      Below code will update attribute using sql script



                                      $installer = $this;
                                      $this->updateAttribute('customer_address', 'region', 'is_required' ,1);





                                      share|improve this answer


























                                        0












                                        0








                                        0







                                        Below code will update attribute using sql script



                                        $installer = $this;
                                        $this->updateAttribute('customer_address', 'region', 'is_required' ,1);





                                        share|improve this answer













                                        Below code will update attribute using sql script



                                        $installer = $this;
                                        $this->updateAttribute('customer_address', 'region', 'is_required' ,1);






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Mar 11 '15 at 10:12









                                        DigishaDigisha

                                        1345




                                        1345























                                            0














                                            you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php






                                            share|improve this answer




























                                              0














                                              you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php






                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php






                                                share|improve this answer













                                                you can find definition of updateAttribute() function in file appcodecoreMageEavModelEntitysetup.php







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Sep 29 '16 at 9:37









                                                AjayAjay

                                                12




                                                12






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Magento Stack Exchange!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f13775%2fupdate-is-required-for-existing-attribute-code%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                                                    How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                                                    夢乃愛華...