Install the Cart feature
Edit on GitHubThe following feature integration guide expects the basic feature to be in place.
The current feature integration guide only adds the Add product to cart from the Catalog page functionality.
Install feature core
Follow the steps below to install the core of the functionality.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Spryker Core | 202404.0 | Install the Spryker Core feature |
1) Install the required modules
composer require spryker-feature/cart 202404.0 --update-with-dependencies
2) Add translations
- Append glossary according to your configuration:
src/data/import/glossary.csv
global.add-to-cart,In den Warenkorb,de_DE
global.add-to-cart,Add to Cart,en_US
cart_page.error_message.unexpected_error,Unexpected error occurred.,en_US
cart_page.error_message.unexpected_error,Ein unerwarteter Fehler aufgetreten.,de_DE
- Import data:
console data:import glossary
Make sure that above keys and corresponding translations are present in the spy_glossary_key
and spy_glossary_translation
tables.
Install feature frontend
Follow the steps below to install the frontend of the functionality.
Prerequisites
Install the required features:
NAME | VERSION | INSTALLATION GUIDE |
---|---|---|
Spryker Core | 202404.0 | Install the Spryker Core feature |
1) Install the required modules
composer require spryker-feature/cart 202404.0 --update-with-dependencies
Make sure that the following modules have been installed:
MODULE | EXPECTED DIRECTORY |
---|---|
CartPage | vendor/spryker-shop/cart-page |
2) Set up widgets
Register the following widgets:
PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
---|---|---|---|
ProductAbstractAddToCartButtonWidget | Displays a button for adding the product abstract to the cart in case the product is eligible. | None | SprykerShop\Yves\CartPage\Widget |
src/Pyz/Yves/ShopApplication/ShopApplicationDependencyProvider.php
<?php
namespace Pyz\Yves\ShopApplication;
use SprykerShop\Yves\CartPage\Widget\ProductAbstractAddToCartButtonWidget;
use SprykerShop\Yves\ShopApplication\ShopApplicationDependencyProvider as SprykerShopApplicationDependencyProvider;
class ShopApplicationDependencyProvider extends SprykerShopApplicationDependencyProvider
{
/**
* @return string[]
*/
protected function getGlobalWidgets(): array
{
return [
ProductAbstractAddToCartButtonWidget::class,
];
}
}
Enable Javascript and CSS changes:
console frontend:yves:build
Navigate to the catalog and find an abstract product with a single concrete product. The button for adding this concrete product to the cart must be displayed on the catalog page.
Thank you!
For submitting the form