Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Multi Vendor Feed Manager Importer


2 replies to this topic

#1 ShaGGy

  • Community Member
  • 59 posts
  • Real Name:Les

Posted 26 November 2011, 21:32

Looking for a bit of help with this add on Multi Vendor Feed Manager Importer

I have got it installed and it is downloading the file from the FTP and placing it within the feeds dir but then I get an error Warning: Invalid argument supplied for foreach() in /home/xxxxxxxx/public_html/feed_import.php on line 118
DONE ::Row Count:: 0 ::Redirects:: 0

But line 118 in feed_import.php is a blank line ?

any suggestions as I really could do with getting this add on working.

thanks for any help in advance.

#2 ShaGGy

  • Community Member
  • 59 posts
  • Real Name:Les

Posted 29 November 2011, 18:58

After loading the file into a proper PHP editor it hightlights line 118 which says switch($dbCol){

any ideas what is causin this error I am desperate to get this working. is there some genius out there who can help me?

			 $csv = new parseCSV();
			 if ($this->config['throttle'] > 0){
				 $csv->limit = $this->config['throttle'];
			 }
			 $csv->offset = max($this->startRow, 1);
			 $csv->delimiter = $this->config['delimiter'];
			
			 $file = file($this->config['url']);
			 $fileRows = (sizeof($file) - 1);
			 $fileHeaders = array();
			 $lineArr = $this->pregSplit($file[0]);
			 foreach($lineArr as $col => $text){
				 $colCheck = strtolower(trim($text));
				 if (isset($this->fields[$colCheck])){
					 $fileHeaders[$col] = $this->fields[$colCheck];
				 }
			 }
			 unset($file[0]);
			 $csv->fields = $fileHeaders;
			 $csv->parse($this->config['url']);
		  }
		  foreach($csv->data as $row => $lineArr){
			  $this->dataArray[$row] = array();
			  foreach($lineArr as $dbCol => $val){
				  $colCheck = strtolower($val);
				  switch($dbCol){
					  case 'products_id':
					  break;
					  case 'categories_id':
						  if (isset($this->categories[$colCheck])){
							  $refArr = $this->categories[$colCheck];
						  }else{
							  $refArr = $this->parseCategory($colCheck);
						  }
						  $this->dataArray[$row][$dbCol] = explode('_', $refArr['ref']);
					  break;
					  case 'products_attributes':
						  $arr = explode($this->config['attrib_sep'], $colCheck);
						  foreach($arr as $attribute){
							  if (tep_not_null($attribute)){
								  $att = explode($this->config['attrib_price_sep'], $attribute);
								  $attribName = $att[0];
								  $attribPrice = $att[1];
								  if (isset($this->attributes[$attribName])){
									  $this->dataArray[$row][$dbCol][] = array(
										  'id' => explode('_', $this->attributes[$attribName]),
										  'price' => $attribPrice
									  );
								  }else{
									  $this->dataArray[$row][$dbCol][] = array(
										  'name'  => $attribName,
										  'price' => $attribPrice,
									  );
								  }
							  }
						  }
					  break;
					  case 'manufacturers_id':
						  if (isset($this->manufacturers[$colCheck])){
							  $this->dataArray[$row][$dbCol] = $this->manufacturers[$colCheck];
						  }else{
							  $this->dataArray[$row][$dbCol] = str_replace('"', '', $colCheck);
						  }
					  break;
					  default:
						  $this->dataArray[$row][$dbCol] = str_replace('""', '\"', trim($val, '"'));
					  break;
				  }
			  }
			  $row++;
			  $this->rowCount++;
		  }
		  if ($csv->totalProducts > 0){
			  $this->needsRedirect = true;
		  }else{
			  $this->needsRedirect = false;
		  }
	  }

Edited by ShaGGy, 29 November 2011, 19:00.


#3 ShaGGy

  • Community Member
  • 59 posts
  • Real Name:Les

Posted 29 November 2011, 19:58

Sorry its line 114 that has the error

foreach($csv->data as $row => $lineArr){

Edited by ShaGGy, 29 November 2011, 19:58.