Display stock count on admin order detail page

I like to display the stock count on order detail page.



I asked the Help Desk for advise, and they said it would be a custom development. That means it costs me.

Whenever I ask them for help, it always is a custom development.



Any hint will be appreciated.

So when the admin is reviewing an order, they’ll also see the remaining stock?



The steps to implement this:



In the file “ontrollers/admin/orders.php” find this code (around line 353):


foreach ($order_info['items'] as $n=>$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;
}
}




replace it with this:


foreach ($order_info['items'] as $n=>$v) {
$order_info['items'][$n]["remaining"] = db_get_field("SELECT amount FROM ?:products WHERE product_id = ?i", $v['product_id']);
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;
}
}




In the file “/skins/basic/admin/views/orders/details.tpl” find this code (around line 203):

```php


{$oi.amount}

{if $settings.General.use_shipments == "Y" && $oi.shipped_amount > 0}
({$oi.shipped_amount} {$lang.shipped})
{/if}

```

replace it with this:
```php

{$oi.amount} ({$oi.remaining})

{if $settings.General.use_shipments == "Y" && $oi.shipped_amount > 0}
({$oi.shipped_amount} {$lang.shipped})
{/if}

```

Enjoy.

Thank you very much!

It is perfectly working.



I have one more question.

Which file should I modify for the page when you click “New shipment” link?

I want to display it in this page as well.

I’d have to track that one down. Perhaps another good developer would be willing to help out here.