-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add possibility to save the cart to offcanvas cart (#40)
Co-authored-by: Janko <[email protected]>
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{% sw_extends '@Storefront/storefront/component/checkout/offcanvas-cart.html.twig' %} | ||
|
||
{% block component_offcanvas_cart_actions_cart %} | ||
{{ parent() }} | ||
|
||
{% if config('FroshPlatformShareBasket.config.showSaveCartButtonInOffcanvas') %} | ||
{% block frosh_share_basket_offcanvas %} | ||
{% if page.froshShareBasketState == 'cartExists' %} | ||
{% block frosh_share_basket_offcanvas_existing_cart %} | ||
{% sw_include '@Storefront/storefront/utilities/frosh-share-basket.html.twig' with { | ||
froshShareBasketUrl: page.froshShareBasketUrl, | ||
froshShareBasketState: page.froshShareBasketState, | ||
} %} | ||
{% endblock %} | ||
{% elseif page.froshShareBasketState != 'cartLoaded' %} | ||
{% set froshBasketAjaxSubmitOptions = { | ||
replaceSelectors: ".js-frosh-share-basket-container", | ||
submitOnce: true, | ||
} %} | ||
|
||
{% block frosh_share_basket_offcanvas_form %} | ||
<div class="js-frosh-share-basket-container" data-frosh-share-basket-buttons="true"> | ||
<form action="{{ path('frontend.frosh.share-basket.save') }}" | ||
method="post" | ||
class="js-frosh-share-basket-form" | ||
data-form-ajax-submit="true" | ||
data-form-ajax-submit-options="{{ froshBasketAjaxSubmitOptions|json_encode }}"> | ||
{% block frosh_share_basket_offcanvas_save_button %} | ||
<button type="submit" class="btn btn-link w-100"> | ||
{{ "frosh-share-basket.saveCart"|trans }} | ||
</button> | ||
{% endblock %} | ||
</form> | ||
</div> | ||
{% endblock %} | ||
{% endif %} | ||
{% endblock %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters