Seite 1 von 2
Produkt Quantity
Verfasst: 21.08.2014, 14:43
von wolfschw
Hallo Ralf,
würde gerne unsere Ampel um 3 Grüne Punkte erweitern.
Wenn bei uns im Shop mehr als 5 Artikel am Lager sind, soll die Ampel mit drei grünen Punkten erscheinen.
Was muss dann hier in der produkt_listing.php geändert werden.
Code
case 'PRODUCT_LIST_QUANTITY':
if ($listing['products_quantity'] > 0) {
$pq_image = 'ampel_gruen.gif';
} else {
$pq_image = 'ampel_gelb.gif';
}
if ($listing['products_quantity'] < 0) {
$pq_image = 'ampel_rot.gif';
}
if ($listing['products_status'] == 4) {
$pq_image = 'ampel_3rot.gif';
}
$lc_align = 'right';
$sImage = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantit']);
$lc_text = '<a href="javascript:void(window.open(\'
http://www.jura-ersatzteile-shop.de/dow ... ollbars=no\'))">' . $sImage . '</a>';
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 22.08.2014, 18:35
von r23
Hallo,
ich würde vermutlich switch verwenden
http://php.net/manual/de/control-structures.switch.php
Code: Alles auswählen
case 'PRODUCT_LIST_QUANTITY':
$quantity = $listing['products_quantity'];
switch($quantity)
{
case ($quantity > 5):
$pq_image = 'die neue grafik.gif';
break;
case ($quantity >= 1):
$pq_image = 'ampel_gelb.gif';
break;
case($quantity <= 0):
$pq_image = 'ampel_rot.gif';
break;
}
if ($listing['products_status'] == 4) {
$pq_image = 'ampel_3rot.gif';
}
$lc_align = 'right';
$sImage = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantit']);
$lc_text = '<a href="javascript:void(window.open(\'http://www.jura-ersatzteile-shop.de/download/lagerbestand.htm\',\'\',\'width=540,height=420,left=10,top=10,resizable=yes,menubar=no,location=no,status=yes,scrollbars=no\'))">' . $sImage . '</a>';
Ich hoffe, es funktioniert so?
Schönes Wochenende
Ralf
Re: Produkt Quantity
Verfasst: 24.08.2014, 13:28
von wolfschw
Hallo Ralf,
hier mein Code:
case 'PRODUCT_LIST_QUANTITY':
$quantity = $listing['products_quantity'];
switch($quantity)
{
case ($quantity >= 5):
$pq_image = 'ampel3_gruen.gif';
break;
case ($quantity >= 3):
$pq_image = 'ampel2_gruen.gif';
break;
case ($quantity >= 1):
$pq_image = 'ampel_gruen.gif';
break;
case ($quantity = 0):
$pq_image = 'ampel_gelb.gif';
break;
case ($quantity < -0):
$pq_image = 'ampel_rot.gif';
break;
}
if ($listing['products_status'] == 4) {
$pq_image = 'ampel_3rot.gif';
}
$lc_align = 'right';
$sImage = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantit']);
$lc_text = '<a href="javascript:void(window.open(\'
http://www.jura-ersatzteile-shop.de/dow ... ollbars=no\'))">' . $sImage . '</a>';
jetzt funktioniert aber meine gelbe Ampel bei Bestand Null nicht mehr.
Was mache ich falsch?
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 24.08.2014, 16:38
von r23
Hallo,
und
hoffe, die Antwort hilft weiter?
Ralf
Re: Produkt Quantity
Verfasst: 24.08.2014, 17:51
von wolfschw
Hallo,
das hatte ich auch schon so probiert, aber geht nicht
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 24.08.2014, 17:59
von r23
Hallo,
bei == sollte
$quantity == 0
es funktionieren?
Wenn nicht mir ein Produkt im Shop nennen und ich sehe es mir an.
Beste Grüße
ralf
Re: Produkt Quantity
Verfasst: 24.08.2014, 18:21
von wolfschw
Hallo Ralf,
ich kann dir leider kein Produkt nennen, da ich dieses Lokal auf dem Rechner probiere.
Ich habe das so eingefügt:
case 'PRODUCT_LIST_QUANTITY':
$quantity = $listing['products_quantity'];
switch($quantity)
{
case ($quantity >= 5):
$pq_image = 'ampel3_gruen.gif';
break;
case ($quantity >= 3):
$pq_image = 'ampel2_gruen.gif';
break;
case ($quantity >= 1):
$pq_image = 'ampel_gruen.gif';
break;
case ($quantity == 0):
$pq_image = 'ampel_gelb.gif';
break;
case ($quantity < 0):
$pq_image = 'ampel_rot.gif';
break;
}
if ($listing['products_status'] == 4) {
$pq_image = 'ampel_3rot.gif';
}
$lc_align = 'right';
$sImage = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantit']);
$lc_text = '<a href="javascript:void(window.open(\'
http://www.jura-ersatzteile-shop.de/dow ... ollbars=no\'))">' . $sImage . '</a>';
Die ersten drei Grünen und die Rote Ampel funktionieren ja, nur die Gelbe nicht.
Gruß
Re: Produkt Quantity
Verfasst: 24.08.2014, 23:39
von r23
Hallo,
keine Ahnung
evtl. ist es keine Zahl? Mit intval
http://php.net/manual/de/function.intval.php
würde ich es versuchen...
bzw. was steht in $quantity ?
Hoffe, es funktioniert jetzt
Ralf
Re: Produkt Quantity
Verfasst: 25.08.2014, 09:23
von wolfschw
Hallo Ralf,
habe das mal Online gestellt.
Artikel Nr. 64738 müsste nun eigentlich gelb zeigen, zeigt aber drei grüne punkte.
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 25.08.2014, 18:50
von r23
hallo Wolfgang,
ich habe die Ausgabe mit if else nun gemacht... ich hoffe, es funktioniert richtig?
Beste Grüße
Ralf
Re: Produkt Quantity
Verfasst: 25.08.2014, 20:08
von wolfschw
Hallo Ralf,
ja jetzt funktioniert es richtig, aber hinter dem Artikelnamen steht jetzt plötzlich der Bestand
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 25.08.2014, 21:42
von wolfschw
ok hat sich erledigt, hab den Fehler gefunden.
Re: Produkt Quantity
Verfasst: 26.08.2014, 13:00
von wolfschw
Hallo Ralf,
habe da noch was vergessen.
In der Produktinfo "product_info.html" gibt es auch noch die Ampel.
Wie muss dann dieses geändert werden?
Gruß
Wolfgang
Re: Produkt Quantity
Verfasst: 26.08.2014, 15:46
von r23
Hallo,
geändert - bitte einmal prüfen...
und Sorry für die Ausgabe der Lagermenge nach dem Produkt-Namen gestern ....
Beste Grüße
Ralf
Re: Produkt Quantity
Verfasst: 26.08.2014, 18:54
von wolfschw
Hallo,
kein Problem wegen der Lagermenge.
In der Produktinfo sollen auch die drei grünen Ampeln erscheinen wie in der Produktliste
ampel3gruen.gif bei 5 Stück
ampel2gruen.gif bei 3 Stück
ampelgruen.gif bei 1 Stück
Bildmaterial ist bereits Online.
Was beteutet "lt", "eq", "gt" ?
{if $product_info.products_status eq 4}<img src="{$smarty.const.OOS_IMAGES}ampel3rot.gif" align="bottom">
{elseif $product_info.products_quantity lt 0}<img src="{$smarty.const.OOS_IMAGES}ampelrot.gif" align="bottom">
{elseif $product_info.products_quantity eq 0}<img src="{$smarty.const.OOS_IMAGES}ampelgelb.gif" align="bottom">
{elseif $product_info.products_quantity gt 0}<img src="{$smarty.const.OOS_IMAGES}ampelgruen.gif" align="bottom">
Gruß
Wolfgang