OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: Sort By Alphabetical Order In Admin List
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Contribution Development
Jayman11
Ok I have taken 2 mods and put them together to get what i want working good. I installed Product Cost mod and from there added the Product Inventory Editor which gives you the ability to edit the item price, weight and quantity all from one page for all items. I added some coding from that Product Cost mod into so that I can now edit all of that from one place with those other items. Now, here is my question....Is there a code i can add to sort those items by alphabetical order? They seem to be pretty random.

Thanks,
Jason
Jayman11
Here is the code I am looking at. I believe it is one of these that needs to have something added to it. Just not 100% sure what or where. I'm thinking the first query is for the Search box at the top of my admin page and the 2nd query is the one that i need to change and the 3rd query is just for the database.

Jason

CODE
if($_REQUEST['prod_search']!="")
{
$product_query = tep_db_query("select pd.products_name, p.products_id, p.products_price, p.products_quantity, p.products_model, p.products_weight, p.products_cost from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and pd.products_name like '".$_REQUEST['prod_search']."%'");
}
else
{
$product_query = tep_db_query("select pd.products_name, p.products_id, p.products_price, p.products_quantity, p.products_model, p.products_weight, p.products_cost from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
}
if($_REQUEST['update']=="update")
{
while($product1 = tep_db_fetch_array($product_query))
{

$str=tep_db_query("update products set products_price='".$_REQUEST['price_'.$product1['products_id']]."',products_weight='".$_REQUEST['weight_'.$product1['products_id']]."', products_quantity='".$_REQUEST['qty_'.$product1['products_id']]."', products_cost='".$_REQUEST['cost_'.$product1['products_id']]."' where products_id='".$product1[products_id]."'");

}
header("location:product_list.php?Update=Success&prod_search=".$_REQUEST['prod_search']);

}
?>
Jayman11
Nevermind...answered my own question.....changed the end of the 2nd query to read:

CODE
(int)$languages_id . "'order by p.products_model");


and works perfect for alphabetical sorting for me.

Jason
Davefromcornwall
I changed the same bit of code to:

CODE
(int)$languages_id . "'order by pd.products_name");


Your fix didn't appear to do anything on my version of this very useful contribution. Now the Product List is in product name alphabetical order.

Both of our fixes may work for some people, so they can try both and see which works for them.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.