0

我正在将我的网站从 osc 迁移到 prestashop,但模块 importerosc 显示错误。

除类别外,其他所有内容均已成功导入。但是当我选择显示技术错误的类别模块时。

类别类扩展了 objectmodel 和 object model,显示 date_add 字段的 unsignedint。但是 ImportererOSC 模块没有从 oscommerce 数据库中获取 date_add 值,如果我更改查询,也没有任何变化。

技术错误

详细信息:致命错误:在 /home/xxxxxx/public_html/shop/classes/ObjectModel.php:790 中包含消息“Property Category->date_add is not valid”的未捕获异常“PrestaShopException” 堆栈跟踪:#0 /home/xxxxx/public_html /shop/classes/ObjectModel.php(265): ObjectModelCore->validateFields() #1 /home/xxxxxx/public_html/shop/classes/ObjectModel.php(551): ObjectModelCore->getFields() #2 /home/xxxxxx /public_html/shop/classes/Category.php(210): ObjectModelCore->update(false) #3 /home/xxxxxx/public_html/shop/modules/shopimporter/shopimporter.php(971): CategoryCore->update() # 4 /home/xxxxxx/public_html/shop/modules/shopimporter/shopimporter.php(533): shopimporter->updateCat() #5 /home/xxxxxx/public_html/shop/modules/shopimporter/ajax.php(148): shopimporter ->genericImport('Category', 数组,true) #6 {main} 在第 790 行的 /home/xxxxxx/public_html/shop/classes/ObjectModel.php 中抛出

4

1 回答 1

1

此问题可能是由于数据库 oscommerce 中的 iso 代码不正确造成的。你也可以尝试走这条路

Regards
$server = 'localhost'; // DATABASE SERVER
$db_user = ''; // DATABASE SERVER USER NAME
$db_password = ''; // DATABASE SERVER USER PASSWORD
$database = ''; // OLD OSCOMMERCE DATABASE
$databasenew = ''; // NEW PRESTASHOP DATABASE


// CONNECT TO DATABASE SERVER

$con = mysql_connect($server,$db_user,$db_password);
if (!$con)
{
  die('COULD NOT CONNECT TO DATABASE SERVER: ' . mysql_error());
}



$db1 = mysql_select_db($database, $con);
if (!$db1) {
    die ('COULD NOT SELECT OSCOMMERCE DATABASE: ' . mysql_error());
}

$result = mysql_query("SELECT * FROM customers");
echo '<h4>OSCOMMERCE > PRESTASHOP CUSTOMER IMPORT</h4>';

while($row = mysql_fetch_array($result)){

  // PREPARE ADDITIONAL FIELDS
  $date = date("Y-m-d H:m:s)");

  // random key for user
  $key = md5(uniqid(rand(), true));

  // customer newsletter y/n
  if($row['customers_newsletter'] == "1"){
     $newsletter = "1";
  } else {
     $newsletter = "0";
  }



  // SELECT NEW DATABASE

  $db2 = mysql_select_db($databasenew, $con);
  if (!$db1) {
    die ('COULD NOT SELECT PRESTASHOP DATABASE: ' . mysql_error());
  }

  $result1 = mysql_query("INSERT INTO `ps_customer` (
`id_customer` ,
`id_gender` ,
`id_default_group` ,
`firstname` ,
`lastname` ,
`email` ,
`passwd` ,
`last_passwd_gen` ,
`birthday` ,
`newsletter` ,
`ip_registration_newsletter` ,
`newsletter_date_add` ,
`optin` ,
`secure_key` ,
`note` ,
`active` ,
`is_guest` ,
`deleted` ,
`date_add` ,
`date_upd`
)

VALUES (

NULL , '1', '1', '".$row['customers_firstname']."', '".$row['customers_lastname']."', '".$row['customers_email_address']."', '1', '2000-05-27 15:53:08', NULL , '".$newsletter."', NULL , '".$date."' , '0', '".$key."', NULL , '1', '0', '0', '".$date."', '".$date."'

)");



// ADD USER TO GROUP - ( Default 1 )

$userid = mysql_insert_id();   
$result2 = mysql_query("INSERT INTO `ps_customer_group` (`id_customer` ,`id_group`)
VALUES ('".$userid."', '1')");
echo "SUCCESS!: " . $row['customers_firstname'] . " " . $row['customers_lastname'].'<br/>';

}

 ?>
于 2012-12-22T16:18:26.440 回答