And if possible a column with the price including taxes?
Quickly Update Product Stock
#41
Posted 23 August 2005 - 10:19 AM
And if possible a column with the price including taxes?
#42
Posted 14 September 2005 - 11:37 PM
Quote
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); '<a href="' . tep_href_link(FILENAME_QUICK_STOCKUPDATE, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_QUICK_STOCKUPDATE . '</a><br>' . }the last "}" is line 31
I have tried changing the last
'</a><br>'.to look like this instead:
'</a>'with no change in result.
This must be something so simple I'm going to smack myself but I can't seem to grasp it. Any help appreciated. This Contribution will be handy for me if I can get it running.
Thanks!
#43
Posted 14 September 2005 - 11:50 PM
#44
Posted 14 September 2005 - 11:51 PM
Quote
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); '<a href="' . tep_href_link(FILENAME_QUICK_STOCKUPDATE, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_QUICK_STOCKUPDATE . '</a><br>' . }the last "}" is line 31
I have tried changing the last
'</a><br>'.to look like this instead:
'</a>'with no change in result.
This must be something so simple I'm going to smack myself but I can't seem to grasp it. Any help appreciated. This Contribution will be handy for me if I can get it running.
Thanks!
#45
Posted 27 September 2005 - 03:41 PM
any ideas how i can make it show both?
if not i have to go into each product to check the price
Please! someone... anyone........dont make me beg!
#46
Posted 05 October 2005 - 01:22 PM
when you have 0 of number of Order of the default language of your web
then no show the categories drop-menu to select the categories to changed
The solution of changed the number in /admin/quick_stockupdate.php in the line 112: ".... AND cd.language_id = 1")" the 1 to 0 no work,
if you have Order:1 an you "..language_id = 1")" ..." yes,
and with other number too
but only with 0 no works.
any know how to resolve this?
thanks for this great contributions
#47
Posted 12 October 2005 - 10:26 PM
Warning: Variable passed to each() is not an array or object in /~path~/quick_stockupdate.php on line 90
Lines 90 Through 94
while (list($key, $items) = each($stock_update)) {
// update the quantity in stock
$sql = "UPDATE products SET products_quantity = '".$items['stock']."', products_model = '".$items['model']."', products_price = '".$items['price']."', products_weight = '".$items['weight']."' WHERE products_id = $key";
$update = tep_db_query($sql);
$stock_i++;
Help ^.^;;
#48
Posted 17 October 2005 - 02:25 AM
#49
Posted 26 April 2006 - 04:56 PM
Hkanaris, on Aug 23 2005, 04:08 PM, said:
Does anyone know how?
If you want to sort it differently than it is now, do the following:
/admin/quick_stockupdate.php
Find:
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by pd.products_name");
And change the end (ie. change order by pd.products_name) to order by any value that you wish, for example if you wish to make it sort my product's id, then change it to look like this:
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by p.products_id");
#50
Posted 12 October 2006 - 06:34 PM
Is there anyone who could point me in the right direction as to what I would need to add to the sql query????
Thanks
#51
Posted 13 October 2006 - 06:57 AM
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>' . '<a href="' . tep_href_link(FILENAME_QUICK_STOCKUPDATE, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_QUICK_STOCKUPDATE . '</a>' ); }
that should fix it!
methodprobiz, on Sep 15 2005, 12:37 AM, said:
In the catalog.php file I have:
'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>'); '<a href="' . tep_href_link(FILENAME_QUICK_STOCKUPDATE, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_QUICK_STOCKUPDATE . '</a><br>' . }the last "}" is line 31
I have tried changing the last
'</a><br>'.to look like this instead:
'</a>'with no change in result.
This must be something so simple I'm going to smack myself but I can't seem to grasp it. Any help appreciated. This Contribution will be handy for me if I can get it running.
Thanks!
Edited by jacklawry, 13 October 2006 - 07:00 AM.
#52
Posted 11 March 2007 - 01:19 AM
Quote
Warning: Variable passed to each() is not an array or object in /~path~/quick_stockupdate.php on line 90
I've installed Version 2.5. and I'm getting this problem as well, does anyone have a solution for it?
#53
Posted 19 March 2007 - 12:24 PM
dr_lucas, on Apr 26 2006, 04:56 PM, said:
/admin/quick_stockupdate.php
Find:
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by pd.products_name");
And change the end (ie. change order by pd.products_name) to order by any value that you wish, for example if you wish to make it sort my product's id, then change it to look like this:
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by p.products_id");I think this guy ment adding the sort order added by the product sort order contrib? If so I have done this but I am no programmer and im having trouble getting the coloum to display the sort order? can anybody help? this is what i have so far
<?php
/*
$Id: product_updates.php,v 1.1 2005/02/12 Exp $
osCommerce
http://www.oscommerce.com
Copyright (c) 2005
Released under the GNU General Public License\
*/
require('includes/application_top.php');
require(DIR_WS_CLASSES . 'currencies.php');
define('FIELD_SIZE', 6);
define('FIELD_SIZE_MODEL', 12);
$currencies = new currencies();
$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
if ($HTTP_GET_VARS['action'] == 'update') {
// Get all productions first to make sure we are not updating products that did not change
foreach ($_POST['event_record'] as $id => $row) {
$products_query = tep_db_query("SELECT * from " . TABLE_PRODUCTS);
$products = array();
while($product = tep_db_fetch_array($products_query))
{
$products[$product['products_id']] = array(
'products_id' => $product['products_id'],
'products_price' => number_format($product['products_price'], 2),
'products_model' => $product['products_model'],
'products_weight' => number_format($product['products_weight'], 1),
'products_sort_order' => number_format($product['products_sort_order'], 0),
'products_quantity' => number_format($product['products_quantity'], 0)
);
}
if( strcasecmp($products[$row['products_id']]['products_price'], $row['products_price']) != 0 ||
strcasecmp($products[$row['products_id']]['products_model'], $row['products_model']) != 0 ||
strcasecmp($products[$row['products_id']]['products_weight'], $row['products_weight']) != 0 ||
strcasecmp($products[$row['products_id']]['products_sort_order'], $row['products_sort_order']) != 0 ||
strcasecmp($products[$row['products_id']]['products_quantity'], $row['products_quantity']) != 0
) {
/*
echo "product " . $row['products_id'] . " will be updated<br/>";
print_r($products[$row['products_id']]);
echo "<br/>";
print_r($row);
echo "<br/>";
continue;
*/
tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_price = '" . $row['products_price'] . "', products_model = '" . $row['products_model'] . "', products_weight = '" . $row['products_weight'] . "', products_sort_order = '" . $row['products_sort_order'] . "', products_quantity = '" . $row['products_quantity'] . "' where products_id = '" . $row['products_id'] . "'");
$products_updated = true;
}
}
if ($products_updated == true) {
$messageStack->add_session(SUCCESS_PRODUCTS_UPDATED, 'success');
} else {
$messageStack->add_session(WARNING_PRODUCTS_NOT_UPDATED, 'warning');
}
tep_redirect(tep_href_link(FILENAME_PRODUCT_UPDATES));
}
if ($HTTP_GET_VARS['action'] == 'export') {
$csv_output = TABLE_HEADING_PRODUCT_ID . "," . TABLE_HEADING_PMAN . "," . TABLE_HEADING_PNAME . "," . TABLE_HEADING_PMODEL . "," . TABLE_HEADING_PPRICE . "," . TABLE_HEADING_PWEIGHT . "," . TEXT_PRODUCTS_SORT_ORDER . "," . TABLE_HEADING_PQTY;
$csv_output .= "\n";
$csv_query = tep_db_query("select p.products_id, p.manufacturers_id, p.products_quantity, p.products_price, p.products_weight, products_sort_order, p.products_model, pd.products_name, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id group by pd.products_name order by pd.products_name ASC");
while ($csv = tep_db_fetch_array($csv_query)) {
$csv_output .= $csv['products_id'] . "," . $csv['manufacturers_name'] . "," . $csv['products_name'] . "," . $csv['products_model'] . "," . $currencies->format($csv['products_price']) . "," . $csv['products_weight'] . "," . $csv['products_sort_order'] . "," . $csv['products_quantity'] . "\n";
}
$saveas = 'product_stock-price_report_' . strftime("%m-%d-%Y");
header("Content-Disposition: attachment; filename=$saveas.csv");
print $csv_output;
exit;
}
?>
<!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">
<script type="text/javascript" language="javascript" src="includes/general.js"></script>
</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%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"><?php echo tep_draw_form('stockprice', FILENAME_PRODUCT_UPDATES, 'action=update', 'post'); ?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?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></td>
</tr>
<?php
switch ($listing) {
case "prod":
$order = "p.products_id";
break;
case "prod-desc":
$order = "p.products_id DESC";
break;
case "manu":
$order = "m.manufacturers_name";
break;
case "manu-desc":
$order = "m.manufacturers_name DESC";
break;
case "name":
$order = "pd.products_name";
break;
case "name-desc":
$order = "pd.products_name DESC";
break;
case "model":
$order = "p.products_model";
break;
case "model-desc":
$order = "p.products_model DESC";
break;
case "quantity":
$order = "p.products_quantity";
break;
case "quantity-desc":
$order = "p.products_quantity DESC";
break;
case "weight":
$order = "p.products_weight";
break;
case "weight-desc":
$order = "p.products_weight DESC";
break;
case "sort":
$order = "products_sort_order";
break;
case "sort-desc":
$order = "products_sort_order DESC";
break;
case "price":
$order = "p.products_price";
break;
case "price-desc":
$order = "p.products_price DESC";
break;
default:
//$order = "p.products_model ASC";
$order = "p.products_quantity";
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=prod"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PRODUCT_ID . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=prod-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PRODUCT_ID . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PRODUCT_ID; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=manu"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PMAN . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=manu-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PMAN . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PMAN; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=name"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PNAME . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=name-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PNAME. ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PNAME; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=model"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PMODEL . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=model-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PMODEL . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PMODEL; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=weight"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=weight-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PWEIGHT; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=sort"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PSORT_ORDER . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=sort-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PSORT_ORDER . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PSORT_ORDER; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=price"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PPRICE . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=price-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PPRICE . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PPRICE; ?></td>
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=quantity"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PQTY . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=quantity-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PQTY . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PQTY; ?></td>
</tr>
<?php
//$countrows_query = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_status=1");
//$countrows = tep_db_num_rows($countrows_query);
$updates_raw = "select p.products_id, p.manufacturers_id, p.products_quantity, p.products_weight, products_sort_order, p.products_price, p.products_model, pd.products_name, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = 1 and p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id and pd.language_id = $languages_id group by pd.products_name order by $order";
$updates = tep_db_query($updates_raw);
$countrows = tep_db_num_rows($updates);
$updates_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $updates_raw, $countrows);
while ($row = tep_db_fetch_array($updates)) {
$id = $row['products_id'];
$updates_man = $row['manufacturers_name'];
$updates_name = $row['products_name'];
$updates_model = $row['products_model'];
$updates_weight = number_format($row['products_weight'], 1);
$updates_height = number_format($row['products_sort_order'], 0);
$updates_price = number_format($row['products_price'], 2);
$updates_pqty = number_format($row['products_quantity'], 0);
?>
<tr class="dataTableRow">
<td class="dataTableContent"><?php echo $id . "<input type='hidden' name='event_record[" . $id . "][products_id]' value='".$id."'>"; ?></td>
<td class="dataTableContent"><?php echo $updates_man; ?></td>
<td class="dataTableContent"><?php echo '<a href="' . tep_catalog_href_link('product_info.php', 'products_id=' . $id) . '">' . $updates_name . '</a>'; ?></td>
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_model]', $updates_model, 'size="' . FIELD_SIZE_MODEL . '" readonly'); ?></td>
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_weight]', $updates_weight, 'size="' . FIELD_SIZE . '"'); ?></td>
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_sort_order]', $updates_sort_order, 'size="' . FIELD_SIZE . '"'); ?></td>
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_price]', $updates_price, 'size="' . FIELD_SIZE . '"'); ?></td>
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_quantity]', $updates_pqty, 'size="' . FIELD_SIZE . '"'); ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="6"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
</tr>
<tr>
<td colspan="3" align="left"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></form></td>
<td colspan="3" align="right"><?php echo tep_draw_form('stockprice_report', FILENAME_PRODUCT_UPDATES, 'action=export', 'post'); ?><?php echo tep_image_submit('button_save.gif', IMAGE_SAVECSV); ?></form></td>
</tr>
<tr>
<td colspan="6"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td class="smallText" align="left" colspan="3"><?php echo $updates_split->display_count($countrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right" colspan="3"><?php echo $updates_split->display_links($countrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'x', 'y', 'products_id'))); ?> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
#54
Posted 19 March 2007 - 02:17 PM
1: add to product_update.php in admin/includes/languages/english/
define('TABLE_HEADING_PSORT_ORDER', 'Sort Order');
2: Open Product Updates and add lthe following:
FIND:
'products_weight' => number_format($product['products_weight'], 1),
And add after:
'products_sort_order' => number_format($product['products_sort_order'], 0),
FIND:
strcasecmp($products[$row['products_id']]['products_weight'], $row['products_weight']) != 0 ||
And add after:
strcasecmp($products[$row['products_id']]['products_sort_order'], $row['products_sort_order']) != 0 ||
FIND:
tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_price = '" . $row['products_price'] . "', products_model = '" . $row['products_model'] . "', products_weight = '" . $row['products_weight'] . "'
And add after: (, products_weight = '" . $row['products_weight'] . "')
, products_sort_order = '" . $row['products_sort_order'] . "'
FIND:
$csv_output = TABLE_HEADING_PRODUCT_ID . "," . TABLE_HEADING_PMAN . "," . TABLE_HEADING_PNAME . "," . TABLE_HEADING_PMODEL . "," . TABLE_HEADING_PPRICE . "," . TABLE_HEADING_PWEIGHT . "
And add after: ("," . TABLE_HEADING_PWEIGHT . ")
," . TABLE_HEADING_PSORT_ORDER . "
FIND:
$csv_query = tep_db_query("select p.products_id, p.manufacturers_id, p.products_quantity, p.products_price, p.products_weight,
And add after: (, p.products_weight)
p.products_sort_order,
FIND:
$currencies->format($csv['products_price']) . "," . $csv['products_weight'] . "
And add after: (," . $csv['products_weight'] . ")
," . $csv['products_sort_order'] . "
FIND:
case "weight-desc": $order = "p.products_weight DESC"; break;
And add after:
case "sort": $order = "p.products_sort_order"; break; case "sort-desc": $order = "p.products_sort_order DESC"; break;
FIND:
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=weight"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=weight-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PWEIGHT; ?></td>
And add after:
<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=sort"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PSORT_ORDER . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=sort-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PSORT_ORDER . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PSORT_ORDER; ?></td>
FIND:
$updates_raw = "select p.products_id, p.manufacturers_id, p.products_quantity, p.products_weight,
And add after: (p.products_weight,)
p.products_sort_order,
FIND:
$updates_weight = number_format($row['products_weight'], 1);
And add after:
$updates_sort_order = number_format($row['products_sort_order'], 0);
FIND:
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_weight]', $updates_weight, 'size="' . FIELD_SIZE . '"'); ?></td>
And add after:
<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_sort_order]', $updates_sort_order, 'size="' . FIELD_SIZE . '"'); ?></td>
Upload your modded file and you are done. just to clarify this will add the option to edit the sort order of products if you have the Product Sort v1.6 contrib installed.
hope this has helped
#56
Posted 05 September 2007 - 03:36 PM
<?php
/*
quick_stockupdate.php v1.1 by Tomorn Kaewtong / http://www.phpthailand.com
MODIFIED quick_stockupdate.php v2.1 by Dominic Stein
Stand-alone Admin tool for osCommerce v2.2-CVS
A spin-off of my Quick DeActivate script so you can set a lot of quantities
in a single process. Also allows you to change the STATUS of the products
based upon quantities provided.
Released under the GPL licence.
*/
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">
<script LANGUAGE="Javascript1.2" SRC="jsgraph/graph.js"></SCRIPT>
<!-- 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%" valign="top">
<table style="border:none" border="0" width="90%" align="center" class="none"><tr><td>
<?php
// we've done nothing cool yet...
if ($HTTP_POST_VARS['stock_update']) {
//set counter
$stock = 0;
$status_a = 0;
$status_d = 0;
while (list($key, $items) = each($stock_update)) {
// update the quantity in stock and image
$sql = "UPDATE products SET products_quantity = '".$items['stock']."', products_model = '".$items['model']."', products_price = '".$items['price']."', products_weight = '".$items['weight']."' WHERE products_id = $key";
$update = tep_db_query($sql);
$stock_i++;
// we're de-re-activating the selected products
if ($HTTP_POST_VARS['update_status']) {
if ($items['stock'] >= 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++;
}
}
}
}
?>
<br><form method="post" action="quick_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 = 1");
echo '<center><font face="Genvea,Arial"><b>Quick Stock Update</b></font>'. tep_draw_separator('pixel_trans.gif', '100%', '3') . '</center><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="quick_stockupdate.php"><th class="smallText" align="left" valign="top">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="quick_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="quick_stockupdate.php"><table border="0" width="100%" cellspacing=2 cellpadding=2>';
$i = 0;
// get all active prods in that specific category
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by pd.products_name");
echo '<tr class="dataTableHeadingRow"><td class="dataTableContent" align="left"><b>Model</b></td><td class="dataTableContent" align="left"><b>ID#</b></td><td class="dataTableContent" align="left"><b>Name</b></td><td class="dataTableContent" align="left"><b>Weight</b></td><td class="dataTableContent" align="left"><b>Price</b></td><td class="dataTableContent" align="left"><b>Stock</b></td></tr>';
// added changes thowden 10/2004 stock_update becomes a multi-dim array
while ($results = tep_db_fetch_array($sql2)) {
$i++;
echo '<tr class="dataTableRow"><td class="dataTableContent" align="left"><input type="text" size="16" name="stock_update[' . $results['products_id'] . '][model]" value="' . $results['products_model'] . '"><i>';
echo '</td><td class="dataTableContent" align="left">' . $results['products_id'] . '</td><td class="dataTableContent" align="left">' . $results['products_name'];
echo '</td><td class="dataTableContent" align="left"><input type="text" size="3" name="stock_update[' . $results['products_id'] . '][weight]" value="' . $results['products_weight'] . '"><i>';
echo '</td><td class="dataTableContent" align="left"><input type="text" size="5" name="stock_update[' . $results['products_id'] . '][price]" value="' . $results['products_price'] . '"><i>';
echo '</td><td class="dataTableContent" align="left"><input type="text" size="4" name="stock_update[' . $results['products_id'] . '][stock]" value="' . $results['products_quantity'] . '"><i>';
echo (($results['products_status'] == 0) ? '<font color="ff0000"><b>not active</b></font>' : '<font color="009933"><b>active</b></font>');
echo '</i></td></tr>';
if ($i == $max_cols) {
$i =0;
}
}
echo '</table><table border="0" width="100%" cellspacing=2 cellpadding=2><tr>';
echo '<input type="hidden" name="cat_id" value="' . $HTTP_POST_VARS['cat_id'] . '">';
echo '</tr><br><td align="center" colspan="10" class="smallText">';
echo '<input type="checkbox" name="update_status">Check to set status on each individual product based on items in stock<br><i>( one or more in stock will become <font color="009933"><b>active</b></font> / zero in stock will become <font color="ff0000"><b>not active</b></font> )</i><p>';
echo '<input type="submit" value="Update"></td></tr></form>';
} //if
?>
</tr></table>
</td>
</tr></table><center>
<a style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:xx-small;text-decoration:none;text-decoration:none;color=ccbbcc;" href="mailto:info@phpthailand.com?subject=QuickStockUpdate"><b>© 2002 Tomorn K. -</b></a>
<a style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:xx-small;text-decoration:none;color=#ccbbcc;" href="http://www.phpthailand.com"><b>http://www.phpthailand.com</b></a></center>
</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'); ?>
#57
Posted 05 September 2007 - 04:18 PM
#58
Posted 13 September 2007 - 09:09 AM
Thanks
data2700, on Sep 5 2007, 05:36 PM, said:
<?php
/*
quick_stockupdate.php v1.1 by Tomorn Kaewtong / http://www.phpthailand.com
MODIFIED quick_stockupdate.php v2.1 by Dominic Stein
Stand-alone Admin tool for osCommerce v2.2-CVS
A spin-off of my Quick DeActivate script so you can set a lot of quantities
in a single process. Also allows you to change the STATUS of the products
based upon quantities provided.
Released under the GPL licence.
*/
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">
<script LANGUAGE="Javascript1.2" SRC="jsgraph/graph.js"></SCRIPT>
<!-- 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%" valign="top">
<table style="border:none" border="0" width="90%" align="center" class="none"><tr><td>
<?php
// we've done nothing cool yet...
if ($HTTP_POST_VARS['stock_update']) {
//set counter
$stock = 0;
$status_a = 0;
$status_d = 0;
while (list($key, $items) = each($stock_update)) {
// update the quantity in stock and image
$sql = "UPDATE products SET products_quantity = '".$items['stock']."', products_model = '".$items['model']."', products_price = '".$items['price']."', products_weight = '".$items['weight']."' WHERE products_id = $key";
$update = tep_db_query($sql);
$stock_i++;
// we're de-re-activating the selected products
if ($HTTP_POST_VARS['update_status']) {
if ($items['stock'] >= 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++;
}
}
}
}
?>
<br><form method="post" action="quick_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 = 1");
echo '<center><font face="Genvea,Arial"><b>Quick Stock Update</b></font>'. tep_draw_separator('pixel_trans.gif', '100%', '3') . '</center><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="quick_stockupdate.php"><th class="smallText" align="left" valign="top">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="quick_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="quick_stockupdate.php"><table border="0" width="100%" cellspacing=2 cellpadding=2>';
$i = 0;
// get all active prods in that specific category
$sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, 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'] . "' order by pd.products_name");
echo '<tr class="dataTableHeadingRow"><td class="dataTableContent" align="left"><b>Model</b></td><td class="dataTableContent" align="left"><b>ID#</b></td><td class="dataTableContent" align="left"><b>Name</b></td><td class="dataTableContent" align="left"><b>Weight</b></td><td class="dataTableContent" align="left"><b>Price</b></td><td class="dataTableContent" align="left"><b>Stock</b></td></tr>';
// added changes thowden 10/2004 stock_update becomes a multi-dim array
while ($results = tep_db_fetch_array($sql2)) {
$i++;
echo '<tr class="dataTableRow"><td class="dataTableContent" align="left"><input type="text" size="16" name="stock_update[' . $results['products_id'] . '][model]" value="' . $results['products_model'] . '"><i>';
echo '</td><td class="dataTableContent" align="left">' . $results['products_id'] . '</td><td class="dataTableContent" align="left">' . $results['products_name'];
echo '</td><td class="dataTableContent" align="left"><input type="text" size="3" name="stock_update[' . $results['products_id'] . '][weight]" value="' . $results['products_weight'] . '"><i>';
echo '</td><td class="dataTableContent" align="left"><input type="text" size="5" name="stock_update[' . $results['products_id'] . '][price]" value="' . $results['products_price'] . '"><i>';
echo '</td><td class="dataTableContent" align="left"><input type="text" size="4" name="stock_update[' . $results['products_id'] . '][stock]" value="' . $results['products_quantity'] . '"><i>';
echo (($results['products_status'] == 0) ? '<font color="ff0000"><b>not active</b></font>' : '<font color="009933"><b>active</b></font>');
echo '</i></td></tr>';
if ($i == $max_cols) {
$i =0;
}
}
echo '</table><table border="0" width="100%" cellspacing=2 cellpadding=2><tr>';
echo '<input type="hidden" name="cat_id" value="' . $HTTP_POST_VARS['cat_id'] . '">';
echo '</tr><br><td align="center" colspan="10" class="smallText">';
echo '<input type="checkbox" name="update_status">Check to set status on each individual product based on items in stock<br><i>( one or more in stock will become <font color="009933"><b>active</b></font> / zero in stock will become <font color="ff0000"><b>not active</b></font> )</i><p>';
echo '<input type="submit" value="Update"></td></tr></form>';
} //if
?>
</tr></table>
</td>
</tr></table><center>
<a style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:xx-small;text-decoration:none;text-decoration:none;color=ccbbcc;" href="mailto:info@phpthailand.com?subject=QuickStockUpdate"><b>© 2002 Tomorn K. -</b></a>
<a style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:xx-small;text-decoration:none;color=#ccbbcc;" href="http://www.phpthailand.com"><b>http://www.phpthailand.com</b></a></center>
</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'); ?>
#59
Posted 25 October 2007 - 09:56 AM
#60
Posted 17 November 2007 - 05:29 PM
Anime_House, on Oct 13 2005, 12:26 AM, said:
Warning: Variable passed to each() is not an array or object in /~path~/quick_stockupdate.php on line 90
Lines 90 Through 94
while (list($key, $items) = each($stock_update)) {
// update the quantity in stock
$sql = "UPDATE products SET products_quantity = '".$items['stock']."', products_model = '".$items['model']."', products_price = '".$items['price']."', products_weight = '".$items['weight']."' WHERE products_id = $key";
$update = tep_db_query($sql);
$stock_i++;
Help ^.^;;
I'm having the same problem here, does anybody know how to fix this?
Thanks









