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

I have added two files in my ext folder I have created under >>

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:

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?

#4338 by aimeos
21 Jun 2017, 21:03
OK, if you want to use the mini basket component in your own pages (not only those that are offered by the Aimeos Laravel package by default), you should have a look into this article explaining the details:
#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

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
#4344 by aimeos
23 Jun 2017, 15:51
In this case, a common Laravel service provider might be really the best option:

There you can inject the output of the "Page" object you've defined in the config for all templates.