summaryrefslogtreecommitdiff
path: root/views/blocks/mini-cart.phtml
blob: 3f94518eda78f4c33df2cad4cb94899378bf173f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

	/**
	 * Block „Mini-Warenkorb“: Link zum Warenkorb mit Anzahl und Summe
	 *
	 * Die Seite enthält den leeren Zustand; den Inhalt von .wpsg-mini-cart__content tauscht der Browser gegen den des
	 * Besuchers aus (blocks/mini-cart.js). Die Klasse muss deshalb in eigenen Fassungen erhalten bleiben.
	 * @version 4.6.1
	 */

	if (!defined('ABSPATH')) exit;

	$arBlock = $this->view['wpsg_block'];

?>
<a class="wpsg-mini-cart__link" href="<?php echo esc_url($arBlock['url']); ?>">
	<?php if ($arBlock['label'] !== '') { ?>
	<span class="wpsg-mini-cart__label"><?php echo esc_html($arBlock['label']); ?></span>
	<?php } ?>
	<span class="wpsg-mini-cart__content">
		<?php /* Leer ohne Zahl: Die Seite springt sonst beim Nachladen von „0 Artikel“ auf die richtige Zahl */ ?>
		<?php if ($arBlock['count'] > 0) { ?>
		<?php /* Die Zahl als eigenes Element: Themes können daraus eine Kurzform wie „(1)“ bilden */ ?>
		<span class="wpsg-mini-cart__count"><?php echo str_replace('%s', '<span class="wpsg-mini-cart__number">'.esc_html(number_format_i18n(intval($arBlock['count']))).'</span>', esc_html(
			/* translators: %s: Anzahl der Artikel im Warenkorb */
			_n('%s Artikel', '%s Artikel', intval($arBlock['count']), 'wpsg')
		)); ?></span>
		<?php if ($arBlock['showSum']) { ?>
		<span class="wpsg-mini-cart__sum"><?php echo wpsg_price_html($arBlock['sum'], 'mini_cart'); ?></span>
		<?php } ?>
		<?php } ?>
	</span>
</a>