So OroCommerce offer ability to define which Preferred Localization for specific Customer User with filed Preferred Localization Your can choose between all locale added from configuration. The field Preferred Localization get showed just if you’re choosing more than one locale from configuration.
let’s add other locale go System→Configuration → System Configuration (Section) → localization:
From Enabled Localizations add one other language like Germany .
The filed has added to Edit customer user and view in section general , the form extension has used:
to show in edit and view the service :
oro_customer.form.extension.preferred_localization_customer_user: class: Oro\Bundle\CustomerBundle\Form\Extension\PreferredLocalizationCustomerUserExtension arguments: - '@oro_customer.form.event_listener.preferred_localization_customer_user' tags: - { name: form.type_extension, extended_type: Oro\Bundle\CustomerBundle\Form\Type\CustomerUserType }
Explore Oro\Bundle\CustomerBundle\Form\Extension\PreferredLocalizationCustomerUserExtension for more info .
Note: the page customer edit and view has just 2 block with name 0 and one you can show all blocks of admin of specif route by :
$scrollData = $event->getScrollData();
the scrollData is instance of Oro\Bundle\UIBundle\View\$scrollData;
To save Preferred Localization the service which used is – EventListener -:
oro_customer.form.event_listener.preferred_localization_customer_user: class: Oro\Bundle\CustomerBundle\Form\EventListener\PreferredLocalizationCustomerUserSubscriber arguments: - '@oro_website.manager' - '@oro_config.manager' - '@doctrine'
Explore 2 functions of class PreferredLocalizationCustomerUserSubscriber
1 - onPostSetData
2 - onPostSubmit
The table which register all info related to Preferred Localization is oro_customer_user_settings
the Entity is CustomerUserSettings
and has relation OneToMany with CustomerUser as:
/** * @var ArrayCollection|CustomerUserSettings[] * * @ORM\OneToMany( * targetEntity="Oro\Bundle\CustomerBundle\Entity\CustomerUserSettings", * mappedBy="customerUser", * cascade={"all"}, * orphanRemoval=true * ) * @ConfigField( * defaultValues={ * "importexport"={ * "excluded"=true * } * } * ) */ protected $settings;
So you can make lot of customization based on Preferred Localization.
Comments