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.

eZ debug

Timing: Jan 18 2025 11:17:43
Script start
Timing: Jan 18 2025 11:17:43
Module start 'layout'
Timing: Jan 18 2025 11:17:43
Module start 'content'
Timing: Jan 18 2025 11:17:44
Module end 'content'
Timing: Jan 18 2025 11:17:44
Script end

Main resources:

Total runtime0.7037 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.0313152.6250
Module start 'layout' 0.00510.0041 741.656339.4453
Module start 'content' 0.00920.6928 781.1016461.0313
Module end 'content' 0.70200.0016 1,242.13288.1563
Script end 0.7036  1,250.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4657160.0002
Check MTime0.00140.2036160.0001
Mysql Total
Database connection0.00130.180510.0013
Mysqli_queries0.655793.1796520.0126
Looping result0.00050.0696500.0000
Template Total0.672895.620.3364
Template load0.00220.307420.0011
Template processing0.670695.298120.3353
Template load and register function0.00010.011110.0001
states
state_id_array0.00100.142010.0010
state_identifier_array0.00170.241020.0008
Override
Cache load0.00180.2529250.0001
Sytem overhead
Fetch class attribute can translate value0.00070.092810.0007
Fetch class attribute name0.00190.265930.0006
XML
Image XML parsing0.00040.052510.0004
class_abstraction
Instantiating content class attribute0.00000.001440.0000
General
dbfile0.00080.1131160.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs