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

Install the Service Points Cart + Checkout feature #2223

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@


This document describes how to integrate the Service Points Cart + Checkout feature into a Spryker project.

## Install feature core

Follow the steps below to install the Service Points Cart + Checkout feature.

### Prerequisites

To start feature integration, integrate the required features:

| NAME | VERSION | INTEGRATION GUIDE |
|---------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Service Points Cart | {{page.version}} | [Install the Service Points Cart feature](/docs/pbc/all/service-points/{{page.version}}/unified-commerce/install-and-upgrade/install-the-service-points-cart-feature.html) |
| Checkout | {{page.version}} | [Install the Checkout feature](/docs/scos/dev/feature-integration-guides/{{page.version}}/checkout-feature-integration.html) |

### 1) Install the required modules using Composer

We offer the example Click & Collect service point cart replacement strategies. To use them, install the following module:

```bash
composer require spryker/click-and-collect-example: "^0.3.0" --update-with-dependencies
```

{% info_block warningBox "Verification" %}

Make sure that the following module has been installed:

| MODULE | EXPECTED DIRECTORY |
|------------------------|------------------------------------------|
| ClickAndCollectExample | vendor/spryker/click-and-collect-example |

{% endinfo_block %}

### 2) Set up transfer objects

Generate transfer changes:

```bash
console transfer:generate
```

{% info_block warningBox "Verification" %}

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

| TRANSFER | TYPE | EVENT | PATH |
|----------------------------------|-------|---------|------------------------------------------------------------------------|
| QuoteError | class | created | src/Generated/Shared/Transfer/QuoteErrorTransfer |
| QuoteResponse | class | created | src/Generated/Shared/Transfer/QuoteResponseTransfer |
| Quote | class | created | src/Generated/Shared/Transfer/QuoteTransfer |
| Item | class | created | src/Generated/Shared/Transfer/ItemTransfer |
| Currency | class | created | src/Generated/Shared/Transfer/CurrencyTransfer |
| Store | class | created | src/Generated/Shared/Transfer/StoreTransfer |
| ServicePoint | class | created | src/Generated/Shared/Transfer/ServicePointTransfer |
| ShipmentType | class | created | src/Generated/Shared/Transfer/ShipmentTypeTransfer |
| Shipment | class | created | src/Generated/Shared/Transfer/ShipmentTransfer |
| ProductOffer | class | created | src/Generated/Shared/Transfer/ProductOfferTransfer |
| ProductOfferServicePoint | class | created | src/Generated/Shared/Transfer/ProductOfferServicePointTransfer |
| ProductOfferServicePointCriteria | class | created | src/Generated/Shared/Transfer/ProductOfferServicePointCriteriaTransfer |
| ProductOfferPrice | class | created | src/Generated/Shared/Transfer/ProductOfferPriceTransfer |
| ProductOfferStock | class | created | src/Generated/Shared/Transfer/ProductOfferStockTransfer |

{% endinfo_block %}

### 2) Set up behavior

1. Register plugins:

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|---------------------------------------------------|-------------------------------------------------|---------------|-------------------------------------------------------|
| ServicePointCheckoutAddressStepPostExecutePlugin | Replaces quote items using applicable strategy. | None | SprykerShop\Yves\ServicePointCartPage\Plugin\CartPage |

**src/Pyz/Yves/CheckoutPage/CheckoutPageDependencyProvider.php**

```php
<?php

/**
* This file is part of the Spryker Suite.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/

namespace Pyz\Yves\CheckoutPage;

use SprykerShop\Yves\CheckoutPage\CheckoutPageDependencyProvider as SprykerShopCheckoutPageDependencyProvider;
use SprykerShop\Yves\ServicePointCartPage\Plugin\CartPage\ServicePointCheckoutAddressStepPostExecutePlugin;

class CheckoutPageDependencyProvider extends SprykerShopCheckoutPageDependencyProvider
{
/**
* @return list<\SprykerShop\Yves\CheckoutPageExtension\Dependency\Plugin\CheckoutAddressStepPostExecutePluginInterface>
*/
protected function getCheckoutAddressStepPostExecutePlugins(): array
{
return [
new ServicePointCheckoutAddressStepPostExecutePlugin(),
];
}
}
```

2. Enable the demo Click & Collect replacement strategy plugins:

For the demo purpose, we propose the example of the Click & Collect replacement strategy.

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|--------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|---------------|--------------------------------------------------------------------------|
| ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin | Replaces product offers in quote items that have `delivery` shipment type with suitable product offers replacements. | | Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart |
| ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin | Replaces product offers in quote items that have `pickup` shipment type with suitable product offers replacements. | | Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart |

**src/Pyz/Zed/ServicePointCart/ServicePointCartDependencyProvider.php**

```php
<?php

/**
* This file is part of the Spryker Suite.
* For full license information, please view the LICENSE file that was distributed with this source code.
*/

namespace Pyz\Zed\ServicePointCart;

use Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart\ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin;
use Spryker\Zed\ClickAndCollectExample\Communication\Plugin\ServicePointCart\ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin;
use Spryker\Zed\ServicePointCart\ServicePointCartDependencyProvider as SprykerServicePointCartDependencyProvider;

class ServicePointCartDependencyProvider extends SprykerServicePointCartDependencyProvider
{
/**
* @return list<\Spryker\Zed\ServicePointCartExtension\Dependency\Plugin\ServicePointQuoteItemReplaceStrategyPluginInterface>
*/
protected function getServicePointQuoteItemReplaceStrategyPlugins(): array
{
return [
new ClickAndCollectExampleDeliveryServicePointQuoteItemReplaceStrategyPlugin(),
new ClickAndCollectExamplePickupServicePointQuoteItemReplaceStrategyPlugin(),
];
}
}
```
abitskil marked this conversation as resolved.
Show resolved Hide resolved

{% info_block warningBox "Verification" %}

1. Create two Product Offers with `delivery` and `pickup` shipment types for the same product.
2. Add the Product Offer with `delivery` shipment type to the cart.
3. Start Checkout.
4. Go to the Address step.
5. Choose `pickup` shipment type.
6. Go to the next step.
7. Make sure that the Product Offer with `delivery` type was replaced with the Product Offer with `pickup` type.

{% endinfo_block %}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Follow the steps below to install the Service Points Cart feature.

To start feature integration, integrate the required features:

| NAME | VERSION | INTEGRATION GUIDE |
|-------------------------|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Service Points | {{page.version}} | [Install the Service Points feature](/docs/pbc/all/service-points/{{page.version}}/unified-commerce/install-and-upgrade/install-the-service-points-feature.html) |
| Cart | {{page.version}} | [Install the Cart feature](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/cart-feature-overview/cart-feature-overview.html) |
| NAME | VERSION | INTEGRATION GUIDE |
|----------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Service Points | {{page.version}} | [Install the Service Points feature](/docs/pbc/all/service-points/{{page.version}}/unified-commerce/install-and-upgrade/install-the-service-points-feature.html) |
| Cart | {{page.version}} | [Install the Cart feature](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/cart-feature-overview/cart-feature-overview.html) |

### 1) Install the required modules using Composer

Expand All @@ -25,10 +25,11 @@ composer require spryker-feature/service-points-cart: "{{page.version}}" --updat

Make sure that the following modules have been installed:

| MODULE | EXPECTED DIRECTORY |
|-------------------------|---------------------------------------------|
| ServicePointCart | vendor/spryker/service-point-cart |
| ServicePointCartPage | vendor/spryker-shop/service-point-cart-page |
| MODULE | EXPECTED DIRECTORY |
|---------------------------|---------------------------------------------|
| ServicePointCart | vendor/spryker/service-point-cart |
| ServicePointCartExtension | vendor/spryker/service-point-cart-extension |
| ServicePointCartPage | vendor/spryker-shop/service-point-cart-page |

{% endinfo_block %}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Install the Service Points Cart + Checkout feature
description: Learn how to integrate the Service Points Cart + Checkout feature into your project
last_updated: Oct 5, 2023
template: feature-integration-guide-template
---

{% include pbc/all/install-features/{{page.version}}/install-the-service-points-cart-checkout-feature.md %} <!-- To edit, see /_includes/pbc/all/install-features/202400.0/install-the-service-points-cart-checkout-feature.md/ -->