VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: cleoni on January 27, 2015, 11:07:20 AM

Title: How to display a message after app->redirect
Post by: cleoni on January 27, 2015, 11:07:20 AM
Hello,
I am using VM 2.6 and I am stuck in this problem:

When at the Cart, after coupon code validation, the validating routine returns null string in case coupon code is OK, and a message if coupon was not valid.

The problem that I have now is that this message is not displayed to the user.

At a certain point execution flows at components/com_virtuemart/controllers/cart.php line 231 where I have the validation message in variable $msg

then runs this code

if ($cart->getInCheckOut()) {
$app = JFactory::getApplication();
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=checkout', FALSE),$msg);
} else {
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart', FALSE),$msg);
}


I can see here the $app->redirect sends somehow the $msg variable to the cart page, but my question is: how do I read it (session, $POST/$GET, shared vars..)?

I am using a buyed template which is somehow overriding the original code so, it must be buggy in the sense that messages caught from the coupon validator are not actually displayed (most likely ANY messages are just ignored and never printed)

Any ideas?
Title: Re: How to display a message after app->redirect
Post by: GJC Web Design on January 27, 2015, 15:47:03 PM
do any standard messages show in your template?  i.e. is <jdoc:include type="message" /> there ?
Title: Re: How to display a message after app->redirect
Post by: cleoni on January 27, 2015, 16:38:00 PM
As long as I can see from a recursive search on the entire site, in my template this

jdoc:include

is used just for defining module positions.

Inserting the code

<jdoc:include type="message" />

no message pops up.

You see, it's still unclear to me after this $arr->redirect where this $msg variable is stored or used.
Title: Re: How to display a message after app->redirect
Post by: GJC Web Design on January 27, 2015, 16:44:45 PM
<jdoc:include type="message" /> is for showing system messages in all Joomla

$app->redirect(LINK,MSG)  is a standard joomla method to display messages in the std. Joomla messaging

nothing more needs to be done

you still haven't answered-> do any standard messages (from VM or any where - try the contact page) show in your template?