i have a little program that feeds from two xml files into a Mysql. im having a trouble with a php code
i keep getting this errors:
Notice: Undefined index: e_cod in on line 327
Notice: Undefined index: nombre in on line 328
Notice: Undefined index: titulo in on line 449
Notice: Undefined index: codbar in on line 450
Notice: Undefined index: precio in on line 451
Notice: Undefined index: editorial in on line 452
Notice: Undefined index: codbar in on line 453
Notice: Undefined index: autor in on line 454
Now here are some key parts of the file
Line 313 to 338
public function getmanufacturers()
{
$feedurl='http://mysite/manufacturer.xml';
$xml=simplexml_load_file($feedurl);
$products =get_object_vars($xml);
$i=0;
$manufacturer_array =array();
foreach($products as $product)
{
foreach($product as $productitem)
{
$i++;
$feedproduct = (array)($productitem);
$e_cod = $feedproduct['e_cod']; //3
$name = $feedproduct['nombre']; //1
$manufacturer_array['$e_cod'] = $name;
}
}
return $manufacturer_array;
}
and my XML from manufacturer.
<?xml version="1.0" standalone="yes"?>
<RECORDS>
<RECORD>
<id>1</id>
<nombre>AMERICAN BOOK STORE</nombre>
<proveedor_cod>0410</proveedor_cod>
<e_cod>0001</e_cod>
<nombrec>ABS</nombrec>
<cambio>2012/3/14</cambio>
</RECORD>
</RECORDS>
again php file from line 415 to 522
$manufacturer_array= $this->getmanufacturers();
//inactive features
$datasource ='TEL';
$feedurl='http://mysite/libro.xml';
$xml=simplexml_load_file($feedurl);
$products =get_object_vars($xml);
$i=0;
$raw_products_arr2 =array();
//$Submitoffset = '894757001973';
// $Submitoffset = 'FL5018-2';
//$Submitoffset = '3000000263';
$gotit =0;
foreach($products as $product)
{
foreach($product as $productitem)
{
$i++;
$feedproduct = (array)($productitem);
//print_r($feedproduct);
//die();
Configuration::updateValue('PRODIMPORTER_STAGE',1);
if($i<$rowid )
{
continue;
}
try
{
$pname = $feedproduct['titulo'];
$reference = $feedproduct['codbar'];
$price = $feedproduct['precio'];
$manufacturer_ref = $feedproduct['editorial'];
$ean13 = $feedproduct['codbar'];
$supplier_reference = $feedproduct['autor'];
if(!isset($feedproduct['id']) || $feedproduct['id']=='')
{
$this->html .= "<br/>Product id not found :".$pname."<br/>";
continue;
}
$pid = $feedproduct['id'];
$quantity =999;
$category_list =array();
$parentcatarray =array();
$wholesale_price =$price;
if($Submitlimit!="0" && $Submitlimit!="" )
{
if((int)$total >= $Submitlimit)
{
break;
}
}
$rowid =$rowid + 1;
$this->rowid = $rowid;
Configuration::updateValue('vcxmlprimporter_counter',$rowid);
$total = (int)$rowid-(int)$startrow;
if(trim($reference)=="" )
{
$this->html .= "<br/>Product reference not found :".$pname."<br/>";
continue;
}
Configuration::updateValue('PRODIMPORTER_LASTPROD',$reference);
if(trim($pname)=="" )
{
$this->html .= "<br/>Product name not found :".$pname."<br/>";
continue;
}
if(!isset($price))
{
$this->html .= "<br/>Price not found :".$pname."<br/>";
continue;
}
if($Submitoffset!="0" && $Submitoffset!="" )
{
if(trim($reference) == $Submitoffset && $gotit ==0)
{
$gotit = 1;
}
else
{
continue;
}
}
some of my xml file
<?xml version="1.0" standalone="yes"?>
<RECORDS>
<RECORD>
<id>3</id>
<titulo>INFORMATICA 1 -COMPETENCIAS+APRENDIZAJE+VIDA</titulo>
<autor>ROMERO</autor>
<editorial>0102</editorial>
<tema>0013</tema>
<codbar>3</codbar>
<isbn></isbn>
<precio>225,0000</precio>
</RECORD>
Now i really think that for some unknown reason the assoc array its not getting the fields of my xml file. or something i dont know really
edit: this differ from other question since using xml that for sure i know it exist. ( check the xml and the PHP)