public function getColorsAndSizesDifferences() { $connection = connectionServer(); $mapping = new MappingArray(); $ps_id = ""; $active = ""; $category = ""; $price = ""; $supplier = ""; $name = ""; $collection = ""; $manufacture = ""; $qta = ""; $qta_min = ""; $size = ""; $height = ""; $width = ""; $name_color = array(); $quantity = array(); $name_size = array(); $model = ""; $code_color = array(); $url = ""; $name_photo = array(); $code_size = array(); $sql = "SELECT * FROM new_size_color WHERE 1 ORDER BY reference ASC"; $to_return = array(); $result = mysql_query($sql, $connection); if (mysql_num_rows($result) > 0) { $new_reference = ''; while ($row = mysql_fetch_array($result)) { if (empty($new_reference)) { $new_reference = $row[1]; } if ($new_reference === $row[1]) { $ps_id = $row[0]; $active = $row[2]; $category = $row[3]; $price = $row[4]; $supplier = $row[5]; $manufacture = $row[6]; $qta = $row[7]; $qta_min = $row[8]; $size = $row[9]; $height = $row[10]; $width = $row[11]; array_push($name_color, $row[12]); array_push($quantity, $row[13]); array_push($name_size, $row[14]); $name = $row[15]; $model = $row[16]; $collection = $row[17]; array_push($code_color, $row[18]); $url = $row[19]; array_push($name_photo, $row[20]); array_push($code_size, $row[21]); } else { $array_mapping = $mapping->createSingleArrayMapping($price, $active, $new_reference, $name, $category, $supplier, $manufacture, $qta, $qta_min, $width, $height, $size, $model, $collection, $url); $array_triple = $mapping->createSingleArrayTriple($new_reference, $code_color, $code_size); $array_combinations = $mapping->createSingleArrayCombination($new_reference, $code_color, $code_size, $name_color, $name_size, $name_photo, $quantity); $element = array(); array_push($element, $array_mapping); array_push($element, $array_triple); array_push($element, $array_combinations); array_push($element, $ps_id); array_push($to_return, $element); $new_reference = $row[1]; $name_color = array(); $quantity = array(); $name_size = array(); $code_color = array(); $name_photo = array(); $code_size = array(); $ps_id = $row[0]; $active = $row[2]; $category = $row[3]; $price = $row[4]; $supplier = $row[5]; $manufacture = $row[6]; $qta = $row[7]; $qta_min = $row[8]; $size = $row[9]; $height = $row[10]; $width = $row[11]; array_push($name_color, $row[12]); array_push($quantity, $row[13]); array_push($name_size, $row[14]); $name = $row[15]; $model = $row[16]; $collection = $row[17]; array_push($code_color, $row[18]); $url = $row[19]; array_push($name_photo, $row[20]); array_push($code_size, $row[21]); } } $array_mapping = $mapping->createSingleArrayMapping($price, $active, $new_reference, $name, $category, $supplier, $manufacture, $qta, $qta_min, $width, $height, $size, $model, $collection, $url); $array_triple = $mapping->createSingleArrayTriple($new_reference, $code_color, $code_size); $array_combinations = $mapping->createSingleArrayCombination($new_reference, $code_color, $code_size, $name_color, $name_size, $name_photo, $quantity); $element = array(); array_push($element, $array_mapping); array_push($element, $array_triple); array_push($element, $array_combinations); array_push($element, $ps_id); array_push($to_return, $element); closeConnectionServer($connection); return $to_return; } else { closeConnectionServer($connection); return 0; } }
public function getColorsAndSizesDifferences() { $connection = connectionServer(); $mapping = new MappingArray(); $ps_id = ""; $active = ""; $category = ""; $price = ""; $supplier = ""; $name = ""; $collection = ""; $manufacture = ""; $qta = ""; $qta_min = ""; $size = ""; $height = ""; $width = ""; $name_color = array(); $quantity = array(); $name_size = array(); $model = ""; $code_color = array(); $url = ""; $name_photo = array(); $code_size = array(); $sql = "SELECT ps_tmp_product.ps_id, ps_buffer_product.reference, ps_buffer_product.attivo, ps_buffer_product.categoria, \nps_buffer_product.prezzo, ps_buffer_product.supplier, ps_buffer_product.manufacture, ps_buffer_product.qta, \nps_buffer_product.qta_min, ps_buffer_product.lunghezza, ps_buffer_product.altezza, ps_buffer_product.larghezza, ps_buffer_product.colore,\nps_buffer_product.quantita,ps_buffer_product.taglia, ps_buffer_product.nome, ps_buffer_product.modello,ps_buffer_product.linea, \nps_buffer_product.codice_colore, ps_buffer_product.url, ps_buffer_product.immagine, ps_buffer_product.codice_taglia FROM ps_buffer_product LEFT JOIN ps_tmp_product ON (ps_buffer_product.reference = ps_tmp_product.reference AND ps_buffer_product.codice_colore = ps_tmp_product.codice_colore AND ps_buffer_product.codice_taglia = ps_tmp_product.codice_taglia) WHERE( ps_tmp_product.ps_id IS NULL) ORDER BY ps_buffer_product.reference ASC"; $to_return = array(); $result = mysql_query($sql, $connection); if (mysql_num_rows($result) > 0) { $new_reference = ''; while ($row = mysql_fetch_array($result)) { if (empty($new_reference)) { $new_reference = $row[1]; } if ($new_reference === $row[1]) { $ps_id = $row[0]; $active = $row[2]; $category = $row[3]; $price = $row[4]; $supplier = $row[5]; $manufacture = $row[6]; $qta = $row[7]; $qta_min = $row[8]; $size = $row[9]; $height = $row[10]; $width = $row[11]; array_push($name_color, $row[12]); array_push($quantity, $row[13]); array_push($name_size, $row[14]); $name = $row[15]; $model = $row[16]; $collection = $row[17]; array_push($code_color, $row[18]); $url = $row[19]; array_push($name_photo, $row[20]); array_push($code_size, $row[21]); } else { $array_mapping = $mapping->createSingleArrayMapping($price, $active, $new_reference, $name, $category, $supplier, $manufacture, $qta, $qta_min, $width, $height, $size, $model, $collection, $url); $array_triple = $mapping->createSingleArrayTriple($new_reference, $code_color, $code_size); $array_combinations = $mapping->createSingleArrayCombination($new_reference, $code_color, $code_size, $name_color, $name_size, $name_photo, $quantity); $element = array(); array_push($element, $array_mapping); array_push($element, $array_triple); array_push($element, $array_combinations); array_push($element, $ps_id); array_push($to_return, $element); $new_reference = $row[1]; $name_color = array(); $quantity = array(); $name_size = array(); $code_color = array(); $name_photo = array(); $code_size = array(); $ps_id = $row[0]; $active = $row[2]; $category = $row[3]; $price = $row[4]; $supplier = $row[5]; $manufacture = $row[6]; $qta = $row[7]; $qta_min = $row[8]; $size = $row[9]; $height = $row[10]; $width = $row[11]; array_push($name_color, $row[12]); array_push($quantity, $row[13]); array_push($name_size, $row[14]); $name = $row[15]; $model = $row[16]; $collection = $row[17]; array_push($code_color, $row[18]); $url = $row[19]; array_push($name_photo, $row[20]); array_push($code_size, $row[21]); } } $array_mapping = $mapping->createSingleArrayMapping($price, $active, $new_reference, $name, $category, $supplier, $manufacture, $qta, $qta_min, $width, $height, $size, $model, $collection, $url); $array_triple = $mapping->createSingleArrayTriple($new_reference, $code_color, $code_size); $array_combinations = $mapping->createSingleArrayCombination($new_reference, $code_color, $code_size, $name_color, $name_size, $name_photo, $quantity); $element = array(); array_push($element, $array_mapping); array_push($element, $array_triple); array_push($element, $array_combinations); array_push($element, $ps_id); array_push($to_return, $element); closeConnectionServer($connection); return $to_return; } else { closeConnectionServer($connection); return 0; } }