Refactor product relations to use new category_product and channel_product tables

- Updated queries and relationships in various controllers and models to replace `product_has_relations` with `category_product` and `channel_product`.
- Adjusted methods in `ProductFilterer`, `FilterParamsController`, and `FilterController` to reflect the new database structure.
- Modified seeder to insert data into the new `channel_product` table.
- Updated tests to ensure compatibility with the new product relation structure.
This commit is contained in:
Mekan1206
2026-02-09 00:48:22 +05:00
parent 683fa5e0d9
commit 522ebdae34
15 changed files with 102 additions and 48 deletions

View File

@@ -217,7 +217,7 @@ test('can list related products', function () {
// Then it selects product_ids from those categories.
// It doesn't explicitly exclude the main product ID in the query shown in tool output?
// Let's check the controller code again.
// It selects `product_has_relations.product_id` where `productable_id` IN (categories of main product).
// It selects `category_product.product_id` where `category_id` IN (categories of main product).
// It does NOT seem to exclude the main product ID in the query.
// However, `unique()` is used.
// If the main product is returned, count would be 3. If excluded, 2.