Step one: Go to the database to add fields
1. You can directly enter the database phpmyadmin to add fields to esc_goods
2. You can also directly use sql statements to add fields ALTER TABLE 'ecs_goods ' ADD 'flower_lang' VARCHAR( 500 ) NOT NULL AFTER 'goods_weight';
The location added here is under the product weight of the ecshop backend management--->Other information
Step 2: Modify the admin/goods.php file
Find $shop_price = !empty($_POST[shop_price]) ? $_POST['shop_price'] : 0;
Copy and paste $flower_lang= !empty($_POST[flower_lang]) ? $_POST['flower_lang '] : 0;
Find if ($is_insert) is a judgment statement, directly find "goods_weight = '$goods_weight'," .
Add below: "flower_lang= '$flower_lang '," .
Step 3: Modify the background template file admin/templates/goods_info.htm
Find
{if $code eq ”} <tr> <td class=”label”>{$lang.lab_goods_weight}</td> <td><input type=”text” name=”goods_weight” value=”{$goods.goods_weight_by_unit}” size=”20″ /> <select name=”weight_unit”>{html_options options=$unit_list selected=$weight_unit}</select> </td> </tr> {/if}
Copy and paste
##Step 4: Add the calling field {$goods.flower_lang}# at the corresponding position in the front-end template goods.dwt ##Added completed
Step 5: Test to see if the database can store data and whether the front desk can call it
The above is the detailed content of Use ecshop to add fields to the background goods table. For more information, please follow other related articles on the PHP Chinese website!