Home > Backend Development > PHP Tutorial > Use ecshop to add fields to the background goods table

Use ecshop to add fields to the background goods table

炎欲天舞
Release: 2023-03-14 16:50:01
Original
1943 people have browsed it

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 after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template