Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Auto update Order Status via barcode on invoice

    1.3.8a - I know, we are upgrading soon

    The code I'm working on should auto update the order_status when a barcode on an invoice is scanned into a text box.

    I have placed this in admin/includes/header.php as I would like it visible always and mainly viewing admin home.
    Also have "admin home" refresh when the order is updated with the cursor always ready to go in that checkbox if initially clicked there.

    Here's the code I have based on super_orders id text box though a bit stuck. While in super_orders viewing an order, it's changing the dropdown to order_status 2? The input_field itself does nothing up in the header.
    Any suggestions?

    PHP Code:
    <?php
            
    echo zen_draw_input_field('oID''''size="6"');
                    echo 
    zen_draw_hidden_field('oID'$oID);
                
    $db->Execute("UPDATE " TABLE_ORDERS " SET orders_status_id='2' where orders_id='".$oID."'");
                    echo 
    '</form>'?>

  2. #2
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Auto update Order Status via barcode on invoice

    I have recoded this, which breaks the behavior of the status displaying "2" in the dropdown menu.

    I do think this is the wrong direction as I believe the previous code was actually updating the order to status "2", but not updating the order status history that is desired.

    Thoughts?

    PHP Code:
    <?php
                      
    echo zen_draw_form('auto_update''/index.php''''get'''true);
                      echo 
    zen_draw_input_field('auto_update''''size="6"');
                      echo 
    zen_draw_hidden_field('auto_update'$oID);
                     
    ?>
                     <?php
                      
    {
            if(isset(
    $_POST['auto_update']) ){ 
                      
    $orders_history $db->Execute("UPDATE ".TABLE_ORDERS." SET orders_status='4' where orders_id='".$oID."'");
                                               }
                      }
                      
    ?>
                      <?php
                      
    echo '</form>'?>

  3. #3
    Join Date
    Jan 2007
    Posts
    1,484
    Plugin Contributions
    10

    Default Re: Auto update Order Status via barcode on invoice

    Hmmm, I like where you are going with this since we are about to add barcodes to our warehouse fulfillment process and auto updating by scanning a barcode would be nice. But I would want it to send the email, too, so there's more to it than that. I'll have a think about this and try a few things out this coming weekend. I don't have time during the week to work on much code development anymore. Thanks for getting the conversation started!

    Zen Cart and it's community are the best!!

  4. #4
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Auto update Order Status via barcode on invoice

    excellent great hopeful move forward - default behavior of the comments is that the email notification is set to true. I have changed that to false.

    Where I am stuck is that the 1st post is more correct - it needs the following to update the page and engage the form field.
    PHP Code:
    echo zen_draw_form('auto_update''/index.php''''get'''true); 
    The code is making the dropdown status update to that status, just not updating the status_history. When I swap table_orders for table_orders_status_history and orders_status to include _id, ALL the previous statuses change to that ID.

    It needs to still update the order and INSERT a new status as if I hit the update button on super_orders
    PHP Code:
    <?php echo zen_image_submit('button_update.gif'IMAGE_UPDATE); ?>
    After the page refreshes, the cursor disappears from the form. Would need it to stay there ready to accept another scan.

    Automation is the key to expediency!

  5. #5
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Auto update Order Status via barcode on invoice

    For the barcode, I used this and it was extremely easy and effective

    http://www.ladyada.net/library/zencart/barcodeinv.html

    We currently use it in super_orders for the shipper to "bleep" the order in and go to that order instantaneously.

  6. #6
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Auto update Order Status via barcode on invoice

    Very frustrating - I got this to work minus having the order_status_name appear in the history, it was a blank box.

    Now that I come back to it later tonight - nothing works at all - what gives?!

    PHP Code:
    <td align="left" valign="middle"><?php
                      
    echo zen_draw_form('auto_update''/index.php''''get'''true);
                      echo 
    zen_draw_input_field('auto_update''''size="6"');
                      echo 
    zen_draw_hidden_field('auto_update'$oID);
                      
    // the order status name is blank on the update
            
    if(isset($_POST['oID']) ){ 
                      
    $orders_status $db->Execute("UPDATE " TABLE_ORDERS " SET orders_status='4' where orders_id='" $oID "'");
                      
                      
    $orders_status_history $db->Execute("INSERT into " TABLE_ORDERS_STATUS_HISTORY "
                          (orders_id, orders_status_id, date_added, customer_notified, comments)
                          values ('" 
    . (int)$oID "',
                          '" 
    zen_db_input($status) . "',
                          now(),
                          '" 
    zen_db_input($customer_notified) . "',
                            (SELECT IFNULL(admin_initials, '') FROM admin WHERE admin_id='" 
    .$_SESSION["admin_id"] ."'))");            
                      }
                      
    ?>
                      <?php
                      
    echo '</form>'?>
                    <br />Update to Pulled</td>
        </td>

  7. #7
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: Auto update Order Status via barcode on invoice

    ANSWER - POST needs to be GET

    It works again.

    So anyone know why the order_status_name is not populating upon the update?

 

 

Similar Threads

  1. v154 Scan Barcode > Post Order Update
    By ShopVille in forum General Questions
    Replies: 14
    Last Post: 12 Sep 2015, 02:41 AM
  2. Can you auto update the order status?
    By ricky_moore in forum Managing Customers and Orders
    Replies: 3
    Last Post: 11 Jan 2011, 05:35 PM
  3. Change Email Subject of Status Update Messages e.g. Order Update XXXX
    By apemusic in forum Managing Customers and Orders
    Replies: 4
    Last Post: 13 Oct 2010, 08:42 AM
  4. Auto Order Status update?
    By Diddyo in forum General Questions
    Replies: 3
    Last Post: 25 Jul 2010, 05:14 AM
  5. invoice deleted on update of status
    By alghazn in forum Managing Customers and Orders
    Replies: 5
    Last Post: 2 Nov 2007, 09:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR