Jump to content

YePix

Members
  • Content count

    395
  • Joined

  • Last visited

  • Days Won

    5

YePix last won the day on May 18

YePix had the most liked content!

2 Followers

Profile Information

  • Real Name
    YePix

Recent Profile Visitors

26,928 profile views
  1. I uploaded it to the apps but it is not published. I have no idea what's happening with oscommerce but unfortunately nothing has changed for the better lately.
  2. YePix

    NEED ADVICE ON MY OS COMMERCE WEBSITE

    hi, yes @Hotclutch is right. I switched to this version too. No offense, but it will still be many months before version 4.0 is ready for use.
  3. file for Bootstrap frozen 2.3.4.1 catalog/admin/master_password.php <?php require('includes/application_top.php'); require('includes/functions/' . 'password_funcs.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'save': if (isset($_GET['mPID'])) $pass_id = tep_db_prepare_input($_GET['mPID']); $master_password = tep_db_prepare_input($_POST['master_password']); $sql_data_array = array( 'master_password' => tep_encrypt_password($master_password)); if ($action == 'save') { $sql_data_array = $sql_data_array; if (empty($master_password)){ function gennewPassword ( $passwordlength = 8, $numNonAlpha = 0, $numNumberChars = 0, $useCapitalLetter = false ) { $numberChars = '123456789'; $specialChars = '!$%&=?*-:;.,+~@_'; $secureChars = 'abcdefghjkmnpqrstuvwxyz'; $stack = ''; $stack = $secureChars; if ( $useCapitalLetter == true ) $stack .= strtoupper ( $secureChars ); $count = $passwordlength - $numNonAlpha - $numNumberChars; $temp = str_shuffle ( $stack ); $stack = substr ( $temp , 0 , $count ); if ( $numNonAlpha > 0 ) { $temp = str_shuffle ( $specialChars ); $stack .= substr ( $temp , 0 , $numNonAlpha ); } if ( $numNumberChars > 0 ) { $temp = str_shuffle ( $numberChars ); $stack .= substr ( $temp , 0 , $numNumberChars ); } $stack = str_shuffle ( $stack ); return $stack; } $passwd = gennewPassword ( 8, 2, 2, true ); tep_db_query("update master_pass set master_password = '" . tep_encrypt_password($passwd) . "' where pass_id = '" . (int)$pass_id . "'"); tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_encrypt_password($passwd) . "' where configuration_key = 'MASTER_PASS'"); }else{ tep_db_perform('master_pass', $sql_data_array, 'update', "pass_id = '" . (int)$pass_id . "'"); tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_encrypt_password($master_password) . "' where configuration_key = 'MASTER_PASS'"); } } if (USE_CACHE == 'true') { tep_reset_cache_block('pass_labels'); } tep_redirect(tep_href_link('master_password.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mPID=' . $pass_id)); break; } } require('includes/template_top.php'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><h1><?php echo MASTER_PASSWORT_HEADING_TITLE; ?></h1></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"><?php echo MASTER_PASSWORT_HEADING_TITLE; ?></td> <td class="dataTableHeadingContent" align="right"></td> </tr> <?php $masterpass_query_raw = "select pass_id, master_password from master_pass order by pass_id"; $masterpass_query = tep_db_query($masterpass_query_raw); while ($masterpass = tep_db_fetch_array($masterpass_query)) { $masterpass_id = $masterpass['pass_id']; if ((!isset($_GET['mPID']) || (isset($_GET['mPID']) && ($_GET['mPID'] == $masterpass['pass_id']))) && !isset($mpInfo) && (substr($action, 0, 3) != 'new')) { $mpInfo = new objectInfo($masterpass); } if (isset($mpInfo) && is_object($mpInfo) && ($masterpass['pass_id'] == $mpInfo->pass_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('master_password.php', '&mPID=' . $masterpass['pass_id'] . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('master_password.php', '&mPID=' . $masterpass['pass_id']) . '\'">' . "\n"; } ?> <td class="dataTableContent"> <?php echo MASTER_PASSWORT_TEXT_SECURE; ?></td> <td class="dataTableContent" align="right"> </td> </tr> <?php } ?> <tr> <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" valign="top"></td> <td class="smallText" align="right"></td> </tr> </table></td> <tr> <td colspan="4"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <td colspan="4" class="smallText" align="right"></td> </tr> </table></td> <?php $heading = array(); $contents = array(); switch ($action) { case 'edit': $heading[] = array('text' => MASTER_PASSWORT_HEADING_TITLE . ' ' . TEXT_MASTER_PASSWORT_TITLE_EDIT); $contents = array('form' => tep_draw_form('pass_labels', 'master_password.php', '&mPID=' . $mpInfo->pass_id . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => MASTER_PASSWORT_TEXT_EDIT_INTRO); $contents[] = array('text' => '<br />' . tep_draw_input_field('master_password', '', 'required aria-required="true"')); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'plus', null, 'primary')); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link('master_password.php', '&mPID=' . $mpInfo->pass_id))); break; default: if (isset($mpInfo) && is_object($mpInfo)) { $heading[] = array('align' => 'center', 'text' => TEXT_MASTER_PASSWORT_TITLE_EDIT); $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link('master_password.php', '&mPID=' . $mpInfo->pass_id . '&action=edit'))); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table></td> </tr> </table> <?php require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?>
  4. file for Bootstrap frozen 2.3.4.1 catalog/admin/master_password.php is on work
  5. This post is only for users of the following version: https://forums.oscommerce.com/topic/497129-w3-oscommerce-wip/ If someone runs the standard version and is interested in a corresponding solution, just let me know. ############################################################################# Anyone who has installed the master password and uses the following settings: -- phpMyAdmin SQL Dump -- version 5.1.3 -- -- Server-Version: 8.0.29 -- PHP-Version: 7.4.28 should check if it still works. if not, 3 changes are necessary in the database and the following files. in the database (configuration) delete: MASTER_PASS_UPD further in (configuration) configuration_key = MASTER_PASS change configuration_group_id to '6' import the following sql: CREATE TABLE `master_pass` ( `pass_id` int NOT NULL, `master_password` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; INSERT INTO `master_pass` (`pass_id`, `master_password`) VALUES (1, '$P$DUtaalZRAg5bys3.I/flCi4YeQ3TNI0'); catalog/admin/master_password.php <?php require('includes/application_top.php'); require('includes/functions/' . 'password_funcs.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); if (tep_not_null($action)) { switch ($action) { case 'save': if (isset($_GET['mPID'])) $pass_id = tep_db_prepare_input($_GET['mPID']); $master_password = tep_db_prepare_input($_POST['master_password']); $sql_data_array = array( 'master_password' => tep_encrypt_password($master_password)); if ($action == 'save') { $sql_data_array = $sql_data_array; if (empty($master_password)){ function gennewPassword ( $passwordlength = 8, $numNonAlpha = 0, $numNumberChars = 0, $useCapitalLetter = false ) { $numberChars = '123456789'; $specialChars = '!$%&=?*-:;.,+~@_'; $secureChars = 'abcdefghjkmnpqrstuvwxyz'; $stack = ''; $stack = $secureChars; if ( $useCapitalLetter == true ) $stack .= strtoupper ( $secureChars ); $count = $passwordlength - $numNonAlpha - $numNumberChars; $temp = str_shuffle ( $stack ); $stack = substr ( $temp , 0 , $count ); if ( $numNonAlpha > 0 ) { $temp = str_shuffle ( $specialChars ); $stack .= substr ( $temp , 0 , $numNonAlpha ); } if ( $numNumberChars > 0 ) { $temp = str_shuffle ( $numberChars ); $stack .= substr ( $temp , 0 , $numNumberChars ); } $stack = str_shuffle ( $stack ); return $stack; } $passwd = gennewPassword ( 8, 2, 2, true ); tep_db_query("update master_pass set master_password = '" . tep_encrypt_password($passwd) . "' where pass_id = '" . (int)$pass_id . "'"); tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_encrypt_password($passwd) . "' where configuration_key = 'MASTER_PASS'"); }else{ tep_db_perform('master_pass', $sql_data_array, 'update', "pass_id = '" . (int)$pass_id . "'"); tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_encrypt_password($master_password) . "' where configuration_key = 'MASTER_PASS'"); } } if (USE_CACHE == 'true') { tep_reset_cache_block('pass_labels'); } tep_redirect(tep_href_link('master_password.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mPID=' . $pass_id)); break; } } require('includes/template_top.php'); ?> <div class="w3-padding"> <h1 class="pageHeading"><?php echo MASTER_PASSWORT_HEADING_TITLE; ?></h1> <div class="d-flex flex-column flex-sm-row mb-3"> <div class="flex-grow-1"> <table class="w3-table w3-border w3-bordered w3-hoverable"> <thead class="w3-hover-none"> <tr class="w3-theme"> <th scope="col"><?php echo MASTER_PASSWORT_HEADING_TITLE; ?></th> </tr> </thead> <tbody> <?php $masterpass_query_raw = "select pass_id, master_password from master_pass order by pass_id"; $masterpass_query = tep_db_query($masterpass_query_raw); while ($masterpass = tep_db_fetch_array($masterpass_query)) { $masterpass_id = $masterpass['pass_id']; if ((!isset($_GET['mPID']) || (isset($_GET['mPID']) && ($_GET['mPID'] == $masterpass['pass_id']))) && !isset($mpInfo) && (substr($action, 0, 3) != 'new')) { $mpInfo = new objectInfo($masterpass); } if (isset($mpInfo) && is_object($mpInfo) && ($masterpass['pass_id'] == $mpInfo->pass_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('master_password.php', '&mPID=' . $masterpass['pass_id'] . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('master_password.php', '&mPID=' . $masterpass['pass_id']) . '\'">' . "\n"; } ?> <td class="dataTableContent">&nbsp;<?php echo MASTER_PASSWORT_TEXT_SECURE; ?></td> </tr> <?php } ?> </tbody> </table> </div> <?php $heading = ''; $contents = ''; switch ($action) { case 'edit': $heading = MASTER_PASSWORT_HEADING_TITLE . '&nbsp;' . TEXT_MASTER_PASSWORT_TITLE_EDIT; $contents = tep_draw_form('pass_labels', 'master_password.php', '&mPID=' . $mpInfo->pass_id . '&action=save', 'post', 'enctype="multipart/form-data"'); $contents .= '<tr><td>' . MASTER_PASSWORT_TEXT_EDIT_INTRO; $contents .= '<div class="mt-2 mb-3">' . tep_draw_input_field('master_password', '', 'required aria-required="true" class="w3-input w3-border"') . '</div>'; $contents .= '<hr class="hr-gr mt-2 mb-2"><div class="mb-3 mt-3">' . tep_draw_w3_button(IMAGE_SAVE, 'disk', null, 'primary', null, 'class="w3-button w3-large w3-block w3-teal"') . '</div><div class="mb-3">' . tep_draw_w3_button(IMAGE_CANCEL, 'close', tep_href_link('master_password.php', '&mPID=' . $mpInfo->pass_id), null, null, 'class="w3-button w3-large w3-block w3-theme-light"') . '</div>'; $contents .= '</td></tr>'; $contents .= '</form>'; break; default: if (isset($mpInfo) && is_object($mpInfo)) { // $heading[] = array('align' => 'center', 'text' => '&nbsp;<strong>' . $mpInfo->master_password . '</strong>'); $heading = TEXT_MASTER_PASSWORT_TITLE_EDIT; $contents = '<tr><td>' . tep_draw_w3_button(IMAGE_EDIT, 'document', tep_href_link('master_password.php', '&mPID=' . $mpInfo->pass_id . '&action=edit'), null, null, 'class="w3-button w3-large w3-block w3-black mb-3"'); $contents .= '<div class="clearfix"></div>'; $contents .= '</td></tr>'; } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo '<div class="w3-quarter ms-sm-2">' . "\n" . ' <table class="w3-table w3-border w3-border-black w3-light-gray">' . ' <thead>' . ' <tr class="w3-theme">' . ' <th scope="col">'. $heading . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>' . $contents . '</tbody>' . ' </table>' . '</div>' . "\n"; } ?> </div> </div> <?php require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?> catalog/admin/includes/languages/master_password.php <?php define('MASTER_PASSWORT_HEADING_TITLE', 'Masterpasswort'); define('TEXT_MASTER_PASSWORT_TITLE_EDIT', 'bearbeiten'); define('MASTER_PASSWORT_TEXT_SECURE', '** Passwort verschlüsselt **'); define('MASTER_PASSWORT_TEXT_EDIT_INTRO', 'Vergeben Sie hier das neue Masterpasswort, mit dem Sie sich, über die Shopseite, in jedes Kundenkonto einloggen können.'); ?> catalog/admin/includes/boxes/configuration.php array( 'code' => 'master_password.php', 'title' => BOX_CONFIGURATION_MASTER_PASSWORD, 'link' => tep_href_link('master_password.php') ), catalog/admin/includes/languages/german.php - or your file define('BOX_CONFIGURATION_MASTER_PASSWORD', 'Masterpasswort'); delete: catalog/admin/includes/sew_actions/encrypt_var.php catalog/admin/includes/boxes/master_password.php catalog/admin/includes/languages/modules/boxes/master_password.php
  6. New changed file: catalog/admin/inactive_user.php <?php require('includes/application_top.php'); // for Inactive User removal function get_year_list($name) { $years = array(); $years_query = tep_db_query("select distinct YEAR(customers_info_date_account_created) as y from " . TABLE_CUSTOMERS_INFO . " order by year(customers_info_date_account_created)"); while ($year = tep_db_fetch_array($years_query)) { $years[] = array('id' => $year['y'], 'text' => $year['y']); } return tep_draw_pull_down_menu($name, $years, '', 'class="w3-select w3-border w3-border-black w3-camo-field"'); } function get_monthname_list($name) { $months = array(); for ($i=1; $i<13; $i++) { $months[] = array('id' => $i, 'text' => date('F', mktime(0,0,0,$i,1,2011))); } return tep_draw_pull_down_menu($name, $months, '', 'class="w3-select w3-border w3-border-black w3-camo-earth"'); } function get_day_list($name) { $days = array(); for ($i=1; $i<32; $i++) { $days[] = array('id' => $i, 'text' => $i); } return tep_draw_pull_down_menu($name, $days, '', 'class="w3-select w3-border w3-border-black w3-camo-sand"'); } function delete_customer($customers_id) { tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'"); } function count_orders($customers_id) { $query = tep_db_query("select count(*) as total from " . TABLE_ORDERS . " where customers_id = " . (int)$customers_id); $num = tep_db_fetch_array($query); return $num['total']; } function last_order($customers_id) { $query = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where customers_id = " . (int)$customers_id . ' order by date_purchased desc limit 1'); $d = tep_db_fetch_array($query); return tep_date_short($d['date_purchased']); } function list_customers($raw_query, $inc_with_orders = false) { global $_GET; $cid = isset($_GET['id']) ? $_GET['id'] : 0; $page = isset($_GET['page']) ? $_GET['page'] : 1; ?> <?php /*****************************/ ?> <?php $rows = 0; $siu_query = tep_db_query($raw_query); while ($customers = tep_db_fetch_array($siu_query)) { $rows++; $customers['num_orders'] = count_orders($customers['customers_id']); if ($inc_with_orders || ($customers['num_orders'] == 0)) { if ($customers['customers_newsletter'] == '1') { $customers['customers_newsletter'] = NEWSLETTER_YES; } else { $customers['customers_newsletter'] = '<span class="w3-text-red">' . NEWSLETTER_NO . '</span>' ; } if (strlen($rows) < 1) { $rows = '0' . $rows; } ?> <div class="col-sm-12 w3-padding w3-border w3-bottombar w3-border-theme mb-3 w3-hover-border-blue w3-hover-shadow"> <div class="col-sm-2 mb-2"><div class="w3-col s1 mt-2"><?php echo '<a href="' . tep_href_link('inactive_user.php', 'go=delete&id=' . $customers['customers_id'] . '&page=' . $page) .'"><i class="fa fa-trash-alt"></i></a>'; ?></div><div class="w3-col s10 mt-2"><?php echo $customers['customers_id'];?> <?php echo $customers['customers_firstname'] . ' ' . $customers['customers_lastname'];?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo TABLE_HEADING_CREATED . ': ' . tep_date_short($customers['customers_info_date_account_created']); ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo '<a href="mail.php?selected_box=tools&customer=' . $customers['customers_email_address'] . '">' . $customers['customers_email_address'] . '</a>' ; ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo TABLE_HEADING_NEWS . ': ' . $customers['customers_newsletter']; ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php if (!empty($customers['customers_info_date_of_last_logon'])){ echo TABLE_HEADING_LAST_LOGON . ': ' . tep_date_short($customers['customers_info_date_of_last_logon']);}else{echo TABLE_HEADING_LAST_LOGON . ': <span class="w3-text-red"><b>' . TABLE_HEADING_CUSTOMER_INACTIVE . '</b></span>';} ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php if (!empty($customers['num_orders'])){ echo TABLE_HEADING_ORDERS . ': ' . $customers['num_orders'];}else{ echo TABLE_HEADING_ORDERS . ': ' . '<span class="w3-text-red"><b>' . TABLE_HEADING_ORDERS_EMPTY . '</b></span>';} ?> <?php if (!empty(last_order($customers['customers_id']))) echo TABLE_HEADING_LAST_ORDER . ': ' . last_order($customers['customers_id']); ?></div></div> <div class="clearfix"></div></div> <?php } //end if } // end while ?> <?php /*****************************/ ?> <?php } // end function list_customers $action = isset($_GET['go']) ? $_GET['go'] : ''; if (!isset($_SESSION['minage']) || !is_integer($_SESSION['minage'])) $_SESSION['minage'] = 12; if ($action == 'setage') { // change minimum age of information to work with if (is_numeric($_POST['age'])) $_SESSION['minage'] = (int)$_POST['age']; unset($_GET['go']); } if ($_SESSION['minage'] < 1) $_SESSION['minage'] = 12; $yearsold = intval($_SESSION['minage'] / 12); $monthsold = $_SESSION['minage'] % 12; $maxyear = date('Y') - $yearsold; $maxmonth = date('n') - $monthsold; if ($maxmonth < 1) { $maxyear--; $maxmonth = 12 + $maxmonth; } if (strlen($maxmonth) < 2) $maxmonth = '0' . $maxmonth; $maxday = date('d'); if ($maxday > 28) $maxday = 28; // all months have at least 28 days $maxdate = $maxyear . '-' . $maxmonth . '-' . $maxday; // customer records must come before this date $maxdate_e = $maxday . '.' . $maxmonth . '.' . $maxyear; require('includes/template_top.php'); ?> <div class="w3-padding"> <?php $cust_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$cid . "'"); $cust = tep_db_fetch_array($cust_query); if ($action == 'delete') { // confirm deletion of single customer echo '<p class="main"><br />' . sprintf(SURE_TO_DELETE, $cust[customers_firstname] . ' ' . $cust[customers_lastname]) . '<br /><br />' . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('inactive_user.php', 'page=' . $page . '&go=deleteyes&id=' . $cid)) . ' ' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } elseif ($action == 'deleteyes') { // single customer deletion has been confirmed delete_customer($cid); echo '<p class="main"><br />' . sprintf(SIU_CUSTOMER_DELETED, $cust[customers_firstname] . ' ' . $cust[customers_lastname]) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } elseif ($action == 'deletenull') { // confirm deletion of no log in customers $yy = (int)$_POST['yy']; $mm = (int)$_POST['mm']; if (strlen($mm) < 2) $mm = '0' . $mm; $dd = (int)$_POST['dd']; if (strlen($dd) < 2) $dd = '0' . $dd; $beforedate = $yy . '-' . $mm . '-' . $dd; $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); if ($withorders && ($yy == date('Y'))) { echo '<p class="main"><br /><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } else { echo '<p class="main"><br />' . SURE_TO_DELETE_NULL . '<br />' . SIU_DELETE_NULL . tep_date_short($beforedate) . '<br />' . ENTRY_WITH_ORDERS . ($withorders ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br />' . ENTRY_NO_NEWSLETTER . ($nonews ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br /><br />' . tep_draw_form('deletenullconfirm', 'inactive_user.php'. '?go=deletenullyes') . tep_draw_hidden_field('with_orders', $_POST['with_orders']) . tep_draw_hidden_field('no_news_only', $_POST['no_news_only']) . tep_draw_hidden_field('beforedate', $beforedate) . tep_draw_button(IMAGE_DELETE, 'trash', null, 'secondary') . '</form> ' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; echo SIU_AFFECTED_CUSTOMERS . "<br /><br /></p>\n"; if ($nonews) { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } list_customers($siu_query_raw, $withorders); } } elseif ($action == 'deletenullyes') { // deletion of no log in customers has been confirmed $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); $beforedate = tep_db_prepare_input($_POST['beforedate']); if ($withorders && (substr($beforedate, 0, 4) == date('Y'))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } else { if ($nonews) { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } $siu_query = tep_db_query($siu_query_raw); echo '<p class="main"><strong>' . TEXT_DELETED_CUSTOMERS . "</strong><br />\n"; while ($customers = tep_db_fetch_array($siu_query)) { $customers['num_orders'] = count_orders($customers['customers_id']); if ($withorders || ($customers['num_orders'] == 0)) { echo TABLE_HEADING_ID . ' ' . $customers['customers_id'] . ' ' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . ' ' . $customers['customers_email_address'] . "<br />\n"; delete_customer($customers['customers_id']); } } echo '<br />' . SIU_CUSTOMER_DELETED_NULL . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } } elseif ($action == 'deleterange') { // confirm date range deletion $yy1 = (int)$_POST['yy1']; $mm1 = (int)$_POST['mm1']; if (strlen($mm1) < 2) $mm1 = '0' . $mm1; $dd1 = (int)$_POST['dd1']; if (strlen($dd1) < 2) $dd1 = '0' . $dd1; $yy2 = (int)$_POST['yy2']; $mm2 = (int)$_POST['mm2']; if (strlen($mm2) < 2) $mm2 = '0' . $mm2; $dd2 = (int)$_POST['dd2']; if (strlen($dd2) < 2) $dd2 = '0' . $dd2; $fromdate = $yy1 . '-' . $mm1 . '-' . $dd1; $todate = $yy2 . '-' . $mm2 . '-' . $dd2; $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); if ($withorders && (($yy1 == date('Y')) || ($yy2 == date('Y')))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } else { echo '<p class="main"><br />' . sprintf(SURE_TO_DELETE_RANGE, tep_date_short($fromdate), tep_date_short($todate)) . '<br />' . ENTRY_WITH_ORDERS . ($withorders ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br />' . ENTRY_NO_NEWSLETTER . ($nonews ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br /><br />' . tep_draw_form('deleterangeconfirm', 'inactive_user.php'. '?go=deleterangeyes') . tep_draw_hidden_field('with_orders', $_POST['with_orders']) . tep_draw_hidden_field('no_news_only', $_POST['no_news_only']) . tep_draw_hidden_field('fromdate', $fromdate) . tep_draw_hidden_field('todate', $todate) . tep_draw_button(IMAGE_DELETE, 'trash', null, 'secondary') . '</form> ' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . "<br /><br />\n"; if ($nonews) { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } echo SIU_AFFECTED_CUSTOMERS . "<br /><br /><p/>\n"; list_customers($siu_query_raw, $withorders); } } elseif ($action == 'deleterangeyes') { // date range deletion has been confirmed $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); $fromdate = tep_db_prepare_input($_POST['fromdate']); $todate = tep_db_prepare_input($_POST['todate']); if ($withorders && ((substr($fromdate, 0, 4) == date('Y')) || (substr($fromdate, 0, 4) == date('Y')))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } else { if ($nonews) { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } $siu_query = tep_db_query($siu_query_raw); echo '<p class="main">' . TEXT_DELETED_CUSTOMERS . "<br />\n"; while ($customers = tep_db_fetch_array($siu_query)) { $customers['num_orders'] = count_orders($customers['customers_id']); if ($withorders || ($customers['num_orders'] == 0)) { echo TABLE_HEADING_ID . ' ' . $customers['customers_id'] . ' ' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . ' ' . $customers['customers_email_address'] . "<br />\n"; delete_customer($customers['customers_id']); } } echo '<br />' . sprintf(SIU_CUSTOMER_DELETED_RANGE, tep_date_short($fromdate), tep_date_short($todate)) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } } else { // display main page echo '<div class="main"><p class="main">' .tep_draw_form('set_months', 'inactive_user.php'. '?go=setage'); $mpd = array(); for ($i=1; $i<61; $i++) { $mpd[] = array('id' => $i, 'text' => $i); } ?> <div class="row"> <div class="col-sm-7"> <div class="w3-padding mb-2"><div class="w3-large mb-1"><?php echo HEADING_TITLE; ?></div> <?php echo TEXT_INFO_MAXDATE . $maxdate_e; ?></div> </div> <div class="col-sm-5"><div class="w3-padding mb-2"> <?php echo sprintf(ENTRY_OLDER_THAN, tep_draw_pull_down_menu('age', $mpd, $_SESSION['minage'], 'onchange="this.form.submit()"')) . '</form>';?> </div></div> </div> <div class="clearfix"></div><hr class="hr-gr mt-2 mb-4"> <div class="row"> <div class="col-sm-6"> <?php echo '<header class="w3-red w3-padding"><b>'; echo TEXT_DELETE . '</b></header>'; echo '<div class="w3-border w3-padding mb-3">' . tep_draw_form('delrange', 'inactive_user.php'. '?go=deleterange'); echo '<div class="mt-3 mb-4">'; echo '<div class="w3-col s3 mb-3">' . FROMDATE . '</div>'; echo '<div class="w3-col s2 mb-3 pr-1">' . get_day_list('dd1') . '</div>'; echo '<div class="w3-col s4 mb-3 pr-1">' . get_monthname_list('mm1') . '</div>'; echo '<div class="w3-col s2 mb-3">' . get_year_list('yy1') . '</div>'; echo '</div>'; echo '<div class="mb-4">'; echo '<div class="w3-col s3 mb-3">' . TODATE . '</div>'; echo '<div class="w3-col s2 mb-3 pr-1">' . get_day_list('dd2') . '</div>'; echo '<div class="w3-col s4 mb-3 pr-1">' . get_monthname_list('mm2') . '</div>'; echo '<div class="w3-col s2 mb-3">' . get_year_list('yy2') . '</div>'; echo '</div><div class="clearfix"></div>'; echo '<hr class="hr-gr mt-2 mb-2"><div class="mt-3 mb-2">'; echo '<div class="mb-1">' . ENTRY_WITH_ORDERS . tep_draw_radio_field('with_orders', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('with_orders', 'no', true) . NEWSLETTER_NO . '</div>'; echo '<div class="mb-3">' . ENTRY_NO_NEWSLETTER . tep_draw_radio_field('no_news_only', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('no_news_only', 'no', true) . NEWSLETTER_NO . '</div>'; echo '</div>'; echo '<div class="mt-3 mb-1"><hr class="hr-gr mt-2 mb-3">'; echo tep_draw_w3_button(SIU_DELETE, 'far fa-trash-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red w3-border w3-border-black mb-3"'); echo '</div>'; echo '</form></div>'; ?> </div> <div class="col-sm-6"> <?php echo '<header class="w3-red w3-padding"><b>'; echo SIU_DELETE_NULL . '</b></header>'; echo '<div class="w3-border w3-padding mb-3">' . tep_draw_form('del_no_login', 'inactive_user.php'. '?go=deletenull'); echo '<div class="mt-4 mb-2">'; echo '<div class="w3-col s3 mb-3">' . FROMDATE . '</div>'; echo '<div class="w3-col s2 mb-3 pr-1">' . get_day_list('dd') . '</div>'; echo '<div class="w3-col s4 mb-3 pr-1">' . get_monthname_list('mm') . '</div>'; echo '<div class="w3-col s2 mb-3">' . get_year_list('yy') . '</div>'; echo '</div><div class="clearfix"></div>'; echo '<hr class="hr-gr mt-1 mb-2"><div class="mt-3 mb-2">'; echo '<div class="mb-1">' . ENTRY_WITH_ORDERS . tep_draw_radio_field('with_orders', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('with_orders', 'no', true) . NEWSLETTER_NO . '</div>'; echo '<div class="mb-3">' . ENTRY_NO_NEWSLETTER . tep_draw_radio_field('no_news_only', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('no_news_only', 'no', true) . NEWSLETTER_NO . '</div>'; echo '</div>'; echo '<div class="mt-3 mb-2"><hr class="hr-gr mt-3 mb-3">'; echo tep_draw_w3_button(SIU_DELETE, 'far fa-trash-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red w3-border w3-border-black mb-3"'); echo '</div>'; echo '</form></div>'; ?> </div> </div> <?php $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and (ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' or ci.customers_info_date_of_last_logon is null) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created"; $siu_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $siu_query_raw, $siu_query_numrows ); list_customers($siu_query_raw, true); ?> <div class="w3-padding"> </div><div class="clearfix"></div><hr class="hr-gr mb-3 mt-3"> <table border="0" width="99%" cellspacing="0" cellpadding="6"> <tr> <td class="smallText" valign="top"><?php echo $siu_split->display_count($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $page, TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td> <td class="smallText" align="right"><?php echo $siu_split->display_links($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $page, tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td> </tr> </table> </div> <?php } require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?>
  7. New file for inactive customer. Only compatible wit this version !! German language *************************************************** catalog/admin/inactive_user.php <?php require('includes/application_top.php'); // for Inactive User removal function get_year_list($name) { $years = array(); $years_query = tep_db_query("select distinct YEAR(customers_info_date_account_created) as y from " . TABLE_CUSTOMERS_INFO . " order by year(customers_info_date_account_created)"); while ($year = tep_db_fetch_array($years_query)) { $years[] = array('id' => $year['y'], 'text' => $year['y']); } return tep_draw_pull_down_menu($name, $years); } function get_monthname_list($name) { $months = array(); for ($i=1; $i<13; $i++) { $months[] = array('id' => $i, 'text' => date('F', mktime(0,0,0,$i,1,2011))); } return tep_draw_pull_down_menu($name, $months); } function get_day_list($name) { $days = array(); for ($i=1; $i<32; $i++) { $days[] = array('id' => $i, 'text' => $i); } return tep_draw_pull_down_menu($name, $days); } function delete_customer($customers_id) { tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'"); tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'"); } function count_orders($customers_id) { $query = tep_db_query("select count(*) as total from " . TABLE_ORDERS . " where customers_id = " . (int)$customers_id); $num = tep_db_fetch_array($query); return $num['total']; } function last_order($customers_id) { $query = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where customers_id = " . (int)$customers_id . ' order by date_purchased desc limit 1'); $d = tep_db_fetch_array($query); return tep_date_short($d['date_purchased']); } function list_customers($raw_query, $inc_with_orders = false) { global $_GET; $cid = isset($_GET['id']) ? $_GET['id'] : 0; $page = isset($_GET['page']) ? $_GET['page'] : 1; ?> <?php /*****************************/ ?> <?php $rows = 0; $siu_query = tep_db_query($raw_query); while ($customers = tep_db_fetch_array($siu_query)) { $rows++; $customers['num_orders'] = count_orders($customers['customers_id']); if ($inc_with_orders || ($customers['num_orders'] == 0)) { if ($customers['customers_newsletter'] == '1') { $customers['customers_newsletter'] = NEWSLETTER_YES; } else { $customers['customers_newsletter'] = '<span class="w3-text-red">' . NEWSLETTER_NO . '</span>' ; } if (strlen($rows) < 1) { $rows = '0' . $rows; } ?> <div class="col-sm-12 w3-padding w3-border w3-bottombar w3-border-theme mb-3 w3-hover-border-blue w3-hover-shadow"> <div class="col-sm-2 mb-2"><div class="w3-col s1 mt-2"><?php echo '<a href="' . tep_href_link('inactive_user.php', 'go=delete&id=' . $customers['customers_id'] . '&page=' . $page) .'"><i class="fa fa-trash-alt"></i></a>'; ?></div><div class="w3-col s10 mt-2"><?php echo $customers['customers_id'];?> <?php echo $customers['customers_firstname'] . ' ' . $customers['customers_lastname'];?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo TABLE_HEADING_CREATED . ': ' . tep_date_short($customers['customers_info_date_account_created']); ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo '<a href="mail.php?selected_box=tools&customer=' . $customers['customers_email_address'] . '">' . $customers['customers_email_address'] . '</a>' ; ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php echo TABLE_HEADING_NEWS . ': ' . $customers['customers_newsletter']; ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php if (!empty($customers['customers_info_date_of_last_logon'])){ echo TABLE_HEADING_LAST_LOGON . ': ' . tep_date_short($customers['customers_info_date_of_last_logon']);}else{echo TABLE_HEADING_LAST_LOGON . ': <span class="w3-text-red"><b>' . TABLE_HEADING_CUSTOMER_INACTIVE . '</b></span>';} ?></div></div> <div class="col-sm-2 mb-2"><div class="w3-col s12 mt-2"><?php if (!empty($customers['num_orders'])){ echo TABLE_HEADING_ORDERS . ': ' . $customers['num_orders'];}else{ echo TABLE_HEADING_ORDERS . ': ' . '<span class="w3-text-red"><b>' . TABLE_HEADING_ORDERS_EMPTY . '</b></span>';} ?> <?php if (!empty(last_order($customers['customers_id']))) echo TABLE_HEADING_LAST_ORDER . ': ' . last_order($customers['customers_id']); ?></div></div> <div class="clearfix"></div></div> <?php } //end if } // end while ?> <?php /*****************************/ ?> <?php } // end function list_customers $action = isset($_GET['go']) ? $_GET['go'] : ''; if (!isset($_SESSION['minage']) || !is_integer($_SESSION['minage'])) $_SESSION['minage'] = 12; if ($action == 'setage') { // change minimum age of information to work with if (is_numeric($_POST['age'])) $_SESSION['minage'] = (int)$_POST['age']; unset($_GET['go']); } if ($_SESSION['minage'] < 1) $_SESSION['minage'] = 12; $yearsold = intval($_SESSION['minage'] / 12); $monthsold = $_SESSION['minage'] % 12; $maxyear = date('Y') - $yearsold; $maxmonth = date('n') - $monthsold; if ($maxmonth < 1) { $maxyear--; $maxmonth = 12 + $maxmonth; } if (strlen($maxmonth) < 2) $maxmonth = '0' . $maxmonth; $maxday = date('d'); if ($maxday > 28) $maxday = 28; // all months have at least 28 days $maxdate = $maxyear . '-' . $maxmonth . '-' . $maxday; // customer records must come before this date $maxdate_e = $maxday . '.' . $maxmonth . '.' . $maxyear; require('includes/template_top.php'); ?> <div class="w3-padding"> <?php $cust_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$cid . "'"); $cust = tep_db_fetch_array($cust_query); if ($action == 'delete') { // confirm deletion of single customer echo '<p class="main"><br />' . sprintf(SURE_TO_DELETE, $cust[customers_firstname] . ' ' . $cust[customers_lastname]) . '<br /><br />' . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link('inactive_user.php', 'page=' . $page . '&go=deleteyes&id=' . $cid)) . '&nbsp;&nbsp;' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } elseif ($action == 'deleteyes') { // single customer deletion has been confirmed delete_customer($cid); echo '<p class="main"><br />' . sprintf(SIU_CUSTOMER_DELETED, $cust[customers_firstname] . ' ' . $cust[customers_lastname]) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } elseif ($action == 'deletenull') { // confirm deletion of no log in customers $yy = (int)$_POST['yy']; $mm = (int)$_POST['mm']; if (strlen($mm) < 2) $mm = '0' . $mm; $dd = (int)$_POST['dd']; if (strlen($dd) < 2) $dd = '0' . $dd; $beforedate = $yy . '-' . $mm . '-' . $dd; $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); if ($withorders && ($yy == date('Y'))) { echo '<p class="main"><br /><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } else { echo '<p class="main"><br />' . SURE_TO_DELETE_NULL . '<br />' . SIU_DELETE_NULL . tep_date_short($beforedate) . '<br />' . ENTRY_WITH_ORDERS . ($withorders ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br />' . ENTRY_NO_NEWSLETTER . ($nonews ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br /><br />' . tep_draw_form('deletenullconfirm', 'inactive_user.php'. '?go=deletenullyes') . tep_draw_hidden_field('with_orders', $_POST['with_orders']) . tep_draw_hidden_field('no_news_only', $_POST['no_news_only']) . tep_draw_hidden_field('beforedate', $beforedate) . tep_draw_button(IMAGE_DELETE, 'trash', null, 'secondary') . '</form>&nbsp;&nbsp;' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; echo SIU_AFFECTED_CUSTOMERS . "<br /><br /></p>\n"; if ($nonews) { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } list_customers($siu_query_raw, $withorders); } } elseif ($action == 'deletenullyes') { // deletion of no log in customers has been confirmed $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); $beforedate = tep_db_prepare_input($_POST['beforedate']); if ($withorders && (substr($beforedate, 0, 4) == date('Y'))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . '<br /><br /></p>'; } else { if ($nonews) { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_account_created < '" . tep_db_input($beforedate) . " 00:00:00' and (ci.customers_info_date_of_last_logon='0000-00-00 00:00:00' or ci.customers_info_date_of_last_logon is NULL) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } $siu_query = tep_db_query($siu_query_raw); echo '<p class="main"><strong>' . TEXT_DELETED_CUSTOMERS . "</strong><br />\n"; while ($customers = tep_db_fetch_array($siu_query)) { $customers['num_orders'] = count_orders($customers['customers_id']); if ($withorders || ($customers['num_orders'] == 0)) { echo TABLE_HEADING_ID . ' ' . $customers['customers_id'] . ' ' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . ' ' . $customers['customers_email_address'] . "<br />\n"; delete_customer($customers['customers_id']); } } echo '<br />' . SIU_CUSTOMER_DELETED_NULL . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } } elseif ($action == 'deleterange') { // confirm date range deletion $yy1 = (int)$_POST['yy1']; $mm1 = (int)$_POST['mm1']; if (strlen($mm1) < 2) $mm1 = '0' . $mm1; $dd1 = (int)$_POST['dd1']; if (strlen($dd1) < 2) $dd1 = '0' . $dd1; $yy2 = (int)$_POST['yy2']; $mm2 = (int)$_POST['mm2']; if (strlen($mm2) < 2) $mm2 = '0' . $mm2; $dd2 = (int)$_POST['dd2']; if (strlen($dd2) < 2) $dd2 = '0' . $dd2; $fromdate = $yy1 . '-' . $mm1 . '-' . $dd1; $todate = $yy2 . '-' . $mm2 . '-' . $dd2; $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); if ($withorders && (($yy1 == date('Y')) || ($yy2 == date('Y')))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } else { echo '<p class="main"><br />' . sprintf(SURE_TO_DELETE_RANGE, tep_date_short($fromdate), tep_date_short($todate)) . '<br />' . ENTRY_WITH_ORDERS . ($withorders ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br />' . ENTRY_NO_NEWSLETTER . ($nonews ? NEWSLETTER_YES : NEWSLETTER_NO) . '<br /><br />' . tep_draw_form('deleterangeconfirm', 'inactive_user.php'. '?go=deleterangeyes') . tep_draw_hidden_field('with_orders', $_POST['with_orders']) . tep_draw_hidden_field('no_news_only', $_POST['no_news_only']) . tep_draw_hidden_field('fromdate', $fromdate) . tep_draw_hidden_field('todate', $todate) . tep_draw_button(IMAGE_DELETE, 'trash', null, 'secondary') . '</form>&nbsp;&nbsp;' . tep_draw_button(IMAGE_CANCEL, 'cancel', tep_href_link('inactive_user.php', 'page=' . $page), 'primary') . "<br /><br />\n"; if ($nonews) { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } echo SIU_AFFECTED_CUSTOMERS . "<br /><br /><p/>\n"; list_customers($siu_query_raw, $withorders); } } elseif ($action == 'deleterangeyes') { // date range deletion has been confirmed $withorders = ($_POST['with_orders'] == 'yes'); $nonews = ($_POST['no_news_only'] == 'yes'); $fromdate = tep_db_prepare_input($_POST['fromdate']); $todate = tep_db_prepare_input($_POST['todate']); if ($withorders && ((substr($fromdate, 0, 4) == date('Y')) || (substr($fromdate, 0, 4) == date('Y')))) { echo '<p class="main"><strong>' . TEXT_ERROR . '</strong><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } else { if ($nonews) { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and c.customers_newsletter = 0 and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } else { $siu_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and ci.customers_info_date_of_last_logon>='" . tep_db_input($fromdate) . " 00:00:00' and ci.customers_info_date_of_last_logon<='" . tep_db_input($todate) . " 23:59:59' and ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by c.customers_id"; } $siu_query = tep_db_query($siu_query_raw); echo '<p class="main">' . TEXT_DELETED_CUSTOMERS . "<br />\n"; while ($customers = tep_db_fetch_array($siu_query)) { $customers['num_orders'] = count_orders($customers['customers_id']); if ($withorders || ($customers['num_orders'] == 0)) { echo TABLE_HEADING_ID . ' ' . $customers['customers_id'] . ' ' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . ' ' . $customers['customers_email_address'] . "<br />\n"; delete_customer($customers['customers_id']); } } echo '<br />' . sprintf(SIU_CUSTOMER_DELETED_RANGE, tep_date_short($fromdate), tep_date_short($todate)) . '<br /><br /><br />' . tep_draw_button(IMAGE_BACK, 'arrowrefresh-1-n', tep_href_link('inactive_user.php'), 'primary') . '<br /><br /></p>'; } } else { // display main page echo '<div class="main"><p class="main">' .tep_draw_form('set_months', 'inactive_user.php'. '?go=setage'); $mpd = array(); for ($i=1; $i<61; $i++) { $mpd[] = array('id' => $i, 'text' => $i); } ?> <div class="row"> <div class="col-sm-7"> <div class="w3-padding mb-2"><div class="w3-large mb-1"><?php echo HEADING_TITLE; ?></div> <?php echo TEXT_INFO_MAXDATE . $maxdate_e; ?></div> </div> <div class="col-sm-5"><div class="w3-padding mb-2"> <?php echo sprintf(ENTRY_OLDER_THAN, tep_draw_pull_down_menu('age', $mpd, $_SESSION['minage'], 'onchange="this.form.submit()"')) . '</form>';?> </div></div> </div> <div class="clearfix"></div><hr class="hr-gr mt-2 mb-4"> <div class="row"> <div class="col-sm-6"> <?php echo '<header class="w3-red w3-padding"><b>'; echo TEXT_DELETE . '</b></header>'; echo '<div class="w3-border w3-padding mb-3">' . tep_draw_form('delrange', 'inactive_user.php'. '?go=deleterange'); echo '<div class="mt-3 mb-2">' . FROMDATE . ' ' . get_day_list('dd1'); echo get_monthname_list('mm1'); echo get_year_list('yy1'); echo '</div>'; echo '<div class="mb-3">'; echo TODATE . ' ' . get_day_list('dd2'); echo get_monthname_list('mm2'); echo get_year_list('yy2'); echo '</div>'; echo '<div class="mt-3 mb-2">'; echo '<div class="mb-1">' . ENTRY_WITH_ORDERS . tep_draw_radio_field('with_orders', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('with_orders', 'no', true) . NEWSLETTER_NO . '</div>'; echo '<div class="mb-3">' . ENTRY_NO_NEWSLETTER . tep_draw_radio_field('no_news_only', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('no_news_only', 'no', true) . NEWSLETTER_NO . '</div>'; echo '</div>'; echo '<div class="mt-3 mb-1"><hr class="hr-gr mt-2 mb-2">'; echo tep_draw_w3_button(SIU_DELETE, 'far fa-trash-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red w3-border w3-border-black mb-3"'); echo '</div>'; echo '</form></div>'; ?> </div> <div class="col-sm-6"> <?php echo '<header class="w3-red w3-padding"><b>'; echo SIU_DELETE_NULL . '</b></header>'; echo '<div class="w3-border w3-padding mb-3">' . tep_draw_form('del_no_login', 'inactive_user.php'. '?go=deletenull'); echo '<div class="mt-3 mb-2">' . FROMDATE . ' ' . get_day_list('dd'); echo get_monthname_list('mm'); echo get_year_list('yy') . "<br />\n"; echo '</div>'; echo '<div class="mt-3 mb-2">'; echo '<div class="mb-1">' . ENTRY_WITH_ORDERS . tep_draw_radio_field('with_orders', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('with_orders', 'no', true) . NEWSLETTER_NO . '</div>'; echo '<div class="mb-3">' . ENTRY_NO_NEWSLETTER . tep_draw_radio_field('no_news_only', 'yes', false) . ' ' . NEWSLETTER_YES . ' ' . tep_draw_radio_field('no_news_only', 'no', true) . NEWSLETTER_NO . '</div>'; echo '</div>'; echo '<div class="mt-3 mb-1"><hr class="hr-gr mt-2 mb-2">'; echo tep_draw_w3_button(SIU_DELETE, 'far fa-trash-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red w3-border w3-border-black mb-3"'); echo '</div>'; echo '</form></div>'; ?> </div> </div> <?php $siu_query_raw = "select ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter from " . TABLE_CUSTOMERS_INFO . " ci join " . TABLE_CUSTOMERS . " c where c.customers_id = ci.customers_info_id and (ci.customers_info_date_of_last_logon < '" . tep_db_input($maxdate) . "' or ci.customers_info_date_of_last_logon is null) and ci.customers_info_date_account_created < '" . tep_db_input($maxdate) . "' order by ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created"; $siu_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $siu_query_raw, $siu_query_numrows ); list_customers($siu_query_raw, true); ?> <div class="w3-padding"> </div><div class="clearfix"></div><hr class="hr-gr mb-3 mt-3"> <table border="0" width="99%" cellspacing="0" cellpadding="6"> <tr> <td class="smallText" valign="top"><?php echo $siu_split->display_count($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $page, TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td> <td class="smallText" align="right"><?php echo $siu_split->display_links($siu_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $page, tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td> </tr> </table> </div> <?php } require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?> catalog/admin/includes/languages/german/inactive_user.php <?php define('TABLE_HEADING_DELETE', 'Löschen'); define('TABLE_HEADING_ID', 'ID'); define('TABLE_HEADING_CUSTOMERS', 'Nutzername'); define('TABLE_HEADING_EMAIL', 'Email'); define('TABLE_HEADING_NEWS', 'Newsletter'); define('TABLE_HEADING_LAST_LOGON', 'Letzte Anmeldung'); define('TABLE_HEADING_CUSTOMER_INACTIVE', 'Inaktiv'); define('TABLE_HEADING_CREATED', 'Kunde seit'); define('TABLE_HEADING_LAST_ORDER', 'Letzte'); define('TABLE_HEADING_ORDERS', 'Bestellungen'); define('TABLE_HEADING_ORDERS_EMPTY', 'Keine'); define('HEADING_TITLE', 'Inaktive Benutzer'); define('NEWSLETTER_YES', 'Ja'); define('NEWSLETTER_NO', 'Nein'); define('SIU_BACK', 'Zurück'); define('SIU_DELETE', 'Löschen!'); define('SIU_DELETE_NULL', 'Kunden löschen, für die kein Anmeldedatum erstellt wurde:'); define('SIU_CUSTOMER_DELETED', 'Kunde %s gelöscht!'); define('SIU_CUSTOMER_DELETED_RANGE', 'Kunde mit dem letzten Login-Datum zwischen %s und %s gelöscht!'); define('SIU_CUSTOMER_DELETED_NULL', 'Kunden mit dem letzten Anmeldedatums gelöscht!'); define('SURE_TO_DELETE', 'Sind Sie sicher, dass Sie den Benutzer löschen möchten %s?'); define('SURE_TO_DELETE_RANGE', 'Sind Sie sicher, dass Sie die Benutzer mit der letzten Anmeldung zwischen %s und %s löschen möchten ?'); define('SURE_TO_DELETE_NULL', 'Sind Sie sicher, dass Sie die Benutzer ohne letztes Login-Datum löschen möchten?'); define('FROMDATE', 'Ab Datum:'); define('TODATE', 'Bis Datum:'); define('SIU_AFFECTED_CUSTOMERS', 'Die folgenden Kunden werden gelöscht:'); define('TEXT_DELETE', 'Kunden mit Anmeldedaten löschen:'); define('ENTRY_WITH_ORDERS', 'Kunden einschließen, die Bestellungen aufgegeben haben '); define('ENTRY_NO_NEWSLETTER', 'Nur Kunden einschließen, die keine Newsletter abonniert haben '); define('TEXT_DELETED_CUSTOMERS', 'Die folgenden Kunden wurden gelöscht:'); define('TEXT_ERROR', 'Sie dürfen Kunden, die im laufenden Jahr Bestellungen aufgegeben haben, nicht löschen! Bitte ändern Sie das Jahr entweder in ein vorheriges Jahr oder nehmen Sie keine Kunden mit Bestellungen auf.'); define('ENTRY_OLDER_THAN', 'Bearbeiten Sie Kunden, deren Informationen älter als %s Monat(e) sind.'); define('TEXT_INFO_MAXDATE', 'Informationen werden für Kunden angezeigt, deren aktuellste Anmeldung / Erstellung vor '); ?>
  8. the magic word is "between" if (isset($_GET['start_date'])) { $start_date = $_GET['start_date']; } else { $start_date = date('Y-m-d'); } if (isset($_GET['end_date'])) { $end_date = $_GET['end_date']; } else { $end_date = date('Y-m-d'); } . SELECT o.customers_id, o.customers_name, o.customers_email_address, o.date_purchased FROM orders o where o.customers_id = '" . (int)$customers_id . "' and o.date_purchased between '" . $start_date . "' and '" . $end_date . " 23:59:59' ORDER BY o.date_purchased . <?php echo tep_draw_form('date_range', 'your_site.php', '', 'get'); ?><?php echo tep_hide_session_id(); ?> <div class="col-sm-6 mb-3"><?php echo '<a href="javascript:document.forms[\'date_range\'].submit();"></a>'; echo 'startdate' . ' ' . tep_draw_input_field('start_date', $start_date, 'class="w3-input w3-border" onchange=\'this.form.submit();\'');?></div> <div class="col-sm-6"><?php echo '<a href="javascript:document.forms[\'date_range\'].submit();"></a>'; echo 'enddate' . ' ' . tep_draw_input_field('end_date', $end_date, 'class="w3-input w3-border" onchange=\'this.form.submit();\'');?></div> try and adjust.
  9. find in catalog/admin/customers_email.php $email_query_raw = "select email_id, customers_id, name, email, phone, subject, enquiry, date, status, adminenquiry, senddate from contact_us order by email_id"; change to: $email_query_raw = "select email_id, customers_id, name, email, enquiry, date, status, adminenquiry, senddate from contact_us order by email_id";
  10. I wrote something useful for users of this version. Saving the emails from the file contact_us.php in the database and the possibility to answer them from the admin area. contact_us.php find: require('includes/application_top.php'); require('includes/languages/' . $language . '/contact_us.php'); add after: $account = array();$name = '';$email = '';$phone = ''; if (isset($_SESSION['customer_id'])) { $account_query = tep_db_query("select c.customers_id" . " FROM " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab " . " WHERE c.customers_id = '" . (int)$customer_id . "'" . " AND ab.address_book_id = c.customers_default_address_id"); $account = tep_db_fetch_array($account_query); $customer_id = $account['customers_id']; } find: tep_redirect(tep_href_link('contact_us.php', 'action=success')); add bevore: if (!empty($customer_id)){$cus_id = $customer_id;}else{$cus_id = '0';} tep_db_query("insert into contact_us ( customers_id, name, email, enquiry, date) VALUES ( '" . $cus_id . "', '" . tep_db_input($name) . "', '" . $email_address . "', '" . tep_db_input($enquiry) . "', Now())"); ******************** SQL - contact_us CREATE TABLE `contact_us` ( `email_id` int NOT NULL, `customers_id` text NOT NULL, `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_turkish_ci NOT NULL, `email` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL, `enquiry` longtext CHARACTER SET utf8mb3 COLLATE utf8_unicode_ci NOT NULL, `date` datetime DEFAULT NULL, `status` int NOT NULL, `adminenquiry` longtext NOT NULL, `senddate` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; ALTER TABLE `contact_us` ADD PRIMARY KEY (`email_id`); ALTER TABLE `contact_us` MODIFY `email_id` int NOT NULL AUTO_INCREMENT; COMMIT; add to: catalog/admin/includes/languages/german.php define('BOX_CUSTOMERS_EMAILS_HEADING', 'Kundenanfragen'); ############################ catalog/admin/includes/boxes/customers.php array( 'code' => 'customers_email.php', 'title' => BOX_CUSTOMERS_EMAILS_HEADING, 'link' => tep_href_link('customers_email.php') ), ############################ New files: catalog/admin/includes/languages/german/customers_email.php <?php define('CUSTOMERS_EMAIL_HEADING_TITLE', 'Kundenemails'); define('CUSTOMERS_EMAIL_CUSTOMER_NAME', 'Kundenname'); define('CUSTOMERS_EMAIL_CUSTOMER_GUEST', 'Gast'); define('CUSTOMERS_EMAIL_CUSTOMER_MAIL_ID', 'E-Mail ID'); define('CUSTOMERS_EMAIL_CUSTOMER_ID', 'Kundennummer'); define('CUSTOMERS_EMAIL_CUSTOMER_EMAIL', 'E-Mail'); define('CUSTOMERS_EMAIL_CUSTOMER_PHONE', 'Telefonnummer'); define('CUSTOMERS_EMAIL_CUSTOMER_SUBJECT', 'Betreff'); define('CUSTOMERS_EMAIL_CUSTOMER_ENQUIRY', 'Kundenanfrage'); define('CUSTOMERS_EMAIL_CUSTOMER_ADMIN_ENQUIRY', 'Gesendete Antwort'); define('CUSTOMERS_EMAIL_CUSTOMER_DATE', 'Anfragedatum'); define('CUSTOMERS_EMAIL_CUSTOMER_STATUS', 'Status'); define('CUSTOMERS_EMAIL_TEXT_DISPLAY_NUMBER_OF_STOCKLABEL', 'Kunden und Besucheremails'); define('CUSTOMERS_EMAIL_SEND_MAIL', 'Kundenanfrage beantworten'); define('CUSTOMERS_EMAIL_SEND_STATUS_EDIT', 'Antwort umwiderruflich senden'); define('CUSTOMERS_EMAIL_SEND_STATUS_SEND', 'Status aktualisieren'); define('CUSTOMERS_EMAIL_SEND_STATUS_SEND_OK', 'Gesendet an'); define('CUSTOMERS_EMAIL_STATUS_ON', 'Aktiv'); define('CUSTOMERS_EMAIL_STATUS_OFF', 'Gelesen'); define('CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER', 'E-Mail gesendet'); define('CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER_OVER', 'E-Mail wurde bereits gesendet'); define('CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER_CLOSE', 'Schliessen'); define('CUSTOMERS_EMAIL_STATUS_BUTTON_SHOW_EDIT', 'Details ansehen'); define('CUSTOMERS_EMAIL_STATUS_TEXT_DELETE_INTRO', 'Löschen'); define('CUSTOMERS_EMAIL_STATUS_TEXT_EDIT_INTRO', 'Bearbeiten'); define('CUSTOMERS_EMAIL_BUTTON_RETURN_TO_CUSTOMER', 'Auf E-Mail antworten'); define('CUSTOMERS_EMAIL_BUTTON_INDEX', 'Weiter zu Startseite'); define('CUSTOMERS_EMAIL_SENT_EMAIL_SUBJECT', 'Antwort auf Ihre Anfrage'); define('CUSTOMERS_EMAIL_SENT_EMAIL_TO_CUSTOMER_HEADING', 'Antwort auf Ihre Anfrage mit dem Betreff'); define('CUSTOMERS_EMAIL_TEXT_EMAIL_SEPARATOR', '<span class="small"><br>---------------------------<br></span>'); define('CUSTOMERS_EMAIL_TEXT_EMAIL_SIGNATURE_CR', '<br><span class="small"><a href="'. tep_href_link('../' . 'index.php') . '">' . STORE_NAME . '</a>' . '<br>' . STORE_ADDRESS . '<br>E-Mail: ' . STORE_OWNER_EMAIL_ADDRESS . '<br></span>'); ?> catalog/admin/customers_email.php <?php require('includes/application_top.php'); $action = (isset($_GET['action']) ? $_GET['action'] : ''); $status_array = array(array('id'=>'0', 'text'=>CUSTOMERS_EMAIL_STATUS_ON), array('id'=>'1', 'text'=>CUSTOMERS_EMAIL_STATUS_OFF), array('id'=>'2', 'text'=>CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER)); if (tep_not_null($action)) { switch ($action) { case 'insert': case 'save': if (isset($_GET['emID'])) $email_id = tep_db_prepare_input($_GET['emID']); $status = tep_db_prepare_input($_POST['status']); $adminenquiry = tep_db_prepare_input($_POST['adminenquiry']); $sql_data_array = array( 'status' => $status, 'adminenquiry' => $adminenquiry ); if ($action == 'insert') { $sql_data_array = array_merge($sql_data_array); tep_db_perform('contact_us', $sql_data_array); tep_db_query("update contact_us set status = '1' where email_id = '" . (int)$email_id . "'"); $email_id = tep_db_insert_id(); } elseif ($action == 'save') { $sql_data_array = $sql_data_array; tep_db_perform('contact_us', $sql_data_array, 'update', "email_id = '" . (int)$email_id . "'"); tep_db_query("update contact_us set status = '1' where email_id = '" . (int)$email_id . "'"); } if (USE_CACHE == 'true') { tep_reset_cache_block('email_labels'); } tep_redirect(tep_href_link('customers_email.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'emID=' . $email_id)); break; case 'sendmail': if (isset($_GET['emID'])) $email_id = tep_db_prepare_input($_GET['emID']); tep_db_query("update contact_us set senddate = now() where email_id = '" . (int)$email_id . "'"); tep_db_query("update contact_us set status = '2' where email_id = '" . (int)$email_id . "'"); if (USE_CACHE == 'true') { tep_reset_cache_block('email_labels'); } tep_redirect(tep_href_link('customers_email.php', (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'emID=' . $email_id)); break; case 'deleteconfirm': $email_id = tep_db_prepare_input($_GET['emID']); tep_db_query("delete from contact_us where email_id = '" . (int)$email_id . "'"); $auto_increment_query = tep_db_query("select email_id from contact_us where email_id"); if (tep_db_num_rows($auto_increment_query) < '1'){ tep_db_query("ALTER TABLE contact_us AUTO_INCREMENT =1"); } if (USE_CACHE == 'true') { tep_reset_cache_block('email_labels'); } tep_redirect(tep_href_link('customers_email.php', 'page=' . $_GET['page'])); break; } } require('includes/template_top.php'); ?> <div class="w3-padding"> <h1 class="pageHeading"><?php echo CUSTOMERS_EMAIL_HEADING_TITLE; ?></h1> <div class="d-flex flex-column flex-sm-row mb-3"> <div class="flex-grow-1"> <table class="w3-table w3-border w3-bordered w3-hoverable"> <thead class="w3-hover-none"> <tr class="w3-theme"> <th scope="col"><?php echo CUSTOMERS_EMAIL_CUSTOMER_NAME; ?></th> <th scope="col" class="w3-center"><?php echo CUSTOMERS_EMAIL_CUSTOMER_MAIL_ID; ?></th> <th scope="col" class="w3-center"><?php echo CUSTOMERS_EMAIL_CUSTOMER_ID; ?></th> <th scope="col" class="w3-center"><?php echo CUSTOMERS_EMAIL_CUSTOMER_EMAIL; ?></th> <th scope="col" class="w3-center"><?php echo CUSTOMERS_EMAIL_CUSTOMER_DATE; ?></th> <th scope="col" class="w3-center"><?php echo CUSTOMERS_EMAIL_CUSTOMER_STATUS; ?></th> <th scope="col" class="w3-center"><?php echo ''; ?>&nbsp;</th> </tr> </thead> <tbody> <?php $email_query_raw = "select email_id, customers_id, name, email, phone, subject, enquiry, date, status, adminenquiry, senddate from contact_us order by email_id"; $email_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $email_query_raw, $email_query_numrows); $email_query = tep_db_query($email_query_raw); while ($email = tep_db_fetch_array($email_query)) { $email_id = $email['email_id']; if ($email['customers_id'] > '0'){$cus_id = $email['customers_id'];}else{$cus_id = CUSTOMERS_EMAIL_CUSTOMER_GUEST;} if ((!isset($_GET['emID']) || (isset($_GET['emID']) && ($_GET['emID'] == $email['email_id']))) && !isset($emInfo) && (substr($action, 0, 3) != 'new')) { $emInfo = new objectInfo($email); } if (isset($emInfo) && is_object($emInfo) && ($email['email_id'] == $emInfo->email_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $email['email_id'] . '&action=edit') . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $email['email_id']) . '\'">' . "\n"; } ?> <td class="dataTableContent">&nbsp;<?php echo $email['name']; ?></td> <td class="dataTableContent w3-center">&nbsp;<?php echo $email['email_id']; ?></td> <td class="dataTableContent w3-center">&nbsp;<?php echo $cus_id; ?></td> <td class="dataTableContent w3-center"><?php echo $email['email']; ?></td> <td class="dataTableContent w3-center">&nbsp;<?php echo tep_date_short($email['date']);?></td> <td class="dataTableContent w3-center"><?php if ($email['status'] == '0'){ echo CUSTOMERS_EMAIL_STATUS_ON;} if ($email['status'] == '1'){ echo CUSTOMERS_EMAIL_STATUS_OFF;} if ($email['status'] == '2'){ echo CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER;}?></td> <td class="dataTableContent w3-right-align"><?php if (isset($emInfo) && is_object($emInfo) && ($email['email_id'] == $emInfo->email_id)) { echo '<span class="fas fa-angle-right" style="font-size:20px;"></span>'; } else { echo '<a href="' . tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id) . '"><span title="' . IMAGE_ICON_INFO . '" class="fas fa-info-circle" style="font-size:20px;"></span></a>'; } ?>&nbsp;</td> </tr> <?php } ?> </tbody> </table> <div class="d-flex flex-column flex-sm-row justify-content-sm-between mb-3"> <div class="w3-small"><?php echo $email_split->display_count($email_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], CUSTOMERS_EMAIL_TEXT_DISPLAY_NUMBER_OF_STOCKLABEL); ?></div> <div class="w3-small"><?php echo $email_split->display_links($email_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></div> </div> <div class="d-flex flex-column flex-sm-row justify-content-sm-end mb-3"> </div> </div> <?php $heading = ''; $contents = ''; switch ($action) { case 'edit': $heading = $emInfo->name . '&nbsp;' . $emInfo->email; $contents = tep_draw_form('email_labels', 'customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=save', 'post', 'enctype="multipart/form-data"'); if ($emInfo->status == '2'){ $contents .= '<tr><td><div class="w3-border w3-border-red w3-black w3-padding mb-3">' . CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER_OVER . '</div>'; }else{ if ($emInfo->status == '0'){ $contents .= '<tr><td><div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_STATUS . '<br />' . tep_draw_pull_down_menu('status', $status_array, $emInfo->status, 'class="w3-select w3-border w3-teal"') . '</div>'; }else{ $contents .= '<tr><td><div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_STATUS . '<br />' . tep_draw_pull_down_menu('status', $status_array, $emInfo->status, 'class="w3-select w3-border w3-red"') . '</div>'; } } $contents .= '<div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_ENQUIRY . '<br /><div class="w3-border w3-sand w3-padding mb-2">' . CUSTOMERS_EMAIL_CUSTOMER_SUBJECT . ': ' . $emInfo->subject . '<hr class="hr-gr mt-2 mb-2">' . $emInfo->enquiry . '</div></div>'; if ($emInfo->status == '2'){ $contents .= '<div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_ADMIN_ENQUIRY . '<br /><div class="w3-border w3-sand w3-padding mb-2">' . $emInfo->adminenquiry . '</div></div>'; }else{ $contents .= '<div class="mb-3">' . CUSTOMERS_EMAIL_SEND_MAIL . '<br>' . tep_draw_textarea_field('adminenquiry', 'soft', '60', '5', $emInfo->adminenquiry, 'class="w3-input w3-border"') . '</div></div>'; } if ($emInfo->status == '2'){ $contents .= '<hr class="hr-gr mt-2 mb-2"><div class="mb-3">' . tep_draw_w3_button(CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER_CLOSE, 'fa fa-lock', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id), null, null, 'class="w3-button w3-large w3-block w3-black"') . '</div>'; }else{ if ($emInfo->status == '0'){ $contents .= '<hr class="hr-gr mt-2 mb-2"><div class="mb-3 mt-3">' . tep_draw_w3_button(IMAGE_SAVE, 'fa fa-save', null, 'primary', null, 'class="w3-button w3-large w3-block w3-teal"') . '</div>'; }else{ $contents .= '<hr class="hr-gr mt-2 mb-2"><div class="mb-3 mt-3">' . tep_draw_w3_button(IMAGE_SAVE, 'fa fa-save', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red"') . '</div>'; } $contents .= '<hr class="hr-gr mt-2 mb-2"><div class="mb-3">' . tep_draw_w3_button(IMAGE_CANCEL, 'fa fa-times', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id), null, null, 'class="w3-button w3-large w3-block w3-theme-light"') . '</div>'; } $contents .= '</td></tr>'; $contents .= '</form>'; break; case 'send': $heading = CUSTOMERS_EMAIL_SEND_STATUS_SEND_OK . '&nbsp;' . $emInfo->email; $contents = '<tr><td>' . tep_draw_form('email_labels', 'customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=sendmail', 'post', 'enctype="multipart/form-data"'); $contents .= '<div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_ENQUIRY . '<br /><div class="w3-border w3-sand w3-padding mb-2">' . CUSTOMERS_EMAIL_CUSTOMER_SUBJECT . ': ' . $emInfo->subject . '<hr class="hr-gr mt-2 mb-2">' . $emInfo->enquiry . '</div></div>'; $contents .= '<div class="mb-3">' . CUSTOMERS_EMAIL_CUSTOMER_ADMIN_ENQUIRY . '<br /><div class="w3-border w3-sand w3-padding mb-2">' . $emInfo->adminenquiry . '</div></div>'; if (!empty($emInfo->adminenquiry)){ tep_mail($emInfo->name, $emInfo->email, CUSTOMERS_EMAIL_SENT_EMAIL_SUBJECT, CUSTOMERS_EMAIL_SENT_EMAIL_TO_CUSTOMER_HEADING . ': ' . $emInfo->subject . CUSTOMERS_EMAIL_TEXT_EMAIL_SEPARATOR . $emInfo->adminenquiry . '<br>' . CUSTOMERS_EMAIL_TEXT_EMAIL_SEPARATOR . CUSTOMERS_EMAIL_CUSTOMER_ENQUIRY . ':<br>' . CUSTOMERS_EMAIL_CUSTOMER_SUBJECT . ': ' . $emInfo->subject . '<br>' . $emInfo->enquiry . CUSTOMERS_EMAIL_TEXT_EMAIL_SEPARATOR . CUSTOMERS_EMAIL_TEXT_EMAIL_SIGNATURE_CR, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } $contents .= '<div class="mb-3">' . tep_draw_w3_button(CUSTOMERS_EMAIL_SEND_STATUS_SEND, 'fa fa-sync-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-teal"') . '</div>'; $contents .= '</td></tr>'; $contents .= '</form>'; break; case 'delete': $heading .= CUSTOMERS_EMAIL_CUSTOMER_NAME . '&nbsp;' . $emInfo->name . '&nbsp;' . CUSTOMERS_EMAIL_STATUS_TEXT_DELETE_INTRO; $contents = tep_draw_form('email_labels', 'customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=deleteconfirm'); $contents .= '<tr><td>' . CUSTOMERS_EMAIL_STATUS_TEXT_DELETE_INTRO; $contents .= '<div class="w3-border w3-border-teal w3-pale-green w3-padding-small mb-3"><strong>' . $emInfo->name . '</strong></div>'; $contents .= '<div class="mb-3">' . tep_draw_w3_button(IMAGE_DELETE, 'fa fa-trash-alt', null, 'primary', null, 'class="w3-button w3-large w3-block w3-red"') . '</div>'; $contents .= '<div class="mb-3">' . tep_draw_w3_button(IMAGE_CANCEL, 'fa fa-times', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $_GET['emID']), null, null, 'class="w3-button w3-large w3-block w3-theme-light"') . '</div>'; $contents .= '</td></tr>'; $contents .= '</form>'; break; default: if (isset($emInfo) && is_object($emInfo)) { $heading = $emInfo->name; if ($emInfo->status == '2'){ $contents .= '<tr><td>' . tep_draw_w3_button(CUSTOMERS_EMAIL_STATUS_BUTTON_SHOW_EDIT, 'fa fa-envelope-square', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=edit'), null, null, 'class="w3-button w3-large w3-block w3-black mb-3"'); }else{ $contents .= '<tr><td>' . tep_draw_w3_button(IMAGE_EDIT, 'fa fa-cog', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=edit'), null, null, 'class="w3-button w3-large w3-block w3-teal mb-3"'); } if ((!empty($emInfo->adminenquiry) && ($emInfo->status != '2'))){ $contents .= '<tr><td>' . tep_draw_w3_button(CUSTOMERS_EMAIL_SEND_STATUS_EDIT, 'fab fa-telegram-plane', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=send'), null, null, 'class="w3-button w3-large w3-block w3-black mb-3"'); } $contents .= tep_draw_w3_button(IMAGE_DELETE, 'fa fa-trash-alt', tep_href_link('customers_email.php', 'page=' . $_GET['page'] . '&emID=' . $emInfo->email_id . '&action=delete'), null, null, 'class="w3-button w3-large w3-block w3-red mb-3"'); if ($emInfo->status == '0'){ $statusname = '<div class="w3-leftbar w3-border-top w3-border-green"><div class="w3-padding-small">' . CUSTOMERS_EMAIL_CUSTOMER_STATUS . ' ' . CUSTOMERS_EMAIL_STATUS_ON . '</div></div>'; }if ($emInfo->status == '1'){ $statusname = '<div class="w3-leftbar w3-border-top w3-border-red"><div class="w3-padding-small">' . CUSTOMERS_EMAIL_CUSTOMER_STATUS . ' ' . CUSTOMERS_EMAIL_STATUS_OFF . '</div></div>'; }if ($emInfo->status == '2'){ $statusname = '<div class="w3-leftbar w3-border-top w3-border-black"><div class="w3-padding-small">' . CUSTOMERS_EMAIL_CUSTOMER_STATUS . ' ' . CUSTOMERS_EMAIL_STATUS_SEND_TO_CUSTOMER . '</div></div>'; } $contents .= '<div class="clearfix"></div>' . $statusname; $contents .= '</td></tr>'; } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo '<div class="w3-quarter ms-sm-2">' . "\n" . ' <table class="w3-table w3-border w3-border-black w3-light-gray">' . ' <thead>' . ' <tr class="w3-theme">' . ' <th scope="col">'. $heading . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>' . $contents . '</tbody>' . ' </table>' . '</div>' . "\n"; } ?> </div> </div> <?php require('includes/template_bottom.php'); require('includes/application_bottom.php'); ?> FINISH I hope it will be useful to you. Sorry is only in german.
  11. thank you all. the STOCK_ALLOW_CHECKOUT != 'true' was set incorrectly.
  12. // BOF stl stock check ******* function tep_get_products_stl_stock($products_id) { $products_id = tep_get_prid($products_id); $slabel_product_query = tep_db_query("select sl.stocklabel_stock from " . TABLE_PRODUCTS . " p, " . TABLE_STOCKLABEL . " sl where p.products_stl_id = sl.stocklabel_id"); $slabel_product = tep_db_fetch_array($slabel_product_query); $stl_stock = $slabel_product['stocklabel_stock']; return $stl_stock; } function tep_count_products_stl_stock_per_stl_id($products_id) { global $customer_id; $products_id = tep_get_prid($products_id); $stock_query = tep_db_query("select products_stl_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $stock_values = tep_db_fetch_array($stock_query); $products_query = tep_db_query("select * from " . TABLE_CUSTOMERS_BASKET . " cb, " . TABLE_PRODUCTS . " p, " . TABLE_STOCKLABEL . " sl where cb.products_id = p.products_id and p.products_stl_id = '" . (int)$stock_values['products_stl_id'] . "' and p.products_stl_id = sl.stocklabel_id and cb.customers_id = '" . (int)$customer_id . "' and sl.stocklabel_status = '1'"); while($products = tep_db_fetch_array($products_query)) { $qty += $products['customers_basket_quantity']; } return $qty; } function tep_check_stl_stock($products_id) { $stock_stl_left = tep_get_products_stl_stock($products_id) - tep_count_products_stl_stock_per_stl_id($products_id); $out_of_stl_stock = ''; if ($stock_stl_left < 0) { $out_of_stl_stock = '<span class="text-danger"><b>' . STOCK_MARK_PRODUCT_OUT_OF_STL_STOCK . '&nbsp;' . OUT_OF_STL_STOCK_INFO_CHECKOUT . '</b></span>'; } return $out_of_stl_stock; } // EOF stl stock check ******* //################################################################# at checkout_payment.php this code just doesn't lead me back to the shopping cart. does anyone have an idea here? // BOF stl stock check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $pID = current(explode("{", $products[$i]['id'])); $stl_stlstatus = current(explode("{", $products[$i]['stl_stlstatus'])); if ($stl_stlstatus == 1){ if (tep_count_products_stl_stock_per_stl_id($pID, $cart->get_products()) > tep_get_products_stl_stock($pID, $cart->get_products())){ tep_redirect(tep_href_link('shopping_cart.php')); } } } } // EOF stl stock check
  13. ok, this is how it work. // BOF stl stock check ******* function tep_get_products_stl_stock($products_id) { $products_id = tep_get_prid($products_id); $slabel_product_query = tep_db_query("select sl.stocklabel_stock from " . TABLE_PRODUCTS . " p, " . TABLE_STOCKLABEL . " sl where p.products_stl_id = sl.stocklabel_id"); $slabel_product = tep_db_fetch_array($slabel_product_query); $stl_stock = $slabel_product['stocklabel_stock']; return $stl_stock; }
  14. Hi guys, maybe someone could take a look at this? I do not get a value for this function. with php 7 it works but with php 8 nothing comes up. Is there something I still have to pay attention to? Thank you in advance for your help. function tep_get_products_stl_stock($products_id) { $products_id = tep_get_prid($products_id); $stock_query = tep_db_query("select products_stl_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $stock_values = tep_db_fetch_array($stock_query); $pstlid = $stock_values['products_stl_id']; $slabel_product_query = tep_db_query("select stocklabel_stock from " . TABLE_PRODUCTS . " p, " . TABLE_STOCKLABEL . " sl where p.products_stl_id = '" . (int)$pstlid . "' and p.products_stl_id = sl.stocklabel_id"); $slabel_product = tep_db_fetch_array($slabel_product_query); $stl_stock = $slabel_product['stocklabel_stock']; return $stl_stock; }
×