//hole orderposes $orders_productstable = $oostable['orders_products']; $cur_query = xtc_db_query("SELECT *\n FROM {$orders_productstable}\n WHERE orders_id=" . intval($_POST['KeyBestellung']) . "\n ORDER BY orders_products_id"); while ($BestellungPos = mysql_fetch_object($cur_query)) { //hole etl aufpreise $aufpreis = 0; $orders_products_attributestable = $oostable['orders_products_attributes']; $aufpreise_query = xtc_db_query("SELECT options_values_price \n FROM {$orders_products_attributestable}\n WHERE orders_id=" . $BestellungPos->orders_id . "\n AND orders_products_id=" . $BestellungPos->orders_products_id . " \n AND options_values_price!=0"); while ($aufpreis_arr = mysql_fetch_row($aufpreise_query)) { $aufpreis += $aufpreis_arr[0] * (100 + $BestellungPos->products_tax) / 100; } //mappe bestellpos $kBestellPos = setMappingBestellPos($BestellungPos->orders_products_id); echo CSVkonform($kBestellPos) . ';'; echo CSVkonform(intval($_POST['KeyBestellung'])) . ';'; echo CSVkonform(getEsArtikel($BestellungPos->products_id)) . ';'; echo CSVkonform($BestellungPos->products_name) . ';'; echo CSVkonform($BestellungPos->products_price - $aufpreis) . ';'; echo CSVkonform($BestellungPos->products_tax) . ';'; echo CSVkonform($BestellungPos->products_quantity) . ';'; echo "\n"; } //letzte Position Versand $orders_totaltable = $oostable['orders_total']; $cur_query = xtc_db_query("SELECT *\n FROM {$orders_totaltable}\n WHERE class=\"ot_shipping\"\n AND orders_id=" . intval($_POST['KeyBestellung'])); if ($Versand = mysql_fetch_object($cur_query)) { //mappe bestellpos $kBestellPos = setMappingBestellPos(0); //hole versand mwst aus einstellungen $eazysales_einstellungenstable = $oostable['eazysales_einstellungen']; $cur_query = xtc_db_query("SELECT versandMwst FROM {$eazysales_einstellungenstable}");
$eazysales_einstellungenstable = $oostable['eazysales_einstellungen']; $cur_query = xtc_db_query("SELECT languages_id FROM {$eazysales_einstellungenstable}"); $einstellungen = mysql_fetch_object($cur_query); //hole orders_products_id $orders_products_id = getFremdBestellPos(intval($_POST['KeyBestellPos'])); //hole alle Eigenschaften, die ausgew�lt wurden zu dieser bestellung $orders_productstable = $oostable['orders_products']; $orders_products_attributestable = $oostable['orders_products_attributes']; $cur_query = xtc_db_query("SELECT orders_products_attributes.*, orders_products.products_tax, orders_products.products_id\n FROM {$orders_products_attributestable},\n {$orders_productstable}\n WHERE orders_products_attributes.orders_products_id=" . $orders_products_id . "\n AND orders_products.orders_products_id=orders_products_attributes.orders_products_id\n ORDER BY orders_products_attributes.orders_products_id"); while ($WarenkorbPosEigenschaft = mysql_fetch_object($cur_query)) { $preisprefix = 1; if ($WarenkorbPosEigenschaft->price_prefix == "-") { $preisprefix = -1; } //hole attribut $products_attributestable = $oostable['products_attributes']; $products_optionstable = $oostable['products_options']; $products_options_valuestable = $oostable['products_options_values']; $attribut_query = xtc_db_query("SELECT products_attributes.products_attributes_id \n FROM {$products_attributestable},\n {$products_optionstable},\n {$products_options_valuestable}\n WHERE products_attributes.products_id=" . $WarenkorbPosEigenschaft->products_id . " \n AND products_attributes.options_id=products_options.products_options_id \n AND products_attributes.options_values_id=products_options_values.products_options_values_id \n AND products_attributes.options_values_price=" . $WarenkorbPosEigenschaft->options_values_price . " \n AND products_options.products_options_name=\"" . $WarenkorbPosEigenschaft->products_options . "\" \n AND products_options.language_id=" . $einstellungen->languages_id . " \n AND products_options_values.products_options_values_name=\"" . $WarenkorbPosEigenschaft->products_options_values . "\" \n AND products_options_values.language_id=" . $einstellungen->languages_id); $attribut_arr = mysql_fetch_row($attribut_query); echo CSVkonform($WarenkorbPosEigenschaft->orders_products_attributes_id) . ';'; echo CSVkonform(intval($_POST['KeyBestellPos'])) . ';'; echo ';'; echo CSVkonform(getEsEigenschaftsWert($attribut_arr[0], getEsArtikel($WarenkorbPosEigenschaft->products_id))) . ';'; echo CSVkonform(($WarenkorbPosEigenschaft->options_values_price + $WarenkorbPosEigenschaft->options_values_price * $WarenkorbPosEigenschaft->products_tax / 100) * $preisprefix) . ';'; echo "\n"; } } } echo $return; logge($return);