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

Phoca Cart - complex e-commerce extension
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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

Tags:
christine
Phoca Hero
Phoca Hero
Posts: 2725
Joined: 28 Nov 2010, 17:20

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

Post 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
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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
christine
Phoca Hero
Phoca Hero
Posts: 2725
Joined: 28 Nov 2010, 17:20

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

Post 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
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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
christine
Phoca Hero
Phoca Hero
Posts: 2725
Joined: 28 Nov 2010, 17:20

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

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post 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
If you find Phoca extensions useful, please support the project
nicouth2000
Phoca Member
Phoca Member
Posts: 14
Joined: 15 Sep 2019, 22:54

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

Post 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
Post Reply