Add to a Simple XML Object
$2-10 USD / hora
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
(
)
Nº del proyecto: #4069103
Sobre el proyecto
Adjudicado a:
5 freelancers están ofertando un promedio de $12 / hora por este trabajo
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