File download counter in OJS 3

Who can help me create a button, counter for calculating the downloads of a document on the magazine’s website.
Something like in the picture.Screenshot_3

See this thread for one option:

Hello
the solution needs to hard code the template file : article_summary.inc.php (you need to add somme code lines here) if you want these statistics to show on the Table of contents…
See this video for the detailed solution : #OJS Tutorial Menampilkan Abstract and Download Statistics pada Table of Content OJS 3 - YouTube

Hi,
In this video, the code is not visible completely.
I would appreciate it if you can assist in having this code completely.
image

{assign var=galleys value=$article->getGalleys()}
Views: {$article->getViews()}
{if $galleys}
    {foreach from=$galleys item=galley name=galleyList}
       / Download: {$galley->getViews()}
    {/foreach}
{/if}

Hi,
I applied this but it didn’t work:

			</li>
		{/foreach}
	</ul>
{/if}

{call_hook name="Templates::Issue::Issue::Article"}

{foreach from=$pubIdPlugins item=pubIdPlugin}
{if $issue->getPublished()}
{assign var=pubId value=$article->getStoredPubId($pubIdPlugin->getPubIdType())}
{else}
{assign var=pubId value=$pubIdPlugin->getPubId($article)}{Preview pubId}
{/if}
{if $pubId}
{assign var=“doiUrl” value=$pubIdPlugin->getResolvingURL($currentJournal->getId(), $pubId)|escape}
{translate key=“plugins.pubIds.doi.readerDisplayName”} :

{$doiUrl}

        {/if}

{/foreach}
{translate key=”article.abstract”} views: {$article->getViews()} , {if is_a($article, ‘PublishedArticle’)}{assign var=galleys value=$article->getGalleys()} Views: {$article->getViews()}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{$galley->getGalleyLabel()} Downloads: {$galley->getViews()}
{/foreach}
{/if}

Add following code to article_details.tpl

templates/frontend/objects/article_details.tpl

{assign var=galleys value=$article->getGalleys()}
Görüntüleme: {$article->getViews()}
{if $galleys}
    {foreach from=$galleys item=galley name=galleyList}
       / İndirme: {$galley->getViews()}
    {/foreach}
{/if}

You can see sample here
https://ojsdergi.com/demo/index.php/dergi/article/view/7

Thanks a lot, it worked.

1 Like

A post was split to a new topic: Downloads and views not displaying