Produkt Quantity

MyOOS hat einen Fehler, oder tut nicht das, was Ihr erwartet? Derartige "Unanehmlichkeiten" bitte hier.
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Produkt Quantity

Beitrag 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
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von r23 »

Hallo,

Code: Alles auswählen

case ($quantity == 0):
 
und

Code: Alles auswählen

case ($quantity < 0):
 
hoffe, die Antwort hilft weiter?

Ralf
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von wolfschw »

Hallo,

das hatte ich auch schon so probiert, aber geht nicht

Gruß

Wolfgang
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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ß
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von r23 »

Hallo,

keine Ahnung :(

evtl. ist es keine Zahl? Mit intval

Code: Alles auswählen

$quantity = intval($listing['products_quantity']); 
 

http://php.net/manual/de/function.intval.php

würde ich es versuchen...

bzw. was steht in $quantity ?

Hoffe, es funktioniert jetzt

Ralf
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von r23 »

hallo Wolfgang,

ich habe die Ausgabe mit if else nun gemacht... ich hoffe, es funktioniert richtig?

Beste Grüße

Ralf
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von wolfschw »

Hallo Ralf,

ja jetzt funktioniert es richtig, aber hinter dem Artikelnamen steht jetzt plötzlich der Bestand

Gruß

Wolfgang
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag von wolfschw »

ok hat sich erledigt, hab den Fehler gefunden.
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
r23
Beiträge: 2624
Registriert: 18.09.2008, 05:56
Wohnort: Hagen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
wolfschw
Beiträge: 396
Registriert: 01.03.2009, 21:23
Wohnort: Ilshofen
Kontaktdaten:

Re: Produkt Quantity

Beitrag 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
Antworten