Transforming from php to blade yield 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!
thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Transforming from php to blade yield problem

Post by thestranger » 10 Nov 2025, 05:22

Laravel ^12.0
Aimeos ~2025.10
PHP ^8.2
I have a problem when transforming from blocks to section/yield. when I do that, it ignores the page settings from the config (unless i mismanaged something)
i will use the example of catalog/filter and search.
catalog/filter/body.blade.php:

Code: Select all

{{--
@license LGPLv3, http://opensource.org/licenses/LGPL-3.0
@copyright Metaways Infosystems GmbH, 2012
@copyright Aimeos (aimeos.org), 2015-2025

client/html/catalog/lists/url/target
Destination of the URL where the controller specified in the URL is known

The destination can be a page ID like in a content management system or the
module of a software development framework. This "target" must contain or know
the controller that should be called by the generated URL.

@param string Destination of the URL
@since 2014.03
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/controller
Name of the controller whose action should be called

In Model-View-Controller (MVC) applications, the controller contains the methods
that create parts of the output displayed in the generated HTML page. Controller
names are usually alpha-numeric.

@param string Name of the controller
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/action
Name of the action that should create the output

In Model-View-Controller (MVC) applications, actions are the methods of a
controller that create parts of the output displayed in the generated HTML page.
Action names are usually alpha-numeric.

@param string Name of the action
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/config
Associative list of configuration options used for generating the URL

You can specify additional options as key/value pairs used when generating
the URLs, like

 client/html/<clientname>/url/config = array( 'absoluteUri' => true )

The available key/value pairs depend on the application that embeds the e-commerce
framework. This is because the infrastructure of the application is used for
generating the URLs. The full list of available config options is referenced
in the "see also" section of this page.

@param string Associative list of configuration options
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/filter
Removes parameters for the detail page before generating the URL

This setting removes the listed parameters from the URLs. Keep care to
remove no required parameters!

@param array List of parameter names to remove
@since 2022.10
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config

client/html/catalog/multiroute
Enables multiple entities sharing the same route

To allow categories, products, CMS pages, etc. sharing the same route, you
have to enable this option.

@param bool TRUE to enable resolving multi-routes, FALSE if not
@since 2023.10
--}}

@php
    $multi = aiconfig('client/html/catalog/multiroute', false);
    $linkKey = ($multi && request()->input('path') || request()->input('f_catid')) ? 'client/html/catalog/tree/url' : 'client/html/catalog/lists/url';
    $params = collect(request()->all())->only(['path', 'f_catid', 'f_name', 'f_search']);
    if($catid = aiconfig('client/html/catalog/filter/tree/startid')) {
        $params = $params->union(['f_catid' => $catid]);
    }
@endphp

<div class="section aimeos catalog-filter" data-jsonurl="{{ airoute(aiconfig('client/jsonapi/url/target', '/jsonapi')) }}">
    <nav class="container-xxl">
        <form method="GET" action="{{ airoute(aiconfig($linkKey . '/target', '/catalog/lists'), $params->all()) }}">
            @foreach(collect(request()->all())->only(['f_sort', 'l_type']) as $name => $value)
                <input type="hidden" name="{{ $name }}" value="{{ $value }}">
            @endforeach
            {{-- @include('catalog.filter.tree-body')
            @include('catalog.filter.search-body')
            @include('catalog.filter.price-body')
            @include('catalog.filter.supplier-body')
            @include('catalog.filter.attribute-body') --}}


           @yield('catalog/filter/tree')
            @yield('catalog/filter/search')
            @yield('catalog/filter/price')
            @yield('catalog/filter/supplier')
            @yield('catalog/filter/attribute')

        </form>
    </nav>
</div>
catalog/filter/search-body.blade.php:

Code: Select all

{{--
@license LGPLv3, http://opensource.org/licenses/LGPL-3.0
@copyright Aimeos (aimeos.org), 2015-2025

client/html/catalog/suggest/url/target
Destination of the URL where the controller specified in the URL is known

The destination can be a page ID like in a content management system or the
module of a software development framework. This "target" must contain or know
the controller that should be called by the generated URL.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/target

@param string Destination of the URL
@since 2014.03
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/controller
Name of the controller whose action should be called

In Model-View-Controller (MVC) applications, the controller contains the methods
that create parts of the output displayed in the generated HTML page. Controller
names are usually alpha-numeric.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/controller

@param string Name of the controller
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/action
Name of the action that should create the output

In Model-View-Controller (MVC) applications, actions are the methods of a
controller that create parts of the output displayed in the generated HTML page.
Action names are usually alpha-numeric.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/action

@param string Name of the action
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/config
Associative list of configuration options used for generating the URL

You can specify additional options as key/value pairs used when generating
the URLs, like

 client/html/<clientname>/url/config = array( 'absoluteUri' => true )

The available key/value pairs depend on the application that embeds the e-commerce
framework. This is because the infrastructure of the application is used for
generating the URLs. The full list of available config options is referenced
in the "see also" section of this page.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/config

@param string Associative list of configuration options
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/filter
Removes parameters for the detail page before generating the URL

This setting removes the listed parameters from the URLs. Keep care to
remove no required parameters!

@param array List of parameter names to remove
@since 2022.10
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config

client/html/catalog/filter/search/force-search
Always reuse the current input for full text searches

Normally, the full text search string is added to the input field after each
search. This is also the standard behavior of other shops.

If it's desired, setting this configuration option to "0" will drop the full
text search input so it's not used if the user selects a category or attribute
filter.

@param boolean True to reuse the search string, false to clear after each search
@since 2020.04
--}}

@php
    // $multi = aiconfig('client/html/catalog/multiroute', false);
    // $linkKey =
    //     ($multi && request()->input('path')) || request()->input('f_catid')
    //         ? 'client/html/catalog/tree/url'
    //         : 'client/html/catalog/lists/url';
    // $params = collect(request()->all())->only(['path', 'f_catid', 'f_name', 'f_search']);
    $enforce = aiconfig('client/html/catalog/filter/search/force-search', true);
@endphp
@section('catalog/filter/search')
{{-- <form method="GET" action="{{ airoute(aiconfig($linkKey . '/target', '/catalog/lists'), $params->all()) }}">
    @foreach (collect(request()->all())->only(['f_sort', 'l_type']) as $name => $value)
        <input type="hidden" name="{{ $name }}" value="{{ $value }}">
    @endforeach --}}

    <div class="section catalog-filter-search ps-1" aria-label="{{ aitrans('Product search', [], 'client') }}">

        <!-- Toggle button for mobile (below lg) -->
        <button class="btn d-lg-none p-0" data-bs-toggle="offcanvas" data-bs-target="#offcanvasSearch"
            aria-controls="offcanvasSearch" aria-label="{{ aitrans('Toggle search', [], 'client') }}">
            <i class="bi bi-search" style="font-size: 32px;"></i>
        </button>

        <!-- Responsive offcanvas (hidden below lg, inline above lg) -->
        <div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasSearch"
            aria-labelledby="offcanvasSearchLabel">
            <div class="offcanvas-header d-lg-none">
                <h5 class="offcanvas-title" id="offcanvasSearchLabel">{!! aitrans('Search', [], 'client') !!}</h5>
                <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasSearch"
                    aria-label="Close"></button>
            </div>
            <div class="offcanvas-body">
                <div class="input-group">
                    <input class="form-control value" autocomplete="off" name="f_search"
                        title="{{ aitrans('Search', [], 'client') }}"
                        placeholder="{{ aitrans('Search', [], 'client') }}"
                        value="{{ $enforce ? request()->input('f_search') : '' }}"
                        data-url="{{ airoute(aiconfig('client/html/catalog/suggest/url/target', '/catalog/suggest'), ['f_search' => '_term_']) }}"
                        data-hint="{{ aitrans('Please enter at least three characters', [], 'client') }}">
                    <button class="btn btn-outline-secondary reset" type="reset"
                        title="{{ aitrans('Reset', [], 'client') }}"><i class="bi bi-x"></i></button>
                    <button class="btn btn-outline-secondary btn-search" type="submit"
                        title="{{ aitrans('Search', [], 'client') }}"><i class="bi bi-search"></i></button>
                </div>
            </div>
        </div>
    </div>
{{-- </form> --}}

@endsection
@yield('catalog/filter/search')
basically what happens, if i dont @include, nothing appears. if I @include they appear twice (which is obvious due to double yield). if i remove the yield they appear once but the page settings from the config get ignored (I can no longer tell it to not show search in specific locations etc) and everything appears everywhere (got price, supplier, attribute in the navbar)

Code: Select all

'page' => [
		'account-index' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'account/profile', 'account/review', 'account/subscription', 'account/basket', 'account/history', 'account/favorite', 'account/watch', 'catalog/session'],
		'basket-index' => ['locale/select', 'catalog/tree', 'catalog/search', 'basket/standard', 'basket/bulk', 'basket/related'],
		'catalog-count' => ['catalog/count'],
		'catalog-detail' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/stage', 'catalog/detail', 'catalog/session'],
		'catalog-home' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/home'],
		'catalog-list' => ['locale/select', 'basket/mini', 'catalog/filter', 'catalog/tree', 'catalog/search', 'catalog/price', 'catalog/supplier', 'catalog/attribute', 'catalog/session', 'catalog/stage', 'catalog/lists'],
		'catalog-session' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'catalog/session'],
		'catalog-stock' => ['catalog/stock'],
		'catalog-suggest' => ['catalog/suggest'],
		'catalog-tree' => ['locale/select', 'basket/mini', 'catalog/filter', 'catalog/tree', 'catalog/search', 'catalog/price', 'catalog/supplier', 'catalog/attribute', 'catalog/session', 'catalog/stage', 'catalog/lists'],
		'checkout-confirm' => ['catalog/tree', 'catalog/search', 'checkout/confirm'],
		'checkout-index' => ['locale/select', 'catalog/tree', 'catalog/search', 'checkout/standard'],
		'checkout-update' => ['checkout/update'],
		'supplier-detail' => ['locale/select', 'basket/mini', 'catalog/tree', 'catalog/search', 'supplier/detail', 'catalog/lists'],
		'cms' => ['cms/page', 'catalog/tree', 'basket/mini'],
	],
is this expected? am i missing something?
Last edited by thestranger on 10 Nov 2025, 05:35, edited 2 times in total.

thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Re: Transforming from php to blade yield problem

Post by thestranger » 10 Nov 2025, 05:27

Oh and if it is expected, is there a way to reintegrate the page settings back into the section logic or am I supposed to keep using the block logic instead of the section yield logic. it is weird because in the docs you use a similar example and that's what I went for. are the docs wrong in this case?

thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Re: Transforming from php to blade yield problem

Post by thestranger » 10 Nov 2025, 06:56

I should also add that not replacing the body (catalog/filter/body) with blade makes the sections (from the replaced components such as search-body.blade.php) work normally, respecting the page settings and everything, probably because it uses blocks.

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

Re: Transforming from php to blade yield problem

Post by aimeos » 10 Nov 2025, 13:00

Can you remove the @section, @endsection and @yield in your catalog/filter/search-body.blade.php?
@include add the output of the included template directly.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Re: Transforming from php to blade yield problem

Post by thestranger » 10 Nov 2025, 15:21

Of course but that doesn't really solve the underlying problem of losing the page settings. including them makes them always appear in the filter, wherever filter is located, such as navbar for the tree, left side for the actual filter and wherever I yield aimeos_head_search since that contains catalog/search which has filter component.
(in the code below I just commented that but I have also tested on a new project+new extension with the lines properly deleted)

Code: Select all

{{--
@license LGPLv3, http://opensource.org/licenses/LGPL-3.0
@copyright Aimeos (aimeos.org), 2015-2025

client/html/catalog/suggest/url/target
Destination of the URL where the controller specified in the URL is known

The destination can be a page ID like in a content management system or the
module of a software development framework. This "target" must contain or know
the controller that should be called by the generated URL.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/target

@param string Destination of the URL
@since 2014.03
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/controller
Name of the controller whose action should be called

In Model-View-Controller (MVC) applications, the controller contains the methods
that create parts of the output displayed in the generated HTML page. Controller
names are usually alpha-numeric.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/controller

@param string Name of the controller
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/action
Name of the action that should create the output

In Model-View-Controller (MVC) applications, actions are the methods of a
controller that create parts of the output displayed in the generated HTML page.
Action names are usually alpha-numeric.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/action

@param string Name of the action
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/config
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/config
Associative list of configuration options used for generating the URL

You can specify additional options as key/value pairs used when generating
the URLs, like

 client/html/<clientname>/url/config = array( 'absoluteUri' => true )

The available key/value pairs depend on the application that embeds the e-commerce
framework. This is because the infrastructure of the application is used for
generating the URLs. The full list of available config options is referenced
in the "see also" section of this page.

Note: Up to 2015-02, the setting was available as
client/html/catalog/listsimple/url/config

@param string Associative list of configuration options
@since 2014.03
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/filter

client/html/catalog/suggest/url/filter
Removes parameters for the detail page before generating the URL

This setting removes the listed parameters from the URLs. Keep care to
remove no required parameters!

@param array List of parameter names to remove
@since 2022.10
@see client/html/catalog/suggest/url/target
@see client/html/catalog/suggest/url/controller
@see client/html/catalog/suggest/url/action
@see client/html/catalog/suggest/url/config

client/html/catalog/filter/search/force-search
Always reuse the current input for full text searches

Normally, the full text search string is added to the input field after each
search. This is also the standard behavior of other shops.

If it's desired, setting this configuration option to "0" will drop the full
text search input so it's not used if the user selects a category or attribute
filter.

@param boolean True to reuse the search string, false to clear after each search
@since 2020.04
--}}

@php
    // $multi = aiconfig('client/html/catalog/multiroute', false);
    // $linkKey =
    //     ($multi && request()->input('path')) || request()->input('f_catid')
    //         ? 'client/html/catalog/tree/url'
    //         : 'client/html/catalog/lists/url';
    // $params = collect(request()->all())->only(['path', 'f_catid', 'f_name', 'f_search']);
    $enforce = aiconfig('client/html/catalog/filter/search/force-search', true);
@endphp
{{-- @section('catalog/filter/search') --}}


    <div class="section catalog-filter-search ps-1" aria-label="{{ aitrans('Product search', [], 'client') }}">

        <!-- Toggle button for mobile (below lg) -->
        <button class="btn d-lg-none p-0" data-bs-toggle="offcanvas" data-bs-target="#offcanvasSearch"
            aria-controls="offcanvasSearch" aria-label="{{ aitrans('Toggle search', [], 'client') }}">
            <i class="bi bi-search" style="font-size: 32px;"></i>
        </button>

        <!-- Responsive offcanvas (hidden below lg, inline above lg) -->
        <div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasSearch"
            aria-labelledby="offcanvasSearchLabel">
            <div class="offcanvas-header d-lg-none">
                <h5 class="offcanvas-title" id="offcanvasSearchLabel">{!! aitrans('Search', [], 'client') !!}</h5>
                <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasSearch"
                    aria-label="Close"></button>
            </div>
            <div class="offcanvas-body">
                <div class="input-group">
                    <input class="form-control value" autocomplete="off" name="f_search"
                        title="{{ aitrans('Search', [], 'client') }}"
                        placeholder="{{ aitrans('Search', [], 'client') }}"
                        value="{{ $enforce ? request()->input('f_search') : '' }}"
                        data-url="{{ airoute(aiconfig('client/html/catalog/suggest/url/target', '/catalog/suggest'), ['f_search' => '_term_']) }}"
                        data-hint="{{ aitrans('Please enter at least three characters', [], 'client') }}">
                    <button class="btn btn-outline-secondary reset" type="reset"
                        title="{{ aitrans('Reset', [], 'client') }}"><i class="bi bi-x"></i></button>
                    <button class="btn btn-outline-secondary btn-search" type="submit"
                        title="{{ aitrans('Search', [], 'client') }}"><i class="bi bi-search"></i></button>
                </div>
            </div>
        </div>
    </div>
{{--
@endsection
@yield('catalog/filter/search') --}}

Code: Select all

{{--
@license LGPLv3, http://opensource.org/licenses/LGPL-3.0
@copyright Metaways Infosystems GmbH, 2012
@copyright Aimeos (aimeos.org), 2015-2025

client/html/catalog/lists/url/target
Destination of the URL where the controller specified in the URL is known

The destination can be a page ID like in a content management system or the
module of a software development framework. This "target" must contain or know
the controller that should be called by the generated URL.

@param string Destination of the URL
@since 2014.03
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/controller
Name of the controller whose action should be called

In Model-View-Controller (MVC) applications, the controller contains the methods
that create parts of the output displayed in the generated HTML page. Controller
names are usually alpha-numeric.

@param string Name of the controller
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/action
Name of the action that should create the output

In Model-View-Controller (MVC) applications, actions are the methods of a
controller that create parts of the output displayed in the generated HTML page.
Action names are usually alpha-numeric.

@param string Name of the action
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/config
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/config
Associative list of configuration options used for generating the URL

You can specify additional options as key/value pairs used when generating
the URLs, like

 client/html/<clientname>/url/config = array( 'absoluteUri' => true )

The available key/value pairs depend on the application that embeds the e-commerce
framework. This is because the infrastructure of the application is used for
generating the URLs. The full list of available config options is referenced
in the "see also" section of this page.

@param string Associative list of configuration options
@since 2014.03
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/filter

client/html/catalog/lists/url/filter
Removes parameters for the detail page before generating the URL

This setting removes the listed parameters from the URLs. Keep care to
remove no required parameters!

@param array List of parameter names to remove
@since 2022.10
@see client/html/catalog/lists/url/target
@see client/html/catalog/lists/url/controller
@see client/html/catalog/lists/url/action
@see client/html/catalog/lists/url/config

client/html/catalog/multiroute
Enables multiple entities sharing the same route

To allow categories, products, CMS pages, etc. sharing the same route, you
have to enable this option.

@param bool TRUE to enable resolving multi-routes, FALSE if not
@since 2023.10
--}}

@php
    $multi = aiconfig('client/html/catalog/multiroute', false);
    $linkKey = ($multi && request()->input('path') || request()->input('f_catid')) ? 'client/html/catalog/tree/url' : 'client/html/catalog/lists/url';
    $params = collect(request()->all())->only(['path', 'f_catid', 'f_name', 'f_search']);
    if($catid = aiconfig('client/html/catalog/filter/tree/startid')) {
        $params = $params->union(['f_catid' => $catid]);
    }
@endphp

<div class="section aimeos catalog-filter" data-jsonurl="{{ airoute(aiconfig('client/jsonapi/url/target', '/jsonapi')) }}">
    <nav class="container-xxl">
        <form method="GET" action="{{ airoute(aiconfig($linkKey . '/target', '/catalog/lists'), $params->all()) }}">
            @foreach(collect(request()->all())->only(['f_sort', 'l_type']) as $name => $value)
                <input type="hidden" name="{{ $name }}" value="{{ $value }}">
            @endforeach

            @include('catalog.filter.tree-body')
            @include('catalog.filter.search-body')
            @include('catalog.filter.price-body')
            @include('catalog.filter.supplier-body')
            @include('catalog.filter.attribute-body')

            {{-- @yield('catalog/filter/tree')
            @yield('catalog/filter/search')
            @yield('catalog/filter/price')
            @yield('catalog/filter/supplier')
            @yield('catalog/filter/attribute') --}}

        </form>
    </nav>
</div>

I have tested this also in a new project with a new extension just to check if any of my settings were affecting it. nope. same thing, i have search+attribute+supplier+price in 2-3 places (depending if i also yield aimeos_head_search in the base)
In conclusion, is there a way to still be able to use the page settings from config with blades? or is there another way I could limit where what appears?

I have noticed how the code adds up the data inside the $aibody and head variables, basically when using section yield no code gets captured there and when using include it's all of it, there's no in between like how blocks have for some reason
vendor/aimeos/aimeos-laravel/src/Controller/CatalogController.php
in treeAction() i added a print

Code: Select all

public function treeAction()
	{
		try
		{
			$params = ['page' => 'page-catalog-tree'];

			foreach( app( 'config' )->get( 'shop.page.catalog-tree' ) as $name )
			{
                error_log("\n\n".$name."\n\n".json_encode(Shop::get( $name )->body()));
				$params['aiheader'][$name] = Shop::get( $name )->header();
				$params['aibody'][$name] = Shop::get( $name )->body();
			}

			return Response::view( Shop::template( 'catalog.tree' ), $params )
				->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
		}
		catch( \Exception $e )
		{
			if( $e->getCode() >= 400 && $e->getCode() < 600 ) { abort( $e->getCode() ); }
			throw $e;
		}
	}
basically with blocks they get composed properly but with section yield you get nothing (for catalog/filter catalog/search etc) and with include you get all of them always as in catalog/filter contains everything regardless of your page settings

this happens in multiple locations where your documentation suggests using section yield by the way. So yea, @include works as long as you're fine with losing the config page settings. which kinda forces you to rewrite everything from scratch with includes and changing the structure since you no longer have control over which subcomponents (components seem fine, it's just the sub ones that break I think) you put where (aka being forced to have search only in the left aside and then css hiding the search and supplier inside the nav menu? or wherever you use aimeos_head_search to css hide supplier and everything else that appears except search just to have a search? that seems really bad) and I'll point out that it works fine without overriding the catalog/filter/body but that isn't really a fix, I am trying to make a laravel theme

Again, I may have missed something, who knows, but all I did was start laravel project, get the aimeos stuff set up, download the laravel theme extension from the aimeos website and integrate it, then put those replacement files in the templates/client/html/catalog/filter
oh and just to add this config also doesn't work anymore, removing search from the subparts does nothing with include, search is still there (same for removing anything else like supplier). so yea, you lose all subpart settings control
config/client.php in the extension (tested in the main config file too, same thing)

Code: Select all

<?php

return [
    'html' => [
        'catalog' => [
            'filter' => [
                'subparts' => [ 'price', 'supplier', 'attribute','search'],  // Exclude 'search'
            ],
        ],
    ],
    'jsonapi' => [
    ],
];

thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Re: Transforming from php to blade yield problem

Post by thestranger » 11 Nov 2025, 08:08

It would be really helpful to know if you can replicate the bug so I know if it's my fault on setting up the extension. (basically setting up body and search-body as blades and only including/yielding the search so you don't have to rewrite the other files since you have my code for those). Basically I need to know which direction to take, ditching the page settings entirely and doing includes? rewriting the controllers maybe? keeping the body as php (though that introduces other interesting bugs)?

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

Re: Transforming from php to blade yield problem

Post by aimeos » 12 Nov 2025, 11:12

I have to admit, that using Blade instead of PHP templates for every HTML client template haven't been used in the past by anyone. We've added that possibility for Laravel developers who really want to use Blade everywhere like you but it haven't been tested in the last years anymore due to nobody using it. That said, it's no surprise that there are cases that doesn't work out of the box any more or where the documentation may be outdated. Sorry for that if this is the case!

Basically, your approach is correct. The reason why the the catalog/filter component is a bit special relates to parts of it being used by several components:
- catalog/filter contains attribute, search, supplier, and tree
- catalog/search uses only search subpart
- catalog/attriubte only attribute subpart
- catalog/tree only tree subpart

This works when using PHP templates but we never testet that with Blade only templates. All other templates may work much better due to they are only used by one component.

There are two options now:
- You use the PHP templates and know it works
- You change all templates to Blade but need to find a solution for the catalog/filter edge case

In the later case we try to support you and we will integrate the fixes that will be required to make it fully work but we need your help because you are the only one using it that way.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

thestranger
Posts: 22
Joined: 06 Jun 2024, 04:34

Re: Transforming from php to blade yield problem

Post by thestranger » 13 Nov 2025, 01:49

I actually wouldn't mind at all if all you did was pointing me to the files that handle the view logic. I most likely can do a fix and then come back with the code or a git pull request for it. It's just that I haven't been able to locate where blocks are being linked to the page settings, specifically the part where they get excluded. And of course the other place where the logic happens for blade templates (since it does work for normal components and breaks only for subcomponents). So I think the logic for it to work is there, I just am unable to locate it and add a patch.

Another thing that might work is probably reworking the controllers and directly integrating the settings, or reworking the view blades into using yield and skipping the vars (maybe).

Just help in the sense of pointing me in the right direction would be appreciated regarding the difference between rendering the components vs subcomponents. (because I'd rather not take 3 different approaches due to time constraints)

Code: Select all

/**
	 * Returns the html for the catalog list page.
	 *
	 * @return \Illuminate\Http\Response Response object with output and headers
	 */
	public function listAction()
	{
		try
		{
			$params = ['page' => 'page-catalog-list'];

			foreach( app( 'config' )->get( 'shop.page.catalog-list' ) as $name )
			{
				$params['aiheader'][$name] = Shop::get( $name )->header();
				$params['aibody'][$name] = Shop::get( $name )->body();
			}

			return Response::view( Shop::template( 'catalog.list' ), $params )
				->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
		}
		catch( \Exception $e )
		{
			if( $e->getCode() >= 400 && $e->getCode() < 600 ) { abort( $e->getCode() ); }
			throw $e;
		}
	}
I get that in theory this part should handle it (due to it doing foreach based on the settings) but the bug seems to be deeper where either it doesn't load the the files like the normal components with body or something, I'm not sure. In theory I would just need to load the sections before them being yielded. Or somehow ignoring the include output though that seems overly complicated

My plan is to basically create an extension that uses laravel for the output but that integrates over aimeos. And I have translated the files and it works mostly, this is the only bug I couldn't fix (the error of subparts ignoring the settings)

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

Re: Transforming from php to blade yield problem

Post by aimeos » 14 Nov 2025, 10:38

This is the catalog/filter component including all sub-parts:
https://github.com/aimeos/ai-client-htm ... andard.php

This is the catalog/attribute component rendering only the attribute filter:
https://github.com/aimeos/ai-client-htm ... rd.php#L77

Here you can see, that catalog/attribute class extending from catalog/filter class but overwrites the getSubClientNames() methods to limit the called sub-client to "attribute" only. You find the catalog/filter/attribute sub-component here:
https://github.com/aimeos/ai-client-htm ... andard.php

That said, I think the catalog/filter/attribute template must keep the @section, @endsection and @yield tags and the catalog/filter template is where the problem must be fixed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply