Jump to content

[Resolved] Additional columns in Dashboard


jka
 Share

Recommended Posts

The table may get ridiculously messy if orders could have an unlimited (however impractical as that may be) number of items per order.

Do you have an idea of how you would want the desired info to be displayed?

For example, edit any order by adding a Note on the Notes tab. Save, then look at the Dashboard, Unsettled Orders tab. You should now see an icon that, when the mouse hovers over it, will show a "tooltip" containing the Note's content.

That could be done for the inventory of the order.

Link to comment
Share on other sites

Let's try the above.

In /admin/sources/dashboard.index.inc.php, near line 204, find:

$GLOBALS['smarty']->assign('ORDERS', $orders);

ABOVE that, add:

/* Adds order inventory to dashboard Unsettled Orders table */
	if (($order_inventory = $GLOBALS['db']->select('CubeCart_order_inventory', '`cart_order_id`,`product_code`,`quantity`', array('cart_order_id' => $cart_order_ids))) !== false) {
		foreach ($order_inventory as $inventory) {
			$order_items[$inventory['cart_order_id']]['items'][] = $inventory;
		}
		$orders = merge_array($orders, $order_items);
	}
/**/


In /admin/skins/default/templates/dashboard.index.php, near line 164, find:

{if isset($order.notes)}

ABOVE that, add:

<!-- If any items, adds order inventory to dashboard Unsettled Orders table -->
                  {if isset($order.items)}
                  <a href="?_g=orders&action=edit&order_id={$order.cart_order_id}&source=dashboard#order_inventory" title="{foreach $order.items as $item}{$item.quantity}{" x "}{$item.product_code}{"\r\n"}{/foreach}"><i class="fa fa-shopping-cart" alt="{$LANG.common.items}"></i></a>
                  {/if}
<!-- -->

 

Link to comment
Share on other sites

  • 5 months later...

Try this:

In /admin/sources/dashboard.index.inc.php, near line 216, find:

$unsettled_orders = $GLOBALS['db']->select('CubeCart_order_summary', array('cart_order_id', 'name', 'first_name', 'last_name', 'order_date', 'customer_id', 'total', 'status'), 'status IN (1,2) OR `dashboard` = 1', '`dashboard` DESC, `status` DESC,`order_date` ASC', $results_per_page, $page);

Change to:
$unsettled_orders = $GLOBALS['db']->select('CubeCart_order_summary', false, 'status IN (1,2) OR `dashboard` = 1', '`dashboard` DESC, `status` DESC,`order_date` ASC', $results_per_page, $page);
In the admin template dashboard.index.php, near line 165, find:

<a href="{$order.link_print}" class="print" target="_blank" title="{$LANG.common.print}"><i class="fa fa-print" title="{$LANG.common.print}"></i></a>
<a href="?_g=orders&action=edit&order_id={$order.cart_order_id}&source=dashboard" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
<a href="?_g=orders&delete={$order.cart_order_id}&source=dashboard" class="delete" title="{$LANG.notification.confirm_delete}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>

Add after:
{if $order.customer_comments ne ""}<i class="fa fa-file-text-o" title="{$order.customer_comments}"></i>{/if}

The first edit grabs all the columns from the Order Summary database table (instead of just that which is required - for easy future expansion). The second edit tests for the presence of Customer Comments and if any, creates an icon. Hovering the mouse cursor over this icon will show the contents of the Customer Comments (up to a browser limit, I suppose).

Link to comment
Share on other sites

Sorry to bother you again, i am trying to get the customer notes and internal notes to appear on the "orders" page like they do on the unsettled dashboard page.

 

I have the following  inserted in to the orders.index.php and the customer notes appear, but the internal notes dont work.

 

               <td>
                  <a href="{$order.link_print}" class="print" target="_blank" title="{$LANG.common.print}"><i class="fa fa-print" title="{$LANG.common.print}"></i></a>
                  <a href="?_g=orders&action=edit&order_id={$order.cart_order_id}&source=dashboard" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
                  <a href="?_g=orders&delete={$order.cart_order_id}&source=dashboard" class="delete" title="{$LANG.notification.confirm_delete}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>
                  {if $order.customer_comments ne ""}<i class="fa fa-file-text-o" title="{$order.customer_comments}"></i>{/if}
                  {if isset($order.notes)}
                  <a href="?_g=orders&action=edit&order_id={$order.cart_order_id}&source=dashboard#order_notes" title="{foreach $order.notes as $note}{$note.time} {$note.content}{"\r\n"}{/foreach}"><img src="{$SKIN_VARS.admin_folder}/skins/{$SKIN_VARS.skin_folder}/images/note.png" alt="{$LANG.common.notes}"></a>
                  {/if}
               </td>

 

i think i need to make a change in the orders.index.inc.php but i cant quite understand that one

 

Link to comment
Share on other sites

Please make these edits:

In the admin template orders.index.php, near line 52, find:

               <td>
                  <a href="{$order.link_print}" class="print" target="_blank" title="{$LANG.common.print}"><i class="fa fa-print" title="{$LANG.common.print}"></i></a>
                  <a href="{$order.link_edit}" class="edit" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
                  <a href="{$order.link_delete}" class="delete" title="{$LANG.notification.confirm_delete}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>
               </td>

Change to:

               <td{* align="center" *}>
                  <a href="{$order.link_print}" class="print" target="_blank" title="{$LANG.common.print}"><i class="fa fa-print" title="{$LANG.common.print}"></i></a>
                  <a href="{$order.link_edit}" class="edit" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
                  <a href="{$order.link_delete}" class="delete" title="{$LANG.notification.confirm_delete}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>
{if $order.customer_comments ne ""}<i class="fa fa-comment-o" title="{$order.customer_comments}"></i>{/if}
{if isset($order.notes)}<a href="?_g=orders&action=edit&order_id={$order.cart_order_id}#order_notes" title="{foreach $order.notes as $note}{$note.time} {$note.content}{"\r\n"}{/foreach}"><i class="fa fa-file-text-o"></i></a>{/if}
               </td>

In the file /admin/sources/orders.index.php, near line 705, find:

foreach ($orders as $order) {

Change to:

foreach ($orders as $order) { $cart_order_ids[] = "'".$order['cart_order_id']."'";

Near line 718, find:

			$smarty_data['list_orders'][] = $order;
		}

		$GLOBALS['smarty']->assign('ORDER_LIST', $smarty_data['list_orders']);

Change to:

			$smarty_data['list_orders'][$order['cart_order_id']] = $order; // $smarty_data['list_orders'][] = $order;
		} if (($notes = $GLOBALS['db']->select('CubeCart_order_notes', '`cart_order_id`,`time`,`content`', array('cart_order_id' => $cart_order_ids))) !== false) { foreach ($notes as $note) { $order_notes[$note['cart_order_id']]['notes'][] = $note; } $smarty_data['list_orders'] = merge_array($smarty_data['list_orders'], $order_notes); }

		$GLOBALS['smarty']->assign('ORDER_LIST', $smarty_data['list_orders']);

The placement of some of the new code is odd in that it sits on existing lines of code. I did this so that line numbers do not get changed. PHP will run fine with code written that way - but it is hard for a human to parse.

I used the "comment" symbol to indicate there exists a customer comment, and the "text file" symbol to indicate internal notes. You may want to change the symbols used on the Dashboard list to match.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...