$manufacturers_result->MoveNext(); } if (MULTIPLE_CATEGORIES_USE == '1') { $categories_array_selected = array(array('id' => '')); if (isset($_GET['action']) && $_GET['action'] == 'new_product' && isset($_GET['categories'])) { $categories_array_selected = array(array('id' => (int) $_GET['categories'])); } $products_to_categoriestable = $oostable['products_to_categories']; $categories_result_selected = $dbconn->Execute("SELECT categories_id FROM {$products_to_categoriestable} WHERE products_id = '" . $_GET['pID'] . "'"); while ($categories_selected = $categories_result_selected->fields) { $categories_array_selected[] = array('id' => $categories_selected['categories_id']); // Move that ADOdb pointer! $categories_result_selected->MoveNext(); } $categories_array = array(array('id' => '', 'text' => TEXT_NONE)); $categories_array = oos_get_category_tree(); } $tax_class_array = array(); $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE)); $tax_classtable = $oostable['tax_class']; $tax_class_result = $dbconn->Execute("SELECT tax_class_id, tax_class_title FROM {$tax_classtable} ORDER BY tax_class_title"); while ($tax_class = $tax_class_result->fields) { $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']); // Move that ADOdb pointer! $tax_class_result->MoveNext(); } $products_units_array = array(); $products_units_array = array(array('id' => '0', 'text' => TEXT_NONE)); $products_unitstable = $oostable['products_units']; $products_units_result = $dbconn->Execute("SELECT products_units_id, products_unit_name FROM {$products_unitstable} WHERE languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY products_unit_name"); while ($products_units = $products_units_result->fields) {
$ProductSelectOptions .= "<option value='0'> " . $LastOptionTag . "\n"; $ProductSelectOptions .= "<option value='0'> " . $LastOptionTag . "\n"; } } echo "<tr><td><table border='0'>\n"; // Set Defaults if (!isset($add_product_categories_id)) { $add_product_categories_id = 0; } if (!isset($add_product_products_id)) { $add_product_products_id = 0; } // Step 1: Choose Category echo '<tr class="dataTableRow"><form action="' . $_SERVER['PHP_SELF'] . '?oID=' . $oID . '&action=' . $action . '" method="POST">' . "\n"; echo '<td class="dataTableContent" align="right"><b>STEP 1:</b></td><td class="dataTableContent" valign="top">'; echo ' ' . oos_draw_pull_down_menu('add_product_categories_id', oos_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); echo '<input type="hidden" name="step" value="2">'; echo '</td>' . "\n"; echo '</form></tr>' . "\n"; echo '<tr><td colspan="3"> </td></tr>' . "\n"; // Step 2: Choose Product if ($step > 1 && $add_product_categories_id > 0) { echo '<tr class="dataTableRow"><form action="' . $_SERVER['PHP_SELF'] . '?oID=' . $oID . '&action=' . $action . '" method="POST">' . "\n"; echo '<td class="dataTableContent" align="right"><b>STEP 2:</b></td><td class="dataTableContent" valign="top"><select name="add_product_products_id" onChange="this.form.submit();">'; $ProductOptions = '<option value="0">' . ADDPRODUCT_TEXT_SELECT_PRODUCT . "\n"; asort($ProductList[$add_product_categories_id]); foreach ($ProductList[$add_product_categories_id] as $ProductID => $ProductName) { $ProductOptions .= '<option value="' . $ProductID . '"> ' . $ProductName . "\n"; } $ProductOptions = str_replace('value="' . $add_product_products_id . '"', 'value="' . $add_product_products_id . '" selected', $ProductOptions); echo $ProductOptions;
$contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('delete', 'delete_off.gif', IMAGE_DELETE) . ' <a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&pID=' . $pInfo->products_id) . '">' . oos_image_swap_button('cancel', 'cancel_off.gif', IMAGE_CANCEL) . '</a>'); break; case 'move_product': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_PRODUCT . '</b>'); $contents = array('form' => oos_draw_form('products', $aFilename['categories'], 'action=move_product_confirm&categories=' . $categories) . oos_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_PRODUCTS_INTRO, $pInfo->products_name)); $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENT_CATEGORIES . '<br /><b>' . oos_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br />' . sprintf(TEXT_MOVE, $pInfo->products_name) . '<br />' . oos_draw_pull_down_menu('move_to_category_id', oos_get_category_tree(), $current_category_id)); $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('move', 'move_off.gif', IMAGE_MOVE) . ' <a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&pID=' . $pInfo->products_id) . '">' . oos_image_swap_button('cancel', 'cancel_off.gif', IMAGE_CANCEL) . '</a>'); break; case 'copy_to': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>'); $contents = array('form' => oos_draw_form('copy_to', $aFilename['categories'], 'action=copy_to_confirm&categories=' . $categories) . oos_draw_hidden_field('products_id', $pInfo->products_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '<br />' . TEXT_INFO_CURRENT_CATEGORIES . '<br /><b>' . oos_output_generated_category_path($pInfo->products_id, 'product') . '</b>'); $contents[] = array('text' => '<br />' . TEXT_CATEGORIES . '<br />' . oos_draw_pull_down_menu('categories_id', oos_get_category_tree(), $current_category_id)); $contents[] = array('text' => '<br />' . TEXT_HOW_TO_COPY . '<br />' . oos_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br />' . oos_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('text' => '<br />' . oos_image(OOS_IMAGES . 'pixel_black.gif', '', '100%', '3')); $contents[] = array('text' => '<br />' . TEXT_COPY_ATTRIBUTES_ONLY); $contents[] = array('text' => '<br />' . TEXT_COPY_ATTRIBUTES . '<br />' . oos_draw_radio_field('copy_attributes', 'copy_attributes_yes', true) . ' ' . TEXT_COPY_ATTRIBUTES_YES . '<br />' . oos_draw_radio_field('copy_attributes', 'copy_attributes_no') . ' ' . TEXT_COPY_ATTRIBUTES_NO); $contents[] = array('align' => 'center', 'text' => '<br />' . oos_image_swap_submits('copy', 'copy_off.gif', IMAGE_COPY) . ' <a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&pID=' . $pInfo->products_id) . '">' . oos_image_swap_button('cancel', 'cancel_off.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . oos_image_swap_button('edit', 'edit_off.gif', IMAGE_EDIT) . '</a> <a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . oos_image_swap_button('delete', 'delete_off.gif', IMAGE_DELETE) . '</a> <a href="' . oos_href_link_admin($aFilename['categories'], 'categories=' . $categories . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . oos_image_swap_button('move', 'move_off.gif', IMAGE_MOVE) . '</a>'); $contents[] = array('text' => TEXT_CATEGORIES . ' ' . oos_get_categories_name($categories) . ' ' . oos_get_categories_name($cID) . '<br />' . TEXT_DATE_ADDED . ' ' . oos_date_short($cInfo->date_added)); if (oos_is_not_null($cInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . oos_date_short($cInfo->last_modified));
$stock_i++; // we're de-re-activating the selected products if (isset($_POST['update_status']) && !empty($_POST['update_status'])) { if ($items['stock'] >= 1) { $productstable = $oostable['products']; $dbconn->Execute("UPDATE {$productstable} SET products_status = '3' WHERE products_id = '" . $key . "'"); $status_a++; } else { $productstable = $oostable['products']; $dbconn->Execute("UPDATE {$productstable} SET products_status = '0' WHERE products_id = '" . $key . "'"); $status_d++; } } } } $tree = oos_get_category_tree(); $dropdown = oos_draw_pull_down_menu('cat_id', $tree, $_POST['cat_id'], 'onChange="this.form.submit();"'); ?> <br /> <table border="0"> <tr><?php echo oos_draw_form('stockupdate', $aFilename['quick_stockupdate']); ?> <th class="smallText" align="left" valign="top">Categories:<br /><?php echo $dropdown; ?> </form></th> </tr> </table> </td> </tr>
function oos_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (count($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); } // Get database information $dbconn =& oosDBGetConn(); $oostable =& oosDBGetTables(); if ($include_itself) { $categories_descriptiontable = $oostable['categories_description']; $query = "SELECT cd.categories_name\n FROM {$categories_descriptiontable} cd\n WHERE cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "'\n AND cd.categories_id = '" . intval($parent_id) . "'"; $category_result =& $dbconn->Execute($query); $category = $category_result->fields; $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); // Close result set $category_result->Close(); } $categoriestable = $oostable['categories']; $categories_descriptiontable = $oostable['categories_description']; $query = "SELECT c.categories_id, cd.categories_name, c.parent_id\n FROM {$categoriestable} c,\n {$categories_descriptiontable} cd\n WHERE c.categories_id = cd.categories_id\n AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "'\n AND c.parent_id = '" . intval($parent_id) . "'\n ORDER BY c.sort_order, cd.categories_name"; $categories_result =& $dbconn->Execute($query); while ($categories = $categories_result->fields) { if ($exclude != $categories['categories_id']) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); } $category_tree_array = oos_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); // Move that ADOdb pointer! $categories_result->MoveNext(); } // Close result set $categories_result->Close(); return $category_tree_array; }