#1 (permalink)  
Alt 24.08.2004, 19:54
xt:Commerce Support Kunde
 
Registriert seit: 17.04.2004
Beiträge: 74
Standard

Hallo NG
wie ist es mir m?glich in der Box whats_new oder whats_new2
mehrere zuletzt angelegte neue Produkte anzeigen zu lassen. Als
Standard wird jetzt ja nur ein neu angelegtes Produkt angezeigt. Ich
w?rde aber gerne auf der Startseite zwei oder drei anzeigen lassen.
Was f?r Code/Datei muss ge?ndert werden um dies zu Realisieren?

Vielen Dank.

Gru?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 25.08.2004, 20:40
Benutzerbild von morix
xt:Commerce Support Kunde
 
Registriert seit: 28.05.2004
Beiträge: 1.877
Standard

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....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 08.06.2006, 15:00
xt:C Sponsor
 
Registriert seit: 28.08.2005
Beiträge: 193
Standard

hallo, soweit ist alles klar mit der umsetzung, nur sagt er bei mir das es die get_products_name.inc.php nicht gibt...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #4 (permalink)  
Alt 09.06.2006, 15:37
Benutzerbild von morix
xt:Commerce Support Kunde
 
Registriert seit: 28.05.2004
Beiträge: 1.877
Standard

welche shopversion ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #5 (permalink)  
Alt 09.06.2006, 16:00
xt:C Sponsor
 
Registriert seit: 28.08.2005
Beiträge: 193
Standard

3.0.4 Sp1


kannst du mir die box auf diese version schreiben???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #6 (permalink)  
Alt 12.06.2006, 22:43
Benutzerbild von morix
xt:Commerce Support Kunde
 
Registriert seit: 28.05.2004
Beiträge: 1.877
Standard

mmmh. die Version hab ich auch und bei mir gibts die datei...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #7 (permalink)  
Alt 14.06.2006, 09:49
xt:C Sponsor
 
Registriert seit: 28.08.2005
Beiträge: 193
Standard

ok sorry, die name gibt es aber die price nicht, bzw die ist anderst ausgef?hrt
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #8 (permalink)  
Alt 14.06.2006, 10:14
Benutzerbild von morix
xt:Commerce Support Kunde
 
Registriert seit: 28.05.2004
Beiträge: 1.877
Standard

dann kommentier die products_price einfach mal raus.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #9 (permalink)  
Alt 14.06.2006, 15:19
xt:C Sponsor
 
Registriert seit: 28.08.2005
Beiträge: 193
Standard

ja okay, dann gehts, kannst du mir die box vielleicht umschreiben, damit nur die produkte aus der Top verlinkung angezeigt werden? oder gibt es eine box womit ich mehrere artikel aus top kategorie anzeigen lassen kann???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #10 (permalink)  
Alt 10.11.2006, 13:31
xt:Commerce Support Kunde
 
Registriert seit: 21.05.2005
Beiträge: 98
Standard

Hallo,

passt zwar nicht ganz dazu, aber vielleicht hilft es jemand weiter. Ich habe mir die whats_new_box so angepasst, dass ich Sie über die products_id auswerten kann. Da ich kein PHP-Experte bin hoffe ich jetzt nicht, dass die Leute über mich herfallen. Das ganze ist für das 3.4SP1 und wie immer vorher ein Backup machen. Es sind lediglich die IDs in das input array einzutragen:

/templates/templates/source/boxes/whats_new.php

PHP-Code:
<?php

/* -----------------------------------------------------------------------------------------
   $Id: whats_new.php 1292 2005-10-07 16:10:55Z mz $   

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on: 
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(whats_new.php,v 1.31 2003/02/10); www.oscommerce.com 
   (c) 2003     nextcommerce (whats_new.php,v 1.12 2003/08/21); www.nextcommerce.org

   Released under the GNU General Public License 
   -----------------------------------------------------------------------------------------
   Third Party contributions:
   Enable_Disable_Categories 1.3            Autor: Mikel Williams | mikel@ladykatcostumes.com

   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
  
$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_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";
}

/* Möglichkeit die Produkte zu begrenzen 
a) den SQL-Select ändern auf die gewünschte product id z.B. and p.products_id = 231 oder Angabe einer Variabel
b) Ein Array mit den Produkt-IDs füttern die in der Box angezeigt werden sollen und über array_rand auswerten lassen
*/

$input = array("230""231""55""35");
$rand_keys array_rand($input2);
$produkte = ($input[$rand_keys[0]]);
//echo($produkte);


    # 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 = "
.$produkte."
        and c.categories_id = p2c.categories_id
        "
.$group_check."
        and c.categories_status=1 order by
         p.products_date_added desc limit 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_content $tmp_content;

$box_smarty->assign('box_content'$tmp_content);
//    $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);
?>
und

/templates/templaes/boxes/box_whatsnew.html
PHP-Code:

{config_load file="$language/lang_$language.conf" section="boxes"}
<
table width="210"  border="0" cellpadding="0" cellspacing="0">
 {foreach 
name=aussen item=box_data from=$box_content}
     {
php}
  
$col++;
     {/
php}
  <
tr>
    <
td height="22" class="box_oben_neuimshop"><a href="{$NEW_LINK}"><img src="{$tpl_path}img/icon_more.gif" alt="" /></a></td>
  </
tr>
  <
tr>
    <
td align="center" valign="middle" class="box_mitteweiss">  {if $box_data.IMAGE}<a href="{$box_data.LINK}"><img src="{$box_data.IMAGE}border="0"></a>{/if}<br />
            <
a href="{$box_data.LINK}">{$box_data.NAME}</a></strong><br />
            {
$box_data.PRICE}<br /></td>
     </
tr>
  <
tr>
    <
td height="5" class="box_unten"></td>
  </
tr>
<
tr>     {php}
  if (
$col>=0)
  {
      
$col=0;
      echo 
'</tr>';
  }
     {/
php}
 {/foreach}
    </
tr>
</
table
gruesse
olli
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
box

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus



Alle Zeitangaben in WEZ +1. Es ist jetzt 08:43 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand