Route [aimeos_home] not defined.

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
fabian
Posts: 2
Joined: 07 Jul 2022, 16:47

Route [aimeos_home] not defined.

Post by fabian » 07 Jul 2022, 17:12

Hello there

I'm trying to test aimeos as a laravel package

I have followed the instructions in the documentation https://github.com/aimeos/aimeos-laravel, but when trying to access either /shop or /admin I always get this error: Route [aimeos_home] not defined.

When inspecting the routes, in fact, that route does not exist, I do not know if I have to use another version of this package, or that route comes in some other package of aimeos. (I have seen in the posts other similar errors of routes not defined and it will be solved by adding another package)

I am using:
PHP 8.0.19
Laravel v9.19.0
Docker version 20.10.12, build 20.10.12-0ubuntu4

aimeos/ai-admin-jqadm 2022.07.1
aimeos/ai-admin-jsonadm 2022.07.1
aimeos/ai-client-html 2022.07.1
aimeos/ai-client-jsonapi 2022.07.1
aimeos/ai-controller-frontend 2022.07.1
aimeos/ai-controller-jobs 2022.07.1
aimeos/ai-laravel 2022.07.1
aimeos/aimeos-base 2022.07.1
aimeos/aimeos-core 2022.07.2
aimeos/aimeos-laravel 2022.07.1
aimeos/macro 1.0.0
aimeos/map 3.1.0
aimeos/upscheme 0.8.2

Thanks in advance for your help

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Route [aimeos_home] not defined.

Post by ahmed31916 » 07 Jul 2022, 18:09

Adding this route, will solve the problem:

Code: Select all

Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')->name('aimeos_home');

User avatar
peter69
Posts: 98
Joined: 09 Jun 2022, 19:31

Re: Route [aimeos_home] not defined.

Post by peter69 » 07 Jul 2022, 19:52

I have the same problem. I have checked the routes that are defined in web.php and the route is already defined:

Code: Select all

[b]Route::get('/', '\Aimeos_ShopController@homeAction')->name('aimeos_home');[/b]
I cleared the route cache, however I still get the same error:

Missing required parameter for

Code: Select all

[b][Route: aimeos_home] [URI: {locale}] [Missing parameter: locale].[/b]

User avatar
peter69
Posts: 98
Joined: 09 Jun 2022, 19:31

Re: Route [aimeos_home] not defined.

Post by peter69 » 07 Jul 2022, 19:58

If I set the value of the environment variable "SHOP_MULTILOCALE" to 0, the issue disappears.

User avatar
peter69
Posts: 98
Joined: 09 Jun 2022, 19:31

Re: Route [aimeos_home] not defined.

Post by peter69 » 07 Jul 2022, 20:45

the problem also appears in the checkout process:

Code: Select all

[b]Missing required parameter for [Route: aimeos_shop_count] [URI: locale/shop/count] [Missing parameter: locale][/b]

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Route [aimeos_home] not defined.

Post by ahmed31916 » 08 Jul 2022, 06:45

peter69 wrote: 07 Jul 2022, 19:52 I cleared the route cache, however I still get the same error:

Missing required parameter for

Code: Select all

[b][Route: aimeos_home] [URI: {locale}] [Missing parameter: locale].[/b]
you need to configure your routes like this:

Code: Select all

if( env( 'SHOP_MULTILOCALE' ) ) {
    $locale = ['prefix' => '{locale}', 'where' => ['locale' => '[a-zA-Z]{2}(\_[a-zA-Z]{2})?']];
}

Route::group($locale ?? [], function() {

    require __DIR__.'/auth.php';

    Route::match(['GET', 'POST'], 'p/{path?}', '\Aimeos\Shop\Controller\PageController@indexAction')
        ->name('aimeos_page')->where( 'path', '.*' );

    Route::get('/', '\Aimeos\Shop\Controller\CatalogController@homeAction')
        ->name('aimeos_home');
 
});

if( env( 'SHOP_MULTILOCALE' ) )
{
    Route::get('/', function () {
        return redirect(airoute('aimeos_home', ['locale' => app()->getLocale()]));
    });
}

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

Re: Route [aimeos_home] not defined.

Post by aimeos » 08 Jul 2022, 08:08

The "aimeos_home" route isn't defined by default, you have to add it yourself. See here:
https://github.com/aimeos/aimeos-laravel#frontend

To avoid that problem, it has been removed from the base.blade.php template and "/" is now used instead.

A new minor version (2022.07.2) has been released. Please run "composer up" to get the updated files.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: Route [aimeos_home] not defined.

Post by aimeos » 08 Jul 2022, 08:25

peter69 wrote: 07 Jul 2022, 20:45 the problem also appears in the checkout process:

Code: Select all

[b]Missing required parameter for [Route: aimeos_shop_count] [URI: locale/shop/count] [Missing parameter: locale][/b]
Can you please post the output of "composer show" and your .env file (without the credentials)?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

fabian
Posts: 2
Joined: 07 Jul 2022, 16:47

Re: Route [aimeos_home] not defined.

Post by fabian » 08 Jul 2022, 16:41

aimeos wrote: 08 Jul 2022, 08:08 The "aimeos_home" route isn't defined by default, you have to add it yourself. See here:
https://github.com/aimeos/aimeos-laravel#frontend

To avoid that problem, it has been removed from the base.blade.php template and "/" is now used instead.

A new minor version (2022.07.2) has been released. Please run "composer up" to get the updated files.
Hello, with this version (2022.07.2), everything worked fine. Thanks

User avatar
peter69
Posts: 98
Joined: 09 Jun 2022, 19:31

Re: Route [aimeos_home] not defined.

Post by peter69 » 12 Jul 2022, 16:19

Hello Sir,

I share with you the requested screenshots.

Now I only get an error "A non-recoverable error occurred" in the checkout process that does not allow me to finalize the purchase.

Regards,
Attachments
env.png
env.png (96.94 KiB) Viewed 6469 times
composer show.png
composer show.png (217.08 KiB) Viewed 6469 times

Post Reply