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:
The manage_body.pre.tpl contains:
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.
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).
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.
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…
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.