Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2008
    Plugin Contributions

    Default Limit Maximum Post Code length ?


    I'm still working with the v1.3.7. In the administration it is possible to set the minimum number of characters for the ZIP code, but I wonder if it is possible to setup maximum number of characters? Is it possible to edit it somewhere in php source?

  2. #2
    Join Date
    Jan 2004
    Blog Entries
    Plugin Contributions

    Default Re: Limit Maximum Post Code length ?

    In your templates, tpl_modules_address_book_details.php you'll find this code:

    (this link is from v1.5.7, but you'll recognize the similarities in yours)

    Notice there that it uses the following to set the field length:
    zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40')
    Behind the scenes it does 2 things:
    1. It says use 40 characters as the initial size/width displayed on the page.
    2. It reads the database table (address_book table) to get the maximum length of the field in there, and then tells the web page to not allow more characters than that.

    So, if your "real" question is how to shorten the field so it doesn't take up so much horizontal space (40 characters when you're only wanting 10) then perhaps just changing the 40 to a smaller number will suffice.

    Or was your "real" question something else?

    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.

  3. #3
    Join Date
    Feb 2008
    Plugin Contributions

    Default Re: Limit Maximum Post Code length ?

    Thank you very much for your feedback. However, this is not what I am looking for. Recently we have a problem with customer registration through spambot. I think the implementation of captcha would be too complicated.

    So, I thought to limit the length of the ZIP code characters because there are 6 characters in our country, but spambot enters more characters. The minimum number of characters that can be set in the administration works so that if the customer enters fewer characters when registering, he / she will receive a "more characters must be entered" error. I'm looking for how to do the same upside down to limit the maximum number of characters.

    This is a spambot registration:
    Name:  customer.PNG
Views: 18
Size:  12.9 KB

  4. #4
    Join Date
    Jul 2012
    Plugin Contributions

    Default Re: Limit Maximum Post Code length ?

    Honestly if the goal is to address spambot type actions it would be suggested to start the upgrade process as the software being used (Zen Cart 1.3.7 based on the content of this thread) is based on antiquated and potentially buggy software as compared to today's standard.

    As far as captcha type implementation it shouldn't be much effort at all to implement, there are example sections of code in the associated header_php.php file for the pages in question, in the associated template file for the page and the code to implement the captcha should already exist for that version or a relatively equivalent version.

    As to simply limiting that field length, it may temporarily stop a few of the submissions, but there is no reason to expect that the bot won't get "smarter". I see that numbers are applied to the phone number, so apparently it has figured out that aspect...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  5. #5
    Join Date
    Dec 2007
    Payson, AZ
    Plugin Contributions

    Default Re: Limit Maximum Post Code length ?

    I don't even have a copy of 1.3.7 to look at, but you could try pattern matching on the field..

    One thing through,
    However, this is not what I am looking for. Recently we have a problem with customer registration through spambot
    This bot does not use your form! which makes CAPTCHA useless anyway, and any pattern matching..

    This is what I use on my postal code. Google search for patterns matching your country needs..
    <?php echo zen_draw_input_field('postcode', '',' id="postcode" title="Your postal code (12345 or 12345-1234)" pattern="^\d{5}(?:[\s]?[-\s][\s]?\d{4})?$" required="required" aria-required="true" '); ?>
    Always forward thinking... MySite..



Similar Threads

  1. How to change the maximum length for postcode?
    By ferid in forum Basic Configuration
    Replies: 6
    Last Post: 26 Sep 2011, 06:50 AM
  2. Setting maximum string length for admin fields
    By numinix in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 3 Jul 2007, 07:39 AM
  3. Maximum Length of EZpage?
    By dave5698225 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Jan 2007, 03:18 AM
  4. maximum password length
    By stagebrace in forum General Questions
    Replies: 3
    Last Post: 28 May 2006, 07:28 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
Zen-Cart, Internet Selling Services, Klamath Falls, OR