Giter VIP home page Giter VIP logo

Comments (19)

bencroker avatar bencroker commented on August 11, 2024

So does this code display a running total of the count?

{% do craft.entryCount.increment(entry.id) %}

{{ craft.entryCount.count(entry.id) }}

If it does, but nothing appears in the control panel, then maybe reinstall the plugin as something must not have worked in the initial install.

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Yep, it does... I have it showing the running count for a set of entries as I view them.

Uninstall/reinstall and still the same behaviour.

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

The plugin uses the ElementQuery::EVENT_BEFORE_PREPARE event. Do you have any custom modules/plugins installed that might be interfering with this?

You can also try this code in a template to see if any counted entries are returned.

{{ craft.entryCount.countedEntries.count() }} entries counted

Can you also check that the entrycount datbase table is being populated?

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

The plugin uses the ElementQuery::EVENT_BEFORE_PREPARE event. Do you have any custom modules/plugins installed that might be interfering with this?

I'm not certain... we don't have any custom plugins we've written doing that but I'm not certain about other third party plugins. I did a quick search for the string EVENT_BEFORE_PREPARE and got nothing so probably not.

{{ craft.entryCount.countedEntries.count() }} entries counted

When I do this, I get this error:

Neither the property "countedEntries" nor one of the methods "countedEntries()", "getcountedEntries()"/"iscountedEntries()"/"hascountedEntries()" or "__call()" exist and have public access in class "putyourlightson\entrycount\variables\EntryCountVariable".

Can you also check that the entrycount datbase table is being populated?

Yes, it appears to be populating correctly with the correct entry id and corresponding counts.

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

Hmm, strange, what about this?

{{ craft.entryCount.getCountedEntries().all()|length }} entries counted

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Similar error:

Neither the property "getCountedEntries" nor one of the methods "getCountedEntries()", "getgetCountedEntries()"/"isgetCountedEntries()"/"hasgetCountedEntries()" or "__call()" exist and have public access in class "putyourlightson\entrycount\variables\EntryCountVariable".

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

Sounds like there must be a problem with your installed version. Can you remove the plugin files completely and reinstall?

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

I did uninstall it and reinstall it before via the cp. Is there something more I can do after uninstalling? ie. Are the plugin files still there to delete manually (I've never checked before)?

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

There’s an option to “remove” the plugin after uninstalling in the CP which will remove the files too. Otherwise you can use composer remove as well.

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Thanks Ben but still the same behaviour after removing and installing again.

I'm not a plugin developer so this comes a bit more from a layman's perspective but when I look at your plugin files, I can't even find a method for getCountedEntries or countedEntries... so maybe I'm missing something but I don't understand why you asked me to try those? Are you saying those methods exist but for some reason my installed files are missing them?

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

Apologies Mike, I was referencing a different version of the plugin. The method is called getEntries in version 2.0.2, so this is the code:

{{ craft.entryCount.getEntries().count() }} entries counted

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Ok, so that works and returns the expected result... as does this in a front end template:

{% set entries = craft.entryCount.entries.all() %}

But that returns nothing (ie. an empty array) when it is called in your cp template at craft/vendor/putyourlightson/craft-entry-count/src/templates/index.html

from craft-entry-count.

Stefenyo avatar Stefenyo commented on August 11, 2024

I'm getting this as well. Not showing up in the backend. I'm running the latest version of craft.

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

Do you have a multi-site setup? Could it be that the front-end site that it is working on is not the primary site?

from craft-entry-count.

Stefenyo avatar Stefenyo commented on August 11, 2024

No multi-site setup here. I did a fresh install of the plugin then I even did a fresh install of craft cms, unfortunately still getting the same thing.

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Mine is a multi - and yes, it is on a secondary site... but in light of @SweetPoStayPro's non-multi, I guess that's not the issue? I could try testing on the primary... ok, just tested it. I get results on primary site entries in the CP - but not the secondary.

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

@Coalescent Ok so the issue is multi-site, I'll see if I can release a fix for this soon, thanks for sticking with it!

@SweetPoStayPro Can you please provide some more info and show your code?

from craft-entry-count.

Coalescent avatar Coalescent commented on August 11, 2024

Same to you Ben and thanks for providing a fix!

from craft-entry-count.

bencroker avatar bencroker commented on August 11, 2024

Released a fix in v2.0.3, however note that the plugin has limited multi-site compatibility, as it is intended for educational purposes. For anything more complex, check out the View Count plugin.

from craft-entry-count.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.