Page 1 of 1

get product data at checkout process

Posted: 10 Feb 2018, 04:50
by Travin
Hey guys
Could you explain me how can I access order products data during the checkout process? I'm trying:

Code: Select all

public function process( \Aimeos\MShop\Order\Item\Iface $order, array $params = [] )
    {
$orderBaseItem = $this->getOrderBase( $order->getBaseId() );  
 print_r(get_class($orderBaseItem));  // Aimeos\MShop\Order\Item\Base\Standard
 echo '<br/>PRODUCTS:<br/>';
print_r($orderBaseItem->getProducts());
}
$orderBaseItem->getProducts() returns me an empty array.
But it saved at DB well, and I can access all products data at Orders History page from the same object Aimeos\MShop\Order\Item\Base\Standard.
But I need it at my process() too.
Thanks!

Re: get product data at checkout process

Posted: 12 Feb 2018, 22:46
by aimeos
There's a second parameter for the getOrderBase() method:
https://github.com/aimeos/aimeos-core/b ... e.php#L523

Pass one of these as second parameter:

Code: Select all

$parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_SERVICE | \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT;
$parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL;
The second one will also fetch address and coupon data (https://github.com/aimeos/aimeos-core/b ... se.php#L28)