Page 1 of 1

Install alongside existing application

Posted: 03 Jun 2017, 16:59
by spierce
I have an existing Laravel 5.4 installation using MariaDB with a custom application running for a site. I want to use Aimeos to add shopping functionality to the site. Is there a way to install without a fresh installation of Laravel? I've tried and can't get it to work.

What I've tried:

Clone production server to create development box.
Change APP_ENV to "development"
Add these lines to composer.json:

Code: Select all

    "prefer-stable": true,
    "minimum-stability": "dev",
    "require": {
        "aimeos/aimeos-laravel": "~2017.04",
        ...
    },
    "scripts": {
        ...
        "post-update-cmd": [
            "php artisan vendor:publish --tag=public --force",
            "php artisan vendor:publish",
            "php artisan migrate",
            ...
        ]
    }
Run "composer update"
Install missing php-curl
Run "composer update"
Install missing php-gd
Run "composer update"
Everything downloads and there's an aimeos directory under the vendor directory but the artisan publish and artisan migrate commands don't seem to do anything.

Output from artisan publish command:

Code: Select all

Copied Directory [/vendor/laravel/framework/src/Illuminate/Notifications/resources/views] To [/resources/views/vendor/notifications]
Copied Directory [/vendor/laravel/framework/src/Illuminate/Pagination/resources/views] To [/resources/views/vendor/pagination]
Copied Directory [/vendor/laravel/framework/src/Illuminate/Mail/resources/views] To [/resources/views/vendor/mail]
Publishing complete.
Output from artisan migrate command:

Code: Select all

Nothing to migrate.
As expected from above, look at database structure and no new tables were added. No shop.php in config directory, etc.

I've installed and developed an Aimeos site from scratch on a fresh Laravel install (a couple years ago) but that's not an option with this project. Any way to install without breaking the current site but yet add Aimeos?

Thanks!
Scott

Re: Install alongside existing application

Posted: 03 Jun 2017, 20:14
by aimeos
Make sure, you've updated your "./config/app.php" file and added the Aimeos service provider class like described in the docs. Then execute

Code: Select all

./artisan aimeos:setup --option=setup/default/demo:1
to create the database tables and the demo data. You can leave out the "--option" part if you want to create only the tables.

Re: Install alongside existing application

Posted: 04 Jun 2017, 16:38
by spierce
Thanks! I got the storefront working yesterday but forgot to post here. Currently trying to figure out the admin interface - we already had routes for /admin so we reworked those to not interfere with the Aimeos admin routes. Currently getting

Code: Select all

Call to undefined method User::can()
So we're chasing that down today :)

Re: Install alongside existing application - Routing issues

Posted: 04 Jun 2017, 17:57
by spierce
We had to make a few tweaks to get things to work with regard to accessing the admin interface. One thing we had to do was change like 291 of the Aimeos Context object to use $user->getName() instead of $user->name

Now we're fighting routing issues. We run multiple sites off the same Laravel install. Our route file looks something like this:

Code: Select all

$site1routes = function() {
    Route::get( '/', function() {
        return redirect( '/site1app' );
    }
    Route::group( 'middleware' => [ 'web' ], function() {
        // various routes for site 1
    });
});

Route::group( array( 'domain' => 'site1.com' ), $site1routes );

// repeat above for site 2

$site3apps = function() {
    Route::group( [ 'middleware' => [ 'web' ] ], function() {
        Route::get( 'login', [ 'as' => 'login', 'uses' => function() {
            return view( 'login' );
        }]);

        Route::post( 'auth/login', [ 'as' => 'auth.login', 'uses' => function( \Illuminate\Http\Request $request ) {
            if( \Auth::attempt([
                'email' => $request->get( 'email' ),
                'password' => $request->get( 'password' )
            ])) {
                return redirect( '/site3admin' );  // changed from /admin for adding Aimeos
            } else {
                return view( 'login' )->withErrors( array( 'message' => 'The Email/password provided do not match.' ) );
            }
          }]);

          Route::get( 'logout', [ 'as' => 'logout', 'uses' => function() {
              \Auth::logout();
              \Session::flush();
              return redirect( 'login' );
          }]);

        Route::group( [ 'middleware' => [ 'auth', 'web' ] ], function() {
            // various site3 admin routes, all changed from /admin/path to /site1admin/path for adding Aimeos
        });
    });
};

Route::group( array( 'domain' => 'site3.com' ), $site3routes );
Only site3 needs authentication so that's how we set it up. We don't want the login form displayed on the other sites, etc. To try and get Aimeos working, we commented out all of our login and logout routes, and added

Code: Select all

Auth::routes()
to the top of routes/web.php but we still can't get authorization working with Aimeos.

We previously had

Code: Select all

$redirectTo="/site3admin";
in the LoginController but we removed that as well. We also tried changing it to

Code: Select all

$redirectTo="/admin";
but still not working.

When we access /admin, we see the Aimeos login form. When we try to login, we get

Code: Select all

NotFoundHttpException in RouteCollection.php
. We even created a brand new user using php artisan

Code: Select all

aimeos:account email@ite.com --admin
to make sure the user had admin authority. No luck.

Any ideas?

Re: Install alongside existing application

Posted: 04 Jun 2017, 22:15
by aimeos
spierce wrote:Thanks! I got the storefront working yesterday but forgot to post here. Currently trying to figure out the admin interface - we already had routes for /admin so we reworked those to not interfere with the Aimeos admin routes.
You can reconfigure the admin routes (and all others as well) to use a different prefix, domain, etc.
- https://github.com/aimeos/aimeos-larave ... tes.php#L3
- https://github.com/aimeos/aimeos-larave ... hop.php#L6

Code: Select all

return [
	'routes' => [
		'login' => ['prefix' => 'aimeos', 'middleware' => ['web']],
		'jqadm' => ['prefix' => 'aimeos/admin/{site}/jqadm', 'middleware' => ['web', 'auth']],
		'extadm' => ['prefix' => aimeos/'admin/{site}/extadm', 'middleware' => ['web', 'auth']],
		'jsonadm' => ['prefix' => 'aimeos/admin/{site}/jsonadm', 'middleware' => ['web', 'auth']],
	],
	// ...
];

Re: Install alongside existing application

Posted: 04 Jun 2017, 22:24
by aimeos
Maybe the redirect to the admin interface isn't working because the route is not found. You may have a deeper look into the AdminController to see where the problem occurs:
https://github.com/aimeos/aimeos-larave ... roller.php

Re: Install alongside existing application

Posted: 03 Jan 2019, 07:23
by hihaider196
Hi,
Can you please tell me how can i make new admin account on my live project because my old account is giving error, showing that credentials do not match and please tell me the table name in database where admin account information is stored.
Thankyou and please reply me as soon as possible.

Re: Path of files

Posted: 03 Jan 2019, 10:28
by hihaider196
Hi,
Can anyone pease tell me the path of category(catalogue) page file.
Thankyou

Re: Install alongside existing application

Posted: 03 Jan 2019, 17:00
by aimeos
One separate topic for each question please.