Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ibexa Global Partner Conference 2024

Avatar for Artur Artur
January 15, 2024
32

Ibexa Global Partner Conference 2024

Take a look under the hood and get inspired by flexibility of the Ibexa Commerce solution, the embedded PIM and Ibexa Connect and their interoperability. Get to know how easy they can be extended and configured to replicate daily business use cases.

With the power of Ibexa Connect you will see live examples of following use cases:
- Custom checkout workflow
- Product availability on the fly
- Product Pricing
- Order synchronization
- Customer Portal enrichment with remote data

Avatar for Artur

Artur

January 15, 2024

Transcript

  1. About me • Artur Wawrzynkiewicz Enterprise Solution Architect DACH •

    At Ibexa 3,5 years, over 12 years experience within Ibexa and eZ ecosystem • Passionate car enthusiast • [email protected] • https://www.linkedin.com/in/artur-wawrzynkiewicz
  2. Agenda Use Case 1: Product availability at Checkout Use Case

    2: Low-Level PIM Product availability Use Case 3: Low-Level PIM Product pricing Use Case 4: Order Synchronisation Q & A Agenda - Practical example of integration with ERP system
  3. Use Case 1: Implementation Steps • YAML Workflow configuration •

    Places & Transitions in Workflow • Custom Controller Configure Workflow 1 • Handle workflow Steps • Form Control • Connect Service Implement Step Controller 2 • UI for User interaction • Storefront Components Add Templates and Assets 3 • Handle Request & Parameters • Query External Service (ERP) • Transform Payload Design Connect Scenario 4
  4. ibexa: framework: workflows: product_availability_checkout: places: - initialized - product_availability -

    ... transitions: check_product_availability: from: - initialized to: - product_availability metadata: next_step: select_address controller: App\Controller\Checkout\Step\ProductAvailabilityController label: 'Verify product availability' services.yaml
  5. Use Case 1: Sum Up – What and where https://doc.ibexa.co/en/master/commerce/checkout/customize_checkout/

    Scope Description config/packages/workflow_checkout.yaml YAML configuration of custom checkout Controller/Checkout/Step/ProductAvailabilityController.php Step Controller during Workflow Form/Type/ProductAvailabilityType.php Form Type templates/themes/storefront/checkout/step/product_availability.html.twig Step Template public/assets/qntm_motors/images/* Additional assets Documentation Reference: File additions and adjustments
  6. Use Case 2: Implementation Steps • Custom Product Availability Strategy

    • Service injection with proper priority Availability Strategy 1 • Cover non-Local Persistence • Inject custom Gateway • API Level CRUD Implement Connect Handler 2 • Forwarding Requests to Ibexa Connect • Abstract to Handle Requests & Headers • Data Schema • Persistence CRUD Operations Implement Connect Gateway 3 • Handle Requests & Parameters • Query external Services (ERP) • Transform Payload Design Connect Scenario 4
  7. App\ProductCatalog\Connect\Repository\ProductAvailabilityStrategy: arguments: $handler: '@App\ProductCatalog\Connect\Persistence\ProductAvailability\Handler' tags: - { name: ibexa.product_catalog.availability.strategy, priority:

    10 } App\ProductCatalog\Connect\Persistence\ProductAvailability\Handler: arguments: $gateway: '@App\ProductCatalog\Connect\Persistence\ProductAvailability\Gateway\Connect' services.yaml
  8. final class ProductAvailabilityStrategy implements ProductAvailabilityStrategyInterface { ... public function accept(AvailabilityContextInterface

    $context): bool { return $this->connectService->isAlive() && $context instanceof AvailabilityContext; } ... } services.yaml
  9. Scope Description config/services.yaml Service definitions ProductCatalog/Connect/Repository/ProductAvailabilityStrategy.php Connect Strategy Provider ProductCatalog/Connect/Persistence/ProductAvailability/Handler.php

    Connect Handler ProductCatalog/Connect/Persistence/ProductAvailability/Gateway/Connect.php API Level Gateway ProductCatalog/Connect/Persistence/ProductAvailability/Gateway/ConnectSchema.php Communication Schema ProductCatalog/Connect/Persistence/ProductAvailability/Contracts/AbstractAvailabilityGateway.php Abstract Methods ProductCatalog/Contracts/CorePersistence/Gateway/AbstractConnect.php Core Methods & Service initialization ProductCatalog/Contracts/CorePersistence/Gateway/GatewayInterface.php "Doctrine-Less" Interface Use Case 2: Sum up – What and where
  10. Use Case 3: Implementation Steps • Custom PriceService decorator •

    Implement only required use cases • Pricing handling by discriminator Price Service Decorator 1 • Cover non-Local Persistence • Inject custom Gateway • API Level CRUD Implement Connect Handler 2 • Forwarding Requests to Ibexa Connect • Abstract to Handle Requests & Headers • Data Schema • Persistence CRUD Operations Implement Connect Gateway 3 • Handle Requests & Parameters • Query external Services (ERP) • Transform Payload Design Connect Scenario 4
  11. App\ProductCatalog\Connect\ProductPriceServiceDecorator: decorates: Ibexa\Contracts\ProductCatalog\ProductPriceServiceInterface arguments: $innerService: '@.inner' $handler: '@App\ProductCatalog\Connect\Persistence\ProductPrice\Handler' App\ProductCatalog\Connect\Persistence\ProductPrice\Handler: arguments:

    $gateway: '@App\ProductCatalog\Connect\Persistence\ProductPrice\Gateway\Connect' App\ProductCatalog\Connect\Persistence\ProductPrice\Inheritance\DomainObjectBuilder: arguments: $domainMappers: !tagged_iterator 'ibexa.product_catalog.product_price.inheritance.domain_mapper' services.yaml
  12. ProductPriceServiceDecorator public function findPricesByProductCode(string $code): PriceListInterface { $product = $this->productService->getProduct($code);

    $prices = $this->handler->findBy([ 'product_code' => $code, 'discriminator' => 'main', ]); $results = []; foreach ($prices as $price) { $results[] = $this->domainObjectBuilder->buildDomainPriceObject($price, $product); } return new PriceList($results, count($results)); } public function findOneForCustomerGroup(PriceInterface $price, CustomerGroupInterface $customerGroup): ?CustomPriceAwareInterface { return parent::findOneForCustomerGroup($price, $customerGroup); }
  13. Use Case 3: Sum Up – What and where Scope

    Description config/services.yaml Service definitions ProductCatalog/Connect/ProductPriceServiceDecorator.php Service Decorator ProductCatalog/Connect/Persistence/ProductPrice/Handler.php Connect Handler ProductCatalog/Connect/Persistence/ProductPrice/Gateway/Connect.php API Level Gateway ProductCatalog/Connect/Persistence/ProductPrice/Gateway/ConnectSchema.php Communication Schema ProductCatalog/Connect/Persistence/ProductPrice/GatewayInterface.php Abstract Methods ProductCatalog/Connect/Persistence/ProductPrice/Contracts/AbstractPriceGateway.php Core Methods & Service initialization ProductCatalog/Connect/Persistence/ProductPrice/Inheritance/DomainObjectBuilder.php DO Builder ProductCatalog/Connect/Persistence/ProductPrice/Inheritance/DomainObjectBuilderInterface.php Builder Interface
  14. Use Case 4: Sum Up – What and where File

    additions and adjustments Scope Description config/services.yaml ~ config/packages/connect_block.yaml ~ Subscriber/CreateOrderSubscriber.php ~ templates/themes/standard/blocks/connect/orders.html.twig ~ Documentation References: https://doc.ibexa.co/en/latest/api/event_reference/order_management_events/ https://doc.ibexa.co/en/master/content_management/pages/ibexa_connect_scenario_block/
  15. Thank you! https://doc.ibexa.co/ Ibexa Connect & Ibexa API documentation https://speakerdeck.com/wawrzynkiewicz/ibexa-global-partner-conference-2024

    Code examples in Dedicated branches on github https://github.com/ibexa/gpc-2024-pim-connect-examples