Jump to content

webService get product order


marczaq

Recommended Posts

I wan to get products detail from order.

I try it like:

 

 $opt = array('resource' => 'orders', 'filter[id]' => '[' . $id_order . ']');
           $xml = $webService->get($opt);

I know that product are inside order->associations->order_rows->order_row

 

But how to get this data? I can't get node associations. 

 

Could somebody explain me it?

 
Link to comment
Share on other sites

  • 2 months later...

i finally can acces to products inside order doing ...

 

$opt = array(
    'resource' =>'orders',
    'display'=>'full',
    'filter[id]'=>$id, 
    );
    
 
    $xml = $webService->get($opt);
    $order_array = $xml->orders->order->children();
 
 
After that i pass this array to a twig template (i'm working in a symfony project to coonect presta and ERP )and get products like this:
 
{% set associations = order_array.associations %}
{% set order_rows = associations.order_rows %}
 
and then ...
 
{% for order_row in order_rows %}
        
    {% for order in order_row %}
      <tr>
 
      {% for value in order %}
        <td>[spam-filter] value [spam-filter]</td>
      {% endfor %}
       </tr>
    {% endfor %}    
            
{% endfor %}

 

 

 

 

one afternoon spent on that shit :)

 

 

In php only, i think it could be ...

 

(...)

 

$order_array = $xml->orders->order->children();

 

$product = $order_array['associations']['order_rows']['order']

 

and then 

 

foreach($product as $field=>$value){ 'do something' }

Edited by Marc F (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...