dmstr / yii2-cookie-consent

14 stars 3 forks source link

composer update error #3

Closed WeeSee closed 4 years ago

WeeSee commented 4 years ago

I added this line to composer require: section:

"dmstr/yii2-cookie-consent" : "~1.3.2"

When executing composer update it fails with

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for dmstr/yii2-cookie-consent ~1.3.2 -> satisfiable by dmstr/yii2-cookie-consent[1.3.2].
    - dmstr/yii2-cookie-consent 1.3.2 requires npm-asset/dmstr--cookie-consent ^0.2.0 -> no matching package found.

Did I miss something?

WeeSee commented 4 years ago

Found the problem: need to enable fxp-asset (was set to false):

"config": {
        "process-timeout": 1800,
        "fxp-asset": {
            "enabled": true
        }
    },
WeeSee commented 4 years ago

still not working...

I added the <?= CookieConsent::widget( from the readme to ./views/layouts/main.php

and now get stuck with this error:

Unknown Property – yii\base\UnknownPropertyException
Setting unknown property: dmstr\cookieconsent\widgets\CookieConsent::detailsOpen

When commenting out this line and some others from the example, I get it working, but only on some pages, not the home page e.g. even there is only one layout in the app.

And I had to specify in the composer:

"config": {
        "process-timeout": 1800,
        "fxp-asset": {
            "enabled": true,
            "installer-paths": {
                "npm-asset-library": "vendor/npm",
                "bower-asset-library": "vendor/bower"
              }
        }
    },
germanbisurgi commented 4 years ago

need example code of cookie-consent

WeeSee commented 4 years ago

here is my code in layouts/main.php

<?= CookieConsent::widget([
    'name' => 'cookie_consent_status',
    'path' => '/',
    'domain' => '',
    'expiryDays' => 365,
    'message' =>
        'We use cookies to ensure the proper functioning of our website. '.
        'For an improved visit experience we use analysis products. '.
        'These are used when you agree with "Statistics".'
    ,
    'save' => 'Save',
    'acceptAll' => 'Accept all',
    'controlsOpen' => 'Change',
    //'detailsOpen' => 'Cookie Details',
    'learnMore' => 'Privacy statement',
    //'visibleControls' => true,
    //'visibleDetails' => false,
    'link' => '#',
    'consent' => [
        'necessary' => [
            'label' => 'Necessary',
            'checked' => true,
            'disabled' => true
        ],
        'statistics' => [
            'label' => 'Statistics',
            'cookies' => [
                ['name' => '_ga'],
                ['name' => '_gat', 'domain' => '', 'path' => '/'],
                ['name' => '_gid', 'domain' => '', 'path' => '/']
            ],
            'details' => [
 [
                    'title' => 'Google Analytics',
                    'description' => 'Create statistics data'

                ],
                [
                    'title' => 'Goal',
                    'description' => '_ga, _gat, _gid, _gali'

                ]
            ]
        ]
    ]
]) ?>
<footer class="footer">
germanbisurgi commented 4 years ago

i think is because you are trying to install version 1.3.2. You need 1.4.3 for details

WeeSee commented 4 years ago

Good hint. I saw 1.3.2 as latest release mentioned in https://github.com/dmstr/yii2-cookie-consent/releases

germanbisurgi commented 4 years ago

there are more releases but github displays them "collapesed" and are not to easy to see :)

germanbisurgi commented 4 years ago

can i close this?

WeeSee commented 4 years ago

Yes, close the issue. I'll be sure it will work now. Thanx a lot for your help.

WeeSee commented 4 years ago

May you can add the composer requirements

"fxp-asset": {
            "enabled": true,
            "installer-paths": {
                "npm-asset-library": "vendor/npm",
                "bower-asset-library": "vendor/bower"
              }
        }

to the docs since the sample app Yii2-basic just uses

"config": {
        "process-timeout": 1800,
        "fxp-asset": {
            "enabled": false
        }
    },