Search Results Page – Displaying Custom Meta Fields

You’ve got a missing ) and you’re passing true as a string and not a boolean value. So this line:

$pName = get_post_meta($post->ID, $productName, 'true';

Should in fact be:

$pName = get_post_meta($post->ID, $productName, true);

In light of your update why not do something like:

echo 'Product Name: '. $pName['productName'][0];
echo 'Location: '. $pName['locationName'][0];
echo 'Address: '. $pName['locationAddress'][0];

However this code will need to be improved and is maybe a question for stackoverflow as it’s not specific to WordPress. This is PHP and dealing with arrays/multidimensional arrays