Several theme loading views problem

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Several theme loading views problem

Post by aimeos » 13 May 2022, 13:22

First of all, 2021.07.x isn't supported any more, only 2021.10.x LTS.

Furthermore, 2021.x was never tested with several themes for different sites in one setup while in 2022.04+ it's officially supported when using PHP templates. We have also no experience if there are any problems when using Blade templates that replace the standard PHP templates as this way is not widely used among Aimeos developers (you can use Laravel objects/functions in the PHP templates too but no Blade syntax).

As you've said before, you've already disabled the Aimeos content cache, so it doesn't seem to be a caching problem which would always be our first guess.

Another problem could be that the client/html templates are not bound to the themes you've installed because they all have the same name and may be loaded by the view in random order and the last one is used. You can test if that's the problem by renaming your overwritten templates and configure their new names in the Locale > Site Option/Value table.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: Several theme loading views problem

Post by aimeos » 13 May 2022, 13:52

Most likely, the Laravel Blade template engine chooses the wrong template file because Laravel has no concept of multi-site/multi-tenancy within one installation:
https://github.com/aimeos/ai-laravel/bl ... de.php#L48
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Several theme loading views problem

Post by krzysiekp » 17 May 2022, 08:56

I have a small mutlishop, so I will convert it into my own controllers and template and use the Aimeos code, then I will have full control over it.

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

Re: Several theme loading views problem

Post by aimeos » 18 May 2022, 06:11

Another option might be to overwrite the same templates in all theme extensions, i.e. if you need to overwrite ./templates/client/html/catalog/detail/body.php in one extension, you also need to add a copy in every other theme extension so the template files are not mixed between themes.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Several theme loading views problem

Post by krzysiekp » 18 May 2022, 06:32

But that's how I got it done now and it keeps on mixing.
I had done as you write from the very beginning and there is still a problem.

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

Re: Several theme loading views problem

Post by aimeos » 18 May 2022, 06:54

Then, it's most likely that the Laravel Blade view integration mixes things up as it doesn't happen when using the Aimeos PHP templates.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Several theme loading views problem

Post by krzysiekp » 18 May 2022, 07:19

Are you able to fix it ?
Then, it's most likely that the Laravel Blade view integration mixes things up as it doesn't happen when using the Aimeos PHP templates.
Then I have to use Aimeos standalone shop ?

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

Re: Several theme loading views problem

Post by aimeos » 18 May 2022, 07:36

Not sure about that. Laravel may support a file syntax like "mytheme::catalog/detail/body" if you place the .blade.php templates in the ./view/ directory of the theme extensions.

Can you check if it works for one theme if you add the theme name as "<mytheme>::$filename" here (in ./vendor/aimeos/ai-laravel/lib/custom/src/MW/View/Engine/Blade.php, Line 48, replace "<mytheme>" with your theme name):
https://github.com/aimeos/ai-laravel/bl ... de.php#L48
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

krzysiekp
Posts: 85
Joined: 05 Nov 2021, 16:19

Re: Several theme loading views problem

Post by krzysiekp » 18 May 2022, 14:48

$filename variable contains full path for file. Example:

C:\xampp\htdocs\giftcard\vendor\aimeos-themes\sk-theme\client\html\templates\catalog\stage\body-standard.blade.php

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

Re: Several theme loading views problem

Post by aimeos » 19 May 2022, 06:33

If you switch sites with different themes, is the theme name in the file path still the same?

Can you dump "$this->paths" here and check what the array contains when you switch sites with different themes?
https://github.com/aimeos/aimeos-base/b ... #L296-L317
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply