Author Topic: Passing cid to edit form in admin panel  (Read 3030 times)

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Passing cid to edit form in admin panel
« 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:

Code: [Select]
$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
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Passing cid to edit form in admin panel
« Reply #1 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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Passing cid to edit form in admin panel
« Reply #2 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!
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Passing cid to edit form in admin panel
« Reply #3 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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/