Page 1 of 1

price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 10:02
by columbo
Hi,

I'd like to restrict my Aimeos & Laravel 6 webshop, so that only registered and approved users can see products with prices and place orders. I expect, that I can use and extend the Laravel registration form for this.

When I use the Laravel (standard) registration form, siteId is not set (in user table) and the newly created customer / user can not be edited in Aimeos admin area ("read only").

How or where can I add the siteId? in config/shop.php?
Or do I have to add the siteId in registrationContoller?

Is there also a shop.php setting for restricting price-display and checkout for registered users only?

Thank you!

Re: price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 10:22
by lucadambros
Use the middleware Authenticate.php and put the routes you want inside the web.php with this:

Code: Select all

Route::group(['middleware' => 'MIDDLEWARE THAT CHECKS IF USER IS LOGGED'], function ()
{
// list of the routes
}

Re: price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 10:29
by lucadambros
All the routes can be found here: https://github.com/aimeos/aimeos-larave ... routes.php

You can match all the routes you want https://laravel.com/docs/master/routing ... p-prefixes without writing them all

Re: price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 11:37
by aimeos
columbo wrote: 09 Oct 2019, 10:02 When I use the Laravel (standard) registration form, siteId is not set (in user table) and the newly created customer / user can not be edited in Aimeos admin area ("read only").

How or where can I add the siteId? in config/shop.php?
Or do I have to add the siteId in registrationContoller?
Yes, you have to set it in the registration controller.
columbo wrote: 09 Oct 2019, 10:02 Is there also a shop.php setting for restricting price-display and checkout for registered users only?
The Aimeos company is offering an extension for that:
https://aimeos.com/extensions#c437

Re: price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 11:49
by columbo
aimeos wrote: 09 Oct 2019, 11:37 Yes, you have to set it in the registration controller.
Thank you!

are there any examples availbale how to add static values (like siteId) or add new viels (e.g. Company, Address, Phone, etc.) to the Laravel registartion form / registration controller?

Re: price-view & checkout for registered user - extend Laravel registration

Posted: 09 Oct 2019, 14:13
by aimeos
You should ask questions regarding the registration form in a Laravel forum.
The site depends on the "site" parameter in the URL (or "default" value if none is given) and you can get the site ID using:

Code: Select all

$context = $this->app->make('aimeos.context')->get();
$siteid = $context->getLocale()->getSiteId();