summaryrefslogtreecommitdiff
path: root/views/blocks/product-list.phtml
blob: feb186fd9ab5b8523493a61722844aafcd264c2d (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php

	/**
	 * Block „Produktliste“: Produkte als Kacheln mit Preisangaben
	 *
	 * Standard ist der Link „Zum Produkt“. Den Knopf „In den Warenkorb“ zeigt die Liste nur, wenn er am Block eingeschaltet
	 * ist und das Produkt in der Liste gekauft werden darf ($p['buy'], \wpsg\Blocks::canBuyInList(), in eigenen Vorlagen
	 * auch wpsg_buy_in_list()). Mit Produktfilter auf der Seite sagt die Statuszeile die Anzahl an.
	 * @version 4.6.1
	 */

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

	$arBlock = $this->view['wpsg_block'];
	$currency = $this->get_option('wpsg_currency');
	$hint_id = \wpsg\Blocks::kleinunternehmerHintID();

?>
<?php if ($arBlock['bFilter']??false) { ?>
<p class="wpsg-product-list__count" role="status"><?php if ($arBlock['bFiltered']) echo esc_html(sprintf(_n('%d Produkt gefunden', '%d Produkte gefunden', sizeof($arBlock['arProducts']), 'wpsg'), sizeof($arBlock['arProducts']))); ?></p>
<?php } ?>
<?php if (sizeof($arBlock['arProducts']) === 0) { ?>
<p class="wpsg-product-list__empty"><?php echo esc_html((($arBlock['bFiltered']??false)?__('Keine Produkte für diese Filter.', 'wpsg'):__('Keine Produkte gefunden.', 'wpsg'))); ?></p>
<?php } else { ?>
<ul class="wpsg-product-list__items">
	<?php foreach ($arBlock['arProducts'] as $p) { $oProduct = $p['oProduct']; $product_id = intval($oProduct->id); $name = $oProduct->getProductName(); ?>
	<li class="wpsg-product-list__item">

		<?php if ($arBlock['showImage']) { $attachment_id = $this->imagehandler->getAttachmentID($product_id); ?>
		<a class="wpsg-product-list__image" href="<?php echo esc_url($p['url']); ?>" tabindex="-1" aria-hidden="true">
			<?php if (wpsg_isSizedInt($attachment_id)) echo wp_get_attachment_image($attachment_id, 'medium', false, ['alt' => '']); ?>
		</a>
		<?php } ?>

		<?php /* Etiketten am Bild, nur im Modus „neu“ (Punkt 8.15) */ if (\wpsg\ThemeStyle::isThemeMode()) echo \wpsg\ProductPage::labels($oProduct, floatval($oProduct->getPrice($product_id))); ?>

		<?php $h = 'h'.intval($arBlock['titleLevel']??3); ?><<?php echo $h; ?> class="wpsg-product-list__title"><a href="<?php echo esc_url($p['url']); ?>"><?php echo esc_html($name); ?></a></<?php echo $h; ?>>

		<?php /* Sterne nur mit dem Modul Produktbewertungen, aus freigegebenen Bewertungen */ if ($this->hasMod('wpsg_mod_reviews')) echo $this->callMod('wpsg_mod_reviews', 'renderSummary', [$product_id, 'wpsg-product-list__rating']); ?>

		<?php if ($this->canDisplayPrice()) { $price = $oProduct->getPrice($product_id); ?>
		<div class="wpsg-product-list__price">
			<?php if ($this->hasMod('wpsg_mod_productvariants') && $this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$product_id])) { ?>
				<?php echo wpsg_translate(esc_html__('ab #1#', 'wpsg'), wpsg_price_html($price, 'list')); ?>
			<?php } else { ?>
				<?php echo wpsg_price_html($price, 'list'); ?>
			<?php } ?>
		</div>
		<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
		<div class="wpsg-product-list__baseprice"><?php echo $this->callMod('wpsg_mod_fuellmenge', 'renderPriceInfo', [$price, $oProduct->__get('fmenge'), $product_id]); ?></div>
		<?php } ?>
		<div class="wpsg-product-list__taxnote wpsg_produkt_preishinweis"><?php echo \wpsg\Blocks::priceNote($oProduct, $hint_id); ?></div>
		<?php if ($this->hasMod('wpsg_mod_deliverytime') && $this->get_option('wpsg_mod_deliverytime_show_product') == '1') { ?>
		<div class="wpsg-product-list__deliverytime">
			<?php if ($this->callMod('wpsg_mod_deliverytime', 'isStoreProduct', [$oProduct->getProductKey()])) { ?>
			<?php echo esc_html((string)$this->callMod('wpsg_mod_deliverytime', 'displayStoreText', [$oProduct->getProductKey()])); ?>
			<?php } else { $strDelay = (string)$this->callMod('wpsg_mod_deliverytime', 'displayDelayTime', [$oProduct->getProductKey()]); ?>
			<?php if ($strDelay !== '') { echo esc_html($strDelay); } else { ?>
			<?php echo esc_html__('Lieferzeit:', 'wpsg'); ?> <?php echo wp_kses_post((string)$this->callMod('wpsg_mod_deliverytime', 'displayDeliveryTime', [$oProduct->getProductKey()])); ?>
			<?php } ?>
			<?php } ?>
		</div>
		<?php } ?>
		<?php } else { ?>
		<div class="wpsg-product-list__price"><?php echo esc_html__('Preise nur für eingeloggte Benutzer', 'wpsg'); ?></div>
		<?php } ?>

		<div class="wpsg-product-list__action">
			<?php if ($p['buy']) { ?>
			<form method="post" action="<?php echo esc_url($this->getCurrentURL()); ?>">
				<input type="hidden" name="wpsg[produkt_id]" value="<?php echo esc_attr((string)$product_id); ?>" />
				<input type="hidden" name="wpsg[menge]" value="1" />
				<input type="hidden" name="myReferer" value="<?php echo esc_attr($this->getCurrentURL()); ?>" />
				<button type="submit" name="wpsg[submit]" value="1" class="wpsg_button wpsg_add_basket<?php echo wpsg_button_class(); ?>"><?php echo esc_html(wpsg_button_text('add_to_basket', __('In den Warenkorb', 'wpsg'))); ?><span class="screen-reader-text"><?php echo esc_html(': '.$name); ?></span></button>
			</form>
			<?php } else { ?>
			<a class="wpsg_button<?php echo wpsg_button_class(); ?>" href="<?php echo esc_url($p['url']); ?>"><?php echo esc_html(wpsg_button_text('to_product', __('Zum Produkt', 'wpsg'))); ?><span class="screen-reader-text"><?php echo esc_html(': '.$name); ?></span></a>
			<?php } ?>
		</div>

	</li>
	<?php } ?>
</ul>
<?php echo \wpsg\Blocks::kleinunternehmerHint($hint_id); ?>
<?php } ?>