Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2008
    Posts
    4
    Plugin Contributions
    0

    Default Mixed Options for multiple quantities error

    I'm in the process of converting my OsCommerce store to Zen (nice improvement in so many ways), and I may have found a gliche in 1.3.8a - or I'm not setup correctly.

    I have Item "A" setup with the "mixed options" turned ON and a minimum order quantity of 10.

    Item A has an attribute with 2 possible values - red or blue - with no cost associated with either.

    If I understand how the "mixed options" is supposed to work - the customer should be able to order 8 red and 2 blue to fulfill the min order quanitity of Item A.

    But what's happening is that a warning message is appearing in the cart"
    " Please update your order. Item A has a minimum quantity restriction.
    You ordered a total of: 2 Min: 10"

    In fact, the only way to "fix" the order and allow it to go thru is if you edit the LAST shopping cart entry to be equal to "10".

    I've tried a number of different situations, and they all seem to come up the same way.

    If I turn OFF the mixed options, I get a message for each shopping cart entry that is below the minimum - which looks correct.

    It doesn't look like the zen is properly accumulating the quantity totals for matching product ID's with different attribute options selected - which is what I thought the "mixed options" selection did.

    So...is it me, or is it a glitch?

    Thanks!!

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

    Default Re: Mixed Options for multiple quantities error

    If you add 8 and then 2 ... does this work properly for you?
    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!

  3. #3
    Join Date
    Jul 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Mixed Options for multiple quantities error

    Quote Originally Posted by Ajeh View Post
    If you add 8 and then 2 ... does this work properly for you?

    I suspect it's a coding error because of how it behaves. If there are 2 blue items and 8 red items in the cart, the error msg only refers to the second cart item (it says that "you only have 8").

    If you then were to add 2 more red items, it's fine (because the last item is "10"). (But realize that you actually have 12)

    As long as the last item added to the cart equals 10, it's fine.

    But if you were to add 10 reds followed by 2 blues, it would error that you didn't have enough. It would say you only have "2" and need "10".

    See what I mean? The only item that "counts" is the last item in the cart - and it has to meet the min all by itself...

    Here, I did some screen caps...

    Both are caps of the shopping cart with the same exact item listed. This item has 1 option with 2 possible values. The item is set to YES for "Product Qty Min/Unit Mix:".

    In this cap, I bought 10 pinbacks and 2 magnets for a total of 12 units, which should meet the 10 min requirement. As you see, it errors on the second cart item..



    Here is another cap of the same item, purchased in the same quanitity, with the same options. The only difference is that I bought the magnets first, and then the pinbacks.



    So in the second example the option is working as it should. Even though I only bought 2 pinbacks, the "mix" option allowed the 10 magnets to count towards the total, and there is no error.

    Far as I can tell, the first cart example should work exactly the same way as the second....

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

    Default Re: Mixed Options for multiple quantities error

    This is reminding me of a fix I thought was made or posted ... hmm ... think think think ...
    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!

  5. #5
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Mixed Options for multiple quantities error

    .

    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.

  6. #6
    Join Date
    Jul 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Mixed Options for multiple quantities error

    in \includes\classes\shopping_cart.php the routine looks to start around line 1377.

    PHP Code:
    /**
       * Method to calculate item quantity, bounded the mixed/min units settings
       *
       * @param boolean product id of item to check
       * @return deciaml
       */
      
    function in_cart_mixed($products_id) {
        global 
    $db;
        
    // if nothing is in cart return 0
        
    if (!is_array($this->contents)) return 0;

        
    // check if mixed is on
        //      $product = $db->Execute("select products_id, products_quantity_mixed from " . TABLE_PRODUCTS . " where products_id='" . (int)$products_id . "' limit 1");
        
    $product $db->Execute("select products_id, products_quantity_mixed from " TABLE_PRODUCTS " where products_id='" zen_get_prid($products_id) . "' limit 1");

        
    // if mixed attributes is off return qty for current attribute selection
        
    if ($product->fields['products_quantity_mixed'] == '0') {
          return 
    $this->get_quantity($products_id);
        }

        
    // compute total quantity regardless of attributes
        
    $in_cart_mixed_qty 0;
        
    $chk_products_idzen_get_prid($products_id);

        
    // reset($this->contents); // breaks cart
        
    $check_contents $this->contents;
        while (list(
    $products_id, ) = each($check_contents)) {
          
    $test_id zen_get_prid($products_id);
          if (
    $test_id == $chk_products_id) {
            
    $in_cart_mixed_qty += $check_contents[$products_id]['qty'];
          }
        }
        return 
    $in_cart_mixed_qty;
      }
      
    /**
       * Method to calculate item quantity, bounded the mixed/min units settings
       *
       * @param boolean product id of item to check
       * @return deciaml
       */
      
    function in_cart_mixed_discount_quantity($products_id) {
        global 
    $db;
        
    // if nothing is in cart return 0
        
    if (!is_array($this->contents)) return 0

  7. #7
    Join Date
    Jul 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Mixed Options for multiple quantities error

    Quote Originally Posted by DrByte View Post

    Thanks Dr. Byte! That same fixed worked here!

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

    Default Re: Mixed Options for multiple quantities error

    DrByte is my hero! ... and fortunately has a younger brain than I ...
    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!

  9. #9
    Join Date
    Aug 2008
    Posts
    12
    Plugin Contributions
    0

    application error Re: Mixed Options for multiple quantities error

    tg11 & others,


    I have a question on the code that you posted. I understand that everyone used the code and it is working. For some odd reason it is making my website blank. when I take out the code, my whole website is back the way it was. When I checked out the code I see some similar code when I download the product matrix grid module except it does not solve the problem regarding the mixed options for multiple quantities error. The current code gives the end user options in purchasing the single product but they will receive the multiple quantities error. The code that I have in my shopping cart is:

    Lines: 1545 to 1588
    Code:
    /**
       * Method to calculate item quantity, bounded the mixed/min units settings
       *
       * @param boolean product id of item to check
       * @return deciaml
       */
      function in_cart_mixed($products_id) {
        global $db;
        // if nothing is in cart return 0
        if (!is_array($this->contents)) return 0;
    
        // check if mixed is on
        //      $product = $db->Execute("select products_id, products_quantity_mixed from " . TABLE_PRODUCTS . " where products_id='" . (int)$products_id . "' limit 1");
        $product = $db->Execute("select products_id, products_quantity_mixed from " . TABLE_PRODUCTS . " where products_id='" . zen_get_prid($products_id) . "' limit 1");
    
        // if mixed attributes is off return qty for current attribute selection
        if ($product->fields['products_quantity_mixed'] == '0') {
          return $this->get_quantity($products_id);
        }
    
        // compute total quantity regardless of attributes
        $in_cart_mixed_qty = 0;
        $chk_products_id= zen_get_prid($products_id);
    
        // reset($this->contents); // breaks cart
        $check_contents = $this->contents;
        while (list($products_id, ) = each($check_contents)) {
          $test_id = zen_get_prid($products_id);
          if ($test_id == $chk_products_id) {
            $in_cart_mixed_qty += $check_contents[$products_id]['qty'];
          }
        }
        return $in_cart_mixed_qty;
      }
      /**
       * Method to calculate item quantity, bounded the mixed/min units settings
       *
       * @param boolean product id of item to check
       * @return deciaml
       */
      function in_cart_mixed_discount_quantity($products_id) {
        global $db;
        // if nothing is in cart return 0
        if (!is_array($this->contents)) return 0;
    product matrix grid:



    My errors:



    I am not sure what I am doing wrong.

    Any advice?

 

 

Similar Threads

  1. Replies: 3
    Last Post: 30 Jun 2011, 02:04 AM
  2. attributes help for multiple quantities and prices
    By dellvostro in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 15 Oct 2008, 05:11 PM
  3. Replies: 2
    Last Post: 6 Aug 2008, 06:38 PM
  4. Mixed Options?
    By Shooters in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 27 Feb 2008, 12:13 PM
  5. Removing Mixed Options Values text
    By castylx in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 16 Sep 2006, 02:56 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
  •  
disjunctive-egg