@ 2013-11-12T03:55:45Z <?php
switch ($task) { case 'update':
{
if(isset($HTTP_POST_FILES['filename']['name']))
{
echo "<h3>Uploading: ".$HTTP_POST_FILES['filename']['name']."</h3><br>";
$handle=fopen($HTTP_POST_FILES['filename']['tmp_name'],"r");
if ($handle)
{
if (!feof($handle))
$buffer = fgets($handle);
while (!feof($handle)&&!stristr(iconv("WINDOWS-1251","UTF-8",$buffer),'Код'))
{
$buffer = fgets($handle);
}
if(!stristr(iconv("WINDOWS-1251","UTF-8",$buffer),'Код'))
{
echo "<h3>Incorrect file<h3>";
exit;
}
else
{
$columns=explode("\t",$buffer);
$i=0;
foreach ($columns as $column)
{
$column=iconv("WINDOWS-1251","UTF-8",$column);
if ($column=="Розница") $price1=$i;
if ($column=="Опт1") $price2=$i;
if ($column=="Опт2") $price3=$i;
if ($column=="Опт3") $price4=$i;
if ($column=="Код") $code=$i;
$i++;
}
}
echo $database->doSQL("DROP TABLE IF EXISTS #__import");
echo $database->doSQL("CREATE TABLE IF NOT EXISTS #__import (
`code` bigint(20) unsigned NOT NULL,
`price1` float NOT NULL default '0',
`price2` float NOT NULL default '0',
`price3` float NOT NULL default '0',
`price4` float NOT NULL default '0',
KEY `code` (`code`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1");
$buffer = fgets($handle);
while (!feof($handle))
{
$buffer = fgets($handle);
$row = explode("\t",$buffer);
if (array_key_exists(9,$row))
{
$out=array("'"," руб.");
$row[$price1] = str_replace($out,"",$row[$price1]);
$row[$price2] = str_replace($out,"",$row[$price2]);
$row[$price3] = str_replace($out,"",$row[$price3]);
$row[$price4] = str_replace($out,"",$row[$price4]);
$sql = "INSERT INTO #__import (`code`, `price1`, `price2`, `price3`, `price4`) VALUES ('$row[$code]', '$row[$price1]', '$row[$price2]', '$row[$price3]', '$row[$price4]');";
$result = $database->doSQL($sql);
}
}
fclose($handle);
}
echo "<h3>Import completed</h3><br />";
$database->doSQL("UPDATE #__itemdetails SET `price1` = 0, `price2` = 0, `price3` = 0, `price4` = 0");
echo '<h3>Old prices was nulled</h3><br>';
$sql="";
$database->setQuery('select * from #__itemdetails');
$rows = $database->loadObjectList();
foreach ($rows as $row)
{
$database->setQuery("select * from #__import where code=$row->code");
$rows1=$database->loadObjectList();
if (!sizeof($rows1))
$errors.=$row->code.', ';
else
{
$database->doSQL("UPDATE #__itemdetails SET `price1` = '".$rows1[0]->price1."', `price2` = '".$rows1[0]->price2."', `price3` = '".$rows1[0]->price3."', `price4` = '".$rows1[0]->price4."' WHERE `code` = ".$row->code);
$completed.=$row->code.', ';
}
}
echo '<div align=left><b>The following goods were updated:</b> '.substr($completed,0,strlen($completed)-2).'</div>';
if (isset($errors))
echo '<br><br><div align=left><b><font color=red>The following goods were not found:</b></font> '.substr($errors,0,strlen($errors)-2).'</div>';
exit;
} }
default:
HTML_catalog::ShowUploadPriceForm();
break;
}
break;
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.5.5 0.007 0.073 17.25 5.5.4 0.007 0.067 17.22 5.5.3 0.003 0.080 17.26 5.5.2 0.003 0.043 17.22 5.5.1 0.010 0.070 17.23 5.5.0 0.010 0.067 17.24 5.4.21 0.010 0.060 18.99 5.4.20 0.003 0.043 19.09 5.4.19 0.003 0.040 19.06 5.4.18 0.010 0.073 18.98 5.4.17 0.017 0.070 18.89 5.4.16 0.007 0.077 18.97 5.4.15 0.013 0.070 19.18 5.4.14 0.007 0.073 16.42 5.4.13 0.010 0.067 16.51 5.4.12 0.013 0.050 16.33 5.4.11 0.010 0.070 16.23 5.4.10 0.007 0.057 16.43 5.4.9 0.013 0.063 16.29 5.4.8 0.013 0.063 16.40 5.4.7 0.007 0.050 16.31 5.4.6 0.007 0.073 16.44 5.4.5 0.003 0.037 16.32 5.4.4 0.010 0.047 16.26 5.4.3 0.010 0.030 16.30 5.4.2 0.003 0.037 16.20 5.4.1 0.010 0.053 16.45 5.4.0 0.013 0.067 15.68 5.3.27 0.007 0.040 14.61 5.3.26 0.007 0.043 14.57 5.3.25 0.003 0.043 14.62 5.3.24 0.010 0.050 14.58 5.3.23 0.007 0.047 14.49 5.3.22 0.033 0.030 14.53 5.3.21 0.007 0.067 14.43 5.3.20 0.010 0.073 14.56 5.3.19 0.000 0.060 14.57 5.3.18 0.003 0.063 14.56 5.3.17 0.007 0.077 14.54 5.3.16 0.003 0.073 14.57 5.3.15 0.003 0.040 14.54 5.3.14 0.013 0.050 14.42 5.3.13 0.003 0.037 14.41 5.3.12 0.010 0.037 14.41 5.3.11 0.007 0.057 14.57 5.3.10 0.000 0.053 14.03 5.3.9 0.007 0.033 13.99 5.3.8 0.000 0.040 14.03 5.3.7 0.007 0.040 13.98 5.3.6 0.010 0.073 14.01 5.3.5 0.007 0.077 13.95 5.3.4 0.003 0.057 13.96 5.3.3 0.010 0.073 13.71 5.3.2 0.010 0.073 13.68 5.3.1 0.010 0.070 13.45 5.3.0 0.000 0.050 13.63
preferences:dark mode live preview
143.84 ms | 1394 KiB | 7 Q