Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Minimum Total Order Quantity


edtiger

Recommended Posts

Minimum Total Order Quantity is an adaptation of the minimum order total contribution for sites which need a minimum total quantity. This is not a minimum quantity per product but a minimum total quantity. The contribution uses the calculation of total items in the order and checks that total against the minimum number set in the admin configuration area.

Link to comment
Share on other sites

I don't anticipate many people will need help with this contrib-it's very straight forward and should work on your site even if it has been heavily modified (mine is). Nevertheless, if you have any questions please post to this form and I will try to help out.

 

The contribution adds one database entery in the configuration table and adds a only a few lines of code to 6 files.

 

Get the contribution here: Minimum Total Order Quantity

Edited by edtiger
Link to comment
Share on other sites

  • 2 weeks later...

Small Fix

 

Change

STEP 3: run the following sql query

INSERT INTO `wholesale_configuration` VALUES ('', 'Minimum Total Order Quantity', 'MIN_TOTAL_ORDER_QUANTITY', '12', 'The minimum total quantity an order must be able to checkout.  Only set this if you require an minimum of total items. Empty means no minimum.', 1, 30, '', '', NULL, NULL);

 

to

STEP 3: run the following sql query

INSERT INTO `configuration` VALUES ('', 'Minimum Total Order Quantity', 'MIN_TOTAL_ORDER_QUANTITY', '12', 'The minimum total quantity an order must be able to checkout.  Only set this if you require an minimum of total items. Empty means no minimum.', 1, 30, '', '', NULL, NULL);

 

I have different database table names to accomodate multiple shops in one database. This fix should help everyone with the default table names.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

in the admin page select

Configuration > My Store

 

Search for "Minimum Total Order Quantity" and edit the number according to your needs. No it cannot be used as a minimum for categories. It only makes sure that the total quantity in the cart of all products combined reaches the minimum total you set.

 

SORRY it took me so long to reply. For some reason I never received the auto notify that a post had occured to this forum.

Link to comment
Share on other sites

  • 1 month later...
No it cannot be used as a minimum for categories.

 

 

Hello, thank you for your contribution.

 

I was wondering if it would be difficult to modify this contribution to be category specific. Seems like a if/else statement could be added to check for a certain category, but i would be unclear of the syntax.

 

In the store im working on, they have around 600 products, of which 450 or so are signs. The signs are all the same price, but they require a min. of 25 items per order for the signs only, does not have to be 25 of the same exact item. The rest of their items are 1-3 item min.

 

Thanks for any advice you can provide w/ this.

 

FrikFrak

Edited by FrikFrak
Link to comment
Share on other sites

Try adding a function to catalog/includes/classes/shopping_cart.php that looks something like this:

 

	function count_cat_contents() {  // get total number of items in cart
  $total_items = 0;
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) { //modify this line so it only collects quantities from products within desired category
	  $total_items += $this->get_quantity($products_id);
	}
  }

  return $total_items;
}

 

Then change all the code in my setup file to the following:

 

  if ($cart->count_cat_contents() < MIN_TOTAL_ORDER_QUANTITY) {

 

That should get you started. I wouldn't know exactly how to do it without coding the fix myself...

Link to comment
Share on other sites

Great, sorry for slow response,

 

Thank you for you assistance, and advice.

 

Ive added the code above, and changed the few spots as you suggested, but when attempting to checkout, i get this error...

 

Fatal error: Call to undefined function: count_cat_contents() in category/checkout_shipping.php

 

i tried moving the function from catalog/includes/class/shopping_cart.php to category/checkout_shipping.php and get the same error

 

any ideas ? lol got me boggled cause the function name, and the calls to that function are the same, another words no typos.... and its there so im unsure why it says its undifined.

 

also, the category id # is 1 that im checking for, im unclear exactly where to add that in that line, when i try where i think it should be, it gives parse errors...

 

Thanks again for your help

-John

Edited by FrikFrak
Link to comment
Share on other sites

ok that was dumb on my part i see, i added the function in the wrong file....

 

anyway, could someone tell me how to add category id # 1 to this line ? ive tried bout everything, and i keep getting parse errors expected blah blah

 

while (list($products_id, ) = each($this->contents)) {

 

Please, anyone ?

 

thanks

-John

Link to comment
Share on other sites

  • 3 weeks later...
ok that was dumb on my part i see, i added the function in the wrong file....

 

anyway, could someone tell me how to add category id # 1 to this line ? ive tried bout everything, and i keep getting parse errors expected blah blah

 

while (list($products_id, ) = each($this->contents)) {

 

Please, anyone ?

 

thanks

-John

 

You will want to add a database query somewhere in here like this:

 

 

$products_query = tep_db_query("select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "'");

 

The category id is not being retrieved from the database so you first need to grab it so you can use it to check against the category id of products in the shopping cart. This should get you started. I don't know how to do the rest of it without doing it myself to an install of oscommerce.

Link to comment
Share on other sites

  • 2 months later...

I'm getting this error, any ideas? This is on the checkout_shipping.php file after I've clicked continue.

 

TEXT_ORDER_UNDER_MIN_QUANTITY_AMOUNT

Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/mysite.com/httpdocs/store/checkout_shipping.php:68) in /home/httpd/vhosts/mysite.com/httpdocs/store/includes/functions/general.php on line 29

 

On the checkout_shipping.php page itself, it has TEXT_ORDER_UNDER_MIN_QUANTITY_AMOUNT above my logo.

 

I did see the red error message, but I was trying to be a customer and pretended to miss it so I could see what happens.

 

Any ideas?

Link to comment
Share on other sites

First check to make sure there are no extra line breaks at the end of your checkout_shipping.php and general.php files after the

?>

tag. If there are extra line breaks, it will often give an error similar to the one you mention.

 

TEXT_ORDER_UNDER_MIN_QUANTITY_AMOUNT means you haven't added the variable to your checkout_shipping.php english file. Add this variable to that file and that should go away.

Edited by edtiger
Link to comment
Share on other sites

  • 4 years later...

Hi

 

I know this is old - but I installed it on my old oscommerce site - the message comes up fine in the cart saying that there is a minimum - but you can still press checkout and go through the whole process with less items in the cart. Is this module meant to make it impossible to check out unless the minimum is met? Im using FF 3.6.12.

 

Thanks in advance!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...