News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

VM 3.0.13.6 PHP Fatal error: Customfilters PRO

Started by 2dmaster, March 07, 2016, 01:05:05 AM

Previous topic - Next topic

2dmaster

PHP Fatal error:  Access level to CustomfiltersModelProducts::populateState() must be public (as in class VirtueMartModelProduct) in /../domains/...ru/public_html/components/com_customfilters/models/products.php on line 33
how to fix it fast ? pls help
/**
* Class containing the main logic of the component
* @author sakis
*
*/
class CustomfiltersModelProducts extends VirtueMartModelProduct
{

Ghost

As a fast temporary solution you can change "private" to "public" on this line in /components/com_customfilters/models/products.php:

private function populateState($ordering = 'ordering', $direction = 'ASC')

Permanent solution should be provided by the extension developer.

balai

Quote from: 2dmaster on March 08, 2016, 10:23:04 AM
Not at all.
Virtuemart cannot change the functions visibility in minor versions.
It's not correct to force any developer to change it's code in minor versions.
There should be a minimum contract in minor updates.

I have already talked to Max about that and i think he understood that and he will fix it in the core files of VM.

Kind Regards,
Sakis

To avoid confusions. This is my response in the communication we had with 2dmaster

Milbo

In princip correct, but here it is a bit different.

There is a joomla function, called "populateState". I did not use this function, then I wrote a function to set certain states by request/session to the model.

Then I noticed, that populateState is an empty function which is meant to be overriden to provide this function. There was no need to change it, so I let it last years as is.

Working on the VMF, I had to implement the populateState to the vModel. Then I decided to write the product model proper and use the old updateRequests as proxy function (fallback for old code) and to use directly the correct populateState. I thought also to use another name for it, but this would lead to confusion for later development (why vm does it different than joomla, would be the question).

The function is defined as
Quote
protected function populateState()
   {
   }

I accidently added it with "private" instead of "protected". Balai already notified me in our skype dev chat. So that was the error, but I still defend, that we use now the correct populateState. It is also the clean solution to keep selected filters.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

#4
Thanks for clarifying that Max.
I suppose that it will become protected again the next version. Right?
As we already discussed there should be some basic contracts (function/class names and visibility) to ensure code stability in minor updates.
I think it's the no 1 priority to ensure that people's shops will continue to work with their installed addons when the apply minor updates.

Milbo

It is already protected, when you would have downloaded the last version in the skype chat. But it may be changed to public in vm3.1, because there is no reason to forbid the use from outside.

and as you can see, the problem was not to use the correct function now, the problem was that I accidently set it on private, cause I developed it on the vModel, not the old vmModel.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/