How to get the basket items with properties in other class
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 2
- Joined: 16 May 2017, 16:40
How to get the basket items with properties in other class
Hi,
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?
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!
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?
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!
Re: How to get the basket items with properties in other cl
Did you read this article?
https://aimeos.org/docs/Laravel/Extend_Aimeos
With the context object you can instantiate the basket controller and get the basket content:
https://github.com/aimeos/ai-controller ... end/Basket
https://aimeos.org/docs/Laravel/Extend_Aimeos
With the context object you can instantiate the basket controller and get the basket content:
https://github.com/aimeos/ai-controller ... end/Basket
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 2
- Joined: 16 May 2017, 16:40
Re: How to get the basket items with properties in other cl
Yes... Merci I've found the methods!
Re: How to get the basket items with properties in other cl
It's still issue for me.
Dear Support, Could you please help get basket items in own controller?
--
PHP 7.0.22-0ubuntu0.16.04.1
laravel/framework: 5.5
aimeos/ai-laravel: 2018.04.1
Dear Support, Could you please help get basket items in own controller?
--
PHP 7.0.22-0ubuntu0.16.04.1
laravel/framework: 5.5
aimeos/ai-laravel: 2018.04.1
Re: How to get the basket items with properties in other cl
Found solution:
--
PHP 7.0.22-0ubuntu0.16.04.1
laravel/framework: 5.5
aimeos/ai-laravel: 2018.04.1
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
-
- Posts: 1
- Joined: 27 Aug 2018, 05:07
Re: How to get the basket items with properties in other cl
@Sergunik
How does your BaseHelper Class look like?
How does your BaseHelper Class look like?
Re: How to get the basket items with properties in other cl
DiegoFelipeProaño wrote:How does your BaseHelper Class look like?
Code: Select all
<?php
namespace App\Helper;
class BaseHelper
{
/**
* @return \Aimeos\MShop\Context\Item\Standard $context
*/
protected static function getContext() {
return app('\Aimeos\Shop\Base\Context')->get();
}
}