Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4204 by Starringstars
16 May 2017, 16:58
How can I get the basket items with all their properties in another class. Separated from the vendor Laravel dir.
Not the frontend generated code but the php functions which are private or protected. Ore is there an abstract class which I can insert? :geek:

I know how to get the forntend with:
$params = app( '\Aimeos\Shop\Base\Page' )->getSections( 'basket-index' );
print_r ($params);

But need the backend ass well in php functions.

Thank you!
#4206 by aimeos
17 May 2017, 19:16
Did you read this article?

With the context object you can instantiate the basket controller and get the basket content:
#6131 by Sergunik
15 May 2018, 09:34
Found solution:
Code: Select all<?php

namespace App\Helper;

class BasketHelper extends BaseHelper
     * @return \Aimeos\Controller\Frontend\Basket\Standard
     * @throws \Aimeos\Controller\Frontend\Exception
     * @throws \Illuminate\Container\EntryNotFoundException
    private static function getBasketController()
        return \Aimeos\Controller\Frontend\Factory::createController( self::getContext(), 'basket' );

     * @return \Aimeos\MShop\Order\Item\Base\Product\Standard[]
     * @throws \Aimeos\Controller\Frontend\Exception
     * @throws \Illuminate\Container\EntryNotFoundException
    public static function getProducts() {

        $controller = self::getBasketController();
        $summaryBasket = $controller->get();

        return $summaryBasket->getProducts();

PHP 7.0.22-0ubuntu0.16.04.1
laravel/framework: 5.5
aimeos/ai-laravel: 2018.04.1