osCmax v2.5 User Manual
Results 1 to 7 of 7

help with order listings in admin

This is a discussion on help with order listings in admin within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; does anyone know a neat way to add a input text field next to each order listing in admin->customers->orders (perhaps ...

      
  1. #1
    Senior Member blackhawk's Avatar
    Join Date
    Aug 2009
    Location
    indiana
    Posts
    640
    Blog Entries
    1
    Rep Power
    27


    Question help with order listings in admin

    does anyone know a neat way to add a input text field next to each order listing in admin->customers->orders (perhaps right after the status column) All for the purpose of showing custom details per order initially without having to go into "details" and viewing the details of that order?

    I would eventually figure out how to show that custom order note on the details page in addition to the regular comments built into oscmax.

    The status column is nice, its just that every order will have something different about it that you would just want to jot or note on the fly.

    thanks
    bh

  2. #2
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: help with order listings in admin

    Have you had a look at:

    osCommerce Community Add-Ons

    or this one which sounds perfect - although on inspection you will need to look at v1.0 first and then do the changes in the subsequent posts afterwards. Very simple install (at first glance!)

    osCommerce Community Add-Ons

    Regards,
    Last edited by pgmarshall; 12-30-2009 at 10:46 AM.
    pgmarshall
    _______________________________

  3. #3
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: help with order listings in admin

    Blackhawk,

    If you use the second contibution I posted which looks the best then you should be able to see the comments are you mentioned.

    However, you will not be able to see the comments on the summary page of orders.php. You should see the comments when you highlight the order line.

    If you want to see the comments in the summary then you will have to JOIN the query to the new admin_comments table to get it to show up ... should be fairly simple ...

    If you get it to work ... please post back your work as I think it might make a nice addition to version 2.1.

    Regards,
    pgmarshall
    _______________________________

  4. #4
    Senior Member blackhawk's Avatar
    Join Date
    Aug 2009
    Location
    indiana
    Posts
    640
    Blog Entries
    1
    Rep Power
    27


    Default Re: help with order listings in admin

    thanks PG the only problem with these contributions that you still cannot write a custom note or comment on the orders listing page on the fly....still have to open up every order to write a comment.

  5. #5
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: help with order listings in admin

    Can't you install the second one and then simple duplicate the code into the different part of orders.php?

    <?php
    $admin_comments_query = tep_db_query("select orders_id, date_added, comments from admin_comments where orders_id = '" . tep_db_input($oID) . "' order by date_added");
    if (tep_db_num_rows($admin_comments_query)) {
    while ($admin_history = tep_db_fetch_array($admin_comments_query)) {
    echo ' <tr>' . "n" .
    ' <td class="smallText" align="center">' . tep_datetime_short($admin_history['date_added']) . '</td>' . "n" .
    ' <td class="smallText">' . nl2br(tep_db_output($admin_history['comments'])) . '&nbsp;</td>' . "n" .
    ' </tr>' . "n";
    }
    } else {
    echo ' <tr>' . "n" .
    ' <td class="smallText" colspan="2">No Admin Comments.</td>' . "n" .
    ' </tr>' . "n";
    }
    ?>
    </table></td>
    </tr>
    <tr>
    <td><?php echo tep_draw_form('status', FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=update_admin_comments'); ?>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="main">
    <tr>
    <td class="main"><b>Admin Comments</b></td>
    </tr>
    <tr>
    <td><?php echo tep_draw_textarea_field('admin_comments', 'soft', '60', '5'); ?></td>
    </tr>
    <tr>
    <td><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
    </tr>
    </table></form></td>
    </tr>
    </table></td>
    </tr>
    </table>
    The above seems to do most of it ... just get it to display outside of the if action=edit bit of the page ... For example you could put them in the preview info box on the right hand side of the page ...

    Regards,
    pgmarshall
    _______________________________

  6. #6
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: help with order listings in admin

    After line 529:

    Code:
    $contents[] = array('text' => '<br>' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
    Run the query:

    Code:
    $admin_comments_query = tep_db_query("select orders_id, date_added,  comments from admin_comments where orders_id = '" . tep_db_input($oID) .  "' order by date_added");
        if (tep_db_num_rows($admin_comments_query)) {
          while ($admin_history = tep_db_fetch_array($admin_comments_query))  {
    Shove the text into the $content infobox:

    Code:
    $contents[] = array ('text' => '<td>' . nl2br(tep_db_output($admin_history['comments'])) . '</td>');
    } else {
    $contents[] = array ('text' => '<td>No Comments</td>');
    Then you need to add back in the ability to add your comments:

    Code:
    <?php echo tep_draw_form('status', FILENAME_ORDERS,  tep_get_all_get_params(array('action')) .  'action=update_admin_comments'); ?> 
    
     $contents[] = array ('text' => '<tr><td><?php echo  tep_draw_textarea_field("admin_comments", "soft", "60", "5");  ?></td>
                              </tr><tr> <td><?php echo  tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
                              </tr>
                            </form>
    Since I have not tried this out - you will need to clean up the syntax ... switch a few " ' etc. But it should work ... I think!

    Regards,
    pgmarshall
    _______________________________

  7. #7
    Senior Member blackhawk's Avatar
    Join Date
    Aug 2009
    Location
    indiana
    Posts
    640
    Blog Entries
    1
    Rep Power
    27


    Default Re: help with order listings in admin

    Thank PG you are the man. I will try out your code shortly. I looked at this post today. I built a custom field in my orders table to called 'paid_status.' its being called from the orders.php page in the admin and has a <form> element within a new <td> column to the right of the "Action" column.

    so my order list looks like

    Order ID | Customers | Order Total | Date Purchased | Status | Action | Paid Status

    6005 | bill frank | $500.00 | 02/... | SHIPPED | > | this order is paid for


    along with the database field called "paid status" i modified a section of my orders.php page to look like this starting around line 899....

    Code:
     
    
    if (isset($orders['paid_status']) && $orders['paid_status']!= ''){ $pstatusshown = $orders['paid_status']; } else { $pstatusshown = ''; }
    $pstatusshown = $orders['paid_status']; $paidorderidrow = strip_tags($orders['orders_id']);
    if (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { //echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '\'">' . "\n"; echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n"; } else { //echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '\'">' . "\n"; //BLACKHAWK - custom - eliminate the row being an entire link so that we can input text into the paid status field echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n"; } ?> <tdclass="dataTableContent"><?phpecho strip_tags($orders['orders_id']); ?></td> <tdclass="dataTableContent"><?phpecho '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $orders['customers_name']; ?></td> <tdclass="dataTableContent"align="right"><?phpecho strip_tags($orders['order_total']); ?></td> <tdclass="dataTableContent"align="center"><?phpecho tep_datetime_short($orders['date_purchased']); ?></td> <tdclass="dataTableContent"align="right"><?phpecho $orders['orders_status_name']; ?></td> <tdclass="dataTableContent"align="right"><?phpif (isset($oInfo) && is_object($oInfo) && ($orders['orders_id'] == $oInfo->orders_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td> <tdclass="dataTableContent"align="right"><?php
    if (isset($_GET[$paidorderidrow])){
    tep_db_query(
    "update " . TABLE_ORDERS . " set paid_status = '" .$_GET[$paidorderidrow]. "' where orders_id = '" .$paidorderidrow. "'");
    $pstatusshown = $orders['paid_status']; }
    print '<a name="'.strip_tags($orders['orders_id']).'"></a>'; print '<form name="paidstatus_'.strip_tags($orders['orders_id']).'" action="'.$PHP_SELF.'#'.strip_tags($orders['orders_id']).'" method="get">';
    print '<input type="hidden" name="page" value="'.$HTTP_GET_VARS['page'].'" />'; print '<input ';
    if (isset($_GET[$paidorderidrow])) print 'style="background: #b0b0b0;';
    print 'type="" maxlength="50" name="'.$paidorderidrow.'" size="6" value="'.$pstatusshown.'">'; print '<input type="submit" value="u" />';
    print '</form>';
    print '<form name="reresh" action="'.$PHP_SELF.'#'.strip_tags($orders['orders_id']).'" method="get">'; print '<input type="hidden" name="page" value="'.$HTTP_GET_VARS['page'].'" />';
    print '<input type="submit" value="r" />'; print '</form>'; ?> </td> </tr> <?php }
    ?>
    It's not pretty but it works. But the only fus i got is that I need to have 2 form fields becuase after getting values from the first form, the input box does not show the value right away eventhough the value is stored in the database. So i have to have 2nd form called refresh to then show the value in the input box.

    If your post can do better than this, i'll wash your car!

    -blackhawk
    Last edited by blackhawk; 02-22-2010 at 04:38 PM.

Similar Threads

  1. Homepage Listings
    By idllc in forum osCMax v2 Features Discussion
    Replies: 0
    Last Post: 06-02-2008, 08:57 AM
  2. images in catalog listings
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 10-18-2007, 07:00 AM
  3. Module Display Order Matches Sort Order in Admin
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 08-09-2007, 03:26 AM
  4. Add Quantity to Listings
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 06-13-2007, 07:12 AM
  5. Catalog Listings - Add pictures?
    By AJ in forum osCommerce 2.2 Modification Help
    Replies: 5
    Last Post: 03-11-2003, 12:53 AM

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
  •