ssossossosso

Forums

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

Open-Source CRM software Forums OroPlatform OroPlatform – Programming Questions Address form – default country

This topic contains 4 replies, has 4 voices, and was last updated by  apcimino 1 month, 2 weeks ago.

  • Creator
    Topic
  • #7576

    jakabadambalazs
    Participant

    Is there a place where I can set the default country (i’d like to set Italy) for the Address form?
    thanks


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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #10208

    mirche
    Participant

    Same issue here…

    #10219

    mirche
    Participant

    Alright, I’ve got a solution:

    Copy the file Oro\Bundle\AddressBundle\Resources\views\Include\fields.html.twig to your own ..\Resources\views\Include\fields.html.twig;

    Edit this piece of code:

    <script type=”text/javascript”>
    require([‘jquery’, ‘oroaddress/js/region/view’, ‘oroaddress/js/region/collection’, ‘jquery.select2’],
    function($, RegionView, RegionCollection){
    $(function() {
    /** @type oro.region.View */

    new RegionView({
    el: $(‘#{{ country_field.vars.id }}’),
    target: $(‘#{{ id }}’),
    simpleEl: $(‘#{{ region_text_field.vars.id }}’),
    collection: new RegionCollection(),
    showSelect: {{ showSelect|json_encode|raw }}
    });
    });

    $(document).ready(function(){
    var el = $(‘#{{ country_field.vars.id }}’);
    var defaultValue = ‘NL’; // or any other country code
    el.select2(‘val’,defaultValue).trigger(‘change’);
    })

    });
    </script>

    Make sure you include this file into your form theme, so in ..\Resources\views\Default\update.html.twig:

    {% form_theme form with […, ‘MyAddressBundle:Include:fields.html.twig’] %}

    #10299
    Artem Liubeznyi
    Artem Liubeznyi
    Oro Core

    Hi Adam and Mirche,

    There is no available option to set up a default country for now, but we will add it to our roadmap. Thanks for the suggestion!

    #24990

    apcimino
    Participant

    Any update on this?

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

You must be logged in to reply to this topic.