News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Error 404 Using Content button Plugin in the Front End - [Fixed in 4.0.30]

Started by ghicar, 22.08.2023 15:04:03

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ghicar

Environment

  • Joomla version 4.3.3
    Template - Cassiopeia
    PHP version 8.1.22
    jDownloads Version 4.0.29
The site was migrated from Joomla3 & jDownloads 3.9.8.7 to Joomla 4 and following the jDownloads migration document
( https://www.jdownloads.net/documentation/getting-started-v3-9/upgrading-from-jd3-9-to-jd4 )

I get a 404 error when trying to use the content button in the JCE editor from the front end.
I can use this content plugin from the backend without issue.
On the front end, if I try to enter filter from any of the dropdowns such as a category, author, status, ... or or a search string, or we get:  "404 View not found [name, type, prefix]: article, html, site"

Adding the jDownloads file link by hand works fine if I type by hand the text ie "{jd_file file==id}"

call stack is below:

Function   Location
1   ()   JROOT/libraries/src/MVC/Controller/BaseController.php:822
2   Joomla\CMS\MVC\Controller\BaseController->getView()   JROOT/libraries/src/MVC/Controller/BaseController.php:608
3   Joomla\CMS\MVC\Controller\BaseController->display()   JROOT/components/com_jdownloads/src/Controller/DisplayController.php:123
4   JDownloads\Component\JDownloads\Site\Controller\DisplayController->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:678
5   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
6   Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()   JROOT/components/com_jdownloads/src/Dispatcher/Dispatcher.php:55
7   JDownloads\Component\JDownloads\Site\Dispatcher\Dispatcher->dispatch()   JROOT/libraries/src/Component/ComponentHelper.php:361
8   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/SiteApplication.php:208
9   Joomla\CMS\Application\SiteApplication->dispatch()   JROOT/libraries/src/Application/SiteApplication.php:249
10   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:293
11   Joomla\CMS\Application\CMSApplication->execute()   JROOT/includes/app.php:61
12   require_once()   JROOT/index.php:32

The same error occurs with jDocuments 4.0.27 as well the latest 4.0.29.

  •  

ghicar

I believe this is the same issue as reported in topic  "Fehler 404 bei Suche im jDownload-Plug im Frontend".
  •  

ColinM

Hi
I believe that the xtd-plugin for jD works when the Super User is logged in to the Front End.  But not others.

Could you confirm please

Colin
Colin M
  •  

ghicar

Hi Colin

As requested, I have just tested the content button in "Front End" article edit logged in as superuser and I get the same 404 error when using a lesser user.  (Also tested with recent Joomla 4.3.4).
  •  

ghicar

Don't know if it helps but I dumped "dd($this)"  in the call stack method display() in JROOT/components/com_jdownloads/src/Controller/DisplayController.php:123 after selecting a filter on category and I noticed $this had an array (I replaced the full path to the website root with <JROOT>):

  #paths: array:1 [?
    "view" => array:1 [?
      0 => "<JROOT>/components/com_jdownloads/views/"
    ]
  ]

The folder  "~/components/com_jdownloads/views/   does not exist, which my guess is the cause of the 404 error?

  •  

ColinM

ghicar,
jD 4 does not have 'views' there - that was in the jD3.9 series.  Changing to Joomla! 4 involved significant restructuring.
The 'views' are now typically located as below

/public_html/components/com_jdownloads/tmpl/downloads/default.php

Colin
Colin M
  •  

ghicar

I looked into this further with the knowledge that the filter setting in the jD content editor button works in the backend and not the frontend when editing articles.

I noticed that, from the front end article editing, when you click the downloads button to open up the modal dialog to select a file, the dispatch() function in
components/com_jdownloads/src/Dispatcher/Dispatcher.php is called with $this->input->get('view') set to "downloads", but when you then select any filter from a drop down or search field the same dispatch() function is called  $this->input->get('view') set to "article".


I did an experiment of changing the value from "article" to "downloads" by adding

if( $this->input->get('view') === 'article')
{
   $this->input->set('view', "downloads");
}


at the start of the dispatch() function in components/com_jdownloads/src/Dispatcher/Dispatcher.php.

After doing this the filters can be used in the front end as expected.

This is obviously a hack, but suggests something needs to be changed in the jD content button config or code to use "downloads" rather than "article" from the outset ?
  •  

Arno

Hi,
I have tried to find the reason for this bug. But so far I have not had any success. Therefore, I have now used your little hack to get it working again. But maybe I will find the cause later.

I have attached the file below. For testing please copy the unzipped file to /components/com_jdownloads/src/Dispatcher/
Please post here results. Thanks.

Note: We have now three topics with reports about this bug. So I will either merge these different posts or delete the others.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

ColinM

Arno
Have tested the revised Dispatcher.php and it solves the 'challenge' with the filtering etc.

Clicking on the Download button does a Download OK but clicking on the title , or symbol, causes error
    1054 Unknown column 'file_id' in 'field list'   
I have Front End Options - 'Use Link in Symbol' and 'Use Downloads title as download link' set to 'Yes'.
If I set both Options to 'No' then the links are still active  :(
and again the error occurs  :( :(

When I tested on a full website all was OK - previous tests done on XAMPP site Hmm!
Colin
Colin M
  •  

ghicar

I have tested with the dispatcher.php that Arno supplied and it solves the filtering problems with the frontend edit. Backend edit filtering still works OK.
Our use case for jDownloads are all working fine: 

  • ie the embedded link in an article
    Downloads from a list all categories menu item.
    Front End upload via the add button on "List All categories"

We use a custom minimal layout for the content button layout, which is set as:  <div class="BSCJDownloadsButton" >{file_title}</div>
  •  

Arno

Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •