foreach($arResult[GetMessage("CC_BSC1_COM_INFO")]["#"][GetMessage("CC_BSC1_DOCUMENT")] as $value)
{
if($value["#"][GetMessage("CC_BSC1_OPERATION")][0]["#"] == GetMessage("CC_BSC1_ORDER"))
{
$orderId = IntVal($value["#"][GetMessage("CC_BSC1_NUMBER")][0]["#"]);
$arOrder[$orderId] = Array();
$arItem = Array();
$arOrder[$orderId]["AMOUNT"] = $value["#"][GetMessage("CC_BSC1_SUMM")][0]["#"];
$arOrder[$orderId]["COMMENT"] = $value["#"][GetMessage("CC_BSC1_COMMENT")][0]["#"];
foreach($value["#"][GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")] as $val)
$arOrder[$orderId]["TRAITS"][$val["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
$taxValue = 0;
$taxValueTmp = 0;
$taxName = "";
if(is_array($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")]))
{
foreach($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")] as $val)
{
$val = $val["#"];
$productID = $val[GetMessage("CC_BSC1_ID")][0]["#"];
$bGood = false;
$arItem[$productID] = Array(
"NAME" => $val[GetMessage("CC_BSC1_NAME")][0]["#"],
"PRICE" => $val[GetMessage("CC_BSC1_PRICE_PER_UNIT")][0]["#"],
"QUANTITY" => $val[GetMessage("CC_BSC1_QUANTITY")][0]["#"],
);
if(is_array($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")]))
{
foreach($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")] as $val1)
$arItem[$productID]["ATTRIBUTES"][$val1["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val1["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
}
if(is_array($val[GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")]))
  |