Page 1 of 2

Locating components / templates

Posted: 13 Nov 2017, 19:43
by Doveman
I am having a bit of a problem understanding where certain function take place.
For example if I want to change the format for {% block aimeos_nav %}{% endblock %}
I can find the templates and I understand how to overwrite them, and I can find the views and how to overwite them, but I can't figure out where blocks aimeos_nav or aimeos_body etc. are located or how I would overwrite it.

Re: Locating components / templates

Posted: 14 Nov 2017, 21:25
by aimeos
You must understand that Aimeos consists of different components, the core is a PHP library and the Symfony bundle using it. The core itself consists of a few composer packages, e.g. one that renders the HTML blocks which are included in the Twig templates (ai-client-html). Here's the software stack of the core:
https://aimeos.org/docs/Developers/Software_stack

The HTML is generated by these templates:
https://github.com/aimeos/ai-client-htm ... /templates

To overwrite or extend them, you need to copy those you want to change in your own project-specific Aimeos extension:
https://aimeos.org/docs/Developers/Create_an_extension

Re: Locating components / templates

Posted: 20 Nov 2017, 13:21
by GalinaBublik
aimeos wrote:You must understand that Aimeos consists of different components, the core is a PHP library and the Symfony bundle using it. The core itself consists of a few composer packages, e.g. one that renders the HTML blocks which are included in the Twig templates (ai-client-html). Here's the software stack of the core:
https://aimeos.org/docs/Developers/Software_stack

The HTML is generated by these templates:
https://github.com/aimeos/ai-client-htm ... /templates

To overwrite or extend them, you need to copy those you want to change in your own project-specific Aimeos extension:
https://aimeos.org/docs/Developers/Create_an_extension
Can you more explane this?
Working on "symfony/symfony": "3.3.*","aimeos/aimeos-symfony": "~2017.10", PHP Version 5.6.29, Window 8.
I see template in my_project\ext\ai-client-html\client\html\templates, try edit him - but changes not show in the front end. Directory my_project\vendor\aimeos\aimeos-core\misc\ext-template\client\html\templates is empty(
Coppied ai-client-html directory to app/Resources and single directories from ai-client-html\client\html\templates.
Edit my config client:
html:
catalog:
basket:
mini:
template-body: basket/mini/body-default.html.twig
My custom class not shown.
What i do wrong?

Re: Locating components / templates

Posted: 20 Nov 2017, 22:40
by aimeos
Caching is enabled by default as long as you don't disable it during development. Add this to your ./app/config/config.yml (four spaces per level) to disable caching:

Code: Select all

aimeos_shop:
    madmin:
        cache:
            manager:
                name: None
The basket is cached too until it's updated as long as you don't disable caching for this as well:
https://aimeos.org/docs/Configuration/C ... che/enable

You can find more how to set configuration options here:
https://aimeos.org/docs/Symfony/Change_configuration

Re: Locating components / templates

Posted: 21 Nov 2017, 10:06
by GalinaBublik
Thank you for the answer - but it's not working.
Added example of code to my config, clear cache for project, use dev environment.

Can you tell full path to template in core, example project\vendor\aimeos\aimeos-core ...
also full path to directory where i must copy this template, exapmle project\app\Resources\AimeosBundle\...

I think i did wrong copy(

Re: Locating components / templates

Posted: 22 Nov 2017, 00:13
by aimeos
For example, the template for the catalog list view is in ./ext/ai-client-html/client/html/templates/catalog/lists/body-default.php

You have to generate your own project-specific Aimeos extension and place it in the ./ext/ folder to, e.g. named "myproject". Then, you have to copy the template you want to overwrite (e.g. the catalog list template) to ./ext/myproject/client/html/templates/catalog/lists/body-default.php

Re: Locating components / templates

Posted: 22 Nov 2017, 09:09
by GalinaBublik
Added to config.yml
aimeos_shop:
client:
html:
basket:
mini:
template-body: basket/mini/body-default.html.twig

Added class for test in symshop\ext\ai-client-html\client\html\templates\basket\mini\body-default.php then copied them to symshop\ext\symshop\client\html\templates\basket\mini\, changed new template for my design.
After added product to cart (cache: manager: name: None - not working) i can see changes, but i see file from core aimeos((
Something wrong?

Re: Locating components / templates

Posted: 22 Nov 2017, 22:16
by aimeos
If you copy the PHP template file, don't configure the "template-body" setting. This is not necessary and you told Aimeos that you want to use the Twig engine for processing the file and this is only valid if you rewrite the file to use the Twig syntax.

The mini basket component has an additional caching mechanism in the session of the user. It's only updated if you change the products in the basket or their quantity or by setting this configuration to 0:
https://aimeos.org/docs/Configuration/C ... che/enable

Re: Locating components / templates

Posted: 24 Nov 2017, 12:20
by GalinaBublik
Deleted configurated. Not working whatever(
Any else ideas?

Re: Locating components / templates

Posted: 24 Nov 2017, 20:58
by aimeos
Remove the session cookie from your browser. You will get a new session without cached mini basket