Could you please tell me if there a proper way to include a custom php function in VM2 without modifying files in Controllers folder? VM 1 had a Security tab in config where we could add some extra functionality. To be precise, I'd like to modify some minicart functionality, so I don't want to modify core cart.php
Thank you.
take the cart module
make a copy, make your own module out of it, just rename the xml and change one line, then it is already your module. http://docs.joomla.org/Creating_a_simple_module
Thank you, Milbo for your reply. But you misunderstood me or I wasn't clear enough what exactly I want to do. I need to add some extra functionality to com_virtuemart/controllers/cart.php and com_virtuemart/helpers/cart.php, such as the functions, which delete all items from cart by clicking the button from minicart. This requires to add extra functions like:
public function deleteCart() {
$mainframe = JFactory::getApplication();
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
$mainframe->enqueueMessage(JText::_('CARTFLUSHED'));
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'));
}
In order to do that I need to extend VirtueMartControllerCart class. I found a work around on this by using Override MVC plugin, it allows overriding controllers and views (but not helpers).
The VM's function emptyCart() which is in com_virtuemart/helpers/cart.php does not return a boolean value I need to make ajax-minicart working properly.
The write a plugin http://dev.virtuemart.net/projects/virtuemart/wiki/Developing_a_module_or_plugin_for_VirtueMart_2