Hi,
2.0.24 using the plgVmOnRemoveFromCart trigger in a plugin.
The only way I can get it to work is by removing the conditional if(isset($this->cartProductsData[$prod_id])){
removing this it works fine..
full code snippet from components/com_virtuemart/helpers/cart.php ~ line 563
/**
* Remove a product from the cart
*
* @author RolandD
* @param array $cart_id the cart IDs to remove from the cart
* @access public
*/
public function removeProductCart($prod_id=0) {
// Check for cart IDs
if (empty($prod_id))
$prod_id = JRequest::getVar('cart_virtuemart_product_id');
unset($this->products[$prod_id]);
if(isset($this->cartProductsData[$prod_id])){
// hook for plugin action "remove from cart"
if(!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS.DS.'vmcustomplugin.php');
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$addToCartReturnValues = $dispatcher->trigger('plgVmOnRemoveFromCart',array($this,$prod_id));
unset($this->cartProductsData[$prod_id]);
}
$this->setCartIntoSession();
return true;
}
all tests I try $this->cartProductsData[$prod_id]) is always empty or not set
what is this supposed to be? Searching the whole VM files I can only find it in this function....
Thanks
It is testing if the product has some custom data and gets only active then.
Seems that you want to use it in general. Then the only solution is to remove it. Or you manipulate your product, adding to the cart. So that it has data there. Hmmm.