B2bPlatformContext
What is the B2bPlatformContext?
In the Shopware standard there is already the normal SalesChannelContext, we have extended this via the "extension" accordingly with a new b2BPlatformContext to provide B2B-specific data in the user context.
Examples:
Which employee of a "customer" is logged in?
Is a sales employee logged in? And is he currently logged in to a customer.
Is the employee an admin or not?
Which employee with which role is logged in?
The b2bPlatformContext is available from anywhere. (Can be accessed from anywhere.)
Example:


Note alert
the B2BplatformContext is only set when you are logged in as, so we always recommend asking beforehand.
if(!$context->hasExtension('b2bPlatformContext')) {
return;
}
Alternatively, the B2BPlatformContext can always be requested via the B2bContextTrait (see documentation B2bContextTrait).

Note Alert:
In the employeeCustomer is the connection table between the logged-in employee and the assigned customer. The role, admin, etc. are maintained here.
Examples:


Was this helpful?