No announcement yet.

B2C mode and two addresses

  • Filter
  • Time
  • Show
Clear All
new posts

  • B2C mode and two addresses


    I'm new to EspoCRM, so i'm just learning how things done here.

    I've found man page about how to change EspoCRM from B2B mode to B2C mode:
    And there is one problem for me. Accounts (which are organizations in B2B model as I understand) have two Address fields - Billing Address and Shipping Address.
    But Contacts (which are individual customers in B2C model) have only one Address.
    So, is it possible for Contacts to also have two Address fields - Billing Address and Shipping Address? And if it's possible - how to make it?

  • #2

    You can add it: Administration > Entity Manager > Contact > Fields > Add Field > Address
    Name it "shippingAddress"

    Then put it on Detail Layout in Layout Manager.


    • #3

      And how to get "Copy Billing" button here (in Contact) too?
      I see it in client/modules/crm/src/views/account/fields/shipping-address.js file, but simple copying it to client/modules/crm/src/views/contact/fields does nothing.


      • #4
        In needs some manual customization.


        • #5
          Seems logical.

          At least, which files need to be customized? EspoCRM's structure is still very complicated for me.


          • #6
            look to
            and Contact.

            There are custom view for shipping address. You can do the same for your new contact field (metadata in custom folder)


            • #7
              It's working. Thank you.

              But there is another problem with it now:
              (It's B2C case)
              For example, when I create new Lead, it have "simple" Address.
              Next I'm converting this Lead to Contact (my "new" Contact now have two address fields - billingAddress and shippingAddress) and in result address information "stay" in "simple" Address fields.

              So now there are three different addresses in CRM: Address, billingAddress and shippingAddress. Kinda a lot of addresses. =)
              May be it will be logical to get rid of "simple" Address and replace it with billingAddress CRM-wide OOTB? (billingAddress is "basic" and shippingAddress is additional)


              • #8
                This worked perfectly for Me! Except I was doing it to Opportunity and a Different Address Label of ServiceAddress.
                Now I put the file in the following directory: C:\xampp\htdocs\espocrm\client\modules\crm\src\vie ws\opportunity\fields\service-address.js

                Will an upgrade/update break this? Should it be in the custom directory somewhere?


                • #9


                  • khopper
                    khopper commented
                    Editing a comment

                    I created the directories as you described client/custom/src/views/opportunity/fields/service-address.js and set in entityDefs the view "custom:views/opportunity/fields/service-address" as you described.

                    Upon rebuilding it prevented me from creating an opportunity completely the form would not even come up would stay stuck on loading....
                    I reverted the by removing src/views/opportunity/fields/service-address.js and changed entityDefs the view "crm:views/opportunity/fields/service-address" and it began working again without issue.

                  • tanya
                    tanya commented
                    Editing a comment
                    I hope json was valid, so seems you defined a view wrong. Is it possible to see the custom view definition?

                  • khopper
                    khopper commented
                    Editing a comment
                    The json file works perfectly pointing to "crm:views/opportunity/fields/service-address" its when I change it to view": "custom:views/opportunity/fields/service-address" it stops working.
                    I copied the working/vaild file "service-address.js" to "/client/custom/src/views/opportunity/fields/" from "/client/modules/crm/src/views/opportunity/fields/"

                • #10
                  Tanya, here are some screen shots of what happens for a visual.
                  Last edited by khopper; 02-02-2018, 05:25 PM.


                  • #11
                    Open browser console. Is there any error message?


                    • #12
                      I moved my entire system over to an Ubuntu Linux box (testing). I have determined that this specific modification is what was causing all sorts of issues with rebuilds, clearing cache, upgrades, etc. (the system generated logs were not very helpful in pointing this out - even in DEBUG mode)

                      I created the directories as you originally described "client/custom/src/views/opportunity/fields/"service-address.js and set in entityDefs the view "custom:views/opportunity/fields/service-address" It just hangs trying to create an opportunity. currently at version 5.0.5

                      I copied the file "service-address.js" to "/client/custom/src/views/opportunity/fields/" (putting it here causes it to hang) from "/client/modules/crm/src/views/opportunity/fields/" (Putting it here causes all the above issues with clearing cache and upgrades etc)

                      If i remove the entry to entityDefs the view "custom:views/opportunity/fields/service-address" or "crm:views/opportunity/fields/service-address" the system works but does not display properly for the service address. See screen shot!

                      without this mod the address doesn't display right and there is no copy option. see service-address.txt this is the js file.
                      Attached Files
                      Last edited by khopper; 02-24-2018, 03:59 PM.


                      • #13
                        you don't change the view name in your copied file
                        Espo.define('custom:views/opportunity/fields/service-address', 'crm:views/opportunity/fields/service-address', function (Dep) { ....


                        • #14

                          I made the change and it worked perfectly, until I try to rebuild or clear cache on the back end.
                          If I remove the entry from opportunity.json pointing the the custom js I can clear & rebuild without issue.
                          would you like a copy of the files to verify on your end? It appears to be a system issue at this point being that I have done as much as I can with regards to switching OS platform and packages and am having the same problem on both. I have already confirmed permissions and services are not the issue as well.


                          • #15
                            did you define this view for field in application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json or in custom/Espo/Custom/Resources/metadata/entityDefs/Opportunity.json


                            • khopper
                              khopper commented
                              Editing a comment