Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2006
    Posts
    25
    Plugin Contributions
    0

    Default [Done v1.3.7] Error when setting fractional quantity.

    Hi,

    I have an issue with fractional quantities. I'm selling fabric so need to sell by 0.5 metre lengths. The installation version is Zen-Cart v1.3.6.

    I go into Admin > Config > Stock and change the 'product quantity decimals' to 1 decimal place (which should allow the sale of fabric by 0.5 metre lengths).

    When I'm on the front end and attempt to add a product item to my cart I get a yellow warning/error. The error displays like such:

    Quantity Error Adjustment
    Product A - 1 => 1

    This seems to happen regardless of whether I set the 'Product Qty Minimum' and 'Product Qty Units' to a fraction or a whole number in the actual product item itself.

    Does anyone know why this error appears and what can be done to rectify so that it doesn't appear?

    Many thanks in advance,

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

    Default Re: Error when setting fractional quantity.

    For now, comment out 2 of the messages at the bottom of the file around lines 1847 - 1873:
    /includes/classes/shopping_cart.php

    The routine is used 2 ways and is passing the messages when it should not ...
    PHP Code:
      function adjust_quantity($check_qty$products$message=false) {
        global 
    $messageStack;
          
    $old_quantity $check_qty;
            if (
    QUANTITY_DECIMALS != 0) {
              
    //          $new_qty = round($new_qty, QUANTITY_DECIMALS);

              
    $fix_qty $check_qty;
              switch (
    true) {
                case (!
    strstr($fix_qty'.')):
                
    $new_qty $fix_qty;
    //            $messageStack->add_session('shopping_cart', ERROR_QUANTITY_ADJUSTED . ' - ' . zen_get_products_name($products) . ' - ' . $old_quantity . ' => ' . $new_qty, 'caution');
                
    break;
                default:
                
    $new_qty preg_replace('/[0]+$/',''$check_qty);
    //            $messageStack->add_session('shopping_cart', ERROR_QUANTITY_ADJUSTED . ' - ' . zen_get_products_name($products) . ' - ' . $old_quantity . ' => ' . $new_qty, 'caution');
                
    break;
              }
            } else {
              if (
    $check_qty != round($check_qtyQUANTITY_DECIMALS)) {
                
    $new_qty round($check_qtyQUANTITY_DECIMALS);
                
    $messageStack->add_session('shopping_cart'ERROR_QUANTITY_ADJUSTED ' - ' zen_get_products_name($products) . ' - ' $old_quantity ' => ' $new_qty'caution');
              } else {
                
    $new_qty $check_qty;
              }
            }
         return 
    $new_qty;
      } 
    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
    Nov 2006
    Posts
    25
    Plugin Contributions
    0

    Default Re: Error when setting fractional quantity.

    Thanks! Works fine now.

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

    Default Re: Error when setting fractional quantity.

    Thanks for the update that when using decimals in your quantities that this was able to fix the errant error messages ...

    Moved to Bug Reports ...
    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!

  5. #5
    Join Date
    Oct 2006
    Posts
    9
    Plugin Contributions
    0

    Default Re: [Done v1.3.7] Error when setting fractional quantity.

    I couldn't find the lines that were mentioned here but in my version of ZenCart (1.3.5), I did find these two lines and commented them out for fractional quantities and all is well now.


    lines 1137 and 1138

    $_SESSION['valid_to_checkout'] = false;
    $_SESSION['cart_errors'] .= ERROR_PRODUCT . $products->fields['products_name'] . ERROR_PRODUCT_QUANTITY_UNITS_SHOPPING_CART . ERROR_PRODUCT_QUANTITY_ORDERED . $check_quantity . ' <span class="alertBlack">' . zen_get_products_quantity_min_units_display((int)$prid, false, true) . '</span> ' . '<br />';

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

    Default Re: [Done v1.3.7] Error when setting fractional quantity.

    There are a number of bugs in v1.3.5 and it is advised to upgrade to v1.3.7 plus add the current patch at:
    http://www.zen-cart.com/forum/showthread.php?t=56216
    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!

 

 

Similar Threads

  1. v151 Fractional Quantity Sub-Total Rounding Discrepency
    By saturate in forum Bug Reports
    Replies: 7
    Last Post: 25 Aug 2014, 02:53 AM
  2. fatal error after setting quantity discounts
    By wolfsz in forum Managing Customers and Orders
    Replies: 1
    Last Post: 25 Aug 2009, 01:34 AM
  3. Fractional Quantity Rounding Price
    By christianpatrick in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 1 Apr 2009, 03:57 PM
  4. Replies: 5
    Last Post: 11 Jun 2007, 05:59 PM
  5. [DONE 1.3.5] Fractional Image Sizes - syntax error
    By Brian the Brain in forum Bug Reports
    Replies: 3
    Last Post: 23 Jul 2006, 03:16 AM

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