Add to a Simple XML Object

Fertiggestellt Veröffentlicht Dec 24, 2012 Bezahlt bei Lieferung
Fertiggestellt

I need someone to quickly solve this problem and tell me whats being done wrong. First solution gets paid. I need to add additional products to the $products object using the $fields array to set the key/values. This job will pay $15. It should be very quick for someone who knows just a little more than me.

When using the code below to add a product to the $products SimpleXML object I get an error Warning: Illegal offset type in file and can't figure out what is wrong.

$fields = array(

$o->order_id => 'order_id',

$o->order_address_id => 'order_address_id',

$o->price_ex_tax => 'price_ex_tax' ,

'DISCS' => 'sku',

'1' => 'quantity'

);

$products->addChild('product');

array_walk_recursive($fields, array ($products, 'addChild'));

HERE IS MY SIMPLEXML OBJECT using print_r for $products:

SimpleXMLElement Object

(

[product] => Array

(

[0] => SimpleXMLElement Object

(

[id] => 23

[order_id] => 110

[product_id] => 63477

[order_address_id] => 11

[name] => Dead Sea Treasures Foot Cream

[sku] => 703

[type] => physical

[base_price] => 20.0000

[price_ex_tax] => 20.0000

[price_inc_tax] => 20.0000

[price_tax] => 0.0000

[base_total] => 40.0000

[total_ex_tax] => 40.0000

[total_inc_tax] => 40.0000

[total_tax] => 0.0000

[weight] => 0.5

[quantity] => 2

[base_cost_price] => 0.0000

[cost_price_inc_tax] => 0.0000

[cost_price_ex_tax] => 0.0000

[cost_price_tax] => 0.0000

[is_refunded] => false

[refund_amount] => 0.0000

[return_id] => 0

[wrapping_name] => SimpleXMLElement Object

(

)

PHP

Projekt-ID: #4069103

Über das Projekt

5 Vorschläge Remote Projekt Aktiv Dec 25, 2012

Vergeben an:

sureshdevi

I can fix this problem of SimpleXML Object. I can complete this work in next few hours.

$15 USD / Stunde
(673 Bewertungen)
7.5

5 Freelancer bieten im Durchschnitt $12/Stunde für diesen Job

webxtreams

ready to fix sir

$10 USD / Stunde
(327 Bewertungen)
6.3
realestateweb

Try dumping the var values for $o->price_ex_tax

$15 USD / Stunde
(20 Bewertungen)
5.2
pareshmaghodiya

Hello, I have 4+ years of experience in website customization and i believe that I can do this. Looking forward to work with you. Thanks

$10 USD / Stunde
(14 Bewertungen)
4.0