Registrierung nur "Gewerblich" ohne Auswahl der "Ich bin"

Hallo.

Gibt es in SW6 keine Möglichkeit die Registrierung je Verkaufskanal nur für gewerbliche Kunden vorzubelgen? Quasi die Logik wenn ich bei “Ich bin*” Gewerblich auswähle. Also die Felder Unternehmen, Abteilung, Ust-Id anzeigen? Es soll kein Auswahlfeld geben. In der Konfiguration zur Registrierung sehe ich leider keine Option. Im Template auch nicht… Gibt es vielleicht noch einen anderen Weg ohne Templatenanpassung?

 

Gruß Mike

Ich suche die Funktion auch. Ich habe versucht dies über JS zu hacken, aber leider wird dann das Form-Template dann nicht entsprechend aktualisiert.

// Block private registration
window.addEventListener('load', function() {
    document.querySelector('option[value=private]').remove();
    document.querySelector('option[value=business]').selected = 'selected';
    document.querySelector('select#accountType').value = 'business';
});

 

Ich würde das auch benötigen! Also nur gewerbliche Kunden.

Hallo zusammen. 

Es ist ein Zusammenspiel mehrer Faktoren notwendig um die Funktion bereitzustellen (scss, js und Templateanpassungen). Wir haben die Logik in ein Pluign gepackt und werden prüfen ob wir dies im Store bereitstellen können.

 

Gruß Mike

@_MikeB schrieb:

Hallo zusammen. 

Es ist ein Zusammenspiel mehrer Faktoren notwendig um die Funktion bereitzustellen (scss, js und Templateanpassungen). Wir haben die Logik in ein Pluign gepackt und werden prüfen ob wir dies im Store bereitstellen können.

 

Gruß Mike

Oh, ja das wäre wirklich super! 

Guten Morgen zusammen.

Plugin wird gerade von Shopware geprüft und sollte dann zeitnahe im Store bereitstehen. Ich schreibe hier nochmal wenn es soweit ist :wink:

 

Gruß Mike

1 „Gefällt mir“

Hallo, oh das klingt super. Eine Frage vorab, kann man das dann pro Verkaufskanal zuweisen? Ich hab nämlich zwei Verkaufskanäle, einer ist B2C und einer B2B. Und ich würde das eben für B2B brauchen.

Ja das geht :wink:

Wird wohl ein guter Tag heute …

:slight_smile: Dauer wohl aber leider ein paar Tage bis Shopware das Plugin geprüft hat… :frowning:

Der gute Tag ist doch schon heute :smiley: SW hat Gas gegeben. Hier ist das Plugin:

 

Gruß Mike

1 „Gefällt mir“

Sag ich doch …

Edit: Es funktioniert hervorragend !!!

Hallo zusammen,

entweder das Plugin nehmen oder einfach ein neues Template Override in /custom/plugins//src/Resources/views/storefront/component/address/address-personal.html.twig mit folgenden Inhalt setzen:

{% sw_extends '@Storefront/storefront/component/address/address-personal.html.twig' %}

{% block component_address_personal_account_type_select %}
        {% if shopware.config.core.loginRegistration.showAccountTypeSelection %}
            <select name="{% if prefix %}{{ prefix }}[accountType]{% else %}accountType{% endif %}"
                id="{{ prefix }}accountType"
                required="required"
                class="custom-select contact-select"
                data-form-field-toggle="true"
                data-form-field-toggle-target=".js-field-toggle-contact-type-company"
                data-form-field-toggle-value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
                data-form-field-toggle-scope="{% if scope == 'parent' %}parent{% else %}all{% endif %}"
                {% if scope == 'parent' %}data-form-field-toggle-parent-selector={{ parentSelector }}{% endif %}
            >
        {% endif %}

        {% set isCompany = false %}

        {% if page.address.company or data.company is not empty %}
            {% set isCompany  = true %}
        {% endif %}

        {% if accountType and accountType == constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') %}
            {% set isCompany  = true %}
        {% endif %}

        {% set isLoginPage = false %}
        {% if activeRoute == 'frontend.account.login.page' %}
            {% set isLoginPage = true %}
        {% endif %}

        <option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
            {% if isLoginPage == false %} selected="selected"{% endif %} aria-hidden="true">
            {{ "account.personalTypeBusiness"|trans|sw_sanitize }}
        </option>
    </select>
{% endblock %}

Ist dirty, funktioniert aber und lässt alle Funktionen vorhanden.

Alternativ den Block noch unsichtbar machen. SCSS:

.contact-type {
display: none;
}

Grüße
Ralf

Anbei die Lösung von @rasch.media aktualisiert, sodass auch das Feld „Firma“ angezeigt wird:

{% sw_extends '@Storefront/storefront/component/address/address-personal.html.twig' %}

{% block component_address_personal_account_type_select %}

    {% set onlyCompanyRegistration = true %}

        {% if onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection') %}
            <select name="{% if prefix %}{{ prefix }}[accountType]{% else %}accountType{% endif %}"
                id="{{ prefix }}accountType"
                {% if onlyCompanyRegistration %}disabled{% endif %}
                required="required"
                class="custom-select contact-select"
                data-form-field-toggle="true"
                data-form-field-toggle-target=".js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}"
                data-form-field-toggle-value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
                data-form-field-toggle-scope="{% if scope == 'parent' %}parent{% else %}all{% endif %}"
                {% if scope == 'parent' %}data-form-field-toggle-parent-selector={{ parentSelector }}{% endif %}
            >
        {% endif %}

        {% set isCompany = true %}

        {% if page.address.company or data.company is not empty %}
            {% set isCompany  = true %}
        {% endif %}

        {% if onlyCompanyRegistration or (accountType and accountType == constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS')) %}
            {% set isCompany  = true %}
        {% endif %}

        {% set isLoginPage = false %}
        {% if activeRoute == 'frontend.account.login.page' %}
            {% set isLoginPage = true %}
        {% endif %}

        {% if isLoginPage %}
            <option disabled="disabled"
                    selected="selected"
                    value="">
                {{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
            </option>
        {% endif %}

        <option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
            {% if isCompany == true and isLoginPage == false %} selected="selected"{% endif %}>
            {{ "account.personalTypeBusiness"|trans|sw_sanitize }}
        </option>
    </select>
    {% if onlyCompanyRegistration %}<input type="hidden" name="accountType" value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}">{% endif %}
{% endblock %}


1 „Gefällt mir“

Hallo zusammen,

ich würde auch gerne die Private anmeldung verhindern.

So wie oben beschrieben (von @schnere ) klappt es bei mir leider nicht immer.

Wenn ich ganz normal über „Anmelden“ oder „registrieren“ gehe funktoniert es.

Wenn ich aber etwas in den Warnkrob lege und dann auf weiter zur Kasse gehe. Mich dort anmelde funktoniert es nicht.

Ich gebe alle Daten ein, klicke auf weiter und nix passiert. Alle Felder sind ausgefüllt und Grün.

Hier mein Code:


{% sw_extends '@Storefront/storefront/component/address/address-personal.html.twig' %}

{% block component_address_personal_account_type_select %}
    {{ dump() }}

        {% if onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection') %}
            <select name="{% if prefix %}{{ prefix }}[accountType]{% else %}accountType{% endif %}"
                id="{{ idPrefix ~ prefix }}accountType"
                {% if onlyCompanyRegistration %}disabled{% endif %}
                required="required"
                class="{{ formSelectClass }} contact-select"
                data-form-field-toggle="true"
                data-form-field-toggle-target=".js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}"
                data-form-field-toggle-value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
                data-form-field-toggle-scope="{% if scope == 'parent' %}parent{% else %}all{% endif %}"
                {% if scope == 'parent' %}data-form-field-toggle-parent-selector={{ parentSelector }}{% endif %}
            >
        {% endif %}

        {% set isCompany = true %}

        {% if page.address.company or data.company is not empty %}
            {% set isCompany  = true %}
        {% endif %}

        {% if onlyCompanyRegistration or (accountType and accountType == constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS')) %}
            {% set isCompany  = true %}
        {% endif %}

        {% set isLoginPage = false %}
        {% if activeRoute == 'frontend.account.login.page' %}
            {% set isLoginPage = true %}
        {% endif %}

        {% if isLoginPage %}
            <option disabled="disabled"
                    selected="selected"
                    value="">
                {{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
            </option>
        {% endif %}

        {#### BAM - Entfernen Privat ####}
		
        <option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
            {% if isCompany == true and isLoginPage == false %} selected="selected"{% endif %}>
            {{ "account.personalTypeBusiness"|trans|sw_sanitize }}
        </option>
		
    </select>
    {% if onlyCompanyRegistration %}<input type="hidden" name="accountType" value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}">{% endif %}
{% endblock %}

Ich habe nur das „{% set onlyCompanyRegistration = true %}“ weggelassen, da ich sonst auf der normal „Anmelden“ oder „registrieren“ nicht die Select box ändenr kann und die Daten von der Privaten anmeldung angezeigt werden, ohne Abteilung, Umsatzsteuer-ID .

Aber auch mit „{% set onlyCompanyRegistration = true %}“ funktoniert es nicht bei der checkout/register Seite.

Hat jemand eine Idee?

Vielen Dank für eure Mühe und Zeit.

Ich nutze Shopware 6.4.18.1

Moin zusammen,

ich habe auch etwas gebaut und meine Lösung sieht so aus:

{% sw_extends '@Storefront/storefront/component/account/register.html.twig' %}

{% block component_account_register_personal_address_fields %}
    {% sw_include '@Storefront/storefront/component/address/address-personal.html.twig' with {
        'showBirthdayField': config('core.loginRegistration.showBirthdayField'),
        'accountType': data.get('accountType'),
        'onlyCompany': true
    } %}
{% endblock %}
{% sw_extends '@Storefront/storefront/component/address/address-personal.html.twig' %}

{% block component_address_personal_account_type_select %}
    {% if onlyCompany %}
        {% set onlyCompanyRegistration = true %}
    {% endif %}
    {{ parent() }}
{% endblock %}

Dadurch kann als Rechnungsadresse nur noch ein Gewerbe genutzt werden. Als Lieferadresse allerdings kann abweichend auch eine Privatanschrift genutzt werden.

Vielleicht hilft es ja noch jemandem :slight_smile:

Grüße
Matthias

ich würde auch gerne die Private anmeldung verhindern.
So wie oben beschrieben (von @schnere ) klappt es bei mir leider nicht immer.

Wenn ich ganz normal über „Anmelden“ oder „registrieren“ gehe funktoniert es.

Wenn ich aber etwas in den Warnkrob lege und dann auf weiter zur Kasse gehe. Mich dort anmelde funktoniert es nicht.

Ich gebe alle Daten ein, klicke auf weiter und nix passiert. Alle Felder sind ausgefüllt und Grün.

Hallo,

Habe das gleiche Problem.
hast du das gelöst ?

oder hat jemand anderes eine Lösung?

Beste Grüße

Wir hatten hin und wieder auch das Problem, dass man nicht weiterkam, wenn man ein Firmenkunde ist, obwohl alle angezeigten Felder grün sind.

Bei uns ist das Problem gewesen, dass das Geburtsdatum auch mit abgefragt wird, dieses Feld wurde aber bei Firmenkunden nicht gezeigt. Somit ist ein Pflichtfeld nicht gefüllt, welches man aber gar nicht sehen kann… Lösung war das Geburtstagsfeld einfach immer einzublenden, dann können es Firmenkunden auch ausfüllen und es wird rot gezeigt, wenn es nicht gefüllt ist.