Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setShippingDateEarliest example
$orderDeliveryPositionCollection
=
new
OrderDeliveryPositionCollection
(
)
;
$orderDeliveryPosition
=
new
OrderDeliveryPositionEntity
(
)
;
$orderDeliveryPosition
->
setId
(
'order-delivery-position-id-1'
)
;
$orderDeliveryPosition
->
setOrderLineItem
(
$orderLineItem
)
;
$orderDeliveryPosition
->
setPrice
(
new
CalculatedPrice
(
1, 1,
new
CalculatedTaxCollection
(
)
,
new
TaxRuleCollection
(
)
)
)
;
$orderDeliveryPositionCollection
->
add
(
$orderDeliveryPosition
)
;
// Order delivery
$orderDeliveryCollection
=
new
OrderDeliveryCollection
(
)
;
$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'
)
{