Results 1 to 10 of 10
  1. #1
    Join Date
    May 2008
    Posts
    1
    Plugin Contributions
    0

    red flag CheckBox Maximum Selection

    Hi, I've setup products using Product Attributes/Optiona Values/Option names with multiple checkboxes, for example 30 different options, however I would like to limit the selection to 10, so that the customer can only select up to 10 products of the 30, is there a way to limit this? thanks in advance.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: CheckBox Maximum Selection

    This is not an existing feature of Zen Cart at this time ... it is however on the list of fun things to do in a future release ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: CheckBox Maximum Selection

    Any update on this feature? I have a client who really needs it...
    20 years a Zencart User

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: CheckBox Maximum Selection

    The *way* to do it is to write the appropriate javascript and put it in your /includes/modules/pages/product_info/ folder as either a jscript_something.js or jscript_something.php file depending on whether you need PHP logic to dynamically build the javascript for the page.
    .

    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.

  5. #5
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: CheckBox Maximum Selection

    Yes, I was looking at a .js something like:

    Code:
    function verify_checkboxes(form)
    {
         var elements = form.elements;
         var boxcount = 0;
    
         for (var i in elements)
         {
               if (elements[i].type == 'checkbox' && elements[i].checked)
               {
                      if (++boxcount >= 5)
                      {
                            alert('You cannot check more than 5 boxes');
                            return false;
                      }
               }
         }
         return true;
    }
    But where (and how) do I add the following to the product_info page?

    Code:
    <form action="" method="post" onsubmit="return verify_checkboxes(this);">
    
    .....
    
    </form>
    20 years a Zencart User

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: CheckBox Maximum Selection

    tpl_product_info_display.php
    Add your onsubmit parameter after the enctype parameter:
    [FONT="Courier New"]<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data" onsubmit="return verify_checkboxes(this);"') . "\n"; ?>[/FONT]
    .

    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.

  7. #7
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: CheckBox Maximum Selection

    Thanks doc... I'll give it a go and report back...
    20 years a Zencart User

  8. #8
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: CheckBox Maximum Selection

    Works a treat. See it HERE
    20 years a Zencart User

  9. #9
    Join Date
    Nov 2010
    Posts
    3
    Plugin Contributions
    0

    Default Re: CheckBox Maximum Selection

    Can you post the exact code and where to inset it. I'm not very good at coding....
    I need 3 boxes selected.
    Thanks so much!!!!

  10. #10
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: CheckBox Maximum Selection

    Since the original discussion, I have changed the behaviour of my example, and no longer use it. If I have time, I'll go back to my original files and come back to this discussion.

    NB: Only if I have time... We are very busy just now.
    20 years a Zencart User

 

 

Similar Threads

  1. v139h zen_draw_checkbox_field - how do I get my custom field to show selection in checkbox?
    By johnlewisdesign in forum Customization from the Admin
    Replies: 2
    Last Post: 1 May 2012, 03:12 PM
  2. Skip shipping selection question (hide selection)
    By CabernetCat in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 1 Jan 2012, 09:31 AM
  3. Maximum Package Weight You Will Ship - Maximum?
    By WellCool in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 25 Nov 2010, 04:00 PM
  4. Checkbox in Cart?
    By KES99 in forum General Questions
    Replies: 2
    Last Post: 29 May 2009, 04:53 AM
  5. How to force selection of a checkbox?
    By karma-lab in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 5 Jun 2008, 07:09 PM

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