'Smarty array with null value
I'm trying to get the value of one position of array in a smarty .tpl, here's my code
{$destination = $destination_id}
{$bid = $destination}
{$shippingRate = $shipping.rates.$bid|@json_encode}
$dest: {$destination}
<br>
$bid: {$bid}
<br>
$shippingRate: {$shippingRate}
HTML result:
$dest: 244
$bid: 244
$shippingRate: null
And this is an example with the var $bid hardcoded:
{$destination = $destination_id}
{$bid = 244}
{$shippingRate = $shipping.rates.$bid|@json_encode}
$dest: {$destination}
<br>
$bid: {$bid}
<br>
$shippingRate: {$shippingRate}
HTML result:
$dest: 244
$bid: 244
$shippingRate: {"destination_id":"244","status":"A"}
I guess that I'm doing something wrong in the assignation of $bid, I did try with the following options with the same result:
{$bid = $destination|intval}
{$bid = $destination|strip|intval}
{$bid = $destination|strip}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
