PDA

Shop Support News Archive - Shopbetreiber News -> Forum : xt eCommerce Templates Module SEO Support: Shopsoftware Templates Module Frage: Ampelsystem Für Verfügbarkeit!


scanner
12.02.2007, 12:20
Hi@all, ja ich habe das Forum schon durchsucht aber nicht das gefunden was ich möchte. Also habe ich selber mal was gemacht, das klappt aber leider noch nicht so wie es soll.

Hier der Code der in die Datei /includes/modules/product_info.php eingefügt habe



//Verfügbarkeitsampel
define('TEXT_AMPEL_CASE_01','Keine Artikel auf Lager');
define('TEXT_AMPEL_CASE_02','Es wurde keine Artikel anzahl eingegeben');
define('TEXT_AMPEL_CASE_03','Artikel Anzahl 1-3 noch vorhanden');
define('TEXT_AMPEL_CASE_04','Artikel Anzahl 4-100 noch vorhanden');
define('TEXT_AMPEL_CASE_05','Artikel Anzahl 101-200 noch vorhanden');
define('TEXT_AMPEL_CASE_06','Artikel Anzahl 201-300 noch vorhanden');
define('TEXT_AMPEL_CASE_07','Artikel Anzahl 301-400 noch vorhanden');
define('TEXT_AMPEL_IMG_01','/images/icons/av1.gif');
define('TEXT_AMPEL_IMG_02','/images/icons/av2.gif');
define('TEXT_AMPEL_IMG_03','/images/icons/av3.gif');
define('TEXT_AMPEL_IMG_04','/images/icons/av4.gif');
define('TEXT_AMPEL_IMG_05','/images/icons/av5.gif');
define('TEXT_AMPEL_IMG_06','/images/icons/av6.gif');
define('TEXT_AMPEL_IMG_07','/images/icons/av7.gif');
define('AMPEL_TEXT','Verfügbarkeitsstatus');

$a = $product_info['products_quantity'];
$_01 = ($a <= 0 || $a == 0);
$_02 = ($a == NULL);
$_03 = ($a >= 1 && $a <= 4);
$_04 = ($a >= 4 && $a <= 100);
$_05 = ($a >= 101 && $a <= 200);
$_06 = ($a >= 201 && $a <= 300);
$_07 = ($a >= 301 && $a <= 400);

switch ($a)
{
case $_01:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $_02:
$output_string = ''.TEXT_AMPEL_IMG_02.'';
break;
case $_03:
$output_string = ''.TEXT_AMPEL_IMG_03.'';
break;
case $_04:
$output_string = ''.TEXT_AMPEL_IMG_04.'';
break;
case $_05:
$output_string = ''.TEXT_AMPEL_IMG_05.'';
break;
case $_06:
$output_string = ''.TEXT_AMPEL_IMG_06.'';
break;
case $_07:
$output_string = ''.TEXT_AMPEL_IMG_07.'';
break;
}
$info_smarty->assign('AMPELMODUL',$output_string);
****
****
****
****$info_smarty->assign('PRODUCTS_IMAGE',$image);
****$info_smarty->assign('PRODUCTS_POPUP_LINK','java script:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&imgID=0\')');



So als nächstes habe ich die Variable {$AMPELMODUL} in das Template product_info_v1.html eingebaut. So wenn ich jetzt zb. im Admin den Wert 255 eingebe als Warenbestand müsste das Bild av6.gif kommen.

Klingt komisch iss aber so es kommt das Bild av3.gif

Kann mir da einer helfen???

der Shop befindet sich auf www.manilo.de Beispielartikel: http://www.manilo.de/product_info.php/info...--Class-2-.html (http://anonym.to/?http://www.manilo.de/product_info.php/info/p13_Transcend-Secure-Digital-SDHC-Card-8-GB--Class-2-.html)

Shopversion mit SP2

Vielen Vielen Dank schon vorab für die Hilfe

Selbstverständlich darf der Code für nicht Kommerzielle Arten verwendet werden, heißt nicht zum Weiterverkauf!

nom
12.02.2007, 13:30
.. wenn du schon unsere Grafiken für Lieferzeit nutzt, dann solltest du sie wenigstens umbenennen ..

scanner
12.02.2007, 15:53
Das sind nicht eure Originalgrafiken, ich habe diese lediglich als Vorlage verwendet, wenn Du siehst habe ich mehr Grafiken als Ihr.... und für was umbenennen?

''>ZITAT(nom @ Feb 12 2007, 13:30) 20772
.. wenn du schon unsere Grafiken für Lieferzeit nutzt, dann solltest du sie wenigstens umbenennen ..
[/b]

nom
12.02.2007, 19:52
Als Vorlage :D
1:1 identisch

TechWay
12.02.2007, 20:06
die ganzen Variablen $_XX beinhalten dann doch nur wahrheitswerte (0 oder 1, true oder false)

d.h. du musst die ganzen klammern in die jeweiligen CASE-Fälle direkt coden...

so in der art:

switch ($a)
{
case ($a <= 0 || $a == 0):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
....


so ähnlich halt :D

Gruß
TechWay

scanner
12.02.2007, 20:45
Hi danke erstmal für die schnelle Hilfe, aber das funktionert leider nicht so wie Du geschrieben hast... oder habe ich etwas falsch gemacht? Wenn ich es so code wie Du geschrieben hast dann kommt immer das .gif für 'Keine Artikel auf Lager'....



//Verfügbarkeitsampel
define('TEXT_AMPEL_CASE_01','Keine Artikel auf Lager');
define('TEXT_AMPEL_CASE_02','Es wurde keine Artikel anzahl eingegeben');
define('TEXT_AMPEL_CASE_03','Artikel Anzahl 1-3 noch vorhanden');
define('TEXT_AMPEL_CASE_04','Artikel Anzahl 4-100 noch vorhanden');
define('TEXT_AMPEL_CASE_05','Artikel Anzahl 101-200 noch vorhanden');
define('TEXT_AMPEL_CASE_06','Artikel Anzahl 201-300 noch vorhanden');
define('TEXT_AMPEL_CASE_07','Artikel Anzahl 301-400 noch vorhanden');
define('TEXT_AMPEL_IMG_01','/images/icons/av1.gif');
define('TEXT_AMPEL_IMG_02','/images/icons/av2.gif');
define('TEXT_AMPEL_IMG_03','/images/icons/av3.gif');
define('TEXT_AMPEL_IMG_04','/images/icons/av4.gif');
define('TEXT_AMPEL_IMG_05','/images/icons/av5.gif');
define('TEXT_AMPEL_IMG_06','/images/icons/av6.gif');
define('TEXT_AMPEL_IMG_07','/images/icons/av7.gif');
define('AMPEL_TEXT','Verfügbarkeitsstatus');

$a = $product_info['products_quantity'];
$_01 = ($a <= 0 || $a == 0);
$_02 = ($a == NULL);
$_03 = ($a >= 1 && $a <= 4);
$_04 = ($a >= 4 && $a <= 100);
$_05 = ($a >= 101 && $a <= 200);
$_06 = ($a >= 201 && $a <= 300);
$_07 = ($a >= 301 && $a <= 400);

switch ($a)
{
case ($a <= 0 || $a == 0):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_02 = $a == NULL):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_03 >= 1 && $a <= 4):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_04 >= 4 && $a <= 100):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_05 >= 101 && $a <= 200):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_06 >= 201 && $a <= 300):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case ($_06 >= 301 && $a <= 400):
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
}
$info_smarty->assign('AMPELMODUL',$output_string);
****
****$info_smarty->assign('PRODUCTS_IMAGE',$image);
****$info_smarty->assign('PRODUCTS_POPUP_LINK','java script:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&imgID=0\')');

TechWay
12.02.2007, 22:11
du musst schon $a vergleichen ;)

ungetestet!

switch ($a)
{
case $a <= 0:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a == NULL:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a >= 1 and $a <= 4:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a > 4 and $a <= 100:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a >= 101 and $a <= 200:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a >= 201 and $a <= 300:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
case $a >= 301 and $a <= 400:
$output_string = ''.TEXT_AMPEL_IMG_01.'';
break;
default:
$output_string = '';
break;
}

msslovi0
12.02.2007, 22:19
Das dürfte mal ein sehr einheitliches Bild geben, die Ausgabe ist immer $output_string = ''.TEXT_AMPEL_IMG_01.'';


Hab mir das nicht genau angesehen, aber der Code sieht unheimlich aufgebläht aus.

TechWay
12.02.2007, 22:25
oh ja dass sehe ich jetzt auch :D:D

das muss man natürlich immer erhöhen... wie im ersten posting ;)

bara.munchies
12.02.2007, 22:33
ich würd ja den cases nur eine variable zuordnen und dann nach dem case eine ausgabezeile machen.
EVA halt.

bara.munchies
13.02.2007, 09:39
dieses case kommt mir auch etwas schräg vor

bara.munchies
13.02.2007, 13:20
da ich eh grad php lern hab ich mal meine version versucht:



switch (TRUE)

{
case $a <= 0:
$text_ampel = 'Keine Artikel auf Lager';
$bild = 1;
break;

case $a >= 1 and $a <= 4:
$text_ampel = 'Artikel Anzahl 1-3 noch vorhanden';
$bild = 2;
break;

case $a > 4 and $a <= 100:
$text_ampel = 'Artikel Anzahl 4-100 noch vorhanden';
$bild = 3;
break;

case $a >= 101 and $a <= 200:
$text_ampel = 'Artikel Anzahl 101-200 noch vorhanden';
$bild = 4;
break;

case $a >= 201 and $a <= 300:
$text_ampel = 'Artikel Anzahl 201-300 noch vorhanden';
$bild = 5;
break;

case $a >= 301 and $a <= 400:
$text_ampel = 'Artikel Anzahl 301-400 noch vorhanden';
$bild = 6;
break;

default:
$text_ampel = 'Es wurde keine Artikel Anzahl eingegeben';
$bild = 0;
break;
}

$output_string = '/images/icons/av'.$bild.'.gif'.$text_ampel;


echo $output_string;

oder das smarty gedöns, sorry.
wie gesagt, nur zum üben, nicht zum besserwissen;)

scanner
14.02.2007, 08:10
@Lockdron

Hi Lockdron, erstmal vielen Dank für Deine Hilfe! Also was Du geschrieben hast sieht für mich als noob schonmal ziemlich gut aus, aber es funktioniert leider nicht :-( Hattest eine Klammer vergessen aber an dem lag es nicht... kannst du nochmal nachschauen?


Mein Schop (http://anonym.to/?http://www.manilo.de/product_info.php/info/p13_Transcend-Secure-Digital-SDHC-Card-8-GB--Class-2-.html/XTCsid/6a435942898bbfed53d2ea054838108c)

Jetzt zeigt er mir an das ich keine Artikelanzahl angegeben habe :-(

@bara.munchias

Wenn ich Deinen Code rein mache kommt das raus SCREENSHOT (http://anonym.to/?http://img241.imageshack.us/my.php?image=screengx3.gif)

bara.munchies
14.02.2007, 10:03
@scanner
mein code enthält keine smarty zuweisungen, das musst du dir selber darinbauen, mit gings nur um die case abfrage.

scanner
14.02.2007, 10:05
Ja schon klar obwohl ich kein php kann :-) Also die smarty zuweisung habe ich vom alten code gleich drin gelassen

''>ZITAT(bara.munchies @ Feb 14 2007, 10:03) 20940
@scanner
mein code enthält keine smarty zuweisungen, das musst du dir selber darinbauen, mit gings nur um die case abfrage.
[/b]

bara.munchies
14.02.2007, 10:31
poste doch mal alles

scanner
14.02.2007, 10:35
''>ZITAT(bara.munchies @ Feb 14 2007, 10:31) 20943
poste doch mal alles
[/b]



//Verfügbarkeitsampel
define('TEXT_AMPEL_CASE_01','Keine Artikel auf Lager');
define('TEXT_AMPEL_CASE_02','Es wurde keine Artikel anzahl eingegeben');
define('TEXT_AMPEL_CASE_03','Artikel Anzahl 1-3 noch vorhanden');
define('TEXT_AMPEL_CASE_04','Artikel Anzahl 4-100 noch vorhanden');
define('TEXT_AMPEL_CASE_05','Artikel Anzahl 101-200 noch vorhanden');
define('TEXT_AMPEL_CASE_06','Artikel Anzahl 201-300 noch vorhanden');
define('TEXT_AMPEL_CASE_07','Artikel Anzahl 301-400 noch vorhanden');
define('TEXT_AMPEL_IMG','/images/icons/av[[NUMBER]].gif');
define('AMPEL_TEXT','Verfügbarkeitsstatus');

switch (TRUE)

{
case $a <= 0:
$text_ampel = 'Keine Artikel auf Lager';
$bild = 1;
break;

case $a >= 1 and $a <= 4:
$text_ampel = 'Artikel Anzahl 1-3 noch vorhanden';
$bild = 2;
break;

case $a > 4 and $a <= 100:
$text_ampel = 'Artikel Anzahl 4-100 noch vorhanden';
$bild = 3;
break;

case $a >= 101 and $a <= 200:
$text_ampel = 'Artikel Anzahl 101-200 noch vorhanden';
$bild = 4;
break;

case $a >= 201 and $a <= 300:
$text_ampel = 'Artikel Anzahl 201-300 noch vorhanden';
$bild = 5;
break;

case $a >= 301 and $a <= 400:
$text_ampel = 'Artikel Anzahl 301-400 noch vorhanden';
$bild = 6;
break;

default:
$text_ampel = 'Es wurde keine Artikel Anzahl eingegeben';
$bild = 0;
break;
}

$output_string = '/images/icons/av'.$bild.'.gif'.$text_ampel;


echo $output_string;


$info_smarty->assign('AMPELMODUL',$output_string);
****
****$info_smarty->assign('PRODUCTS_IMAGE',$image);
****$info_smarty->assign('PRODUCTS_POPUP_LINK','java script:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&imgID=0\')');

bara.munchies
14.02.2007, 10:49
bei dir fehlt noch die zuweisung der variablen $a, dafür kannste den DEFINE krams weglassen.
mit den letzten 3 zeilen bin ich mir nicht sicher...

versuchs mal so:

//Verfügbarkeitsampel

$a = $product_info['products_quantity'];

switch (TRUE)

{
case $a <= 0:
$text_ampel = 'Keine Artikel auf Lager';
$bild = 1;
break;

case $a >= 1 and $a <= 4:
$text_ampel = 'Artikel Anzahl 1-3 noch vorhanden';
$bild = 2;
break;

case $a > 4 and $a <= 100:
$text_ampel = 'Artikel Anzahl 4-100 noch vorhanden';
$bild = 3;
break;

case $a >= 101 and $a <= 200:
$text_ampel = 'Artikel Anzahl 101-200 noch vorhanden';
$bild = 4;
break;

case $a >= 201 and $a <= 300:
$text_ampel = 'Artikel Anzahl 201-300 noch vorhanden';
$bild = 5;
break;

case $a >= 301 and $a <= 400:
$text_ampel = 'Artikel Anzahl 301-400 noch vorhanden';
$bild = 6;
break;

default:
$text_ampel = 'Es wurde keine Artikel Anzahl eingegeben';
$bild = 0;
break;
}

$output_string = '/images/icons/av'.$bild.'.gif'.$text_ampel;




$info_smarty->assign('AMPELMODUL',$output_string);
****
****$info_smarty->assign('PRODUCTS_IMAGE',$image);
****$info_smarty->assign('PRODUCTS_POPUP_LINK','java script:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '&imgID=0\')');

scanner
14.02.2007, 10:55
Nein leider immer noch nicht, irgendwie nimmt das Script nicht die Artikel die im Lager auch sind... kannst ja mal schauen manilo.de und dann eben in einem Artikel.

Lockdron hat noch gemeint das meine Variable wahrscheinlich falsch war und ich


$a = $product->data['products_quantity'];


benutze sollte, aber nützt irgendwie alles nichts. Er bleibt auf dem .gif stehen das "Verfügbarkeitsstatus - Keine Artikel auf Lager"

bara.munchies
14.02.2007, 16:01
geb doch mal die variable mit

echo $a;

aus