Seite 1 von 1
Artikelbestand durch eine Ampel ersetzen
Verfasst: 08.10.2010, 16:55
von wolfschw
Hallo
Würde gern in der \templates\osc\products\product_info.html eine Ampel für Lieferstatus anzeigen lassen.
Beispiel:
Für Artikelbestand <0 eine grüne Ampel
Für Artikelbestand =0 eine gelbe Ampel
und für Artikelbestand >0 also ab -1 eine rote Ampel
Da unser Shop mit dem Warenwirtschftsprogramm verbunden ist und ich den Lagerbestand pflege,
könnte ich die Bestände vom Rechnungsprogramm in den Online-Shop übertragen.
In der \shop\includes\modules\product_listing.php
habe ich es hinbekommen das mir die Ampel rot, gelb oder grün angezeigt wird, je nach bestand.
Für eine kleine Hilfe wäre ich dankbar.
gruß
Wolfgang
Verfasst: 09.10.2010, 11:35
von r23
Hallo,
der Lagerbestand steht in dem Datenfeld
products_quantity (bitte vorher mit PHPMyAdmin prüfen)
Das Datenfeld fragt man in
~/shop/includes/pages/products/info.php ab
Code: Alles auswählen
$product_info_sql = "SELECT p.products_id, pd.products_name, pd.products_description, pd.products_url,
pd.products_description_meta, pd.products_keywords_meta, p.products_quantity,...
ab.
Code: Alles auswählen
{if $product_info.products_quantity gt 0}
<img src="{$smarty.const.OOS_ICONS}green.gif" border="0" alt="{$lang.icon_green}" width="10" height="10">
{elseif $product_info.products_quantity eq 0}
<img src="{$smarty.const.OOS_ICONS}...
{elseif $product_info.products_quantity lt 0}
<img
{/if}
http://www.smarty.net/manual/de/languag ... ion.if.php
Schnönes Wochenende
ralf
Verfasst: 15.10.2010, 18:08
von wolfschw
Hallo
Habe in der /shop/includes/modules/product_listing.php die Ampel Rot, Gelb und Grün siehe Beispiel eingetragen
Code: Alles auswählen
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';
}
$lc_align = 'right';
$lc_text = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantity]);
break;
Kann man diese Ampeln zusätzlich noch mit einen link versehen
so das ein kleines html Fenster aufgeht. ?
gruß
Wolfgang
Verfasst: 15.10.2010, 19:13
von r23
Hallo,
ein pop up Fenster öffent man mit diesem JavaScript z.B.
Code: Alles auswählen
<a href="javascript:void(window.open('http://example.org/ampel.html','','width=590,height=580,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes'))">
Bitte eine entsprechede Dokumenation im Web selber suchen - bei Klick öffnet sich
http://example.org/ampel.html in einem neuen Fenster 590 x 580 pixel.
Code: Alles auswählen
$lc_align = 'right';
$sImage = oos_image(OOS_IMAGES . $pq_image, $listing['products_quantity]);
$lc_text = '<a href="javascript:void(window.open(\'http://example.org/ampel.html\',\'\',\'width=590,height=580,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes\'))">' . $sImage . '</a>';
Tipp. es gibt elseif
http://php.net/manual/en/control-structures.elseif.php
Code: Alles auswählen
<?php
if ($a > $b) {
echo "a is bigger than b";
} elseif ($a == $b) {
echo "a is equal to b";
} else {
echo "a is smaller than b";
}
?>
Hoffe die Antwort hilft weiter
ralf