Reputation: 2129
I'm working on a php script to import products/categories from an XML feed into prestashop.
I have the following insert statement for categories (this is formatted using sprintf in the code):
INSERT INTO ps_category(id_parent, id_shop_default, level_depth, active, data_add, date_upd, position, is_root_category) VALUES($parent, 1,2,1, now(), now(), $position, 0)
$position is calculated by incrementing a counter for each new category, $parentID is the ID of the parent category.
I'm then running a plugin to regenerate the nested set values.
I'm also inserting into the category_lang and category_group tables.
When i view the category in the back office, they display in the list, but clicking them causes the ui to briefly display a different set of icons, and then return to the list. Clicking the edit button takes me to the edit screen for the 'Home' category.
I'm new to prestashop, so I'm not sure if there are any useful log files I could look at.
Does anyone have any idea where to start with this?
I'm using version 1.5.4.1.
Upvotes: 0
Views: 604
Reputation: 4012
You shouldn't do SQL queries like this. Use PrestaShop classes in your import, or you will miss some parts of category creation. You just need to include config/config.inc.php file, and then use Category class.
Upvotes: 1