Shop, PHP, $order and parameters

Author Message

laurent le cadet

Friday 11 June 2010 2:32:03 am

Hi,

I'm building a workflow event.
I need to retrieve the number of items in the current user order.

I found I can fetch the order but I don't know how to go further to count items of the order.

Where I am :

$orderID = $http->sessionVariable( 'MyTemporaryOrderID' );
$order = eZOrder::fetch( $orderID );

Is there something like this ?

$count = $order->attribute( 'OrderItems' );

Best regards.

Laurent

laurent le cadet

Friday 11 June 2010 6:50:42 am

Answering to myself :

$http = eZHTTPTool::instance();
$orderID = $http->sessionVariable( 'MyTemporaryOrderID' );
$order = eZOrder::fetch( $orderID );
$items = $order->productItems();
$count = count( $items );

This do the job.

Hope this help

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.