Plugin Directory

Changeset 3476026


Ignore:
Timestamp:
03/06/2026 02:09:18 AM (4 weeks ago)
Author:
infility
Message:

v2.14.58 (20260306) Ben: 优化批量导入产品功能。

Location:
infility-global/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • infility-global/trunk/infility_global.php

    r3474225 r3476026  
    44Plugin URI: https://www.infility.cn/
    55Description: Infility公共插件
    6 Version: 2.14.56
     6Version: 2.14.57
    77Author: Infility
    88Author URI: https://www.infility.cn/
     
    142142v2.14.53 (20260211) Ben: 新增elepost列表组件的当前分类post功能。
    143143v2.14.54 (20260224) Ben: 新增获取cf7表单数据接口,废弃infility_get_data接口。
     144v2.14.58 (20260306) Ben: 优化批量导入产品功能。
    144145*/
    145146
     
    147148    function __construct()
    148149    {
    149         define( 'INFILITY_GLOBAL_VERSION', '2.14.56' );
     150        define( 'INFILITY_GLOBAL_VERSION', '2.14.57' );
    150151        define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠
    151152        define( 'INFILITY_GLOBAL_URL', plugins_url( '/', __FILE__ ) ); // https://the_domain/wp-content/plugins/infility-global/ // 斜杠是自己加的
  • infility-global/trunk/widgets/infility-import-data/include/infility-import-excel.php

    r3416920 r3476026  
    4949                    if(empty($taxonomy_arr[$field])){continue;}
    5050                    $terms = $taxonomy_arr[$field];
    51                     $term = '';
    52                     foreach($terms as $key1=>$value1){
    53                         $format_value = str_replace('&', '&', $value);
    54                         if($format_value == $value1->name){
    55                             $term = $value1;
    56                             break;
     51                    $term = [];         
     52
     53                    $value_arr = explode(',',$value);
     54                    if(!empty($value_arr)){
     55                        foreach($value_arr as $key2=>$value2){
     56                            $format_value = str_replace('&', '&', $value2);
     57                            foreach($terms as $key1=>$value1){
     58                                if($format_value == $value1->name){
     59                                    $term[] = $value1;
     60                                    break;
     61                                }
     62                            }
    5763                        }
    5864                    }
    59 
     65                   
    6066                    if(empty($term)){continue;}
    6167
     
    6369                }else{
    6470                    if($field=='post_title'){
    65                         $info[$field] = $value;
     71                        $info[$field] = trim($value);
    6672                    }else if($field=='s01_price'){
    6773                        $info[$field] = $this->special_rule($field,$value);
     
    95101
    96102        if($type=='text'){
     103            $format_data = trim($data);
     104        }else if($type=='textarea'){
    97105            $format_data = $data;
    98106        }else if($type=='repeater'){
     
    158166        foreach($data as $k=>$v){
    159167            if(taxonomy_exists($k)){
    160                 if(!empty($v->term_id)){
    161                     wp_set_object_terms( $post_id, $v->term_id, $k, true );
     168                if(is_array($v)){
     169                    $term_ids = [];
     170                    foreach($v as $key=>$value){
     171                        $term_ids[] = $value->term_id;
     172                    }
     173                    wp_set_object_terms( $post_id, $term_ids, $k, true );
     174                }else{
     175                    if(!empty($v->term_id)){
     176                        wp_set_object_terms( $post_id, $v->term_id, $k, true );
     177                    }
    162178                }
    163179            }else{
  • infility-global/trunk/widgets/infility-import-data/include/infility-import-file.php

    r3401623 r3476026  
    127127                [
    128128                    'key' => 'sign',
    129                     'value' => $sign,
     129                    'value' => trim($sign),
    130130                    'compare' => '=',
    131131                ]
     
    163163                        $acf_config = acf_get_field($acf_field);
    164164                        if(empty($acf_config)){$this->error= $field.':acf 没有该字段信息';continue;}
    165                         if(!in_array($acf_config['type'],['gallery','image','file'])){$this->error= $field.':字段类型错误';continue;}
     165                        if(!in_array($acf_config['type'],['gallery','image','file','repeater'])){$this->error= $field.':字段类型错误';continue;}
    166166                        if($acf_config['type']=='gallery'){
    167167                            $attach_id = $this->add_post_file($full_path);
    168168                            $other_field[$acf_field][] = $attach_id;
     169                        }else if($acf_config['type']=='repeater'){
     170                            $attach_id = $this->add_post_file($full_path);
     171                            $file_repeat = ['title'=>pathinfo($file_name, PATHINFO_FILENAME),'file'=>$attach_id];
     172                            $other_field[$acf_field][] = $file_repeat;
    169173                        }else{
    170174                            if(!empty($other_field[$acf_field])){continue;}
     
    360364
    361365    public function get_system_field($post_type){
    362         $allow_type = ['gallery','file','image'];
     366        $allow_type = ['gallery','file','image','repeater'];
    363367
    364368        $field_groups = acf_get_field_groups([
Note: See TracChangeset for help on using the changeset viewer.