Jump to content

Disable Maximum Purchase Amount?


prophoto
 Share

Recommended Posts

I realized that all my products now have a maximum purchase amount set to zero.  I'm discovering that ALL my products have a zero in that particular box in admin. It says (Leave blank to disable). When I remove the zero and leave it blank, the zero comes back when I hit save and it says no changes were made. In the past, people have been able to order successfully. What happened? Did I accidentally change a default? Any help please??? Thanks. Bob

Link to comment
Share on other sites

The phrase "Leave blank to disable" is less than ideally worded. The database column that holds this setting is configured to hold an integer value. That means, even if the INSERT statement has no value for that column, the database engine will use the closest equivalent -- a zero value.

That zero will then be returned when CubeCart makes a SELECT query for data.

So, accept the zero value. CubeCart knows not to enforce a "Maximum purchase quantity" of zero.

The "Maximum purchase quantity" is a recent enhancement for those merchants who sell items that are subject to "panic buying" (disinfectant wipes and toilet paper, most recently).

Edited by bsmither
Link to comment
Share on other sites

Please use a database management utility (such as phpMyAdmin) to examine the structure of the CubeCart database table CubeCart_inventory, the 'minimum_quantity' column. That column should have a default value of 1. The values in 'minimum_quantity' in all the rows should be 1 as well, unless you do have any products where there is a minimum quantity greater than 1 that is being enforced.

When creating a new product, the Pricing tab should have a Minimum Quantity Purchase text entry field that is blank. When that is left as blank, the database table structure (called 'schema') says to use the default value of 1 for 'minimum_quantity' when inserting a new record.

From what I can see, the value for the 'minimum_quantity' column is getting set to zero.

I am specifically mentioning minimum quantity because only if the maximum quantity is greater or equal to the minimum quantity, will the maximum quantity be part of the HTML coding of the Quantity to Add to Basket spinner. Because the minimum quantity is 0, that minimum quantity is equal to the default value of the maximum quantity, thus controlling the spinner's maximum value permitted.

 

Link to comment
Share on other sites

  • 2 weeks later...

Having an issue with this also, where the minimum_quantity column is not being autofilled at 1, but rather, is taking the 0 for being left blank. This is for all new items added to the store as of the last update. I have since gone back and edited phpmyadmin for those columns to behave correctly, but I'd rather it be automatic, rather than something I have to manually do!

Link to comment
Share on other sites

Please use a database management utility (such as phpMyAdmin) to examine the structure of the CubeCart database table CubeCart_inventory, the 'minimum_quantity' column. That column should have a default value of 1.

When creating a new Inventory item, and leaving the Minimum Quantity Purchase field blank, can you verify that a POST value exists for the minimum_quantity form element when Saving?

You can do this by having the browser's Developer Tools open, watching the Network tab. When Saving, a POST line will appear in the Network list. Clicking once on that line will highlight it, and viewing the Parameters sub-tab will show if 'minimum_quantity' is an element in the POST. There should not be 'minimum_quantity' in POST if that field was left blank.

Likewise, have CubeCart in Debug mode (and enter your IP address in the adjacent field - www.showmyip.com). Then when Saving, note the POST array in the first debug section, and also find the INSERT database SQL query for CubeCart_inventory. There should not be 'minimum_quantity' if that field was left blank.

Link to comment
Share on other sites

I said: "There should not be 'minimum_quantity' in POST if that field was left blank."

My experiment (just now) shows that Firefox is, in fact, including 'minimum_quantity' and 'maximum_quantity' form elements in POST. That is really odd. Maybe this was a fundamental misunderstanding of how I thought browsers worked.

Link to comment
Share on other sites

Ok, so, now that we know that CubeCart is getting a zero-length-string (zls) for 'minimum_quantity' and 'maximum_quantity' form elements in POST, we need to deal with that.

Even though the database is getting a zls for an integer type column, that zls is getting converted to zero instead of using the column's default value.

In the admin script products.index.inc.php, find near line 65:

    //Need to remove these in some cases to stop SQL errors
    $records = array('product_id', 'product_weight', 'stock_level', 'stock_warning');
    foreach ($records as $r) {
        if (empty($record[$r]) && !is_numeric($record[$r])) {
            unset($record[$r]);
        }
    }

Change to:

    //Need to remove these in some cases to stop SQL errors
    $records = array('product_id', 'product_weight', 'stock_level', 'stock_warning', 'minimum_quantity', 'maximum_quantity');
    foreach ($records as $r) {
        if (empty($record[$r]) && !is_numeric($record[$r])) {
            unset($record[$r]);
        }
    }

OR, be sure to enter a 1 in the Minimum Quantity Purchase field when entering the prices.

  • Like 1
Link to comment
Share on other sites

I’ll let you know how it goes on my end. So, yes, instead of empty, it was posting 0, making it impossible to add to cart. As you stated, I can manually type a 1 in that field, if I choose, but it’s just another step that interferes with a routine. I appreciate your help, as we all do!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...