Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing province when create order #104

Open
hmonglee opened this issue Nov 22, 2018 · 4 comments
Open

Missing province when create order #104

hmonglee opened this issue Nov 22, 2018 · 4 comments
Labels
Bug Confirmed bugs or bugfixes.

Comments

@hmonglee
Copy link

When I create an order, I have a form error, there is no province for shipping and billing address

@Zales0123 Zales0123 added the bug label Nov 26, 2018
@Zales0123
Copy link
Member

Could you, please, provide any more details? What exactly data you're passing? What is your store configuration?

@Zales0123 Zales0123 added Bug Confirmed bugs or bugfixes. and removed bug labels May 29, 2019
@jcgdjob
Copy link

jcgdjob commented Feb 6, 2020

I face the same issue.
missing province field on addresses.

@htaoufikallah
Copy link

htaoufikallah commented Sep 20, 2020

I faced the same issue here is what I have done to make it work:
I'm using symfony encore/webpack workflow

Override the form template to use the @SyliusAdmin/Common/Form/_address.html.twig template for addresses forms

// templates/bundles/SyliusAdminOrderCreationPlugin/Order/Create/_form.html.twig
<div class="ui segment">
    {{ form_start(form, {'action': action, 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }}

    <div class="ui styled fluid accordion">
        <div class="title active">
            <i class="dropdown icon"></i> {{ 'sylius.ui.items'|trans }}
        </div>
        <div id="items" class="content active">
            {{ form_row(form.items) }}
        </div>

        <div class="title">
            <i class="dropdown icon"></i> {{ 'sylius.ui.shipping_address'|trans }} &amp; {{ 'sylius.ui.billing_address'|trans }}
        </div>
        <div class="content">
            <div class="ui horizontal segments">
                <div class="ui segment">
                    {% include '@SyliusAdmin/Common/Form/_address.html.twig' with {'form': form.shippingAddress} %}
                </div>
                <div class="ui segment">
                    {% include '@SyliusAdmin/Common/Form/_address.html.twig' with {'form': form.billingAddress} %}
                </div>
            </div>
        </div>

        <div id="localeTab" class="title">
            <i class="dropdown icon"></i> {{ 'sylius.ui.locale'|trans }} & {{ 'sylius.ui.currency'|trans }}
        </div>
        <div id="locale" class="content">
            <div class="ui horizontal segments">
                <div class="ui segment">{{ form_row(form.localeCode) }}</div>
                <div class="ui segment">{{ form_row(form.currencyCode) }}</div>
            </div>
        </div>

        <div id="shipmentsAndPaymentsTab" class="title">
            <i class="dropdown icon"></i> {{ 'sylius.ui.shipments'|trans }} &amp; {{ 'sylius.ui.payments'|trans }}
        </div>
        <div id="shipmentsAndPayments" class="content">
            <div class="ui segments">
                <div class="ui segment">
                    <div class="invalid-data-message">{{ 'sylius_admin_order_creation.ui.shipping_methods_selection_requirement'|trans }}</div>
                    {{ form_row(form.shipments) }}
                </div>
                <div class="ui segment">
                    {{ form_row(form.payments) }}
                </div>
            </div>
        </div>
    </div>

    {% include '@SyliusUi/Form/Buttons/_create.html.twig' with {'paths': {'cancel': path('sylius_admin_order_index')}} %}

    {{ form_row(form._token) }}
    {{ form_end(form, {'render_rest': false}) }}
</div>

Import sylius province field

// assets/admin/entry.js
import 'sylius/bundle/AdminBundle/Resources/private/entry';
import 'sylius/bundle/ShopBundle/Resources/private/js/sylius-province-field';
if ($('form[name=sylius_admin_order_creation_new_order]').length > 0) {
  $(document).provinceField();
}

@Zales0123 do you think that this should be added as PR or just mentioned in the doc?

@Loocos
Copy link

Loocos commented Apr 12, 2023

Still facing the bug. If I choose a country on billing/shipping which have more than one province, it will not ask the user to choose a province, so after submitting the form, we got the error message "Please choose a province" but we're not able anymore to do it.

Prometee pushed a commit to Prometee/AdminOrderCreationPlugin that referenced this issue May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

No branches or pull requests

5 participants