route error on privacy page

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!
User avatar
niloofar
Posts: 16
Joined: 04 Apr 2021, 09:41

route error on privacy page

Post by niloofar » 04 Apr 2021, 10:25

Hi.

I'm using Aimeos as a marketplace. Extension

Code: Select all

ai-sites
is enabled and in my

Code: Select all

config/shop.php
file I have added:

Code: Select all

[
'admin' => ['prefix' => 'admin', 'middleware' => ['web', 'verified']],
'jqadm' => ['prefix' => 'admin/{site}/jqadm', 'middleware' => ['web', 'auth', 'verified']],
'jsonadm' => ['prefix' => 'admin/{site}/jsonadm', 'middleware' => ['web', 'auth', 'verified']],
'jsonapi' => ['prefix' => 'jsonapi/{site}', 'middleware' => ['web', 'api']],
'account' => ['prefix' => 'profile/{site}', 'middleware' => ['web', 'auth']],
'default' => ['prefix' => 'shop/{site}', 'middleware' => ['web']],
]
to my routes.


In my

Code: Select all

app.blade.php
in footer section I'm calling privacy route like this:

Code: Select all

href="{{ route('aimeos_shop_privacy') }}"
and shop page like:

Code: Select all

href="{{ route('aimeos_shop_list') }}"
Since these links are in footer, they both are called in every page, including privacy, shop page,...

on my homepage there's no error and shop_list page works fine.
but by clicking on privacy link, which opens

Code: Select all

localhost:8000/privacy
, I get this error:
Missing required parameters for [Route: aimeos_shop_list] [URI: shop/{site}]
What should I do?

Laravel version: 6.2.12
Aimeos: 2020.10
php version: 7.4.9
Windows, wampp

Thanks in advance
Aimeos version: ~2021.07
Laravel version: ^8.40
PHP: 7.4.9

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

Re: route error on privacy page

Post by aimeos » 06 Apr 2021, 15:23

The routes for terms and privacy doesn't require a site by default:
https://github.com/aimeos/aimeos-larave ... #L252-L266

But if you add a link to the Aimeos list page in the footer, it requires the current site because it's mandatory for the "aimeos_shop_list" route. At the terms and privacy page, you currently don't have a site parameter in your URL and you can either add

Code: Select all

'legal' => ['prefix' => '{site}'],
to the page configuration in the config/shop.php file to have page URLs like "/default/privacy" or add the site by using

Code: Select all

route('aimeos_shop_list', ['site' => Route::input('site', 'default']))
Then, you have "/privacy" and the link to the Aimeos list page will be /shop/default/ for the default shop at the privacy page.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
niloofar
Posts: 16
Joined: 04 Apr 2021, 09:41

Re: route error on privacy page

Post by niloofar » 10 Apr 2021, 07:23

Thanks a lot.
I used the second approach since I wanted only privacy page for whole site.

But now I get this error when I enter an url that does not exists. Normally it must go to 404 page.
My 404 page also extends app.blade.php and therefor I have problems.

I get this error:
Call to a member function parameter() on null.

I do check if the route exists:
app.blade.php

Code: Select all

@if (Route::has('aimeos_shop_account'))
    route('aimeos_shop_list', ['site' => Route::input('site', 'default')])
@else
	url('/profile/default')
@endif

I know it's actually Laravel related, but I would be so thankful if you could answer me.
Aimeos version: ~2021.07
Laravel version: ^8.40
PHP: 7.4.9

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

Re: route error on privacy page

Post by aimeos » 11 Apr 2021, 12:11

Do you have a stack trace of the exception?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply