News:

Looking for documentation? Take a look on our wiki

Main Menu

Coupon discount appears only after refresh of the page

Started by isuv, April 11, 2013, 21:36:56 PM

Previous topic - Next topic

isuv

I have Joomla 2.5.9 and VM 2.0.16. I am using a coupon for our clients could get discount while ordering goods through the shopping cart at our website. The situation is like this: visitor goes to his cart, enters coupon code, there appears a notification of successfully added coupon discount, but no changes can be seen in the prices. The sum to be paid remains the same as before coupon activation till a visitor refreshes the page in browser or till he begins to order (in case he begins to order after filling registration form he returnes to the cart with renewed pricing). This situation is confusing for a customer, because when he sees, that there is no discount, he may become dissappointed and just leave the website. How can I do so, that dicount appeared just after coupon activation without page refreshing?

isuv

Do anybody knows, if One Page Checkout solves this? As far as I understand, there are several One Page Checkout solutions http://www.cmsmart.net/our-blog/item/2-one-page-check-out-for-virtuemart-2 . Which one is suitable?

isuv

I also tested this on a test installation, beez5 and sample data - no such mistake! That means, that our template or some other adjusments causes this situation. If anyone struggled against this successfully, your advice will be highly appreciated.

aspero81

I have just had the same issue. I solved it by adding a line of code to setcoupon() function located in

/components/com_virtuemart/controllers/cart.php


around line 200:

$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'));

So it looks like this:


if ($cart) {
$msg = $cart->setCouponCode($coupon_code);
if (!empty($msg)) {
$mainframe->enqueueMessage($msg, 'message');
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'));
}
// $cart->setDataValidation(); //Not needed already done in the getCart function
if ($cart->getInCheckOut()) {
$mainframe = JFactory::getApplication();
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout'));
}
}


Maybe it's not very nice - it forces additional refresh, but it works.

Bartek.