Home >Backend Development >PHP Tutorial >Example tutorial for adding fields to the goods table in the ecshop backend
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 ”}
Step 4: In the corresponding position in the front-end template goods.dwt, add Calling field {$goods.flower_lang}
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 Example tutorial for adding fields to the goods table in the ecshop backend. For more information, please follow other related articles on the PHP Chinese website!