Customize checkout urls

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
niloofar
Posts: 16
Joined: 04 Apr 2021, 09:41

Customize checkout urls

Post by niloofar » 23 Oct 2021, 08:22

Hi.

I have changed checkout steps in the config like below:

Code: Select all

'html' => [
    'checkout' => [
         'subparts' => ['shipping', 'checkout', 'process']
    ]
]
I've created the necessary classes and everything works fine.

However, the URLs for each step are like this:

Code: Select all

/shop/default/checkout                              for shipping step
/shop/default/checkout/checkout                     for checkout step
But I want them to be:

shop/default/shipping
shop/default/checkout

or if that's not possible this one:

shop/default/something/shipping
shop/default/something/checkout

How can I do this?
Aimeos version: ~2021.07
Laravel version: ^8.40
PHP: 7.4.9

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Customize checkout urls

Post by aimeos » 25 Oct 2021, 11:08

niloofar wrote: 23 Oct 2021, 08:22 However, the URLs for each step are like this:

Code: Select all

/shop/default/checkout                              for shipping step
/shop/default/checkout/checkout                     for checkout step
But I want them to be:

shop/default/shipping
shop/default/checkout
That's difficult because the URL contains two parts:
- an unique route for Laravel
- an optional parameter for the checkout step ("shipping", "checkout", "process" in your case)

Your Laravel route is now "shop/{site}/checkout" and the optional parameter for the step will always be appended if present.
niloofar wrote: 23 Oct 2021, 08:22 or if that's not possible this one:

shop/default/something/shipping
shop/default/something/checkout
You can overwrite the Laravel checkout route in your ./routes/web.php e.g. to "shop/{site}/c/{c_step?} so the routes will be:

shop/default/c (if not c_step parameter is passed)
shop/default/c/shipping
shop/default/c/checkout

Here's the Laravel checkout route definition:
https://github.com/aimeos/aimeos-larave ... #L218-L221
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply