![]() |
xml callback |
Post Reply
|
| Author | |
jemcook
Regular
Joined: 02 March 2016 Status: Offline Points: 48 |
Post Options
Thanks(0)
Quote Reply
Topic: xml callbackPosted: 12 April 2016 at 5:02pm |
|
Not sure if I'm posting this in the right place but hopefully there's someone out there that can shed some light on this for me.
I'm using the excellent romancart xml callback function to filter some information into a database on our server. I can extract information and set them as variables from the xml using this format: $first_name=$rcxml->{'sales-record-fields'}->{'first-name'}; $last_name=$rcxml->{'sales-record-fields'}->{'last-name'}; $address1=$rcxml->{'sales-record-fields'}->{'address1'}; Or: $order_item=$rcxml->{'order-items'}->{'order-item'}->{'item-name'}; $quantity=$rcxml->{'order-items'}->{'order-item'}->{'quantity'}; Which works fine. However there are a few instances when I specifically want to select the second or third item in an order. I don't want to run them through a foreach loop but I thought I could just target them in this way: $order_item2=$rcxml->{'order-items'}->{'order-item[1]'}->{'item-name'}; $quantity2=$rcxml->{'order-items'}->{'order-item[1]'}->{'quantity'}; $order_item3=$rcxml->{'order-items'}->{'order-item[2]'}->{'item-name'}; $quantity3=$rcxml->{'order-items'}->{'order-item[2]'}->{'quantity'}; But I get nothing. Can anyone spot the schoolboy error or give me some suggestion as to what I should do to specifically target these elements? with thanks, Jem |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |