osCmax v2.5 User Manual
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Tax ID REQUIRD -- help!!

This is a discussion on Tax ID REQUIRD -- help!! within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; Posted to osc forums also.. I really thought I had this working, but went to test again before an install ...

      
  1. #1
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Tax ID REQUIRD -- help!!

    Posted to osc forums also..

    I really thought I had this working, but went to test again before an install on a new cart and its not working.. can someone take a look and tell me where I am wrong here??

    RUN SQL
    Code:
    ALTER TABLE address_book
        MODIFY `entry_company_tax_id` varchar(32) NOT NULL DEFAULT '';
    Code:
    INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
    (1626, 'Tax ID', 'ENTRY_COMPANY_TAX_ID_MIN_LENGTH', '5', 'Minimum length of License or Tax ID', 2, 1, NULL, '0000-00-00 00:00:00', NULL, NULL);
    ===================================
    OPEN
    catalog/includes/javascript/form_check.js.php - added:
    FIND:
    Code:
    check_input("city", <?php echo ENTRY_CITY_MIN_LENGTH; ?>, "<?php echo ENTRY_CITY_ERROR; ?>");
    ADD AFTER:
    Code:
    ##require company_tax_id
      check_input("company_tax_id", <?php echo ENTRY_COMPANY_TAX_ID_MIN_LENGTH; ?>, "<?php echo ENTRY_COMPANY_TAX_ID_ERROR; ?>");
    ===================================
    OPEN
    catalog/includes/languages/english.php
    MODIFY AS DESIRED:
    Code:
    define('ENTRY_COMPANY_TAX_ID', 'License or Tax ID number:');
    define('ENTRY_COMPANY_TAX_ID_ERROR', 'License number is required unless you reside in an unlicensed country or state. Please state so in the box.');
    define('ENTRY_COMPANY_TAX_ID_TEXT', '*');
    ===================================
    OPEN
    catalog/create_account.php
    FIND:
    Code:
        if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
          $error = true;
          $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
        }
    ADD AFTER:
    Code:
    ##require company_tax_id
    if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
    $error = true;
    $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
    }
    I also tried this code for the last change, and it did not work either
    Code:
    ##require company_tax_id
        if (COMPANY_TAX_ID == 'true') {
         if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
           $error = true;
           $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
         }
        }
    Debbie D
    NY & VA

  2. #2
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Tax ID REQUIRD -- help!!

    are you even reading ENTRY_COMPANY_TAX_ID_ERROR from the config table?
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  3. #3
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Re: Tax ID REQUIRD -- help!!

    ok I'll be a jackass today.. point me in the right direction as to where I need to do that and I will try again.. thx
    Debbie D
    NY & VA

  4. #4
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Tax ID REQUIRD -- help!!

    In includes/application_top.php

    look for
    Code:
      $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
      while ($configuration = tep_db_fetch_array($configuration_query)) {
        define($configuration['cfgKey'], $configuration['cfgValue']);
      }
    That's where all the configuration variables get loaded. I would check and see what is getting loaded in to ENTRY_COMPANY_TAX_ID_MIN_LENGTH

    after that look for
    $messageStack = new messageStack;
    Now that the message stack has been loaded, you can use it to send a debug statement to the message stack

    such as:

    $messageStack->add('header', 'Value for ENTRY_COMPANY_TAX_ID_MIN_LENGTH is: '.ENTRY_COMPANY_TAX_ID_MIN_LENGTH, 'warning');
    This is a fast and easy way to write out the debug line when any catalog page is loaded. Once we get past the determiation that the value is getting read and stored from the configuration table, we move on to determining what the javascript actually says. Here you would use firebug to see what the javascript looks like when it gets loaded onto th create account screen.

    After that, it's a fairly straight forward debug. If the javascript is there, then step through to see what happens when it runs.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  5. #5
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Re: Tax ID REQUIRD -- help!!

    OK good start here

    Yes I see that code in /includes/appluication_top.php

    Also in the same file I do see:
    Code:
    // initialize the message stack for output messages
      require(DIR_WS_CLASSES . 'message_stack.php');
      $messageStack = new messageStack;

    I do have in /catalog/creat_account.php
    Code:
    //require company_tax_id
        if (COMPANY_TAX_ID == 'true') {
         if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
           $error = true;
           $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
         }
        }
    So do I need to add this somewhere???
    Code:
    $messageStack->add('header', 'Value for ENTRY_COMPANY_TAX_ID_MIN_LENGTH is: '.ENTRY_COMPANY_TAX_ID_MIN_LENGTH, 'warning');
    I really need to get this working.. a new line one of my clients took on - some 1400 products - the manufacturer requirers we force the buy to enter thier license information to ensure we are selling their stuff to licensed professionals (I will add thier stuff is in almost every drug store in the US so anyone can walk in and plunk down some cash and this seems not to bother their butts..)

    I use firebug so we're good there..
    Debbie D
    NY & VA

  6. #6
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    26


    Default Re: Tax ID REQUIRD -- help!!

    The first thing I would look for in the debug is to see if the value is being picked up in the configuration table read portion of application_top. The fastest way to see that is to add that message stack line, as that will display on the top of the page when you do. (like when you have the install directory still there). It's a very fast way to find out if the configuration variable is getting picked up at all. If it is, then the next thing to do is use firebug to look at the javascript you loaded on the create_account and see if the javascript matches what you thought it should be

    this line should show us
    check_input("company_tax_id", <?php echo ENTRY_COMPANY_TAX_ID_MIN_LENGTH; ?>, "<?php echo ENTRY_COMPANY_TAX_ID_ERROR; ?>");
    as
    check_input("company_tax_id", 5 , "License number is required unless you reside in an unlicensed country or state. Please state so in the box.");

    If it doesn't, then you need to investigate why it is not, because then the error is in form_check.js.php

    also, is there a reason your comments are

    ##

    Code:
    ##require company_tax_id
    if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
    $error = true;
    $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
    }
    instead of

    Code:
    //BOF: CompID - require company_tax_id
    if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
    $error = true;
    $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
    }
    // EOF: CompID - end company ID required mod
    I don't remember seeing any of the oscMax stuff using # comments. There are /* */ blocks and // on lines. Yes, you can use a single #, but it is really non-standard in osCmax. You will find a great deal of
    //BOF: ...
    //EOF: ...

    as it makes it easy to follow the changes that way (easy search terms).

    I realize there is no official standard, but I would say that the BOF/EOF is used by most of the development team.
    so endith the lesson
    <think>sometimes I just sit's and thinks</think>
    "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB

  7. #7
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default Re: Tax ID REQUIRD -- help!!

    Sorry to butt in on this thread ... but are you using the field that already exists - yes? Admin -> Configuration -> Customer Details -> Company = set to true.

    This will show the company name and tax id field in the create account page ... then all you need to do is make it a required field.

    Regards,
    pgmarshall
    _______________________________

  8. #8
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Re: Tax ID REQUIRD -- help!!

    also, is there a reason your comments are

    ##
    Um yea.. CGI and UNIX habits.. I always have to go in and change that

    I checked firebug and it does show I am checking the tax ID field for a minimum length
    Code:
    check_input("company_tax_id", 5, "License number is required unless you reside in an unlicensed country or state. Please state so in the box.");
    Sorry to butt in on this thread ... but are you using the field that already exists
    pg, you are never butting into any thread
    I thought I did set it as required..

    I'm using the tax ID field - wanting to make it required as the products being sold should be sold only to licensed professionals. I don't need their actual tax ID, just their license number and adjusted the language file to reflect that.
    Code:
    OPEN
    catalog/includes/languages/english.php
    MODIFY AS DESIRED:
    define('ENTRY_COMPANY_TAX_ID', 'License number:');
    define('ENTRY_COMPANY_TAX_ID_ERROR', 'License number is required unless you reside in an unlicensed country or state. Please state so in the box.');
    define('ENTRY_COMPANY_TAX_ID_TEXT', '*');
    I altered the DB
    Code:
        MODIFY `entry_company_tax_id` varchar(32) NOT NULL DEFAULT '';
    I forced a required length to the tax ID field
    Code:
    INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
    (1626, 'Tax ID', 'ENTRY_COMPANY_TAX_ID_MIN_LENGTH', '5', 'Minimum length of License or Tax ID', 2, 1, NULL, '0000-00-00 00:00:00', NULL, NULL);
    Minimum Values TitleValue First Name2 Tax ID5
    I added the checking of the Tax ID field for the minimum entry value here:
    Code:
    OPEN
    catalog/includes/javascript/form_check.js.php:
     
    FIND:
      check_input("city", <?php echo ENTRY_CITY_MIN_LENGTH; ?>, "<?php echo ENTRY_CITY_ERROR; ?>");
    ADD AFTER:
    /* require company_tax_id  */
      check_input("company_tax_id", <?php echo ENTRY_COMPANY_TAX_ID_MIN_LENGTH; ?>, "<?php echo ENTRY_COMPANY_TAX_ID_ERROR; ?>");

    and here:
    Code:
    OPEN
    catalog/create_account.php
    FIND:
        if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
          $error = true;
          $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
        }
    ADD AFTER:
    /* require company_tax_id  */
    if (strlen($company_tax_id) < ENTRY_COMPANY_TAX_ID_MIN_LENGTH) {
    $error = true;
    $messageStack->add('create_account', ENTRY_COMPANY_TAX_ID_ERROR);
    }
    Something is missing obviously
    If I go to the form, fill nothing in at all and SUBMIT it shows everything except the tax ID line
    Errors have occured during the process of your form.
    Please make the following corrections:
    * Your First Name must contain a minimum of 2 characters.
    * Your Last Name must contain a minimum of 2 characters.
    * Your E-Mail Address must contain a minimum of 6 characters.
    * Your Street Address must contain a minimum of 5 characters.
    * Your Post Code must contain a minimum of 4 characters.
    * Your City must contain a minimum of 3 characters.
    * Your Telephone Number must contain a minimum of 3 characters.
    * Your Password must contain a minimum of 5 characters
    Debbie D
    NY & VA

  9. #9
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Re: Tax ID REQUIRD -- help!!

    anyone??

    I was poking around at other files and mods for other ideas and came up with these 2 sets of code..
    Code:
     if ($remoteip == null || $remoteip == '') {
      die ("For security reasons, you must pass the remote ip to reCAPTCHA");
     }
    Code:
       if ($enquiry == '') {
            $error = true;
            $messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR);
        }
    One of these should do the trick?? but where??
    Debbie D
    NY & VA

  10. #10
    osCMax Testing Team wkdwich's Avatar
    Join Date
    Jul 2007
    Posts
    307
    Rep Power
    11


    Default Re: Tax ID REQUIRD -- help!!

    Quote Originally Posted by pgmarshall View Post
    Sorry to butt in on this thread ... but are you using the field that already exists - yes? Admin -> Configuration -> Customer Details -> Company = set to true.

    This will show the company name and tax id field in the create account page ... then all you need to do is make it a required field.

    Regards,

    PG I have messed with this and messed with it.. can you help me out here.. yes I have Company as required, yes the tax id box shows, yes I put the * (designating required) there but thats just a language file thing.. how to I force the field to be filled in - honestly I dont care is I get grandma's meatloaf recipie in there one of the lines my client distributes is insisting on this being required...

    thanks
    Debbie D
    NY & VA

Page 1 of 2 12 LastLast

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
  •