追加功能 #462
v4.0: Product - Import option & product data from SBX
Added by Xihua Fan 10 months ago.
Updated 10 months ago.
Target version:
IT: Easytryck (Sweden) - v4.0
Description
Background
- New requirement for v4.0 OTS
See: OneDrive\赤蓝商贸(上海)有限公司\Shanghai Group - IT\开发相关\OTS V4\开发需求
Task Details
- 1. OTS:开发Import product module,可以多次导入SBX相关产品数据(CSV格式?)
v4 coding standard:
- Git提交
#xxx(redmine number): xxx(redmine title) - xxx(任意:补充内容)
- 代码规范
2.1: 结构:Public -> Protected -> Private
2.2: 其他代码规范同SBX
- 数据层规范(Model)
3.1: 数据库操作只应出现在model或者system中。
3.2: v3/v4的model分为两个文件,比如: order.php, order_v3.php
- 前台代码
twig, js, css (js, css尽量写在单独的css文件中)
- 后台代码
MVCL (L:en,cn)
- 注释
- 类名:
/**
* xxx
*
* @copyright RedBlue-OTS 2024
* @version v4
*
*/
- 函数名:参数类型 + 返回值类型
/**
* xxx
*
* @param xxx $xxx
* @param xxx $xxx
* @return xxx
*/
Output
Others
Files
- Copied from 追加功能 #454: v4.0: Product - Step 1 added
- File SBX-20250301.7z added
- Status changed from 进行中 to 已关闭
- % Done changed from 30 to 100
Output(2025/02/27 ~ 2025/02/28) 居家
- Create a Module (Product Import) to transfer product and options data in SBX to OTS.
- Only enable products (status = 1) are transferred, and disabled product data is not inserted into all related data tables.
- Color option is excluded from option-related data during import.
- In OTS: color option in product_option, product_option_value, product_extra_option, product_extra_option_value are replaced with color_option/color_extra_option (only one) and color_option_value/extra_color_option_value (only one) created in OTS.
- In the data tables of some language packages, use English as Chinese to insert into the data table.
- This time we jointly synchronize SBX 23 data tables:
- ots_option
- ots_option_description
- ots_option_value
- ots_option_value_description
- ots_branding_group
- ots_branding_group_description
- ots_product_group
- ots_product_group_description
- ots_product
- ots_product_description
- ots_product_option
- ots_product_option_description
- ots_product_option_value
- ots_product_option_value_description
- ots_product_discount
- ots_product_option_value_discount
- ots_product_extra_option
- ots_product_extra_option_value
- ots_product_image
- ots_product_image_description
- ots_product_option_value_hover_description
- ots_product_option_value_layer_image
- ots_product_square_meter_discount
- After synchronization to OTS, 25 tables are actually affected, adding 2 tables to No.6
- ots_product_to_manufacturer
- ots_product_to_manufacturer_description
- After the import is completed, the product data added by OTS itself will not be affected.
- Note:
- Tools used: Navicat Premium (https://www.navicat.com/en/products/navicat-premium)
- There is a necessary condition that the exported SQL must be insert statements line by line, otherwise the program will not be able to parse it. Reference Export Configuration: https://redmine.easydingzhi.com/attachments/229
- The general workflow is as follows:
- Read a line of string
- Obtain the table name + fields name + field values through regular matching.
$data = array(
'table_name' = > 'eazy_9455product',
'values' => array(
'field1' => value1,
'field2' => value2,
'field3' => value
)
);
- Match the result of No.2 with the OTS data table structure and assemble the data required by OTS
$data = array(
'table_name' = > 'ots_product',
'values' => array(
'field1' => value1,
'field2' => value2,
'field3' => value,
'field4' => value
)
);
- Note: In some scenarios, you must assemble an array of the same structure. For example, when synchronizing the English language package, generate a Chinese language package.
- Arrange the data of No.3 into an insert statement and insert it directly into the data table.
- Note: Delete the data in the associated table based on the primary key id before inserting.
- File SBX-20250304.7z added
- File deleted (
SBX-20250304.7z)
- File deleted (
SBX-20250301.7z)
Also available in: Atom
PDF