How to determine which language the user is viewing for a static link?

Started by be, November 14, 2012, 14:49:43 PM

Previous topic - Next topic

be

Hi,
I have in my override of the file "productdetails/default.php" a static link to an contactform.
Now my site is multilanguage and I need an if-dedection for this link.
I wrote this:

<?php
$app 
JFactory::getApplication(); 
$menu $app->getMenu();
?>

<?php 
//MY EDIT STARTS HERE
//make a database connection and find the field record that contains the customfield string
$db JFactory::getDBO();
//please do check in php myadmin how your database table is called and replace it instead of "VM2_virtuemart_product_customfields" replace the "6" with your ID of Custom field you want to outpu
$db->setQuery("SELECT custom_value FROM #__virtuemart_product_customfields WHERE virtuemart_product_id=".$this->product->virtuemart_product_id." and virtuemart_custom_id=6 ;");  
$db->query();
$resultisbn $db->loadResult();
 
if (
$menu->getActive() == $menu->getDefault'de-DE' )) { 
echo 
'
<form id="isbn" method="post" action="index.php?option=com_content&view=article&layout=aka-template:article-banner&id=22&Itemid=242">
<input type="hidden" name="isbn" value="'
$resultisbn .'" />
<button type="submit" class="btn" style="float: right;" name="bestellformular" value="Bestellformular" >'
JText::_('COM_VIRTUEMART_CART_ADD_TO') .'</button>
</form>
'


elseif (
$menu->getActive() == $menu->getDefault'gb-GB' )) { 
echo 
'
<form id="isbn" method="post" action="index.php?option=com_content&view=article&layout=aka-template:article-banner&id=24&Itemid=107">
<input type="hidden" name="isbn" value="'
$resultisbn .'" />
<button type="submit" class="btn" style="float: right;" name="bestellformular" value="Bestellformular" >'
JText::_('COM_VIRTUEMART_CART_ADD_TO') .'</button>
</form>
'


?>



I found this in this  documentation: http://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page

My problem now is that the form-construct will not be displayed in the productdetailsite on my webpage. Where is my failure?

BR