Stock level is not visible on custom page

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!
D-Cell
Posts: 23
Joined: 17 Dec 2018, 17:47

Stock level is not visible on custom page

Post by D-Cell » 18 Dec 2019, 11:02

Hello, dear Aimeos team!

I made a custom controller for separate category page. Here is the code:

Code: Select all

class CategoryController extends Controller
{
    public function treeAction()
	{
		foreach( app( 'config' )->get( 'shop.page.catalog-tree' ) as $name )
		{
			$params['aiheader'][$name] = Shop::get( $name )->getHeader();
			$params['aibody'][$name] = Shop::get( $name )->getBody();
        }
        

        return Response::view( 'category', 
        [
            'params' => $params            
        ])
			->header( 'Cache-Control', 'private, max-age=10' );
	}
}
"Category" view looks like:

Code: Select all

@extends('layouts.layoutinner')
@section('content')
<div class="container">
    <div class="row">       
    {!! $params['aibody']['catalog/stage'] !!}
    {!! $params['aibody']['catalog/lists'] !!}
        </div>
    </div>
@endsection
List of products looks as i need, but the stock level (green/red square) on each product is not visible. In /shop page and product page everything is fine.

Please, tell me, how can i fix it?

Kind regards.

D-Cell
Posts: 23
Joined: 17 Dec 2018, 17:47

Re: Stock level is not visible on custom page

Post by D-Cell » 18 Dec 2019, 21:43

Sorry, forgot to provide my system info:

Aimeos 2019.10, Laravel 6.2, Fedora 30, PHP 7.3

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

Re: Stock level is not visible on custom page

Post by aimeos » 19 Dec 2019, 07:07

Stock level information is dynamically loaded using an asynchronous request (via JS). Please check if the /stock URL is part of the HTML header (in a <script>/script> tag) and no error is shown in the browser console.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

D-Cell
Posts: 23
Joined: 17 Dec 2018, 17:47

Re: Stock level is not visible on custom page

Post by D-Cell » 19 Dec 2019, 18:30

aimeos wrote: 19 Dec 2019, 07:07 Stock level information is dynamically loaded using an asynchronous request (via JS). Please check if the /stock URL is part of the HTML header (in a <script>/script> tag) and no error is shown in the browser console.
Yes! This is it! I didn`t have {!! $params['aiheader']['catalog/lists'] !!} in my layout header. Thank you! :D :D :D

Post Reply