Bitte um schnelle Antwort
Ich kann nicht zaubern, aber ich will es versuchen
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_shop.php
#
#-----[ FIND ]------------------------------------------
#
function insert_buyed_item( $item_id, $user )
#
#-----[ BEFORE, ADD ]------------------------------------------
#
function get_buyed_items_profile( $user )
{
global $db, $lang;
if( !is_array($this->buyed_items[$user]) )
{
$this->buyed_items[$user] = array();
$sql = "SELECT count(b.buy_id) as buyed_count, i.item_name, i.item_pic
FROM ". SHOP_BUY_TABLE ." b, ". SHOP_ITEM_TABLE ." i
WHERE b.buy_user = '$user'
AND i.item_id = b.buy_item
GROUP BY i.item_name, i.item_pic";
if( !($result = $db->sql_query($sql) ))
{
message_die(GENERAL_ERROR, $lang['shop_no_buy'], '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
if ($row['item_pic'])
{
$item_pic = '<img src="'.$row['item_pic'].'" border="0" alt="'.str_replace('"', '', $row['item_name']).'" /> ';
}
else
{
$item_pic = '';
}
$this->buyed_items[$user][$row['buyed_count']] = $item_pic . $row['item_name'];
}
}
return $this->buyed_items[$user];
}
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
$usercash = $shop->get_cash($profiledata['user_id']);
$shop_config = $shop->get_shop_config();
$template->assign_var('USER_CASH', sprintf($lang['shop_user_cash'], $usercash, $shop_config['waehrung']));
$buyed_items = $shop->get_buyed_items_profile($profiledata['user_id']);
$total_items = count($buyed_items);
if( $total_items == 0 )
{
$template->assign_var('BUYED_ITEMS', $lang['shop_no_buyed_items']);
}
else
{
$i = 1;
$items = '';
while( list($item_id, $item_name) = each($buyed_items) )
{
if( $i == $total_items )
{
$items .= $item_name;
}
else
{
$items .= $item_name.', ';
}
$i++;
}
$template->assign_var('BUYED_ITEMS', $items);
$template->assign_var('L_SHOP_BUYED_ITEMS', $lang['l_shop_buyed_items']);
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
$usercash = $shop->get_cash($profiledata['user_id']);
$shop_config = $shop->get_shop_config();
$template->assign_var('USER_CASH', sprintf($lang['shop_user_cash'], $usercash, $shop_config['waehrung']));
$buyed_items = $shop->get_buyed_items_profile($profiledata['user_id']);
$total_items = count($buyed_items);
if( $total_items == 0 )
{
$template->assign_var('BUYED_ITEMS', $lang['shop_no_buyed_items']);
}
else
{
$i = 1;
$items = '';
while( list($item_count, $item_name) = each($buyed_items) )
{
if( $i == $total_items )
{
$items .= $item_name . ' x ' . $item_count;
}
else
{
$items .= $item_name . ' x ' . $item_count . '<br />';
}
$i++;
}
$template->assign_var('BUYED_ITEMS', $items);
$template->assign_var('L_SHOP_BUYED_ITEMS', $lang['l_shop_buyed_items']);
}
Das zumindest, so denke ich mir, sollte funktionieren...