Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a way to disable nested collection inheritance from parents #1382

Closed
tianyingchun opened this issue Jan 27, 2022 · 1 comment
Closed

Is a way to disable nested collection inheritance from parents #1382

tianyingchun opened this issue Jan 27, 2022 · 1 comment

Comments

@tianyingchun
Copy link
Contributor

Is your feature request related to a problem? Please describe.

for vendure@1.4.5 i saw the nested collection, the children collection will inherits it's parents products, in fact in most case , for parent collection it should contains more products than children, i think we need give configuration option to disable nest collection inherits ability should be better.

Describe the solution you'd like

  1. we need give configuration option to disable nest collection inherits ability should be better.
  2. for collection filters We should have a more complex facet filter, which allows multiple combinations of facet values where you can specify the boolean operators.

Describe alternatives you've considered
no

Additional context
vendur@1.4.5

@tianyingchun
Copy link
Contributor Author

tianyingchun commented Jan 29, 2022

BTW

 private async applyCollectionFiltersInternal(
        collection: Collection,
        applyToChangedVariantsOnly = true,
    ): Promise<ID[]> {
        const ancestorFilters = await this.getAncestors(collection.id).then(ancestors =>
            ancestors.reduce(
                (filters, c) => [...filters, ...(c.filters || [])],
                [] as ConfigurableOperation[],
            ),
        );
        const preIds = await this.getCollectionProductVariantIds(collection);
        collection.productVariants = await this.getFilteredProductVariants([
            ...ancestorFilters,
            ...(collection.filters || []),
        ]);

If inherits filters from ancestors, we should remove duplicated filters(parent has A, child always defined A) this will generated two duplicated sql combination

michaelbromley added a commit that referenced this issue Mar 3, 2022
Relates to #1382. This commit introduces a new property on the Collection entity & GraphQL type -
`inheritFilters`. When set to `true` (the default), behaviour is the same as before - a Collection's
filters will be composed of its own filters, plus those of all ancestors up to the root.

Setting to `false` allows you to nest a Collection and set up filters which act completely
independently of the parent filters. This allows much more flexibility in setting up category
hierarchies.

BREAKING CHANGE: The new `inheritFilters` property on the Collection entity will require a DB
migration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants