Locating components / templates

Questions around the Aimeos bundle for the Symfony framework
Forum rules
Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Doveman
Posts: 23
Joined: 06 Nov 2017, 20:59

Locating components / templates

Post by Doveman » 13 Nov 2017, 19:43

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.

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

Re: Locating components / templates

Post by aimeos » 14 Nov 2017, 21:25

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

GalinaBublik
Posts: 5
Joined: 20 Nov 2017, 12:58

Re: Locating components / templates

Post by GalinaBublik » 20 Nov 2017, 13:21

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?

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

Re: Locating components / templates

Post by aimeos » 20 Nov 2017, 22:40

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

GalinaBublik
Posts: 5
Joined: 20 Nov 2017, 12:58

Re: Locating components / templates

Post by GalinaBublik » 21 Nov 2017, 10:06

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(

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

Re: Locating components / templates

Post by aimeos » 22 Nov 2017, 00:13

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

GalinaBublik
Posts: 5
Joined: 20 Nov 2017, 12:58

Re: Locating components / templates

Post by GalinaBublik » 22 Nov 2017, 09:09

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?

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

Re: Locating components / templates

Post by aimeos » 22 Nov 2017, 22:16

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
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

GalinaBublik
Posts: 5
Joined: 20 Nov 2017, 12:58

Re: Locating components / templates

Post by GalinaBublik » 24 Nov 2017, 12:20

Deleted configurated. Not working whatever(
Any else ideas?

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

Re: Locating components / templates

Post by aimeos » 24 Nov 2017, 20:58

Remove the session cookie from your browser. You will get a new session without cached mini basket
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply