AnsweredAssumed Answered

How can I extract data from a Xcart array.

Question asked by datanaut on Sep 9, 2013
Latest reply on Dec 11, 2013 by datanaut


How can I extract data from a Xcart array.


     Xcart is a popular shopping cart. In one table called 'order_details' one field 'extra_data'  has text in it which is an array like this ;
     s:15:"product_options"; a:4:{
     i:465; s:4:"4213";
     i:466; s:4:"4220";
     i:467; s:4:"4227";
     i:473; s:0:"";
     s:5:"taxes"; a:1:{
     s:5:"taxid"; s:1:"2";
     s:8:"tax_name"; s:6:"VAT_20";
     s:7:"formula"; s:5:"ST+SH";
     s:12:"address_type"; s:1:"S";
     s:6:"active"; s:1:"Y";
     s:18:"price_includes_tax"; s:1:"Y";
     s:21:"display_including_tax"; s:1:"Y";
     s:12:"display_info"; s:0:"";
     s:9:"regnumber"; s:10:"6973114311";
     s:8:"priority"; s:1:"0";
     s:10:"rate_value"; d:20;
     s:9:"rate_type"; s:1:"%";
     s:16:"tax_display_name"; s:3:"VAT";
     s:17:"tax_value_precise"; d:36.5;
     s:9:"tax_value"; d:36.5;
     s:11:"taxed_price"; d:219;
     s:7:"display"; a:3:{
     s:5:"price"; s:6:"182.50";
     s:16:"discounted_price"; s:6:"182.50";
     s:8:"subtotal"; s:6:"182.50";
     s:8:"subtotal"; s:6:"182.50";
     s:6:"weight"; s:4:"0.00";
     s:10:"event_data"; N;
     I am trying to extract some data from this text field that is an array. The array is dynamic so I can't count on size to find the data I require. I could write something to 'walk' the array or maybe better still I could use a string search for the elements I want.

     My internet searches give me the impression that dealing with this sort of problem in FM Pro 12 Advanced V12.0v4  ain't easy. Is there a smarter way to make this text into something I can access the data from much easier than the options I've mentioned. I've been using FM Pro for a month and write some PHP so if you can take that into consideration it would be a help.