RomanCart.com Forum Homepage
Forum Home Forum Home > RomanCart > Integration
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

xml callback

 Post Reply Post Reply
Author
Message
jemcook View Drop Down
Regular
Regular


Joined: 02 March 2016
Status: Offline
Points: 48
Post Options Post Options   Thanks (0) Thanks(0)   Quote jemcook Quote  Post ReplyReply Direct Link To This Post Topic: xml callback
    Posted: 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.056 seconds.