oakhill Posted February 15, 2007 Share Posted February 15, 2007 Hi I have installed two different Stock Update Contributions - Stockupdate and Quick Price Update (with the stock update facility). Both work fine however they are not sorting alphabetically which is a problem as I sometimes have over a hundred products in a section. Has someone altered this contribs to sort alphabetically by product name.? I am not even sure what they are sorting by as the products are all over the place. Both contribs are fantastic and I will use them if I can get them to sort! Below is the code for the stockupdate.php which is the only file installed exp for the language one. Help!!! */ include('includes/application_top.php'); /// optional parameter to set max products per row: $max_cols = 6; ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"> <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table> </td> <!-- body_text //--> <td width="100%" height="300" valign="top"> <table style="border:none" border="0" width="100%" align="center"><tr><td class="smalltext"> <?php // we've done nothing cool yet... $msg_stack = '' . TEXT_FETCH_DB . ''; if ($HTTP_POST_VARS['stock_update']) { //set counter $stock = 0; $status_a = 0; $status_d = 0; while (list($key, $value) = each($stock_update)) { // update the quantity in stock $update = tep_db_query("UPDATE products SET products_quantity = $value WHERE products_id = $key"); $stock_i++; // we're de-re-activating the selected products if ($HTTP_POST_VARS['update_status']) { if ($value >= 1 ) { $dereac = tep_db_query("UPDATE products SET products_status = 1 WHERE products_id = $key"); $status_a++; }else{ $dereac = tep_db_query("UPDATE products SET products_status = 0 WHERE products_id = $key"); $status_d++; } } } $msg_stack = '<br>' . UPDATED_QUANTITY . ' ' . $stock_i . ' ' . UQ_PRODUCTS . '<br>' . ACTIVATED_STATUS . ' ' . $status_a . ' ' . UQ_PRODUCTS . '<br>' . DE_ACTIVATED_STATUS . ' ' . $status_d . ' products</class>'; } ?> <tr> <td class="pageHeading" align="left"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> <table border="0" width="90%" align="center"><tr><td class="smalltext"> <br><form method="post" action="stockupdate.php"> <?php // first select all categories that have 0 as parent: $sql = tep_db_query("SELECT c.categories_id, cd.categories_name from categories c, categories_description cd WHERE c.parent_id = 0 AND c.categories_id = cd.categories_id AND cd.language_id = $languages_id"); echo '<table border="0" align="center"><tr>'; while ($parents = tep_db_fetch_array($sql)) { // check if the parent has products $check = tep_db_query("SELECT products_id FROM products_to_categories WHERE categories_id = '" . $parents['categories_id'] . "'"); if (tep_db_num_rows($check) > 0) { $tree = tep_get_category_tree(); $dropdown= tep_draw_pull_down_menu('cat_id', $tree, '', 'onChange="this.form.submit();"'); //single $all_list = '<form method="post" action="stockupdate.php"><th class="smallText" align="left" valign="top">' . TEXT_ALL_CATEGORIES . '<br>' . $dropdown . '</form></th>'; } else { // get the tree for that parent $tree = tep_get_category_tree($parents['categories_id']); // draw a dropdown with it: $dropdown = tep_draw_pull_down_menu('cat_id', $tree, '', 'onChange="this.form.submit();"'); $list .= '<form method="post" action="stockupdate.php"><th class="smallText" align="left" valign="top">' . $parents['categories_name'] . '<br>' . $dropdown . '</form></th>'; } } echo $list . $all_list . '</form></tr></table><p>'; // see if there is a category ID: if ($HTTP_POST_VARS['cat_id']) { // start the table echo '<form method="post" action="stockupdate.php"><table border="0" width="100%"><tr>'; $i = 0; // get all active prods in that specific category $sql2 = tep_db_query("SELECT p.products_id, p.products_model, p. products_quantity, p.products_status, p.products_image, pd.products_name from products p, products_to_categories ptc, products_description pd where p.products_id = ptc.products_id and p.products_id = pd.products_id and language_id = $languages_id and ptc.categories_id = '" . $HTTP_POST_VARS['cat_id'] . "'"); while ($results = tep_db_fetch_array($sql2)) { $i++; echo '<td class="main" align="center">' . tep_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $results['products_image'], 'ID ' . $results['products_id'] . ': ' . $results['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>'; echo '<font size="1" color="#ff0000"><b>' . $results['products_model'] . '</b></font><br>' . $results['products_name'] . '<br>'; echo '<input type="text" size="3" name="stock_update[' . $results['products_id'] . ']" value="' . $results['products_quantity'] . '">'; echo (($results['products_status'] == 0) ? ' ' . tep_image(DIR_WS_LANGUAGES . $language . '/images/' . 'blokje_niet_actief.gif') . ' ' : ' ' . tep_image(DIR_WS_LANGUAGES . $language . '/images/' . 'blokje_actief.gif') . ' '); // echo (($results['products_status'] == 0) ? ' <img src="' . DIR_WS_LANGUAGES . $language . '/images/' . 'blokje_niet_actief.gif' . '"> ' : ' <img src="' . DIR_WS_LANGUAGES . $language . '/images/' . 'blokje_actief.gif' . '"> '); echo '</i></td>'; if ($i == $max_cols) { echo '</tr><tr>'; $i =0; } } echo '<input type="hidden" name="cat_id" value="' . $HTTP_POST_VARS['cat_id'] . '">'; echo '</tr><td class="smalltext" align="center" colspan="10"><br><br><br><br>'; echo '<input type="checkbox" name="update_status">' . TEXT_STOCK_UPDATE . '<p>'; echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . '</td></tr><td class="main" colspan="30" align="left"><br><b>' . LAST_ACTION . '</b><br>' . $msg_stack . '</b></font></td></tr></form>'; } ?> </tr></table> </td> </tr></table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> 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.
Note: Your post will require moderator approval before it will be visible.