diff --git a/resources/references/app-reference/script-reference/cart-manipulation-script-services-reference.md b/resources/references/app-reference/script-reference/cart-manipulation-script-services-reference.md
index 722b79e26..3af77edf4 100644
--- a/resources/references/app-reference/script-reference/cart-manipulation-script-services-reference.md
+++ b/resources/references/app-reference/script-reference/cart-manipulation-script-services-reference.md
@@ -20,9 +20,8 @@ You can use the cart service to add line-items, change prices, add discounts, et
Use this to get the correct prices after you made changes to the cart.
Note that after calling the `calculate()` all collections (e.g. items(), products()) get new references,
so if you still hold references to things inside the cart, these are outdated after calling `calculate()`.
-
+
The `calculate()` method will be called automatically after your cart script executed.
-
### count()
* `count()` returns the count of line-items in this collection.
@@ -31,11 +30,11 @@ You can use the cart service to add line-items, change prices, add discounts, et
* **Returns** `int`
The number of line-items in this collection.
-
### discount()
* The `discount()` methods creates a new discount line-item with the given type and value.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\DiscountFacade`](./cart-manipulation-script-services-reference#discountfacade)
Returns the newly created discount line-item.
@@ -65,7 +64,6 @@ You can use the cart service to add line-items, change prices, add discounts, et
{% do services.cart.discount('my-discount', 'absolute', price, 'Fancy discount') %}
```
-
* Add a relative discount to the cart.
```twig
@@ -79,7 +77,6 @@ You can use the cart service to add line-items, change prices, add discounts, et
{% do services.cart.discount('my-discount', 'percentage', -10, 'Fancy discount') %}
```
-
### errors()
* The `errors()` method returns the current errors of the cart.
@@ -88,35 +85,34 @@ You can use the cart service to add line-items, change prices, add discounts, et
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ErrorsFacade`](./cart-manipulation-script-services-reference#errorsfacade)
A `ErrorsFacade` containing all cart errors as a collection (may be an empty collection if there are no errors).
-
### get()
* `get()` returns the line-item with the given id from this collection.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade) | `null`
The line-item with the given id, or null if it does not exist.
* **Arguments:**
* *`string`* **id**: The id of the line-item that should be returned.
-
### has()
* `has()` checks if a line-item with the given id exists in this collection.
+
* **Returns** `bool`
Returns true if the given line-item or a line-item with the given id already exists in the collection, false otherwise.
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id or a line-item that should be checked if it already exists in the collection.
-
### items()
* The `items()` method returns all line-items of the current cart for further manipulation.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemsFacade`](./cart-manipulation-script-services-reference#itemsfacade)
A `ItemsFacade` containing all line-items in the current cart as a collection.
-
### price()
* The `price()` method returns the current price of the cart.
@@ -126,7 +122,6 @@ You can use the cart service to add line-items, change prices, add discounts, et
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\CartPriceFacade`](./cart-manipulation-script-services-reference#cartpricefacade)
The calculated price of the cart.
-
### products()
* The `product()` method returns all products of the current cart for further manipulation.
@@ -135,11 +130,11 @@ You can use the cart service to add line-items, change prices, add discounts, et
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ProductsFacade`](./cart-manipulation-script-services-reference#productsfacade)
A `ProductsFacade` containing all product line-items in the current cart as a collection.
-
### remove()
* `remove()` removes the given line-item or the line-item with the given id from this collection.
+
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id of the line-item or the line-item that should be removed.
* **Examples:**
@@ -150,19 +145,19 @@ You can use the cart service to add line-items, change prices, add discounts, et
{% do services.cart.products.remove(hook.ids.get('p1')) %}
```
-
### states()
* `states()` allows you to access the state functions of the current cart.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\StatesFacade`](./cart-manipulation-script-services-reference#statesfacade)
A `StatesFacade` containing all cart states as a collection (maybe an empty collection if there are no states).
-
### surcharge()
* The `surcharge()` methods creates a new surcharge line-item with the given type and value.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\DiscountFacade`](./cart-manipulation-script-services-reference#discountfacade)
Returns the newly created surcharge line-item.
@@ -184,7 +179,6 @@ You can use the cart service to add line-items, change prices, add discounts, et
{% do services.cart.surcharge('my-surcharge', 'absolute', price, 'Fancy surcharge') %}
```
-
* Add a relative surcharge to the cart.
```twig
@@ -198,17 +192,17 @@ You can use the cart service to add line-items, change prices, add discounts, et
{% do services.cart.surcharge('my-surcharge', 'percentage', -10, 'Fancy discount') %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\CartPriceFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/CartPriceFacade.php) {#cartpricefacade}
The CartPriceFacade is a wrapper around the calculated price of a cart.
+
### create()
* `create()` creates a new `PriceCollection` based on an array of prices.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Pricing\PriceCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Pricing/PriceCollection.php)
Returns the newly created `PriceCollection`.
@@ -222,15 +216,14 @@ The CartPriceFacade is a wrapper around the calculated price of a cart.
'default': { 'gross': 19.99, 'net': 19.99}
}) %}
```
-
### getNet()
* `getNet()` returns the net price of the cart.
+
* **Returns** `float`
Returns the net price of the cart as float.
-
### getPosition()
* `getPosition()` returns the sum price of all line-items in the cart.
@@ -240,23 +233,22 @@ The CartPriceFacade is a wrapper around the calculated price of a cart.
* **Returns** `float`
The position price as float.
-
### getRaw()
* `getRaw() returns the total price of the cart before rounding.
+
* **Returns** `float`
The total price before rounding as float.
-
### getRounded()
* Alias for `getTotal()`.
+
* **Returns** `float`
The rounded total price of the cart as float.
-
### getTotal()
* `getTotal()` returns the total price of the cart that has to be paid by the customer.
@@ -266,17 +258,17 @@ The CartPriceFacade is a wrapper around the calculated price of a cart.
* **Returns** `float`
The rounded total price of the cart as float.
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\ContainerFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/ContainerFacade.php) {#containerfacade}
The ContainerFacade allows you to wrap multiple line-items inside a container line-item.
+
### add()
* Use the `add()` method to add an item to this container.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade)
The item that was added to the container.
@@ -288,7 +280,6 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
```twig
```
-
### count()
* `count()` returns the count of line-items in this collection.
@@ -297,11 +288,11 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
* **Returns** `int`
The number of line-items in this collection.
-
### discount()
* The `discount()` methods creates a new discount line-item with the given type and value.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\DiscountFacade`](./cart-manipulation-script-services-reference#discountfacade)
Returns the newly created discount line-item.
@@ -331,7 +322,6 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.discount('my-discount', 'absolute', price, 'Fancy discount') %}
```
-
* Add a relative discount to the cart.
```twig
@@ -345,65 +335,64 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.discount('my-discount', 'percentage', -10, 'Fancy discount') %}
```
-
### get()
* `get()` returns the line-item with the given id from this collection.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade) | `null`
The line-item with the given id, or null if it does not exist.
* **Arguments:**
* *`string`* **id**: The id of the line-item that should be returned.
-
### getChildren()
* `getChildren()` returns the child line-items of this line-item.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemsFacade`](./cart-manipulation-script-services-reference#itemsfacade)
Returns the children as a `ItemsFacade`, that may be empty if no children exist.
-
### getId()
* `getId()` returns the id of the line-item.
+
* **Returns** `string`
Returns the id.
-
### getLabel()
* `getLabel()` returns the translated label of the line-item.
+
* **Returns** `string` | `null`
Returns the translated label, or null if none exists.
-
### getPayload()
* `getPayload()` returns the payload of this line-item.
+
* **Returns** [`Shopware\Core\Framework\Script\Facade\ArrayFacade`](./miscellaneous-script-services-reference#arrayfacade)
Returns the payload as `ArrayFacade`.
-
### getPrice()
* `getPrice()` returns the calculated price of the line-item.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\PriceFacade`](./cart-manipulation-script-services-reference#pricefacade) | `null`
Returns the price of the line-item as a `PriceFacade` or null if the line-item has no calculated price.
-
### getQuantity()
* `getQuantity()` returns the quantity of the line-item.
+
* **Returns** `int`
Returns the quantity.
-
### getReferencedId()
* `getReferenceId()` returns the id of the referenced entity of the line-item.
@@ -412,7 +401,6 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
* **Returns** `string` | `null`
Returns the id of the referenced entity, or null if no entity is referenced.
-
### getType()
* `getType()` returns the type of this line-item.
@@ -421,17 +409,16 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
* **Returns** `string`
The type of the line-item.
-
### has()
* `has()` checks if a line-item with the given id exists in this collection.
+
* **Returns** `bool`
Returns true if the given line-item or a line-item with the given id already exists in the collection, false otherwise.
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id or a line-item that should be checked if it already exists in the collection.
-
### products()
* The `product()` method returns all products inside the current container for further manipulation.
@@ -440,11 +427,11 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ProductsFacade`](./cart-manipulation-script-services-reference#productsfacade)
A `ProductsFacade` containing all product line-items inside the current container as a collection.
-
### remove()
* `remove()` removes the given line-item or the line-item with the given id from this collection.
+
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id of the line-item or the line-item that should be removed.
* **Examples:**
@@ -455,11 +442,11 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.products.remove(hook.ids.get('p1')) %}
```
-
### surcharge()
* The `surcharge()` methods creates a new surcharge line-item with the given type and value.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\DiscountFacade`](./cart-manipulation-script-services-reference#discountfacade)
Returns the newly created surcharge line-item.
@@ -481,7 +468,6 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.surcharge('my-surcharge', 'absolute', price, 'Fancy surcharge') %}
```
-
* Add a relative surcharge to the cart.
```twig
@@ -495,7 +481,6 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.surcharge('my-surcharge', 'percentage', -10, 'Fancy discount') %}
```
-
### take()
* `take()` splits an existing line-item by a given quantity.
@@ -523,9 +508,7 @@ The ContainerFacade allows you to wrap multiple line-items inside a container li
{% do services.cart.products.add(split) %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\DiscountFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/DiscountFacade.php) {#discountfacade}
The DiscountFacade is a wrapper around a newly created discount.
@@ -535,20 +518,19 @@ Note that this wrapper is independent from the line-item that was added for this
* `getId()` returns the id of the line-item that was added with this discount.
+
* **Returns** `string`
The id of the discount line-item.
-
### getLabel()
* `getLabel()` returns the translated label of the line-item that was added with this discount.
+
* **Returns** `string` | `null`
The translated label of the discount line-item.
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\ErrorsFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/ErrorsFacade.php) {#errorsfacade}
The ErrorsFacade is a wrapper around the errors of a cart.
@@ -574,27 +556,26 @@ You can use it to add new errors to the cart or remove existing ones.
```twig
{% do services.cart.errors.error('NO_PRODUCTS_IN_CART') %}
```
-
### get()
* The `get()` method returns the error with the given id.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Error\Error`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Error/Error.php) | `null`
The Error with the given id, null if an error with that id does not exist.
* **Arguments:**
* *`string`* **id**: The id of the error that should be returned.
-
### has()
* The `has()` method, checks if an error with a given id exists.
+
* **Returns** `bool`
Returns true if an error with that key exists, false otherwise.
* **Arguments:**
* *`string`* **id**: The id of the error that should be checked.
-
### notice()
* The `notice()` method adds a new error of type `notice` to the cart.
@@ -615,26 +596,23 @@ You can use it to add new errors to the cart or remove existing ones.
```twig
{% do services.cart.errors.warning('ADD_PRODUCTS_OR_GO_AWAY') %}
```
-
* Add a notice to the cart with a custom id.
```twig
{% do services.cart.errors.notice('YOU_SHOULD_REALLY_ADD_PRODUCTS', 'add-same-message') %}
```
-
* Add a notice to the cart with parameters.
```twig
{% do services.cart.errors.notice('MESSAGE_WITH_PARAMETERS', null, {'foo': 'bar'}) %}
```
-
### remove()
* The `remove()` method removes the error with the given id.
+
* **Arguments:**
* *`string`* **id**: The id of the error that should be removed.
-
### resubmittable()
* The `resubmittable()` method adds a new error of type `error` to the cart.
@@ -649,7 +627,6 @@ You can use it to add new errors to the cart or remove existing ones.
Default: `array (
)`
-
### warning()
* The `warning()` method adds a new error of type `warning` to the cart.
@@ -670,61 +647,60 @@ You can use it to add new errors to the cart or remove existing ones.
```twig
{% do services.cart.errors.notice('YOU_SHOULD_REALLY_ADD_PRODUCTS') %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/ItemFacade.php) {#itemfacade}
The ItemFacade is a wrapper around one line-item.
+
### getChildren()
* `getChildren()` returns the child line-items of this line-item.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemsFacade`](./cart-manipulation-script-services-reference#itemsfacade)
Returns the children as a `ItemsFacade`, that may be empty if no children exist.
-
### getId()
* `getId()` returns the id of the line-item.
+
* **Returns** `string`
Returns the id.
-
### getLabel()
* `getLabel()` returns the translated label of the line-item.
+
* **Returns** `string` | `null`
Returns the translated label, or null if none exists.
-
### getPayload()
* `getPayload()` returns the payload of this line-item.
+
* **Returns** [`Shopware\Core\Framework\Script\Facade\ArrayFacade`](./miscellaneous-script-services-reference#arrayfacade)
Returns the payload as `ArrayFacade`.
-
### getPrice()
* `getPrice()` returns the calculated price of the line-item.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\PriceFacade`](./cart-manipulation-script-services-reference#pricefacade) | `null`
Returns the price of the line-item as a `PriceFacade` or null if the line-item has no calculated price.
-
### getQuantity()
* `getQuantity()` returns the quantity of the line-item.
+
* **Returns** `int`
Returns the quantity.
-
### getReferencedId()
* `getReferenceId()` returns the id of the referenced entity of the line-item.
@@ -733,7 +709,6 @@ The ItemFacade is a wrapper around one line-item.
* **Returns** `string` | `null`
Returns the id of the referenced entity, or null if no entity is referenced.
-
### getType()
* `getType()` returns the type of this line-item.
@@ -742,7 +717,6 @@ The ItemFacade is a wrapper around one line-item.
* **Returns** `string`
The type of the line-item.
-
### take()
* `take()` splits an existing line-item by a given quantity.
@@ -770,17 +744,17 @@ The ItemFacade is a wrapper around one line-item.
{% do services.cart.products.add(split) %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\ItemsFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/ItemsFacade.php) {#itemsfacade}
The ItemsFacade is a wrapper around a collection of line-items.
+
### add()
* `add()` adds a line-item to this collection.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade)
Returns the added line-item.
@@ -807,7 +781,6 @@ The ItemsFacade is a wrapper around a collection of line-items.
{% do services.cart.discount('my-discount', 'absolute', price, 'Fancy discount') %}
```
-
### count()
* `count()` returns the count of line-items in this collection.
@@ -816,31 +789,31 @@ The ItemsFacade is a wrapper around a collection of line-items.
* **Returns** `int`
The number of line-items in this collection.
-
### get()
* `get()` returns the line-item with the given id from this collection.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade) | `null`
The line-item with the given id, or null if it does not exist.
* **Arguments:**
* *`string`* **id**: The id of the line-item that should be returned.
-
### has()
* `has()` checks if a line-item with the given id exists in this collection.
+
* **Returns** `bool`
Returns true if the given line-item or a line-item with the given id already exists in the collection, false otherwise.
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id or a line-item that should be checked if it already exists in the collection.
-
### remove()
* `remove()` removes the given line-item or the line-item with the given id from this collection.
+
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id of the line-item or the line-item that should be removed.
* **Examples:**
@@ -851,18 +824,18 @@ The ItemsFacade is a wrapper around a collection of line-items.
{% do services.cart.products.remove(hook.ids.get('p1')) %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\PriceFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/PriceFacade.php) {#pricefacade}
The PriceFacade is a wrapper around a price.
+
### change()
* `change()` allows a price overwrite of the current price scope. The provided price will be recalculated
over the quantity price calculator to consider quantity, tax rule and cash rounding configurations.
+
* **Arguments:**
* *[`Shopware\Core\Framework\DataAbstractionLayer\Pricing\PriceCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Pricing/PriceCollection.php)* **price**: The provided price can be a fetched price from the database or generated over the `PriceFactory` statically
* **Examples:**
@@ -875,11 +848,11 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{ to: null, price: services.price.create({ 'default': { 'gross': 5, 'net': 5} }) },
]) %}
```
-
### create()
* `create()` creates a new `PriceCollection` based on an array of prices.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Pricing\PriceCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Pricing/PriceCollection.php)
Returns the newly created `PriceCollection`.
@@ -893,7 +866,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
'default': { 'gross': 19.99, 'net': 19.99}
}) %}
```
-
### discount()
* `discount()` allows a percentage discount calculation of the current price scope. The provided value will be ensured to be negative via `abs(value) * -1`.
@@ -907,39 +879,38 @@ over the quantity price calculator to consider quantity, tax rule and cash round
```twig
{% do product.calculatedPrice.discount(10) %}
```
-
### getQuantity()
* `getQuantity()` returns the quantity that was used to calculate the total price.
+
* **Returns** `int`
Returns the quantity.
-
### getRules()
* `getRules()` returns the tax rules that were used to calculate the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Tax\Struct\TaxRuleCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Tax/Struct/TaxRuleCollection.php)
Returns the tax rules.
-
### getTaxes()
* `getTaxes()` returns the calculated taxes of the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTaxCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Tax/Struct/CalculatedTaxCollection.php)
Returns the calculated taxes.
-
### getTotal()
* `getTotal()` returns the total price for the line-item.
+
* **Returns** `float`
The total price as float.
-
### getUnit()
* `getUnit()` returns the unit price for the line-item.
@@ -948,7 +919,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
* **Returns** `float`
The price per unit as float.
-
### minus()
* `minus()` allows a price subtraction of the current price scope. The provided price will be recalculated via the quantity price calculator.
@@ -967,7 +937,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{% do product.calculatedPrice.minus(price) %}
```
-
### plus()
* `plus()` allows a price addition of the current price scope. The provided price will be recalculated via the quantity price calculator.
@@ -986,7 +955,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{% do product.calculatedPrice.plus(price) %}
```
-
### surcharge()
* `surcharge()` allows a percentage surcharge calculation of the current price scope. The provided value will be ensured to be negative via `abs(value)`.
@@ -1000,17 +968,17 @@ over the quantity price calculator to consider quantity, tax rule and cash round
```twig
{% do product.calculatedPrice.surcharge(10) %}
```
-
_________
-
## [services.price (`Shopware\Core\Checkout\Cart\Facade\PriceFactory`)](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/PriceFactory.php) {#pricefactory}
The PriceFacade is a wrapper around a price.
+
### create()
* `create()` creates a new `PriceCollection` based on an array of prices.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Pricing\PriceCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Pricing/PriceCollection.php)
Returns the newly created `PriceCollection`.
@@ -1024,13 +992,12 @@ The PriceFacade is a wrapper around a price.
'default': { 'gross': 19.99, 'net': 19.99}
}) %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\ProductsFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/ProductsFacade.php) {#productsfacade}
The ProductsFacade is a wrapper around a collection of product line-items.
+
### add()
* `add()` adds a new product line-item to this collection.
@@ -1050,7 +1017,6 @@ The ProductsFacade is a wrapper around a collection of product line-items.
```twig
{% do services.cart.products.add(hook.ids.get('p1')) %}
```
-
### count()
* `count()` returns the count of line-items in this collection.
@@ -1059,7 +1025,6 @@ The ProductsFacade is a wrapper around a collection of product line-items.
* **Returns** `int`
The number of line-items in this collection.
-
### create()
* `create()` creates a new product line-item for the product with the given id in the given quantity.
@@ -1073,11 +1038,11 @@ The ProductsFacade is a wrapper around a collection of product line-items.
* *`int`* **quantity**: Optionally provide the quantity with which the product line-item should be created, defaults to 1.
Default: `1`
-
### get()
* `get()` returns the product line-item with the given product id.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\ItemFacade`](./cart-manipulation-script-services-reference#itemfacade) | `null`
The line-item associated with the given product id, or null if it does not exist.
@@ -1089,21 +1054,21 @@ The ProductsFacade is a wrapper around a collection of product line-items.
```twig
{% set product = services.cart.products.get(hook.ids.get('p1')) %}
```
-
### has()
* `has()` checks if a line-item with the given id exists in this collection.
+
* **Returns** `bool`
Returns true if the given line-item or a line-item with the given id already exists in the collection, false otherwise.
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id or a line-item that should be checked if it already exists in the collection.
-
### remove()
* `remove()` removes the given line-item or the line-item with the given id from this collection.
+
* **Arguments:**
* *`string|\ItemFacade`* **id**: The id of the line-item or the line-item that should be removed.
* **Examples:**
@@ -1114,13 +1079,12 @@ The ProductsFacade is a wrapper around a collection of product line-items.
{% do services.cart.products.remove(hook.ids.get('p1')) %}
```
-
_________
-
## [`Shopware\Core\Checkout\Cart\Facade\StatesFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Facade/StatesFacade.php) {#statesfacade}
The StatesFacade allows access to the current cart states and functions.
+
### add()
* `add()` allows you to add one or multiple states as string values to the cart.
@@ -1128,30 +1092,29 @@ The StatesFacade allows access to the current cart states and functions.
This can be useful to check if your script did already run and did some manipulations to the cart.
* **Arguments:**
* *`string`* **states**: One or more strings that will be stored on the cart.
-
### get()
* `get()` returns all states that are present on the cart.
+
* **Returns** `array`
An array containing all current states of the cart.
-
### has()
* `has()` allows you to check if one or more states are present on the cart.
+
* **Returns** `bool`
Returns true if at least one of the passed states is present on the cart, false otherwise.
* **Arguments:**
* *`string`* **states**: One or more strings that should be checked.
-
### remove()
* `remove()` removes the given state from the cart, if it existed.
+
* **Arguments:**
* *`string`* **state**: The state that should be removed.
-
_________
diff --git a/resources/references/app-reference/script-reference/custom-endpoint-script-services-reference.md b/resources/references/app-reference/script-reference/custom-endpoint-script-services-reference.md
index a957e1b8f..2827a829e 100644
--- a/resources/references/app-reference/script-reference/custom-endpoint-script-services-reference.md
+++ b/resources/references/app-reference/script-reference/custom-endpoint-script-services-reference.md
@@ -12,10 +12,12 @@ nav:
The `cache` service allows you to invalidate the cache if some entity is updated.
+
### invalidate()
* `invalidate()` allows you to invalidate all cache entries with the given tag.
+
* **Arguments:**
* *`array`* **tags**: The tags for which all cache entries should be invalidated as array.
* **Examples:**
@@ -24,7 +26,6 @@ The `cache` service allows you to invalidate the cache if some entity is updated
```twig
{% do services.cache.invalidate(['my-tag']) %}
```
-
* Build tags based on written entities and invalidate those tags.
```twig
@@ -41,7 +42,6 @@ The `cache` service allows you to invalidate the cache if some entity is updated
{% do services.cache.invalidate(tags) %}
```
-
* Build tags if products with a specific property is created and invalidate those tags.
```twig
@@ -59,9 +59,7 @@ The `cache` service allows you to invalidate the cache if some entity is updated
{% do services.cache.invalidate(tags) %}
```
-
_________
-
## [services.writer (`Shopware\Core\Framework\DataAbstractionLayer\Facade\RepositoryWriterFacade`)](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Facade/RepositoryWriterFacade.php) {#repositorywriterfacade}
The `writer` service allows you to write data, that is stored inside shopware.
@@ -71,6 +69,7 @@ Keep in mind that your app needs to have the correct permissions for the data it
* The `delete()` method allows you to delete entities from the database.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Event/EntityWrittenContainerEvent.php)
The WriteEvents that were generated by executing the `delete()`.
@@ -85,11 +84,11 @@ Keep in mind that your app needs to have the correct permissions for the data it
{ 'id': hook.productId }
]) %}
```
-
### sync()
* The `sync()` method allows you to execute updates and deletes to multiple entities in one method call.
+
* **Returns** [`Shopware\Core\Framework\Api\Sync\SyncResult`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Api/Sync/SyncResult.php)
The result of the `sync()`.
@@ -118,7 +117,6 @@ Keep in mind that your app needs to have the correct permissions for the data it
{% do services.writer.sync(payload) %}
```
-
### upsert()
* The `upsert()` method allows you to create or update entities inside the database.
@@ -138,7 +136,6 @@ Keep in mind that your app needs to have the correct permissions for the data it
{ 'name': 'new Tax', 'taxRate': 99.9 }
]) %}
```
-
* Update an existing entity.
```twig
@@ -146,17 +143,17 @@ Keep in mind that your app needs to have the correct permissions for the data it
{ 'id': hook.productId, 'active': true }
]) %}
```
-
_________
-
## [services.response (`Shopware\Core\Framework\Script\Api\ScriptResponseFactoryFacade`)](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Script/Api/ScriptResponseFactoryFacade.php) {#scriptresponsefactoryfacade}
The `response` service allows you to create HTTP-Responses.
+
### json()
* The `json()` method allows you to create a JSON-Response.
+
* **Returns** [`Shopware\Core\Framework\Script\Api\ScriptResponse`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Script/Api/ScriptResponse.php)
The created response object, remember to assign it to the hook with `hook.setResponse()`.
@@ -172,7 +169,6 @@ The `response` service allows you to create HTTP-Responses.
{% set response = services.response.json({ 'foo': 'bar' }) %}
{% do hook.setResponse(response) %}
```
-
* Search for products and return them in a JsonResponse.
```twig
@@ -182,7 +178,6 @@ The `response` service allows you to create HTTP-Responses.
{% set response = services.response.json({ 'products': products }) %}
{% do hook.setResponse(response) %}
```
-
* Provide a response to a ActionButtons request from the administration.
```twig
@@ -198,11 +193,11 @@ The `response` service allows you to create HTTP-Responses.
{% do hook.setResponse(response) %}
```
-
### redirect()
* The `redirect()` method allows you to create a RedirectResponse.
+
* **Returns** [`Shopware\Core\Framework\Script\Api\ScriptResponse`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Script/Api/ScriptResponse.php)
The created response object, remember to assign it to the hook with `hook.setResponse()`.
@@ -219,14 +214,12 @@ The `response` service allows you to create HTTP-Responses.
{% set response = services.response.redirect('api.product.detail', { 'path': productId }) %}
{% do hook.setResponse(response) %}
```
-
* Redirect to a storefront page.
```twig
{% set response = services.response.redirect('frontend.detail.page', { 'productId': productId }) %}
{% do hook.setResponse(response) %}
```
-
### render()
* The `render()` method allows you to render a twig view with the parameters you provide and create a StorefrontResponse.
@@ -255,5 +248,4 @@ The `response` service allows you to create HTTP-Responses.
{% do hook.setResponse(response) %}
```
-
_________
diff --git a/resources/references/app-reference/script-reference/data-loading-script-services-reference.md b/resources/references/app-reference/script-reference/data-loading-script-services-reference.md
index 779de716b..e3507020c 100644
--- a/resources/references/app-reference/script-reference/data-loading-script-services-reference.md
+++ b/resources/references/app-reference/script-reference/data-loading-script-services-reference.md
@@ -17,6 +17,7 @@ Keep in mind that your app needs to have the correct permissions for the data it
* The `aggregate()` method allows you to execute aggregations specified in the given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\AggregationResult\AggregationResultCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/AggregationResult/AggregationResultCollection.php)
A `AggregationResultCollection` including the results of the aggregations you specified in the criteria.
@@ -42,11 +43,11 @@ Keep in mind that your app needs to have the correct permissions for the data it
'sum': sumResult.getSum
}) %}
```
-
### ids()
* The `ids()` method allows you to search for the Ids of Entities that match a given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/IdSearchResult.php)
A `IdSearchResult` including all entity-ids that matched your criteria.
@@ -72,11 +73,11 @@ Keep in mind that your app needs to have the correct permissions for the data it
'ids': productIds
}) %}
```
-
### search()
* The `search()` method allows you to search for Entities that match a given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/EntitySearchResult.php)
A `EntitySearchResult` including all entities that matched your criteria.
@@ -98,7 +99,6 @@ Keep in mind that your app needs to have the correct permissions for the data it
{% do page.addExtension('myProduct', product) %}
```
-
* Filter the search result.
```twig
@@ -115,7 +115,6 @@ Keep in mind that your app needs to have the correct permissions for the data it
{% do page.addExtension('myProduct', product) %}
```
-
* Add associations that should be included in the result.
```twig
@@ -134,9 +133,7 @@ Keep in mind that your app needs to have the correct permissions for the data it
{% do page.addExtension('myProduct', product) %}
{% do page.addExtension('myManufacturer', product.manufacturer) %}
```
-
_________
-
## [services.store (`Shopware\Core\Framework\DataAbstractionLayer\Facade\SalesChannelRepositoryFacade`)](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Facade/SalesChannelRepositoryFacade.php) {#saleschannelrepositoryfacade}
The `store` service can be used to access publicly available `store-api` data.
@@ -150,6 +147,7 @@ this means that e.g. product prices are already calculated based on the current
* The `aggregate()` method allows you to execute aggregations specified in the given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\AggregationResult\AggregationResultCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/AggregationResult/AggregationResultCollection.php)
A `AggregationResultCollection` including the results of the aggregations you specified in the criteria.
@@ -175,11 +173,11 @@ this means that e.g. product prices are already calculated based on the current
'sum': sumResult.getSum
}) %}
```
-
### ids()
* The `ids()` method allows you to search for the Ids of Entities that match a given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/IdSearchResult.php)
A `IdSearchResult` including all entity-ids that matched your criteria.
@@ -205,11 +203,11 @@ this means that e.g. product prices are already calculated based on the current
'ids': productIds
}) %}
```
-
### search()
* The `search()` method allows you to search for Entities that match a given criteria.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Search\EntitySearchResult`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Search/EntitySearchResult.php)
A `EntitySearchResult` including all entities that matched your criteria.
@@ -231,7 +229,6 @@ this means that e.g. product prices are already calculated based on the current
{% do page.addExtension('myProduct', product) %}
```
-
* Filter the search result.
```twig
@@ -248,7 +245,6 @@ this means that e.g. product prices are already calculated based on the current
{% do page.addExtension('myProduct', product) %}
```
-
* Add associations that should be included in the result.
```twig
@@ -267,5 +263,4 @@ this means that e.g. product prices are already calculated based on the current
{% do page.addExtension('myProduct', product) %}
{% do page.addExtension('myManufacturer', product.manufacturer) %}
```
-
_________
diff --git a/resources/references/app-reference/script-reference/miscellaneous-script-services-reference.md b/resources/references/app-reference/script-reference/miscellaneous-script-services-reference.md
index 80d6d2989..21207bfbc 100644
--- a/resources/references/app-reference/script-reference/miscellaneous-script-services-reference.md
+++ b/resources/references/app-reference/script-reference/miscellaneous-script-services-reference.md
@@ -12,7 +12,6 @@ nav:
The `request` service allows you to access the current request in the script
Examples:
-
```twig
{% block response %}
{% if services.request.method != "POST" %}
@@ -32,10 +31,10 @@ Examples:
* The method `cookies` returns all request cookies as an array.
+
* **Returns** `array`
request cookies
-
### headers()
* The method `headers` returns all request headers as an array.
@@ -44,39 +43,38 @@ Examples:
* **Returns** `array`
request headers
-
### ip()
* The ip method returns the real client ip address
+
* **Returns** `string` | `null`
request client ip address
-
### method()
* The method returns the request method in upper case
+
* **Returns** `string`
request method in upper case
-
### pathInfo()
* The method `pathInfo` returns the request path info. The path info can be also an internal link when a seo url is used.
+
* **Returns** `string`
request path info
-
### query()
* The method `query` returns all query parameters as an array
+
* **Returns** `array`
request query parameters
-
### request()
* The method `request` returns all post parameters as an array.
@@ -85,33 +83,33 @@ Examples:
* **Returns** `array`
request post parameters
-
### scheme()
* The scheme method returns the request scheme
+
* **Returns** `string`
request scheme
-
### uri()
* The method `uri` returns the request uri with the resolved url
+
* **Returns** `string`
request uri
-
_________
-
## [services.acl (`Shopware\Core\Framework\Script\Api\AclFacade`)](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Script/Api/AclFacade.php) {#aclfacade}
The `acl` service allows you to check if your app has been granted the specified privilege.
+
### can()
* The `can()` method allows you to check if your app has been granted the specified privilege.
+
* **Returns** `bool`
Returns `true` if the privilege has been granted, `false` otherwise.
@@ -131,15 +129,12 @@ The `acl` service allows you to check if your app has been granted the specified
{% do page.addExtension('myProduct', product) %}
{% endif %}
```
-
_________
-
## [`Shopware\Core\Framework\Script\Facade\ArrayFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Script/Facade/ArrayFacade.php) {#arrayfacade}
The ArrayFacade acts as a wrapper around an array and allows easier manipulation of arrays inside scripts.
An array facade can also be accessed like a "normal" array inside twig.
Examples:
-
```twig
{% do array.push('test') %}
@@ -156,22 +151,23 @@ Examples:
* `all()` function returns all elements of this array.
+
* **Returns** `array`
Returns all elements of this array.
-
### count()
* `count()` returns the count of elements inside this array.
+
* **Returns** `int`
Returns the count of elements.
-
### merge()
* `merge()` recursively merges the array with the given array.
+
* **Arguments:**
* *`array<string|int,mixed>|\ArrayFacade`* **array**: The array that should be merged with this array. Either a plain `array` or another `ArrayFacade`.
* **Examples:**
@@ -182,32 +178,32 @@ Examples:
{% do product.payload.merge(my_array) %}
```
-
### push()
* `push()` adds a new value to the end of the array.
+
* **Arguments:**
* *`mixed`* **value**: The value that should be added.
-
### remove()
* `remove()` removes the given value from the array. It does nothing if the provided value does not exist in the array.
+
* **Arguments:**
* *`mixed`* **value**: The value that should be removed.
-
### removeBy()
* `removeBy()` removes the value at the given index from the array.
+
* **Arguments:**
* *`string|int`* **index**: The index that should be removed.
-
### replace()
* `replace()` recursively replaces elements from the given array into this array.
+
* **Arguments:**
* *`array<string|int,mixed>|\ArrayFacade`* **array**: The array from which the elements should be replaced into this array. Either a plain `array` or another `ArrayFacade`.
* **Examples:**
@@ -218,15 +214,16 @@ Examples:
{% do product.payload.replace(second) %}
```
-
### reset()
* `reset()` removes all entries from the array.
+
### set()
* `set()` adds a new element to the array using the given key.
+
* **Arguments:**
* *`string|int`* **key**: The array key.
* *`mixed`* **value**: The value that should be added.
@@ -238,13 +235,12 @@ Examples:
{% do product.payload.set('test', 1) %}
```
-
_________
-
## [services.config (`Shopware\Core\System\SystemConfig\Facade\SystemConfigFacade`)](https://github.com/shopware/shopware/blob/trunk/src/Core/System/SystemConfig/Facade/SystemConfigFacade.php) {#systemconfigfacade}
The `config` service allows you to access the shop's and your app's configuration values.
+
### app()
* The `app()` method allows you to access the config values your app's configuration.
@@ -252,6 +248,7 @@ The `config` service allows you to access the shop's and your app's configuratio
Notice that your app does not need any additional privileges to use this method, as you can only access your own app's configuration.
* **Returns** `array<string,mixed>|bool|float|int|string|null`
+
* **Arguments:**
* *`string`* **key**: The name of the configuration value specified in the config.xml e.g. `exampleTextField`.
* *`string` | `null`* **salesChannelId**: The SalesChannelId if you need the config value for a specific SalesChannel, if you don't provide a SalesChannelId, the one of the current Context is used as default.
@@ -263,7 +260,6 @@ The `config` service allows you to access the shop's and your app's configuratio
```twig
{% set appConfig = services.config.app('app_config') %}
```
-
### get()
* The `get()` method allows you to access all config values of the store.
@@ -271,6 +267,7 @@ The `config` service allows you to access the shop's and your app's configuratio
Notice that your app needs the `system_config:read` privilege to use this method.
* **Returns** `array<string,mixed>|bool|float|int|string|null`
+
* **Arguments:**
* *`string`* **key**: The key of the configuration value e.g. `core.listing.defaultSorting`.
* *`string` | `null`* **salesChannelId**: The SalesChannelId if you need the config value for a specific SalesChannel, if you don't provide a SalesChannelId, the one of the current Context is used as default.
@@ -282,5 +279,4 @@ The `config` service allows you to access the shop's and your app's configuratio
```twig
{% set systemConfig = services.config.get('core.listing.productsPerPage') %}
```
-
_________
diff --git a/resources/references/app-reference/script-reference/product-script-services-reference.md b/resources/references/app-reference/script-reference/product-script-services-reference.md
index 449a89908..94c03d2ec 100644
--- a/resources/references/app-reference/script-reference/product-script-services-reference.md
+++ b/resources/references/app-reference/script-reference/product-script-services-reference.md
@@ -12,11 +12,13 @@ nav:
The CheapestPriceFacade is a wrapper around the cheapest price of the product.
+
### change()
* `change()` allows to overwrite the cheapest price of the current price scope. The provided price will be recalculated
over the quantity price calculator to consider quantity, tax rule and cash rounding configurations.
+
* **Arguments:**
* *`\PriceFacade|\PriceCollection|\CalculatedPrice|null` | `null`* **price**: You can provide different values to overwrite the cheapest price. In case of null, it uses the original single price of the product.
* *`bool`* **range**: Allows to switch the `hasRange` attribute of the cheapest price
@@ -32,23 +34,21 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{% do variant.calculatedCheapestPrice.change(price) %}
```
-
* Overwrite the cheapest price with the original price
```twig
{% do variant.calculatedCheapestPrice.plus(price) %}
```
-
* Discount the cheapest price by 10%
```twig
{% do variant.calculatedCheapestPrice.discount(10) %}
```
-
### create()
* `create()` creates a new `PriceCollection` based on an array of prices.
+
* **Returns** [`Shopware\Core\Framework\DataAbstractionLayer\Pricing\PriceCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/DataAbstractionLayer/Pricing/PriceCollection.php)
Returns the newly created `PriceCollection`.
@@ -62,7 +62,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
'default': { 'gross': 19.99, 'net': 19.99}
}) %}
```
-
### discount()
* `discount()` allows a percentage discount calculation of the current price scope. The provided value will be ensured to be negative via `abs(value) * -1`.
@@ -76,39 +75,38 @@ over the quantity price calculator to consider quantity, tax rule and cash round
```twig
{% do product.calculatedPrice.discount(10) %}
```
-
### getQuantity()
* `getQuantity()` returns the quantity that was used to calculate the total price.
+
* **Returns** `int`
Returns the quantity.
-
### getRules()
* `getRules()` returns the tax rules that were used to calculate the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Tax\Struct\TaxRuleCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Tax/Struct/TaxRuleCollection.php)
Returns the tax rules.
-
### getTaxes()
* `getTaxes()` returns the calculated taxes of the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTaxCollection`](https://github.com/shopware/shopware/blob/trunk/src/Core/Checkout/Cart/Tax/Struct/CalculatedTaxCollection.php)
Returns the calculated taxes.
-
### getTotal()
* `getTotal()` returns the total price for the line-item.
+
* **Returns** `float`
The total price as float.
-
### getUnit()
* `getUnit()` returns the unit price for the line-item.
@@ -117,7 +115,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
* **Returns** `float`
The price per unit as float.
-
### minus()
* `minus()` allows a price subtraction of the current price scope. The provided price will be recalculated via the quantity price calculator.
@@ -136,7 +133,6 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{% do product.calculatedPrice.minus(price) %}
```
-
### plus()
* `plus()` allows a price addition of the current price scope. The provided price will be recalculated via the quantity price calculator.
@@ -155,18 +151,17 @@ over the quantity price calculator to consider quantity, tax rule and cash round
{% do product.calculatedPrice.plus(price) %}
```
-
### reset()
* `reset()` allows to reset the cheapest price to the original price of the product.
+
* **Examples:**
* Reset the product price to default
```twig
{% do variant.calculatedCheapestPrice.change(price) %}
```
-
### surcharge()
* `surcharge()` allows a percentage surcharge calculation of the current price scope. The provided value will be ensured to be negative via `abs(value)`.
@@ -180,20 +175,20 @@ over the quantity price calculator to consider quantity, tax rule and cash round
```twig
{% do product.calculatedPrice.surcharge(10) %}
```
-
_________
-
## [`Shopware\Core\Content\Product\Hook\Pricing\PriceCollectionFacade`](https://github.com/shopware/shopware/blob/trunk/src/Core/Content/Product/Hook/Pricing/PriceCollectionFacade.php) {#pricecollectionfacade}
The PriceCollectionFacade is a wrapper around the calculated price collection of a product. It allows to manipulate the quantity
prices by resetting or changing the price collection.
+
### change()
* The `change()` function allows a complete overwrite of the product quantity prices
+
* **Arguments:**
- * *`array`* **changes**:
+ * *`array`* **changes**:
* **Examples:**
* Overwrite the product prices with a new quantity price graduation
@@ -204,30 +199,31 @@ prices by resetting or changing the price collection.
{ to: null, price: services.price.create({ 'default': { 'gross': 5, 'net': 5} }) },
]) %}
```
-
### count()
* The `count()` function returns the number of prices which are stored inside this collection.
+
* **Returns** `int`
Returns the number of prices which are stored inside this collection
-
### reset()
* The `reset()` functions allows to reset the complete price collection.
+
_________
-
## [`Shopware\Core\Content\Product\Hook\Pricing\ProductProxy`](https://github.com/shopware/shopware/blob/trunk/src/Core/Content/Product/Hook/Pricing/ProductProxy.php) {#productproxy}
The `ProductProxy` is a wrapper for the `SalesChannelProductEntity`. It provides access to all properties of the product,
but also wraps some data into helper facade classes like `PriceFacade` or `PriceCollectionFacade`.
+
### __get()
* The `__get()` function allows access to all properties of the [SalesChannelProductEntity](https://github.com/shopware/shopware/blob/trunk/src/Core/Content/Product/SalesChannel/SalesChannelProductEntity.php)
+
* **Returns** `mixed` | `null`
Returns the value of the property. The value is `mixed` due to the fact that all properties are accessed via `__get()`
@@ -241,32 +237,31 @@ but also wraps some data into helper facade classes like `PriceFacade` or `Price
{ to: null, price: services.price.create({ 'default': { 'gross': 5, 'net': 5} }) },
]) %}
```
-
### calculatedCheapestPrice()
* The `calculatedCheapestPrice` property returns the cheapest price of the product. The price object will
be wrapped into a `PriceFacade` object which allows to manipulate the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\PriceFacade`](./cart-manipulation-script-services-reference#pricefacade) | `null`
Returns a `PriceFacade` if the product has a calculated cheapest price, otherwise `null`
-
### calculatedPrice()
* The `calculatedPrice` property returns the price of the product. The price object will
be wrapped into a `PriceFacade` object which allows to manipulate the price.
+
* **Returns** [`Shopware\Core\Checkout\Cart\Facade\PriceFacade`](./cart-manipulation-script-services-reference#pricefacade) | `null`
Returns a `PriceFacade` if the product has a price, otherwise `null`
-
### calculatedPrices()
* The `calculatedPrices` property returns the price of the product. The price object will
be wrapped into a `PriceCollectionFacade` object which allows to manipulate the collection.
+
* **Returns** [`Shopware\Core\Content\Product\Hook\Pricing\PriceCollectionFacade`](./product-script-services-reference#pricecollectionfacade) | `null`
Returns a `PriceCollectionFacade` if the product has graduated prices, otherwise `null`
-
_________
diff --git a/resources/references/app-reference/script-reference/script-hooks-reference.md b/resources/references/app-reference/script-reference/script-hooks-reference.md
index 429749486..0a1c04ce7 100644
--- a/resources/references/app-reference/script-reference/script-hooks-reference.md
+++ b/resources/references/app-reference/script-reference/script-hooks-reference.md
@@ -671,3 +671,4 @@ All available hooks that can be used to manipulate products.
| **Available Data** | context: [`Shopware\Core\Framework\Context`](https://github.com/shopware/shopware/blob/trunk/src/Core/Framework/Context.php)
products: `array`
salesChannelContext: [`Shopware\Core\System\SalesChannel\SalesChannelContext`](https://github.com/shopware/shopware/blob/trunk/src/Core/System/SalesChannel/SalesChannelContext.php)
|
| **Available Services** | [repository](./data-loading-script-services-reference#RepositoryFacade)
[price](./cart-manipulation-script-services-reference#PriceFactory)
[config](./miscellaneous-script-services-reference#SystemConfigFacade)
[store](./data-loading-script-services-reference#SalesChannelRepositoryFacade)
[acl](./miscellaneous-script-services-reference#AclFacade)
|
| **Stoppable** | `false` |
+
diff --git a/resources/references/app-reference/script-reference/webhook-events-reference.md b/resources/references/app-reference/script-reference/webhook-events-reference.md
index 6be33e49d..fb2ca1977 100644
--- a/resources/references/app-reference/script-reference/webhook-events-reference.md
+++ b/resources/references/app-reference/script-reference/webhook-events-reference.md
@@ -109,13 +109,13 @@
|`order.deleted` | Triggers when a order is deleted | `order:read` | {"entity":"order","operation":"deleted","primaryKey":"array string","payload":"array"}
|`order_address.written` | Triggers when a order_address is written | `order_address:read` | {"entity":"order_address","operation":"update insert","primaryKey":"array string","payload":"array"}
|`order_address.deleted` | Triggers when a order_address is deleted | `order_address:read` | {"entity":"order_address","operation":"deleted","primaryKey":"array string","payload":"array"}
-|`media.uploaded` | Fires when a media file is uploaded | `media:read` |
-|`app.activated` | Fires when an app is activated | - |
-|`app.deactivated` | Fires when an app is deactivated | - |
-|`app.deleted` | Fires when an app is deleted | - |
-|`app.installed` | Fires when an app is installed | - |
-|`app.updated` | Fires when an app is updated | - |
-|`app.permissions.updated` | Fires when an apps permissions were updated with a list of the currently accepted permissions, eg after new were accepted or revoked | - |
-|`shopware.updated` | Fires after an shopware update has been finished | - |
-|`app.config.changed` | Fires when a system config value is changed | `system_config:read` |
-|`app.system_heartbeat` | Fires as a recurrent task. Indicates to the app that the system is up and running. | - |
+|`media.uploaded` | Fires when a media file is uploaded | `media:read` |
+|`app.activated` | Fires when an app is activated | - |
+|`app.deactivated` | Fires when an app is deactivated | - |
+|`app.deleted` | Fires when an app is deleted | - |
+|`app.installed` | Fires when an app is installed | - |
+|`app.updated` | Fires when an app is updated | - |
+|`app.permissions.updated` | Fires when an apps permissions were updated with a list of the currently accepted permissions, eg after new were accepted or revoked | - |
+|`shopware.updated` | Fires after an shopware update has been finished | - |
+|`app.config.changed` | Fires when a system config value is changed | `system_config:read` |
+|`app.system_heartbeat` | Fires as a recurrent task. Indicates to the app that the system is up and running. | - |