Page 1 of 2

Currency module - Fatal error: Using $this when not in object context

Posted: 15 Sep 2019, 23:24
by nicouth2000
Hi,

it's the first time i try phoca.

i have a test site on localhost with 3.9.11 joomla version and 3.3.2 phoca cart version

when currency module is activated, whatever the position, i got this message from the local website :

Fatal error: Using $this when not in object context in C:\wamp64\www\Test\modules\mod_phocacart_currency\tmpl\default.php on line 72

I found on line a joomla problem if you are in 3.8 Joomla version. To change the line 16 into this file : modules/mod_random_image/tmpl
First i undisplayed the Random image module, still the problem
Then i fixed the line 16, and it changed absolutly nothing. So i did put again the original line

i have tried with other older joomla versions, i still have the same error.

i checked your forum, it happened with the EmmaD64's post. i followed the Christine's advice, to click the Database correction button.

Still the same error, then, somebody could help me ? ( if somebody helps me, im not a developper, i understand very few to the informatic problems, so thank you in advance for your patiency )

Thank you, Nicouth2000

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 15 Sep 2019, 23:55
by christine
Hi,
nicouth2000 wrote:
15 Sep 2019, 23:24

i have a test site on localhost with 3.9.11 joomla version and 3.3.2 phoca cart version.
when currency module is activated, whatever the position, i got this message from the local website :

Fatal error: Using $this when not in object context in C:\wamp64\www\Test\modules\mod_phocacart_currency\tmpl\default.php on line 72
1) which PHP version are you using? Do you have the latest module? https://www.phoca.cz/download/category/ ... ncy-module
I found on line a joomla problem if you are in 3.8 Joomla version. To change the line 16 into this file : modules/mod_random_image/tmpl ...
2) This happened only in Joomla 3.8.8 and has been solved in Joomla 3.8.9: https://github.com/joomla/joomla-cms/pull/20533

So, check point 1) please.

Kind regards
Christine

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 16 Sep 2019, 00:56
by nicouth2000
Hi Christine,

this is a 5.6.25 PHP version with WampServer. Yes this is the latest Currency module 3.3.0

What should i do ?

Thank you, Nicouth2000

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 16 Sep 2019, 01:27
by nicouth2000
Christine,

i have just tried with a 7.0.1 PHP Version, and it's still the same problem.

What should i do ?

Thank you, Nicouth2000

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 16 Sep 2019, 11:45
by christine
Hi,

we need the exact messages. Try following please, either in backend:

System > Global configuration > System > Debug Settings > Debug System > Yes
System > Global configuration > Server > Error reporting > Maximum

or via FTP, to change following lines of configuration.php:

Image

Then you will get so called: "Call Stack" and these informations we need.

Sometimes also useful: To rename temporary the error.php.

Kind regards
Christine

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 17 Sep 2019, 04:59
by nicouth2000
Hi Christine,

this is the Call Stack message that you need :

Call stack
# Function Location
1 () JROOT\modules\mod_phocacart_currency\tmpl\default.php:72
2 require() JROOT\modules\mod_phocacart_currency\mod_phocacart_currency.php:63
3 include() JROOT\libraries\src\Helper\ModuleHelper.php:200
4 Joomla\CMS\Helper\ModuleHelper::renderModule() JROOT\libraries\src\Document\Renderer\Html\ModuleRenderer.php:98
5 Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render() JROOT\libraries\src\Document\Renderer\Html\ModulesRenderer.php:47
6 Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render() JROOT\libraries\src\Document\HtmlDocument.php:491
7 Joomla\CMS\Document\HtmlDocument->getBuffer() JROOT\libraries\src\Document\HtmlDocument.php:783
8 Joomla\CMS\Document\HtmlDocument->_renderTemplate() JROOT\libraries\src\Document\HtmlDocument.php:557
9 Joomla\CMS\Document\HtmlDocument->render() JROOT\libraries\src\Application\CMSApplication.php:1044
10 Joomla\CMS\Application\CMSApplication->render() JROOT\libraries\src\Application\SiteApplication.php:778
11 Joomla\CMS\Application\SiteApplication->render() JROOT\libraries\src\Application\CMSApplication.php:202
12 Joomla\CMS\Application\CMSApplication->execute() JROOT\index.php:49

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 17 Sep 2019, 05:04
by nicouth2000
i don't know what all this means,
Tell me what could help.
i don't know in which folder i can find the error.php file to temporary rename it.

Thank you
Best Regards, Nicouth2000

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 17 Sep 2019, 11:11
by christine
Hi,

Thanks for the Call Stack. It's not needed now to re-name error.php. I think, it's a PHP Version Problem or another Plugin (other extension).
Is everything up to date? Framework? Which template are you using?

Kind regards
Christine

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 17 Sep 2019, 12:49
by Jan
Hi, try to open this file:
modules/mod_phocacart_currency/tmpl/default.php on line cca. 72

and try to change

FROM:

Code: Select all

echo '<div class="'.$this->s['c']['pull-right'].' ph-input-select-currencies-button">';
TO:

Code: Select all

echo '<div class="'.$s['c']['pull-right'].' ph-input-select-currencies-button">';
And let me know if this is OK now?

Thank you, Jan

Re: Currency module - Fatal error: Using $this when not in object context

Posted: 17 Sep 2019, 23:06
by nicouth2000
Hi Jan,

All is OK now. The problem is solved.

i'm gonna open another topic about 2 site view problems

Thank you for your patiency

Best Regards, Nicouth2000