News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Extend custom field with associated list (BE)

Started by AmStaF, December 26, 2011, 06:54:59 AM

Previous topic - Next topic

AmStaF

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

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

Oh, thanks for showing the correct direction, I will try it :)

AmStaF

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

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

Quote from: Electrocity on December 27, 2011, 09:19:56 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