/**
  * Creates the Quantity Input Boxes/Radio Buttons/Lists for Products
  *
  * @param int $product_id The Parent Product ID
  * @param int $prod_id The actual Product ID
  * @param string $child
  * @param string $use_parent
  * @return string
  */
 function show_quantity_box($product_id, $prod_id, $child = false, $use_parent = 'N')
 {
     global $VM_LANG;
     $tpl = vmTemplate::getInstance();
     if ($child == 'Y') {
         //We have a child list so get the current quantity;
         $quantity = 0;
         for ($i = 0; $i < $_SESSION["cart"]["idx"]; $i++) {
             if ($_SESSION['cart'][$i]["product_id"] == $prod_id) {
                 $quantity = $_SESSION['cart'][$i]["quantity"];
             }
         }
     } else {
         $quantity = vmrequest::getInt('quantity', 1);
     }
     // Detremine which style to use
     if ($use_parent == 'Y' && !empty($product_id)) {
         $id = $product_id;
     } else {
         $id = $prod_id;
     }
     //Get style to use
     $product_in_stock = ps_product::get_field($id, 'product_in_stock');
     $quantity_options = ps_product::get_quantity_options($id);
     extract($quantity_options);
     //Start output of quantity
     //Check for incompatabilities and reset to normal
     if (CHECK_STOCK == '1' && !$product_in_stock) {
         $display_type = 'hide';
     }
     if (empty($display_type) || @$display_type == "hide" && $child == 'Y' || @$display_type == "radio" && $child == 'YM' || @$display_type == "radio" && !$child) {
         $display_type = "none";
     }
     unset($quantity_options['display_type']);
     $tpl->set('prod_id', $prod_id);
     $tpl->set('quantity', $quantity);
     $tpl->set('display_type', $display_type);
     $tpl->set('child', $child);
     $tpl->set('quantity_options', $quantity_options);
     //Determine if label to be used
     $html = $tpl->fetch('product_details/includes/quantity_box_general.tpl.php');
     return $html;
 }
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
require_once CLASSPATH . 'ps_order_status.php';
$ps_order_status = new ps_order_status();
$order_status_id = vmrequest::getInt('order_status_id', 0);
$option = empty($option) ? vmGet($_REQUEST, 'option', 'com_virtuemart') : $option;
//First create the object and let it print a form heading
$formObj = new formFactory($VM_LANG->_('PHPSHOP_ORDER_STATUS_FORM_LBL'));
//Then Start the form
$formObj->startForm();
$readonly = '';
if (!empty($order_status_id)) {
    $q = "SELECT * FROM #__{vm}_order_status WHERE order_status_id='{$order_status_id}'";
    $db->query($q);
    $db->next_record();
    if (in_array($db->f('order_status_code'), $ps_order_status->_protected_status_codes)) {
        $readonly = 'readonly="readonly"';
    }
}
?>