CalcBuilder Forum

can I use _name from sql option list?

User moon_1855 2014-11-13 22:23:51

I have created a multi option list using an sql query and successfully used the value in a calculation for price of my product
I would like to use the option key or name in the description and as far as I can tell from the Quick Guide this should be available as $myvar_name however this is does not produce anything?

Is the _name functionality available for an sql generated list?

Many Thanks
Simon

Moonsoft support 2014-11-14 09:41:30

Hello,

Option List from sql query is a special feature of option list, and _name suffix is not available. You should get value as $myvar. You could write a query in code to get other value from your table, like this:

$db =JFactory::getDBO();
$query="select OTHER_VALUE from #__MYTABLE where ID=".$myvar;
$db->setQuery($query);
$result=$db->loadResult();
$newvalue=$result->OTHER_VALUE;

Regards,

Edited by MSTeam - 14.11.2014 09:46

User moon_1855 2014-11-17 21:36:28

OK - I already have the query obviously from making the list.
thanks
Simon

...
CalcBuilder

Create dynamic calculators

Buy now!
...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!