Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    help question Company Name Check Filter?

    I would like to filter out or block customers from entering "None" or "n/a" for the company name field when they create an account or new address.

    Is there a topic on this anywhere with some examples of code to accomplish this? I could not find anything discussions on this and know figured others have had or having the same issue and just dealing with it.

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Company Name Check Filter?

    I suppose you could write something, but how are you going to determine what isn't allowed? If someone doesn't want to give you their company name (which you can make required) and are prevented from using n/a or none, I'm thinking they'll just enter boolaboola or noyb or ...

  3. #3
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: Company Name Check Filter?

    I do not require them to enter a company and wished they just left it blank, however 90% of the people if they do not have a company leave it blank as they are supposed to the other 10% enter either enter "none" or "N/A" why I do not know, so blocking those two words or giving them some type of error saying please leave it blank when those words are detected would ((SHOULD)) resolve the issue.

  4. #4
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Company Name Check Filter?

    Why don't you just remove the company field in admin?

  5. #5
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Company Name Check Filter?

    .. or easily adapt the PO Box Ban mod.

  6. #6
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: Company Name Check Filter?

    I need the company because I ship to companies and the shipping modules looks at the company field to determine which rates to display.

    The PO Box Ban will not work because like I said I ship to PO Box address as long as they USE the Postal service.

  7. #7
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Company Name Check Filter?

    Like I said, adapt it. Look at the code and change it to filter the company field instead of the street address.

  8. #8
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: Company Name Check Filter?

    easier said then done...I do not write code very well

  9. #9
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Company Name Check Filter?

    That's okay. Try this (untested) code:

    Find the following file:
    includes/modules/create_account.php

    Copy the file into your override system, so you have this:
    includes/modules/your_template/create_account.php

    In your override file, find this block of code (around line 113):
    PHP Code:
    if (ACCOUNT_COMPANY == 'true') {
        if ((int)
    ENTRY_COMPANY_MIN_LENGTH && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
          
    $error true;
          
    $messageStack->add('create_account'ENTRY_COMPANY_ERROR);
        }
      } 
    Directly underneath it, add this:

    PHP Code:
    // BEGIN Company Filter 1/1
    if (preg_match('/\bnone\b/i'$company)) {
        
    $error true;
        
    $messageStack->add('create_account'COMPANY_FILTER_ERROR);
        } else if (
    preg_match('/\bn\/a\b/i'$company)) {
        
    $error true;
        
    $messageStack->add('create_account'COMPANY_FILTER_ERROR);
        }
    // END Company Filter 1/1 
    Then in includes/languages/english/extra_definitions/
    Create a file called company_filter_defines.php

    In that file, add this:

    PHP Code:
    <?php
    define
    ('COMPANY_FILTER_ERROR''Please leave the company field blank if you are not a company.');
    ?>

  10. #10
    Join Date
    May 2008
    Posts
    442
    Plugin Contributions
    1

    Default Re: Company Name Check Filter?

    Works perfect, thank you VERY much!

    This is not a big deal but while I was testing it, it basically resets the form if the error occurs.

    In the java script file:
    /includes/modules/pages/create_account/jscript_form_check.php

    If an additional check is added there then it will simply create a popup with the error allowing the person to fix it and leave the form intact.

    Below is an example line that checks the company length, if not to much trouble can you modify this?

    Code:
    <?php if (ACCOUNT_COMPANY == 'true' && (int)ENTRY_COMPANY_MIN_LENGTH != 0) echo '  check_input("company", ' . ENTRY_COMPANY_MIN_LENGTH . ', "' . ENTRY_COMPANY_ERROR . '");' . "\n"; ?>

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Company Name after Customer Name Support
    By dw08gm in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 24 Aug 2015, 07:08 AM
  2. v151 Company Name after Customer Name (instead of before)
    By dw08gm in forum General Questions
    Replies: 3
    Last Post: 8 Oct 2014, 11:42 AM
  3. Company name before name??
    By bottyz in forum Managing Customers and Orders
    Replies: 7
    Last Post: 5 Jul 2010, 11:18 PM
  4. Paypal RETURN TO shows my real name instead of company name
    By tuanle55 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Jul 2008, 03:47 AM
  5. Company name vs Customer name at registration
    By sanji in forum Managing Customers and Orders
    Replies: 4
    Last Post: 28 Jan 2008, 10:57 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR