Also upgraded
Zen Cart 1.3.0.2
Database Patch Level: 1.3.0.2
Still only emails when i make an acount pending - NOT when I approve an account.
Any suggestions?
Also upgraded
Zen Cart 1.3.0.2
Database Patch Level: 1.3.0.2
Still only emails when i make an acount pending - NOT when I approve an account.
Any suggestions?
sounds like you've implemented it incorrectly
post the first 75 lines of your /admin/customers.php file
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Code:require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $action = (isset($_GET['action']) ? $_GET['action'] : ''); $error = false; $processed = false; if (zen_not_null($action)) { switch ($action) { case 'status': $customers_id = zen_db_prepare_input($_GET['cID']); if ($_GET['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) { $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization=0 where customers_id='" . (int)$customers_id . "'"; } else { $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); if ($custinfo->RecordCount() > 0) { $message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE; $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ; zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], EMAIL_CUSTOMER_STATUS_CHANGE_SUBJECT , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'default'); } $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . $customers_id . "'"; } $db->Execute($sql); $action = ''; zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL')); break; case 'update': $customers_id = zen_db_prepare_input($_GET['cID']); $customers_firstname = zen_db_prepare_input($_POST['customers_firstname']); $customers_lastname = zen_db_prepare_input($_POST['customers_lastname']); $customers_email_address = zen_db_prepare_input($_POST['customers_email_address']); $customers_telephone = zen_db_prepare_input($_POST['customers_telephone']); $customers_fax = zen_db_prepare_input($_POST['customers_fax']); $customers_newsletter = zen_db_prepare_input($_POST['customers_newsletter']); $customers_group_pricing = zen_db_prepare_input($_POST['customers_group_pricing']); $customers_email_format = zen_db_prepare_input($_POST['customers_email_format']); $customers_gender = zen_db_prepare_input($_POST['customers_gender']); $customers_dob = (empty($_POST['customers_dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['customers_dob'])); $customers_whole = zen_db_prepare_input($_POST['customers_whole']); $customers_authorization = zen_db_prepare_input($_POST['customers_authorization']); $customers_referral= zen_db_prepare_input($_POST['customers_referral']); if (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $customers_authorization == 1) { $customers_authorization = 2; $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION2, 'caution'); } if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 and $customers_authorization == 2) { $customers_authorization = 1; $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION1, 'caution'); }
hmmm ... that same code works perfectly for me... granted, my testing was with approvals set to "not required".
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Originally Posted by DrByte
Thas is weird - well maybe this is a bug in the code. There is NO point in sending an approval email for someone who is already automatically approved.
Seems just like a silly thing where it is working but only if making somebody who is already approved to pending status. Maybe just a sloppy if statement. who knows?
aha ... the problem was in the testing ... yes, the IF is backwards and incomplete.
here's the fix:
PHP Code:case 'status':
if ($_GET['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) {
$sql = "update " . TABLE_CUSTOMERS . " set customers_authorization=0 where customers_id='" . (int)$customers_id . "'";
$custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname
from " . TABLE_CUSTOMERS . "
where customers_id = '" . (int)$customers_id . "'");
if ((int)CUSTOMERS_APPROVAL_AUTHORIZATION > 0 && (int)$_GET['current'] > 0 && $custinfo->RecordCount() > 0) {
$message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE;
$html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ;
zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], EMAIL_CUSTOMER_STATUS_CHANGE_SUBJECT , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'default');
}
} else {
$sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . $customers_id . "'";
}
$db->Execute($sql);
$action = '';
zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL'));
break;
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I just replaced my code witht his and now when i shange the status of a customer it just takes me to the last page of my customers - it doesnt update theor status or send an email.
Originally Posted by DrByte
argh -- still need to set the $customers_id:
Code:case 'status': $customers_id = zen_db_prepare_input($_GET['cID']); .......
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.