News:

Looking for documentation? Take a look on our wiki

Main Menu

Can not modify products from frontend

Started by skotman, August 28, 2013, 00:59:40 AM

Previous topic - Next topic

skotman

I just upgraded my VM to 2.0.22b from 2.0.22a and noticed I have this error when I try to edit a product from the front end:

Fatal error: Using $this when not in object context in \administrator\components\com_virtuemart\helpers\vmview.php on line 366

I'm running Joomla 2.5.14, I don't know if this issue existed in 2.0.22a since I'm still in development of my site. Any help would be appreciated, I did a quick google and came up with one other person reporting this error from Italy:
http://forum.vmitalia.net/index.php?topic=11694.0

If he's already posted his error over here as directed by someone else please point me to that thread, no need for duplicate threads.

attiliog

#1
PHP: 5.3.5
Joomla!: 2.5.14
Virtuemart: 2.0.22b
Local machine: Macintosh

I'm the Italian user quoted in the previous post. This is my first post here. I report below what I wrote in the Italian forum.

I upgraded an on line site to last versions of Joomla and VirtueMart. Then I tried to edit a product from frontend as administrator. I received a blank page. I thought something went wrong during the upgrade. So I installed a clean version of Joomla and Virtuemart with only the sample data on a local machine. Same behavior. I activated the error reporting on Joomla and I got this error:
Fatal error: Using $this when not in object context in /Applications/MAMP/htdocs/vm2022b/administrator/components/com_virtuemart/helpers/vmview.php on line 366

I verified the code in the file reported by the message: there is an if statement that was not there before, in the 2.0.22a version. Moreover, when I deactivated the if statement, the error didn't show anymore and I edited the product without problems.

I hope this helps.

skotman


skotman

I took out the If statement, now the page shows up but the changes arn't saved. Are you seeing the same thing?

alatak

#4
Hello
Txs for reporting

I have fixed it.
We should have a new version 2.0.22c this week.
The fix will be included.

Here is the fix for those who cannot wait
in file administrator/components/com_virtuemart/helpers/vmview.php
replace line 366 with
if ($vmView->canDo->get('core.admin') || $vmView->canDo->get('vm.'.$view.'.edit')) {


In file /Applications/MAMP/htdocs/VM2/VM2014MP/administrator/components/com_virtuemart/helpers/adminui.php
replace  line 29 with
   static function startAdminArea($vmView,$selectText = 'COM_VIRTUEMART_DRDOWN_AVA2ALL') {


and then replace all occurence of
AdminUIHelper::startAdminArea();

with
AdminUIHelper::startAdminArea($this);

attiliog

Really thanks for your answer. Only a little thing. You say:

Quote from: alatak on September 02, 2013, 09:38:03 AM
and then replace all occurence of
AdminUIHelper::startAdminArea();

with
AdminUIHelper::startAdminArea($this);


In what files do we need to replace it? I tried in the two files you reported in your post, but i found no occurrence.
Sorry if this is an obvious thing: I'm a novice, as you can see.

alatak

Hello
IN all the files where you have that code
AdminUIHelper::startAdminArea();
It is actually in all the tmpl files

skotman

Quote from: skotman on September 02, 2013, 05:14:18 AM
I took out the If statement, now the page shows up but the changes arn't saved. Are you seeing the same thing?

I was able to fix the changes not being saved by turning off Search Engine Friendly URLs in the global config.

optmax

Joomla 2.5.14
VM 2.0.22c

Just to confirm that even with the 2.0.22c release I can still only edit products in the front end if Joomla! SEO is turned off.