$class_jc->updateField($catalog_id, $dataArray);
        } else {
            $data = explode('-', $fieldName);
            if ($data[0] == 'pa') {
                $products_articles_id = $data[2];
                switch ($data[1]) {
                    case 'price':
                        $price = $fieldValue;
                        $price_old = null;
                        break;
                    case 'price_old':
                        $price = null;
                        $price_old = $fieldValue;
                        break;
                }
                $class_pa->update($products_articles_id, $price, $price_old, null, true);
            }
        }
        $result = array();
        $result['id'] = $catalog_id;
        $result['field_name'] = $fieldName;
        $result['field_value'] = $fieldValue;
        ajaxReturn($result);
        exit;
    }
    $class_jc->processCommentAction();
}
$jng_sp_id = tep_db_prepare_input($_GET['sp']);
$products_id = tep_db_prepare_input($_GET['id']);
$sp_info = $class_sp->retrieveDetail($jng_sp_id);
$catalog = $class_jc->retrieveDetail(null, $jng_sp_id, $products_id);
     $products_id = tep_db_prepare_input($_POST['products_id']);
     $result = drawLengthsForm($products_id);
     echo utf8_encode($result);
     exit;
 } elseif ($_POST['me_action'] == 'SAVELENGTHS') {
     use_class('products_ean');
     $class_ean = new products_ean();
     $products_id = tep_db_prepare_input($_POST['products_id']);
     $def_length = tep_db_prepare_input($_POST['def_length']);
     $add_length = tep_db_prepare_input($_POST['add_length']);
     $upd_length = tep_db_prepare_input($_POST['upd_length']);
     $class_pm->saveLength($products_id, $def_length, $add_length);
     if (is_array($upd_length) && count($upd_length) > 0) {
         foreach ($upd_length as $paid => $l) {
             if ($l > 0 && $l != 'NaN') {
                 $class_pa->update($paid, 0, 0, array('length' => $l), true);
             } else {
                 $a_ean = $class_ean->getEAN($products_id, $paid);
                 if ($a_ean != '') {
                     $class_ean->setAsFree($a_ean);
                 }
                 $class_pa->remove($paid, true);
             }
         }
     }
     //$result = drawLengthsForm($products_id);
     $result = 'UPDATED';
     echo utf8_encode($result);
     exit;
     // TODO: remove this after freetext switch to attach
     //    } elseif($_POST['me_action']=='SAVEMANPI') {