Author Topic: Extend custom field with associated list (BE)  (Read 2110 times)

AmStaF

  • Beginner
  • *
  • Posts: 47
Extend custom field with associated list (BE)
« on: December 26, 2011, 06:54:59 am »
From my experience, maybe it would be a very usefull feature.

With new product we can assign category or manufacture through dropdown list. But for my needs it`s usefull to specify also which user delivered the product to the warehouse. And I don`t want to allow the administrator to type the user`s name in the inputbox (to avoid typos).

Because there is no any solution for that inside vm, I was forced to implement some hack in models\customfields.php:

 - for the customfield with specified name it creates the dropdown list with registered users;
 - standart inputbox (customfield) is set to readonly;
 - implement js (onChange) for dropdown list that change the inputbox;
 - product and its customfield are being saved by normal (default) way with no accident.

But what about standart core feature? maybe it makes sense?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Extend custom field with associated list (BE)
« Reply #1 on: December 26, 2011, 10:24:53 am »
For such needs you can use customfields plugin to write your own customfield "type" and for eg using a dropdownlist of user.
Please refer to plugins/vmcustom folder and look the trigger plgVmOnProductEdit.
If you use it only in the virtuemart Admin you have only to use 2 or 3 function to achive this with "NO" hack in the core !
If you want use it to simple display and edit it in Back-End look in textInput plugin, on simply using plgVmOnProductEdit and set a dropdown with field from an existing table you can write it 30 minutes !

AmStaF

  • Beginner
  • *
  • Posts: 47
Re: Extend custom field with associated list (BE)
« Reply #2 on: December 26, 2011, 10:32:34 am »
Oh, thanks for showing the correct direction, I will try it :)

AmStaF

  • Beginner
  • *
  • Posts: 47
Re: Extend custom field with associated list (BE)
« Reply #3 on: December 27, 2011, 07:47:20 am »
Trigger plgVmOnProductEdit had been included in 2.0 release only, not 1.98. I`m afraid to upgrade right now from cleared and perfect (for my needs) 1.98, so I prefer to wait.

But I`ve got the look of 2.0, there is great potential for development! Thanx :)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4067
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Extend custom field with associated list (BE)
« Reply #4 on: December 27, 2011, 09:19:56 am »
Amstaf,
 the 1.98 revision have no support and you get always answer for vm2.0.

If you hack your code now, you have no chance to get your shop working as expected with future release :(

AmStaF

  • Beginner
  • *
  • Posts: 47
Re: Extend custom field with associated list (BE)
« Reply #5 on: December 27, 2011, 11:24:51 am »
working as expected with future release

Yes, I know but.. come what may..  :)

I`ve got a lot of overrided templates and a few model implemented functions long before 2.0 stable, so I`m waiting annoying bugs to be dissappeared before rewrite the code. You`ve got a huge work so I`ll wait a little!

Anyway no more words about 1.98  :-X