Hi,
I added 2 x the same vmcustom plugin in same product, this display and work ok.
But in the module the plugin is displayed 2 times.
I added a control to see the id(see attached image), the plugin is not called 2 times in the module.
I think, it's a sort of cache or reference problem when adding it to the display.
Greets,
Patrick.
J3.4.1 vm 3.0.8.4
I found how to fix it, but only for my plugin.
The problem is that the function displayProductCustomfieldFE can be called in 3 different files:
reference for displayProductCustomfieldFE are in
ROOT\components\com_virtuemart\views\productdetails\view.html.php
ROOT\components\com_virtuemart\views\cart\tmpl\padded.php
ROOT\components\com_virtuemart\helpers\shopfunctionsf.php
I think shopfunctionsf call is the bug origin and add a new display each time this is called and don't check if something is set or not.
P.S: the real orgin is the product module : shopFunctionsF::sortLoadProductCustomsStockInd
This recall each time the plugin(for nothing) and readd a new display and of course do all the checks in this function.
Adding a bool in product to know is already checked/set can be the simpliest solution without any big code changes.
For info, if you use the module 4 time with same product this is checked 4 times for nothing and display are added each time on trigger plugin plgVmOnDisplayProductFEVM3