ecshop bulk upload (add custom properties)

  • 2020-05-16 06:29:32
  • OfStack

The following is the implementation of batch upload (add custom properties) thought and implementation process.

1. Add attributes
The reason why you can only upload specific properties is that the fixed properties of batch upload are all from 1 table. esc_goods table.
Therefore, if we want to add our own properties, we must add our own properties in esc_goods, such as the field addition added this time
Specification: goods_guige
Code :sql statement: alter table ecs_goods goods_guige varchar(255) not null after goods_desc;

2. Page modification
Location: admin/templates/ goods_info.htm adds custom fields in their form
I inserted 174 lines here:

< input type="text" name="goods_guige" value="{$goods.goods_guige}" size="20" / >

3. Add fields to read and update the commodity table (unrelated to bulk upload but easy to view)
Location: admin/goods php
Add in update location:
$sql="update ecs_goods set goods_guige='".$_POST['goods_guige']."' where goods_id= ".$_REQUEST['goods_id'];
$db- > query($sql);
The attributes of this item can be updated

4. Batch upload add fields
language/admin/goods_batch.php
Add field:
// custom batch upload field
$_LANG [' upload_goods] [' goods_guige] = 'specifications';

OK! At this point, as long as you export the cvs of the goods, you can achieve bulk upload of custom properties.

Related articles: