How to add customer new entity type and customer new fieldhow can we display data from database for all field...

Windows Server Datacenter Edition - Unlimited Virtual Machines

What do you call someone who likes to pick fights?

Specifying a starting column with colortbl package and xcolor

Why is there an extra space when I type "ls" in the Desktop directory?

Outlet with 3 sets of wires

How to draw dashed arc of a circle behind pyramid?

Which situations would cause a company to ground or recall a aircraft series?

I reported the illegal activity of my boss to his boss. My boss found out. Now I am being punished. What should I do?

Doubts in understanding some concepts of potential energy

What materials can be used to make a humanoid skin warm?

I can't die. Who am I?

How to check whether module is loaded with custom configurations?

What is Earthy controling in the ISS cupola?

Which classes are needed to have access to every spell in the PHB?

Can we track matter through time by looking at different depths in space?

Why is a very small peak with larger m/z not considered to be the molecular ion?

Is a piano played in the same way as a harmonium?

Professor forcing me to attend a conference, I can't afford even with 50% funding

Do items de-spawn?

PTIJ: Why does only a Shor Tam ask at the Seder, and not a Shor Mu'ad?

Does a difference of tense count as a difference of meaning in a minimal pair?

Having the player face themselves after the mid-game

Conservation of Mass and Energy

What do *foreign films* mean for an American?



How to add customer new entity type and customer new field


how can we display data from database for all field form custom table in magento?Custom field for new order new customerHow can I add new custom field into customer form and then save it into database in MagentoHow to make state/company field in new customer creation required from admin panel?Set custom field value in customer registrationhow to add an additional field in the client panel / during registrationMagento 2 :- How can i add tab in customer group?How can I split one customer import field on CSV to 2 Magento fields?Magento2 display Fax and Is Active attributes in admin customer edit formHow to display created dynamic attibute into the customer array?













0















I want to create a new tab name as "Preference" in customer dashboard and also admin side customer edit page.
I successfully created new tab both side(means Admin and frontend).



Can any one suggest me how to create a two new field and display field in "preference tab" for both side and how i can add, edit field value.










share|improve this question





























    0















    I want to create a new tab name as "Preference" in customer dashboard and also admin side customer edit page.
    I successfully created new tab both side(means Admin and frontend).



    Can any one suggest me how to create a two new field and display field in "preference tab" for both side and how i can add, edit field value.










    share|improve this question



























      0












      0








      0








      I want to create a new tab name as "Preference" in customer dashboard and also admin side customer edit page.
      I successfully created new tab both side(means Admin and frontend).



      Can any one suggest me how to create a two new field and display field in "preference tab" for both side and how i can add, edit field value.










      share|improve this question
















      I want to create a new tab name as "Preference" in customer dashboard and also admin side customer edit page.
      I successfully created new tab both side(means Admin and frontend).



      Can any one suggest me how to create a two new field and display field in "preference tab" for both side and how i can add, edit field value.







      magento-1.7 customer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 mins ago









      Teja Bhagavan Kollepara

      2,98641947




      2,98641947










      asked Nov 29 '13 at 6:28









      krutikruti

      13317




      13317






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Lifted from:




          • https://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237




          This is the code for a basic int attribute with text renderer:



          $installer = $this;
          $installer->startSetup();

          $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

          $entityTypeId = $setup->getEntityTypeId('customer');
          $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
          $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

          $setup->addAttribute('customer', 'your_attribute_code_here', array(
          'input' => 'text',
          'type' => 'int',
          'label' => 'Some textual description',
          'visible' => 1,
          'required' => 0,
          'user_defined' => 1,
          ));

          $setup->addAttributeToGroup(
          $entityTypeId,
          $attributeSetId,
          $attributeGroupId,
          'your_attribute_code_here',
          '999' //sort_order
          );

          $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
          $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
          $oAttribute->save();

          $setup->endSetup();


          The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.



          In terms of using a select with predefined options, this is what you need:



          $iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
          $aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
          $aOption = array();
          $aOption['attribute_id'] = $iAttributeId;

          for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
          $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
          }
          $setup->addAttributeOption($aOption);


          And here is a walk-through on using a custom source for your drop-down



          Hope this helps,

          JD






          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%2f11324%2fhow-to-add-customer-new-entity-type-and-customer-new-field%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Lifted from:




            • https://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237




            This is the code for a basic int attribute with text renderer:



            $installer = $this;
            $installer->startSetup();

            $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

            $entityTypeId = $setup->getEntityTypeId('customer');
            $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
            $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

            $setup->addAttribute('customer', 'your_attribute_code_here', array(
            'input' => 'text',
            'type' => 'int',
            'label' => 'Some textual description',
            'visible' => 1,
            'required' => 0,
            'user_defined' => 1,
            ));

            $setup->addAttributeToGroup(
            $entityTypeId,
            $attributeSetId,
            $attributeGroupId,
            'your_attribute_code_here',
            '999' //sort_order
            );

            $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
            $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
            $oAttribute->save();

            $setup->endSetup();


            The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.



            In terms of using a select with predefined options, this is what you need:



            $iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
            $aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
            $aOption = array();
            $aOption['attribute_id'] = $iAttributeId;

            for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
            $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
            }
            $setup->addAttributeOption($aOption);


            And here is a walk-through on using a custom source for your drop-down



            Hope this helps,

            JD






            share|improve this answer






























              1














              Lifted from:




              • https://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237




              This is the code for a basic int attribute with text renderer:



              $installer = $this;
              $installer->startSetup();

              $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

              $entityTypeId = $setup->getEntityTypeId('customer');
              $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
              $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

              $setup->addAttribute('customer', 'your_attribute_code_here', array(
              'input' => 'text',
              'type' => 'int',
              'label' => 'Some textual description',
              'visible' => 1,
              'required' => 0,
              'user_defined' => 1,
              ));

              $setup->addAttributeToGroup(
              $entityTypeId,
              $attributeSetId,
              $attributeGroupId,
              'your_attribute_code_here',
              '999' //sort_order
              );

              $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
              $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
              $oAttribute->save();

              $setup->endSetup();


              The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.



              In terms of using a select with predefined options, this is what you need:



              $iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
              $aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
              $aOption = array();
              $aOption['attribute_id'] = $iAttributeId;

              for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
              $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
              }
              $setup->addAttributeOption($aOption);


              And here is a walk-through on using a custom source for your drop-down



              Hope this helps,

              JD






              share|improve this answer




























                1












                1








                1







                Lifted from:




                • https://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237




                This is the code for a basic int attribute with text renderer:



                $installer = $this;
                $installer->startSetup();

                $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

                $entityTypeId = $setup->getEntityTypeId('customer');
                $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
                $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

                $setup->addAttribute('customer', 'your_attribute_code_here', array(
                'input' => 'text',
                'type' => 'int',
                'label' => 'Some textual description',
                'visible' => 1,
                'required' => 0,
                'user_defined' => 1,
                ));

                $setup->addAttributeToGroup(
                $entityTypeId,
                $attributeSetId,
                $attributeGroupId,
                'your_attribute_code_here',
                '999' //sort_order
                );

                $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
                $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
                $oAttribute->save();

                $setup->endSetup();


                The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.



                In terms of using a select with predefined options, this is what you need:



                $iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
                $aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
                $aOption = array();
                $aOption['attribute_id'] = $iAttributeId;

                for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
                $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
                }
                $setup->addAttributeOption($aOption);


                And here is a walk-through on using a custom source for your drop-down



                Hope this helps,

                JD






                share|improve this answer















                Lifted from:




                • https://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237




                This is the code for a basic int attribute with text renderer:



                $installer = $this;
                $installer->startSetup();

                $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

                $entityTypeId = $setup->getEntityTypeId('customer');
                $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
                $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

                $setup->addAttribute('customer', 'your_attribute_code_here', array(
                'input' => 'text',
                'type' => 'int',
                'label' => 'Some textual description',
                'visible' => 1,
                'required' => 0,
                'user_defined' => 1,
                ));

                $setup->addAttributeToGroup(
                $entityTypeId,
                $attributeSetId,
                $attributeGroupId,
                'your_attribute_code_here',
                '999' //sort_order
                );

                $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'your_attribute_code_here');
                $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
                $oAttribute->save();

                $setup->endSetup();


                The unusual step for adding attributes is the setData('used_in_forms') this seems to be unique to customer attributes. Without it, the field won't get rendered, certainly not in the adminhtml anyway. You can see the valid options for this array in the customer_form_attribute database table.



                In terms of using a select with predefined options, this is what you need:



                $iAttributeId = $installer->getAttributeId($entityTypeId, 'your_attribute_code_here');
                $aClasses = array('TV','DVD','Home Theatre','Air Conditioner','Stereo/Hifi','Game Console','Camcorder','VCR','Set Top Box','PVR');
                $aOption = array();
                $aOption['attribute_id'] = $iAttributeId;

                for($iCount=0;$iCount<sizeof($aClasses);$iCount++){
                $aOption['value']['option'.$iCount][0] = $aClasses[$iCount];
                }
                $setup->addAttributeOption($aOption);


                And here is a walk-through on using a custom source for your drop-down



                Hope this helps,

                JD







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 23 '17 at 12:37









                Community

                1




                1










                answered Dec 1 '13 at 21:21









                B00MERB00MER

                8,20321645




                8,20321645






























                    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%2f11324%2fhow-to-add-customer-new-entity-type-and-customer-new-field%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)...

                    變成蝙蝠會怎樣? 參考資料 外部連結 导航菜单Thomas Nagel, "What is it like to be a...