8195 |
daniel |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/** Template für die Anzeige von Produktgruppen Layout 2 */
|
|
|
4 |
|
|
|
5 |
namespace wpsg;
|
|
|
6 |
|
|
|
7 |
$page_url = \get_permalink(\get_the_ID());
|
|
|
8 |
$page_url .= ((strpos($page_url, '?') === false)?'?':'&');
|
|
|
9 |
|
|
|
10 |
if (isset($_REQUEST['show'])) {
|
|
|
11 |
|
8198 |
daniel |
12 |
$oProductgroup = \wpsg_productgroup::getInstance(intval($_REQUEST['show']));
|
8195 |
daniel |
13 |
$arProducts = $oProductgroup->findProducts();
|
|
|
14 |
$view = 'products';
|
|
|
15 |
|
|
|
16 |
} else {
|
|
|
17 |
|
8198 |
daniel |
18 |
$arProductgroups = \wpsg_productgroup::find();
|
8195 |
daniel |
19 |
$view = 'productgroups';
|
|
|
20 |
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
?>
|
|
|
24 |
|
|
|
25 |
<div class="wpsg_mod_productgroup_layout2_wrap">
|
|
|
26 |
<?php if ($view === 'products') { ?>
|
|
|
27 |
|
|
|
28 |
<div class="wpsg_mod_productgroup_layout2 products">
|
|
|
29 |
|
|
|
30 |
<?php foreach ($arProducts as $oProduct) { ?>
|
|
|
31 |
|
|
|
32 |
<?php echo $this->renderProdukt($oProduct->getId(), $oProductgroup->getTemplate()); ?>
|
|
|
33 |
|
|
|
34 |
<?php } ?>
|
|
|
35 |
|
|
|
36 |
<br />
|
|
|
37 |
|
|
|
38 |
<a href="<?php echo $page_url; ?>"><?php echo __('Zurück zur Übersicht', 'wpsg'); ?></a>
|
|
|
39 |
|
|
|
40 |
</div>
|
|
|
41 |
|
|
|
42 |
<?php } else if ($view === 'productgroups') { ?>
|
|
|
43 |
|
|
|
44 |
<div class="wpsg_mod_productgroup_layout2 productgroups">
|
|
|
45 |
|
|
|
46 |
<?php foreach ($arProductgroups as $k => $oProductgroup) { ?>
|
|
|
47 |
|
|
|
48 |
<a href="<?php echo $page_url; ?>show=<?php echo $oProductgroup->getId(); ?>" class="productgroup">
|
|
|
49 |
|
8199 |
daniel |
50 |
<div class="title"><?php echo $oProductgroup->getLabel(); ?></div>
|
8195 |
daniel |
51 |
|
8199 |
daniel |
52 |
<?php echo \wp_get_attachment_image($oProductgroup->getImage(), [462, 462], false, [
|
8195 |
daniel |
53 |
'class' => 'bg'
|
|
|
54 |
]); ?>
|
|
|
55 |
|
|
|
56 |
</a>
|
|
|
57 |
|
|
|
58 |
<?php } ?>
|
|
|
59 |
|
|
|
60 |
</div>
|
|
|
61 |
|
|
|
62 |
<style>
|
|
|
63 |
|
|
|
64 |
.wpsg_mod_productgroup_layout2.productgroups { all:revert; display:grid; grid-template-columns:repeat(2, 1fr); grid-template-rows:repeat(10, 1fr); grid-column-gap:1rem; grid-row-gap:1rem; }
|
|
|
65 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup { grid-column:span 2; padding-top:100%; text-decoration:none; position:relative; overflow:hidden; transition:all 0.3s ease; overflow:hidden width:100%; }
|
8199 |
daniel |
66 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup .bg { position:absolute; left:0; top:0; object-position:50% 50%; background-color:#DEDEDE; width:100%; height:100%; object-fit:cover; z-index:1; }
|
|
|
67 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup .title { z-index:2; border-radius:2px; transition:all 0.3s ease; position:absolute; left:1rem; top:1rem; background-color:#000000; color:#FFFFFF; padding:0 0.5rem; }
|
8195 |
daniel |
68 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup:hover .title { background-color:#FFFFFF; color:#000000; }
|
|
|
69 |
|
|
|
70 |
@media screen and (min-width:768px) {
|
|
|
71 |
|
|
|
72 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup { padding-top:initial; grid-column:initial; }
|
|
|
73 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 1),
|
8199 |
daniel |
74 |
.wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 5) { grid-row:span 2; padding-top:100%; }
|
8195 |
daniel |
75 |
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
</style>
|
|
|
79 |
|
|
|
80 |
<?php } ?>
|
|
|
81 |
</div>
|