Changing root site code from default breaks parts of site

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!
DmS
Posts: 56
Joined: 09 Aug 2021, 08:59

Changing root site code from default breaks parts of site

Post by DmS » 20 Dec 2021, 15:34

Hi.
Customer wants the url to be <domain>/marketplace/<category/product etc>
So I've changed the shop domain in admin configuration -> settings from default to marketplace
Then I've removed the /shop in shop.php for default prefix :

Code: Select all

'default' => ['prefix' => '{site}/', 'middleware' => ['web']],
Most of the things now works as they should, but if I go to <domain>/ i get a fatal error "locale missing"
I've traced this to the https://github.com/aimeos/aimeos-larave ... hp#L57-L66 and the View.php in the same folder where the locale is hard-defaulted to "default" if locale is null.

Is there a way to override/control this in my extension?
Thanx/Dan
_____________
Laravel 8 with Aimeos 2021.10.7 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

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

Re: Changing root site code from default breaks parts of site

Post by aimeos » 21 Dec 2021, 15:44

Your site setup doesn't seem to be correct.
If you want custom domains for vendor sites, your configuration in your config/shop.php must look like:

Code: Select all

'routes' => [
    'admin' => ['domain' => '{site}', 'prefix' => 'admin', 'middleware' => ['web']],
    'jqadm' => ['domain' => '{site}', 'prefix' => 'admin/jqadm', 'middleware' => ['web', 'auth']],
    'jsonadm' => ['domain' => '{site}', 'prefix' => 'admin/jsonadm', 'middleware' => ['web', 'auth']],
    'jsonapi' => ['domain' => '{site}', 'prefix' => 'jsonapi', 'middleware' => ['web', 'api']],
    'account' => ['domain' => '{site}', 'prefix' => 'profile', 'middleware' => ['web', 'auth']],
    'default' => ['domain' => '{site}', 'prefix' => 'shop', 'middleware' => ['web']],
    'update' => ['domain' => '{site}'],
],
For more information have a look at:
https://aimeos.org/docs/latest/laravel/ ... he-routing
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

DmS
Posts: 56
Joined: 09 Aug 2021, 08:59

Re: Changing root site code from default breaks parts of site

Post by DmS » 22 Dec 2021, 08:39

Might have been unclear here.
I have one domain, that's the same for all. I don't want separate domains for the vendor sites.

I'm using the marketplace extension, so all "sub-sites" have their own name/site-code, but the parent site sitecode is named "default" in the original installation. So the standard url to the shop where I can shop from all sub-sites/vendors becomes https://mycustomersshop.com/default/shop/

What I'd like the overall url to be is: https://mycustomersshop.com/marketplace/shop/
That's why I want to change the site-code "default" to marketplace, but in the https://github.com/aimeos/aimeos-larave ... hp#L57-L66 the locale hard coded to "default" if it's null.
/Dan
_____________
Laravel 8 with Aimeos 2021.10.7 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

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

Re: Changing root site code from default breaks parts of site

Post by aimeos » 23 Dec 2021, 12:11

It's correct that there's a fallback to "default" if no site ID is available in the URL. It should be no problem to make that configurable, so this has been changed in dev-master and 2021.10.x-dev:
https://github.com/aimeos/aimeos-larave ... 81bf3b5cca

Install 2021.10.x-dev first:

Code: Select all

composer req aimeos/aimeos-laravel:2021.10.x-dev
Then, adapt the default site code in your config/shop.php using:

Code: Select all

'site_default' => 'marketplace'
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

DmS
Posts: 56
Joined: 09 Aug 2021, 08:59

Re: Changing root site code from default breaks parts of site

Post by DmS » 23 Dec 2021, 13:40

Great!
Thank you, that was pretty much the solution I was thinking of, but didn't want to do in core files :)

A merry Christmas and a happy new year to you all!
_____________
Laravel 8 with Aimeos 2021.10.7 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

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

Re: Changing root site code from default breaks parts of site

Post by aimeos » 23 Dec 2021, 14:03

We've renamed the config to:

Code: Select all

'mshop' => [
	'locale' => [
		'site' => 'marketplace'
	]
]
Reason is that it's now the same configuration as we use in other integrations.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply