问题
How to add a custom text field in Magento v1.5 Catalog/Mange products/General tab in admin panel? please help me if any body have expertise on this..
回答1:
Since Magento maintains Catalog Product as EAV structure, so it will be best (in the interest of Magento functionality & feasibility) to provide the text field as an attribute in the General Tab
of Catalog Product details page in the Admin section.
We will go through step by step process of adding an attribute to all the Products:-
- Go to the "
Manage Attributes
" page (Main Menu
>Catalog
>Attributes
>Manage Attributes
), to find the list of all the available Catalog Attributes. - Click the "
Add New Attribute
" button to add a new attribute. Provide the following in the form (Word of Caution: Don't try to change any of the properties in this Attribute details page, unless you are sure of what you are doing.):-
- First we will fill up the required fields for the tab "
Properties
". - Provide your Attribute Code, in the "
Attribute Code
" field. - Let the "
Catalog Input Type
" be "Text Field
", as you wanted to have text field only. - If you want to pre-populate this text field with any value, then you will need to provide that text in the "
Default Value
" field. - If you want to provide this attribute to all the product types, then you need not change the value of the "
Apply To
" dropdown (which by default is "All Product Types
"). Otherwise you can change this value to "Selected Product Types
" & automatically a list of all the available Magento Product Types will appear in another dropdown, from where you need to select your required product types for this attribute. For the "
Visible on Product View Page on Front-end
" field, you need to select the value "Yes
", if you want this text field to appear in the front-end Product details page.Now we will fill the tab "
Manage Label/Options
", in the left hand panel. Click on that tab to open that tab's details page.- Provide the label in both the fields available which will be shown both in the front-end & in the admin section.
- First we will fill up the required fields for the tab "
- Click the "
Save Attribute
" button to add this attribute. - Magento will provide a notice that you need to re-index one / two Indexes from the "
Index Management
" section, with the link of this section provided. - Click on that link to go to the "
Index Management
" section & re-index those indexes which are marked in red. - Now go to the "
Manage Attribute Sets
" page (Main Menu
>Catalog
>Attribute
>Manage Attribute Sets
). - Click on the "
Default
" row of the Set Name, to view its details page. - Open the FTP or your local Explorer, to go inside the "
var
" folder. - Delete the "
cache
" folder, so that configuring the attribute set do not get disturbed due to the Cache. - Coming back to the browser, go to the rightmost section (named "
Unassigned Attributes
") to find your created attribute in the list. - Drag that attribute into the middle section (named "
Groups
"). There will be many groups available by default. Since you want your attribute to be in the "General
" tab, so you should drag & put your attribute in the "General
" group only after / before any suitable attribute. Be careful in this area, as no other attribute(s) should get misplaced. - Now click the "
Save Attribute Set
" button & your work is complete.
To check whether the above process worked correctly or not, go to the Product details page in the Admin section & in the "General
" tab, you should be ale to find your own created attribute sitting perfectly with a text field happily among others.
Hope it helps.
来源:https://stackoverflow.com/questions/5193699/how-to-add-a-custom-text-field-in-magento-v1-5-catalog-mange-products-general-ta