sulu / SuluProductBundle

Sulu product bundle
MIT License
7 stars 8 forks source link

[FEATURE] Added addon prices to products api #335

Closed turbo-ele closed 7 years ago

turbo-ele commented 7 years ago
Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Fixed tickets none
Related issues/PRs none
License MIT

What's in this PR?

In this PR, addon-prices are introduced to products api. Before this PR you were able to define prices for Product-Addon relations but could not derive them through an API call.

Example Usage

yourdomain.com/admin/api/products/id

...
addons: [
    {
    ...
        addonPrices: [
            {
                id: 1
                currency: {
                    id: 2
                    name: "Euro"
                    number: "978"
                    code: "EUR"
                },
                price: 11
                priceFormatted: "11,00"
            }
        ]
    }
]

BC Breaks/Deprecations

  1. ProductFactoryInterface was extended by a new function createAddonProductApiEntity
  2. ApiProduct now needs a ProductFactory to be passed to the constructor.