File: /var/www/dinamo-shop/wp-content/themes/dinamo-shop/woocommerce/checkout/review-order.php
<?php
/**
* Review order table
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.8.0
*/
defined( 'ABSPATH' ) || exit;
$has_secondary_currency = get_field('has_secondary_currency', 'options');
$flex_class = "";
if ($has_secondary_currency && get_woocommerce_currency() == "EUR"){
$flex_class = "flex-row-reverse";
}
?>
<ul class="order-details-list">
<?php
do_action( 'woocommerce_review_order_before_cart_contents' );
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
$product_price = $_product->get_price();
if($cart_item["variation_id"]){
$product_price = wc_get_product($cart_item["variation_id"])->get_price();
}
$print_type = $cart_item["variation"]["print_type"];
$print_product_id = get_product_for_print_type($print_type);
$print_name_value = "";
$print_number_value = "";
if($cart_item["variation"] && $cart_item["variation"]["print_name_value"]) {
$print_name_value = $cart_item["variation"]["print_name_value"];
}
if($cart_item["variation"] && $cart_item["variation"]["print_number_value"]) {
$print_number_value = $cart_item["variation"]["print_number_value"];
}
$print_name = get_print_name_for_print_type($print_type, $print_name_value, $print_number_value );
?>
<li class="order-details-list-item">
<div class="order-details-list-img">
<?= $_product->get_image('product_thumbnail_cart', array('class' => 'img-fluid lazyload')); ?>
</div>
<div class="order-details-list-desc">
<div class="full-width d-flex flex-column justify-content-center">
<h4><?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h4>
<label><?= $print_name; ?></label>
<?php if(isset($cart_item["variation"]["print_europa_league"]) && $cart_item["variation"]["print_europa_league"] == "1") {
$europa_league_print_id = get_field('print_europa_league', 'option');
$europa_league_print = new WC_Product($europa_league_print_id); ?>
<br />
<label><?= get_the_title($europa_league_print_id); ?></label>
<?php } ?>
<div class="d-flex flex-row flex-wrap align-items-center mt-5 justify-content-between">
<span class="total"><?= $cart_item['quantity']; ?> x <?= price_with_secondary(calculate_price_with_print($product_price, $print_type, $cart_item['data']->parent_id, $cart_item["variation"]["print_europa_league"])); ?></span>
<span class="total final-price"><?= price_with_secondary(calculate_price_with_print($product_price, $print_type, $cart_item['data']->parent_id, $cart_item["variation"]["print_europa_league"]) * $cart_item['quantity']); ?></span>
</div>
</div>
</div>
</li>
<?php }
} ?>
</ul>
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
<div class="box">
<?php
$packages = WC()->shipping()->get_packages();
foreach ( $packages as $i => $package ) {
$chosen_method = isset(WC()->session->chosen_shipping_methods[$i]) ? WC()->session->chosen_shipping_methods[$i] : '';
$product_names = array();
if (count($packages) > 1) {
foreach ($package['contents'] as $item_id => $values) {
$product_names[$item_id] = $values['data']->get_name() . ' ×' . $values['quantity'];
}
$product_names = apply_filters('woocommerce_shipping_package_details_array', $product_names, $package);
}
$available_methods = $package['rates'];
?>
<?php
$formatted_destination = isset($formatted_destination) ? $formatted_destination : WC()->countries->get_formatted_address($package['destination'], ', ');
$has_calculated_shipping = !empty($has_calculated_shipping);
$show_shipping_calculator = !empty($show_shipping_calculator);
$calculator_text = '';
?>
<?php if ($available_methods) { ?>
<?php foreach ($available_methods as $method) :
?>
<div class="item shipping-pricing">
<div class="">
<label class="form-label uppercase"><?php _e('Dostava', 'dinamo_shop'); ?></label>
<br />
<span class="price"><?= $method->label; ?></span>
</div>
<div class="price-outter d-flex text-align-right align-self-end <?= $flex_class ?>" style="<?= $has_secondary_currency ? "" : "width: unset;" ?>">
<?php if ($has_secondary_currency) { ?>
<span class="price align-self-end shipping-total-price">
<?= secondary_price_output( $method->cost ); ?>
</span>
<?php } ?>
<span class="price align-self-end shipping-total-price eur-price">
<?= wc_price( $method->cost ); ?>
</span>
</div>
</div>
<?php endforeach; ?>
<?php }else { ?>
<div class="item">
<div class="">
<label class="form-label uppercase"><?php _e('Dostava', 'dinamo_shop'); ?></label>
<br />
<span class="price"><?= $formatted_destination; ?></span>
</div>
<span class="price align-self-end">
<?php _e('Nema dostave za unesenu državu', 'dinamo_shop'); ?>
</span>
</div>
<?php }
}?>
</div>
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
<?php endif; ?>
<div class="box">
<div class="item">
<label class="uppercase"><?php _e('Osnovica', 'dinamo_shop'); ?></label>
<div class="price-outter d-flex text-align-right <?= $flex_class ?>" style="<?= $has_secondary_currency ? "" : "width: unset;" ?>">
<?php if ($has_secondary_currency) { ?>
<span class="price base-total-price"><?= secondary_price_output(WC()->cart->total - WC()->cart->tax_total); ?></span>
<?php } ?>
<span class="price base-total-price eur-price"><?= wc_price(WC()->cart->total - WC()->cart->tax_total); ?></span>
</div>
</div>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited ?>
<div class="item">
<label class="uppercase"><?php echo esc_html( $tax->label ); ?></label>
<div class="price-outter d-flex text-align-right <?= $flex_class ?>" style="<?= $has_secondary_currency ? "" : "width: unset;" ?>">
<?php if ($has_secondary_currency) { ?>
<span class="price tax-total-price"><?php echo secondary_price_output( $tax->amount ); ?></span>
<?php } ?>
<span class="price tax-total-price eur-price"><?php echo wp_kses_post( $tax->formatted_amount ); ?></span>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="box">
<div class="item">
<label class="uppercase"><?php _e('Ukupno', 'dinamo_shop'); ?></label>
<div class="price-outter d-flex text-align-right <?= $flex_class ?>" style="<?= $has_secondary_currency ? "" : "width: unset;" ?>">
<?php if ($has_secondary_currency) { ?>
<span class="total cart-total-price"><?= secondary_price_output(WC()->cart->total); ?></span>
<?php } ?>
<span class="total cart-total-price eur-price"><?= WC()->cart->get_total(); ?></span>
</div>
</div>
</div>