ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 7 replies, has 4 voices, and was last updated by  jakabadambalazs 2 years, 5 months ago.

  • Creator
    Topic
  • #6435
    Spurgeon
    Spurgeon
    Participant

    Hi,

    Greetings!

    Realise that when we set default country in the primary location field of System -> Configuration -> Localization, the changes are reflected in currency.

    It would be ideal, if this also sets the default country in the Address Entity to the primary location. As of now, it shows ‘Choose a Country…’ .

    Any idea how this can be implemented?

    Thanks!
    warm regards
    Spurgeon

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #6493

    Alexandr Smaga
    Participant

    Hi @spurgeonbj ! Sound like a good improvement for OroPlatform, thanks !

    For now you can do this by form extension that will extend oro_country form type and set default data in options.

    #6498
    Spurgeon
    Spurgeon
    Participant

    Hi Alex,

    Greetings!

    Thanks a lot for your kind response and tip and also for considering this for implementation.

    Will check out the form extension option.

    warm regards and gratitude,
    Spurgeon

    #6717

    changwuf31
    Participant

    Hi Spurgeon,

    I’m looking into this as well. But cannot find the solution yet.
    Have you solved this one?

    #6721
    Spurgeon
    Spurgeon
    Participant

    Hi Chang,

    Greetings!

    Not yet.

    But I think we can extend / override or modify (only issue with modification is we need to incorporate these changes when we upgrade) oro_country form type in the Address Bundle.

    I tried doing it by modifying and ended up getting the default country as a ‘Place Holder’ rather than the currently selected option, in my case it showed ‘India’ instead of ‘Choose a Country’ when i modified this file.

    vendor/oro/platform/src/Oro/Bundle/AddressBundle/Form/Type/CountryType.php

    I had set empty_value = ‘India’ and empty_data = ‘IN’ (dont remember whether it was the other way round). This does change the select2 control

    Guess it might be to do something with setting default country id.

    Hope Alex can help us here 🙂

    Do let me know if there’s any update.

    Thanks!
    warm regards
    Spurgeon

    #6722

    changwuf31
    Participant

    Ah, thank you for the response Spurgeon,

    I think we should use a javascript solution here, as changing the country, should also trigger the state ajax.

    Yes, sure hope Alex or someone from orocrm can help here 🙂

    #6723
    Spurgeon
    Spurgeon
    Participant

    Hi Chang,

    Greetings!

    Thanks for the quick response.

    That sounds great!

    If you are comfortable in Javascript, you can check this file

    which handles the events for the select2 control dealing with Country.

    I’m not so conversant with JS, so was wondering how to go about…

    Thanks!
    warm regards
    Spurgeon

    #8399

    jakabadambalazs
    Participant

    Sounds good but too much hassle!

    If it is agreed that we can use the system configuration “oro_locale.country” === “Primary Location” to be set as the selected country on the oro.address.form.choose_country field when there is no data set, I’ll try to make a PR for this.

    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.