Skip to content

[ProductBundle] Question: Different prices for Retailers? #1120

@melv-n

Description

@melv-n

Hey folks!

First of all I'm fairly new to Symfony and Sylius, hence I'm posting here to get some feedback and a sense of direction from the more experienced users within these realms.

I'm making a Retailers user group with a ROLE_RETAILER role. If the logged in user is a retailer I would like to:

  • Show a reduced price; this is a predefined percentage e.g. 20% (configurable)
    The price would be displayed correctly on all parts of the site: browsing products, product view and cart.
  • Show the prices excluding taxes; by default I show prices with taxes included.

Now I'd like to know where I would best "hook" into the Product entity to apply some logic to modify its price. I've read about a postLoad event, which I believe was discouraged for some reason.

I could think of these approaches:

  • extend the Product model and modify the getPrice() method
  • somehow listen to the postLoad event for Product and set its price accordingly (?)

How would you tackle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedIssues needing help and clarification.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions