Hi,
Description:
After pressing the "Add to Cart" - button,
the notice about "Product successfully added" is shown twice.
Solution:
In file /components/com_virtuemart/controllers/cart.php the message is queued twice within the function add():
I think this is only a typo after adding some stuff, and I removed the line 78
Before:
/**
* Add the product to the cart
*
* @author RolandD
* @author Max Milbers
* @access public
*/
public function add() {
$mainframe = JFactory::getApplication();
if (VmConfig::get('use_as_catalog', 0)) {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_NOT_ADDED_SUCCESSFULLY');
$type = 'error';
$mainframe->redirect('index.php', $msg, $type);
}
$cart = VirtueMartCart::getCart();
if ($cart) {
$virtuemart_product_ids = JRequest::getVar('virtuemart_product_id', array(), 'default', 'array');
$success = true;
if ($cart->add($virtuemart_product_ids,$success)) {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_ADDED_SUCCESSFULLY');
$mainframe->enqueueMessage($msg);
$type = '';
} else {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_NOT_ADDED_SUCCESSFULLY');
$type = 'error';
}
// if (JRequest::getWord('format','') =='raw' ) {
// JRequest::setVar('layout','minicart','POST');
// $this->cart();
// //$view->display();
// return ;
// } else {
$mainframe->enqueueMessage($msg, $type);
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'));
// }
} else {
$mainframe->enqueueMessage('Cart does not exist?', 'error');
}
}
I removed one line (78) to:
/**
* Add the product to the cart
*
* @author RolandD
* @author Max Milbers
* @access public
*/
public function add() {
$mainframe = JFactory::getApplication();
if (VmConfig::get('use_as_catalog', 0)) {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_NOT_ADDED_SUCCESSFULLY');
$type = 'error';
$mainframe->redirect('index.php', $msg, $type);
}
$cart = VirtueMartCart::getCart();
if ($cart) {
$virtuemart_product_ids = JRequest::getVar('virtuemart_product_id', array(), 'default', 'array');
$success = true;
if ($cart->add($virtuemart_product_ids,$success)) {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_ADDED_SUCCESSFULLY');
// $mainframe->enqueueMessage($msg); //not needed, it's queued 12 lines below :-) TK
$type = '';
} else {
$msg = JText::_('COM_VIRTUEMART_PRODUCT_NOT_ADDED_SUCCESSFULLY');
$type = 'error';
}
// if (JRequest::getWord('format','') =='raw' ) {
// JRequest::setVar('layout','minicart','POST');
// $this->cart();
// //$view->display();
// return ;
// } else {
$mainframe->enqueueMessage($msg, $type);
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'));
// }
} else {
$mainframe->enqueueMessage('Cart does not exist?', 'error');
}
}
VM 2.0.6 , last cvs download
Best regards
Thomas Kuschel
[attachment cleanup by admin]
thx
thank you !
Thank you :). Saved me quite a bit of time digging through the VM code base :).
thanks from me too
THX!!
Thank you very much , it is no working! :) Virtuemart 2.0.6 / Joomla 2.5.4
;D
Quoteit is no working!
I hope, it is no(w) working, and not: no(t) working...
Thomas
Could I comment both messages out completely? It doesn't look very nice on my current site that I get a big message at the top that says the product has been added...
Just asking as I am not sure if that would break anything allong the line, I'm still relatively new to Virtuemart so not sure what the impact could be, if any.
Quote from: quintonv on June 18, 2012, 14:52:25 PM
Could I comment both messages out completely? It doesn't look very nice on my current site that I get a big message at the top that says the product has been added...
Just asking as I am not sure if that would break anything allong the line, I'm still relatively new to Virtuemart so not sure what the impact could be, if any.
I did it and had no problem at all.
Thanks a lot, it worked!
Has anyone filed this as a bug so that this is fixed in the next release?
re jbenes:
yes, Milbo has already fixed this at repository version...
Thomas
Quote from: Thomas Kuschel on June 22, 2012, 08:54:52 AM
re jbenes:
yes, Milbo has already fixed this at repository version...
Thomas
Any idea when that would be publicly available? I'f I don't have to edit code I might wait. If I do patch the code will the new version completely replace the file?
It is in the 2.0.7 J version
Hi all,
I am new here!. I have used virtuemart in my site to purchase the and add the products to the cart, I have created a custom component to display some final steps after "view cart" in virtuemart. skipped the billing information because the site uses cash on payment method. I have checked the the code . the check out is perform in the cart helper file cart.php. How can i include this file to and call confirmDone() function to force checkout. from joomla custom component model or view . please reply ,
How can i create a faq in virtue mart form ., thats why i commented on this post
thanks
http://dev.virtuemart.net/projects/virtuemart/wiki/Developing_a_module_or_plugin_for_VirtueMart_2