Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Porting 2.2 addon - Minimum Product Quantity - to 2.3


  • You cannot reply to this topic
1 reply to this topic

#1 oxwivi

  • Community Member
  • 224 posts
  • Real Name:Oxwivi Oxwil

Posted 28 January 2012, 17:57

I started using osC with 2.3.1 and require the usage of this addon, Minimum Product Quantity with Admin, made for osC 2.2. Downloading the addons gives only a text file with the codes and instructions to add to osC - I've made it available on Pastebin.com.

Since I don't know how the structure of osC have changed since 2.2, I've no idea how to go about it. Please guide me.

#2 oxwivi

  • Community Member
  • 224 posts
  • Real Name:Oxwivi Oxwil

Posted 07 February 2012, 17:16

I'm successfully using this on a stock osC 2.3.1 installation. With a few minor changes in the code to conform with the 2.3 install it worked like a charm. If anyone is interested in releasing the addon as 2.3 compatible, please feel free to contact me.

Additionally, I would like to request a bit of help from the more coding-friendly osC brethren to refine a feature of this addon. Currently this piece of code takes care of changing the quantity to the minimum specified at the shopping cart:

//Minimum quantity code
	if(MINIMUM_ORDERS == 'true'){
	  $min_order_query = tep_db_query("select p.minorder as min_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
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"]);
}
}
//End Minimum quantity code

The thing is, only the warning appears that it's below the MOQ and that it's changing it to the minimum quantity. But the quantity boxes does not reflect the change until the page is refreshed or the user navigates away and returns to the cart. How do I make it so the quantity boxes are immediately updated?

Edited by oxwivi, 07 February 2012, 17:17.