isActive()) { $items = CartItem::createFromSpec(\Query\Operator::equals(['c.id_user' => Contexts::get(UserContext::class)->getActiveId()])); } else { $items = CartItem::createFromSpec(\Query\Operator::equals(['c.user_key' => Cart::getCartID()])); } foreach ($items as $item) { /*if (findModule(Modules::PRICELISTS)) { $item['price'] = $item['product']->price_array; }*/ $price = $item['price']; // celkova cena s dani $totalPriceWithVat = $totalPriceWithVat->add($price['value_with_vat']); // celkova cena bez dane $totalPriceNoVat = $totalPriceNoVat->add($price['value_without_vat']); // celkovy pocet druhu produktu $totalProducts++; // celkovy pocet objednavanych kusu $totalPieces += $item->pieces; // Doprava zdarma $freeShipping |= $item['freeShipping']; } return [ 'items' => $items, 'totalPrice' => printPrice($totalPriceWithVat, ['ceil' => false, 'decimal' => 'dynamic', 'dealerdiscount' => false]), 'totalPriceWithVat_array' => formatPrice($totalPriceWithVat, 0, false), 'totalPriceNoVat_array' => formatPrice($totalPriceNoVat, 0, false), 'totalPieces' => $totalPieces, 'totalProducts' => $totalProducts, 'freeShipping' => $freeShipping, ]; }