phantomeye Posted May 15, 2013 Share Posted May 15, 2013 (edited) Hi Guys, Im looking for a way to see in the database, which all categories a product appears in. Eg: Product: Apple, category: 1,3,4 I tried searching the database but could not find the right table. In the product table, only the default category shows, it does not show all the categories it appears in. Someone in my office, moved all the products around and now nothing matches the original categories ( Thanks Edited May 15, 2013 by phantomeye (see edit history) Link to comment Share on other sites More sharing options...
Paul C Posted May 15, 2013 Share Posted May 15, 2013 The table is db-prefix_category_product. Maps id_category to id_product (and includes a manual position within the category). Via the object model: $product = new Product($id); $categories = $product->getCategories(); To set them: $product = new Product($id); $success = $product->updateCategories(array('1','3','4')) $product->id_category_default = '3'; $product->update(); Link to comment Share on other sites More sharing options...
phantomeye Posted May 15, 2013 Author Share Posted May 15, 2013 You're a rock star !! Thank you kind sir ! Link to comment Share on other sites More sharing options...
kylo Posted August 28, 2014 Share Posted August 28, 2014 (edited) hi (presta1.5.4) I have problem to add categories to database. I use multistore and i have parms id, parent,date add, date mod, name,desc, metatags im trying update tables with: "INSERT INTO `ps_category_shop` ( `id_category` , `id_shop` , `position` ) VALUES ( '".$row['categories_id']."', '3', '1' );" %%%%%%%%%%% "INSERT INTO `ps_category_lang` ( `id_category` , `id_shop` , `id_lang` , `name` , `description` , `link_rewrite` , `meta_title` , `meta_keywords` , `meta_description` ) VALUES ( '".$row['categories_id']."', '3', '1', '".$row['categories_name']."','".$row['categories_htc_desc_tag']."' , '".$link."', NULL , NULL , NULL ); " %%%%%%%%%%% "INSERT INTO `ps_category` ( `id_category` , `id_parent` , `id_shop_default` , `level_depth` , `nleft` , `nright` , `active` , `date_add` , `date_upd` , `position` , `is_root_category` ) VALUES ( '".$row['categories_id']."', '".$parent."', '3', '".$depth."', '12','34', '1', '".$row['date_added']."', '".$row['last_modified']."','1','0' );" %% insert into ps_category_group VALUES('".$row['categories_id']."','1');" after this i use Category::regenerateEntireNtree(); to generate nleft and nright columns and categories still doesnt works to my shop. i see them in BO to all shops but in FO doesnt exist Edited August 28, 2014 by kylo (see edit history) Link to comment Share on other sites More sharing options...
IgnacioSM Posted February 11, 2015 Share Posted February 11, 2015 You don't use the 3 groups? I mean, Guest, Visitor and Customer. You only add the first one 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