Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setPositions example
$orderDelivery
=
new
OrderDeliveryEntity
(
)
;
$orderDelivery
->
setId
(
'order-delivery-id'
)
;
$orderDelivery
->
setShippingDateEarliest
(
new
\
DateTimeImmutable
(
)
)
;
$orderDelivery
->
setShippingDateLatest
(
new
\
DateTimeImmutable
(
)
)
;
$orderDelivery
->
setShippingMethodId
(
'order-delivery-shipping-method-id'
)
;
$orderDelivery
->
setShippingOrderAddress
(
$this
->
getOrderAddress
(
)
)
;
$orderDelivery
->
setShippingCosts
(
new
CalculatedPrice
(
1, 1,
new
CalculatedTaxCollection
(
)
,
new
TaxRuleCollection
(
)
)
)
;
if
(
$toManipulate
!== 'order-delivery-no-shipping-method'
)
{
$orderDelivery
->
setShippingMethod
(
new
ShippingMethodEntity
(
)
)
;
}
if
(
$toManipulate
!== 'order-delivery-no-position'
)
{
$orderDelivery
->
setPositions
(
$orderDeliveryPositionCollection
)
;
}
if
(
$toManipulate
!== 'order-no-order-deliveries'
)
{
$orderDeliveryCollection
->
add
(
$orderDelivery
)
;
}
// Transactions
$orderTransactionCollection
=
new
OrderTransactionCollection
(
)
;
$orderTransaction
=
new
OrderTransactionEntity
(
)
;
$orderTransaction
->
setId
(
'order-transaction-id'
)
;
$orderTransaction
->
setPaymentMethodId
(
'order-transaction-payment-method-id'
)
;