Jump to content

[SOLVED] add array element to simplexml can it be done?


tryingtolearn

Recommended Posts

I need a way to add certain parts of an array to certain parts of a simplexml object

 

The array I have is like this

Array
(
    [0] => ../_designer-shoes_AA00_crtZ4ew_qridZ55690714aa_wowsidZp4634322
    [1] => ../_Other_AA00_crtZ1ew_qridZ55690714aa_wowsidZp4634322
)

 

The simplexml object returned is this

SimpleXMLElement Object
(
    [iD] => 7
    [Name] => OTHER
    [Order] => 0
)

SimpleXMLElement Object
(
    [iD] => 12
    [Name] => designer shoes
    [Order] => 15
)

SimpleXMLElement Object
(
    [iD] => 546781
    [Name] => OUTSIDE PRODUCTS
    [Order] => 32
)

 

So now i need to match up the NAME with the link from the array and if it matches add it to the object to end up with this

SimpleXMLElement Object
(
    [iD] => 7
    [Name] => OTHER
    [Order] => 0
[Path] => ../_Other_AA00_crtZ1ew_qridZ55690714aa_wowsidZp4634322
)

SimpleXMLElement Object
(
    [iD] => 12
    [Name] => designer shoes
    [Order] => 15
[Path] => ../_designer-shoes_AA00_crtZ4ew_qridZ55690714aa_wowsidZp4634322
)

SimpleXMLElement Object
(
    [iD] => 546781
    [Name] => OUTSIDE PRODUCTS
    [Order] => 32
[Path] => NO PATH
)

Is that something that can be done?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.