Abo Anas Posted June 21, 2020 Share Posted June 21, 2020 (edited) Hello All : many thanks in advance for who help or trying i have system{ not prestashop system but its made individually } that contain customers and categories and subcategories and products now i try to go to presta and migrate database i did script to get fields from old database to the prestashop like in category tables $sql="insert into {$this->pprefex}category (id_parent, id_shop_default, level_depth, nleft, nright, active, date_add, date_upd, `position`, is_root_category) values (2, 1, 2, 2, 2, 1, '{$create_time}','{$update_time}', 0, 1)"; $this->dbp->query($sql);$newcust=$this->dbp->lastInsertID(); $sql="insert into {$this->pprefex}category_lang values ({$newcust}, 1, 1, '{$name_en}', '', '', '', '', '')"; $this->dbp->query($sql); BTW im using the primary keys ids from the old system in its get inserted successfully but when i try to edit the the category it gives me The object cannot be loaded (or found) thats in all inserted data product / customers / categories can anyone tell me what i missed while inserting data ? Edited June 21, 2020 by Abo Anas (see edit history) Link to comment Share on other sites More sharing options...
Abo Anas Posted June 27, 2020 Author Share Posted June 27, 2020 On 6/23/2020 at 5:17 PM, ndiaga said: Hi, Why not using a CVS file? Put your old data in a CSV file and match the fields accordingly there you can use the default import feature. Also you need to create Objects one by one : Categories then Products then Customers. thank you tha's very good solution but it cant help in my situation as i need to make changes in the primary key using code before insert Link to comment Share on other sites More sharing options...
Abo Anas Posted June 27, 2020 Author Share Posted June 27, 2020 3 hours ago, ndiaga said: You can also use the primary key in the CSV. i understand but i want to make manipulation to it to change it value from db Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now