Results 1 to 10 of 263

Threaded View

  1. #23
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Add Customers from admin addon

    I just looked at this module for someone who was experiencing problems with it not sending emails for bulk uploads. What I found was that if you have a 1 or zero in the csv file for send_welcome (as per the formatting guide), then there was no way any email could be sent. The module version being referred to here is 1.05

    The statement at line 70 of add_customers_backend.php:
    PHP Code:
    'send_welcome'=>(in_array(strtolower(get_row_id('send_welcome'$line)), array(false,'','n','no')) ? 0:1
    is going to insert a value of 1 for $send_welcome even if you have a 0 in that field, because it's not even checking for a 0. So even if you had all lines set to 0 for send_welcome, you'd expect that every line would get an email sent as a result of that error. However, at line 415, the only condition under which the email will be sent is:
    PHP Code:
        if($send_welcome == 'send'
    To correct this problem, line 70 of add_customers_backend.php should be changed to:
    PHP Code:
    'send_welcome'=>(in_array(strtolower(get_row_id('send_welcome'$line)), array(false,'','n','no','0')) ? 0:'send'
    but wait - there's more...

    at line 376, in the function insert_customer(), there is this code:
    PHP Code:
        if (ACCOUNT_GENDER == 'true') {
            if (!
    in_array(array('m','f'), substr(strtolower($entry_gender), 01))) {
                
    $errors[] = 'Gender not recognised. Expected "m" or "f", got: ' $entry_gender;
            }
            
    $sql_data_array['entry_gender'] = $entry_gender;
        } 
    Now, some people have been reporting in this thread that they are seeing php warnings from line 377 - this is why: there is no variable $entry_gender set. The variable that should be being checked is actually $customers_gender.
    This check has no place here in this function anyway - it should be part of the function validate_customer() - and what's the point of using
    PHP Code:
    substr(strtolower($customers_gender), 01
    (using the correct variable) when $customers_gender has already been set to a single lowercase character string at lines 50 and 51?

    One final point:
    I also found during troubleshooting this module that if there was only a single error in the csv file, and you have it set to process only if no errors, you get bounced right back to the start with no error message and no customers processed. In the file add_customers.php at line 66 is this condition for displaying errors:
    PHP Code:
    if (count($errors) > 1) { 
    That's fine if you have more than one error, but if you have only one, then it won't get displayed. That line needs to be:
    PHP Code:
    if (count($errors) > 0) { 
    A zip file with corrections for the above errors is attached to this post.
    Last edited by bunyip; 6 May 2009 at 08:48 AM.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

 

 

Similar Threads

  1. how do i install the add customers through admin addon
    By Matt Smith in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 12 Oct 2009, 11:46 AM
  2. Add customers from Admin addon error
    By 21zerogo in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 30 Jul 2009, 02:12 AM
  3. How do I set default country when using Add Customers via Admin addon?
    By Andy_GS in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 21 Apr 2009, 09:40 AM
  4. Adding customers from admin side, without an addon?
    By dcb37ga in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 27 Dec 2008, 05:22 AM
  5. Add customer from Admin addon
    By wireyourworld in forum Managing Customers and Orders
    Replies: 3
    Last Post: 4 Apr 2008, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg