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

plgVmOnRemoveFromCart trigger not triggering

Started by GJC Web Design, October 21, 2013, 22:45:32 PM

Previous topic - Next topic

GJC Web Design

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

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/