How to add this code to this code?

Thanks for the huge list of programs. Luckily I did not have to look at each one of them.

Armed with the list, now I have the resources to hunt it down, and it is not in the user list but it the item as I was expected. However, it is not in functions_item.php, which was how the page was set up, but in the class_item.php. And there you will get the location, if the state code is in the database.

So here are the changes needed to add the location to your mainpage:

add this line in index.php (just above includes/functions_item.php):
include_once (‘includes/class_item.php’);

add this line in mainpage.tpl.php (below $tax = new tax())
$item = new item();

now wherever you need the location you add this line or something similar:
<?=MSG_LOCATION;?>: <? echo $item->item_location($item_details[$counter]) ;?><br>

Note: leave out $counter if it is a single row item.

Hello tom8, always good to hear from you :slight_smile:

ok all pasted into place, yet no location showing… yet :slight_smile:

please have a look www.trade-th.com

$counter = 0;
$tax = new tax();
$item = new item();
include_once ('includes/global.php');
include_once ('includes/functions_login.php');
include_once ('includes/class_item.php');
include_once ('includes/functions_item.php');
<tr>
 <td><b><b><?=MSG_COUNTRY;?>: </b> <? echo $tax->display_countries($item_details[$counter]['country']);?> <br>
       <b><?=MSG_LOCATION;?>: </b> <? echo $item->item_location($item_details[$counter]) ;?><br>
       <b><?=MSG_START_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['start_price'], $item_details[$counter]['currency']);?> <br>
        <b><?=MSG_CURRENT_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['max_bid'], $item_details[$counter]['currency']);?> <br>
         <b><?=MSG_ENDS;?>:</b> <? echo show_date($item_details[$counter]['end_time']); ?> </td>
                     </tr>

Hi tom8, remember we added code here: country

$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time, country’, $select_condition, $layout[‘hpfeat_max’]);

do we need to add: location

Update this line:
<b><?=MSG_LOCATION;?>: </b> <? echo $item->item_location($item_details[$counter]) ;?><br>

to this:
<b><?=MSG_LOCATION;?>: </b> <? echo "State: ".$item_details[$counter][‘state’]. " Location: ".$item->item_location($item_details[$counter]);?><br>

I want to see the value in state from the database.

Edit: don’t do anything yet! I didn’t see your last post when I posted this.

Ok, I think we got it. Add state after country like this:
$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time, country, state’, $select_condition, $layout[‘hpfeat_max’]);

There is no location in the item database. The location is from another database by using the state code.

Hi tom8,

ok change made,

Country: Thailand
Location: State: Location:
Start Bid: USD 20.00
Current Bid: -
Ends: Jun. 25, 2012 01:11:44

Hmmm, that’s no good. Somehow we are not picking up the state code.

Post the source code from mainpage.tpl.php again. Maybe you made some changes that I’m not aware of.

<?
#################################################################
## mainpage.tpl.php      					##
##-------------------------------------------------------------##
## Copyright &#65533;2012 All rights reserved.	                     ##
##-------------------------------------------------------------##
#################################################################

if ( !defined('INCLUDED') ) { die("Access Denied"); }
?>
<? if ($layout['hpfeat_nb']) { ?>
<?=$featured_auctions_header;?>

<table width="100%" border="0" cellpadding="0" cellspacing="3" >
   <?
	$counter = 0;
        $tax = new tax();
        $item = new item();
	for ($i=0; $i<$featured_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['hpfeat_nb']; $j++) {
			$width = 100/$layout['hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($item_details[$counter]['name'])) {
      		$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE
      			auction_id='" . $item_details[$counter]['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

      		$auction_link = process_link('auction_details', array('name' => $item_details[$counter]['name'], 'auction_id' => $item_details[$counter]['auction_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr height="<?=$layout['hpfeat_width']+12;?>">
                        <td align="center"><a href="<?=$auction_link;?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" alt="<?=$item_details[$counter]['name'];?>"></a></td>
                     </tr>
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($item_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                       <td><b><b><?=MSG_COUNTRY;?>: </b> <? echo $tax->display_countries($item_details[$counter]['country']);?> <br>
                           
<b><?=MSG_LOCATION;?>: </b> <? echo "State: ".$item_details[$counter]['state']. " Location: ".$item->item_location($item_details[$counter]);?><br>

                           
<b><?=MSG_START_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['start_price'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_CURRENT_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['max_bid'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($item_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
<? } ?>
<? if ($layout['r_hpfeat_nb'] && $setts['enable_reverse_auctions']) { ?>
<?=$featured_reverse_auctions_header;?>
<table width="100%" border="0" cellpadding="3" cellspacing="3" >
   <?
	$counter = 0;
	for ($i=0; $i<$featured_ra_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['r_hpfeat_nb']; $j++) {
			$width = 100/$layout['r_hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($ra_details[$counter]['name'])) {
      		$auction_link = process_link('reverse_details', array('name' => $ra_details[$counter]['name'], 'reverse_id' => $ra_details[$counter]['reverse_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($ra_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                       <td><?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <b><?=MSG_BUDGET;?>:</b> <? echo $feat_fees->budget_output($ra_details[$counter]['budget_id'], null, $ra_details[$counter]['currency']);?>  <br>
                           <b><?=MSG_NR_BIDS;?>:</b> <? echo $ra_details[$counter]['nb_bids'];?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($ra_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>         
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="5"></div>
<? } ?>
<div id="TabbedPanels1" class="TabbedPanels">
   <ul class="TabbedPanelsTabGroup">
      <? if ($layout['nb_recent_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_RECENTLY_LISTED_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_ENDING_SOON_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_POPULAR;?></a></li>
      <? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_WANTED_ADS;?></a></li>
      <? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?> 
		<li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_REVERSE_AUCTIONS;?></a></li>
		<? } ?>
   </ul>
   <div class="TabbedPanelsContentGroup" >
		<? if ($layout['nb_recent_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<? 
			$columns = 3;
			$nb_recent = $db->num_rows($sql_select_recent_items);
			for($i = 0; $i < $nb_recent; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';

				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border <?	if(CURRENT_TIME - $item_details['start_time'] <= 86400) { echo "today"; } ?>">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                           <?=MSG_START_BID;?>: <?=$fees->display_amount($item_details['start_price'], $item_details['currency']);?>
									<br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_recent) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'recent'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<? 
		   $columns = 3;
		   $nb_ending = $db->num_rows($sql_select_ending_items);
		   
			for($i = 0; $i < $nb_ending; $i++) 
			{
				$item_details = mysql_fetch_array($sql_select_ending_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

				$item_details['max_bid'] = ($item_details['max_bid'] > 0) ? $item_details['max_bid'] : $item_details['start_price'];
		
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class='border 
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 86400) && $item_details['auction_type'] != 'first_bidder') /* 1day = 86400 sec */ { echo "day"; }?> 
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 3600) && $item_details['auction_type'] != 'first_bidder') /* 1hour = 3600 sec */ { echo "hour"; }?>'>
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <?=MSG_TIME_LEFT;?>: <?=time_left($item_details['end_time']);?>
                           <br>
                           <?=MSG_CURRENTLY;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
            <? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_ending) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'ending'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<? 
		   $columns = 3;
		   $nb_popular = $db->num_rows($sql_select_popular_items);
		   
			for($i = 0; $i < $nb_popular; $i++) 
			{
				$item_details = mysql_fetch_array($sql_select_popular_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_MAX_BID;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_popular) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'popular'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<? 
		   $columns = 3;
		   $nb_wanted = $db->num_rows($sql_select_recent_wa);
		   
			for($i = 0; $i < $nb_wanted; $i++) 
			{
				$item_details = mysql_fetch_array($sql_select_recent_wa);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE wanted_ad_id='" . $item_details['wanted_ad_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_wanted) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('wanted_ads');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?> 
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<? 
		   $columns = 3;
		   $nb_reverse = $db->num_rows($sql_select_recent_reverse);
		   
			for($i = 0; $i < $nb_reverse; $i++) 
			{
				$item_details = mysql_fetch_array($sql_select_recent_reverse);
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center">
                           <div class="c1feat"><a href="<?=process_link('reverse_details', array('name' => $item_details['name'], 'reverse_id' => $item_details['reverse_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?><br>
                           <?=MSG_BUDGET;?>: <? echo $feat_fees->budget_output($item_details['budget_id'], null, $item_details['currency']);?>  <br>
                           <?=MSG_NR_BIDS;?>: <? echo $item_details['nb_bids'];?> <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_reverse) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('reverse_auctions');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
   </div>
</div>
</td>
<td width="10"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="10" height="1"></td>
<td><? if ($is_news && $layout['d_news_box']) { ?>
   <?=$news_box_header;?>
   <?=$news_box_content;?>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <? if ($is_announcements && $member_active == 'Active') { ?>
   <?=$announcements_box_header;?>
   <div id="exp1102170555">
      <?=$announcements_box_content;?>
   </div>
   <div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
   <? } ?>
   <noscript>
   <?=MSG_JS_NOT_SUPPORTED;?>
   </noscript>
   <? if ($setts['enable_header_counter']) { ?>
   <?=$header_site_status;?>
   <table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_site_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_REGISTERED_USERS;?></td>
      </tr>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_live_auctions;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_AUCTIONS;?></td>
      </tr>
      <? if ($setts['enable_wanted_ads']) { ?>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_live_wanted_ads;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_WANT_ADS;?></td>
      </tr>
      <? } ?>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_online_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_ONLINE_USERS;?></td>
      </tr>
   </table>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <?=$banner_position[3];?>
   <?=$banner_position[4];?>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="170" height="1"></div>

On line 48 - $item_details[$counter][‘city’], should be $item_details[$counter][‘state’]

I would like to run a test. Insert this at line 25 (below if (!empty($item_details…)
echo “<pre>item_details - $counter”;print_R($item_details[$counter]);exit;

Let me know what you got. I hope your site is under construction :smiley:

Hi tom8, ok added the line: echo “<pre>item_details - $counter”;print_R($item_details[$counter]);exit;

results was:

item_details - 0Array
(
[0] => 100025
[auction_id] => 100025
[1] => 100th Anniversary of Panyananda Bhikkhu Commemorative Stamps
[name] => 100th Anniversary of Panyananda Bhikkhu Commemorative Stamps
[2] => 10.00
[start_price] => 10.00
[3] => 0.00
[max_bid] => 0.00
[4] => USD
[currency] => USD
[5] => 1339689264
[end_time] => 1339689264
[6] => 2070
[country] => 2070
)

With all the changes we are making, I think you have overlooked this one:
$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time, country, state’, $select_condition, $layout[‘hpfeat_max’]);

That is in line 23 in mainpage.php

Make sure to remove that line for testing. Before you do that, run the test again and see what you got for the state.

Hello tom8, thank you :slight_smile:

yes added “state” and all is working well :slight_smile:

these are the code lines I have in place:

<? echo $item_details['state']."".$item->item_location($item_details[$counter]);?><br>
$item_details = $db->random_rows('auctions', 'auction_id, name, start_price, max_bid, currency, end_time, country, state', $select_condition, $layout['hpfeat_max']);
$template->set('item_details', $item_details);

if you look at my Homepage you will see I have a mystery comma :slight_smile:

, Central Region - Bangkok

A zip_code should be there so we need to add that into the [FONT=Courier New]$item_details:

$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time, country, state, zip_code’, $select_condition, $layout[‘hpfeat_max’]);
$template->set(‘item_details’, $item_details); [/FONT]

BTW, you don’t need $item_details[‘state’] so remove it:

<? echo $item->item_location($item_details[$counter]);?><br>

Also, if you don’t want the zip_code you could update the above line to this:

<? echo $item->item_location($item_details[$counter],false);?><br>

Good evening tom8, good to hear from you :slight_smile:

no need for a zip code, but thank you, I am a bit limited on room-line length :slight_smile:

so just Country and State is perfect :slight_smile:

but that comma, how to remove? ,

I knew you are going to ask me that so I have already updated my last post :smiley:

Here is it again:
<? echo $item->item_location($item_details[$counter],false);?><br>

It’s that time of the evening again so anything you have for me I’ll take care of them in the morning…

Hi tom8, ok all done thank you many time thank you :slight_smile:

now just when I thought I was understanding your coding changes, then you put in the code:

<? echo $item->item_location($item_details[$counter],false);?><br>

that has not mention of “state”

so how doe sit display the “state” info ? :slight_smile:

Hi tom8, a small problem :slight_smile:

the code works perfect for the Featured Item, yet when placed into Recently Listed or Ending Soon or Wanted Ads, it does not show the “state”

I am referring to the mainpage.tpl.ph

<?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
<? echo $item->item_location($item_details[$counter],false);?><br>  ( no state displayed )


Yes displayed:

<tr>
<td><b><?=MSG_LOCATION;?>: </b> <? echo $tax->display_countries($item_details[$counter]['country']);?> <br>
<? echo $item->item_location($item_details[$counter],false);?><br>
<b><?=MSG_START_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['start_price'], $item_details[$counter]['currency']);?> <br>
<b><?=MSG_CURRENT_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['max_bid'], $item_details[$counter]['currency']);?> <br>
<b><?=MSG_ENDS;?>:</b> <? echo show_date($item_details[$counter]['end_time']); ?> </td>
</tr>


No display of “state”

<br>
<?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
<? echo $item->item_location($item_details[$counter],false);?><br>
<?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
<br>
<?=MSG_START_BID;?>: <?=$fees->display_amount($item_details['start_price'], $item_details['currency']);?>
<br>

Please post your latest mainpage.tpl.php. I don’t think that how you show the Recently Listed/Ending Soon/Wanted Ads.

This probably not right:

<br>
<?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details[‘country’]);?><br>
<? echo $item->item_location($item_details[$counter],false);?><br>
<?=GMSG_START_TIME;?>: <?=show_date($item_details[‘start_time’]);?>
<br>
<?=MSG_START_BID;?>: <?=$fees->display_amount($item_details[‘start_price’], $item_details[‘currency’]);?>
<br>

You get the state info is by using state code to look up the state name in the item_location() function and the location is returned along with the zip_code. You do all this by simply passing $item_details to item_location().

Optionally you can specify not to include the zip_code by passing a FALSE argument.

Here is the source code:


   function item_location ($item_details, $show_zip = true)
   {
	   (string) $display_output = null;
	   $state_name = $item_details['state'];
	   if ($item_details['state'] > 0)
	   {
		   $state_name = $this->get_sql_field("SELECT name FROM " . DB_PREFIX . "countries WHERE
				id='" . $item_details['state'] . "'", 'name', '-');
	   }
	   if ($show_zip)
	   {
		   $display_output = (!empty($state_name)) ?  $item_details['zip_code'] . ', ' . $state_name : $item_details['zip_code'];
	   }
	   else 
	   {
		   $display_output = $state_name;
	   }
	   return $display_output;
   }

Hello Tom8, thank you for those informative replies, I am learning … slowly … lol

ok the mainpage.tpl.php

<?
#################################################################
## mainpage.tpl.php      					##
##-------------------------------------------------------------##
## Copyright &#65533;2012 All rights reserved.	                     ##
##-------------------------------------------------------------##
#################################################################

if ( !defined('INCLUDED') ) { die("Access Denied"); }
?>
<? if ($layout['hpfeat_nb']) { ?>
<?=$featured_auctions_header;?>

<table width="100%" border="0" cellpadding="0" cellspacing="3" >
   <?
	$counter = 0;
        $tax = new tax();
        $item = new item();
	for ($i=0; $i<$featured_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['hpfeat_nb']; $j++) {
			$width = 100/$layout['hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($item_details[$counter]['name'])) {
      		$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE
      			auction_id='" . $item_details[$counter]['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

      		$auction_link = process_link('auction_details', array('name' => $item_details[$counter]['name'], 'auction_id' => $item_details[$counter]['auction_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr height="<?=$layout['hpfeat_width']+12;?>">
                        <td align="center"><a href="<?=$auction_link;?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" alt="<?=$item_details[$counter]['name'];?>"></a></td>
                     </tr>
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($item_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                       <td><b><?=MSG_LOCATION;?>: </b> <? echo $tax->display_countries($item_details[$counter]['country']);?> <br>
                           <? echo $item->item_location($item_details[$counter],false);?><br>
                           <b><?=MSG_START_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['start_price'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_CURRENT_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['max_bid'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($item_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
<? } ?>
<? if ($layout['r_hpfeat_nb'] && $setts['enable_reverse_auctions']) { ?>
<?=$featured_reverse_auctions_header;?>
<table width="100%" border="0" cellpadding="3" cellspacing="3" >
   <?
	$counter = 0;
	for ($i=0; $i<$featured_ra_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['r_hpfeat_nb']; $j++) {
			$width = 100/$layout['r_hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($ra_details[$counter]['name'])) {
      		$auction_link = process_link('reverse_details', array('name' => $ra_details[$counter]['name'], 'reverse_id' => $ra_details[$counter]['reverse_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($ra_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <? echo $item->item_location($item_details[$counter],false);?><br>
                           <b><?=MSG_BUDGET;?>:</b> <? echo $feat_fees->budget_output($ra_details[$counter]['budget_id'], null, $ra_details[$counter]['currency']);?>  <br>
                           <b><?=MSG_NR_BIDS;?>:</b> <? echo $ra_details[$counter]['nb_bids'];?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($ra_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="5"></div>
<? } ?>
<div id="TabbedPanels1" class="TabbedPanels">
   <ul class="TabbedPanelsTabGroup">
      <? if ($layout['nb_recent_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_RECENTLY_LISTED_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_ENDING_SOON_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_POPULAR;?></a></li>
      <? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_WANTED_ADS;?></a></li>
      <? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?>
		<li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_REVERSE_AUCTIONS;?></a></li>
		<? } ?>
   </ul>
   <div class="TabbedPanelsContentGroup" >
		<? if ($layout['nb_recent_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
			$columns = 3;
			$nb_recent = $db->num_rows($sql_select_recent_items);
			for($i = 0; $i < $nb_recent; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';

				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border <?	if(CURRENT_TIME - $item_details['start_time'] <= 86400) { echo "today"; } ?>">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>

                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                           <?=MSG_START_BID;?>: <?=$fees->display_amount($item_details['start_price'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_recent) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'recent'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_ending = $db->num_rows($sql_select_ending_items);
		
			for($i = 0; $i < $nb_ending; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_ending_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

				$item_details['max_bid'] = ($item_details['max_bid'] > 0) ? $item_details['max_bid'] : $item_details['start_price'];
		
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class='border
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 86400) && $item_details['auction_type'] != 'first_bidder') /* 1day = 86400 sec */ { echo "day"; }?>
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 3600) && $item_details['auction_type'] != 'first_bidder') /* 1hour = 3600 sec */ { echo "hour"; }?>'>
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <? echo $item->item_location($item_details[$counter], false);?><br>
                           <?=MSG_TIME_LEFT;?>: <?=time_left($item_details['end_time']);?>
                           <br>
                           <?=MSG_CURRENTLY;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
            <? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_ending) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'ending'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_popular = $db->num_rows($sql_select_popular_items);
		
			for($i = 0; $i < $nb_popular; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_popular_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_MAX_BID;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_popular) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'popular'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_wanted = $db->num_rows($sql_select_recent_wa);
		
			for($i = 0; $i < $nb_wanted; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_wa);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE wanted_ad_id='" . $item_details['wanted_ad_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <? echo $item->item_location($item_details[$counter],false);?><br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_wanted) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('wanted_ads');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?>
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_reverse = $db->num_rows($sql_select_recent_reverse);
		
			for($i = 0; $i < $nb_reverse; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_reverse);
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center">
                           <div class="c1feat"><a href="<?=process_link('reverse_details', array('name' => $item_details['name'], 'reverse_id' => $item_details['reverse_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details['country']);?><br>
                           <? echo $item->item_location($item_details[$counter],false);?><br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?><br>
                           <?=MSG_BUDGET;?>: <? echo $feat_fees->budget_output($item_details['budget_id'], null, $item_details['currency']);?>  <br>
                           <?=MSG_NR_BIDS;?>: <? echo $item_details['nb_bids'];?> <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_reverse) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('reverse_auctions');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
   </div>
</div>
</td>
<td width="10"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="10" height="1"></td>
<td><? if ($is_news && $layout['d_news_box']) { ?>
   <?=$news_box_header;?>
   <?=$news_box_content;?>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <? if ($is_announcements && $member_active == 'Active') { ?>
   <?=$announcements_box_header;?>
   <div id="exp1102170555">
      <?=$announcements_box_content;?>
   </div>
   <div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
   <? } ?>
   <noscript>
   <?=MSG_JS_NOT_SUPPORTED;?>
   </noscript>
   <? if ($setts['enable_header_counter']) { ?>
   <?=$header_site_status;?>
   <table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_site_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_REGISTERED_USERS;?></td>
      </tr>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_live_auctions;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_AUCTIONS;?></td>
      </tr>
      <? if ($setts['enable_wanted_ads']) { ?>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_live_wanted_ads;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_WANT_ADS;?></td>
      </tr>
      <? } ?>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_online_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_ONLINE_USERS;?></td>
      </tr>
   </table>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <?=$banner_position[3];?>
   <?=$banner_position[4];?>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="170" height="1"></div>

Ok, here are the changes you need to make:

On the mainpage.php update this line (line #40):
$ra_details = $db->random_rows(‘reverse_auctions’, ‘reverse_id, name, budget_id, nb_bids, currency, end_time’, $select_condition, $layout[‘r_hpfeat_max’]);

to this:
$ra_details = $db->random_rows(‘reverse_auctions’, ‘reverse_id, name, budget_id, nb_bids, currency, end_time, country, state’, $select_condition, $layout[‘r_hpfeat_max’]);

On the mainpage.tpl.php replace the code below (lines #95-99):
<?=MSG_COUNTRY;?>: <? echo $tax->display_countries($item_details[‘country’]) ;?><br>
<? echo $item->item_location($item_details[$counter],false) ;?><br>
<b><?=MSG_BUDGET;?>: </b> <? echo $feat_fees->budget_output($ra_details[$counter][‘budget_id’], null, $ra_details[$counter][‘currency’]) ;?> <br>
<b><?=MSG_NR_BIDS;?>: </b> <? echo $ra_details[$counter][‘nb_bids’];?> <br>
<b><?=MSG_ENDS;?>: </b> <? echo show_date($ra_details[$counter][‘end_time’]); ?> </td>

with this:
<?=MSG_COUNTRY;?>: <? echo $tax->display_countries($ra_details[$counter][‘country’]);?><br>
<? echo $item->item_location($ra_details[$counter],false);?><br>
<b><?=MSG_BUDGET;?>: </b> <? echo $feat_fees->budget_output($ra_details[$counter][‘budget_id’], null, $ra_details[$counter][‘currency’]);?> <br>
<b><?=MSG_NR_BIDS;?>: </b> <? echo $ra_details[$counter][‘nb_bids’];?> <br>
<b><?=MSG_ENDS;?>: </b> <? echo show_date($ra_details[$counter][‘end_time’]); ?> </td>

Hello Tom8, thank you for those informative replies, I am learning … slowly … lol

We all started as babies and learned how to walk slowly… in time not only will we could walk faster but can run as well, so be patient. Unfortunately as we get older, which is where I am now, we going back and walk slowly again. So as you can see you could easily pass me if you keep on learning. However, as long as my mind is still active, I will continue to provide info that you might find useful. :slight_smile: