Adding MPN to Product Manage (Overview) Page

Hi All,

I am attempting to include the MPN (product feature) field on the general Product Manage (overview) page in the administration panel. By default the product manage page shows the following fields:

Image, Name (including product code), Price ($), List price ($), Quantity, Status

However it would be nice to add the MPN field to this list to make it easier to bulk update when adding new products (other fields may also be useful but getting one to work first is the first step)!

I have created two files in the skins/(skin_name)/admin/addons/my_changes/hooks/products folder they are:





The manage_head.pre.tpl contains:

```<br />
<br />
The manage_body.pre.tpl contains:<br />
<br />
<input type="text" name="products_data[{$product.product_id}][product_features][10]" size="6" value="{$product.product_features[10].value}" class="input-text" />
```<br />
<br />
Everything works perfectly except that the value on the input box in manage_body.pre.tpl is blank rather than having the MPN value of that product.  However the field saves perfectly to the database so I know the name of the input box is correct.<br />
<br />
So the question is does anyone know what the value should be in order to display the MPN rather than having a blank box each time the page loads?  I would appreciate any help anyone can offer.  If you have any questions feel free to ask and I will do my best to help the best I can (I hope I explained everything in a way that is understandable).<br />
<br />
I have tried to switch debug mode on, however the debug popup works on other pages but not on the Products Manager page (typical!).  I do also realise this isn't the best way to do this modification as the feature number could possibly change, again any help is appreciated.<br />
<br />
Thanks all for your time.

Try sticking in this code in your template to see what is in the p.roduct_features array:

I'm going to guess that you want 'variant' rather than 'value'.

[quote name='tbirnseth' timestamp='1321146920' post='125851']

Try sticking in this code in your template to see what is in the p.roduct_features array:

I'm going to guess that you want 'variant' rather than 'value'.


Thanks for the reply, I have tried the code and get empty

 tags… do you think it's a possability that the product features don't get passed onto the product overview screen?  I still don't understand why I can save to the product features from this screen though if that is the case…

I may be right… I just added

to the template to see everything under the $product array and got:



[product_id] => 817

[product_code] => B00078MG5M

[product_type] => P

[status] => A

[company_id] => 0

[list_price] => 10.00

[amount] => 36

[weight] => 0.00

[tracking] => B

[is_edp] => N

[product] => 100% Cotton Adult/Youth Beefy T-Shirt by Hanes (Style# 5180)

[price] => 4.50

[company_name] =>

[main_pair] => Array


[pair_id] => 28

[image_id] => 41

[detailed_id] => 42

[icon] => Array


[image_path] => /images/product/0/B00078MG5M.01-A391PJ63CYO2ZE.SCMZZZZZZZ.jpg

[alt] => B00078MG5M.01-A391PJ63CYO2ZE.SCMZZZZZZZ.jpg

[image_x] => 120

[image_y] => 120

[http_image_path] => /images/product/0/B00078MG5M.01-A391PJ63CYO2ZE.SCMZZZZZZZ.jpg

[absolute_path] => /home/ukp/public_html/dev/images/product/0/B00078MG5M.01-A391PJ63CYO2ZE.SCMZZZZZZZ.jpg

[is_flash] => 0


[detailed] => Array


[image_path] => /images/detailed/0/B00078MG5M.01-A391PJ63CYO2ZE.SCLZZZZZZZ.jpg

[alt] => B00078MG5M.01-A391PJ63CYO2ZE.SCLZZZZZZZ.jpg

[image_x] => 195

[image_y] => 300

[http_image_path] => /images/detailed/0/B00078MG5M.01-A391PJ63CYO2ZE.SCLZZZZZZZ.jpg

[absolute_path] => /home/ukp/public_html/dev/images/detailed/0/B00078MG5M.01-A391PJ63CYO2ZE.SCLZZZZZZZ.jpg

[is_flash] => 0



[base_price] => 4.50

[selected_options] => Array



[has_options] => 1

[discounts] => Array


[A] => 0

[P] => 0


[qty_content] => Array



[detailed_params] => Array


[get_icon] => 1

[get_detailed] => 1

[get_options] =>

[get_discounts] =>

[get_features] =>

[get_extra] =>

[get_for_one_product] =>



I think this means no features are being passed over - any ideas on how to add this (but still use my_changes rather than editing core code directly)? Thanks again for all of your help so far.

You are correct.

There are two ways to include features in the admin search. One is easy, the other is harder (but more efficient). The easy way is to add the hook for 'get_products_post' to your my_changes area and then loop through the products getting the features for each and applying them to the array of products that were retrieved via the fn_get_products() query (I.e. $products[$product_id]['product_features']).

The more difficult but efficient way is to use the 'get_products' hook and ensure the appropriate JOINS, FIELDS and CONDITIONS are set appropriately BEFORE the initial DB query is done.

Since this is admin only, I'd probably use the easy way since performance is not your top requirement, but functionality is.