Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example template redirects for mult site installs #3314

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example-templates/dist/shop/_private/address/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<div class="my-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-3 gap-4">
{% 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 %}
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full relative">
{% tag selectable ? 'label' : 'div' with {
class: 'block relative address-select js-address-select',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="bg-gray-900">
<div class="container mx-auto p-6 md:flex justify-content-between align-content-center">
<h1 class="text-3xl">
<a href="{{ siteUrl('/shop') }}" class="text-white">
<a href="{{ siteUrl('shop') }}" class="text-white">
{{- siteName ~ ' Shop' -}}
</a>
</h1>
Expand Down
2 changes: 1 addition & 1 deletion example-templates/dist/shop/cart/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Outputs cart.
</form>
{% else %}
<p>{{ '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 }}</p>
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion example-templates/dist/shop/cart/load.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Outputs form for collecting a cart number to be loaded.
<form method="post" action="">
{{ csrfInput() }}
{{ actionInput('commerce/cart/load-cart') }}
{{ redirectInput('/shop/cart') }}
{{ redirectInput('shop/cart') }}

<h1 class="text-xl font-bold">
{{- 'Load Cart'|t -}}
Expand Down
2 changes: 1 addition & 1 deletion example-templates/dist/shop/checkout/pay-static.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down
2 changes: 1 addition & 1 deletion example-templates/dist/shop/checkout/register-signin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{- 'Checkout'|t -}}
</h2>
<div class="mt-3">
<a href="{{ url('/shop/checkout/addresses') }}" class="text-blue-500 hover:text-blue-600">
<a href="{{ url('shop/checkout/addresses') }}" class="text-blue-500 hover:text-blue-600">
{{ 'Or continue as guest'|t }} &rarr;
</a>
</div>
Expand Down
8 changes: 4 additions & 4 deletions example-templates/dist/shop/customer/cards.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{% if paymentSource.id != currentUser.primaryPaymentSourceId %}
<form method="post" action="">
{{ csrfInput() }}
{{ redirectInput('/shop/customer/cards') }}
{{ redirectInput('shop/customer/cards') }}
{{ actionInput('commerce/payment-sources/set-primary-payment-source') }}
{{ hiddenInput('id', paymentSource.id) }}
{{ tag('button', {
Expand All @@ -45,7 +45,7 @@
{% endif %}
<form method="post" action="">
{{ csrfInput() }}
{{ redirectInput('/shop/customer/cards') }}
{{ redirectInput('shop/customer/cards') }}
{{ actionInput('commerce/payment-sources/delete') }}
{{ hiddenInput('id', paymentSource.id) }}
{{ tag('button', {
Expand Down Expand Up @@ -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 = {} %}

Expand Down
2 changes: 1 addition & 1 deletion example-templates/dist/shop/customer/index.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% redirect '/shop/customer/orders' %}
{% redirect 'shop/customer/orders' %}
2 changes: 1 addition & 1 deletion example-templates/dist/shop/customer/orders.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% endset %}

{% if not currentUser %}
{% redirect '/shop/customer/sign-in' %}
{% redirect 'shop/customer/sign-in' %}
{% endif %}


Expand Down
4 changes: 2 additions & 2 deletions example-templates/src/shop/_private/address/list.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<div class="my-6 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 xl:grid-cols-3 gap-4">
{% 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 %}
<div class="block border border-gray-200 bg-white rounded-lg shadow-sm hover:shadow-md p-4 w-full relative">
{% tag selectable ? 'label' : 'div' with {
class: 'block relative address-select js-address-select',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="bg-gray-900">
<div class="container mx-auto p-6 md:flex justify-content-between align-content-center">
<h1 class="text-3xl">
<a href="{{ siteUrl('/[[folderName]]') }}" class="text-white">
<a href="{{ siteUrl('[[folderName]]') }}" class="text-white">
{{- siteName ~ ' Shop' -}}
</a>
</h1>
Expand Down
2 changes: 1 addition & 1 deletion example-templates/src/shop/cart/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Outputs cart.
</form>
{% else %}
<p>{{ '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 }}</p>
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion example-templates/src/shop/cart/load.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Outputs form for collecting a cart number to be loaded.
<form method="post" action="">
{{ csrfInput() }}
{{ actionInput('commerce/cart/load-cart') }}
{{ redirectInput('/[[folderName]]/cart') }}
{{ redirectInput('[[folderName]]/cart') }}

<h1 class="text-xl font-bold">
{{- 'Load Cart'|t -}}
Expand Down
2 changes: 1 addition & 1 deletion example-templates/src/shop/checkout/pay-static.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down
2 changes: 1 addition & 1 deletion example-templates/src/shop/checkout/register-signin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{- 'Checkout'|t -}}
</h2>
<div class="mt-3">
<a href="{{ url('/[[folderName]]/checkout/addresses') }}" class="[[classes.a]]">
<a href="{{ url('[[folderName]]/checkout/addresses') }}" class="[[classes.a]]">
{{ 'Or continue as guest'|t }} &rarr;
</a>
</div>
Expand Down
8 changes: 4 additions & 4 deletions example-templates/src/shop/customer/cards.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{% if paymentSource.id != currentUser.primaryPaymentSourceId %}
<form method="post" action="">
{{ csrfInput() }}
{{ redirectInput('/[[folderName]]/customer/cards') }}
{{ redirectInput('[[folderName]]/customer/cards') }}
{{ actionInput('commerce/payment-sources/set-primary-payment-source') }}
{{ hiddenInput('id', paymentSource.id) }}
{{ tag('button', {
Expand All @@ -45,7 +45,7 @@
{% endif %}
<form method="post" action="">
{{ csrfInput() }}
{{ redirectInput('/[[folderName]]/customer/cards') }}
{{ redirectInput('[[folderName]]/customer/cards') }}
{{ actionInput('commerce/payment-sources/delete') }}
{{ hiddenInput('id', paymentSource.id) }}
{{ tag('button', {
Expand Down Expand Up @@ -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 = {} %}

Expand Down
2 changes: 1 addition & 1 deletion example-templates/src/shop/customer/index.twig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% redirect '/[[folderName]]/customer/orders' %}
{% redirect '[[folderName]]/customer/orders' %}
2 changes: 1 addition & 1 deletion example-templates/src/shop/customer/orders.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% endset %}

{% if not currentUser %}
{% redirect '/[[folderName]]/customer/sign-in' %}
{% redirect '[[folderName]]/customer/sign-in' %}
{% endif %}


Expand Down
Loading