File: /var/www/dinamo-shop/wp-content/themes/dinamo-shop/woocommerce/cart/mini-cart.php
<?php
/**
* Mini-cart
*
* Contains the markup for the mini-cart, used by the cart widget.
*
* This template can be overridden by copying it to yourtheme/woocommerce/cart/mini-cart.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.7.0
*/
defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_before_mini_cart' ); ?>
<?php if ( WC()->cart->is_empty() ) :
$min_cart_empty = true;
else:
$min_cart_empty = false;
endif;
WC()->cart->calculate_totals();
$has_secondary_currency = get_field('has_secondary_currency', 'options');
$active_currency = get_woocommerce_currency();
?>
<script>
var dinamoCurrency = "<?= get_woocommerce_currency_symbol(); ?>";
</script>
<div <?= $min_cart_empty ? "style=display:none;" : "" ?> id="MiniCartBody">
<ul class="order-details-list mini-cart-list mt-0">
<?php
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);
$product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key)) {
$product_name = apply_filters('woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key);
$product_price = $_product->regular_price;
$product_sale_price = $_product->sale_price;
$product_lowest_price = get_post_meta($product_id, '_lowest_price_30_days', true);
$product_permalink = apply_filters('woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink($cart_item) : '', $cart_item, $cart_item_key);
$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 );
$europa_league_print_name = "";
if($cart_item["variation"]["print_europa_league"]) {
$europa_league_print_id = get_field('print_europa_league', 'option');
$europa_league_print_name = get_the_title($europa_league_print_id);
}
$europa_league = "0";
if(isset($cart_item["variation"]["print_europa_league"])) {
$europa_league = $cart_item["variation"]["print_europa_league"];
}
?>
<li data-cart-item="<?= $cart_item_key ?>" class="order-details-list-item">
<div>
<div class="order-details-list-img">
<?= $_product->get_image('product_thumbnail_cart', array('class' => 'img-fluid lazyload')); ?>
</div>
<div class="form-group quantity small">
<span data-cart-item-key="<?= $cart_item_key ?>" data-change-qt="down" data-product-id="<?= $product_id ?>" class="minus <?= ($cart_item['quantity'] == '1') ? 'minus--unclickable' : ''; ?>">-</span>
<input disabled type="number" class="form-control" value="<?= $cart_item['quantity']; ?>" name="quantity">
<span data-cart-item-key="<?= $cart_item_key ?>" data-change-qt="up" data-product-id="<?= $product_id ?>" class="plus">+</span>
</div>
</div>
<div class="order-details-list-desc flex-column">
<div class="d-flex flex-column justify-content-end">
<div>
<div class="d-flex flex-row">
<h4><?= $product_name; ?></h4>
<a data-product-id="<?= $product_id ?>" data-cart-item-remove="<?= $cart_item_key ?>" class="cart-remove margin-left-auto"><svg class="icon icon-delete"><use xlink:href="<?php echo THEMEROOT; ?>/assets/icons/icons.svg#icon-delete"></use></svg></a>
</div>
<?php if($print_name){ ?>
<label style="font-size: 13px; color: #909090;"><?= $print_name ?></label>
<?php } ?>
<?php if($europa_league_print_name){ ?>
<label style="font-size: 13px; color: #909090;"><?= $europa_league_print_name ?></label>
<?php } ?>
</div>
<div class="d-flex flex-column" >
<?php if ($_product->is_on_sale()){ ?>
<h4 class="lowest-price"><?= __( 'Najniža cijena u zadnjih 30 dana', 'dinamo_shop' ); ?>: <span class="lowest_amount"><?= price_with_secondary($product_lowest_price) . $_product->get_price_suffix(); ?></span></h4>
<?php } ?>
<div class="d-flex flex-row<?= $active_currency == "HRK" ? "" : "-reverse" ?> justify-content-<?= $has_secondary_currency ? "between" : "end" ?>">
<?php if ($has_secondary_currency){ ?>
<div class="d-flex flex-wrap flex-column">
<span class="regular-price eur-price total<?= $_product->is_on_sale() ? "--with-sale" : "" ?>" data-product-id="<?= $product_id ?>" ><?= secondary_price_output(calculate_price_with_print($product_price, $print_type, $product_id, $europa_league) * $cart_item['quantity']); ?></span>
<span class="sale-price eur-price" style="<?= $_product->is_on_sale() ? "" : "display: none" ?>" data-product-id="<?= $product_id ?>" ><?= secondary_price_output(calculate_price_with_print($product_sale_price, $print_type, $product_id, $europa_league) * $cart_item['quantity']); ?></span>
</div>
<?php } ?>
<div class="d-flex flex-wrap flex-column align-items-end">
<span class="regular-price total<?= $_product->is_on_sale() ? "--with-sale" : "" ?>" data-product-id="<?= $product_id ?>" ><?= wc_price(calculate_price_with_print($product_price, $print_type, $product_id, $europa_league) * $cart_item['quantity']); ?></span>
<span class="sale-price" style="<?= $_product->is_on_sale() ? "" : "display: none" ?>" data-product-id="<?= $product_id ?>" ><?= wc_price(calculate_price_with_print($product_sale_price, $print_type, $product_id, $europa_league) * $cart_item['quantity']); ?></span>
</div>
</div>
</div>
</div>
</div>
</li>
<?php } ?>
<?php }?>
</ul>
<div class="item mt-10" style="display: block;">
<label class="uppercase d-block"><?php _e("Ukupno", "dinamo_shop"); ?></label>
<div class="d-flex flex-row<?= $active_currency == "HRK" ? "" : "-reverse" ?> justify-content-<?= $has_secondary_currency ? "between" : "end" ?> mt-10">
<?php if ($has_secondary_currency) { ?>
<span class="total cart-total-value <?= $active_currency == "HRK" ? "eur-price" : "" ?>"><?= secondary_price_output(WC()->cart->total - WC()->cart->shipping_total); ?> </span>
<?php } ?>
<span class="total cart-total-value text-align-right <?= $active_currency == "HRK" ? "" : "eur-price" ?>"><?php echo (wc_price(WC()->cart->total - WC()->cart->shipping_total)); ?> </span>
</div>
<div class="item cart-error"></div>
<div class="item mt-10 full-width">
<a href="<?= wc_get_cart_url(); ?>" id="cartOrderBtn" class="btn btn-primary full-width"><?php _e("Naruči", "dinamo_shop"); ?></a>
</div>
</div>
</div>
<div <?= !$min_cart_empty ? "style=display:none;" : "" ?> id="MiniCartEmpty">
<div class="empty-state-outter">
<div class="empty-state">
<div class="empty-icon">
<img src="<?= THEMEROOT ?>/assets/img/shopping-bag.png" />
</div>
<h2><?= __('Vaša košarica je trenutno prazna', 'dinamo-shop'); ?></h2>
<p><?= __('Vaša košarica je prazna. Pregledaj ponudu i dodaj proizvode klikom na gumb niže.', 'dinamo-shop'); ?></p>
<a href="<?= get_home_url(); ?>" class="btn btn-primary" ><?= __('Idi na naslovnu', 'tokic_theme'); ?></a>
</div>
</div>
</div>
<?php do_action( 'woocommerce_after_mini_cart' ); ?>