Hi all.
I am using Virtuemart 2.0.20b fresh install with the standard template and with Joomla! 2.5.11
I have developed a plugin, working and tested by a friend in a real life shop, now:
1) I would like to submit an enhance to the code because the returning state from pluging it seems like to be unclear; I have tried to download the source from svn to propose a patch but it gives me this error:
svn: REPORT of '/svn/virtuemart/!svn/vcc/default': Could not read chunk delimiter: Secure connection truncated (https://dev.virtuemart.net)
2) I would like to add a hook to plugins in cart for the remove action, same issue as previous point.
Thank you for your assistance
http://dev.virtuemart.net/projects/virtuemart/wiki/Setting_up_a_Development_Environment
Explain EXACT what you want, there are already 150 triggers. You wanna add here and there a trigger calling a process which is using a lot triggers already. Please explain very closely and create a svn patch so that I can diff your suggested changes.
I think he means for his plugin
http://www.wumen.biz/software/virtuemart-plugin-locking-products/
His plugin changes stock as soon as a product is added to cart & goes back in stock when its deleted from cart.
I think thats already working for 2.1 right?
Hi all,
The solution I have developed is working for the 2.0.20b version, I have checked out and modified the trunk repository in my own local copy (a lot fo disconnection downloading, outputing the error I have mentioned in the previous post); in branches I can not find any 2.1 version, please PRO, where I can find this source?
I refer to the cart.php helper (components/com_virtuemart/helpers/cart.php), at line 454 in trunk I see this function:
function removeProductCart
----
/**
* 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]);
$this->setCartIntoSession();
return true;
}
----
this function has got no hook for plugins, as far as can see, while the previous function "add" has, at least in the 2.0.20b , in the trunk the hook in addToCart commented up (new system for hooking plugins?)
Here is the patch but maybe I am late, because development is gone further, but if this is true, where I can find updated sources and informations to not bore the forum with my questions and proposal?
------------------ cut here ------------------
Index: virtuemart/components/com_virtuemart/helpers/cart.php
===================================================================
--- virtuemart/components/com_virtuemart/helpers/cart.php (revision 6940)
+++ virtuemart/components/com_virtuemart/helpers/cart.php (working copy)
@@ -456,6 +456,11 @@
if (empty($prod_id))
$prod_id = JRequest::getInt('cart_virtuemart_product_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(&$prod_id));
unset($this->cartProductsData[$prod_id]);
$this->setCartIntoSession();
------------------ cut here ------------------
Thank you for your help in advance,
Best regards!
For 2.0.21 series see http://forum.virtuemart.net/index.php?topic=115877.0
Trigger is added. But why the $prod_id as "linked"?
Hi,
am using this plgVmOnRemoveFromCart trigger in a plugin but as written never seems to fire.
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]);
}
the if(isset($this->cartProductsData[$prod_id])){
is always empty on my install...
works fine if I comment this out...
what is $this->cartProductsData[$prod_id]?
Cheers