So, anyways, could I have Adding Custom Field to Address Field Type For Dummies???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Makov
    Junior Member
    • Jun 2016
    • 19

    So, anyways, could I have Adding Custom Field to Address Field Type For Dummies???

    Search whole way through this forum, you just recommends to have a look at files detail.tpl and address.js. And another moment - I haven't got a another file you mentioned in /metadata folder, maybe it is because of my RealEstate Extension.
    So how I supposed to add "House Number" field for example or "Flat Number"? We are developing real estate agency site on your CMS, and we really need this fields.
    And I also want to link this fields with autocomplete .js script. Could you help?
  • yuri
    Member
    • Mar 2014
    • 8627

    #2
    Hi,

    application/Espo/Resources/metadata/fields/address.json

    If you add new field there it will be created in database.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Makov
      Junior Member
      • Jun 2016
      • 19

      #3
      Originally posted by yurikuzn
      Hi,

      application/Espo/Resources/metadata/fields/address.json

      If you add new field there it will be created in database.
      Wow, great! Thank you so much, Yuri!!!
      Could you answer two more questions, please?
      When update will happen this custom fields will be deleted?
      And another one - could you explain from position of developer, how it could be done right.
      I need to add field into address which will be linked with autocomplete.js and will be filling all other adress fields.
      Do I need to write my own custom module or it could be done by just adding new fields?

      Comment

      • Makov
        Junior Member
        • Jun 2016
        • 19

        #4
        Now, when I add two more fields "housenum" and "flatnum" in address.json ESPO throwing an error 500:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'real_estate_property.address_house_number' in 'field_list'.
        PHP Code:
        {
           "actualFields":[
              "street",
              "city",
              "state",
              "country",
              "postalCode",
              "housenum",
              "flatnum"
           ],
           "fields":{
              "street":{
                  "type": "text",
                  "maxLength": 255,
                  "dbType": "varchar"
              },
              "city":{
                 "type":"varchar"
              },
              "state":{
                 "type":"varchar"
              },
              "country":{
                 "type":"varchar"
              },
             "housenum":{
                 "type":"varchar"
              },
              "flatnum":{
                 "type":"varchar"
              },
              "postalCode":{
                 "type":"varchar"
              },
              "map": {
                 "type": "map",
                 "notStorable": true,
                 "readOnly": true,
                 "layoutListDisabled": true,
                 "provider": "Google",
                 "height": 300
              }
           },
           "notMergeable":true,
           "notCreatable": false,
           "filter": true,
           "fieldDefs":{
              "skipOrmDefs":true
           }
        } 
        

        Comment

        • Makov
          Junior Member
          • Jun 2016
          • 19

          #5
          After rebuild.php everything works fine!
          Could you answer this?

          Originally posted by Makov
          When update will happen this custom fields will be deleted?
          And another one - could you explain from position of developer, how it could be done right.
          I need to add field into address which will be linked with autocomplete.js and will be filling all other adress fields.
          Do I need to write my own custom module or it could be done by just adding new fields?

          Comment

          • Makov
            Junior Member
            • Jun 2016
            • 19

            #6
            And I can't save it properly...saving message appears and nothing happens. I've tried to modify address.js
            Here it is.

            Comment

            • Makov
              Junior Member
              • Jun 2016
              • 19

              #7
              Now after after a few modding address.js it saves BUT after several reloads it dissapears!!!!! What can be wrong?

              Comment


              • Binh217
                Binh217 commented
                Editing a comment
                Hi Makov!
                I really need your help.how can i contact you? (i don't see pm in the forum)
                my email(phanthanhbinhgsm@gmail.com)
            • Binh217
              Junior Member
              • Jun 2020
              • 1

              #8
              Hi Makov !
              I really need your help.how can i contact you? (i don't see pm in the forum)
              my email.
              phanthanhbinhgsm@gmail.com.

              p/s
              sorry Admin,mod !

              Thanks for the help!

              Comment

              Working...