Home  >  Article  >  Backend Development  >  Example tutorial for adding fields to the goods table in the ecshop backend

Example tutorial for adding fields to the goods table in the ecshop backend

PHP中文网
PHP中文网Original
2017-06-21 10:54:212138browse

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 ”}

 {$lang.lab_goods_weight}
  < ;/td>

{/if}
Copy and paste

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn