Add php files
This commit is contained in:
15
modules/EcmProducts/update_toOrder.php
Executable file
15
modules/EcmProducts/update_toOrder.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$db = $GLOBALS['db'];
|
||||
$query = "SELECT id, ems_qty_in_stock, q3 FROM ecmproducts WHERE deleted=0;";
|
||||
$result = $db->query($query);
|
||||
|
||||
while ($row = $db->fetchByAssoc($result)) {
|
||||
if ($row['ems_qty_in_stock'] < 3 * $row['q3']) $order=1; else $order=0;
|
||||
$query="update ecmproducts set to_order=".$order." where id='".$row['id']."'";
|
||||
if ($db->query($query)) echo ''; else echo 'co<63> nie tak';
|
||||
//debug
|
||||
echo $row['ems_qty_in_stock']." - ".$row['q3']." - ".$order."<br>";
|
||||
}
|
||||
|
||||
echo $result->num_rows;
|
||||
?>
|
||||
Reference in New Issue
Block a user