// these are the columns in the table
$columns = array("#" => "width=\"20\"", "<input type=\"checkbox\" name=\"toggle\" value=\"\" onclick=\"checkAll(" . $num_rows . ")\" />" => "width=\"20\"", $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_NAME') => 'width="25%"', $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_DESCRIPTION') => 'width="30%"', $VM_LANG->_('PHPSHOP_PRODUCT_TYPE_FORM_PARAMETERS') => 'width="15%"', $VM_LANG->_('PHPSHOP_PRODUCTS_LBL') => 'width="15%"', $VM_LANG->_('PHPSHOP_PRODUCT_LIST_PUBLISH') => 'width="5%"', $VM_LANG->_('PHPSHOP_MODULE_LIST_ORDER') => 'width="5%"', $VM_LANG->_('E_REMOVE') => "width=\"5%\"");
$listObj->writeTableHeader($columns);
$i = 0;
while ($db->next_record()) {
    $product_count = $ps_product_type->product_count($db->f("product_type_id"));
    $parameter_count = $ps_product_type->parameter_count($db->f("product_type_id"));
    $listObj->newRow();
    // The row number
    $listObj->addCell($pageNav->rowNumber($i));
    // The Checkbox
    $listObj->addCell(vmCommonHTML::idBox($i, $db->f("product_type_id"), false, "product_type_id"));
    $tmp_cell = "<a href=\"" . $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_type_form&product_type_id=" . $db->f("product_type_id") . "\">" . $db->f("product_type_name") . "</a>";
    $listObj->addCell($tmp_cell);
    $listObj->addCell($db->f("product_type_description"));
    $tmp_cell = $parameter_count . " " . $VM_LANG->_('PHPSHOP_PARAMETERS_LBL') . " <a href=\"" . $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_type_parameter_list&product_type_id=" . $db->f("product_type_id") . "\">[ " . $VM_LANG->_('PHPSHOP_SHOW') . " ]</a>";
    $listObj->addCell($tmp_cell);
    $tmp_cell = $product_count . " " . $VM_LANG->_('PHPSHOP_PRODUCTS_LBL') . "&nbsp;<a href=\"" . $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_list&product_type_id=" . $db->f("product_type_id") . "\">[ " . $VM_LANG->_('PHPSHOP_SHOW') . " ]</a>";
    $listObj->addCell($tmp_cell);
    //$listObj->addCell( $db->f("list_order"));
    $listObj->addCell(vmCommonHTML::getYesNoIcon($db->f("product_type_publish")));
    //      echo "<a href=\"javascript: void(0);\" onClick=\"return listItemTask('cb$i','orderdown')\">";
    //      echo "Down</a>";
    $tmp_cell = "<div align=\"center\">" . $pageNav->orderUpIcon($i, $i > 0, "orderup", $VM_LANG->_('CMN_ORDER_UP'), $page, "ProductTypeReorder") . "\n&nbsp;" . $pageNav->orderDownIcon($i, $db->num_rows(), $i - 1 <= $db->num_rows(), "orderdown", $VM_LANG->_('CMN_ORDER_DOWN'), $page, "ProductTypeReorder") . "</div>";
    $listObj->addCell($tmp_cell);
    $listObj->addCell($ps_html->deleteButton("product_type_id", $db->f("product_type_id"), "ProductTypeDelete", $keyword, $limitstart));
    $i++;
}
$listObj->writeTable();
$listObj->endTable();
$listObj->writeFooter($keyword);
        }
        if (!$downCondition || !$upCondition) {
            if ($levelcounter[$categories[$row_list[$n]]["category_parent_id"]] > $levels[$depth_list[$n] + 1]) {
                $downCondition = true;
            }
            if ($levels[$depth_list[$n] + 1] > 1) {
                $upCondition = true;
            }
            if ($levelcounter[$categories[$row_list[$n]]["category_parent_id"]] == $levels[$depth_list[$n] + 1]) {
                $upCondition = true;
                $downCondition = false;
            }
            if ($levelcounter[$categories[$row_list[$n]]["category_parent_id"]] < $levels[$depth_list[$n] + 1]) {
                $downCondition = false;
                $upCondition = false;
            }
        }
        $levels[$depth_list[$n] + 1]++;
        $listObj->addCell($pageNav->orderUpIcon($ibg, $upCondition, 'orderup', $VM_LANG->_('CMN_ORDER_UP'), $page, 'reorder') . '&nbsp;' . $pageNav->orderDownIcon($ibg, $levelcounter[$categories[$row_list[$n]]["category_parent_id"]], $downCondition, 'orderdown', $VM_LANG->_('CMN_ORDER_DOWN'), $page, 'reorder'));
        $listObj->addCell(vmCommonHTML::getOrderingField($categories[$row_list[$n]]["list_order"]));
    } else {
        $listObj->addCell('&nbsp;');
        $listObj->addCell('&nbsp;');
    }
    $listObj->addCell($ps_html->deleteButton("category_id", $categories[$row_list[$n]]["category_child_id"], "productCategoryDelete", $keyword, $limitstart));
    $listObj->addCell($categories[$row_list[$n]]["category_child_id"]);
    $ibg++;
}
$listObj->writeTable();
$listObj->endTable();
$listObj->writeFooter($keyword);