<?php if (isset($address_book) && isset($_SESSION["log"])) { if (isset($_GET["delete"])) { $aID = (int) $_GET["delete"]; if (regGetAddressByLogin($aID, $_SESSION["log"])) { redDeleteAddress($aID); } } if (isset($_POST["save"])) { $aID = (int) $_POST["DefaultAddress"]; if (regGetAddressByLogin($aID, $_SESSION["log"])) { regSetDefaultAddressIDByLogin($_SESSION["log"], $aID); } } $addresses = regGetAllAddressesByLogin($_SESSION["log"]); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr($addresses[$i]["addressID"]); } $defaultAddressID = regGetDefaultAddressIDByLogin($_SESSION["log"]); $smarty->assign("defaultAddressID", $defaultAddressID); $smarty->assign("addresses", $addresses); $smarty->assign("main_content_template", "address_book.tpl"); }
function regEmailNotification($smarty_mail, $login, $cust_password, $Email, $first_name, $last_name, $subscribed4news, $additional_field_values, $countryID, $zoneID, $state, $city, $address, $updateOperation) { $user = array(); $smarty_mail->assign("login", $login); $smarty_mail->assign("cust_password", $cust_password); $smarty_mail->assign("first_name", $first_name); $smarty_mail->assign("last_name", $last_name); $smarty_mail->assign("Email", $Email); $additional_field_values = GetRegFieldsValues($login); $smarty_mail->assign("additional_field_values", $additional_field_values); $addresses = regGetAllAddressesByLogin($login); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr((int) $addresses[$i]["addressID"]); } $smarty_mail->assign("addresses", $addresses); if (CONF_ENABLE_REGCONFIRMATION) { $sql = 'SELECT ActivationCode FROM ' . CUSTOMERS_TABLE . ' WHERE Login="******" AND cust_password="******"'; @(list($ActivationCode) = db_fetch_row(db_query($sql))); $smarty_mail->assign('ActURL', CONF_FULL_SHOP_URL . (substr(CONF_FULL_SHOP_URL, strlen(CONF_FULL_SHOP_URL) - 1, 1) == '/' ? '' : '/') . 'index.php?act_customer=1&act_code=' . $ActivationCode); $smarty_mail->assign('ActCode', $ActivationCode); } $html = $smarty_mail->fetch("register_successful.tpl"); xMailTxtHTMLDATA($Email, EMAIL_REGISTRATION, $html); }
if (CONF_BACKEND_SAFEMODE) { Redirect(ADMIN_FILE . "?dpt=custord&sub=custlist&customer_details=contact_info&customerID=" . $_GET["customerID"] . "&encodedReturnUrl=" . $_GET["encodedReturnUrl"] . "&safemode=yes"); } regSetCustgroupID($_GET["customerID"], $_POST["custgroupID"]); } $log1 = regGetLoginById($_GET["customerID"]); $customerInfo = regGetCustomerInfo2($log1); $reg_fields_values = GetRegFieldsValues($log1); $customer_groups = GetAllCustGroups(); $smarty->assign("customer_groups", $customer_groups); $smarty->assign("reg_fields_values", $reg_fields_values); $smarty->assign("customerInfo", $customerInfo); } if ($_GET["customer_details"] == "address_book") { $log1 = regGetLoginById($_GET["customerID"]); $addresses = regGetAllAddressesByLogin($log1); for ($i = 0; $i < count($addresses); $i++) { $addresses[$i]["addressStr"] = regGetAddressStr($addresses[$i]["addressID"]); } $defaultAddressID = regGetDefaultAddressIDByLogin($log1); $smarty->assign("addresses", $addresses); $smarty->assign("defaultAddressID", $defaultAddressID); } if ($_GET["customer_details"] == "order_history") { $data = ScanPostVariableWithId(array("set_order_status")); foreach ($data as $orderID => $value) { ostSetOrderStatusToOrder($orderID, $_POST["order_status_in_table_" . $orderID]); } $orders = array(); $callBackParam = array(); $callBackParam["customerID"] = $_GET["customerID"];
function serExportCustomersToExcel($customers) { $maxCountAddress = 0; foreach ($customers as $customer) { $q = db_query("select count(*) from " . CUSTOMER_ADDRESSES_TABLE . " where customerID=" . $customer["customerID"]); $countAddress = db_fetch_row($q); $countAddress = $countAddress[0]; if ($maxCountAddress < $countAddress) { $maxCountAddress = $countAddress; } } // open file to write $f = fopen("core/temp/customers.csv", "w"); // head table generate $headLine = "Login;First name;Last name;Email;Group;Registered;Newsletter subscription;"; $q = db_query("select reg_field_ID, reg_field_name from " . CUSTOMER_REG_FIELDS_TABLE . " order by sort_order "); while ($row = db_fetch_row($q)) { $headLine .= _filterBadSymbolsToExcel($row["reg_field_name"]) . ";"; } for ($i = 1; $i <= $maxCountAddress; $i++) { $headLine .= "Address " . $i . ";"; } fputs($f, $headLine . "\n"); foreach ($customers as $customer) { $q = db_query("select Login, first_name, last_name, Email, custgroupID, reg_datetime, subscribed4news from " . CUSTOMERS_TABLE . " where addressID=" . (int) $customer["addressID"]); $row_cust = db_fetch_row($q); if ($row_cust["custgroupID"] != null) { $q = db_query("select custgroup_name from " . CUSTGROUPS_TABLE . " where custgroupID=" . $row_cust["custgroupID"]); $row = db_fetch_row($q); $row_cust["custgroup_name"] = $row["custgroup_name"]; } else { $row_cust["custgroup_name"] = ""; } if ($row_cust["subscribed4news"]) { $row_cust["subscribed4news"] = "+"; } else { $row_cust["subscribed4news"] = ""; } $line = ""; $line .= _filterBadSymbolsToExcel($row_cust["Login"]) . ";"; $line .= _filterBadSymbolsToExcel($row_cust["first_name"]) . ";"; $line .= _filterBadSymbolsToExcel($row_cust["last_name"]) . ";"; $line .= _filterBadSymbolsToExcel($row_cust["Email"]) . ";"; $line .= _filterBadSymbolsToExcel($row_cust["custgroup_name"]) . ";"; $line .= _filterBadSymbolsToExcel($row_cust["reg_datetime"]) . ";"; $line .= $row_cust["subscribed4news"] . ";"; $q_reg_param = db_query("select reg_field_ID, reg_field_name from " . CUSTOMER_REG_FIELDS_TABLE . " order by sort_order "); while ($row = db_fetch_row($q_reg_param)) { $q_reg_value = db_query("select reg_field_value from " . CUSTOMER_REG_FIELDS_VALUES_TABLE . " where reg_field_ID=" . $row["reg_field_ID"] . " AND customerID=" . $customer["customerID"]); $value = db_fetch_row($q_reg_value); $value = $value["reg_field_value"]; $line .= _filterBadSymbolsToExcel($value) . ";"; } $countAddress = 0; $addresses = regGetAllAddressesByLogin(regGetLoginById($customer["customerID"])); foreach ($addresses as $address) { $line .= " " . _filterBadSymbolsToExcel(regGetAddressStr($address["addressID"])) . ";"; $countAddress++; } for ($i = 1; $i <= $maxCountAddress - $countAddress; $i++) { $line .= ";"; } fputs($f, $line . "\n"); } fclose($f); }