B2B Unit-Level Orders

The unit-level orders functionality is meant for use as part of the B2B Commerce Organization. It allows authorized buyers to access information on orders placed by peers in the same root unit and its subunits down the organizational hierarchy.

For more information, see B2B Unit-Level Orders.

Architecture

The following section presents feature highlights from the perspective of headless architecture:

  • Authorized B2B agents can access two custom content pages for the feature, both having pre-configured routes to history and details views.

  • An agent with the B2B Admin role can access the Rights and Roles panel to manage the View Unit-Level Orders right.

  • Calls to back-end SAP Commerce Cloud are made through OCC REST APIs to endpoints in the @spartacus/organization library.

  • By default, OAuth 2.0 protocol handles secure authentication.

  • Access to the database resources is read-only. Agents fetch information on nonpersonal orders of peers, including buyer details and B2B unit name, with two GET methods.

The following Technical Architecture Modeling (TAM) diagram shows the details of access and communication for the unit-level orders feature with the back-end SAP Commerce Cloud instance:

Requirements

The unit-level orders feature requires:
  • SAP Commerce Cloud version 2211 or higher

  • The installation of the B2B Accelerator Module, specifically the following extensions:

    • b2bacceleratorfacades Extension

    • b2bocc Extension

    • b2bwebservicescommons Extension

  • The installation of the B2B Commerce Module, specifically the following extensions:

    • b2bcommerce Extension

    • b2bcommercefacades Extension

  • The installation of the @spartacus/organization library, version 5.1, or higher, and its dependencies

For more information, see Installing Additional Composable Storefront Libraries.

CMS Components

Unit-level orders are CMS-driven and consist of various CMS components that make up the two page views of the feature.

The Unit-Level Orders History page consists of the following CMS component:
  • UnitLevelOrderHistoryComponent

The Unit-Level Orders Details page consists of the following CMS components:

  • UnitLevelOrderDetailsOverviewComponent

  • UnitLevelOrderDetailsItemsComponent

  • ExportOrderEntriesComponent

  • UnitLevelOrderDetailsTotalsComponent

You can configure unit-level orders by using SmartEdit to display the unit-level orders components in the composable storefront, or you can manually add them to content slots using ImpEx.

If you're using the Spartacus Sample Data Extension, the unit-level orders components are already enabled. However, if you decide not to use the spartacussampledata extension, you can enable the unit-level CMS components through ImpEx.

Adding CMS Components Manually

You can add various unit-level orders CMS components to the composable storefront using ImpEx.

Context

$contentCatalog=powertools-spaContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]

Procedure

  1. Set up the Unit-Level Orders link with the following series of ImpEx import operations:
    1. Define the feature link.
      INSERT_UPDATE CMSLinkComponent;$contentCV[unique=true];uid[unique=true];name;url;&linkRef;target(code)[default='sameWindow'];;UnitLevelOrderLink;Unit Level Order Link;/my-account/unitLevelOrders;UnitLevelOrderLink;
    2. Add the feature link to the top navigation bar.
      INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active;cmsComponents(uid,$contentCV);;SiteLinksSlot;Slot contains some links;true;QuickOrderLink,OrdersLink,UnitLevelOrderLink,StoreFinderLink,ContactUsLink,HelpLink
    3. Add the feature link to a drop-down list under My Account.
      INSERT_UPDATE CMSNavigationEntry;uid[unique=true];$contentCV[unique=true];name;navigationNode(&nodeRef);item(&linkRef);;UnitLevelOrderNavNodeEntry;;UnitLevelOrderNavNodeEntry;UnitLevelOrderNavNode;UnitLevelOrderLink;
  2. Create the Unit-Level Orders History page with the following series of ImpEx import operations:
    1. Create a Unit Level Order History CMS component.
      INSERT_UPDATE CMSFlexComponent;$contentCV[unique=true];uid[unique=true];name;flexType;&componentRef
      ;;UnitLevelOrderHistoryComponent;Unit Level Order History Component;UnitLevelOrderHistoryComponent;UnitLevelOrderHistoryComponent
    2. Create a new Unit-Level Order History page.
      INSERT_UPDATE ContentPage;$contentCV[unique=true];uid[unique=true];name;masterTemplate(uid,$contentCV);label;defaultPage[default=‘true’];approvalStatus(code)[default=‘approved’];homepage[default=‘false’]
      ;;UnitLevelOrderPage;Unit Level Order Page;AccountPageTemplate;/my-account/unitLevelOrders
      
    3. Create a new Unit-Level Order History slot.
      INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];cmsComponents(uid, $contentCV)
      ;;BodyContent-unitLevelOrder;UnitLevelOrderHistoryComponent
    4. Add the Unit-Level Order History slot to the Unit-Level Order History page.
      INSERT_UPDATE ContentSlotForPage;$contentCV[unique=true];uid[unique=true];position[unique=true];page(uid,$contentCV)[unique=true];contentSlot(uid,$contentCV)[unique=true]
      ;;BodyContent-unitLevelOrder;BodyContent;UnitLevelOrderPage;BodyContent-unitLevelOrder
  3. Create the Unit-Level Orders Details page with the following series of ImpEx import operations:
    1. Create relevant CMS components: UnitLevelOrderDetailsOverviewComponent, UnitLevelOrderDetailsItemsComponent, ExportOrderEntriesComponent, and UnitLevelOrderDetailsTotalsComponent.
      INSERT_UPDATE CMSFlexComponent;$contentCV[unique=true];uid[unique=true];name;flexType;&componentRef
      ;;UnitLevelOrderDetailsOverviewComponent;Unit Level Order Details Overview Component;UnitLevelOrderDetailsOverviewComponent;UnitLevelOrderDetailsOverviewComponent
      ;;UnitLevelOrderDetailsItemsComponent;Unit Level Order Details Items Component;UnitLevelOrderDetailsItemsComponent;UnitLevelOrderDetailsItemsComponent
      ;;ExportOrderEntriesComponent;Export Order Entries Component;ExportOrderEntriesComponent;ExportOrderEntriesComponent
      ;;UnitLevelOrderDetailsTotalsComponent;Unit Level Order Details Totals Component;UnitLevelOrderDetailsTotalsComponent;UnitLevelOrderDetailsTotalsComponent
      
    2. Create a new Unit-Level Order Details page.
      INSERT_UPDATE ContentPage;$contentCV[unique=true];uid[unique=true];name;masterTemplate(uid,$contentCV);label;defaultPage[default='true'];approvalStatus(code)[default='approved'];homepage[default='false']
      ;;UnitLevelOrderDetailsPage;Unit Level Order Details Page;AccountPageTemplate;/my-account/unitLevelOrderDetails
      
      
    3. Create new slots for the Unit-Level Order Details page.
      INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;active;cmsComponents(uid, $contentCV);;;
      ;;SideContent-unit-level-order-details;Side Content Slot for Unit-Level Order Details;true;;;;
      ;;BodyContent-unit-level-order-details;Body Content Slot for Unit-Level Order Details;true;UnitLevelOrderDetailsOverviewComponent,UnitLevelOrderDetailsItemsComponent,ExportOrderEntriesComponent,UnitLevelOrderDetailsTotalsComponent;;;
    4. Add the newly created slots to the Unit-Level Order Details page.
      INSERT_UPDATE ContentSlotForPage;$contentCV[unique=true];uid[unique=true];position[unique=true];page(uid,$contentCV)[unique=true][default='UnitLevelOrderDetailsPage'];contentSlot(uid,$contentCV)[unique=true];;;
      ;;SideContent-unit-level-order-details;SideContent;;SideContent-unit-level-order-details;;;
      ;;BodyContent-unit-level-order-details;BodyContent;;BodyContent-unit-level-order-details;;;
      

Enabling Unit-Level Orders

By default, unit-level orders are disabled in the back end, through the use of a feature flag, for all customers who install SAP Commerce Cloud manually, that is, without an installation script.

To enable the feature, change the value of the b2bcommerce.unitlevelorders.enabled property in hybris/bin/modules/b2b-commerce/b2bcommerce/project.properties to “true”.

By default, unit-level orders are enabled in the back end, through the use of a feature flag, for all customers who install SAP Commerce Cloud based on the cx_old_occ recipe. Here, the b2bcommerce.unitlevelorders.enabled property in installer/recipes/cx_old_occ/build.gradle is set to “true”. The same setting applies to all available recipes.

Disabling Unit-Level Orders

To disable unit-level orders, you can revert the value of b2bcommerce.unitlevelorders.enabled to “false”.

Configuring

No special configuration is required.

Extending

No special extensibility is available for this feature.

Limitations

  • In both Units and Users workflows, a B2B Administrator can only assign the right to view unit-level orders to individuals, not user groups. This is in line with a general rule that an admin of the composable storefront manages roles and rights only on the user level. Even if authorized Backoffice users can assign rights to user groups so that all group members inherit the respective permissions, such assignments aren't supported by and shown in the composable storefront. Therefore, to benefit from unit-level orders, the right must always be assigned on a user-by-user basis.

  • The unit-level order details view doesn't include a dedicated component for Customer Approval Details because pertinent information is fetched through a different endpoint.