 {assign var=itr value=1}
{foreach $allproducts as $product}
        <div class="form-group">
        <h3  class="col-lg-2 control-label" style="padding-top: 21px;"><a href="javascript:;" data-id="{$product.productid}"   class="limitamountfirestup"> {$product.productname} </a></h3>
        <input type="hidden" name="productid{$itr}"  id="productid{$itr}"  value="{$product.productid}" />
        <input type="hidden" name="limitamount{$itr}" value="{$product.limitamount}" />
        <input type="hidden" name="productcatid{$itr}" value="{$product.productcatid}" />
        <input type="hidden" name="allstores{$itr}" value="{$product.stores|@count}">
         
            {assign var=itr2 value=1}
            {foreach $product.stores as $store}
            <div class="col-lg-2">
                <label  class="control-label"> {$store.storeName}</label>
                <input type="number" class="form-control prostorelimitamounts" name="prostorelimitamount{$itr}{$itr2}" data-id="{$store.productstoreid}"  data-placeholder="" value="{$store.prostorelimitamount}"    id="limitamountfirest{$itr2}{$product.productid}"/>
                <input type="hidden" name="storeid{$itr}{$itr2}" value="{$store.storeId}" />
            </div>
            {capture assign=itr2}{$itr2+1}{/capture}    
            {/foreach}
        </div>
{capture assign=itr}{$itr+1}{/capture}        
{/foreach}
<input type="hidden" name="allproducts" id="allproducts" value="{$allproducts|@count}">
<input type="hidden" name="allstores" id="allstores" value="{$allstores}">