Plugin Directory

Changeset 3283660


Ignore:
Timestamp:
04/28/2025 08:12:02 PM (11 months ago)
Author:
universam
Message:

add plugin

Location:
universam-demo/trunk
Files:
19 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • universam-demo/trunk/admin/assets/css/admin.css

    r3282898 r3283660  
    9292.site-slider{overflow-x:hidden;}
    9393
     94.sticky-section-tabs{position:sticky; top:0; background:#fff; z-index:1; padding-top:20px;}
    9495.section_tabs{display:flex; margin-bottom:20px; gap:10px}
    9596.section_tab{padding:5px 10px; background-color:#fff; border-radius:5px; cursor:pointer; border:1px solid #ddd; white-space:nowrap; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none;}
  • universam-demo/trunk/admin/assets/js/setup-wizard.js

    r3234981 r3283660  
    1111                    delivery_services:[],
    1212                    payment_services:[],
     13                    applications:[],
    1314                    tracker:true
    1415                }
     
    100101                                }
    101102                            break;
     103                            case 'applications':
     104                                for (let j in this.options[i].value)
     105                                    usam_api('application', {active:0, service_code:this.options[i].value[j]}, 'POST');
     106                            break;                         
    102107                            default:
    103108                                if( !this.options[i].option )
  • universam-demo/trunk/admin/assets/js/tabs/files.js

    r3201974 r3283660  
    317317                downloadFolder(){
    318318                    usam_active_loader();   
    319                     usam_send({action: 'download_folder', 'id': this.folders[this.folder_menu].id, nonce: USAM_Page_files.download_folder_nonce});
     319                    usam_api('folder/'+this.folders[this.folder_menu].id+'/download', 'GET');
    320320                },
    321321                renameFolder(e){
     
    324324                fileDownload(e){
    325325                    usam_active_loader();
    326                     usam_send({action: 'download_file', 'id': this.files[this.file_menu].id, nonce: USAM_Page_files.download_file_nonce});
     326                    usam_api('file/'+this.files[this.file_menu].id+'/download', 'GET');
    327327                },
    328328                restoreFile(e)
  • universam-demo/trunk/admin/includes/admin_ajax.php

    r3269096 r3283660  
    318318        }
    319319        return false;
    320     }
    321    
    322     protected function controller_download_folder()
    323     {
    324         $folder_id = sanitize_text_field( $_REQUEST['id'] );   
    325         $folder = usam_get_folder( $folder_id );   
    326         usam_get_folders(['child_of' => $folder_id, 'cache_results' => true]); // КЕШИРОВАНИЕ       
    327         $folder_path = usam_zip_archive_folder( $folder_id );           
    328         ob_start();
    329         readfile($folder_path);
    330         $data = ob_get_clean();
    331         unlink( $folder_path );
    332         return ["download" => "data:application/octet-stream;base64,".base64_encode($data), 'title' => $folder['name'].".zip"];
    333     }
    334    
    335     protected function controller_download_file()
    336     {
    337         $id = sanitize_text_field( $_REQUEST['id'] );   
    338         $file = usam_get_file( $id );
    339         ob_start();
    340         readfile(USAM_UPLOAD_DIR.$file['file_path']);
    341         $data = ob_get_clean();
    342         return ["download" => "data:application/octet-stream;base64,".base64_encode($data), 'title' => $file['title']];
    343320    }
    344321   
  • universam-demo/trunk/admin/includes/form/import-form.php

    r3261943 r3283660  
    2626    protected function get_data_tab()
    2727    {           
    28         $default = ['id' => 0, 'name' => __('Новый шаблон', 'usam'), 'existence_check' => 'code', 'manager_id' => 0, 'bank_account_id' => 0, 'status' => '', 'headings' => 0, 'type_import' => '', 'encoding' => '', 'splitting_array' => '|', 'schedule' => '', 'exchange_option' => '', 'file_data' => '', 'type' => $this->rule_type, 'type_file' => 'csv3', 'time' => '00:00', 'start_line' => 0, 'end_line' => 0, 'delete_file' => 1, 'columns' => [], 'columns2' => [], 'exception' => [], 'processing_rules' => [], 'data' => [], 'to_email' => '', 'subject' => '', 'groups' => [], 'after_exchange' => 0, 'check_data' => ['row' => '', 'column' => '', 'condition' => 'like', 'value' => '']];
     28        $default = ['id' => 0, 'name' => __('Новый шаблон', 'usam'), 'existence_check' => 'code', 'manager_id' => 0, 'bank_account_id' => 0, 'status' => '', 'headings' => 0, 'type_import' => '', 'encoding' => '', 'schedule' => '', 'exchange_option' => '', 'file_data' => '', 'type' => $this->rule_type, 'type_file' => 'csv3', 'time' => '00:00', 'start_line' => 0, 'end_line' => 0, 'delete_file' => 1, 'columns' => [], 'columns2' => [], 'exception' => [], 'processing_rules' => [], 'data' => [], 'to_email' => '', 'subject' => '', 'groups' => [], 'after_exchange' => 0, 'check_data' => ['row' => '', 'column' => '', 'condition' => 'like', 'value' => '']];
    2929        $this->js_args['existence_check'] = ['code' => __( 'По внешнему коду', 'usam')];
    3030        $product_existence_check = ['code' => __( 'По внешнему коду', 'usam'), 'sku' => __( 'По артикулу', 'usam'), 'barcode' => __( 'По штрихкоду', 'usam'), 'url' => __( 'По ссылке', 'usam')];
     
    209209                </select>
    210210            </div>
    211         </div>         
    212         <div class ="edit_form__item">
    213             <div class ="edit_form__item_name"><?php esc_html_e( 'Разделение массивов', 'usam'); ?>:</div>
    214             <div class ="edit_form__item_option">
    215                 <input id='splitting_arrays' type="text" v-model="data.splitting_array">
    216             </div>
    217211        </div>     
    218212        <div class ="edit_form__item">
  • universam-demo/trunk/admin/includes/product/product-metabox.class.php

    r3282898 r3283660  
    9999        $types_product = usam_get_types_products_sold();
    100100        ?>     
    101 <site-slider>
     101<site-slider classes="site-slider sticky-section-tabs">
    102102<template v-slot:body="sliderProps">
    103103    <div class="section_tabs">
  • universam-demo/trunk/admin/includes/setup-wizard.class.php

    r3234981 r3283660  
    9696            ]);                     
    9797        }       
     98        $applications = [['id' => 'ozon', 'name' => 'Ozon'], ['id' => 'wildberries', 'name' => 'Wildberries'], ['id' => 'telphin', 'name' => 'АТС «Телфин.Офис»'], ['id' => 'moysklad', 'name' => 'Мой склад'], ['id' => 'evotor', 'name' => 'Эвотор'], ['id' => 'dadata', 'name' => 'DaData.ru']];
     99        if( !$demo_data )
     100            $selected_applications = ['ozon', 'wildberries', 'telphin', 'moysklad', 'evotor', 'dadata'];
    98101        $settings = array_merge( $settings, [       
    99102        /*  ['tab' => 'information', 'field_type' => 'buttons', 'name' => __('Как вы работаете?', 'usam'), 'code' => 'installation', 'options' => [
     
    117120            ['tab' => 'shipping_payments', 'field_type' => 'route', 'name' => __('Способы доставки', 'usam'), 'code' => 'delivery_services', 'multiple' => 1, 'route' => 'delivery_services', 'vars' => '{"active":"all"}', 'value' => $delivery_service],
    118121            ['tab' => 'shipping_payments', 'field_type' => 'route', 'name' => __('Варианты оплаты', 'usam'), 'code' => 'payment_services', 'multiple' => 1, 'route' => 'payment_services', 'vars' => '{"active":"all"}', 'value' => $gateways],
     122            ['tab' => 'shipping_payments', 'field_type' => 'select', 'name' => __('Установить приложения', 'usam'), 'code' => 'applications', 'multiple' => 1, 'value' => $selected_applications, 'options' => $applications], 
    119123        ]);
    120124        if ( ! current_user_can( 'install_themes' ) || ! current_user_can( 'switch_themes' ) || is_multisite() ) {
  • universam-demo/trunk/admin/includes/user_profile_fields.class.php

    r3282898 r3283660  
    1616    {               
    1717        if ( usam_check_current_user_role( 'administrator' ) || usam_check_current_user_role('editor') || usam_check_current_user_role('shop_manager') || usam_check_current_user_role('shop_crm') )
    18         {
    19             $phone = get_the_author_meta('usam_phone', $user->ID);
    20             $phone = usam_get_phone_format( $phone );
    21            
     18        {           
    2219            $sip = get_the_author_meta('usam_sip', $user->ID);
    2320            ?>                     
    2421            <h3><?php _e('IP телефония', 'usam'); ?></h3>   
    25             <table class="form-table">         
    26                 <tr>               
    27                     <th><?php esc_html_e( 'Телефон', 'usam'); ?></th>
    28                     <td>
    29                         <input type='text' value='<?php echo $phone; ?>' name='phone' />   
    30                     </td>       
    31                 </tr>   
     22            <table class="form-table">                     
    3223                <tr>               
    3324                    <th><?php esc_html_e( 'SIP (добавочный номер)', 'usam'); ?></th>
     
    3829            </table>       
    3930            <?php                           
    40             $mailboxes = usam_get_mailboxes( array( 'fields' => array( 'id','name'), 'user_id' => $user->ID ) );   
     31            $mailboxes = usam_get_mailboxes(['fields' => ['id','name'], 'user_id' => $user->ID]);   
    4132            $email_default = esc_attr(get_the_author_meta('usam_email_default', $user->ID));
    4233            ?>         
  • universam-demo/trunk/admin/tabs/files.php

    r3218365 r3283660  
    11<?php
    2 class USAM_Tab_files extends USAM_Tab
     2class USAM_Tab_files extends USAM_Page_Tab
    33{
    44    protected $views = ['grid', 'table', 'report', 'settings'];
  • universam-demo/trunk/admin/tabs/general.php

    r3269096 r3283660  
    5757                'price_platform' => __('Прайс-площадка', 'usam')
    5858            ]],
    59             ['block' => 'option_work', 'field_type' => 'select', 'name' => __('Продаваемые товары', 'usam'), 'code' => 'types_products_sold', 'multiple' => 1, 'default' => ['product', 'services'], 'options' => $types_product_option],
     59            ['block' => 'option_work', 'field_type' => 'select', 'name' => __('Продаваемые товары/услуги', 'usam'), 'code' => 'types_products_sold', 'multiple' => 1, 'default' => ['product', 'services'], 'options' => $types_product_option],
    6060            ['block' => 'checkout_consent_processing_personal_data', 'field_type' => 'tinymce', 'name' => '', 'code' => 'consent_processing_personal_data', 'default' => ''],   
    6161            ['block' => 'cookie_notice', 'field_type' => 'tinymce', 'name' => '', 'code' => 'cookie_notice', 'default' => ''],
  • universam-demo/trunk/admin/tabs/my_files.php

    r3168104 r3283660  
    11<?php
    2 class USAM_Tab_my_files extends USAM_Tab
     2class USAM_Tab_my_files extends USAM_Page_Tab
    33{
    44    protected $views = ['grid', 'table'];   
  • universam-demo/trunk/admin/templates/template-parts/type-option.php

    r3282898 r3283660  
    88<size v-model="property.value" v-else-if="property.field_type=='size-css'"></size> 
    99<border v-model="property.value" v-else-if="property.field_type=='border'"></border>
    10 <color-picker :type="'hex'" v-model="property.value" :vars="siteColors" v-else-if="property.field_type=='color'"/>
     10<color-picker :type="'hex'" v-model="property.value" :vars="siteColors" v-else-if="property.field_type=='color'"></color-picker>
    1111<div class="object_property attribute_buttons" v-else-if="property.field_type=='buttons' || property.field_type=='check'">
    1212    <selector v-model="property.value" :items="property.options"></selector>
  • universam-demo/trunk/includes/application.class.php

    r3282898 r3283660  
    107107        }       
    108108        $result = json_decode($data['body'], true);
    109        
    110        
    111         $Log = new USAM_Log_File( 'send_request' );
    112 $Log->fwrite_array( $url );
    113 $Log->fwrite_array( $params ); 
    114 $Log->fwrite_array( $result );
    115 
    116109        return $this->handle_request( $result, $function, $params );
    117110    }
  • universam-demo/trunk/includes/constants.php

    r3282898 r3283660  
    565565}
    566566
    567 function usam_get_types_products_sold( )
     567function usam_get_types_products_sold()
    568568{
    569569    $products = [
     
    571571        'service' => ['single' => __('Услуга', 'usam'), 'plural' => __('Услуги', 'usam')],
    572572        'subscription' => ['single' => __('Подписка', 'usam'), 'plural' => __('Подписки', 'usam')],
     573        'tour' => ['single' => __('Тур', 'usam'), 'plural' => __('Туры', 'usam')],
    573574        'electronic_product' => ['single' => __('Электронный товар', 'usam'), 'plural' => __('Электронные товары', 'usam')]
    574575    ];
  • universam-demo/trunk/includes/crm/company_importer.class.php

    r3234981 r3283660  
    6868            if ( isset($row['group']) )
    6969            {
    70                 $groups = explode($this->rule['splitting_array'], $row['group']);   
     70                $groups = is_array($row['groups']) ? $row['groups'] : [$row['groups']];
    7171                require_once( USAM_FILE_PATH.'/includes/crm/groups_query.class.php' );
    7272                $groups = usam_get_groups(['type' => 'company', 'fields' => 'id', 'code' => $groups]);     
  • universam-demo/trunk/includes/crm/contact_importer.class.php

    r3201974 r3283660  
    6969            if ( isset($row['group']) )
    7070            {
    71                 $groups = explode($this->rule['splitting_array'], $row['group']);   
     71                $groups = is_array($row['groups']) ? $row['groups'] : [$row['groups']];
    7272                require_once( USAM_FILE_PATH.'/includes/crm/groups_query.class.php' );
    7373                $groups = usam_get_groups(['type' => 'contact', 'fields' => 'id', 'code' => $groups]);     
  • universam-demo/trunk/includes/document/document-importer.class.php

    r3261943 r3283660  
    138138            $groups = [];
    139139            if ( isset($new_data['groups']) )
    140                 $groups = explode($new_data['groups'], $this->rule['splitting_array']);
     140                $groups = is_array($new_data['groups']) ? $new_data['groups'] : [$new_data['groups']];
    141141            elseif( !empty($this->rule['groups']) )
    142142                $groups = $this->rule['groups'];
  • universam-demo/trunk/includes/exchange/API/register_rest_route.php

    r3282898 r3283660  
    158158            ],     
    159159        ]);
     160        register_rest_route( $this->namespace, '/file/(?P<id>\d+)/download', [     
     161            [
     162                'methods'  => 'GET',
     163                'callback' => ['USAM_API', 'download_file'],               
     164                'permission_callback' => function( $request ){ 
     165                    return current_user_can('universam_api') || current_user_can('view_all_files') || current_user_can('view_my_files');
     166                }
     167            ]           
     168        ]);
    160169        register_rest_route( $this->namespace, '/upload', [
    161170            [
     
    233242            ],
    234243        ]);
     244        register_rest_route( $this->namespace, '/folder/(?P<id>\d+)/download', [       
     245            [
     246                'methods'  => 'GET',
     247                'callback' => ['USAM_API', 'download_folder'],             
     248                'permission_callback' => function( $request ){ 
     249                    return current_user_can('universam_api') || current_user_can('view_all_files') || current_user_can('view_my_files');
     250                }
     251            ]           
     252        ]);     
     253       
    235254        register_rest_route( $this->namespace, '/notifications', [
    236255            [
  • universam-demo/trunk/includes/exchange/API/rest_route/API.php

    r3282898 r3283660  
    20292029        return usam_delete_file( $id );
    20302030    }
     2031   
     2032    public static function download_file( WP_REST_Request $request )
     2033    {       
     2034        $id = $request->get_param( 'id' ); 
     2035        $file = usam_get_file( $id );
     2036        ob_start();
     2037        readfile(USAM_UPLOAD_DIR.$file['file_path']);
     2038        $data = ob_get_clean();
     2039        return ["download" => "data:application/octet-stream;base64,".base64_encode($data), 'title' => $file['title']];
     2040    }
    20312041       
    20322042    public static function get_folders( WP_REST_Request $request )
     
    21252135        $id = $request->get_param( 'id' ); 
    21262136        return usam_delete_folder( $id );
     2137    }
     2138   
     2139    public static function download_folder( WP_REST_Request $request )
     2140    {       
     2141        $id = $request->get_param( 'id' ); 
     2142        $folder = usam_get_folder( $id );   
     2143        usam_get_folders(['child_of' => $id, 'cache_results' => true]); // КЕШИРОВАНИЕ     
     2144        $folder_path = usam_zip_archive_folder( $id );         
     2145        ob_start();
     2146        readfile($folder_path);
     2147        $data = ob_get_clean();
     2148        unlink( $folder_path );
     2149        return ["download" => "data:application/octet-stream;base64,".base64_encode($data), 'title' => $folder['name'].".zip"];
    21272150    }
    21282151   
     
    38703893        if ( !$parameters )
    38713894            $parameters = $request->get_body_params();     
    3872         $parameters = $request->get_json_params();
    3873         $integrations = usam_get_data_integrations( 'applications', ['name' => 'Name', 'icon' => 'Icon', 'group' => 'Group'] );
    3874         if ( isset($integrations[$parameters['service_code']]) )
    3875             $parameters['group_code'] = $integrations[$parameters['service_code']]['group'];       
     3895        $parameters = $request->get_json_params();     
    38763896        $id = usam_insert_application( $parameters );       
    38773897        $class = usam_get_class_application( $id );     
  • universam-demo/trunk/includes/exchange/data_exchange.class.php

    r3234981 r3283660  
    107107            if( isset($this->rule['exception'][$key]['value']) && $this->rule['exception'][$key]['value'] !== '' )
    108108            {
    109                 $data = explode($this->rule['splitting_array'],$this->rule['exception'][$key]['value']);               
     109                $data = explode('|', $this->rule['exception'][$key]['value']);             
    110110                foreach( $data as $r )
    111111                {
  • universam-demo/trunk/includes/exchange/exchange_rule.class.php

    r3261943 r3283660  
    498498                if ( is_array($value) )
    499499                    $value = array_map('strip_tags', $value);
    500                 else
     500                elseif ( $value )
    501501                    $value = strip_tags( $value );                 
    502502            break;
     
    525525                        $value[$k] = rtrim($v, $rule['replace']);
    526526                }
    527                 else
     527                elseif ( $value )
    528528                    $value = rtrim($value, $rule['replace']);
    529529            break;
     
    532532                {
    533533                    foreach ($value as $k => $v)
    534                         $value[$k] = explode($v, $rule['replace']);
    535                 }
    536                 else
    537                     $value = explode($value, $rule['replace']);
     534                        $value[$k] = explode($rule['replace'], $v);
     535                }
     536                elseif ( $value )
     537                    $value = explode($rule['replace'], $value);
    538538            break; 
    539539            case 'float' : 
     
    552552                        $value[$k] = trim($v);
    553553                }
    554                 else
     554                elseif ( $value )
    555555                    $value = trim($value);
    556556            break;                 
  • universam-demo/trunk/includes/exchange/integration_service.class.php

    r3201974 r3283660  
    212212        global $wpdb;
    213213
    214         do_action( 'usam_application_pre_save', $this );   
    215         $where_col = $this->args['col'];
    216        
     214        do_action( 'usam_application_pre_save', $this );           
    217215        $result = false;   
    218         if ( $where_col )
     216        if ( $this->args['col'] )
    219217        {   
    220             $where_val = $this->args['value'];
    221             $where_format = self::get_column_format( $where_col );
    222             do_action( 'usam_application_pre_update', $this );         
    223             $where = array( $this->args['col'] => $where_val);
     218            $where_format = self::get_column_format( $this->args['col'] );
     219            do_action( 'usam_application_pre_update', $this ); 
    224220
    225221            $this->data = apply_filters( 'usam_application_update_data', $this->data );
     
    228224            $data = $this->data;
    229225           
    230             $result = $wpdb->update( USAM_TABLE_APPLICATIONS, $this->data, $where, $formats, array( $where_format ) ); 
     226            $result = $wpdb->update( USAM_TABLE_APPLICATIONS, $this->data, [$this->args['col'] => $this->args['value']], $formats, array( $where_format ) );   
    231227            if ( $result )
    232228                $this->delete_cache( );         
     
    237233            do_action( 'usam_application_pre_insert' );         
    238234            if ( isset($this->data['id']) )
    239                 unset( $this->data['id'] );         
     235                unset( $this->data['id'] );
     236
     237            if( empty($this->data['service_code']) )
     238                return false;
     239           
     240            $integrations = usam_get_data_integrations( 'applications', ['name' => 'Name', 'icon' => 'Icon', 'group' => 'Group'] );
     241            if ( isset($integrations[$this->data['service_code']]) )
     242                $this->data['group_code'] = $integrations[$this->data['service_code']]['group'];                   
    240243           
    241244            $this->data = apply_filters( 'usam_application_insert_data', $this->data );
  • universam-demo/trunk/includes/integration/applications/sokolov.php

    r3201974 r3283660  
    11<?php
    22/*
    3     Name: API сайта Соколов
    4     Description: Загружает товары с сайта Соколов на ваш сайт.
     3    Name: sokolov.ru
     4    Description: Загружает товары с сайта sokolov.ru на ваш сайт.
    55    Price: paid
    66    Group: import_products
  • universam-demo/trunk/includes/integration/applications/vavto.php

    r3218365 r3283660  
    11<?php
    22/*
    3     Name: API сайта v-avto.ru
     3    Name: v-avto.ru
    44    Description: Загружает товары с сайта v-avto.ru на ваш сайт.
    55    Price: paid
  • universam-demo/trunk/includes/personnel/personnel.php

    r3133815 r3283660  
    1616    return $name;
    1717}
    18 
    19 function usam_get_manager_phone( $user_id = null )
    20 {
    21     if ( $user_id == null )
    22         $user_id = get_current_user_id();
    23    
    24     $phone = (int)get_the_author_meta('usam_phone', $user_id);
    25     return $phone;
    26 }
    27 
    2818
    2919function usam_get_manager_type_price( $user_id = null )
  • universam-demo/trunk/includes/post-types.class.php

    r3099887 r3283660  
    6464            $permalinks = get_option( 'usam_permalinks' );
    6565            // Товары
    66             $labels = [
    67                 'name'               => __('Товары'                    , 'usam'),
    68                 'singular_name'      => __('Товар'                     , 'usam'),
    69                 'add_new'            => __('Добавить товар'            , 'usam'),
    70                 'add_new_item'       => __('Добавить новый товар'      , 'usam'),
    71                 'edit_item'          => __('Изменить товар'            , 'usam'),
    72                 'new_item'           => __('Новый товар'               , 'usam'),
    73                 'view_item'          => __('Посмотреть товар'          , 'usam'),
    74                 'search_items'       => __('Поиск товаров'             , 'usam'),
    75                 'not_found'          => __('Товары не найдены'         , 'usam'),
     66            $types_product = usam_get_types_products_sold();           
     67            $select_types_product = get_option('usam_types_products_sold', ['product', 'services'] );
     68            $singular_name = __('Товар', 'usam');
     69            if( count($select_types_product) == 1 )
     70            {
     71                $key = array_shift($select_types_product);
     72                if( $key == 'product' || $key == 'electronic_product' )
     73                    $plural_name = __('Товары', 'usam');
     74                else
     75                {
     76                    $plural_name = $types_product[$key]['plural'];
     77                    $singular_name = $types_product[$key]['single'];                   
     78                }
     79            }
     80            else
     81                $plural_name = __('Товары/услуги', 'usam');
     82           
     83            $add_new = sprintf(__('Добавить %s', 'usam'), $singular_name);
     84           
     85            $labels = [
     86                'name'               => $plural_name,
     87                'singular_name'      => $singular_name,
     88                'add_new'            => $add_new,
     89                'add_new_item'       => $add_new,
     90                'edit_item'          => __('Изменить товар', 'usam'),
     91                'new_item'           => __('Новый товар', 'usam'),
     92                'view_item'          => __('Посмотреть товар', 'usam'),
     93                'search_items'       => __('Поиск товаров', 'usam'),
     94                'not_found'          => __('Товары не найдены', 'usam'),
    7695                'not_found_in_trash' => __('Товары не найдены в корзине', 'usam'),
    77                 'menu_name'          => __('Товары'                     , 'usam'),
     96                'menu_name'          => $plural_name,
    7897                'featured_image'        => __( 'Изображение товара', 'usam' ),
    7998                'set_featured_image'    => __( 'Задать изображение товара', 'usam' ),
  • universam-demo/trunk/includes/product/product-template.php

    r3269096 r3283660  
    762762                $do_not_show_in_features = usam_get_term_metadata($attribute['term_id'], 'do_not_show_in_features');
    763763                if ( !empty($do_not_show_in_features) )
    764                     continue;           
    765                 $text = implode(', ', $attribute['value']);         
    766                 if ( usam_get_term_metadata($attribute['term_id'], 'switch_to_selection') )
     764                    continue;                  
     765                               
     766                if( usam_get_term_metadata($attribute['term_id'], 'switch_to_selection') )
    767767                {
    768                     $k = array_key_first($attribute['value']);
    769                     $text = "<a href='".rtrim(home_url( $attribute['slug'] ), '/')."/$k'>$text</a>";   
     768                    $text = [];
     769                    foreach( $attribute['value'] as $code => $value )
     770                        $text[] = "<a href='".rtrim(home_url( $attribute['slug'] ), '/')."/$code'>$value</a>";
     771                    $text = implode(', ',$text);
    770772                }
     773                else
     774                    $text = implode(', ', $attribute['value']);
    771775                $i++;               
    772776                $output .= "<div class='product_characteristics__attribute product_characteristic_".$attribute['slug']."'>
  • universam-demo/trunk/includes/product/product.class.php

    r3282898 r3283660  
    562562            foreach( $attribute_value as $attribute)               
    563563            {                           
     564                if ( !is_numeric($attribute) && usam_attribute_stores_values( $field_type ) )
     565                    $attribute = usam_insert_product_attribute_variant(['value' => $attribute, 'attribute_id' => $terms[$slug]]);
    564566                if ( !isset($attributes_bd[$slug]) || !in_array($attribute, $attributes_bd[$slug]) )
    565                 {           
    566                     if ( !is_numeric($attribute) && usam_attribute_stores_values( $field_type ) )
    567                         $attribute = usam_insert_product_attribute_variant(['value' => $attribute, 'attribute_id' => $terms[$slug]]);
     567                {                       
    568568                    if ( $field_type == 'several_options' || $field_type == 'several_colors' )
    569569                        usam_add_product_attribute($this->product_id, $slug, $attribute, false );
  • universam-demo/trunk/includes/product/product_importer.class.php

    r3255608 r3283660  
    2424                $this->rule[$metadata->meta_key] = maybe_unserialize( $metadata->meta_value );         
    2525        }
    26         $default = ['splitting_array' => '|'];
    27         $this->rule = array_merge( $default, $this->rule );
    28         if ( !$this->rule['splitting_array'] )
    29             $this->rule['splitting_array'] = '|';
    3026    }
    3127   
     
    193189                $product['thumbnail'] = $row['thumbnail']; 
    194190            if ( !empty($row['images']) )
    195                 $product['media_url'] = explode($this->rule['splitting_array'],$row['images']);
     191                $product['media_url'] = is_array($row['images']) ? $row['images'] : [$row['images']];
    196192            if ( !empty($row['not_limited']) )
    197193            {
     
    274270                if ( !empty($row[$name]) )
    275271                {
    276                     $terms = explode($this->rule['splitting_array'],$row[$name]);
     272                    $terms = is_array($row[$name]) ? $row[$name] : [$row[$name]];
    277273                    if ( $name == 'category' )
    278274                        $terms = apply_filters( 'usam_product_import_categories', $terms, $this->rule, $row );
     
    301297                        $field_type = usam_get_term_metadata($attribute->term_id, 'field_type');
    302298                        if ( $field_type == 'several_options' || $field_type == 'several_colors' )
    303                             $attribute_values[$attribute->slug] = explode($this->rule['splitting_array'], $row[$column]);
     299                        {
     300                            if( is_array($row[$column]) )
     301                                $attribute_values[$attribute->slug] = $row[$column];
     302                            else
     303                                $attribute_values[$attribute->slug] = [ $row[$column] ];
     304                        }
    304305                        else
    305306                            $attribute_values[$attribute->slug] = $row[$column];                       
     
    326327                        $parent_term_id = $parent_term->term_id;                   
    327328                    $product['variations'][$parent_term_id] = [];   
    328                     $variations = explode($this->rule['splitting_array'], $strings[1] );
     329                    $variations = explode('|', $strings[1] );
    329330                    foreach ( $variations as $variation )   
    330331                    {
     
    384385                if ( $product_id )             
    385386                {       
    386                     if( !empty($row['crosssell']) )             
    387                         $related_products[$product_id]['crosssell'] = explode($this->rule['splitting_array'],$row['crosssell']);
    388                     if( !empty($row['similar']) )
    389                         $related_products[$product_id]['similar'] = explode($this->rule['splitting_array'],$row['similar']);
     387                    foreach ( ['crosssell', 'similar'] as $name )
     388                        if( !empty($row[$name]) )               
     389                            $related_products[$product_id][$name] = is_array($row[$name]) ? $row[$name] : [$row[$name]];
    390390                    if ( !empty($row['codes_additional_unit']) )
    391391                    {
    392392                        $product_additional_units = [];
    393                         $codes_additional_unit = explode($this->rule['splitting_array'],$row['codes_additional_unit']);
     393                        $codes_additional_unit = is_array($row['codes_additional_unit']) ? $row['codes_additional_unit'] : [$row['codes_additional_unit']];
    394394                        if ( !empty($row['additional_units']) )
    395                             $additional_units = explode($this->rule['splitting_array'],$row['additional_units']);   
     395                            $additional_units = is_array($row['additional_units']) ? $row['additional_units'] : [$row['additional_units']];
    396396                        $p_unit_measure = usam_get_product_meta($product_id,'unit_measure');
    397397                        $p_unit = usam_get_product_meta( $product_id, 'unit' );                     
  • universam-demo/trunk/readme.txt

    r3282898 r3283660  
    33Tags: online store, ecommerce, shop, shopping cart, sell online
    44Requires at least: 6.6
    5 Tested up to: 6.6
    6 Stable tag: 8.71.16
     5Tested up to: 6.8
     6Stable tag: 8.71.17
    77Requires PHP: 7.4
    88License: GPLv1
  • universam-demo/trunk/theme/usam-global-style.css

    r3282898 r3283660  
    22352235.html_block_search__panel_product_image{margin-right:20px; width:90px; display:flex; justify-content:center; align-items:center;}
    22362236.html_block_search__panel_product_name{font-size:14px; font-weight:400; line-height:17px; margin-bottom:5px;}
     2237.html_block_search__panel .html_block_search__panel_product_name a{color:var(--main-text-color)}
    22372238.html_block_search__panel_product_description{font-size:13px; line-height:16px; margin-bottom:4px}
    22382239.html_block_search__panel_product_content{width:100%}           
  • universam-demo/trunk/universam.php

    r3282898 r3283660  
    44 * Plugin URI: https://wp-universam.ru
    55 * Description: Платформа для управления бизнесом и интернет-магазином. Встроенный парсинг, CRM, соц. сети, мессенджеры, карты, план продаж, управление остатками, контакт-центр, коммерческие предложения, счета, акты, инструменты для продвижения сайта, конструктор отчетов, файлы, рассылки, СМС.
    6  * Version: 8.71.16
     6 * Version: 8.71.17
    77 * Author: universam
    88 * Author URI: https://wp-universam.ru
     
    1414{   
    1515    protected static $_instance = null;
    16     private          $version = '8.71.16';
     16    private          $version = '8.71.17';
    1717    public function __construct()
    1818    {
Note: See TracChangeset for help on using the changeset viewer.