Erich FuchsErich Fuchs MemberComments: 12 Received thanks: 14 Member since: October 2014 edited June 2016

Hallo Community,

bei der Versandvorbereitung hatte ich das Problem, dass ich nicht unnötig schmutziges Papier produzieren wollte (Packlisten pro Bestellung drucken) , also eine einfache Handygerechte Liste der offenen Bestellungen, jeweils mit den Artikelpositionen - und nach erfolgreicher Verpackung ein Feld zur Zwischenspeicherung des Paket Gewicht's

die Bestellnummer wird auf dem Paket vermerkt und später mit dem (DHL) Paket Etikett versehen

folgendes Script einfach ins Rootverzeichnis, ev. Zugriffbeschränkung muss Serverseitig erfolgen

<?php
$config=include("config.php");
$db = mysqli_connect($config[db][host], $config[db][username], $config[db][password], $config[db][dbname]);
if (!$db) {
    die('MySQL Error: ' . mysql_error());
}

print "<html><body style=width:800px><font size=5 face=arial>";

$result = mysqli_query($db, "SELECT * FROM `s_order` WHERE `status` = 0 LIMIT 50");
while($order = mysqli_fetch_array($result, MYSQL_ASSOC) )
{

    $result_user = mysqli_query($db, "SELECT * FROM `s_order_shippingaddress` WHERE `orderID` = ".$order[id]);
    $user = mysqli_fetch_array($result_user, MYSQL_ASSOC);

    $result_country = mysqli_query($db, "SELECT * FROM `s_core_countries` WHERE `id` = ".$user[countryID]);
    $country = mysqli_fetch_array($result_country, MYSQL_ASSOC);

    print "<b>";
    print $order[ordernumber]." - ";
    print $user[firstname]." ";
    print $user[lastname]." - ";
    print $user[city].", ";
    print $country[countryiso]."";

    print "</b> ";
    print "<input type=number style='font-size:40px; width:100px; float:right'>";
    if ($order[cleared]=="17") print " <font color=red style=float:right;>O</font>"; //Zahlung Offen
    print "<br>";

    $result_orders = mysqli_query($db, "SELECT * FROM `s_order_details` WHERE `orderID` = ".$order[id]);
    while($orders = mysqli_fetch_array($result_orders, MYSQL_ASSOC) )
    {
    print "&nbsp; &bull; ".$orders[quantity]." x ";
    print $orders[articleordernumber]." ";
    print $orders[name]." ";
    print "</br>";

//    echo "<pre>"; print_r($order); echo "</pre>";
    }

    print "<hr><br>";

}

print "</font></body></html>";
mysqli_close($db);
?>

Hoffe es ist für jemand nützlich ...

LG. aus Österrecih

Erich

Comments

  • sigmasternsigmastern MemberComments: 10 Received thanks: 0 Member since: October 2015

    Hallo Erich,

    die Datenbanktabelle "s_user_shippingaddress", aus der Du die Lieferanschrift zur aktuellen Bestellung holst,  könnte mehrere Einträge pro Kunde ("=userID)" haben.

     

    Falls ein Kunde 2 Bestellungen mit unterschiedlichen Lieferanschriften vorgenommen hat (beliebiger Zeitraum),  könnte die Falsche ausgegeben werden.

    Du kannst bei dem Query der Tabelle s_user_shippingaddress zusätzlich nach orderID filtern, um das auszuschließen.

     

    Viele Grüße,
    Martin

  • Erich FuchsErich Fuchs MemberComments: 12 Received thanks: 14 Member since: October 2014

    Danke für den Hinweis !

    habe es jetzt auf s_order_shippingaddress umgestellt und auch über die orderID referenzeirt

  • Erich FuchsErich Fuchs MemberComments: 12 Received thanks: 14 Member since: October 2014

    überarbeitete Version für Shopware 5.6 auf PHP 7.x

    <?php
    //error_reporting(0);
    $config=include("config.php");
    $db = mysqli_connect($config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['dbname']);
    if (!$db) {
        die('MySQL Error: ' . mysql_error());
    }
    
    print "<html><body style=width:600px;font-size:12px;><font face=arial>";
    
    $result = mysqli_query($db, "SELECT * FROM `s_order` WHERE `status` = 0 LIMIT 50");
    while( $order = mysqli_fetch_array($result) )
    {
    
        $result_user = mysqli_query($db, "SELECT * FROM `s_order_shippingaddress` WHERE `orderID` = ".$order['id']);
        $user = mysqli_fetch_array($result_user);
    
        $result_country = mysqli_query($db, "SELECT * FROM `s_core_countries` WHERE `id` = ".$user['countryID']);
        $country = mysqli_fetch_array($result_country);
    
        print "<b>";
        print $order['ordernumber']." - ";
        print $user['firstname']." ";
        print $user['lastname']." - ";
        print $user['city'].", ";
        print $country['countryiso']."";
    
        print "</b> ";
        print "<input type=number style=font-size:20px;width:100px;float:right>";
        if ($order['cleared']=="17") print " <div color=red style=float:right;color:red;>O&nbsp;</div>"; //Zahlung Offen
    
        $result_magna = mysqli_query($db, "SELECT * FROM `magnalister_orders` WHERE `current_orders_id` = ".$order['id']);
        $magna = mysqli_fetch_array($result_magna);
        if ($magna['platform'])  print " <div style=float:right;color:blue;>".strtoupper(substr($magna['platform'],0,1))."&nbsp;</div>"; //Platform Import
        print "<br>";
        
    
        $result_orders = mysqli_query($db, "SELECT * FROM `s_order_details` WHERE `orderID` = ".$order['id']);
        while($orders = mysqli_fetch_array($result_orders) )
        {
        print "&nbsp; &bull; ".$orders['quantity']." x ";
        print $orders['articleordernumber']." ";
        print $orders['name']." ";
        print "</br>";
    
    //  echo "<pre>"; print_r($magna); echo "</pre>";
        }
    
        print "<hr><br>";
    
    }
    
    print "</font></body></html>";
    mysqli_close($db);
    

     

  • MossiMossi MemberComments: 1 Received thanks: 0 edited August 14 Member since: September 2016

    Hallo Herr Fuchs,

    ich habe mir erlaubt das Script etwas zu erweitern, so dass der Ebay-Name noch mit angezeigt wird.

    <?php
    //error_reporting(0);
    $config=include("config.php");
    $db = mysqli_connect($config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['dbname']);
    if (!$db) {
        die('MySQL Error: ' . mysql_error());
    }
    
    print "<html><body style=width:600px;font-size:12px;><font face=arial>";
    
    $result = mysqli_query($db, "SELECT * FROM `s_order` WHERE `status` = 0 LIMIT 50");
    while( $order = mysqli_fetch_array($result) )
    {
    
        $result_user = mysqli_query($db, "SELECT * FROM `s_order_shippingaddress` WHERE `orderID` = ".$order['id']);
        $user = mysqli_fetch_array($result_user);
    
        $result_country = mysqli_query($db, "SELECT * FROM `s_core_countries` WHERE `id` = ".$user['countryID']);
        $country = mysqli_fetch_array($result_country);
    
        print "<b>";
        print $order['ordernumber']." - ";
        print $user['firstname']." ";
        print $user['lastname']." - ";
        print $user['city'].", ";
        print $country['countryiso']."";
    
        print "</b> ";
        print "<input type=number style=font-size:20px;width:100px;float:right>";
        if ($order['cleared']=="17") print " <div color=red style=float:right;color:red;>O&nbsp;</div>"; //Zahlung Offen
    
        $result_ebayname = mysqli_query($db, "SELECT * FROM `s_order` WHERE `id` = ".$order['id']);
        $ebayname = mysqli_fetch_array($result_ebayname);
        if ($ebayname['internalcomment'])  print " <div style=float:right;color:green;>".substr($ebayname['internalcomment'],102,20)."&nbsp;</div>";
     //Ebayname Import
    
        $result_magna = mysqli_query($db, "SELECT * FROM `magnalister_orders` WHERE `current_orders_id` = ".$order['id']);
        $magna = mysqli_fetch_array($result_magna);
        if ($magna['platform'])  print " <div style=float:right;color:blue;>".strtoupper(substr($magna['platform'],0,1))."&nbsp;</div>"; //Platform Import
        print "<br>";
        
    
        $result_orders = mysqli_query($db, "SELECT * FROM `s_order_details` WHERE `orderID` = ".$order['id']);
        while($orders = mysqli_fetch_array($result_orders) )
        {
        print "&nbsp; &bull; ".$orders['quantity']." x ";
        print $orders['articleordernumber']." ";
        print $orders['name']." ";
        print "</br>";
    
    //  echo "<pre>"; print_r($magna); echo "</pre>";
        }
    
        print "<hr><br>";
    
    }
    
    print "</font></body></html>";
    mysqli_close($db);
     
    

     

  • Erich FuchsErich Fuchs MemberComments: 12 Received thanks: 14 Member since: October 2014

    cool

Sign In or Register to comment.