Close

Profile: sofieoldebjerg

Avatar

User posts

3 years ago

Hi

We're using nopcommerce version 4.0 with the Emporium theme. In this version of nopcommerce it's only possible to accept cookies (a pop up with an OK-button). According to the GDPR rules, the user must be able to choose what cookies they want to accept.

I was wondering if it's possible to add an option that declines cookies? Then I could edit the current scripts with the "data-cookiescript" attribute and set it to "accepted". I don't know if that would be possbile, since I don't know anything about javascript...

But the current code is:

<script type="text/javascript" asp-location="Footer">
    $(document).ready(function () {
        $('#eu-cookie-bar-notification').show();

        $('#eu-cookie-ok').click(function () {
            $.ajax({
                cache: false,
                type: 'POST',
                url: '@Url.RouteUrl("EuCookieLawAccept")',
                dataType: 'json',
                success: function (data) {
                    $('#eu-cookie-bar-notification').hide();
                },
                failure: function () {
                    alert('Cannot store value');
                }
            });
        });
    });
</script>
<div id="eu-cookie-bar-notification" class="eu-cookie-bar-notification">
    <div class="content">
        <div class="text">@T("EUCookieLaw.Description2")</div>
        <div class="buttons-more">
            <button type="button" class="ok-button button-1" id="eu-cookie-ok">@T("Common.OK")</button>
            <a class="learn-more" href="@Url.RouteUrl("Topic", new { SeName = Html.GetTopicSeName("privacyinfo") })">@T("EUCookieLaw.LearnMore")</a>
        </div>
    </div>
</div>

I could probably just add another button that says "decline", but I don't know how to make the functionality work...