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)
#2572 by mathiass
02 Mar 2016, 00:57
Hello community!

Aimeos seems to me a very interesting project. But the documentation is a bit confusing when referring to overwriting views.

Someone has a tutorial or I could give a guide on how to do?

Thank you. :)
#2573 by aimeos
02 Mar 2016, 09:50
The views itself are pretty straight forward: Just HTML with alternative PHP syntax.

You have access to all data that has been assigned by the HTML client which renders the view as well as all data that has been assigned by parent HTML clients, e.g.

| => template: catalog/detail/body-default.php
| => assigns: detailProductItem, detailProductMediaItems, etc.
|- Client/Html/Catalog/Detail/Basket/Standard
| => template: catalog/detail/basket-body-default.php
| => assigns: basketStockUrl, etc.
|-- Client/Html/Catalog/Detail/Basket/Selection/Standard
| => template: catalog/detail/basket-selection-body-default.php
| => assigns: selectionProducts, selectionAttributeItems, etc.

In the template of the selection HTML client, you have now access to selectionProducts, selectionAttributeItems, basketStockUrl, detailProductMediaItems, detailProductItem. You should have a look into the templates and the HTML clients to find out which data they assign.

To access the data in the view, you can use
Code: Select all$this->get( 'selectionProducts', array() );   // second parameter is the default value if not available
$this->selectionProducts;   // (throws an exception if not available)

Additionally, there are some view helpers available. They are located in:

To use the view helpers in the view, call e.g.
Code: Select allecho $this->url( $target, $controller, $action, $params, $trailing, $config );

The example prints the generated URL for the given parameters. Use lower-case for all view helpers, i.e. "url()" for the view helper in the "Url" directory. The parameters for each view helper varies, so so should have a look into the interface or implementation of the view helper you want to use.

These are the view helpers that are available:
* block: Extend from parent templates like in Blade or Twig
* config: Access to the configuration settings
* content: Generate media URL
* csrf: CSRF security for form posts
* date: Localized dates
* encoder: Quoting output to avoid security breaches
* formparam: Generates values for the "name" attribute of input elements
* mail: Access to an e-mail message that can be filled
* number: Localized number format
* param: Access to get/post/url parameters
* partial: Renders the given sub-template
* request: PSR-7 request object
* response: PSR-7 response object
* url: Generates URLs
* value: Access values in multi-dimensional arrays in a simple way

Hope that helps a bit :-)
#2579 by aimeos
02 Mar 2016, 13:08
Yes, the templates are shared in all environments (Laravel, Symfony, Flow, TYPO3, etc.)