示例#1
0
 /**
  *Returns the name of the brand mapping into table sap_brand_name
  *@params int $brand_name
  *@return return if exists the mapping name of a brand
  **/
 public function getNameBrand($brand_name)
 {
     $connection = connectionServer();
     $sql = "SELECT * FROM  brand_mapping WHERE ( sap_brand_name = '" . trim($brand_name) . "')";
     $result = mysql_query($sql, $connection);
     if (mysql_num_rows($result) > 0) {
         while ($row = mysql_fetch_array($result)) {
             $toReturn = $row[1];
         }
         closeConnectionServer($connection);
         return $toReturn;
     } else {
         closeConnectionServer($connection);
         return 0;
     }
 }
 /**
  *Truncate buffer table
  **/
 public function freeBufferTable()
 {
     $connection = connectionServer();
     $sql = "TRUNCATE TABLE ps_buffer_product";
     $res = mysql_query($sql, $connection);
     if ($res) {
     } else {
         $errno = mysql_errno($connection);
         $error = mysql_error($connection);
         switch ($errno) {
             case 1062:
                 throw new HandleOperationsException($error);
                 break;
             default:
                 throw new HandleOperationsException($error);
                 break;
         }
     }
     closeConnectionServer($connection);
 }
示例#3
0
 public function _updateTmpProducts($array_product, $key)
 {
     $view_manager = new ViewManager();
     $result = $view_manager->_getSqlChangedProducts($array_product, $key);
     $connection = connectionServer();
     foreach ($result as $sql) {
         $res = null;
         $res = mysql_query($sql, $connection);
         if ($res) {
         } else {
             $errno = mysql_errno($connection);
             $error = mysql_error($connection);
             switch ($errno) {
                 case 1062:
                     throw new HandleOperationsException($error);
                     break;
                 default:
                     throw new HandleOperationsException($error);
                     break;
             }
         }
     }
     closeConnectionServer($connection);
 }
示例#4
0
 public function _getSqlChangedProducts($array_product, $key)
 {
     $connection = connectionServer();
     $sql = "SELECT * FROM products_differences WHERE reference ='" . $key . "' ORDER BY reference ASC";
     $to_return = array();
     $result = mysql_query($sql, $connection);
     if ($result) {
         if (mysql_num_rows($result) > 0) {
             $to_return = array();
             while ($row = mysql_fetch_array($result)) {
                 $sql = "INSERT INTO ps_tmp_product (ps_id, reference, attivo, categoria, prezzo, supplier, \n                    manufacture, qta, qta_min, lunghezza, altezza, larghezza, colore, quantita, taglia, \n\t\t\t\t\t\tnome, modello, linea, codice_colore, url, immagine, codice_taglia )\n\t\t\t\t\t\tVALUES('" . $array_product . "','" . $key . "','" . $row[2] . "',\n\t\t\t\t\t\t\t   '" . $row[3] . "','" . $row[4] . "','" . $row[5] . "','" . $row[6] . "',\n\t\t\t\t\t\t\t   '" . $row[7] . "','" . $row[8] . "','" . $row[9] . "','" . $row[10] . "',\n\t\t\t\t\t\t\t   '" . $row[11] . "','" . $row[12] . "','" . $row[13] . "','" . $row[14] . "',\n\t\t\t\t\t\t\t   '" . $row[15] . "','" . $row[16] . "','" . $row[17] . "','" . $row[18] . "',\n\t\t\t\t\t\t\t   '" . $row[19] . "','" . $row[20] . "','" . $row[21] . "')";
                 array_push($to_return, $sql);
             }
             closeConnectionServer($connection);
             return $to_return;
         }
     } else {
         $errno = mysql_errno($connection);
         $error = mysql_error($connection);
         switch ($errno) {
             case 1062:
                 throw new HandleOperationsException($error);
                 break;
             default:
                 throw new HandleOperationsException($error);
                 break;
         }
     }
     closeConnectionServer($connection);
 }
示例#5
0
 /** 
  *Updates product informations
  *@params int $ps_id, string $attivo,string $prezzo,string $qta,string $qta_min,string $lunghezza,string
  *$altezza,string $larghezza,string $nome,string $modello,string $linea 
  */
 public function updateProduct($ps_id, $attivo, $prezzo, $qta, $qta_min, $lunghezza, $altezza, $larghezza, $nome, $modello, $linea, $colore, $taglia)
 {
     $connection = connectionServer();
     $sql = "UPDATE  ps_tmp_product SET attivo = '" . $attivo . "', prezzo = '" . $prezzo . "', qta = '" . $qta . "', qta_min = '" . $qta_min . "', lunghezza = '" . $lunghezza . "', altezza = '" . $altezza . "',larghezza = '" . $larghezza . "', nome = '" . $nome . "', modello = '" . $modello . "' , linea = '" . $linea . "' WHERE ps_id = '" . $ps_id . "' AND colore = '" . $colore . "' AND taglia = '" . $taglia . "'";
     $res = mysql_query($sql, $connection);
     if ($res) {
     } else {
         $errno = mysql_errno($connection);
         $error = mysql_error($connection);
         switch ($errno) {
             case 1062:
                 throw new HandleOperationsException($error);
                 break;
             default:
                 throw new HandleOperationsException($error);
                 break;
         }
     }
     closeConnectionServer($connection);
 }
示例#6
0
 /**
 * Checks if the product exists into the tmp table searching by product key
 *@params string $psId
 @return true if exist the product in DB , false otherwise
 */
 public function _ifProductExist($psId)
 {
     $connection = connectionServer();
     $sql = "SELECT * FROM  ps_tmp_product WHERE ( ps_id = '" . $psId . "')";
     $result = mysql_query($sql, $connection);
     if (mysql_num_rows($result) > 0) {
         closeConnectionServer($connection);
         return TRUE;
     } else {
         closeConnectionServer($connection);
         return FALSE;
     }
 }