Quantity not updating on product listing page

Help!!! We are hacking together (bits and pieces from checkout and a product listing page) to create a “Bulk Order Page” that doesn't already exist in CS Cart.



Here's an example of the page:

https://wholesale.kyjen.com/minis-en/



If you enter a quantity on every product on that page, and hit “Add Products”…It will add all of the products to the cart properly, EXCEPT the first product listed- Mini Hard Boiled Softies Bee. Please note we have not added a refresh to the page, so you will have to refresh to see the products to the cart.



I have noticed that the {$key} function appears to start counting at 0- if you notice the first input's id=“amount_0” --not sure if the 0 is causing all of this or not.



Here is the code of the product list:```php

{* $Id$ *}

{if $products}

{script src=“js/exceptions.js”}

{if !$no_pagination}

{include file=“common_templates/pagination.tpl”}

{/if}

{if !$no_sorting}

{include file=“views/products/components/sorting.tpl”}

{/if}

{assign var=“result_ids” value=“cart_items,checkout_totals,checkout_steps,cart_status,checkout_cart”}







{include file="buttons/bulk_order.tpl" but_id="button_cart" but_name="dispatch[checkout.update]"}











{foreach from=$products item="product" key="key" name="products"}
{assign var="main_pair" value=$p.product_id|fn_get_image_pairs:"product":"M"}
{assign var="obj_id" value=$product.product_id}
{assign var="obj_id_prefix" value="`$obj_prefix``$product.product_id`"}
{include file="common_templates/product_data.tpl" product=$product}


{hook name="products:product_compact_list"}








{/hook}
{/foreach}
  {$lang.product} {$lang.product_code} {$lang.price} {$show.qty}


{include file="common_templates/image.tpl" image_width="40" image_height="40" images=$product.main_pair object_type="product" obj_id=$obj_id_prefix show_thumbnail="Y"}


{assign var="name" value="name_$obj_id"}{$smarty.capture.$name}

{assign var="sku" value="sku_$obj_id"}{$smarty.capture.$sku}

{assign var="price" value="price_`$obj_id`"}{$smarty.capture.$price}


{if $product.qty_content && $product.is_edp != "Y"}

{foreach from=$product.qty_content item="var"}
{$var}
{/foreach}

{else}
{if $settings.Appearance.quantity_changer == "Y"}

↑
{/if}

{if $settings.Appearance.quantity_changer == "Y"}
↓

{/if}
{/if}
{if $product.is_edp == "Y" || $product.exclude_from_calculate}

{/if}
{if $product.is_edp == "Y"}

{/if}

{if $product.zero_price_action == "A"}

{/if}






{if !$no_pagination}
{include file="common_templates/pagination.tpl"}
{/if}
{/if}
```

Any help or insight would be greatly appreciated!