I gang

Add to a Simple XML Object

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] => [url removed, login to view]

[price_ex_tax] => [url removed, login to view]

[price_inc_tax] => [url removed, login to view]

[price_tax] => [url removed, login to view]

[base_total] => [url removed, login to view]

[total_ex_tax] => [url removed, login to view]

[total_inc_tax] => [url removed, login to view]

[total_tax] => [url removed, login to view]

[weight] => 0.5

[quantity] => 2

[base_cost_price] => [url removed, login to view]

[cost_price_inc_tax] => [url removed, login to view]

[cost_price_ex_tax] => [url removed, login to view]

[cost_price_tax] => [url removed, login to view]

[is_refunded] => false

[refund_amount] => [url removed, login to view]

[return_id] => 0

[wrapping_name] => SimpleXMLElement Object

(

)

Færdigheder: PHP

Se mere: xml php array, object, php add file, php simple xml, simple xml php, array xml php, add key, simple figure, xml key file, key xml, php array add, xml error, simplexml, php add product code, simplexml file, simple code key, product xml file, php add, code php add product, php array xml, php xml array, xml array php, set product key, php xml file array, add fields product

Om arbejdsgiveren:
( 59 bedømmelser ) Belleville, United States

Projekt-ID: #4069103

Tildelt til:

sureshdevi

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

$15 USD / time
(673 bedømmelser)
7.5

5 freelancere byder i gennemsnit $12/time for dette job

webxtreams

ready to fix sir

$10 USD / time
(327 bedømmelser)
6.3
JoomlaVogue

Hello Sir, I have gone through the details you have provided and would be pleased to work on this with you to deliver the results that you have expected and I am sure you will not be disappointed if you give us Mere

$8 USD / time
(42 bedømmelser)
6.3
realestateweb

Try dumping the var values for $o->price_ex_tax

$15 USD / time
(20 bedømmelser)
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 / time
(14 bedømmelser)
4.0