| 1 | <?php
|
|---|
| 2 | /* -----------------------------------------------------------------------------------------
|
|---|
| 3 | $Id: afterbuy.php 1287 2005-10-07 10:41:03Z mz $
|
|---|
| 4 |
|
|---|
| 5 | modified by F.T.Store (FTS) 2007-08-156 20:07 FTS
|
|---|
| 6 | Version 1.8 (August 2007)
|
|---|
| 7 |
|
|---|
| 8 | mickser
|
|---|
| 9 | Modifikation:
|
|---|
| 10 | 2008 Bei vorhandener Attribut-Artikelnummer diese für die Übertragung verwenden
|
|---|
| 11 | 2009 rawurlencode statt ereg_replace
|
|---|
| 12 | Zahlungsstatus iPayment
|
|---|
| 13 | XT-Commerce - community made shopping
|
|---|
| 14 | http://www.xt-commerce.com
|
|---|
| 15 |
|
|---|
| 16 | Copyright (c) 2003 XT-Commerce
|
|---|
| 17 | -----------------------------------------------------------------------------------------
|
|---|
| 18 | based on:
|
|---|
| 19 | (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
|
|---|
| 20 | (c) 2002-2003 osCommerce(Coding Standards); www.oscommerce.com
|
|---|
| 21 |
|
|---|
| 22 | Released under the GNU General Public License
|
|---|
| 23 | ---------------------------------------------------------------------------------------*/
|
|---|
| 24 |
|
|---|
| 25 | class xtc_afterbuy_functions {
|
|---|
| 26 | var $order_id;
|
|---|
| 27 | var $kdnr;
|
|---|
| 28 | // constructor
|
|---|
| 29 | function xtc_afterbuy_functions($order_id) {
|
|---|
| 30 | $this->order_id = $order_id;
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | function process_order() {
|
|---|
| 34 |
|
|---|
| 35 | require_once (DIR_FS_INC.'xtc_get_attributes_model.inc.php');
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | // ############ SETTINGS ################
|
|---|
| 39 | //Daten im XT Admin (werden von Afterbuy mitgeteilt)
|
|---|
| 40 | $PartnerID = AFTERBUY_PARTNERID;
|
|---|
| 41 | $PartnerPass = AFTERBUY_PARTNERPASS;
|
|---|
| 42 | $UserID = AFTERBUY_USERID;
|
|---|
| 43 | $order_status = AFTERBUY_ORDERSTATUS;
|
|---|
| 44 |
|
|---|
| 45 | // ############ THUNK ################
|
|---|
| 46 |
|
|---|
| 47 | $oID = $this->order_id;
|
|---|
| 48 | $customer = array ();
|
|---|
| 49 | // FT neuer Server AB $afterbuy_URL = 'https://www.afterbuy.de/afterbuy/ShopInterface.asp';
|
|---|
| 50 | //Karsten Geyer schon wieder neuer Server $afterbuy_URL = 'https://net.afterbuy.de/afterbuy/ShopInterface.aspx';
|
|---|
| 51 | $afterbuy_URL = 'https://api.afterbuy.de/afterbuy/ShopInterface.aspx';
|
|---|
| 52 |
|
|---|
| 53 | // connect
|
|---|
| 54 | $ch = curl_init();
|
|---|
| 55 |
|
|---|
| 56 | // This is the URL that you want PHP to fetch. You can also set this option when initializing a session with the curl_init() function.
|
|---|
| 57 | curl_setopt($ch, CURLOPT_URL, "$afterbuy_URL");
|
|---|
| 58 |
|
|---|
| 59 | // curl_setopt($ch, CURLOPT_CAFILE, 'D:/curl-ca.crt');
|
|---|
| 60 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|---|
| 61 | //bei einer leeren Transmission Error Mail + cURL Problemen die nächste Zeile auskommentieren
|
|---|
| 62 | //curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
|
|---|
| 63 |
|
|---|
| 64 | // Set this option to a non-zero value if you want PHP to do a regular HTTP POST. This POST is a normal application/x-www-form-rawurlencoded kind, most commonly used by HTML forms.
|
|---|
| 65 | curl_setopt($ch, CURLOPT_POST, 1);
|
|---|
| 66 |
|
|---|
| 67 | // get order data
|
|---|
| 68 | $o_query = xtc_db_query("SELECT * FROM ".TABLE_ORDERS." WHERE orders_id='".$oID."'");
|
|---|
| 69 | $oData = xtc_db_fetch_array($o_query);
|
|---|
| 70 |
|
|---|
| 71 | // customers Address
|
|---|
| 72 | $customer['id'] = $oData['customers_id'];
|
|---|
| 73 | $customer['firma'] = rawurlencode($oData['billing_company']);
|
|---|
| 74 | $customer['vorname'] = rawurlencode($oData['billing_firstname']);
|
|---|
| 75 | $customer['nachname'] = rawurlencode($oData['billing_lastname']);
|
|---|
| 76 | $customer['strasse'] = rawurlencode($oData['billing_street_address']);
|
|---|
| 77 | $customer['strasse2'] = rawurlencode($oData['billing_suburb']);
|
|---|
| 78 | $customer['plz'] = $oData['billing_postcode'];
|
|---|
| 79 | $customer['ort'] = rawurlencode($oData['billing_city']);
|
|---|
| 80 | $customer['tel'] = $oData['customers_telephone'];
|
|---|
| 81 | $customer['fax'] = "";
|
|---|
| 82 | $customer['mail'] = $oData['customers_email_address'];
|
|---|
| 83 | // get ISO code
|
|---|
| 84 | $ctr_query=xtc_db_query("SELECT countries_iso_code_2 FROM ".TABLE_COUNTRIES." WHERE countries_name='".$oData['customers_country']."'");
|
|---|
| 85 | $crt_data=xtc_db_fetch_array($ctr_query);
|
|---|
| 86 | $customer['land']=$crt_data['countries_iso_code_2'];
|
|---|
| 87 |
|
|---|
| 88 | // ############ VAT_ID ################
|
|---|
| 89 |
|
|---|
| 90 | $ustid_querystrg="SELECT customers_vat_id, customers_status FROM ".TABLE_CUSTOMERS." WHERE customers_id ='".$customer['id']."'";
|
|---|
| 91 | $ustid_query=xtc_db_query($ustid_querystrg);
|
|---|
| 92 | $ustid_data=xtc_db_fetch_array($ustid_query);
|
|---|
| 93 | $customer['ustid']=$ustid_data['customers_vat_id'];
|
|---|
| 94 |
|
|---|
| 95 | // ############ CUSTOMERS ANREDE ################
|
|---|
| 96 |
|
|---|
| 97 | $c_query = xtc_db_query("SELECT customers_gender FROM ".TABLE_CUSTOMERS." WHERE customers_id='".$customer['id']."'");
|
|---|
| 98 | $c_data = xtc_db_fetch_array($c_query);
|
|---|
| 99 | switch ($c_data['customers_gender']) {
|
|---|
| 100 | case 'm' :
|
|---|
| 101 | $customer['gender'] = 'Herr';
|
|---|
| 102 | break;
|
|---|
| 103 | case 'f' :
|
|---|
| 104 | $customer['gender'] = 'Frau';
|
|---|
| 105 | break;
|
|---|
| 106 | default :
|
|---|
| 107 | $customer['gender'] = '';
|
|---|
| 108 | break;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | // ############ DELIVERY ADRESS ################
|
|---|
| 112 | // modified FT (Neuer Parameter Übergabe der 2.Adresszeile)
|
|---|
| 113 |
|
|---|
| 114 | $customer['d_firma'] = rawurlencode(preg_replace("/&/","%26",$oData['delivery_company']));
|
|---|
| 115 | $customer['d_vorname'] = rawurlencode($oData['delivery_firstname']);
|
|---|
| 116 | $customer['d_nachname'] = rawurlencode($oData['delivery_lastname']);
|
|---|
| 117 | $customer['d_strasse'] = rawurlencode($oData['delivery_street_address']);
|
|---|
| 118 | $customer['d_strasse2'] = rawurlencode($oData['delivery_suburb']);
|
|---|
| 119 | $customer['d_plz'] = $oData['delivery_postcode'];
|
|---|
| 120 | $customer['d_ort'] = rawurlencode($oData['delivery_city']);
|
|---|
| 121 | // get ISO code
|
|---|
| 122 | $ctr_query=xtc_db_query("SELECT countries_iso_code_2 FROM ".TABLE_COUNTRIES." WHERE countries_name='".$oData['delivery_country']."'");
|
|---|
| 123 | $crt_data=xtc_db_fetch_array($ctr_query);
|
|---|
| 124 | $customer['d_land']=$crt_data['countries_iso_code_2'];
|
|---|
| 125 |
|
|---|
| 126 | // ############# KUNDENERKENNUNG SETZEN #############
|
|---|
| 127 | // Modifiziert FT
|
|---|
| 128 |
|
|---|
| 129 | $kundenerkennung = '1';
|
|---|
| 130 | $DATAstring .= "Kundenerkennung=" . $kundenerkennung . "&";
|
|---|
| 131 | // 0=Standard EbayName (= gesamte Zeile "Benutzername" in dieser Datei)
|
|---|
| 132 | // 1=Email
|
|---|
| 133 | // 2=EKNummer (wenn im XT vorhanden!)
|
|---|
| 134 |
|
|---|
| 135 | // ############ GET PRODUCT RELATED TO ORDER / INIT GET STRING ################
|
|---|
| 136 | // modified FT (Leerzeichen)
|
|---|
| 137 |
|
|---|
| 138 | $p_query = xtc_db_query("SELECT * FROM ".TABLE_ORDERS_PRODUCTS." WHERE orders_id='".$oID."'");
|
|---|
| 139 | $p_count = xtc_db_num_rows($p_query);
|
|---|
| 140 | $DATAstring .= "Action=new&";
|
|---|
| 141 | $DATAstring .= "PartnerID=".$PartnerID."&";
|
|---|
| 142 | $DATAstring .= "PartnerPass=".$PartnerPass."&";
|
|---|
| 143 | $DATAstring .= "UserID=".$UserID."&";
|
|---|
| 144 | $DATAstring .= "Kbenutzername=".$customer['id']."_XTC_".$oID."&";
|
|---|
| 145 | #oder
|
|---|
| 146 | #$DATAstring .= "Kbenutzername=".$customer['mail']."_XTC_".$oID."&";
|
|---|
| 147 | $DATAstring .= "Kanrede=".$customer['gender']."&";
|
|---|
| 148 | $DATAstring .= "KFirma=".$customer['firma']."&";
|
|---|
| 149 | $DATAstring .= "KVorname=".$customer['vorname']."&";
|
|---|
| 150 | $DATAstring .= "KNachname=".$customer['nachname']."&";
|
|---|
| 151 | $DATAstring .= "KStrasse=".$customer['strasse']."&";
|
|---|
| 152 | $DATAstring .= "KStrasse2=" . $customer['strasse2'] . "&";
|
|---|
| 153 | $DATAstring .= "KPLZ=".$customer['plz']."&";
|
|---|
| 154 | $DATAstring .= "KOrt=".$customer['ort']."&";
|
|---|
| 155 | $DATAstring .= "KTelefon=".$customer['tel']."&";
|
|---|
| 156 | $DATAstring .= "Kfax=&";
|
|---|
| 157 | $DATAstring .= "Kemail=".$customer['mail']."&";
|
|---|
| 158 | $DATAstring .= "KLand=".$customer['land']."&";
|
|---|
| 159 | $DATAstring .= "KLFirma=".$customer['d_firma']."&";
|
|---|
| 160 | $DATAstring .= "KLVorname=".$customer['d_vorname']."&";
|
|---|
| 161 | $DATAstring .= "KLNachname=".$customer['d_nachname']."&";
|
|---|
| 162 | $DATAstring .= "KLStrasse=".$customer['d_strasse']."&";
|
|---|
| 163 | $DATAstring .= "KLStrasse2=".$customer['d_strasse2']."&";
|
|---|
| 164 | $DATAstring .= "KLPLZ=".$customer['d_plz']."&";
|
|---|
| 165 | $DATAstring .= "KLOrt=".$customer['d_ort']."&";
|
|---|
| 166 | $DATAstring .= "KLLand=".$customer['d_land']."&";
|
|---|
| 167 | $DATAstring .= "UsStID=".$customer['ustid']."&";
|
|---|
| 168 | $DATAstring .= "VID=".$oID."&";
|
|---|
| 169 |
|
|---|
| 170 | // ############# HÄNDLERMARKIERUNG AFTERBUY KUNDENDATENSATZ #############
|
|---|
| 171 | // Modifiziert FT
|
|---|
| 172 | // "H" Kennzeichnung im Kundendatensatz in Afterbuy
|
|---|
| 173 | // "Haendler=0&" bedeutet Checkbox deaktiviert
|
|---|
| 174 | // "Haendler=1&" bedeutet Checkbox aktiviert
|
|---|
| 175 | // "case 'X'" steht für die jeweilige Kundengruppen_ID im XT (-->siehe Admin)
|
|---|
| 176 |
|
|---|
| 177 | $customer_status = $ustid_data['customers_status'];
|
|---|
| 178 | switch ($customer_status) {
|
|---|
| 179 | case '0': //Admin
|
|---|
| 180 | $DATAstring .= "Haendler=0&";
|
|---|
| 181 | break;
|
|---|
| 182 | case '1': //Gast
|
|---|
| 183 | $DATAstring .= "Haendler=0&";
|
|---|
| 184 | break;
|
|---|
| 185 | case '2': //Kunde
|
|---|
| 186 | $DATAstring .= "Haendler=0&";
|
|---|
| 187 | break;
|
|---|
| 188 | case '3': //im Standard B2B
|
|---|
| 189 | $DATAstring .= "Haendler=1&";
|
|---|
| 190 | break;
|
|---|
| 191 | case '4': //eigene Kundengruppe
|
|---|
| 192 | $DATAstring .= "Haendler=0&";
|
|---|
| 193 | break;
|
|---|
| 194 | case '5': //eigene Kundengruppe
|
|---|
| 195 | $DATAstring .= "Haendler=0&";
|
|---|
| 196 | break;
|
|---|
| 197 | case '6': //eigene Kundengruppe
|
|---|
| 198 | $DATAstring .= "Haendler=0&";
|
|---|
| 199 | break;
|
|---|
| 200 | case '7': //eigene Kundengruppe
|
|---|
| 201 | $DATAstring .= "Haendler=0&";
|
|---|
| 202 | break;
|
|---|
| 203 | default: //wenn alles nicht zutrifft
|
|---|
| 204 | $DATAstring .= "Haendler=0&";
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | // ############# LIEFERANSCHRIFT SETZEN #############
|
|---|
| 208 | // Modifiziert FT (Neuer Parameter Übergabe der 2.Adresszeile)
|
|---|
| 209 | // hier wird die Rechnungs-und Lieferanschrift verglichen, wenn die Adressen gleich sind, wird kein "L" in der Übersicht gesetzt
|
|---|
| 210 | // soll generell ein "L" in der Übersicht gesetzt werden, müssen die $DATAStrings "Lieferanschrift=1&" sein
|
|---|
| 211 |
|
|---|
| 212 | if( ($customer['firma'] == $customer['d_firma']) &&
|
|---|
| 213 | ($customer['vorname'] == $customer['d_vorname']) &&
|
|---|
| 214 | ($customer['nachname'] == $customer['d_nachname']) &&
|
|---|
| 215 | ($customer['strasse'] == $customer['d_strasse']) &&
|
|---|
| 216 | ($customer['strasse2'] == $customer['d_strasse2']) &&
|
|---|
| 217 | ($customer['plz'] == $customer['d_plz']) &&
|
|---|
| 218 | ($customer['ort'] == $customer['d_ort']))
|
|---|
| 219 | {
|
|---|
| 220 | $DATAstring .= "Lieferanschrift=0&";
|
|---|
| 221 | }
|
|---|
| 222 | else
|
|---|
| 223 | {
|
|---|
| 224 | $DATAstring .= "Lieferanschrift=1&";
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | // ############# ARTIKELERKENNUNG SETZEN #############
|
|---|
| 228 | // modified FT
|
|---|
| 229 | $Artikelerkennung = '0';
|
|---|
| 230 | // 0 = Product ID (p_Model XT muss gleich Product ID Afterbuy sein)
|
|---|
| 231 | // 1 = Artikelnummer (p_Model XT muss gleich Arrikelnummer Afterbuy sein)
|
|---|
| 232 | // 2 = EAN (p_Model XT muss gleich EAN Afterbuy sein)
|
|---|
| 233 | // sollen keine Stammartikel erkannt werden, muss die Zeile: $DATAstring .= "Artikelerkennung=" . $Artikelerkennung ."&"; gelöscht werden
|
|---|
| 234 | // sollen keine Stammartikel erkannt werden, muss die Zeile: $Artikelerkennung = '1'; gelöscht werden
|
|---|
| 235 |
|
|---|
| 236 | // ############# PRODUCTS_DATA TEIL1 #############
|
|---|
| 237 | // modified FT
|
|---|
| 238 | $DATAstring .= "Artikelerkennung=" . $Artikelerkennung ."&";
|
|---|
| 239 | $nr = 0;
|
|---|
| 240 | $anzahl = 0;
|
|---|
| 241 | while ($pDATA = xtc_db_fetch_array($p_query)) {
|
|---|
| 242 | $nr ++;
|
|---|
| 243 |
|
|---|
| 244 | $artnr = $pDATA['products_model'];
|
|---|
| 245 | if ($artnr == '')
|
|---|
| 246 | $artnr = $pDATA['products_id'];
|
|---|
| 247 |
|
|---|
| 248 | $a_query = xtc_db_query("SELECT * FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." WHERE orders_id='".$oID."' AND orders_products_id='".$pDATA['orders_products_id']."'");
|
|---|
| 249 | while ($aDATA = xtc_db_fetch_array($a_query))
|
|---|
| 250 | {
|
|---|
| 251 | $attribute_model = xtc_get_attributes_model($pDATA['products_id'], $aDATA['products_options_values'], $aDATA['products_options']);
|
|---|
| 252 | if ((int)$attribute_model >0)
|
|---|
| 253 | $artnr = $attribute_model;
|
|---|
| 254 |
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | $DATAstring .= "Artikelnr_".$nr."=".$artnr."&";
|
|---|
| 258 | $DATAstring .= "ArtikelStammID_" . $nr . "=" . $artnr . "&";
|
|---|
| 259 | $DATAstring .= "Artikelname_".$nr."=".rawurlencode($pDATA['products_name'])."&";
|
|---|
| 260 |
|
|---|
| 261 | // ############# PREISÜBERGABE BRUTTO/NETTO NACH KUNDENGRUPPE #############
|
|---|
| 262 | // Kundengruppen müssen jeweilige Zuordnung inkl/excl. Anzeige im Admin XT haben
|
|---|
| 263 |
|
|---|
| 264 | $price = $pDATA['products_price'];
|
|---|
| 265 | $tax_rate = $pDATA['products_tax'];
|
|---|
| 266 |
|
|---|
| 267 | /* Rabattprüfung */
|
|---|
| 268 | $cQuery = xtc_db_query("SELECT customers_status_ot_discount FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 269 | $customer_discount = xtc_db_fetch_array($cQuery);
|
|---|
| 270 | if ((float)$customer_discount > 0)
|
|---|
| 271 | {
|
|---|
| 272 | $price -= (($customer_discount['customers_status_ot_discount'] / 100)) * $price;
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | if ($pDATA['allow_tax']==0) {
|
|---|
| 276 | $cQuery=xtc_db_query("SELECT customers_status_add_tax_ot FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 277 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 278 | if ($cData['customers_status_add_tax_ot']==0) {
|
|---|
| 279 | $tax_rate=0;
|
|---|
| 280 | } else {
|
|---|
| 281 | $price+=$price/100*$tax_rate;
|
|---|
| 282 | }
|
|---|
| 283 | }
|
|---|
| 284 | //Währungsprüfung
|
|---|
| 285 | $o_currency = $oData['currency'];
|
|---|
| 286 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 287 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 288 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 289 | $xt_currency = $currency_array['value'];
|
|---|
| 290 | }
|
|---|
| 291 | }
|
|---|
| 292 | $price = $price * $xt_currency;
|
|---|
| 293 | //Währungsprüfung END
|
|---|
| 294 | $price = preg_replace("/\./", ",", $price);
|
|---|
| 295 | $tax = preg_replace("/\./", ",", $tax_rate);
|
|---|
| 296 |
|
|---|
| 297 | // ############# PRODUCTS_DATA TEIL2 #############
|
|---|
| 298 |
|
|---|
| 299 | $DATAstring .= "ArtikelEPreis_".$nr."=".$price."&";
|
|---|
| 300 | $DATAstring .= "ArtikelMwst_".$nr."=".$tax."&";
|
|---|
| 301 | $DATAstring .= "ArtikelMenge_".$nr."=". preg_replace("/\./", ",", $pDATA['products_quantity'])."&";
|
|---|
| 302 | $url = HTTP_SERVER.DIR_WS_CATALOG.'product_info.php?products_id='.$pDATA['products_id'];
|
|---|
| 303 | $DATAstring .= "ArtikelLink_".$nr."=".$url."&";
|
|---|
| 304 | //Attributübergabe
|
|---|
| 305 | $a_query = xtc_db_query("SELECT * FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." WHERE orders_id='".$oID."' AND orders_products_id='".$pDATA['orders_products_id']."'");
|
|---|
| 306 | $options = '';
|
|---|
| 307 | while ($aDATA = xtc_db_fetch_array($a_query)) {
|
|---|
| 308 | if ($options == '') {
|
|---|
| 309 | $options = rawurlencode($aDATA['products_options']).":".rawurlencode($aDATA['products_options_values']);
|
|---|
| 310 | } else {
|
|---|
| 311 | $options .= "|".rawurlencode($aDATA['products_options']).":".rawurlencode($aDATA['products_options_values']);
|
|---|
| 312 | }
|
|---|
| 313 | }
|
|---|
| 314 | if ($options != "") {
|
|---|
| 315 | $DATAstring .= "Attribute_".$nr."=".$options."&";
|
|---|
| 316 | }
|
|---|
| 317 | $anzahl += (int)$pDATA['products_quantity'];
|
|---|
| 318 |
|
|---|
| 319 | }
|
|---|
| 320 | // ############# ORDER_TOTAL #############
|
|---|
| 321 |
|
|---|
| 322 | $order_total_query = xtc_db_query("SELECT
|
|---|
| 323 | class,
|
|---|
| 324 | value,
|
|---|
| 325 | sort_order
|
|---|
| 326 | FROM ".TABLE_ORDERS_TOTAL."
|
|---|
| 327 | WHERE orders_id='".$oID."'
|
|---|
| 328 | ORDER BY sort_order ASC");
|
|---|
| 329 |
|
|---|
| 330 | $order_total = array ();
|
|---|
| 331 | $zk = '';
|
|---|
| 332 | $cod_fee = '';
|
|---|
| 333 | $cod_flag = false;
|
|---|
| 334 | $discount_flag = false;
|
|---|
| 335 | $gv_flag = false;
|
|---|
| 336 | $coupon_flag = false;
|
|---|
| 337 | $gv = '';
|
|---|
| 338 | while ($order_total_values = xtc_db_fetch_array($order_total_query)) {
|
|---|
| 339 |
|
|---|
| 340 | $order_total[] = array ('CLASS' => $order_total_values['class'], 'VALUE' => $order_total_values['value']);
|
|---|
| 341 |
|
|---|
| 342 | // ############# NACHNAHME/GUTSCHEINE/KUPONS/RABATTE #############
|
|---|
| 343 | if ($order_total_values['class'] == 'ot_shipping')
|
|---|
| 344 | $shipping = $order_total_values['value'];
|
|---|
| 345 |
|
|---|
| 346 | // Nachnamegebuehr
|
|---|
| 347 | if ($order_total_values['class'] == 'ot_cod_fee') {
|
|---|
| 348 | $cod_flag = true;
|
|---|
| 349 | $cod_fee = $order_total_values['value'];
|
|---|
| 350 | }
|
|---|
| 351 | // Rabatt
|
|---|
| 352 | if ($order_total_values['class'] == 'ot_discount') {
|
|---|
| 353 | $discount_flag = true;
|
|---|
| 354 | $discount = $order_total_values['value'];
|
|---|
| 355 | }
|
|---|
| 356 | // Gutschein
|
|---|
| 357 | if ($order_total_values['class'] == 'ot_gv') {
|
|---|
| 358 | $gv_flag = true;
|
|---|
| 359 | $gv = $order_total_values['value'];
|
|---|
| 360 | }
|
|---|
| 361 | // Kupon
|
|---|
| 362 | if ($order_total_values['class'] == 'ot_coupon') {
|
|---|
| 363 | $coupon_flag = true;
|
|---|
| 364 | $coupon = $order_total_values['value'];
|
|---|
| 365 | }
|
|---|
| 366 | // ot_payment
|
|---|
| 367 | if ($order_total_values['class']=='ot_payment') {
|
|---|
| 368 | $ot_payment_flag=true;
|
|---|
| 369 | $ot_payment=$order_total_values['value'];
|
|---|
| 370 | }
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | // ############# ÜBERGABE NACHNAHME/GUTSCHEINE/KUPONS/RABATTE #############
|
|---|
| 374 |
|
|---|
| 375 | // Nachnamegebuehr Übergabe als Produkt
|
|---|
| 376 | if ($cod_flag) {
|
|---|
| 377 | $nr ++;
|
|---|
| 378 | $DATAstring .= "Artikelnr_".$nr."=99999999&";
|
|---|
| 379 | $DATAstring .= "Artikelname_".$nr."=Nachnahme&";
|
|---|
| 380 | //Übergabe Brutto/Netto
|
|---|
| 381 | if ($pDATA['allow_tax']==0) {
|
|---|
| 382 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 383 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 384 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 385 | $tax_rate=0;
|
|---|
| 386 | } else {
|
|---|
| 387 | $cod_fee=((($cod_fee/100)*$tax_rate)+$cod_fee);
|
|---|
| 388 | }
|
|---|
| 389 | }
|
|---|
| 390 | //Übergabe Brutto/Netto END
|
|---|
| 391 | //Währungsprüfung
|
|---|
| 392 | $o_currency = $oData['currency'];
|
|---|
| 393 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 394 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 395 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 396 | $xt_currency = $currency_array['value'];
|
|---|
| 397 | }
|
|---|
| 398 | }
|
|---|
| 399 | $cod_fee = $cod_fee * $xt_currency;
|
|---|
| 400 | //Währungsprüfung END
|
|---|
| 401 | $cod_fee = preg_replace("/\./", ",", $cod_fee);
|
|---|
| 402 | $DATAstring .= "ArtikelEPreis_".$nr."=".$cod_fee."&";
|
|---|
| 403 | $DATAstring .= "ArtikelMwst_".$nr."=".$tax."&";
|
|---|
| 404 | $DATAstring .= "ArtikelMenge_".$nr."=1&";
|
|---|
| 405 | $p_count ++;
|
|---|
| 406 | }
|
|---|
| 407 | // Rabatt Übergabe als Produkt
|
|---|
| 408 | if ($discount_flag) {
|
|---|
| 409 | $nr ++;
|
|---|
| 410 | $DATAstring .= "Artikelnr_".$nr."=99999998&";
|
|---|
| 411 | $DATAstring .= "Artikelname_".$nr."=Rabatt&";
|
|---|
| 412 | //Übergabe Brutto/Netto
|
|---|
| 413 | if ($pDATA['allow_tax']==0) {
|
|---|
| 414 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 415 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 416 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 417 | $tax_rate=0;
|
|---|
| 418 | } else {
|
|---|
| 419 | $discount=((($discount/100)*$tax_rate)+$discount);
|
|---|
| 420 | }
|
|---|
| 421 | }
|
|---|
| 422 | //Übergabe Brutto/Netto END
|
|---|
| 423 | //Währungsprüfung
|
|---|
| 424 | $o_currency = $oData['currency'];
|
|---|
| 425 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 426 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 427 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 428 | $xt_currency = $currency_array['value'];
|
|---|
| 429 | }
|
|---|
| 430 | }
|
|---|
| 431 | $discount = $discount * $xt_currency;
|
|---|
| 432 | //Währungsprüfung END
|
|---|
| 433 | $discount = preg_replace("/\./", ",", $discount);
|
|---|
| 434 | $DATAstring .= "ArtikelEPreis_".$nr."=".$discount."&";
|
|---|
| 435 | $DATAstring .= "ArtikelMwst_".$nr."=".$tax."&";
|
|---|
| 436 | $DATAstring .= "ArtikelMenge_".$nr."=1&";
|
|---|
| 437 | $p_count ++;
|
|---|
| 438 | }
|
|---|
| 439 | // Gutschein Übergabe als Produkt
|
|---|
| 440 | if ($gv_flag) {
|
|---|
| 441 | $nr ++;
|
|---|
| 442 | $DATAstring .= "Artikelnr_".$nr."=99999997&";
|
|---|
| 443 | $DATAstring .= "Artikelname_".$nr."=Gutschein&";
|
|---|
| 444 | //Übergabe Brutto/Netto
|
|---|
| 445 | if ($pDATA['allow_tax']==0) {
|
|---|
| 446 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 447 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 448 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 449 | $tax_rate=0;
|
|---|
| 450 | } else {
|
|---|
| 451 | $gv=((($gv/100)*$tax_rate)+$gv);
|
|---|
| 452 | }
|
|---|
| 453 | }
|
|---|
| 454 | //Übergabe Brutto/Netto END
|
|---|
| 455 | //Währungsprüfung
|
|---|
| 456 | $o_currency = $oData['currency'];
|
|---|
| 457 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 458 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 459 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 460 | $xt_currency = $currency_array['value'];
|
|---|
| 461 | }
|
|---|
| 462 | }
|
|---|
| 463 | $gv = $gv * $xt_currency;
|
|---|
| 464 | //Währungsprüfung END
|
|---|
| 465 | $gv = preg_replace("/\./", ",", ($gv * (-1)));
|
|---|
| 466 | $DATAstring .= "ArtikelEPreis_".$nr."=".$gv."&";
|
|---|
| 467 | $DATAstring .= "ArtikelMwst_".$nr."=".$tax."&";
|
|---|
| 468 | $DATAstring .= "ArtikelMenge_".$nr."=1&";
|
|---|
| 469 | $p_count ++;
|
|---|
| 470 | }
|
|---|
| 471 | // Kupon Übergabe als Produkt
|
|---|
| 472 | if ($coupon_flag) {
|
|---|
| 473 | $nr ++;
|
|---|
| 474 | $DATAstring .= "Artikelnr_".$nr."=99999996&";
|
|---|
| 475 | $DATAstring .= "Artikelname_".$nr."=Kupon&";
|
|---|
| 476 | //Übergabe Brutto/Netto
|
|---|
| 477 | if ($pDATA['allow_tax']==0) {
|
|---|
| 478 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 479 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 480 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 481 | $tax_rate=0;
|
|---|
| 482 | } else {
|
|---|
| 483 | $coupon=((($coupon/100)*$tax_rate)+$coupon);
|
|---|
| 484 | }
|
|---|
| 485 | }
|
|---|
| 486 | //Übergabe Brutto/Netto END
|
|---|
| 487 | //Währungsprüfung
|
|---|
| 488 | $o_currency = $oData['currency'];
|
|---|
| 489 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 490 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 491 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 492 | $xt_currency = $currency_array['value'];
|
|---|
| 493 | }
|
|---|
| 494 | }
|
|---|
| 495 | $coupon = $coupon * $xt_currency;
|
|---|
| 496 | //Währungsprüfung END
|
|---|
| 497 | $coupon = preg_replace("/\./", ",", ($coupon * (-1)));
|
|---|
| 498 | $DATAstring .= "ArtikelEPreis_".$nr."=".$coupon."&";
|
|---|
| 499 | $DATAstring .= "ArtikelMwst_".$nr."=".$tax."&";
|
|---|
| 500 | $DATAstring .= "ArtikelMenge_".$nr."=1&";
|
|---|
| 501 | $p_count ++;
|
|---|
| 502 | }
|
|---|
| 503 | //ot_payment Übergabe als Produkt
|
|---|
| 504 | if ($ot_payment_flag) {
|
|---|
| 505 | $nr++;
|
|---|
| 506 | $DATAstring .= "Artikelnr_" . $nr . "=99999995&";
|
|---|
| 507 | $DATAstring .= "Artikelname_" . $nr . "=Zahlartenrabatt&";
|
|---|
| 508 | //Übergabe Brutto/Netto
|
|---|
| 509 | if ($pDATA['allow_tax']==0) {
|
|---|
| 510 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 511 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 512 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 513 | $tax_rate=0;
|
|---|
| 514 | } else {
|
|---|
| 515 | $ot_payment=((($ot_payment/100)*$tax_rate)+$ot_payment);
|
|---|
| 516 | }
|
|---|
| 517 | }
|
|---|
| 518 | //Übergabe Brutto/Netto END
|
|---|
| 519 | //Währungsprüfung
|
|---|
| 520 | $o_currency = $oData['currency'];
|
|---|
| 521 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 522 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 523 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 524 | $xt_currency = $currency_array['value'];
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 | $ot_payment = $ot_payment * $xt_currency;
|
|---|
| 528 | //Währungsprüfung END
|
|---|
| 529 | $ot_payment = preg_replace("/\./",",",$ot_payment);
|
|---|
| 530 | $DATAstring .= "ArtikelEPreis_" . $nr . "=" . preg_replace("/\./",",",$ot_payment) . "&";
|
|---|
| 531 | $DATAstring .= "ArtikelMwst_" . $nr . "=" . $tax . "&";
|
|---|
| 532 | $DATAstring .= "ArtikelMenge_" . $nr . "=1&";
|
|---|
| 533 | $p_count++;
|
|---|
| 534 | }
|
|---|
| 535 |
|
|---|
| 536 | $DATAstring .= "PosAnz=".$p_count."&";
|
|---|
| 537 |
|
|---|
| 538 | // ############# ÜBERGABE BRUTTO/NETTO VERSAND #############
|
|---|
| 539 | // mofified FT Kundengruppen müssen jeweilige Zuordnung inkl/excl. Anzeige im Admin XT haben
|
|---|
| 540 | $cod_vK = preg_replace("/\./",",",$cod_fee);
|
|---|
| 541 | if ($order_total_values['class'] == 'ot_shipping')
|
|---|
| 542 | $shipping = $order_total_values['value'];
|
|---|
| 543 | if ($pDATA['allow_tax']==0) {
|
|---|
| 544 | $cQuery=xtc_db_query("SELECT customers_status_show_price_tax FROM ".TABLE_CUSTOMERS_STATUS." WHERE customers_status_id='".$oData['customers_status']."' LIMIT 0,1");
|
|---|
| 545 | $cData=xtc_db_fetch_array($cQuery);
|
|---|
| 546 | if ($cData['customers_status_show_price_tax']==1) {
|
|---|
| 547 | $tax_rate=0;
|
|---|
| 548 | } else {
|
|---|
| 549 | $shipping=((($shipping/100)*$tax_rate)+$shipping);
|
|---|
| 550 | }
|
|---|
| 551 | }
|
|---|
| 552 | //Währungsprüfung
|
|---|
| 553 | $o_currency = $oData['currency'];
|
|---|
| 554 | $curreny_query = xtc_db_query("SELECT * FROM " . TABLE_CURRENCIES);
|
|---|
| 555 | while ($currency_array = xtc_db_fetch_array($curreny_query)) {
|
|---|
| 556 | if ($currency_array['code'] == $o_currency) {
|
|---|
| 557 | $xt_currency = $currency_array['value'];
|
|---|
| 558 | }
|
|---|
| 559 | }
|
|---|
| 560 | $shipping = $shipping * $xt_currency;
|
|---|
| 561 | //Währungsprüfung END
|
|---|
| 562 | $vK = preg_replace("/\./", ",", $shipping);
|
|---|
| 563 | $DATAstring .= "Versandkosten=" . $vK . "&";
|
|---|
| 564 |
|
|---|
| 565 | $s_method = explode('(', $oData['shipping_method']);
|
|---|
| 566 | $s_method = str_replace(' ', '%20', $s_method[0]);
|
|---|
| 567 | $DATAstring .= "kommentar=".rawurlencode($oData['comments'])."&";
|
|---|
| 568 | $DATAstring .= "Versandart=".$s_method."&";
|
|---|
| 569 | $DATAstring .= "NoVersandCalc=1&";
|
|---|
| 570 | // 1 = Versand aus XT
|
|---|
| 571 | // 0 = Versandermittlung durch Afterbuy (nur wennStammartikel erkannt wird!)
|
|---|
| 572 |
|
|---|
| 573 | // ############# ZAHLARTEN "eingedeutscht!" #############
|
|---|
| 574 |
|
|---|
| 575 | //Übergabe Sofortueberweisung
|
|---|
| 576 | if ($oData['payment_method'] == 'pn_sofortueberweisung') {
|
|---|
| 577 | $DATAstring .= "Zahlart=Sofortüberweisung" . "&";
|
|---|
| 578 | // Übergabe als bezahlt
|
|---|
| 579 | $DATAstring .= "SetPay=1&";
|
|---|
| 580 | }
|
|---|
| 581 | //Übergabe Eustandardtransfer
|
|---|
| 582 | if ($oData['payment_method'] == 'eustandardtransfer') {
|
|---|
| 583 | $DATAstring .= "Zahlart=Überweisung%20/%20Vorkasse" . "&";
|
|---|
| 584 | }
|
|---|
| 585 | //Übergabe Cash
|
|---|
| 586 | elseif ($oData['payment_method'] == 'cash') {
|
|---|
| 587 | $DATAstring .= "Zahlart=Barzahlung" . "&";
|
|---|
| 588 | }
|
|---|
| 589 | //Übergabe Cod
|
|---|
| 590 | elseif ($oData['payment_method'] == 'cod') {
|
|---|
| 591 | $DATAstring .= "Zahlart=Nachnahme" . "&";
|
|---|
| 592 | }
|
|---|
| 593 | //Übergabe Kreditkarte
|
|---|
| 594 | elseif ($oData['payment_method'] == 'cc') {
|
|---|
| 595 | $DATAstring .= "Zahlart=Kreditkarte" ."&";
|
|---|
| 596 | }
|
|---|
| 597 | //Übergabe Paypal
|
|---|
| 598 | elseif ($oData['payment_method'] == 'paypal') {
|
|---|
| 599 | $DATAstring .= "Zahlart=Paypal" ."&";
|
|---|
| 600 | // Übergabe als bezahlt
|
|---|
| 601 | $DATAstring .= "SetPay=1&";
|
|---|
| 602 | }
|
|---|
| 603 | //Übergabe Paypal IPN
|
|---|
| 604 | elseif ($oData['payment_method'] == 'paypa_ipn') {
|
|---|
| 605 | $DATAstring .= "Zahlart=Paypal" ."&";
|
|---|
| 606 | }
|
|---|
| 607 | //Übergabe Rechnung
|
|---|
| 608 | elseif ($oData['payment_method'] == 'invoice') {
|
|---|
| 609 | $DATAstring .= "Zahlart=Rechnung" ."&";
|
|---|
| 610 | }
|
|---|
| 611 | //Übergabe Rechnung bis 60 Euro
|
|---|
| 612 |
|
|---|
| 613 | elseif ($oData['payment_method'] == 'invoiceb') {
|
|---|
| 614 |
|
|---|
| 615 | $DATAstring .= "Zahlart=Rechnung bis 60 Euro" ."&";
|
|---|
| 616 |
|
|---|
| 617 | }
|
|---|
| 618 |
|
|---|
| 619 | //Übergabe Moneyorder
|
|---|
| 620 | elseif ($oData['payment_method'] == 'moneyorder') {
|
|---|
| 621 | $DATAstring .= "Zahlart=Vorkasse/Überweisung" . "&";
|
|---|
| 622 | }
|
|---|
| 623 | //Übergabe ipayment
|
|---|
| 624 | elseif ($oData['payment_method'] == 'ipayment') {
|
|---|
| 625 | $DATAstring .= "Zahlart=IPayment" . "&";
|
|---|
| 626 | $DATAstring .= "SetPay=1&";
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | //Übergabe Bankdaten
|
|---|
| 630 | elseif ($oData['payment_method'] == 'banktransfer') {
|
|---|
| 631 |
|
|---|
| 632 | $DATAstring .= "Zahlart=Bankeinzug" ."&";
|
|---|
| 633 |
|
|---|
| 634 | if ($_GET['oID']) {
|
|---|
| 635 | $b_query = xtc_db_query("SELECT * FROM banktransfer WHERE orders_id='".$_GET['oID']."'");
|
|---|
| 636 | $b_data=xtc_db_fetch_array($b_query);
|
|---|
| 637 | $DATAstring .= "Bankname=".rawurlencode($b_data['banktransfer_bankname'])."&";
|
|---|
| 638 | $DATAstring .= "BLZ=".$b_data['banktransfer_blz']."&";
|
|---|
| 639 | $DATAstring .= "Kontonummer=".$b_data['banktransfer_number']."&";
|
|---|
| 640 | $DATAstring .= "Kontoinhaber=".rawurlencode($b_data['banktransfer_owner'])."&";
|
|---|
| 641 | } else {
|
|---|
| 642 | $DATAstring .= "Bankname=".rawurlencode($_POST['banktransfer_bankname'])."&";
|
|---|
| 643 | $DATAstring .= "BLZ=".$_POST['banktransfer_blz']."&";
|
|---|
| 644 | $DATAstring .= "Kontonummer=".$_POST['banktransfer_number']."&";
|
|---|
| 645 | $DATAstring .= "Kontoinhaber=".rawurlencode($_POST['banktransfer_owner'])."&";
|
|---|
| 646 | } }
|
|---|
| 647 | //sonst Übergabe wie XT
|
|---|
| 648 | else {
|
|---|
| 649 | $DATAstring .= "Zahlart=" . $oData['payment_method'] . "&";
|
|---|
| 650 | }
|
|---|
| 651 |
|
|---|
| 652 | // ############# FEEDBACKDATUM SETZEN #############
|
|---|
| 653 | // Modifiziert FT
|
|---|
| 654 | $feedbackdatum = '0';
|
|---|
| 655 | $DATAstring .= "NoFeedback=" . $feedbackdatum . "&";
|
|---|
| 656 | //0= Feedbackdatum setzen und KEINE automatische Erstkontaktmail versenden
|
|---|
| 657 | //1= KEIN Feedbackdatum setzen, aber automatische Erstkontaktmail versenden (Achtung: Kunde müsste Feedback durchlaufen wenn die Erstkontakt nicht angepasst wird!)
|
|---|
| 658 | //2= Feedbackdatum setzen und automatische Erstkontaktmail versenden (Achtung: Erstkontaktmail muss mit Variablen angepasst werden!)
|
|---|
| 659 |
|
|---|
| 660 | $file = DIR_FS_DOCUMENT_ROOT.'automatik_import/'.'afterbuylog.txt';
|
|---|
| 661 |
|
|---|
| 662 | // Open the file to get existing content
|
|---|
| 663 | $current = file_get_contents($file);
|
|---|
| 664 | // Append a new person to the file
|
|---|
| 665 | $current .= "$DATAstring \n";
|
|---|
| 666 | // Write the contents back to the file
|
|---|
| 667 | file_put_contents($file, $current);
|
|---|
| 668 |
|
|---|
| 669 | // ############# CHECK #############
|
|---|
| 670 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|---|
| 671 | curl_setopt($ch, CURLOPT_POSTFIELDS, $DATAstring);
|
|---|
| 672 | $result = curl_exec($ch);
|
|---|
| 673 | // Open the file to get existing content
|
|---|
| 674 | $current = file_get_contents($file);
|
|---|
| 675 | // Append a new person to the file
|
|---|
| 676 | $current .= "$result \n";
|
|---|
| 677 | // Write the contents back to the file
|
|---|
| 678 | file_put_contents($file, $current);
|
|---|
| 679 | if (preg_match("/<success>1<\/success>/", $result)) {
|
|---|
| 680 | // result ok, mark order
|
|---|
| 681 | // extract ID from result
|
|---|
| 682 | $cdr = explode('<KundenNr>', $result);
|
|---|
| 683 | $cdr = explode('</KundenNr>', $cdr[1]);
|
|---|
| 684 | $cdr = $cdr[0];
|
|---|
| 685 | $this->kdnr = $cdr;
|
|---|
| 686 | xtc_db_query("update ".TABLE_ORDERS." set afterbuy_success='1',afterbuy_id='".$cdr."' where orders_id='".$oID."'");
|
|---|
| 687 | //wenn Kundenkommentar
|
|---|
| 688 | if ($oData['comments'] != '') {
|
|---|
| 689 | $mail_content .= "Name: " .$oData['billing_firstname']." ".$oData['billing_lastname']. "\nEmailadresse: " .$oData['customers_email_address']. "\nKundenkommentar: " .$oData['comments']. "\nBestellnummer: " .$oID.chr(13).chr(10). "\n";
|
|---|
| 690 | mail(EMAIL_BILLING_ADDRESS, "Kundenkommentar bei Bestellung", $mail_content);
|
|---|
| 691 | }
|
|---|
| 692 | //set new order status
|
|---|
| 693 | if ($order_status != '') {
|
|---|
| 694 | xtc_db_query("update ".TABLE_ORDERS." set orders_status='".$order_status."' where orders_id='".$oID."'");
|
|---|
| 695 | }
|
|---|
| 696 | } else {
|
|---|
| 697 |
|
|---|
| 698 | // mail to shopowner
|
|---|
| 699 | $mail_content = 'Fehler bei âÜbertragung der Bestellung: '.$oID.chr(13).chr(10).'Folgende Fehlermeldung wurde vom afterbuy.de zurückgegeben:'.chr(13).chr(10).$result;
|
|---|
| 700 | mail(EMAIL_BILLING_ADDRESS, "Afterbuy-Fehlübertragung", $mail_content);
|
|---|
| 701 | }
|
|---|
| 702 | // close session
|
|---|
| 703 | curl_close($ch);
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | // Funktion zum ueberpruefen ob Bestellung bereits an Afterbuy gesendet.
|
|---|
| 707 | function order_send() {
|
|---|
| 708 | $check_query = xtc_db_query("SELECT afterbuy_success FROM ".TABLE_ORDERS." WHERE orders_id='".$this->order_id."'");
|
|---|
| 709 | $data = xtc_db_fetch_array($check_query);
|
|---|
| 710 |
|
|---|
| 711 | //if ($data['afterbuy_success'] == 1)
|
|---|
| 712 | // return false;
|
|---|
| 713 | return true;
|
|---|
| 714 | }
|
|---|
| 715 | function get_kdnr()
|
|---|
| 716 | {
|
|---|
| 717 | return $this->kdnr;
|
|---|
| 718 | }
|
|---|
| 719 | }
|
|---|
| 720 |
|
|---|
| 721 | ?>
|
|---|