skip to Main Content

With sylius 1.13 i wan’t to override AvailableProductOptionValuesResolver.php

I’ve copied the original class in src/Component/Product/Resolver/AvailableProductOptionValuesResolver.php

and change the namespace and add debug:

<?php

namespace AppComponentProductResolver;
class AvailableProductOptionValuesResolver implements AvailableProductOptionValuesResolverInterface
{
    public function resolve(ProductInterface $product, ProductOptionInterface $productOption): Collection
    {
        dd('modify');

What other changes need to be made for this class to be used? Because here it’s always the file in /vendor/…/AvailableProductOptionValuesResolver that’s used.

2

Answers


  1. Chosen as BEST ANSWER

    I had forgotten to define the service configuration dans services.yaml:

    AppComponentProductResolverAvailableProductOptionValuesResolver:
            decorates: 'sylius.available_product_option_values_resolver'
    

  2. It might not directly help, but perhaps you might also want to check the Sylius #support channel, where most community members are active. There are big chances someone would be eager to help with this, or other questions, which might become handy if you work on something serious with the platform.

    sylius.com/slack

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search