Hi
I need to write a custom script which can override some product's price based under special conditions. It could be a vmcustom plugin where the site owner could add a custom price to the product and the plugin uses it instead the core price, when the script allows it.
I can create the plugin, I have the price but the question that with which method can I override the price?
the function is
function plgVmPrepareCartProduct(&$product, &$customfield,$selected,&$modificatorSum)
I do lot of override with this function, See the variable - $modificatorSum
Thanks
Kishore
Hm. I created the vmcustom plugin, added the customfield, set as cart attribute, added to the product, but plgVmPrepareCartProduct is not triggered. Did I miss something?
My bad that was wrong function, it was for the cart, it will modify the price of the product in the cart.
You need a hidden field
what do you have for this? function plgVmOnDisplayProductFEVM3
// Product Page Display
// is hidden field ONLY in the form and not the custom Params
function plgVmOnDisplayProductFEVM3(&$product,&$group) {
if ($group->custom_element != $this->_name) return '';
$group->display = '<input type="hidden" name="customProductData['.$product->virtuemart_product_id.']['.$group->virtuemart_custom_id.']['.$group->virtuemart_customfield_id.'][hidden]" value="1" />';
return true;
}