Display supplier on each order line item in admin

When the supplier addon is active, each order line item (product) should display the supplier in the admin area:


  1. on the general tab in view order (orders.details);
  2. on the third step in editing orders (order_management.totals).
  3. on the shipment details page (shipments.details)



    Bob

You can vote for this suggestion in the Ideas forum:

[url]http://cscart.uservoice.com/forums/40782-general/suggestions/702934-admin-display-supplier-on-each-order-line-item[/url]



Bob

[quote name=‘jobosales’]When the supplier addon is active, each order line item (product) should display the supplier in the admin area:


  1. on the general tab in view order (orders.details);
  2. on the third step in editing orders (order_management.totals).
  3. on the shipment details page (shipments.details)



    Bob[/QUOTE]



    I’ve wanted #1 on this list for a while and you reminded me of it, so I did it. #2 and #3 should be easy also, I just don’t really need them at this time.



    Find this code in the “controllers/admin/orders.php” file, in the “elseif ($mode == ‘details’ && !empty($_REQUEST[‘order_id’]))” section:



foreach ($order_info['items'] as $v) {
if (!empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y') {
Registry::set('navigation.tabs.downloads', array (
'title' => fn_get_lang_var('downloads'),
'js' => true
));
$view->assign('downloads_exist', true);
break;
}
}




and change it to this code:



foreach ($order_info['items'] [COLOR="Red"]as $k => $v[/COLOR]) {
if (!empty($v['extra']['is_edp']) && $v['extra']['is_edp'] == 'Y') {
Registry::set('navigation.tabs.downloads', array (
'title' => fn_get_lang_var('downloads'),
'js' => true
));
$view->assign('downloads_exist', true);
break;
}

[COLOR="Red"]// CUSTOM FOR SUPPLIER INFORMATION ON PRODUCT DETAILS
if ($v['extra']['supplier_id'] != '0') {
$order_info['items'][$k]['supplier_name'] = db_get_field('SELECT company FROM ?:users WHERE user_id = ?i', $v['extra']['supplier_id']);
}[/COLOR]
}




Then in the “skins/basic/admin/views/orders/details.tpl” file change:



{if $oi.deleted_product}{$lang.deleted_product}{else}{$oi.product|unescape}{/if}




to this:



{if $oi.deleted_product}{$lang.deleted_product}{else}{$oi.product|unescape}[COLOR="Red"]{if $addons.suppliers.status == 'A' && $oi.supplier_name != ''} ({$oi.supplier_name|unescape}){/if}[/COLOR]{/if}




Yes, I know. I was lazy and just put some spaces between the product name and the supplier name. I didn’t feel like using a CSS span with padding for this, besides, it’s just so I can tell what products go with what supplier on large orders and for products that have the same name across different suppliers.



An aside:



I’ve made other changes to the admin also. For example I list the carrier and tracking number for all shipments on the order under the “Shipping information” for quick reference and they are hyper-linked to open a new window to the tracking page of the carrier. I also removed the meaningless old shipping tracking entry box that used to be there. I use the shipments addon (which I believe should be standard functionality anyway), and with it the old method is archaic. If you want me to post that code also I will.



Edit: Altered the second code change so it has an error check to make sure the supplier addon is active and that the current item has a supplier.



Note: This pulls the supplier’s name from the “company” field in the supplier’s user profile. Make sure the company name is the name of the supplier.

Thanks for posting the mod, adorick.



I am in total agreement that they should use the shipments logic and rework the old “Shipping Information” display. Please post your solution in a new thread and I will add it to the Ideas forum requesting inclusion in a future release.



Bob