Cart feature integration
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
Prerequisites
To start feature integration, overview and install the necessary features:
Name | Version |
---|---|
Spryker Core | 202009.0 |
1) Install the required modules using Composer
Run the following command(s) to install the required modules:
composer require spryker-feature/cart 202009.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
Run the following console command to 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
Prerequisites
Please overview and install the necessary features before beginning the integration step. | Name | Version | | — | — | | Spryker Core | 202009.0 |
1) Install the required modules using Composer
Run the following command(s) to install the required modules:
composer require spryker-feature/cart 202009.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,
];
}
}
Run the following command to enable Javascript and CSS changes:
console frontend:yves:build
Navigate to catalog and find an abstract product with single concrete. You should see a button for adding this concrete product to the cart right from the catalog page.
Thank you!
For submitting the form