Hi,
In the plugin plugins/vmcustom/specification/specification.php i can see a function probably call by a trigger:
function plgVmOnStoreProduct($data,$plugin_param){
But i don't see how is trigged this function.
I'm looking for a trigger in virtuemart onStoreProduct i need for a custom component.
Stéphane
yes-- I've been confused/sad about this one
only available from administrator\components\com_virtuemart\models\customfields.php if a custom field is set
I don't know why
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
if (isset($datas['customfield_params']) and is_array($datas['customfield_params'])) {
foreach ($datas['customfield_params'] as $key => $plugin_param ) {
$dispatcher->trigger('plgVmOnStoreProduct', array($datas, $plugin_param ));
}
}
Salut Stéphane,
plgVmOnStoreProduct permit to save in an external table for eg.
I use a hidden customfield_params in product form that on save this is triggered and use another input name for the other fields
eg
<input type="hidden" name="customfield_params[45][255]">
<input type="text" name="my_plugin_name[45][255][position]" value="default">
<input type="text" name="my_plugin_name[45][255][date]" value="default">
.....
nice!!!!!
excellent sideways thinking.. kudos and bookmarked :)
Hi Studio42,
I need to synchronize another table when the product stock or price change.
What do you think it's the best way to do this.
There are no trigger on product update.
Stéphane
that's what he saying
use a hidden (dummy) customfield_params in the product form to call the customfields trigger
haven't tried...
If you need to trigger it in all products, then do not check for the plugin in onProductEdit function but use a static value in the plugin to prevent multiple add
set the hidden fields one time.
And use plgVmOnStoreProduct to get your values.
Another way is to use a Joomla system checking "task" and "option" input, but the problem is that the ID is only set after and VM redirect, so you can only check for updates and not for a new product.
Hi,
I follow your idee and make a customvm plugin.
I use plgVmOnProductEdit to display some info i need to configure
and plgVmOnStoreProduct to trigger database save information when product is saved.
It's work fine when i save the product in virtuemart product page.
But the trigger are not send :
- when i update an order in backend manually
- when the product is purchased in front-end.
The idee is to save data in another table when the product quantidy is changed (backend or cart completed)
Stéphane
Stéphane
investigate
plgVmOnUpdateSingleItem($data, $order)
&&
plgVmConfirmedOrder ($cart, $order)
Thanks i was on plgVmGetProductStockToUpdateByCustom