解決しました。
(配列に使用している2次元目の変数に間違いがあることに、気がつきませんでした。)
修正案
表示順の同期は、異なるテーブル内の商品情報なので、DBへの更新時に不都合が発生する懸念もあり、あきらめました。
data/Smarty/templates/admin/order/edit.tpl
javascriptによる動的変更部分
/* deleted
function quantityCopyForSingleShipping(product_index){
var product_index = parseInt(product_index);
var input_quantity = $('input[name^="quantity[' + product_index + ']"]').val();
$('input[name^="shipment_quantity[0][' + product_index + ']"]').val(input_quantity);
}
deleted */
使用しているHTML部分
<td align="center">
<!--{assign var=key value="quantity"}-->
<span class="attention"><!--{$arrErr[$key][$product_index]}--></span>
<!--{* changed
<input type="text" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" onChange="quantityCopyForSingleShipping('<!--{$product_index}-->')" />
changed *}-->
<input type="text" name="<!--{$key}-->[<!--{$product_index}-->]" value="<!--{$arrForm[$key].value[$product_index]|h}-->" size="3" class="box3" maxlength="<!--{$arrForm[$key].length}-->" style="<!--{$arrErr[$key][$product_index]|sfGetErrorColor}-->" id="<!--{$key}-->_<!--{$product_index}-->" />
<!--{* changed *}-->
</td>
data/class/pages/admin/order/LC_Page_Admin_Order_edit.php
お届け先1件:
コピー(受注商品情報の数量-->お届け先の数量)
お届け先2件以上:(既存の処理)
合算後コピー(お届け先の数量合計)-->受注商品情報の数量
public function setProductsQuantity(&$objFormParam)
{
$arrShipmentsItems = $objFormParam->getSwapArray(array('shipment_product_class_id','shipment_quantity'));
// 配送先が存在する時のみ、商品個数の再設定を行います
if(!SC_Utils_Ex::isBlank($arrShipmentsItems)) {
// added
if (count($arrShipmentsItems) > 1) {
// added
foreach ($arrShipmentsItems as $arritems) {
foreach ($arritems['shipment_product_class_id'] as $relation_index => $shipment_product_class_id) {
$arrUpdateQuantity[$shipment_product_class_id] += $arritems['shipment_quantity'][$relation_index];
}
}
$arrProductsClass = $objFormParam->getValue('product_class_id');
$arrProductsQuantity = $objFormParam->getValue('quantity');
foreach ($arrProductsClass as $relation_key => $product_class_id) {
$arrQuantity['quantity'][$relation_key] = $arrUpdateQuantity[$product_class_id];
}
// added
} else {
// 配送先が1つ
$arrProductsClass = $objFormParam->getValue('product_class_id');
$arrProductsQuantity = $objFormParam->getValue('quantity');
foreach ($arrProductsClass as $relation_key => $product_class_id) {
$arrUpdateQuantity[$product_class_id] = $arrProductsQuantity[$relation_key];
}
foreach ($arrShipmentsItems as $item_index => $arritems) {
foreach ($arritems['shipment_product_class_id'] as $relation_index => $shipment_product_class_id) {
$arrQuantity['shipment_quantity'][$item_index][$relation_index] = $arrUpdateQuantity[$shipment_product_class_id];
}
}
}
// added
$objFormParam->setParam($arrQuantity);
}
}