53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
//ini_set("memory_limit","1024M");
|
|
set_time_limit(6000000);
|
|
|
|
//$connection=mysql_connect('localhost', 'intelectra_shop_', 'Wwja71!3') or die ("Verbindungsversuch fehlgeschlagen");
|
|
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
|
|
mysql_select_db('intelectra_shop__', $connection) or die("Konnte die Datenbank nicht waehlen.1");
|
|
|
|
echo "get items<br>";
|
|
// get items
|
|
$query = mysql_query('select import_item_prices.*, items.id as item_id from import_item_prices left join items on items.old_id=import_item_prices.pid order by pid, menge asc') or die("Anfrage nicht erfolgreich");
|
|
$data = array();
|
|
while($obj = mysql_fetch_object($query)) {
|
|
$data[] = $obj;
|
|
}
|
|
|
|
echo "imports<br>";
|
|
$merker = array();
|
|
foreach ($data as $object) {
|
|
$customer_group = 1;
|
|
if ($object->uid == 6) {
|
|
$customer_group = 101;
|
|
}
|
|
if ($object->menge != 1) {
|
|
|
|
$merker[$object->item_id]++;
|
|
$staffel = $merker[$object->item_id] + 1;
|
|
$sql = "
|
|
UPDATE item_prices
|
|
SET
|
|
quantity_".$staffel."=".$object->menge.",
|
|
price_".$staffel."='".mysql_real_escape_string(price($object->preis))."',
|
|
bargain_price_".$staffel."='0'
|
|
WHERE
|
|
item_id=".$object->item_id." AND customergroup_id=".$customer_group."
|
|
";
|
|
|
|
}
|
|
echo $sql."<br>";
|
|
$query = mysql_query($sql);
|
|
}
|
|
|
|
|
|
|
|
echo "ende<br>";
|
|
|
|
function price ($p) {
|
|
$p = str_replace(',', '.', $p);
|
|
return $p;
|
|
}
|
|
|
|
?>
|