Using JSON in an email

Permalink
Hey!

I'm wondering if anyone can shed some light on what I'm missing. I'm trying to use a JSON with the eCommerce order email and the json is getting decoded correctly, but when I try to read the array, it's not liking it. I'm not echoing it which I think is my issue. Here's what I got:

$ms_first = json_decode($shipping['first_name'], true);
$sub = $product['orderProductID']."-".$a."\n";
$first = $ms_first[$sub];
$body .= "First: $first";


$a is iterated and I know $sub is getting populated right because I have also echoed it out. the First just appears blank. I have also done the jSON out as object as well. Still no dice.

rainmaker
 
rainmaker replied on at Permalink Best Answer Reply
rainmaker
Nevermind! :) Figured it out. My issue was with this line:

$sub = $product['orderProductID']."-".$a."\n";


The \n was breaking it.