Blame view

cron/head.php 824 Bytes
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <?php
  set_time_limit(0);
  $_SERVER['DOCUMENT_ROOT'] = realpath(dirname(__FILE__)."/..");
  require($_SERVER['DOCUMENT_ROOT'] . "/libs/setup.php");
  $setup = new setup();
  
  
  if (($handle = fopen("dk.csv", "r")) !== FALSE) {
      while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
  
             if(strlen($data[0])>0){
  				//echo $data[0] . "<br />\n";
  				print $data[0] . ' - ' . $product_id = $setup->db->getOne("select product_id from catalogs_modifications where code=?",array($data[0]));
  				print'<br />';
  				if($product_id){
  					$fields_values = array('art'=>$data[1]);
  					print_r($fields_values);
  					$r = $setup->db->autoExecute("catalogs_products",$fields_values,DB_AUTOQUERY_UPDATE,"id='".$product_id."'");
  					if (PEAR::isError($r)) die($r->getMessage());
  				}
  			}	
          
      }
      fclose($handle);
  }
  ?>