Neu Link innerhalb Produktdetailseite auf Tab

matteodelmulino

Aktives Mitglied
24. Januar 2014
9
3
Hallo,
ich verzweifle an der Umsetzung über einen Link im Content der Produktdetailseite in den Tab "Frage zum Artikel" zu springen und diesen aktiv zu setzen.

In der Datei js/jtl.article.js des Nova Templates habe ich folgende Funktion gefunden:
Code:
        registerFinish: function($wrapper) {
            $('#jump-to-votes-tab', $wrapper).on('click', function () {
                let $tabID = $('#content a[href="#tab-votes"]');
                if ($tabID.length > 0) {
                    $tabID.tab('show');
                } else {
                    $tabID = $('#tab-votes');
                    $tabID.collapse('show');
                }

                $([document.documentElement, document.body]).animate({
                    scrollTop: $tabID.offset().top
                }, 200);
            });

            let $tabID = $('#product-tabs a[href="' + window.location.hash + '"]');
            if ($tabID.length) {
                $tabID.tab('show');
                $([document.documentElement, document.body]).animate({
                    scrollTop: $tabID.offset().top
                }, 200);
            }

Auf der Produktdetailseite (productdetails/details.tpl) wird der Link wie folgt umgesetzt:
Code:
                                                {link href="{$Artikel->cURLFull}#tab-votes"
                                                    id="jump-to-votes-tab"
                                                    aria=["label"=>{lang key='Votes'}]
                                                }
                                                    {include file='productdetails/rating.tpl' stars=$Artikel->Bewertungen->oBewertungGesamt->fDurchschnitt total=$Artikel->Bewertungen->oBewertungGesamt->nAnzahl}
                                                    ({$Artikel->Bewertungen->oBewertungGesamt->nAnzahl} {lang key='rating'})
                                                {/link}

Hier meine Anpassungen bezüglich "Frage zum Artikel":
Code:
        registerFinish: function($wrapper) {
            $('#jump-to-questionOnItem-tab', $wrapper).on('click', function () {
                let $tabID = $('#content a[href="#tab-questionOnItem"]');
                if ($tabID.length > 0) {
                    $tabID.tab('show');
                } else {
                    $tabID = $('#tab-votes');
                    $tabID.collapse('show');
                }

                $([document.documentElement, document.body]).animate({
                    scrollTop: $tabID.offset().top
                }, 200);
            });

            let $tabID = $('#product-tabs a[href="' + window.location.hash + '"]');
            if ($tabID.length) {
                $tabID.tab('show');
                $([document.documentElement, document.body]).animate({
                    scrollTop: $tabID.offset().top
                }, 200);
            }
Code:
                                                {link href="{$Artikel->cURLFull}#tab-questionOnItem"
                                                    id="jump-to-questionOnItem-tab"
                                                    aria=["label"=>{lang key='productQuestion' section='productDetails'}]
                                                }
                                                    {lang key='productQuestion' section='productDetails'}
                                                {/link}

... leider bisher ohne Erfolg. Hat vielleicht jemand eine Ahnung was ich falsch mache. Besten Dank für jede Unterstützung.

Grüße aus HH,

Matthias