Phoca Download Plugin causes fatal error for Virtuemart

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
MarioP
Phoca Member
Phoca Member
Posts: 20
Joined: 22 Oct 2013, 15:25
Location: Poland

Phoca Download Plugin causes fatal error for Virtuemart

Post by MarioP »

Hi,
I'm using the Download Plugin in Virtuemart product details in order to able the users download the manuals in pdf. It has been working great till I updated the Virtuemart to the newest 3.0.3 version. Now when I go to category view of the Virtuemart I see the blank page with the following error:

Code: Select all

Fatal error: Cannot redeclare class JPaginationObject in \libraries\joomla\html\pagination.php on line 753
How do I know the the plugin is the culprit...? Firstly I noticed that everything works fine after I had turned off using Joomla Plugins in Virtuemart configuration. Going further I started unpublish the plugins one after another and it turned out that when I unpublish the Phoca plugin everything works without any error...But now I can't use the plugin :cry: ....Please help.
J! 2.5.28
Phoca Download Plugin 2.1.6
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by Jan »

Hi, hmm, the problem is, Phoca Download Plugin does not declare a Pagination Object - there is no pagination in plugin as it is a part of content/article :idea:

Really no idea what can be wrong there, the plugin does not need to load any pagination and does not need to declare it :idea:

Jan
If you find Phoca extensions useful, please support the project
MarioP
Phoca Member
Phoca Member
Posts: 20
Joined: 22 Oct 2013, 15:25
Location: Poland

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by MarioP »

I thought so.. It's very strange...But the fact is the plugin triggers the fatal error (i.e. as I wrote in the previous post - when I unpublish the plugin, the error is gone, that's why I stated that the plugin is the culprit). What more strange, it causes the issue in the category layout where it's not being used... :x In the product details (content) it still works as it should.. In the category layout - blank page with the error... :x
Maybe there's something in the Phoca Download component itself..? It uses pagination...
If you would be so kind and like to take a look at this issue live I could make available the admin account - I'd send you the data by PM or whatever you like - just let me know.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by Jan »

Hi, the problem is, when the plugin is active, it loads some data from Phoca Download component but there is no need to load the pagination. Pagination from Phoca Download is loaded in category view - by this view, when the items are loaded from database - to make pages for the items - But in plugin, there is no pagination, as you can paginate the articles but you cannot have double pagination on the site - this is why the plugin does not work with pagination.

Yes, I understand, the error comes only in specific cases, I have checked it and really didn't find any include of the pagination in the plugin :idea:

The problem I see, Phoca Download even do not create any JpaginationObject, it creates own extended class PhocaDownloadPagination but not JPagination and not JpaginationObject :idea:

In the file: \libraries\joomla\html\pagination.php - there is:
class JPaginationObject extends JObject

but such declaration is never used in any of the Phoca extension :idea:

I really have no clue advice, maybe something include the file more then one times, which is not possible in Phoca Download as it loads this way:
jimport('joomla.html.pagination'); --> means load in once, not more :idea:

Anyway, does the VM 3 work under Joomla! 2.5 or it is a Joomla! 3 component?

Jan
If you find Phoca extensions useful, please support the project
MarioP
Phoca Member
Phoca Member
Posts: 20
Joined: 22 Oct 2013, 15:25
Location: Poland

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by MarioP »

VM 3 works under Joomla! 2.5. specifically 2.5.28
Generally the error has occurred just after the update VM from 3.0.0 to the newest one 3.0.3. I also reported the issue on the VM forum, but unfortunately I have not got any feedback so far and its looks like you are my last chance to solve the issue. If you have no idea what can be wrong I just give up :(
Anyway thank you very much for trying to help. I really appreciate it.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by Jan »

Hi, yes, really no idea, and no idea which part can cause it :-( :-(

I have tested it, tried to find the declaration and tested with different "print_r" and "echo" to debug different variables, but didn't found anything.

There can be a lot of different parts which can somehow influence it:

- someting redeclares the JPaginationObject

So try to find in your whole Joomla! folder structure the string "class JPaginationObject" - if you are on localhost, this will be maybe better to search the files and folders for the string.

If you will find two files, then seems the problem will be in the second. The main is:

libraries\joomla\html\pagination.php

Jan
If you find Phoca extensions useful, please support the project
MarioP
Phoca Member
Phoca Member
Posts: 20
Joined: 22 Oct 2013, 15:25
Location: Poland

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by MarioP »

Thank you for the clue. It seems the clue really approached us to the solution. During the investigation I found the second " class JPaginationObject" is in
\administrator\components\com_virtuemart\helpers\vmpagination.php line 776.

Code: Select all

class JPaginationObject extends JObject
{
	/**
	 * @var    string  The link text.
	 * @since  11.1
	 */
	public $text;

	/**
	 * @var    integer  The number of rows as a base offset.
	 * @since  11.1
	 */
	public $base;

	/**
	 * @var    string  The link URL.
	 * @since  11.1
	 */
	public $link;

	/**
	 * @var    integer  The prefix used for request variables.
	 * @since  11.1
	 */
	public $prefix;

	/**
	 * Class constructor.
	 *
	 * @param   string   $text    The link text.
	 * @param   integer  $prefix  The prefix used for request variables.
	 * @param   integer  $base    The number of rows as a base offset.
	 * @param   string   $link    The link URL.
	 *
	 * @since   11.1
	 */
	public function __construct($text, $prefix = '', $base = null, $link = null)
	{
		$this->text = $text;
		$this->prefix = $prefix;
		$this->base = $base;
		$this->link = $link;
	}
}
After I had removed the whole class the error disappeared!
So now...Which extension is the culprit? What does the Phoca plugin have to do with this? Maybe it's the VM issue? If yes, where exactly the issue lies?
Besides I can't find the vmpagination.php file in the 3.0.0 VM...So it looks they added it from some reason in the lastest release and it causes the error in certain circumstances e.g. when we use your plugin...How can I explain them that it is their fault?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by Jan »

Hi, really no idea which way the plugin is a part of this problem. Content plugins are displayed inside articles where "com_content" rules are applied - pagination of articles can be active there so the plugin should have no connection to this at all different features are based or article rules :idea:

The part:
administrator\components\com_virtuemart\helpers\vmpagination.php redeclares the class, but why it does and why it is in conflict with the one in Joomla! core, I think, this should be a question on Joomla! developers :idea: (and it will be not easy to answer it, as maybe they didn't count that something will load the standard pagination when they user own) :idea:

Jan
If you find Phoca extensions useful, please support the project
MarioP
Phoca Member
Phoca Member
Posts: 20
Joined: 22 Oct 2013, 15:25
Location: Poland

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by MarioP »

Indeed maybe I'll try to find the answer in the Joomla forum. If noone helps I'll remove the class JPaginationObject from the VM and that's it.

Thank you very much.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin causes fatal error for Virtuemart

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply