If I re-index catalog_category_product, shouldn't the tables catalog_category_product
and catalog_category_product_index
have the same amount of entries afterwards?
If not, what is the difference or what explains it?
If yes, how come they are still different?
Thanks in advance!
Best Answer
They shouldn't have the same number of records.
The table
catalog_category_product
contains the links you create in the backend. Here is an example. Let's say you have the following category structure. Using category ids:And in the backed you associate the product with id
99
to the category with id 6.Then in
catalog_category_product
you will have:Let's say category 5 is anchor and category 2 is root. After reindexing you will see in
catalog_category_product_index
you will have 3 records for each store view where the product is available:P1, P2, P3 are the product positions.See how they are calculated in here.
is_parent is 0 if the product is directly related to the category and 1 if it's related to a child category (I'm not 100% sure about this).
Also, from the
_index
table only enabled products appear.