mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Shop] Reorganize Twig hooks on cart index page (#17364)
| Q | A |-----------------|----- | Branch? | 2.0 | Bug fix? | no | New feature? | no | BC breaks? | not yet | Deprecations? | no | Related tickets | | License | MIT <!-- - Bug fixes must be submitted against the 1.13 branch - Features and deprecations must be submitted against the 1.14 branch - Features, removing deprecations and BC breaks must be submitted against the 2.0 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> 
This commit is contained in:
commit
fb080519d7
31 changed files with 44 additions and 41 deletions
|
|
@ -173,7 +173,7 @@ class SummaryPage extends ShopPage implements SummaryPageInterface
|
|||
|
||||
public function cartIsEmpty(): bool
|
||||
{
|
||||
return str_contains($this->getElement('flash_message')->getText(), 'Your cart is empty');
|
||||
return str_contains($this->getElement('flash_message_info')->getText(), 'Your cart is empty');
|
||||
}
|
||||
|
||||
public function getQuantity(string $productName): int
|
||||
|
|
@ -226,7 +226,7 @@ class SummaryPage extends ShopPage implements SummaryPageInterface
|
|||
'checkout_button' => '[data-test-cart-checkout-button]',
|
||||
'clear_cart' => '[data-test-clear-cart]',
|
||||
'coupon_field' => '[data-test-cart-promotion-coupon-input]',
|
||||
'flash_message' => '[data-test-sylius-flash-message]',
|
||||
'flash_message_info' => '[data-test-sylius-flash-message="alert-info"]',
|
||||
'form' => '[data-live-name-value="sylius_shop:cart:form"]',
|
||||
'summary_component' => '[data-live-name-value="sylius_shop:cart:summary"]',
|
||||
'grand_total' => '[data-test-cart-grand-total]',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
sylius_twig_hooks:
|
||||
hooks:
|
||||
'sylius_shop.cart.index':
|
||||
content:
|
||||
template: '@SyliusShop/cart/index/content.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.content':
|
||||
form:
|
||||
component: 'sylius_shop:cart:form'
|
||||
props:
|
||||
resource: '@=_context.cart'
|
||||
template: '@SyliusShop/cart/index/form.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form.html.twig'
|
||||
priority: 100
|
||||
suggested_products:
|
||||
component: 'sylius_shop:product:list'
|
||||
|
|
@ -16,106 +21,106 @@ sylius_twig_hooks:
|
|||
title: 'sylius.ui.you_may_also_like'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.header':
|
||||
'sylius_shop.cart.index.content.header':
|
||||
flashes:
|
||||
enabled: false
|
||||
|
||||
'sylius_shop.cart.index.form':
|
||||
'sylius_shop.cart.index.content.form':
|
||||
sections:
|
||||
template: '@SyliusShop/cart/index/form/sections.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections':
|
||||
'sylius_shop.cart.index.content.form.sections':
|
||||
flashes:
|
||||
template: "@SyliusShop/shared/flashes.html.twig"
|
||||
priority: 200
|
||||
header:
|
||||
template: '@SyliusShop/cart/index/form/sections/header.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/header.html.twig'
|
||||
priority: 100
|
||||
general:
|
||||
template: '@SyliusShop/cart/index/form/sections/general.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general#left':
|
||||
'sylius_shop.cart.index.content.form.sections.general#left':
|
||||
items:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items.html.twig'
|
||||
priority: 200
|
||||
coupon:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/coupon.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/coupon.html.twig'
|
||||
priority: 100
|
||||
clear_cart:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/clear_cart.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/clear_cart.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general#right':
|
||||
'sylius_shop.cart.index.content.form.sections.general#right':
|
||||
summary:
|
||||
component: 'sylius_shop:cart:summary'
|
||||
props:
|
||||
cart: '@=_context.cart'
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary.html.twig'
|
||||
priority: 100
|
||||
checkout:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/checkout.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/checkout.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general.items':
|
||||
'sylius_shop.cart.index.content.form.sections.general.items':
|
||||
head:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head.html.twig'
|
||||
priority: 100
|
||||
body:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general.items.head':
|
||||
'sylius_shop.cart.index.content.form.sections.general.items.head':
|
||||
remove:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head/remove.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head/remove.html.twig'
|
||||
priority: 400
|
||||
item:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head/item.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head/item.html.twig'
|
||||
priority: 300
|
||||
unit_price:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head/unit_price.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head/unit_price.html.twig'
|
||||
priority: 200
|
||||
quantity:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head/quantity.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head/quantity.html.twig'
|
||||
priority: 100
|
||||
total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/head/total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/head/total.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general.items.body':
|
||||
'sylius_shop.cart.index.content.form.sections.general.items.body':
|
||||
remove:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body/remove.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body/remove.html.twig'
|
||||
priority: 400
|
||||
item:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body/item.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body/item.html.twig'
|
||||
priority: 300
|
||||
unit_price:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body/unit_price.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body/unit_price.html.twig'
|
||||
priority: 200
|
||||
quantity:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body/quantity.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body/quantity.html.twig'
|
||||
priority: 100
|
||||
total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/items/body/total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/items/body/total.html.twig'
|
||||
priority: 0
|
||||
|
||||
'sylius_shop.cart.index.form.sections.general.summary':
|
||||
'sylius_shop.cart.index.content.form.sections.general.summary':
|
||||
items_total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/items_total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/items_total.html.twig'
|
||||
priority: 500
|
||||
discount:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/discount.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/discount.html.twig'
|
||||
priority: 400
|
||||
estimated_cost:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/estimated_cost.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/estimated_cost.html.twig'
|
||||
priority: 300
|
||||
taxes_total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/taxes_total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/taxes_total.html.twig'
|
||||
priority: 200
|
||||
order_total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/order_total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/order_total.html.twig'
|
||||
priority: 100
|
||||
base_currency_order_total:
|
||||
template: '@SyliusShop/cart/index/form/sections/general/summary/base_currency_order_total.html.twig'
|
||||
template: '@SyliusShop/cart/index/content/form/sections/general/summary/base_currency_order_total.html.twig'
|
||||
priority: 0
|
||||
|
|
|
|||
|
|
@ -6,7 +6,5 @@
|
|||
{% block title %}{{ 'sylius.ui.your_shopping_cart'|trans }} | {{ parent() }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4 mb-5">
|
||||
{% hook cart_hook with { cart, form } %}
|
||||
</div>
|
||||
{% hook cart_hook with { cart, form } %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue