Skip to content

Commit 141a722

Browse files
Merge pull request #2799 from spryker/bugfix/cc-13685-catalog-add-to-cart
CC-13685: Updated product quantity and total in Mini Cart Widget from catalog AJAX add-to-cart action.
2 parents 3a0d2a4 + c4968f9 commit 141a722

File tree

1 file changed

+91
-8
lines changed

1 file changed

+91
-8
lines changed

_includes/pbc/all/install-features/202407.0/install-the-cart-feature.md

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ Make sure the following modules have been installed:
9898

9999
Set up the following configuration:
100100

101-
| CONFIGURATION | SPECIFICATION | NAMESPACE |
102-
|----------------------------------------------------------------|--------------------------------------------------|---------------------------|
103-
| CartPageConfig::IS_CART_CART_ITEMS_VIA_AJAX_LOAD_ENABLED | Enables the loading of cart items via AJAX. | SprykerShop\Yves\CartPage |
104-
| CartPageConfig::IS_LOADING_UPSELLING_PRODUCTS_VIA_AJAX_ENABLED | Enables the loading of upselling products via AJAX. | SprykerShop\Yves\CartPage |
105-
| CartPageConfig::IS_CART_ACTIONS_ASYNC_MODE_ENABLED | Enables the performing of cart actions via AJAX. | SprykerShop\Yves\CartPage |
101+
| CONFIGURATION | SPECIFICATION | NAMESPACE |
102+
|----------------------------------------------------------------|----------------------------------------------------------------------|------------------------------|
103+
| CartPageConfig::IS_CART_CART_ITEMS_VIA_AJAX_LOAD_ENABLED | Enables cart items to be loaded via AJAX. | SprykerShop\Yves\CartPage |
104+
| CartPageConfig::IS_LOADING_UPSELLING_PRODUCTS_VIA_AJAX_ENABLED | Enables upselling products to be loaded via AJAX. | SprykerShop\Yves\CartPage |
105+
| CartPageConfig::IS_CART_ACTIONS_ASYNC_MODE_ENABLED | Enables cart actions to be performed via AJAX. | SprykerShop\Yves\CartPage |
106+
| CatalogPageConfig::IS_MINI_CART_ASYNC_MODE_ENABLED | Enables mini cart to be rendered async during the AJAX add to cart action. | SprykerShop\Yves\CatalogPage |
106107

107108
**src/Pyz/Yves/CartPage/CartPageConfig.php**
108109

@@ -130,18 +131,41 @@ class CartPageConfig extends SprykerCartPageConfig
130131
*/
131132
protected const IS_CART_ACTIONS_ASYNC_MODE_ENABLED = true;
132133
}
133-
134134
```
135135

136136
{% info_block warningBox "Verification" %}
137137

138-
Make sure the following applies:
138+
Make sure the following applies on the **Cart** page:
139139
- Cart items are loaded via AJAX.
140140
- Upselling products are loaded via AJAX.
141141
- Cart actions, like changing item quantity or removing an item, are performed via AJAX.
142142

143143
{% endinfo_block %}
144144

145+
**src/Pyz/Yves/CatalogPage/CatalogPageConfig.php**
146+
147+
```php
148+
<?php
149+
150+
namespace Pyz\Yves\CatalogPage;
151+
152+
use SprykerShop\Yves\CatalogPage\CatalogPageConfig as SprykerCatalogPageConfig;
153+
154+
class CatalogPageConfig extends SprykerCatalogPageConfig
155+
{
156+
/**
157+
* @var bool
158+
*/
159+
protected const IS_MINI_CART_ASYNC_MODE_ENABLED = true;
160+
}
161+
```
162+
163+
{% info_block warningBox "Verification" %}
164+
165+
Make sure that, on the **Catalog** page, cart actions, like changing item quantity or removing an item, are performed via AJAX.
166+
167+
{% endinfo_block %}
168+
145169
### 3) Enable controllers
146170

147171
Register the following route providers on the Storefront:
@@ -199,7 +223,66 @@ class RouterDependencyProvider extends SprykerRouterDependencyProvider
199223

200224
{% endinfo_block %}
201225

202-
### 4) Set up widgets
226+
### 4) Set up behavior
227+
228+
1. Activate the following plugins:
229+
230+
| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
231+
|--------------------------------------|------------------------------------------------------------------|---------------|-------------------------------------------|
232+
| CartBlockMiniCartViewExpanderPlugin | Expands the provided `MiniCartView.content` with a mini cart view. | | SprykerShop\Yves\CartPage\Plugin\CartPage |
233+
234+
**src/Pyz/Yves/Router/RouterDependencyProvider.php**
235+
236+
```php
237+
<?php
238+
239+
namespace Pyz\Yves\CartPage;
240+
241+
use SprykerShop\Yves\CartPage\CartPageDependencyProvider as SprykerCartPageDependencyProvider;
242+
use SprykerShop\Yves\CartPage\Plugin\CartPage\CartBlockMiniCartViewExpanderPlugin;
243+
244+
class CartPageDependencyProvider extends SprykerCartPageDependencyProvider
245+
{
246+
/**
247+
* @return array<\SprykerShop\Yves\CartPageExtension\Dependency\Plugin\MiniCartViewExpanderPluginInterface>
248+
*/
249+
protected function getMiniCartViewExpanderPlugins(): array
250+
{
251+
return [
252+
new CartBlockMiniCartViewExpanderPlugin(),
253+
];
254+
}
255+
}
256+
```
257+
258+
259+
2. B2C Shop: Add the following configuration:
260+
261+
**src/Pyz/Yves/CartPage/CartPageConfig.php**
262+
263+
```php
264+
<?php
265+
266+
namespace Pyz\Yves\CartPage;
267+
268+
use SprykerShop\Yves\CartPage\CartPageConfig as SprykerCartPageConfig;
269+
270+
class CartPageConfig extends SprykerCartPageConfig
271+
{
272+
/**
273+
* @var string
274+
*/
275+
protected const CART_BLOCK_MINI_CART_VIEW_TEMPLATE_PATH = '@ShopUi/components/organisms/navigation-top-async/navigation-top-async.twig';
276+
}
277+
```
278+
279+
{% info_block warningBox "Verification" %}
280+
281+
Make sure that, on the **Cart** page, cart actions, like changing item quantity or removing an item, are reflected in the mini cart.
282+
283+
{% endinfo_block %}
284+
285+
### 5) Set up widgets
203286

204287
1. Register the following widgets:
205288

0 commit comments

Comments
 (0)