call variable in another smarty template

0

I would like to store a value in one variable and then call it in another template, currently I have it like this:

in order-confirm-table.tpl

{assign var="final" value=0 scope=root}
{foreach from=$products item=product}
  {$final=$final+1}
    <div class="order-line row">
      <div class="col-md-2 col-md-4">
        <span class="image">
          <img src="{$product.cover.medium.url}" />
        </span>
        {assign var="id{$final}" value={$product.cover.medium.url} scope=scope}

and I want to call it in order-confirm-table2.tpl

   {foreach from=$products item=product}
  {$i=$i+1}
    <div class="order-line row">
      <div class="col-md-2 col-md-4">
        <span class="image">
          <img src="{$id{$i}}"/>
        </span>
      </div>

but it does not work for me, the question is that in order-confirm-table2.tpl the last image is repeated and order-confirm-table.tpl works well for me. But it is the same code, before the same template. The only thing is that order-confirm-table.tpl comes out first and then when the budget ends order-confirm-table2.tpl, I do not know what happens to the images sincerely.

So my solution is to save those values in one variable and pass it to the other template. Attached the catches.

    
asked by rosibel vicent 21.03.2018 в 17:35
source

0 answers