<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=112012023-02092010><FONT face=Arial
color=#0000ff size=2>Try changing this to this to see what the properties really
are. If you don't understand what you get there, then tell me the
results, and I'll try and interpret them for you. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=112012023-02092010><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=112012023-02092010>
<DIV><FONT class=Apple-style-span face="Courier New">$orderattributes
= <SPAN class=112012023-02092010>print_r(</SPAN>$row<SPAN
class=112012023-02092010>,1)</SPAN>;</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'courier new', monospace">print
$orderattributes;</FONT></DIV></SPAN></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New"></FONT><BR> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> support-bounces@drupal.org
[mailto:support-bounces@drupal.org] <B>On Behalf Of </B>Shai
Gluskin<BR><B>Sent:</B> Thursday, September 02, 2010 2:01 PM<BR><B>To:</B>
support@drupal.org<BR><B>Subject:</B> Re: [support] Unserializing Data for Use
in a View<BR></FONT><BR></DIV>
<DIV></DIV>David and all,
<DIV><BR></DIV>
<DIV>David, thanks for the response:</DIV>
<DIV><BR></DIV>
<DIV>I just tried</DIV>
<DIV><BR></DIV>
<DIV>
<DIV><FONT class=Apple-style-span
face="'courier new', monospace">$orderattributes =
$row->{$field->data};</FONT></DIV>
<DIV><FONT class=Apple-style-span face="'courier new', monospace">print
$orderattributes;</FONT></DIV>
<DIV><BR></DIV>I get a php fatal error: "Cannot access empty property"</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><BR></DIV>
<DIV>The following is from Views "Theme information": Field uc_order_products:
data (ID: data)</DIV>
<DIV><BR>Ideas?</DIV>
<DIV>
<DIV class=gmail_quote><BR></DIV>
<DIV class=gmail_quote>Thanks much,</DIV>
<DIV class=gmail_quote><BR></DIV>
<DIV class=gmail_quote>Shai</DIV>
<DIV class=gmail_quote><BR></DIV>
<DIV class=gmail_quote>On Thu, Sep 2, 2010 at 4:31 PM, Metzler, David <SPAN
dir=ltr><<A
href="mailto:metzlerd@evergreen.edu">metzlerd@evergreen.edu</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I'm not an
expert here, but I'm reading the coments differently than you are.
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>I think
you should be working with $row->data ( or at least $row) and not with
$output. That's got html in it, right? </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Dave</FONT></SPAN></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
href="mailto:support-bounces@drupal.org"
target=_blank>support-bounces@drupal.org</A> [mailto:<A
href="mailto:support-bounces@drupal.org"
target=_blank>support-bounces@drupal.org</A>] <B>On Behalf Of </B>Shai
Gluskin<BR><B>Sent:</B> Thursday, September 02, 2010 1:24 PM<BR><B>To:</B> <A
href="mailto:support@drupal.org"
target=_blank>support@drupal.org</A><BR><B>Subject:</B> [support]
Unserializing Data for Use in a View<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV>I'm creating a view of ubercart order products. I got the necessary
data to be accessible to Views using Table Wizard (<A
href="http://drupal.org/project/tw"
target=_blank>http://drupal.org/project/tw</A>).
<DIV><BR></DIV>
<DIV>The product attribute info is stored serialized in the "data" field on
the uc_order_products table. Here is an example of the raw serialized
data:</DIV>
<DIV><BR></DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><FONT
face="'courier new', monospace">a:5:{s:6:"kit_id";s:3:"570";s:6:"module";s:14:"uc_product_kit";s:10:"attributes";a:2:{s:9:"Attending";a:1:{i:0;s:26:"Jane
Doe, John Doe";}s:4:"Note";a:1:{i:0;s:45:"We are friends of Eric Smith and
Sandy
Smith";}}s:9:"shippable";s:1:"0";s:9:"unique_id";s:23:"4c7d632a8090c7.95333579";}</FONT></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>I have no problem printing it out like above. </DIV>
<DIV><BR></DIV>
<DIV>Unserialized it looks like this:</DIV>
<DIV><BR></DIV>
<DIV><SPAN style="COLOR: rgb(34,34,34)"><FONT
face="'courier new', monospace">Array<BR>(<BR>[kit_id] => 570<BR>[module]
=> uc_product_kit<BR>[attributes] => Array<BR>(<BR>[Attending] =>
Array<BR>(<BR>[0] => Jane Doe, John Doe<BR>)<BR><BR>[Note] =>
Array<BR>(<BR>[0] => We are friends of Eric Smith and Sandy
Smith<BR>)<BR><BR>)<BR><BR>[shippable] => 0<BR>[unique_id] =>
4c7d632a8090c7.95333579<BR>)</FONT></SPAN></DIV>
<DIV><FONT face="'courier new', monospace" color=#222222 size=2><SPAN
style="FONT-SIZE: 10px"><BR></SPAN></FONT></DIV>
<DIV><FONT color=#222222><FONT face="arial, helvetica, sans-serif">I want to
print out: Jane Doe, John Doe</FONT></FONT></DIV>
<DIV><FONT color=#222222><FONT
face="arial, helvetica, sans-serif"><BR></FONT></FONT></DIV>
<DIV><FONT color=#222222><FONT face="arial, helvetica, sans-serif">Here is
what views-view-field.tpl.php has to say:</FONT></FONT></DIV>
<DIV><FONT color=#222222><FONT
face="arial, helvetica, sans-serif"><BR></FONT></FONT></DIV>
<DIV><FONT color=#222222><FONT face="arial, helvetica, sans-serif">
<DIV><FONT face="'courier new', monospace">// $Id: views-view-field.tpl.php,v
1.1 2008/05/16 22:22:32 merlinofchaos Exp $</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> /**</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * This template is used
to print a single field in a view. It is not</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * actually used in
default Views, as this is registered as a theme</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * function which has
better performance. For single overrides, the</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * template is perfectly
okay.</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> *</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * Variables
available:</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * - $view: The view
object</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * - $field: The field
handler object that can process the input</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * - $row: The raw SQL
result that can be used</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * - $output: The
processed output that will normally be used.</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> *</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * When fetching output
from the $row, this construct should be used:</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * $data =
$row->{$field->field_alias}</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> *</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * The above will
guarantee that you'll always get the correct data,</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * regardless of any
changes in the aliasing that might happen if</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> * the view is
modified.</FONT></DIV>
<DIV><FONT face="'courier new', monospace"> */</FONT></DIV>
<DIV><FONT face="'courier new', monospace"><BR></FONT></DIV>
<DIV>This is what I'm putting in views-view-field.tpl.php:</DIV>
<DIV><FONT face="'courier new', monospace"><BR></FONT></DIV>
<DIV><FONT face="'courier new', monospace">$data =
unserialize($output);</FONT></DIV>
<DIV><FONT face="'courier new', monospace">print
$data['Attending'][0];</FONT></DIV>
<DIV><BR></DIV>
<DIV>Nothing gets returned.</DIV>
<DIV><BR></DIV>
<DIV>What am I doing wrong?</DIV>
<DIV><BR></DIV>
<DIV>thanks,</DIV>
<DIV><BR></DIV>
<DIV>Shai</DIV></FONT></FONT></DIV></DIV></DIV></DIV><BR>--<BR>[ Drupal
support list | <A href="http://lists.drupal.org/"
target=_blank>http://lists.drupal.org/</A>
]<BR></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>