How to add this lanuage code into my code

Hello,

currently I have the code below, the words ‘See descrpition’ and ‘New’ are internal, within the code (in red)

I would like the code to read the words from the Language .php file

<OPTION VALUE=“0” SELECTED>See description</OPTION>
<OPTION VALUE=“1” <? echo ($item_details[‘item_condition’]==1) ? ‘selected’ : ‘’; ?>>New</OPTION>

here is how my Language.php file looks like

define (‘MSG_ITEM_SEE_DESCRIPTION’, ‘See description’);
define (‘MSG_ITEM_NEW’, ‘New’);

how do I code this ? like this ?

<OPTION VALUE=“0” SELECTED><?=MSG_ITEM_SEE_DESCRIPTION;?></OPTION>

all help appreciated :slight_smile:

Can anyone help please? :slight_smile:

Hi,
Try this:

<?php
echo '<OPTION VALUE="0" SELECTED>'. MSG_ITEM_SEE_DESCRIPTION. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_NEW. '</OPTION>';
?>

Hello Marplo

many thank you’s :slight_smile:

ok I changed my code to this:

<tr class="c1">
<td width="150" align="right">'. MSG_ITEM_CONDITION. '</td>
<td> <SELECT NAME="item_condition">
echo '<OPTION VALUE="0" SELECTED>'. MSG_ITEM_CHOOSE_CONDITION. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_NEW. '</OPTION>';
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_VERY_GOOD. '</OPTION>';
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_GOOD. '</OPTION>';
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_AVERAGE. '</OPTION>';
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_POOR. '</OPTION>';
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_DEFECTIVE. '</OPTION>';
</SELECT></td>
</tr>

and in Languages.php I added this:

define ('MSG_ITEM_CONDITION', 'Condition');
define ('MSG_ITEM_CHOOSE_CONDITION', 'Choose Condition');
define ('MSG_ITEM_NEW', 'New');
define ('MSG_ITEM_VERY_GOOD', 'Very Good');
define ('MSG_ITEM_GOOD', 'Good');
define ('MSG_ITEM_AVERAGE', 'Average');
define ('MSG_ITEM_POOR', 'Poor');
define ('MSG_ITEM_DEFECTIVE', 'Defective');

It half works! the code shows on the website page,

But! the words showing on the webpage are “MSG_ITEM_CONDITION” and not “Condition”

so it is not reading/detecting the words from the Language.php

help appreciated :slight_smile:

Hi
It shows the nme of the constant, and not its value because it isn’n in echo.
Try this:

<?php
echo '<tr class="c1">
<td width="150" align="right">'. MSG_ITEM_CONDITION. '</td>
<td> <SELECT NAME="item_condition">
<OPTION VALUE="0" SELECTED>'. MSG_ITEM_CHOOSE_CONDITION. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_NEW. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_VERY_GOOD. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_GOOD. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_AVERAGE. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_POOR. '</OPTION>
<OPTION VALUE="1"'. (($item_details['item_condition']==1) ? 'selected' : ''). ' >'. MSG_ITEM_DEFECTIVE. '</OPTION>
</SELECT></td>
</tr>';
?>

anyone help please

MarPlo thank you :slight_smile: working perfectly now :slight_smile:

there is a 2nd part of that code, 1st part was the Selection, 2nd part is the information shown on the webpage.

<tr class="c1">
            <td><b>Condition</b></td>
            <td>
            <? if ($item_details['item_condition']==0)   { ?>Choose Condition<? } 
            else if ($item_details['item_condition']==1) { ?>New<?} 
            else if ($item_details['item_condition']==2) { ?>Very Good<? } 
            else if ($item_details['item_condition']==3) { ?>Good<? } 
            else if ($item_details['item_condition']==4) { ?>Average<? } 
            else if ($item_details['item_condition']==5) { ?>Poor<? } 
            else if ($item_details['item_condition']==6) { ?>Defective<? } ?></td>
            </tr>

are these the correct code changes below?

 <?php
             echo '<tr class="c1">
            <td><b>'. MSG_ITEM_CONDITION. '</b></td>
            <td>
            <? if ($item_details['item_condition']==0) { '. MSG_ITEM_CHOOSE_CONDITION. ' } 
            else if ($item_details['item_condition']==1) { '. MSG_ITEM_NEW. ' } 
            else if ($item_details['item_condition']==2) { '. MSG_ITEM_VERY_GOOD. ' } 
            else if ($item_details['item_condition']==3) { '. MSG_ITEM_GOOD. '} 
            else if ($item_details['item_condition']==4) { '. MSG_ITEM_AVERAGE. ' } 
            else if ($item_details['item_condition']==5) { '. MSG_ITEM_POOR. ' } 
            else if ($item_details['item_condition']==6) { '. MSG_ITEM_DEFECTIVE. '></td>
            </tr>
            ?>

I don’t know.
Test yourself, and see what you get, modify where you think that it’s needed, and so on, till you get what you need.

Hmmm ok :slight_smile: your help greatly appreciated, thank you :slight_smile:

Hello,

I have been attempting to get this code below correct, yet I am lost!

help appreciated :slight_smile:

<?php
  echo '<tr class="c1">
 <td><b>'. MSG_ITEM_CONDITION. '</b></td>
 <td>
 <? if ($item_details['item_condition']==0) { '. MSG_ITEM_CHOOSE_CONDITION. ' }
    else if ($item_details['item_condition']==1) { '. MSG_ITEM_NEW. ' }
    else if ($item_details['item_condition']==2) { '. MSG_ITEM_VERY_GOOD. ' }
    else if ($item_details['item_condition']==3) { '. MSG_ITEM_GOOD. '}
    else if ($item_details['item_condition']==4) { '. MSG_ITEM_AVERAGE. ' }
    else if ($item_details['item_condition']==5) { '. MSG_ITEM_POOR. ' }
    else if ($item_details['item_condition']==6) { '. MSG_ITEM_DEFECTIVE. '></td>
    </tr>';
    ?>

Help please :slight_smile: