oxwivi Posted January 28, 2012 Share Posted January 28, 2012 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. Quote Link to comment Share on other sites More sharing options...
oxwivi Posted February 7, 2012 Author Share Posted February 7, 2012 (edited) 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 February 7, 2012 by oxwivi Quote Link to comment Share on other sites More sharing options...
Guest Posted February 23, 2013 Share Posted February 23, 2013 @@oxwivi can you possibly tell me what code you need to change to get this to work on 2.3.1? please as i need this for my store to work but cannot get it to work and its driving me crazy!! i think the problem lies in step 13,14,15 where it tells me to update lines that dont exist on my index page? many thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted November 9, 2014 Share Posted November 9, 2014 After hours of trying to figure it out, changing the code, and changing the code again and again tried something else. It worked. All of this is on 2.3.4 now - moved from 2.2RC2a The only thing that would not work was shopping cart. It would display warning but not update quantity. Just move the code up and it works fine. //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->update_quantity($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 $products_name .= '<br /><br />' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . tep_draw_button(IMAGE_BUTTON_UPDATE, 'refresh') . ' ' . TEXT_OR . '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product') . '">' . TEXT_REMOVE . '</a>'; $products_name .= ' </td>' . ' </tr>' . '</table>';// THIS IS WHERE MINIMUM QUANTITY CODE WAS ON 2.2 AND ALL I DID WAS MOVE IT UP ABOVE THE PRODUCTS_NAME SECTION ABOVE AND IT STARTED WORKING FINE. EVEN UPDATING THE QUANTITY TO 1 CHANGED IT BACK TO MINIMUM QTY Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.