coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
277 stars 157 forks source link

Create custom filter - docs wrong #2697

Closed JustMe69 closed 2 months ago

JustMe69 commented 2 months ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

I'm trying to define a new filter. Docs stating for yaml file:

app.coreshop.shipping_rule.condition.my_rule:
    class: AppBundle\Shipping\Rule\Condition\MyRuleConditionChecker
    tags:
      - { name: coreshop.shipping_rule.condition, type: my_rule, form-type: AppBundle\Shipping\Form\Type\Condition\MyRuleConfigurationType }

app.filter.condition_type.my_filter_condition:
    class: AppBundle\Filter\MyFilterCondition
    tags:
      - { name: coreshop.filter.condition_type, type: app-my-filter, form-type: AppBundle\Filter\Form\Type\Condition\MyFilterCondition}

see: https://docs.coreshop.org/CoreShop/Development/Index_and_Filters/Filter/Custom_Filter

my configuration:

    # CoreShop Filter
    klio.coreshop.filter_condition.range_condition:
        class: CoreshopResourcesBundle\CoreShop\Filter\Processor\RangeFilterConditionProcessor
        tags:
            - { name: coreshop.shipping_rule.condition, type: range_condition, form-type: CoreshopResourcesBundle\CoreShop\Filter\Condition\RangeFilterConditionType }

    klio.filter.condition_type.range_type:
        class: CoreshopResourcesBundle\CoreShop\Filter\Condition\RangeFilterConditionType
        tags:
            - { name: coreshop.filter.condition_type, type: range_type, form-type: CoreshopResourcesBundle\CoreShop\Filter\Processor\RangeFilterConditionProcessor }

Error shown:

Shipping-rule-condition needs to implement 
"CoreShop\Component\Rule\Condition\ConditionCheckerInterface", 
"CoreshopResourcesBundle\CoreShop\Filter\Processor\RangeFilterConditionProcessor" given.

expecting: Docs are correct and custom filter creation is working

How to create custom filter condition and form correctly?

dpfaffenbauer commented 2 months ago

How does your CoreshopResourcesBundle\CoreShop\Filter\Condition\RangeFilterConditionType look like?

Docs definitely needs changes, since it states a shipping_rule.condition there... so you can remove the CoreshopResourcesBundle\CoreShop\Filter\Processor\RangeFilterConditionProcessor completely.

dpfaffenbauer commented 2 months ago

docs are fixed: https://docs.coreshop.org/CoreShop/Development/Index_and_Filters/Filter/Custom_Filter/index.html