Jump to content

"Undefined index" error in OsComerce importer module


Recommended Posts

Hello, I have installed fresh prestashop 1.5.0.17 and I am trying to import my oscommerce store using shopimporter with importerosc module. Everything is fine except one step where "Product Combinations" are imported. I am getting error for every element in file shopimporter.php in loop on line around 1030 (I was fixing other error related to my database and it could move a bit. I am 110% sure that error is not related to my fixes in other parts of import). I tried import in prestashop 1.4.4.1 and it works without any problem.

 

This is the error. minimal_quantity is a column in prestashop database but i don't know what's wrong.

 

Notice: Undefined index: minimal_quantity in D:\_Developer\xampp\htdocs\presta\modules\shopimporter\shopimporter.php on line 1033

 

Its this line:

 

if (($value = $fields[$field]) == false AND (string)$value != '0')

 

in this function (pasting just beginning):

 

private function validateRules($rules, &$fields, $className, $languages, $defaultLanguage)
{
	$returnErrors = array();
	$hasErrors = Tools::getValue('hasErrors');
	/* Checking for required fields */
	foreach ($rules['required'] AS $field){
		if (($value = $fields[$field]) == false AND (string)$value != '0')
			if ($hasErrors == 2)
			{
				if (array_key_exists($field, $rules['size']))
					$size = $rules['size'][$field];
				else
					$size = 1;
				$fields[$field] = $this->generateData($size, $rules['validate'][$field]);
			}
			else{

					$returnErrors[] = sprintf(
						$this->l('The field %s is required.'),
						call_user_func(array($className, 'displayFieldName'), $field, $className)
					);
				}
	}

Link to comment
Share on other sites

I figured it out myself. It tourns out that importer in version 1.5 somehow requires more columns (than 1.4) for prestashop database. As i mentioned i fixed few other errors which were related to data in other columns like "can't be null" or "invalid data" but in case of minimal_quantity it turned out that this column never existed in oscommerce and was required in prestashop. I fixed it by changing SQL query in importerosc.php and adding one more column minimal_quantity which value was always "1" because at least in my oscommerce shop I never used this field so I could put default value and also didn't even find it in osc database. I think that OsC doesn't have this field.

To sum this up importerosc needs an update in 1.5.

Link to comment
Share on other sites

×
×
  • Create New...