Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

... a little help for me


100asa

Recommended Posts

I've this file, for quick stock update:

[/code]<?php

/*

quick_stockupdate.php v1.1 by Tomorn Kaewtong / http://www.phpthailand.com

MODIFIED quick_stockupdate.php v2.4 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');

 

 

?>

<!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>

<?php

if ($menu_dhtml == false ) { // add for dhtml_menu

echo '<td width="' . BOX_WIDTH . '" valign="top">';

echo '<table border="0" width="' . BOX_WIDTH . '" cellspacing="1" cellpadding="1" class="columnLeft">';

echo '<!-- left_navigation //-->';

require(DIR_WS_INCLUDES . 'column_left.php');

echo '<!-- left_navigation_eof //-->';

echo '</table>';

echo '</td>';

} else {

 

}

?>

<!-- body_text //-->

<td width="100%" valign="top">

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="pageHeading">Aggiornamento veloce<br><?php echo tep_draw_separator('pixel_trans.gif', '100%', '4'); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table>

</td>

</tr>

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top">

<table border="0" width="100%" cellspacing="0" cellpadding="1">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>

</tr>

<tr>

<td class="main">Scegli la categoria dove vuoi effettuare cambiamenti</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td>

<?php

if ($HTTP_POST_VARS['stock_update']) {

while (list($key, $items) = each($stock_update)) {

// update the quantity in stock

$sql = "UPDATE products SET products_quantity = '".$items['stock']."', products_last_modified = '".$items['last_modified']."', 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 ' <table border="0">';

echo ' <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'] . "'");

 

$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">Categories:<br>' . $dropdown . '</form></th>';

}

echo $all_list;

echo ' </tr>';

echo ' </table>';

echo ' </form>';

echo ' </td>';

echo ' </tr>';

echo ' </table>';

 

// see if there is a category ID:

if ($HTTP_POST_VARS['cat_id']) {

// start the table

echo ' <br><form method="post" action="quick_stockupdate.php">';

echo ' <table width="100%" border="0" cellspacing=2 cellpadding=2>';

 

// 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_last_modified, p.products_weight, p.products_cost, 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_last_modified");

echo '<tr class="dataTableHeadingRow"><td class="dataTableContent" align="left"><b>Modello</b></td><td class="dataTableContent" align="left"><b>ID#</b></td><td class="dataTableContent" align="left"><b>Nome</b></td><td class="dataTableContent" align="left"><b>Peso</b></td><td class="dataTableContent" align="left"><b>Prezzo</b></td><td class="dataTableContent" align="left"><b>Giacenza</b></td></tr>';

// added changes thowden 10/2004 stock_update becomes a multi-dim array

while ($results = tep_db_fetch_array($sql2)) {

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']. ' <font size="1">['. $results['products_cost'].']</font>  <font size="1" face="Arial" color="#808080">('. tep_date_short($results['products_last_modified']).')</font> ';

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="10" 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>non attivo</b></font>' : '<font color="009933"><b>attivo</b></font>');

echo '</i></td></tr>';

}

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>

</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'); ?>

 

How can I do to update the "product last modified" field?

Thank's

Skype: centoasa

Skype: remigioruberto

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...