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
|
<?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()).
*/
if (!defined('ABSPATH')) exit;
$arBlock = $this->view['wpsg_block'];
$currency = $this->get_option('wpsg_currency');
?>
<?php if (sizeof($arBlock['arProducts']) === 0) { ?>
<p class="wpsg-product-list__empty"><?php echo esc_html__('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 } ?>
<h3 class="wpsg-product-list__title"><a href="<?php echo esc_url($p['url']); ?>"><?php echo esc_html($name); ?></a></h3>
<?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 esc_html(wpsg_translate(__('ab #1#', 'wpsg'), wpsg_ff($price, $currency))); ?>
<?php } else { ?>
<?php echo esc_html(wpsg_ff($price, $currency)); ?>
<?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); ?></div>
<?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__('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__('Zum Produkt', 'wpsg'); ?><span class="screen-reader-text"><?php echo esc_html(': '.$name); ?></span></a>
<?php } ?>
</div>
</li>
<?php } ?>
</ul>
<?php } ?>
|