Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2010
    Posts
    319
    Plugin Contributions
    0

    Default are you only allowed 1 checkbox per product in attributes

    hi,
    just asking is there a restriction on the amount of checkboxes per product in zencart

    i have been using sba and noticed it didnt reduce the product quantity properly when i selected a mix of the same product with different options selected.

    assuming it was an error in sba i tested in basic install.

    so created a products, added an option name, then added 2 option values

    product looks like this

    Click image for larger version. 

Name:	product.jpg 
Views:	144 
Size:	29.3 KB 
ID:	13799

    if i add to my cart like this

    Click image for larger version. 

Name:	cart.jpg 
Views:	127 
Size:	49.9 KB 
ID:	13800

    so to me this should remove 4 from the product qty but only removes 2

    am i doing something wrong here or is there a limit on checkboxes

    no code touched but did use softaculous to install

    thanks for any help
    bn

  2. #2
    Join Date
    Apr 2010
    Posts
    319
    Plugin Contributions
    0

    Default Re: are you only allowed 1 checkbox per product in attributes

    i have downloaded a fresh copy from site, uploaded and installed sample data,

    if i create 2 options using checkbox attribute and add same scenario as above it still only reduces 2 from stock instead of 4.

    anyone any suggestions

    thanks
    bryan

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: are you only allowed 1 checkbox per product in attributes

    After a great deal of time to try this with the version of SBA that I have installed (not entirely known which version, but it's about 1-2 years old) I noticed the following:
    SBA didn't recognize that two or more checkbox attributes could be selected under the same option name. This was evident in the population of the quantities in stock.

    Further when I tried to add. A combination of 2 or more attributes to a single product, the shopping cart showed that the item was out of stock.

    Recently also was involved in a conversation where someone wanted to use a checkbox to do something similar but not really trying to address stock quantities but to ensure that when selecting the product at least one checkbox was marked.

    Seems to me that in order to use a checkbox to track stock, would need to add one each option name each with only one option value to get this to work. The name of each separate option could be hidden with css, so guest would only see one "description" but multiple checkboxes. Other part of tHat though is that combinations of stock would need to exist, but that too may get confusing when having to have a stock for two options (which really take stock out of the one each) so not exactly ideal.

    Essentially the use of checkboxes in ZC is to some extent limited at this time.

    For clarity I think it is/was either a kuroi or robophung version.
    Last edited by mc12345678; 19 Feb 2014 at 11:19 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Apr 2010
    Posts
    319
    Plugin Contributions
    0

    Default Re: are you only allowed 1 checkbox per product in attributes

    hi,
    apologies if i have gave you a lot of work to check this, i had noticed this when using sba but i am actually back at a fresh install so i shouldnt have even mentioned the word as this has caused confusion.

    so i am talking about a fresh install of zencart 1.51 downloaded from site. i have also tried using a version automatically installed with cpanel/softalicious

    if i have a 12" pizza and 2 toppings mushrooms and bacon(options with checkboxes ) this is with no modifications and i understand there is no stock tracking on the options

    if i checkout with 1 plain pizza, 1 pizza with mushrooms, 1 pizza with bacon and 1 with both toppings it only removes 2 pizza from stock not 4, it does show 4 when checking out and shows 4 in your order but if you watch stock it only deducts 2.

    hopefully this makes more sense

    again thanks for help
    bryan

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: are you only allowed 1 checkbox per product in attributes

    Oh, no big deal on my side, it was things like network connections and data rates that were my issue and then the fact that I didn't recognize the out of stock situation that I was having in the shopping cart.

    So what other settings are we talking about? Ie, price by attributes, etc... Been able to identify which of the four options (when dealing with two potential selections) are responsible for the two stock items? Ie. I'f checkout one at a time each of the four selections (none, 1 A, 1 B, both) which ones deplete stock, and which don't? (My thought with the setup provided that only the ones that have one or the other checked will go through as a product reduction.

    Yeah, okay so SBA did get considered, but it also seems that it helped reveal some things as well. I'm going to take a look at the suggested settings from the other thread I was looking through to see if it would have an effect on what is being observed here.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: are you only allowed 1 checkbox per product in attributes

    So, I've been trying to get a moment to post this for a while now... But...

    I ran a test on the product I setup to try to identify what aspect of the checkbox attribute was causing a problem. While the test was not exhaustive (ie., could have performed a larger number of operations), it appears that although the correct fee is applied to the purchase of any of the following, the stock quantity does not work out correctly.

    The setup was essentially the following:
    One product
    One option name (checkboxes)
    Two option values
    Product is price by attribute
    price of product is 0,
    price of attribute one is $10
    price of attribute two is $20
    In attribute controller: Attribute 1 is identified as Base Price (2 is not)
    Remaining settings for both: display only: off, Free: on, default: off, discounted: on, required: off.
    quantity of stock was 10000 initially



    Product A has no check boxes checked
    Product B has first check box checked
    Product C has second check box checked
    Product D has both check boxes checked
    Product added to cart and quantity Sequence of adding product to cart Qty purchased Remaining Qty after purchase
    A B C D A B C D Used 10000
    1 1 1 2 4 1 2 3 4 3 9997
    1 1 1 1 9996
    1 1 1 1 9995
    1 1 2 1 2 2 9993
    1 1 2 1 2 2 9991
    1 1 1 3 2 1 3 1 9990
    1 1 1 1 2 3 4 1 4 2 9988
    1 1 1 1 3 1 2 4 4 1 9987


    Based on the above, the sequence of adding a product to the cart has an effect on the quantity that is then removed as part of the purchase. Specifically can easily see from the last two purchases that the quantity removed from the store changes from the sequence. Initially: DABC removed a quantity of two of the item, BCAD removed only one. I apologize for the first data, during testing, I thought that I only had selected one of each item, but apparently had selected two of item D.

    This to me revises my previous statement. There does appear to be an error in the coding/handling of checkboxes at least on the inventory side. Cost wise, it comes out correctly, I was "charged" the amount expected for each of the above situations, but my stock would have been grossly in error if it was a real product.

    For some reason I remember seeing something about this problem in the past, but I have spent several days looking for related discussions. Most times an alternate method of gathering data was used, ie. radio buttons, drop downs, etc...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Apr 2010
    Posts
    319
    Plugin Contributions
    0

    Default Re: are you only allowed 1 checkbox per product in attributes

    At least you have confirmed it i seem to get 2 or 3 products deducted never the 4

    I was starting to think this was just me
    Thanks for confirming it is happening to you as well

    Bn

  8. #8
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: are you only allowed 1 checkbox per product in attributes

    Quote Originally Posted by mc12345678 View Post
    This to me revises my previous statement. There does appear to be an error in the coding/handling of checkboxes at least on the inventory side. Cost wise, it comes out correctly, I was "charged" the amount expected for each of the above situations, but my stock would have been grossly in error if it was a real product.
    Ajeh has spent several days in the past couple weeks investigating this. Today we were able to determine that the problem is a chicken/egg cache issue.

    There are a couple ways to fix it, but the simplest way to fix your 1.5.1 code is to add . "\n#" . $i to these 2 queries in /includes/classes/order.php:

    Code:
              $stock_values = $db->Execute($stock_query_raw . "\n#" . $i);
            } else {
              $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'". "\n#" . $i);
            }
    We'll fix it a little differently in 152/160 going forward by passing a proper cache bypass. But the above approach creates enough uniqueness will trigger an appropriate implied bypass, with minimal need to touch your own core files.
    .

    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.

  9. #9
    Join Date
    Apr 2010
    Posts
    319
    Plugin Contributions
    0

    Default Re: are you only allowed 1 checkbox per product in attributes

    thank you ajeh and dr byte seems to deduct stock fine now

    thanks
    bn

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

    Default Re: are you only allowed 1 checkbox per product in attributes

    Thanks for the update that this *temporary* fix works for you ...

    NOTE: the update will be different in v1.5.2+ so make sure you use the new code later in future updates, as this *temporary* fix will not be needed ...
    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!]
    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!

 

 

Similar Threads

  1. Whoops! Sorry, but you are not allowed to perform the action requested. You are still
    By buildingblocks in forum All Other Contributions/Addons
    Replies: 14
    Last Post: 5 Nov 2012, 09:52 PM
  2. Whoops! Sorry, but you are not allowed to perform...
    By PricklyPixel in forum Managing Customers and Orders
    Replies: 5
    Last Post: 8 Dec 2011, 09:15 PM
  3. Re: Whoops! Sorry, but you are not allowed ... Stock by Attributes v1.3.8
    By trisha1581 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 25 Sep 2011, 01:07 AM
  4. Replies: 2
    Last Post: 1 Mar 2011, 11:15 PM
  5. Whoops! Sorry, but you are not allowed
    By gilby in forum Upgrading from 1.3.x to 1.3.9
    Replies: 7
    Last Post: 9 Nov 2010, 02:29 AM

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