I am new to virtuemart and I am trying to find out documentation for how routing works in VM.
I understand that for adding a product to cart, I can just use a URL of the form:
/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2004
The view parameter in the above url makes the user go to the cart page.
I would like to know what are the possible values for this parameter in general, and specifically, what value to pass so that the same page is reloaded (and the cart is updated)?
Could someone please point me in the right direction?
thank you!
I found a solution. I updated function add() at line 242 of components/com_virtuemart/controllers/cart.php as follows:
1. Added a new parameter to the url named vpath at the beginning.
$vpath = $input->get('vpath', 'xxx', 'string');
and after line 268:
Changed:
$mainframe->enqueueMessage($msg, $type);
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE));
to
$mainframe->enqueueMessage($msg, $type);
if($vpath == 'home'){
$mainframe->redirect('index.php');
}
else if($vpath == 'rfr'){
$mainframe->redirect($_SERVER['HTTP_REFERER']);
}
else $mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE));
FWIW.