我正在将我的网站从osc迁移到prestashop,但模块importerosc显示错误。
除了类别外,其他所有内容都已成功导入。但是当我选择显示技术错误的类别模块时。
Category类是扩展objectmodel和对象模型,显示date_add字段的unsignedint。但是ImportererOSC模块没有从oscommerce数据库中获取date_add值,如果我更改查询则没有任何变化。
技术错误
详细说明: 致命错误:未捕获的异常 'PrestaShopException' 有消息 '物业类别 - > DATE_ADD无效' 在/home/xxxxxx/public_html/shop/classes/ObjectModel.php:790堆栈跟踪:#0 /家庭/ XXXXX /的public_html /店/类/ ObjectModel.php(265):ObjectModelCore-> validateFields()#1 /home/xxxxxx/public_html/shop/classes/ObjectModel.php(551):ObjectModelCore-> getFields()#2 /家/ XXXXXX /的public_html /店铺/类/ Category.php(210):ObjectModelCore->更新(假)#3 /home/xxxxxx/public_html/shop/modules/shopimporter/shopimporter.php(971):CategoryCore->更新()#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',Array,true)#7 {main}在790行的/home/xxxxxx/public_html/shop/classes/ObjectModel.php中抛出
答案 0 :(得分: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/>';
}
?>