New Independent Completely Extension

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
makkam
Posts: 12
Joined: 13 Nov 2020, 12:10

New Independent Completely Extension

Post by makkam » 17 Dec 2020, 02:25

dears ..
I would like to thank you all -creators and contributors and developers- for your efforts ..
I want to understand Aimeos very well , but the documentation supposed that all Laravel developers should be familiar with Aimeos by default !
so I would like to ask some questions in order to mapping concepts and get understand Aimeos very well step by step and by examples specifically ..
So, firstly ,lets suppose that I want to create a new Extension for crud functions for "Car Management" .. and the extension should have independent Model and controller and view (MVC with migration and routes as in classic laravel basic concepts) ..
the solution steps that I have reached :
suppose we need to create an extension in Aimeos that allow users to create crud functions for "car" ,and without difference between admins and clients ,to avoid using "ai-admin-jqadm" or "ai-client-html/client/html/template" folders .
step 1: create default files for extension using : https://aimeos.org/extensions/ and but it inside "ext" folder then run "composer update".
step 2 (views of Laravel): we can override original views by put them in same paths and names in Aimeos original files but inside "ext" folder ..
but how to create a new page ? " .
as Laravel developer I say that we should create new controller and route first ! so we should go to next steps .."
step 3 (controller and route of Laravel): Aimeos documentation described how to override existing controller but inside the original Aimeos files as here https://aimeos.org/docs/2020.x/laravel/ ... controller ,not inside Extension structure !, I know there is a documentation for it here https://aimeos.org/docs/2020.x/developer/extensions/ and it is understood but it needs to an example , that will solve a huge gap if existed :roll: .
same problem of how should I add a route to my extension controllers , how and where should I add it !? -I am not talking here about web.php inside route folder in original files.
step 4 (Model and migration of Laravel): here I have an example in github helps me a lot :) , as how to extend the existed Model of Aimeos and edit it ,it updated the price of product model .. thank to him and here are the link to this extension https://github.com/ottomichalicka/myExtension
but I need a similar example for new created Model and how to set relations with Aimeos Model -if needed a relations with them- !
I am ready to share my little knowledge of Aimeos and thanks in advance for who will help me solve those gaps by Examples

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

Re: New Independent Completely Extension

Post by aimeos » 17 Dec 2020, 15:55

makkam wrote: 17 Dec 2020, 02:25 but how to create a new page ? " .
as Laravel developer I say that we should create new controller and route first ! so we should go to next steps .."
A "page" is nothing else than a Laravel controller with an action and a route to this controller/action. It has nothing to do with Aimeos because Aimeos only consists of components that can be included in "pages". So the answer to your question is: Use the standard Laravel means to create controllers, actions and routes.

The Aimeos documentation for Laravel integration exactly descibes that way and how to add Aimeos components to that pages: https://aimeos.org/docs/2020.x/laravel/ ... eate-pages
makkam wrote: 17 Dec 2020, 02:25 step 3 (controller and route of Laravel): Aimeos documentation described how to override existing controller but inside the original Aimeos files as here https://aimeos.org/docs/2020.x/laravel/ ... controller ,not inside Extension structure !, I know there is a documentation for it here https://aimeos.org/docs/2020.x/developer/extensions/ and it is understood but it needs to an example , that will solve a huge gap if existed :roll: .
same problem of how should I add a route to my extension controllers , how and where should I add it !? -I am not talking here about web.php inside route folder in original files.
If you want to ship your Laravel controllers indepentently of your application, you have to create a Laravel package like Aimeos is. The Laravel documentation contains an article for this: https://laravel.com/docs/8.x/packages
The only problem is that the Laravel documentation doesn't say anything about best practices for the package structure (Aimeos extensions have a fixed and documented structure in comparison). A good structure for Laravel packages might be:

composer.json
src/ServiceProvider.php
config/
resource/
migration/
makkam wrote: 17 Dec 2020, 02:25 step 4 (Model and migration of Laravel): here I have an example in github helps me a lot :) , as how to extend the existed Model of Aimeos and edit it ,it updated the price of product model .. thank to him and here are the link to this extension https://github.com/ottomichalicka/myExtension
but I need a similar example for new created Model and how to set relations with Aimeos Model -if needed a relations with them- !
There's no golden bullet how to make relations between Aimeos data and Eloquent models. You can add an Eloquent model for the Aimeos table to need a connection to for example.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

makkam
Posts: 12
Joined: 13 Nov 2020, 12:10

Re: New Independent Completely Extension

Post by makkam » 17 Dec 2020, 18:24

aimeos wrote: 17 Dec 2020, 15:55 A "page" is nothing else than a Laravel controller with an action and a route to this controller/action. It has nothing to do with Aimeos because Aimeos only consists of components that can be included in "pages". So the answer to your question is: Use the standard Laravel means to create controllers, actions and routes.

The Aimeos documentation for Laravel integration exactly descibes that way and how to add Aimeos components to that pages: https://aimeos.org/docs/2020.x/laravel/ ... eate-pages
yes , that was a good documentation but that example is implemented on actual Aimeos files , not in extension files -as I want-
aimeos wrote: 17 Dec 2020, 15:55 If you want to ship your Laravel controllers indepentently of your application, you have to create a Laravel package like Aimeos is. The Laravel documentation contains an article for this: https://laravel.com/docs/8.x/packages
The only problem is that the Laravel documentation doesn't say anything about best practices for the package structure (Aimeos extensions have a fixed and documented structure in comparison). A good structure for Laravel packages might be:

composer.json
src/ServiceProvider.php
config/
resource/
migration/
thanks for pointing to this , and that may be my next testing point ..

now all I want is to develop new extension with new route and new controller and new model and new view , lets say "Car Management" extension using classes and interfaces and structure of Aimeos ..

and I welcome with anybody can help me to develop and upload this extension on github as a first example to use Aimeos and learn it step by step by examples ..
next steps maybe are "example of using laravel package with Aimeos" and "example of extend Aimeos sup-part and develop it" and further more ..

Regards

makkam
Posts: 12
Joined: 13 Nov 2020, 12:10

Re: New Independent Completely Extension

Post by makkam » 18 Dec 2020, 12:54

or in summery ...
every secondary school student knows what is Nuclear reactor ..
but nobody know how to implement it actually ..
so I need examples to create a lovely Nuclear reactor 8-)
regards

Post Reply