So what I’m trying to achieve is assign multiple values in to a smarty array on the indexes that I want. It’s hard to describe it, so I’ll just show it:
{assign var='paymentTypes'
value=','|explode:"$paymentMethods[50],$paymentMethods[51],
$paymentMethods[11],$paymentMethods[10],$paymentMethods[12],
$paymentMethods[99],$paymentMethods[100]"}
(Formatted for readability)
So now I have a paymentTypes array with the values placed on the keys starting from 0. What I want is to keep the keys that were in paymentMethods array – 50, 51, 11.. etc.
And it has to be done totally in Smarty template file. Thanks for any ideas.
I’ve found a workaround. The needed associative array was for a HTML Select tag. So I just used {html_options} with value and output attributes instead of options. I assigned one array just for values and another just for output.
I had this:
But I didn’t want to show all of the values from paymentTypes array, but I had to have them in the array. So what I did was this:
It’s not the most elegant solution – but it works.