Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-29675 Shipment Type support on Checkout & OMS #2058

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@



This document describes how to ingrate the [Order Management](/docs/scos/user/features/{{page.version}}/order-management-feature-overview/order-management-feature-overview.html) + [Inventory Management](/docs/pbc/all/warehouse-management-system/{{page.version}}/base-shop/inventory-management-feature-overview.html) feature into a Spryker project.
This document describes how to integrate the [Order Management](/docs/scos/user/features/{{page.version}}/order-management-feature-overview/order-management-feature-overview.html) + [Inventory Management](/docs/pbc/all/warehouse-management-system/{{page.version}}/base-shop/inventory-management-feature-overview.html) features into a Spryker project.

{% info_block errorBox %}

Expand All @@ -22,9 +22,9 @@ Follow the steps below to install the Order Management + Inventory Management fe

To start feature integration, integrate the required features:

| NAME | VERSION | INTEGRATION GUIDE |
|--------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| Order Management | {{page.version}} | [Order Management feature integration](/docs/scos/dev/feature-integration-guides/{{page.version}}/order-management-feature-integration.html)
| NAME | VERSION | INTEGRATION GUIDE |
|----------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| Order Management | {{page.version}} | [Order Management feature integration](/docs/scos/dev/feature-integration-guides/{{page.version}}/order-management-feature-integration.html) |
| Inventory Management | {{page.version}} | [Inventory Management feature integration](docs/scos/dev/feature-integration-guides/{{page.version}}/install-the-inventory-management-feature.md) |


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@


This document describes how to integrate the [Order Management](/docs/scos/user/features/{{page.version}}/order-management-feature-overview/order-management-feature-overview.html) + [Shipment](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/shipment-feature-overview.html) features into a Spryker project.

{% info_block errorBox %}

The following features integration guide expects the basic feature to be in place.

The feature integration guide adds the following functionality:

* [Order Management](/docs/scos/user/features/{{page.version}}/order-management-feature-overview/order-management-feature-overview.html)
* [Shipment](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/shipment-feature-overview.html)

{% endinfo_block %}

## Install feature core

Follow the steps below to install the Order Management + Shipment feature.

### Prerequisites

To start feature integration, integrate the required features:

| NAME | VERSION | INTEGRATION GUIDE |
|------------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Order Management | {{page.version}} | [Order Management feature integration](/docs/scos/dev/feature-integration-guides/{{page.version}}/order-management-feature-integration.html) |
| Shipment | {{page.version}} | [Shipment feature integration](/docs/pbc/all/carrier-management/{{page.version}}/unified-commerce/enhanced-click-and-collect/install-and-upgrade/install-the-shipment-feature.html) |


## 1) Install the required modules using Composer

```bash
composer require spryker/sales-shipment-type:"^0.1.0" --update-with-dependencies
dmiseev marked this conversation as resolved.
Show resolved Hide resolved
```

{% info_block warningBox "Verification" %}

Make sure that the following module has been installed:

| MODULE | EXPECTED DIRECTORY |
|--------------------|------------------------------------|
| SalesShipmentType | vendor/spryker/sales-shipment-type |

{% endinfo_block %}

### 2) Set up the database schema and transfer objects

Apply the database changes and generate entity and transfer changes:

```bash
console propel:install
console transfer:generate
```

{% info_block warningBox "Verification" %}

Make sure that the following changes have been applied by checking your database:

| DATABASE ENTITY | TYPE | EVENT |
|-------------------------------------|--------|---------|
| spy_sales_shipment_type | table | created |
| spy_sales_shipment.fk_shipment_type | column | created |

Make sure that the following changes have been triggered in transfer objects:

| TRANSFER | TYPE | EVENT | PATH |
|-------------------|-------|---------|---------------------------------------------------------|
| SalesShipmentType | class | created | src/Generated/Shared/Transfer/SalesShipmentTypeTransfer |

{% endinfo_block %}

### 3) Set up behavior

Enable the following plugins:

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------|---------------|----------------------------------------------------------|
| ShipmentTypeOrderItemsPostSavePlugin | Persists shipment type data to `spy_sales_shipment_type` table and updates `spy_sales_shipment` with `fk_shipment_type`. | | Spryker\Zed\SalesShipmentType\Communication\Plugin\Sales |


**src/Pyz/Zed/Sales/SalesDependencyProvider.php**

```php
<?php

namespace Pyz\Zed\Sales;

use Spryker\Zed\Sales\SalesDependencyProvider as SprykerSalesDependencyProvider;
use Spryker\Zed\SalesShipmentType\Communication\Plugin\Sales\ShipmentTypeOrderItemsPostSavePlugin;

class SalesDependencyProvider extends SprykerSalesDependencyProvider
{
/**
* @return list<\Spryker\Zed\SalesExtension\Dependency\Plugin\OrderItemsPostSavePluginInterface>
*/
protected function getOrderItemsPostSavePlugins(): array
{
return [
new ShipmentTypeOrderItemsPostSavePlugin(),
dmiseev marked this conversation as resolved.
Show resolved Hide resolved
];
}
}
```

{% info_block warningBox "Verification" %}

Make sure that when you place an order, the selected shipment type is persisted to `spy_sales_shipment_type` and `spy_sales_shipment.fk_sales_shipment_type` is updated.

{% endinfo_block %}
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,40 @@ Make sure that during checkout on the Shipment step, you can only see shipment m

{% endinfo_block %}

6. To enable the Backend API, register these plugins:
6. Configure the shipment type validation plugin:

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|----------------------------------------|-------------------------------------------------------------------------------------------------------------|---------------|---------------------------------------------------------------------------------------------------|
| ShipmentTypeCheckoutPreConditionPlugin | Validates if selected shipment type have relation to selected shipment method, current store and is active. | | Spryker\Zed\ShipmentTypeCart\Communication\Plugin\Checkout\ShipmentTypeCheckoutPreConditionPlugin |
dmiseev marked this conversation as resolved.
Show resolved Hide resolved

**src/Pyz/Zed/Checkout/CheckoutDependencyProvider.php**

```php
<?php

namespace Pyz\Zed\Checkout;

use Spryker\Zed\Checkout\CheckoutDependencyProvider as SprykerCheckoutDependencyProvider;
use Spryker\Zed\Kernel\Container;
use Spryker\Zed\ShipmentTypeCart\Communication\Plugin\Checkout\ShipmentTypeCheckoutPreConditionPlugin;

class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
*/
protected function getCheckoutPreConditions(Container $container): array
{
return [
new ShipmentTypeCheckoutPreConditionPlugin(),
];
}
}
```

7. To enable the Backend API, register these plugins:

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|------------------------------------|------------------------------------------|---------------|-----------------------------------------------------------------------|
Expand Down Expand Up @@ -1076,7 +1109,32 @@ Ensure that the following modules have been installed:

{% endinfo_block %}

### 2) Set up Behavior
### 2) Add translations

Add translations as follows:

1. Append glossary according to your configuration:

**src/data/import/glossary.csv**

```csv
shipment_type.checkout.validation.error,Selected delivery type "%name%" is not available,en_US
dmiseev marked this conversation as resolved.
Show resolved Hide resolved
shipment_type.checkout.validation.error,Die ausgewählte Lieferart "%name%" ist nicht verfügbar,de_DE
```

2. Import data:

```bash
console data:import glossary
```

{% info_block warningBox "Verification" %}

Make sure that the configured data has been added to the `spy_glossary` table in the database.

{% endinfo_block %}

### 3) Set up Behavior

Enable the following behaviors by registering the plugins:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Install the Order Management + Shipment feature
description: Learn how to integrate the Order Management + Shipment feature in your project
last_updated: Aug 1, 2023
template: feature-integration-guide-template
---

{% include pbc/all/install-features/202204.0/install-the-order-management-shipment-feature.md %} <!-- To edit, see /_includes/pbc/all/install-features/202204.0/install-the-order-management-shipment-feature.md -->