Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#2248 by andreas.allacher
16 Dec 2015, 21:05
Hi,

I am interested in the shop system to use in combination with TYPO3.
However, I have some questions - as I am a developer myself I might also integrated parts of it myself if I get enough information on how to start :)

1.) Can I link to internal TYPO3 pages using the link button in the RTE without having to manually input the URL?
e.g. when inserting the text it could search for internal links via regex (ViewHelper) and use it to call ContentObjectRenderer typolink.

2.) What about linkin to other articles using the RTE - also manual URL required?

3.) Can I link to existing files using TYPO3 (via file browser) and in the best case make use of TYPO3 FAL?
At least linking would be good, although TYPO3 FAL would be even better but probably way more complicated.

If the RTE linkbrowser would work that could be used here too actually and just parsing the file via another ViewHelper on rendering.

4.) Is there a central way to upload images and rename them or only via the upload part in media?

5.) Can I add youtube Videos as media (I guess I would just need to add an URL and parse it accordingly in Template rendering)?

6.) If I use the upload in admin interface can I rename those files aferwards?

7.) On rendering can I make use of TYPO3 functions to e.g. create preview images automatically?
That at least should be possible by creating a small ViewHelper that uses the default TYPO3 libraries like the Fluid ImageViewHelper.

8.) Is it possible to listen to change / delete events on products, e.g. I might - not yet sure - want to index the products into solr and use EXT:solr to implement a website search.

9.) Permissions: How do I limit which TYPO3 backend user can see / edit which aimeos settings.
#2251 by nos3
17 Dec 2015, 13:32
Hi Andreas

andreas.allacher wrote:I am interested in the shop system to use in combination with TYPO3.
However, I have some questions - as I am a developer myself I might also integrated parts of it myself if I get enough information on how to start :)


First of all a bit background about Aimeos :-)

The Aimeos TYPO3 extension is different from all other shop extensions as it's build upon the Aimeos core components, an independent PHP library which encapsulates the e-commerce functionality. The components are self-contained (e.g. they also return the generated output) but integrate into every system nicely by adapters, e.g. for generating URLs, using the user session, etc.

This has a lot of advantages like it can be integrated into every PHP application and framework to offer a full featured shop system. On the downside, the integration is not as deeply possible as a native TYPO3 can offer.

andreas.allacher wrote:1.) Can I link to internal TYPO3 pages using the link button in the RTE without having to manually input the URL?
e.g. when inserting the text it could search for internal links via regex (ViewHelper) and use it to call ContentObjectRenderer typolink.

2.) What about linkin to other articles using the RTE - also manual URL required?


The Aimeos e-commerce components don't use the RTE and the editor don't know about Aimeos. This makes it difficult to generate links to Aimeos from the RTE (maybe this could be done by a RTE hook) and to generate links to other pages from the Aimeos admin interface. The Aimeos components utilize the "typolink" functionality for generating links but the admin interface knows nothing about the surrounding TYPO3. To achieve this, you would need a TYPO3 specific admin interface for Aimeos.

andreas.allacher wrote:3.) Can I link to existing files using TYPO3 (via file browser) and in the best case make use of TYPO3 FAL?
At least linking would be good, although TYPO3 FAL would be even better but probably way more complicated.


For the same reason the TYPO3 file browser isn't available in the Aimeos admin interface. There's a file system layer in the current development version of Aimeos (https://github.com/aimeos/aimeos-core/tree/master/lib/mwlib/src/MW/Filesystem) but the adapter for FAL is still missing - mainly due to the fact that FAL is almost completely undocumented I think. If you know more, feel free to write a FAL adapter :-)

andreas.allacher wrote:4.) Is there a central way to upload images and rename them or only via the upload part in media?


You can upload images via FTP or other means for sure. Then you only need to add the file references as media items to your products, which can be done e.g. via the CSV import.

andreas.allacher wrote:5.) Can I add youtube Videos as media (I guess I would just need to add an URL and parse it accordingly in Template rendering)?


Yes, videos are supported in media items and can be shown in the product detail view.

andreas.allacher wrote:6.) If I use the upload in admin interface can I rename those files aferwards?


You can but then you need to adapt the file references in the media items.

andreas.allacher wrote:7.) On rendering can I make use of TYPO3 functions to e.g. create preview images automatically?
That at least should be possible by creating a small ViewHelper that uses the default TYPO3 libraries like the Fluid ImageViewHelper.


The Aimeos components are not using Fluid internally because the need to be independent from a specific framework. The Aimeos template engine is based on PHP for simplicity and speed. You could add a view helper there that could do the resizing but this will slow down the first request a lot (same as for the TYPO3 counterpart).

andreas.allacher wrote:8.) Is it possible to listen to change / delete events on products, e.g. I might - not yet sure - want to index the products into solr and use EXT:solr to implement a website search.


Yes, you can wrap a decorator around the ExtJS product manager (https://github.com/aimeos/aimeos-core/blob/master/controller/extjs/src/Controller/ExtJS/Product/Standard.php) that's intercepting calls to the finish() method and push the product into Solr.

andreas.allacher wrote:9.) Permissions: How do I limit which TYPO3 backend user can see / edit which aimeos settings.


The Aimeos admin interface in the TYPO3 backend is currently all or nothing. Either backend users are allowed to modify the shop content or not. All configuration settings are done via TypoScript where you can prevent access for backend users if I remember correctly.


Norbert
#2254 by andreas.allacher
17 Dec 2015, 18:18
I meant ViewHelper just generally. I know it uses PHP directly but I could still write an own class for it that behaves like a Fluid-ViewHelper, just that it is called directly :)

ad 4.) So in the current aimeos Version I would be able to select existing files and can upload existing files to certain locations on the filesystem like fileadmin/products ?
Instead of uploads/... ?

Regarding FAL it acutally only stores entries in sys_file to the file and links records to it using sys_file_reference. However, in aimeos it would be enough to link to the sys_file directly (storing the UID of the sys_file) because everything else is stored in aimeos.

Media of aimeos is basically actually similiar to FAL in that regard.

ad 6.) I meant when I upload a file using the upload feature in the media items, can I rename it afterwards?

ad 9.) So I can only deny access to the admin interface completely?
This is rather important for me the rest I could do without as long as I can select files from the server for media elements.

If I create hooks or anything like it regarding RTE links and FAL I will create a PR but I am not sure I will or if when.

However, I guess the easiest solution would be to all those issues would be to let users input data using own TYPO3 tables and on save or periodically I migrate that data into aimeos?
Is there any documentation on how that data has to look like?
I guess I could base it on this extension: https://github.com/aimeos/ai-migrate-txcommerce ?
#2255 by aimeos
17 Dec 2015, 18:43
andreas.allacher wrote:I meant ViewHelper just generally. I know it uses PHP directly but I could still write an own class for it that behaves like a Fluid-ViewHelper, just that it is called directly :)


Yes, that's possible. Here are the view helpers available that are already available:
- https://github.com/aimeos/aimeos-core/tree/2015.10/lib/mwlib/src/MW/View/Helper
- https://github.com/aimeos/aimeos-core/tree/2015.10/client/html/src/MW/View/Helper

andreas.allacher wrote:ad 4.) So in the current aimeos Version I would be able to select existing files and can upload existing files to certain locations on the filesystem like fileadmin/products ? Instead of uploads/... ?


Yes, you can change the configuration settings for the file system path.

andreas.allacher wrote:Regarding FAL it acutally only stores entries in sys_file to the file and links records to it using sys_file_reference. However, in aimeos it would be enough to link to the sys_file directly (storing the UID of the sys_file) because everything else is stored in aimeos.


This sounds not that complicated but for the API FAL is offering we've found no documentation.

andreas.allacher wrote:ad 6.) I meant when I upload a file using the upload feature in the media items, can I rename it afterwards?


Like Norbert said: You have to change the URI reference in the media item afterwards (which is relative to the configured content base URL).

andreas.allacher wrote:ad 9.) So I can only deny access to the admin interface completely?


Yep, that's correct. This will be addressed in the future for sure but not short-term.

andreas.allacher wrote:However, I guess the easiest solution would be to all those issues would be to let users input data using own TYPO3 tables and on save or periodically I migrate that data into aimeos?


If that would be the solution I would rather recommend one of the TYPO3 cart extensions, which doesn't provide a full shop system but a basket and a checkout.

andreas.allacher wrote:Is there any documentation on how that data has to look like?


There's an entity relationship model available: https://aimeos.org/docs/Developers#Library
#2256 by andreas.allacher
17 Dec 2015, 18:48
I actually need the shop system because cart and checkout is not enough but for the backend users it would be enough to input the products with prices and images.
Therefore, I could let them input data using natve TYPO3 and then upon save in the backend it would be migrated to aimeos.

The other data it should be enough if it can be managed via Aimeos (like orders etc.) and then only users that should have access to those would get full aimeos access (or later on maybe more limited access).

EDIT: However, maybe I can just create hooks etc. for file links and page links. If so, I might create a PR later but it surely won't be this year :)
Last edited by andreas.allacher on 17 Dec 2015, 19:00, edited 2 times in total.
#2257 by andreas.allacher
17 Dec 2015, 18:53
Regarding FAL
\TYPO3\CMS\Core\Resource\ResourceFactory
is actually the main class here and \TYPO3\CMS\Core\Resource\FileRepository (would be used to find an existing file refernce by relation)
although ResourceFactory should be enough.
e.g. using retrieveFileOrFolderObject you could retrieve a folder from website root by using 0:/<folder> and then the folder object has the addFile method.
FileReferences itself are usually added by using the DataHandler in the Backend, although it could just be done directly or as said ignored.

Details can also be found here:
https://wiki.typo3.org/File_Abstraction_Layer (see add File / add file reference)
#2258 by aimeos
17 Dec 2015, 19:54
andreas.allacher wrote:I actually need the shop system because cart and checkout is not enough but for the backend users it would be enough to input the products with prices and images.
Therefore, I could let them input data using natve TYPO3 and then upon save in the backend it would be migrated to aimeos.


Aimeos is very flexible and no monolithic block. Instead, you can replace parts or add your own code. Other Aimeos developers already created their own admin interfaces suited for their specific needs. This should be also the best choice for your situation.

Instead of accessing the database directly, please use the managers from the ./lib/mshoplib/ layer. They offer an abstraction from the concrete storage so it's possible to split the database or push the products into Solr/ElasticSearch without any changes required in your code. For creating and working with the objects, you need the Aimeos context object that can be created with
Code: Select all\Aimeos\Aimeos\Base::getContext()

from the Aimeos TYPO3 extension. The forum contains various posts how to work with the managers afterwards.
#2259 by andreas.allacher
17 Dec 2015, 20:23
Yes, I think that might be indeed the best solution.

That way I have all the features backend users know from TYPO3 (and easily input products that way) and the power of aimeos for Frontend and for detailled configuration.
And if I need further options in TYPO3 directly I can always add further managers like e.g. orders (that might also be required but not at the beginning).

Thanks for letting me know regarding the objects, I prefer to use native API isntead of adding directly via database (should also be easier to update).

Thanks for all the feedback.
#2260 by nos3
21 Dec 2015, 10:05
andreas.allacher wrote:Thanks for letting me know regarding the objects, I prefer to use native API isntead of adding directly via database (should also be easier to update).


You should use the current dev-master that will be the base for the new release next month. After years of stability, it contains some breaking changes like full PSR-4 compliance. The documentation hasn't been updated yet, so you may ask here in the forum for details.

Norbert