35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
class stDeliveryOrderProductInfo extends stDeliveryProductInfoAbstract
|
|
{
|
|
/**
|
|
* Zamówienie
|
|
* @var Order
|
|
*/
|
|
protected $order;
|
|
|
|
public function __construct(Order $order, stCurrencyModelInterface $currency)
|
|
{
|
|
$this->order = $order;
|
|
parent::__construct($currency);
|
|
}
|
|
|
|
protected function initialize(): void
|
|
{
|
|
foreach ($this->order->getOrderProductsJoinProduct() as $orderProduct)
|
|
{
|
|
$this->addAmountWithCurrency($orderProduct->getTotalAmount(true, true));
|
|
$this->addWeight($orderProduct->getTotalWeight());
|
|
$this->addQuantity($orderProduct->getQuantity());
|
|
$this->addDimensions($orderProduct->getWidth(), $orderProduct->getHeight(), $orderProduct->getDepth(), $orderProduct->getQuantity());
|
|
$this->addDeliveryPrice($orderProduct->getTotalDeliveryPrice());
|
|
$this->addMaxTax($orderProduct->getTax());
|
|
|
|
if (!empty($orderProduct->getProduct()->getDeliveries()))
|
|
{
|
|
$this->addAllowedDeliveries($orderProduct->getProduct()->getDeliveries());
|
|
}
|
|
}
|
|
}
|
|
}
|