Subversion Repositories wpShopGermany4

Rev

Rev 8200 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
8200 daniel 48
                <a href="<?php
8195 daniel 49
 
8200 daniel 50
                    if (intval($oProductgroup->__get('infopage')) > 0) echo \get_permalink(intval($oProductgroup->__get('infopage')));
51
                    else echo $page_url.'show='.$oProductgroup->getId();
52
 
8280 daniel 53
                    ?>" class="productgroup <?php
54
 
55
						echo (($oProductgroup->hasActiveDiscount())?'active_discount':'');
56
 
57
					?>">
8200 daniel 58
 
8199 daniel 59
                    <div class="title"><?php echo $oProductgroup->getLabel(); ?></div>
8195 daniel 60
 
8199 daniel 61
                    <?php echo \wp_get_attachment_image($oProductgroup->getImage(), [462, 462], false, [
8195 daniel 62
                        'class' => 'bg'
63
                    ]); ?>
64
 
65
                </a>
66
 
67
            <?php } ?>
68
 
69
        </div>
70
 
71
        <style>
72
 
8200 daniel 73
            .wpsg_mod_productgroup_layout2.productgroups { all:revert; width:100%; display:grid; grid-template-columns:repeat(2, 1fr); grid-template-rows:repeat(10, 1fr); grid-column-gap:1rem; grid-row-gap:1rem; }
8195 daniel 74
            .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 75
            .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; }
76
            .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 77
            .wpsg_mod_productgroup_layout2.productgroups > .productgroup:hover .title { background-color:#FFFFFF; color:#000000; }
78
 
79
            @media screen and (min-width:768px) {
80
 
81
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup { padding-top:initial; grid-column:initial; }
82
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 1),
8199 daniel 83
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 5) { grid-row:span 2; padding-top:100%; }
8195 daniel 84
 
85
            }
86
 
87
        </style>
88
 
89
    <?php } ?>
90
</div>