Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Variable passing to PDF, email and Excel 22.12.2011 18:38

I am trying to include some text with some ROI calculators to explain to the user how the calculationis done. As I cannot include text in the Calc Builder itself, I've added some PHP to the pdf creation module but I'd like to have different calculators use different explanatory text. Can I pass a variable from the calculation entry area to the pdf, Excel and email creation modules?
Thanx.

Re: Variable passing to PDF, email and Excel 22.12.2011 19:57

Hello,

One quick solution maybe including in 'code' of each calculator a variable stored at user session. Then in PDF, email and csv you can get it from session again.

Hope this helps,

Moonsoft Team
Moonsoft Team
www.moonsoft.es

Re: Variable passing to PDF, email and Excel 23.12.2011 13:39

Okay - so if I include (for example)
$CommentCode = 'MAIN';
in the same place as my calculation code, and then in the pdf.php file include
if ($commentCode=='MAIN){ etc.
I should be able to make the switch? This is what I have tried, and the variable value does appear to be available in the pdf.php file. Is there a variable scope issue I need to deal with? Or is the variable in the calculation area included in another entity that I need to access (for example, $bob.calc.CommentCode)?
Thanx.

Re: Variable passing to PDF, email and Excel 23.12.2011 17:14

Hello,
yes, when handling variables through different server requests, you need to store the values in a persistent way, using 'session' variables. In Jjoomla session is supposed to work this way:

Store value:

$session =& JFactory::getSession();
$session->set('name', "value");

Now you can retrieve this session variable using:

$session =& JFactory::getSession();
$myvar= $session->get('name');



Hope this helps, best regards
Moonsoft Team
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback