2 replies [Last post]
worded's picture
Offline
Joined: 01/14/2012
Juice: 6
Was this information Helpful?

Hi,

I have three attributes fields (first name, last name and email) for a webinar product class and I'm trying to write a basic module to automatically transfer the data from those fields to a website called GoToWebinar on completion of the order.

I've set up the integration with GoToWebinar with dummy data and it works fine, but I'm having trouble getting the actual data for these attributes out of the data column in uc_order_products. Here's what I've got in the field...

-------------------------
a:3:{s:10:"attributes";a:3:{s:10:"First name";a:1:{i:0;s:6:"Ennio";}s:9:"Last name";a:1:{i:0;s:4:"Morricone";}s:5:"Email";a:1:{i:0;s:28:"ennio.morricone@gmail.com";}}s:9:"shippable";s:1:"0";s:6:"module";s:10:"uc_product";}
-------------------------

Does anyone know the cleanest way of grabbing the values for the three attributes so I can use and manipulate each one separately. I know I need to unserialize it - which gives me the following...

-------------------------
array(3) { ["attributes"]=> array(3) { ["First name"]=> array(1) { [0]=> string(6) "Ennio" } ["Last name"]=> array(1) { [0]=> string(4) "Morricone" } ["Email"]=> array(1) { [0]=> string(28) "ennio.morricone@gmail.com" } } ["shippable"]=> string(1) "0" ["module"]=> string(10) "uc_product" }
-------------------------

...but then I get stuck. (apologies - I know the basics of arrays, but I'm a PHP newbie and my very thin knowledge isn't quite cutting it here!).

Big thanks in advance.

pwhite's picture
Offline
Joined: 11/20/2007
Juice: 6
Re: Help getting attributes data from the uc_order_products data

If its any help use the unserialize PHP function on the data field, this should give you an array you can then work with.

studgate's picture
Offline
Joined: 02/06/2012
Juice: 54
Re: Help getting attributes data from the uc_order_products data

I am looking for the same solution. Please help!