Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Customer Authorization Status Question??

Customer Authorization Status Question??

Locked

Started by dcfxking on 13 Aug 2006, 8:06 PM · Views: 7,871

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
13 Aug 2006, 8:06 PM
#1
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #1 by dcfxking

I have 2 Questions regarding the customer authorization / approval status options.

I am using the setting of 1 for both options (Must login to browse and must be authorized to browse)

  1. Once the custromer requests an account they receive a welcome email saying their account is being reviewed - i get the same email and go in and manually approve them. My questions is - **is there any possible way to have an email automatically sent to them when their account is approved? **Now i have to manually go into my email and send them a note informing them their account is approved and they can now login.

  2. I have been playing around with the different approval statuses that can be used. I thought it may be useful to utilize the "Pending approval - may browse with prices but may not buy" option. I like this because there are some people I want to be able to let into the sie to see what we have but not be able to buy (This is like a demo mode) Then if they want to be able to buy form us they have to fax us an agreement. Whenever i set a customers status to this option - it doesnt even let them login at all. I have made test accounts and for some reason if you set an account to this status when they try to login the page just loads and loads and does not let them in at all.

13 Aug 2006, 8:15 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

  1. If you approve them by clicking on the red dot to make it green from the main customers list page, then an email is sent.

.
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.

13 Aug 2006, 8:29 PM
#3
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #3 by dcfxking

DrByte:

  1. If you approve them by clicking on the red dot to make it green from the main customers list page, then an email is sent.

I just tried this and it did not send me any email. Is there a setting that controls this? That would be exactly the logical thing to happen and exactly what i am looking for.

Thanks for any help.

13 Aug 2006, 8:31 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

What version of Zen Cart are you using?

.
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.

13 Aug 2006, 8:44 PM
#5
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #5 by dcfxking

DrByte:

What version of Zen Cart are you using?

Zen Cart 1.3.0
Database Patch Level: 1.3.0

13 Aug 2006, 8:50 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

Notwithstanding the fact that a number of bugs have been fixed in v1.3.0.1 and v1.3.0.2 and you should upgrade, it seems that that I may have spoken too soon ... the email feature described appears to have been put in the 1.3.0.3 release which isn't out yet.

.
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.

13 Aug 2006, 8:52 PM
#7
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #7 by dcfxking

My Configuration - Sessions settings are as follows:

Session dir - /home/wireless/public_html/secure/cache
cookie domain - true
force cookie - false
check ssl false
check user agent - false
check ip - false
prevent spider sessions - true
recreate session - true
ip to host conversion - false

13 Aug 2006, 8:54 PM
#8
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #8 by dcfxking

DrByte:

Notwithstanding the fact that a number of bugs have been fixed in v1.3.0.1 and v1.3.0.2 and you should upgrade, it seems that that I may have spoken too soon ... the email feature described appears to have been put in the 1.3.0.3 release which isn't out yet.

I guess that explains it! So this feature def doesnt work yet?

13 Aug 2006, 10:50 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #9 by drbyte

dcfxking:

So this feature def doesnt work yet?
You could hack it in by yourself if you like. It'll be a bit different in the core when it's released, but you could try it this way:

/admin/customers.php
around line 35 you have:```php
case 'status':
if ($_GET['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) {
$sql = "update " . TABLE_CUSTOMERS . " set customers_authorization=0 where customers_id='" . $_GET['cID'] . "'";
} else {
$sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . $_GET['cID'] . "'";
}
$db->Execute($sql);
$action = '';
zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $_GET['cID'] . '&page=' . $_GET['page'], 'NONSSL'));
break;



change it to:```php
      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;

in /admin/includes/languages/english/customers.php
add these to the bottom of the file, before the closing ?>

define('EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE', 'Your customer status has been updated. Thank you for shopping with us. We look forward to your business.');
define('EMAIL_CUSTOMER_STATUS_CHANGE_SUBJECT', 'Customer Status Updated');

.
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.

13 Aug 2006, 11:19 PM
#10
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #10 by dcfxking

I made the changes but it seems to only be emailing the customer when I go from Green to Red (Approved to Pending)..I need it to email a status update only when they are approved (Red to Green)

Let me know if you think I did something wrong.

Thank you so much for your help - this will help automate my process so much!

14 Aug 2006, 2:16 PM
#11
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #11 by dcfxking

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?

15 Aug 2006, 11:15 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #12 by drbyte

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.

15 Aug 2006, 6:35 PM
#13
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #13 by dcfxking

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');
        }
18 Aug 2006, 9:30 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #14 by drbyte

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.

18 Aug 2006, 2:21 PM
#15
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #15 by dcfxking

DrByte:

hmmm ... that same code works perfectly for me... granted, my testing was with approvals set to "not required".

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?

18 Aug 2006, 2:53 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #16 by drbyte

aha ... the problem was in the testing ... yes, the IF is backwards and incomplete.

here's the fix:

      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.

18 Aug 2006, 3:39 PM
#17
dcfxking avatar

dcfxking

New Zenner

Join Date:
Jun 2006
Location:
Boston, MA
Posts:
80
Plugin Contributions:
0

Post #17 by dcfxking

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.

DrByte:

aha ... the problem was in the testing ... yes, the IF is backwards and incomplete.

here's the fix:

  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;
18 Aug 2006, 9:02 PM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #18 by drbyte

argh -- still need to set the $customers_id:

      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.