Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I have installed the contribution Minimum Product Quantity with Admin but I need also to have a maximum of weeks for the products we sell (language courses). That's why I have tried to transform the contribution so that I can offer courses that can be booked for a time between e.g. 3 and 8 weeks.

 

I have got, more or less, that the things work, but I have a problem. When I use following code in catalog/shopping_cart.php

 

//Min_Max quantity code
if(MAXIMUM_ORDERS == 'true'){
  $max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
  $min_order_query = tep_db_query("select p.minorder as min_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");

while ($max_order = tep_db_fetch_array($max_order_query))  {
  if ($products[$i]['quantity'] > $max_order['max_quant'] ) {
		$products[$i]['max_quant']=$max_order['max_quant'];
  }
}
 if ($products[$i]['quantity'] > $products[$i]['max_quant'] ) {
 	$products[$i]['quantity']=$products[$i]['max_quant'];
	$cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']);
	$cart_notice = sprintf(MAXIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["max_quant"],$products[$i]['attributes']);
}

while ($min_order = tep_db_fetch_array($min_order_query))  {
  if ($products[$i]['quantity'] < $min_order['min_quant'] ) {
		$products[$i]['min_quant']=$min_order['min_quant'];
  }
}

	 if ($products[$i]['quantity'] < $products[$i]['min_quant'] ) {
 	$products[$i]['quantity']=$products[$i]['min_quant'];
	$cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']);
	$cart_notice = sprintf(MINIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["min_quant"],$products[$i]['attributes']);
}

}
//End Min_Max quantity code

 

everything seems to work fine and I can put less than the minimum or more than the maximum weeks in the shopping cart, and the cart shows up the right quantity (min or max), but... when I leave the shopping_cart site in order to continue shopping and come back to her (cart contents), it falls ALWAYS to the minimum, the right quantity doesn't remains there.

 

Can anyone of you see a solution for this problem? thanks :blush:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...