Ejemplo n.º 1
0
 } 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') {
     //        $products_id = tep_db_prepare_input($_POST['products_id']);
     //        $manual_pi = tep_db_prepare_input($_POST['manpi']);
     //        saveManualPI($products_id, $manual_pi);
     //        $result = 'UPDATED';