Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4331 by bill
20 Jun 2017, 22:06
Hello

I have added two files in my ext folder I have created under >>
client/html/templates/basket/mini/body-default.php

client/html/templates/basket/mini/header-default.php
and in this file I have this code >>
------
foreach( $this->miniBasket->getProducts() as $product ) {
$quantity += $product->getQuantity();
}

echo $quantiy;
-------

basically when I call this <?= $aiheader['basket/mini'] ?> I want to return the quanity of the basket??
I added this to my balde template <?= $aiheader['basket/mini'] ?> and its returning empty??

what I am doing wrong here?
#4336 by bill
21 Jun 2017, 15:51
aimeos wrote:Maybe the content of the basket is cached if you didn't configure otherwise in your dev environment:
https://aimeos.org/docs/Configuration/Core/client/html/basket/cache/enable


I already have it cached , how can I make sure that when I display this : <?= $aiheader['basket/mini'] ?> . in my blade template I want it to work across the whole site, but right now its not working I am getting undefined error on some pages?

could you help me?

Thanks
#4339 by bill
21 Jun 2017, 21:15
Yes I see your point

but I need to make it available in ALL pages Aimeos and my pages , basically in the header.blade I have created that I need to be able to call that array and it will work?

do I need to create a new serviceprovider?
#4340 by aimeos
21 Jun 2017, 21:28
No, you don't. Only configure a new section in your ./config/shop.php:
Code: Select all'page' => array(
    // ... existing entries
    'aimeosall' => array('basket/mini'),
),

Add this to your actions:
Code: Select all$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'mypage' );
// do some more stuff
return \View::make('mypagetmpl', $params);

Then you can use "<?= $aiheader['basket/mini'] ?>" in every template.
#4341 by bill
21 Jun 2017, 21:49
for this :
$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'mypage' );
// do some more stuff
return \View::make('mypagetmpl', $params);

What you mean add to your action? where exactly?

I am not trying to create a new page I just need to use the $aiheader['basket/mini'] in ALL my template
#4343 by bill
22 Jun 2017, 15:36
Thanks

but when you do this in ./config/shop.php you are specifying that variable $aiheader['basket/mini'] in the HOME PAGE only
Code: Select all'page' => array(
      // ...
      'home' => array( 'catalog/filter' ),
   ),


I need to be able to add this variable if I want in my layout blade template and it will used by all the pages without getting error of undefined

right now I get undefined error on the other pages