VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: lliseil on October 03, 2012, 22:11:45 PM

Title: Frontend editing products - 2.0.12f: won't work
Post by: lliseil on October 03, 2012, 22:11:45 PM
Nice new features with 2.0.12b!

Now frontend editing won't work by default. Had to apply a hack to ~/libraries/joomla/registry/registry.php for it to work. EDIT: Unfortunately, causes malfunctioning in the backend.

Vm 2.0.11e, 2.0.12b (site updated from 2.0.10)
Joomla 2.5.7
PHP 5.3.17

Before hacking the core file:
Logged into the frontend with the Vendor user. Clic "Edit" icon. Then comes the following error message, whether clicking "Save" or "Cancel", with/without editing the product :
Fatal error: Cannot access empty property in /site-path/libraries/joomla/registry/registry.php on line 336 Fatal error: Access to undeclared static property: JLoader::$classes in /site-path/libraries/loader.php on line 195
- The URL while in editing window    : ~/index.php?option=com_virtuemart&tmpl=component&view=product&task=edit&virtuemart_product_id=628
- The URL after clicking SAVE or Cancel: ~/index.php?option=com_virtuemart

Editing libraries/joomla/registry/registry.php solved this issue so far: Cancel, Save after editing working fine. Reference's below:

Lines 331-337, original:
// Traverse the registry to find the correct node for the result.
for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
         {
            if (!isset($node->$nodes[$i]) && ($i != $n))
            {
               $node->$nodes[$i] = new stdClass;
            }
            $node = $node->$nodes[$i];
         }


Edited:
for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
         {   if(strlen($nodes[$i]>0)) {
                if (!isset($node->$nodes[$i]) && ($i != $n))
                {
                   $node->$nodes[$i] = new stdClass;
                }
                $node = $node->$nodes[$i];
                }
         }

Patch is taken from: [bug] with JRegistry when the path contains empty fields (double dots) (http://forum.joomla.org/viewtopic.php?f=579&t=709422)

Only misbehaviour we found since a week we're editing through frontend is that return to the frontpage after each editing.

EDIT:
* Behaviour and workaround are identical between Vm 2.0.12b and 2.0.11e.
* WTH, our hack has an unwanted consequence: I just confirmed that it causes Joomla 2.5 to forbid editing in the backend! With the dreadful message:
"You are not authorized to see this page [with the ID of the Menu/Article/Module]"
Title: Re: Frontend editing products - 2.0.12b: issue; workaround
Post by: Zaggiff on October 19, 2012, 02:16:22 AM
Quote from: lliseil on October 03, 2012, 22:11:45 PM
Nice new features with 2.0.12b!

Now frontend editing won't work by default. Had to apply a hack to ~/libraries/joomla/registry/registry.php for it to work. EDIT: Unfortunately, causes malfunctioning in the backend.

Edited:
for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
         {   if(strlen($nodes[$i]>0)) {
                if (!isset($node->$nodes[$i]) && ($i != $n))
                {
                   $node->$nodes[$i] = new stdClass;
                }
                $node = $node->$nodes[$i];
                }
         }

...


Just need to do some fix to the code a bit.

Instead of

{   if(strlen($nodes[$i]>0)) {

put  this

{   if(strlen($nodes[$i])>0) {

and no more "that it causes Joomla 2.5 to forbid editing in the backend!"
Title: Re: Frontend editing products - 2.0.12b: issue; workaround
Post by: lliseil on October 25, 2012, 12:45:17 PM
Thank you Zaggiff.

Well fixed the line ":-} but now with VirtueMart 2.0.12f:
- won't save (with registry.php hacked)
- still can't edit and same error (without editing registry.php)
Have to go: client's calling . . .
Title: Re: Frontend editing products - 2.0.12f: won't work
Post by: jguy on October 26, 2012, 13:54:28 PM
While you guys are talking about whether Front End editing is working properly, I cant even find out where to enable it, what am I missing

Can someone please point me to some docs on this subject or provide me with some instructions, because I am now really confused. Does it work like the old way, with an admin menu becoming available or do I stil need to do something in the Joomla ACL

Any help would be much appreciated
Title: Re: Frontend editing products - 2.0.12f: won't work
Post by: gpessoa on October 29, 2012, 01:02:49 AM
First, you have to login as admin,

Them you will find a button on product front shop (see image attached)

By the way, mine works fine!


[attachment cleanup by admin]
Title: Frontend editing products - 2.0.12f: won't work
Post by: jguy on October 29, 2012, 14:33:30 PM
Thanks for your reply gpessoa

Yes this part seems to be working, but I am looking for access to the Admin area of the shop component, like in the old VM. It used to allow configuration while logged in as storeadmin

Currently the front end editing seems to only allow the editing of an existing product (unless I am missing something here). The little side tab menu doesn't bring up the full admin menu as expected

Having read through the forum, is this why some are talking about setting up a new special user group in the Joomla ACL and creating a special permission menu option to the VM2 backend admin area?


Title: Re: Frontend editing products - 2.0.12f: won't work
Post by: gpessoa on October 29, 2012, 15:12:26 PM
Sorry, I can`t help you on this.
I`m not familiar with VM1 and my knowledge of VM2 is also limited, since I only meet it a few weeks ago.
One thing I Know, This VM2 has a lot to grow up!
Title: Re: Frontend editing products - 2.0.12f: won't work
Post by: jguy on October 29, 2012, 19:50:01 PM
Thanks gpessoa for your reply
Title: Re: Frontend editing products - 2.0.12f: won't work
Post by: David Kan on December 27, 2012, 08:50:22 AM
You can use this module: http://cmsmart.net/virtuemart-extensions/add-virtuemart-product-frontend-detail