HAllo Bigfoot.
es gibt, soweit ich es verstanden habe, zwe "Whats new" routinen. Zum einen kann man in der "Mitte des Contents", also z.B. unter dem "Willkommen" das Module "new_products" einbinden. Hier werden dann wohl alle die Produkte angezeigt, die in die Kategorie "TOP" einsortiert werden. Das finde ich aber reichlich umst?ndlich, da ich dauernd Artikel umsortieren, bzw. kopieren muss.
Daher habe ich die Box WHATSNEW entsprechend umgebaut. Die holt sich aus den neuen Artikel eine definierbare Zahl an zuf?lligen Eintr?gen (das l??t sich aber leicht ?ndern, wenn man z.B. nur die "neuesten" 10 oder so haben will.
Folgende Dateien habe ich ge?ndert:
YOURTEMPLATE/SOURCE/BOXES/WHATS_NEW.PHP
Code:
$box_smarty = new smarty;
$box_smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
$box_content = '';
$how_much_entries = 2;
# include needed functions
require_once(DIR_FS_INC . 'xtc_random_select.inc.php');
require_once(DIR_FS_INC . 'xtc_rand.inc.php');
require_once(DIR_FS_INC . 'xtc_get_products_name.inc.php');
require_once(DIR_FS_INC . 'xtc_get_products_price.inc.php');
require_once(DIR_FS_INC . 'xtc_row_number_format.inc.php');
# fsk18 lock
$fsk_lock='';
if ($_SESSION['customers_status']['customers_fsk18_display']=='0') $fsk_lock=' and p.products_fsk18!=1';
if (GROUP_CHECK=='true') $group_check="and p.group_ids LIKE '%c_".$_SESSION['customers_status']['customers_status_id']."_group%'";
# create database query
$strSQL = "select distinct
p.products_id,
p.products_image,
p.products_tax_class_id,
p.products_price
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c
where p.products_status=1
and p.products_id = p2c.products_id
and p.products_id !='".(int)$_GET['products_id']."' ".$fsk_lock."
and c.categories_id = p2c.categories_id
".$group_check."
and c.categories_status=1 order by
p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW;
$random_product = xtc_db_query($strSQL);
$rows = 0;
$box_content = array();
$tmp_content = array();
# create array with all entries
while ($whats_new = xtc_db_fetch_array($random_product))
{
$rows++;
$image = '';
if ($whats_new['products_image']) $image = DIR_WS_THUMBNAIL_IMAGES . $whats_new['products_image'];
$tmp_content[] = array(
'ID' => xtc_row_number_format($rows),
'NAME' => xtc_get_products_name($whats_new['products_id']),
'IMAGE' => $image,
'PRICE'=> xtc_get_products_price($whats_new['products_id'],$price_special = 1,$quantity = 1),
'LINK'=> xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $whats_new['products_id']));
}
# get a random part of it
$rand_keys = array_rand($tmp_content, $how_much_entries);
foreach ($rand_keys as $key=>$value)
{
$box_content[] = $tmp_content[$value];
}
$box_smarty->assign('box_content', $box_content);
$box_smarty->assign('language', $_SESSION['language']);
# set cache ID
if (USE_CACHE == 'false')
{
$box_smarty->caching = 0;
$box_whats_new = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_whatsnew.html');
}
else
{
$box_smarty->caching = 1;
$box_smarty->cache_lifetime = CACHE_LIFETIME;
$box_smarty->cache_modified_check = CACHE_CHECK;
$cache_id = $_SESSION['language'].$random_product['products_id'].$_SESSION['customers_status']['customers_status_name'];
$box_whats_new = $box_smarty->fetch(CURRENT_TEMPLATE.'/boxes/box_whatsnew.html',$cache_id);
}
$smarty->assign('box_WHATSNEW',$box_whats_new);
Als zweites braucht man nat?rlich ein passendes SMARTY-HTML-File... die kann man dann an seine "Designw?nsche" anpassen. In diesem Fall wird eine zweispaltige Liste aufgebaut:
YOURTEMPLATE/BOXES/BOX_WHATSNEW.HTML
Code:
{config_load file="$language/lang_$language.conf" section="boxes"}
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="infoBoxHeading">{#heading_whatsnew#}</td>
</tr>
</table>
<br/>
<br/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
{foreach name=aussen item=box_data from=$box_content}
{php}
$col++;
{/php}
<td class="main">
<div align="left">
<table width="100%" border="0" cellpadding="0" cellspacing="4">
<tr>
<td width="1" rowspan="2" >{if $box_data.IMAGE}<a href="{$box_data.LINK}"><img src="{$box_data.IMAGE}" border="0"></a>{/if}</td>
<td class="main"><strong><a href="{$box_data.LINK}">{$box_data.NAME}</a></strong></td>
</tr>
<tr>
<td class="main">
<strong>{$box_data.PRICE}<br>
</td>
</tr>
</table>
</div>
</td>
{php}
if ($col>=2)
{
$col=0;
echo '</tr><tr>';
}
{/php}
{/foreach}
</tr>
</table>
e voila... und schon klappts auch mit den neuen Produkten....