From 60e3f447ece5a2f9881d76b82cd6ae9692f98234 Mon Sep 17 00:00:00 2001 From: Nathaniel Hammond Date: Tue, 24 Oct 2023 10:16:17 +0100 Subject: [PATCH] Fixed #3313 example templates redirects for mult site installs --- example-templates/dist/shop/_private/address/list.twig | 4 ++-- .../dist/shop/_private/layouts/includes/header.twig | 2 +- example-templates/dist/shop/cart/index.twig | 2 +- example-templates/dist/shop/cart/load.twig | 2 +- example-templates/dist/shop/checkout/pay-static.twig | 2 +- example-templates/dist/shop/checkout/register-signin.twig | 2 +- example-templates/dist/shop/customer/cards.twig | 8 ++++---- example-templates/dist/shop/customer/index.twig | 2 +- example-templates/dist/shop/customer/orders.twig | 2 +- example-templates/src/shop/_private/address/list.twig | 4 ++-- .../src/shop/_private/layouts/includes/header.twig | 2 +- example-templates/src/shop/cart/index.twig | 2 +- example-templates/src/shop/cart/load.twig | 2 +- example-templates/src/shop/checkout/pay-static.twig | 2 +- example-templates/src/shop/checkout/register-signin.twig | 2 +- example-templates/src/shop/customer/cards.twig | 8 ++++---- example-templates/src/shop/customer/index.twig | 2 +- example-templates/src/shop/customer/orders.twig | 2 +- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/example-templates/dist/shop/_private/address/list.twig b/example-templates/dist/shop/_private/address/list.twig index 0acd99c1f6..77cc2cd8bd 100644 --- a/example-templates/dist/shop/_private/address/list.twig +++ b/example-templates/dist/shop/_private/address/list.twig @@ -4,12 +4,12 @@ {% set primaryShippingAddressId = primaryShippingAddressId ?? null %} {% set showDelete = showDelete ?? false %} {% set showAdd = showAdd ?? false %} -{% set addUrl = '/shop/customer/addresses/edit?redirect=' ~ craft.app.request.fullPath %} +{% set addUrl = siteUrl('shop/customer/addresses/edit?redirect=' ~ craft.app.request.pathInfo) %} {% if currentUser %}
{% for address in addresses %} - {% set editUrl = '/shop/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %} + {% set editUrl = 'shop/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.pathInfo %}
{% tag selectable ? 'label' : 'div' with { class: 'block relative address-select js-address-select', diff --git a/example-templates/dist/shop/_private/layouts/includes/header.twig b/example-templates/dist/shop/_private/layouts/includes/header.twig index 4c479235f4..b07c1b9a39 100644 --- a/example-templates/dist/shop/_private/layouts/includes/header.twig +++ b/example-templates/dist/shop/_private/layouts/includes/header.twig @@ -1,7 +1,7 @@

- + {{- siteName ~ ' Shop' -}}

diff --git a/example-templates/dist/shop/cart/index.twig b/example-templates/dist/shop/cart/index.twig index f29aa0e14c..491d2a8acc 100644 --- a/example-templates/dist/shop/cart/index.twig +++ b/example-templates/dist/shop/cart/index.twig @@ -320,7 +320,7 @@ Outputs cart. {% else %}

{{ 'Empty cart. Add items on the {link} page.'|t({ - link: tag('a', { href: url('/shop/products'), text: 'products', class: 'underline' }) + link: tag('a', { href: url('shop/products'), text: 'products', class: 'underline' }) })|raw }}

{% endif %} {% endblock %} diff --git a/example-templates/dist/shop/cart/load.twig b/example-templates/dist/shop/cart/load.twig index ff95d1c12e..dfe8d144d9 100644 --- a/example-templates/dist/shop/cart/load.twig +++ b/example-templates/dist/shop/cart/load.twig @@ -7,7 +7,7 @@ Outputs form for collecting a cart number to be loaded.
{{ csrfInput() }} {{ actionInput('commerce/cart/load-cart') }} - {{ redirectInput('/shop/cart') }} + {{ redirectInput('shop/cart') }}

{{- 'Load Cart'|t -}} diff --git a/example-templates/dist/shop/checkout/pay-static.twig b/example-templates/dist/shop/checkout/pay-static.twig index be6cb9abc2..3243e735fa 100644 --- a/example-templates/dist/shop/checkout/pay-static.twig +++ b/example-templates/dist/shop/checkout/pay-static.twig @@ -137,7 +137,7 @@ > {{ csrfInput() }} {{ hiddenInput('action', 'commerce/payments/pay') }} - {{ redirectInput('/shop/customer/order?number=' ~ cart.number ~ '&success=true') }} + {{ redirectInput('shop/customer/order?number=' ~ cart.number ~ '&success=true') }} {{ hiddenInput('cancelUrl', craft.app.request.getUrl()|hash) }} {{ hiddenInput('email', email) }} {{ hiddenInput('number', cart.number) }} diff --git a/example-templates/dist/shop/checkout/register-signin.twig b/example-templates/dist/shop/checkout/register-signin.twig index 2b43956013..19e0b2a75d 100644 --- a/example-templates/dist/shop/checkout/register-signin.twig +++ b/example-templates/dist/shop/checkout/register-signin.twig @@ -54,7 +54,7 @@ {{- 'Checkout'|t -}}

diff --git a/example-templates/dist/shop/customer/cards.twig b/example-templates/dist/shop/customer/cards.twig index d9ff069a3b..66e6c8f10c 100644 --- a/example-templates/dist/shop/customer/cards.twig +++ b/example-templates/dist/shop/customer/cards.twig @@ -33,7 +33,7 @@ {% if paymentSource.id != currentUser.primaryPaymentSourceId %} {{ csrfInput() }} - {{ redirectInput('/shop/customer/cards') }} + {{ redirectInput('shop/customer/cards') }} {{ actionInput('commerce/payment-sources/set-primary-payment-source') }} {{ hiddenInput('id', paymentSource.id) }} {{ tag('button', { @@ -45,7 +45,7 @@ {% endif %} {{ csrfInput() }} - {{ redirectInput('/shop/customer/cards') }} + {{ redirectInput('shop/customer/cards') }} {{ actionInput('commerce/payment-sources/delete') }} {{ hiddenInput('id', paymentSource.id) }} {{ tag('button', { @@ -118,8 +118,8 @@ {{ actionInput('commerce/payment-sources/add') }} {{ hiddenInput('gatewayId', gateway.id) }} {{ hiddenInput('successMessage', 'Added payment source.'|hash) }} - {{ hiddenInput('cancelUrl', '/shop/customer/cards'|hash) }} - {{ redirectInput('/shop/customer/cards') }} + {{ hiddenInput('cancelUrl', 'shop/customer/cards'|hash) }} + {{ redirectInput('shop/customer/cards') }} {% set params = {} %} diff --git a/example-templates/dist/shop/customer/index.twig b/example-templates/dist/shop/customer/index.twig index a81ea21b8f..6ac51a0473 100644 --- a/example-templates/dist/shop/customer/index.twig +++ b/example-templates/dist/shop/customer/index.twig @@ -1 +1 @@ -{% redirect '/shop/customer/orders' %} \ No newline at end of file +{% redirect 'shop/customer/orders' %} \ No newline at end of file diff --git a/example-templates/dist/shop/customer/orders.twig b/example-templates/dist/shop/customer/orders.twig index a529a91cf6..41b113970a 100644 --- a/example-templates/dist/shop/customer/orders.twig +++ b/example-templates/dist/shop/customer/orders.twig @@ -8,7 +8,7 @@ {% endset %} {% if not currentUser %} - {% redirect '/shop/customer/sign-in' %} + {% redirect 'shop/customer/sign-in' %} {% endif %} diff --git a/example-templates/src/shop/_private/address/list.twig b/example-templates/src/shop/_private/address/list.twig index 2b9cb542f0..7ac0907a1d 100644 --- a/example-templates/src/shop/_private/address/list.twig +++ b/example-templates/src/shop/_private/address/list.twig @@ -4,12 +4,12 @@ {% set primaryShippingAddressId = primaryShippingAddressId ?? null %} {% set showDelete = showDelete ?? false %} {% set showAdd = showAdd ?? false %} -{% set addUrl = '/[[folderName]]/customer/addresses/edit?redirect=' ~ craft.app.request.fullPath %} +{% set addUrl = siteUrl('[[folderName]]/customer/addresses/edit?redirect=' ~ craft.app.request.pathInfo) %} {% if currentUser %}
{% for address in addresses %} - {% set editUrl = '/[[folderName]]/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.fullPath %} + {% set editUrl = '[[folderName]]/customer/addresses/edit?addressId=' ~ address.id ~ '&redirect=' ~ craft.app.request.pathInfo %}
{% tag selectable ? 'label' : 'div' with { class: 'block relative address-select js-address-select', diff --git a/example-templates/src/shop/_private/layouts/includes/header.twig b/example-templates/src/shop/_private/layouts/includes/header.twig index 2ade3b4c26..8a26e093b7 100644 --- a/example-templates/src/shop/_private/layouts/includes/header.twig +++ b/example-templates/src/shop/_private/layouts/includes/header.twig @@ -1,7 +1,7 @@

- + {{- siteName ~ ' Shop' -}}

diff --git a/example-templates/src/shop/cart/index.twig b/example-templates/src/shop/cart/index.twig index 792e2da572..da3d962f89 100755 --- a/example-templates/src/shop/cart/index.twig +++ b/example-templates/src/shop/cart/index.twig @@ -320,7 +320,7 @@ Outputs cart. {% else %}

{{ 'Empty cart. Add items on the {link} page.'|t({ - link: tag('a', { href: url('/[[folderName]]/products'), text: 'products', class: 'underline' }) + link: tag('a', { href: url('[[folderName]]/products'), text: 'products', class: 'underline' }) })|raw }}

{% endif %} {% endblock %} diff --git a/example-templates/src/shop/cart/load.twig b/example-templates/src/shop/cart/load.twig index 5a22b9b9dd..563f666899 100644 --- a/example-templates/src/shop/cart/load.twig +++ b/example-templates/src/shop/cart/load.twig @@ -7,7 +7,7 @@ Outputs form for collecting a cart number to be loaded.
{{ csrfInput() }} {{ actionInput('commerce/cart/load-cart') }} - {{ redirectInput('/[[folderName]]/cart') }} + {{ redirectInput('[[folderName]]/cart') }}

{{- 'Load Cart'|t -}} diff --git a/example-templates/src/shop/checkout/pay-static.twig b/example-templates/src/shop/checkout/pay-static.twig index 9ea1341431..96aa568bc2 100755 --- a/example-templates/src/shop/checkout/pay-static.twig +++ b/example-templates/src/shop/checkout/pay-static.twig @@ -137,7 +137,7 @@ > {{ csrfInput() }} {{ hiddenInput('action', 'commerce/payments/pay') }} - {{ redirectInput('/[[folderName]]/customer/order?number=' ~ cart.number ~ '&success=true') }} + {{ redirectInput('[[folderName]]/customer/order?number=' ~ cart.number ~ '&success=true') }} {{ hiddenInput('cancelUrl', craft.app.request.getUrl()|hash) }} {{ hiddenInput('email', email) }} {{ hiddenInput('number', cart.number) }} diff --git a/example-templates/src/shop/checkout/register-signin.twig b/example-templates/src/shop/checkout/register-signin.twig index 0313eb56fc..402658c58f 100755 --- a/example-templates/src/shop/checkout/register-signin.twig +++ b/example-templates/src/shop/checkout/register-signin.twig @@ -54,7 +54,7 @@ {{- 'Checkout'|t -}}

diff --git a/example-templates/src/shop/customer/cards.twig b/example-templates/src/shop/customer/cards.twig index 05af55ca93..d7d2167066 100755 --- a/example-templates/src/shop/customer/cards.twig +++ b/example-templates/src/shop/customer/cards.twig @@ -33,7 +33,7 @@ {% if paymentSource.id != currentUser.primaryPaymentSourceId %} {{ csrfInput() }} - {{ redirectInput('/[[folderName]]/customer/cards') }} + {{ redirectInput('[[folderName]]/customer/cards') }} {{ actionInput('commerce/payment-sources/set-primary-payment-source') }} {{ hiddenInput('id', paymentSource.id) }} {{ tag('button', { @@ -45,7 +45,7 @@ {% endif %} {{ csrfInput() }} - {{ redirectInput('/[[folderName]]/customer/cards') }} + {{ redirectInput('[[folderName]]/customer/cards') }} {{ actionInput('commerce/payment-sources/delete') }} {{ hiddenInput('id', paymentSource.id) }} {{ tag('button', { @@ -118,8 +118,8 @@ {{ actionInput('commerce/payment-sources/add') }} {{ hiddenInput('gatewayId', gateway.id) }} {{ hiddenInput('successMessage', 'Added payment source.'|hash) }} - {{ hiddenInput('cancelUrl', '/[[folderName]]/customer/cards'|hash) }} - {{ redirectInput('/[[folderName]]/customer/cards') }} + {{ hiddenInput('cancelUrl', '[[folderName]]/customer/cards'|hash) }} + {{ redirectInput('[[folderName]]/customer/cards') }} {% set params = {} %} diff --git a/example-templates/src/shop/customer/index.twig b/example-templates/src/shop/customer/index.twig index 0de4cfcea7..28a4be4ab4 100755 --- a/example-templates/src/shop/customer/index.twig +++ b/example-templates/src/shop/customer/index.twig @@ -1 +1 @@ -{% redirect '/[[folderName]]/customer/orders' %} \ No newline at end of file +{% redirect '[[folderName]]/customer/orders' %} \ No newline at end of file diff --git a/example-templates/src/shop/customer/orders.twig b/example-templates/src/shop/customer/orders.twig index c326cfe014..ee8c70fcf8 100755 --- a/example-templates/src/shop/customer/orders.twig +++ b/example-templates/src/shop/customer/orders.twig @@ -8,7 +8,7 @@ {% endset %} {% if not currentUser %} - {% redirect '/[[folderName]]/customer/sign-in' %} + {% redirect '[[folderName]]/customer/sign-in' %} {% endif %}