Subversion Repositories wpShopGermany4

Rev

Rev 8199 | Rev 8280 | 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
 
53
                    ?>" class="productgroup">
54
 
8199 daniel 55
                    <div class="title"><?php echo $oProductgroup->getLabel(); ?></div>
8195 daniel 56
 
8199 daniel 57
                    <?php echo \wp_get_attachment_image($oProductgroup->getImage(), [462, 462], false, [
8195 daniel 58
                        'class' => 'bg'
59
                    ]); ?>
60
 
61
                </a>
62
 
63
            <?php } ?>
64
 
65
        </div>
66
 
67
        <style>
68
 
8200 daniel 69
            .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 70
            .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 71
            .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; }
72
            .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 73
            .wpsg_mod_productgroup_layout2.productgroups > .productgroup:hover .title { background-color:#FFFFFF; color:#000000; }
74
 
75
            @media screen and (min-width:768px) {
76
 
77
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup { padding-top:initial; grid-column:initial; }
78
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 1),
8199 daniel 79
                .wpsg_mod_productgroup_layout2.productgroups > .productgroup:nth-child(6n + 5) { grid-row:span 2; padding-top:100%; }
8195 daniel 80
 
81
            }
82
 
83
        </style>
84
 
85
    <?php } ?>
86
</div>