VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Stephen Roberts on November 08, 2011, 02:03:03 AM

Title: Passing cid to edit form in admin panel
Post by: Stephen Roberts on November 08, 2011, 02:03:03 AM
I'm working on a custom admin panel (almost a copy of the Product Categories) and I'm trying to figure out how the 'cid' variable is passed from the list to the edit form. I see that cid[] is set in the URL, and it appears that it used to be processed and set in view.html.php by doing something like:

$cid = JRequest::getInt('cid[]');
$model->setId($cid);


but nothing like this is used in the category MVC.

It appears that, at least for Product Categories, the category id is being set in the model behind the scenes somewhere. I've already spent an hour looking for how this happens. Can anyone save me some time and point me in the right direction? Thanks!

Stephen
Title: Re: Passing cid to edit form in admin panel
Post by: Milbo on November 08, 2011, 21:11:23 PM
Look in the helpers vmmodel to see our abstract model.

Then sometimes it got overriden. The cid is set most time by the constructor itself, but you can also use setId, except the usermodel is a bit different.
Title: Re: Passing cid to edit form in admin panel
Post by: Stephen Roberts on November 08, 2011, 22:08:48 PM
Wow, ok. I see it now. Thanks for clarifying!

Next question: I'm building a custom control panel that's almost an exact replica of the categories. I've created a model, views, controller, and added an admin menu item in adminmenuentries. Is there a better way to extend core functionality of VM2? I was looking at the extendedplugin, but it looks like it doesn't offer enough functionality. Any thoughts are appreciated!
Title: Re: Passing cid to edit form in admin panel
Post by: Milbo on November 09, 2011, 00:06:21 AM
It is even a lot easier than to create a standard view in joomla, due the provided stuff like publish and so.