开发者

K2 Back-End Item Table

could someone help me, i'd like to add开发者_如何学Python an extrafield of price for each item at the back-end item list table of K2.

I know html and css and a very little about php, I need to know which files and line to edit.

Thanks.

K2 Back-End Item Table


You should be able to do an admin template override. You'd need to make a copy of this file -

/Joomla folder/administrator/components/com_k2/views/items/tmpl/default.php

Put the copy here -

/Joomla folder/administrator/templates/your admin template/html/com_k2/items/default.php

Edit this file to include the extra field. Including a single extra field is a little trick some times because of the way extra fields are stored in the DB. All extra fields are retrieved from the DB as an array so if you want to display a specific extra field you would need to know the index of the value you want to display. For any extra field you can access the label with $item->extra_fields[X]->name and the value with $item->extra_fields[X]->value where X is the index of the field you want. Keep in mind that indexes start at 0 and they will vary depending on the extra field group.

Also keep in mind that changes you make to this file are universal. Making this change will add that column to the item manager regardless of the category.

One last thing - the query used to select the items for the item manager might not include the extra fields field. If that is the case, then you will have to hack the K2 core to change the query to include that field. This is a pretty bad idea because any update to K2 will likely wipe out your hack and you'd have to put it back in every time there is an update.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜