Quick linking of goods to the main category in OpenCart 3
A brief note on linking a product to the main category in OpenCart 3 (OcStore 3).
If the product is imported to the site by the module Universal Import Pro, an imported product can be linked to regular categories, but there will be problems with linking to the main category (if our product belongs to several categories with different levels of nesting).
You can correct the situation by executing sql queries in phpmyadmin.
We go into the table of our database oc_product_to_category and execute the query
UPDATE `oc_product_to_category` SET `main_category`='1' WHERE `category_id` = '125'
where 123 will be the id of our category to which we want to bulk bind the main category.
In my case, the products had a third level of complexity, and when importing, in order for the product to be displayed at all levels, I had to bind all three levels. Accordingly, the main category should be the category of the last, third level. We indicate her ID in the request.
In general, this method is a great alternative to manual editing, especially if you need to link several hundred products.