lolrich Posted May 8, 2013 Share Posted May 8, 2013 Hello, I am using the inbuild import system, to import all my products, but i can't find a way to link the products to my existing/new categories, i am using this: $object->id_category_default = 12; $object->category[] = 12; and the category id 12 already exists and works fine, and the product is created fine, its only the relation from the product to the category that is missing, i hope there is someone out there who got the magic moves to solve this issue :-) been searching everyone without any luck! Regards Link to comment Share on other sites More sharing options...
Paul C Posted May 8, 2013 Share Posted May 8, 2013 Assuming that you have an array of categories that the product belongs to I would set it via: $cats = array('1', '2', '3'); $product->id_category_default = $cats[0]; $product->updateCategories($cats); If you only have 1 category to set (12 in your example) then just do: $product->id_category_default = 12; $product->updateCategories(array('12')); Link to comment Share on other sites More sharing options...
lolrich Posted May 13, 2013 Author Share Posted May 13, 2013 Hello Paul, Thanks for your help, but that doesn't help apparently :-( the product wont relate to any categories/category from the code above, anyone else have a solution about this? 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