Plugin Directory

Changeset 3298857


Ignore:
Timestamp:
05/22/2025 02:29:22 PM (10 months ago)
Author:
universam
Message:

add plugin

Location:
universam-demo/trunk
Files:
26 edited

Legend:

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

    r3295959 r3298857  
    120120.htmlblock_elements{display:flex; gap:20px; width:100%;}
    121121.header_editor .htmlblock_elements_column{flex:1 1 33%;}
    122 .htmlblock_elements_group{border-radius:5px; background-color:#F4F4F4; transition:all .2sease; display:flex; cursor:pointer; width:100%; padding:5px; position:relative;}
     122.htmlblock_elements_group{border-radius:5px; background-color:#F4F4F4; transition:all .2sease; display:flex; cursor:pointer; width:100%; position:relative;}
    123123.htmlblock_elements_group:hover{box-shadow:0 4px 20px rgba(0, 0, 0, .1);}
    124124.htmlblock_elements_column{align-items:center; min-height:45px; }
     
    131131.element_content__none_items{width:100%; height:100%}
    132132.home_page__item:hover .home_page__item_name >.element_actions,
    133 .element_content:hover .element_actions{visibility:visible;}
     133div:hover > .element_actions{visibility:visible;}
    134134.element_actions{display:flex; gap:5px; position:absolute; z-index:10; left:0; bottom:100%; padding:5px; visibility:hidden; color:#2c3338; border-radius:5px; border:1px solid #1e1e1e; background-color:#fff; border-radius:2px;}
     135.element_actions .dashicons{cursor:pointer}
    135136
    136137.htmlblock_tabs__headers{display:flex; gap:5px; margin-bottom:10px}
    137 .htmlblock_tabs__header{min-width:100px; height:100%; cursor:pointer; display:flex; align-items: center; justify-content:center;  text-transform:uppercase; padding:0 15px 10px 15px; border-bottom: 2px solid transparent;}
     138.htmlblock_tabs__header{min-width:100px; height:100%; cursor:pointer; display:flex; align-items: center; justify-content:center;  text-transform:uppercase; padding:0 15px 10px 15px; border-bottom: 2px solid transparent; position:relative}
    138139.htmlblock_tabs__header.current{border-bottom: 2px solid var(--main-open-color); color: var(--main-open-color);}
    139140.htmlblock_tabs__header .editable{width:100%;}
     
    141142.htmlblock_tabs__content .htmlblock_elements_group{display:none;}
    142143.htmlblock_tabs__headers .element_add{padding:0}
    143 .htmlblock_tabs__header_title{margin-right:50px}
     144.htmlblock_tabs__header_title{margin-right:50px; position:relative}
    144145
    145146.htmlblock_faq{flex-direction: column;}
    146 .htmlblock_faq__content{width:100%;}
     147.htmlblock_faq__content{width:100%; position:relative;}
    147148.htmlblock_faq__title{font-size:20px; font-weight:600; margin-bottom:20px}
    148149
    149 .htmlblock_harmonic{flex-direction: column;}
    150 .htmlblock_harmonic__content{width:100%;}
    151 .htmlblock_harmonic__title{font-size:20px; font-weight:600; margin-bottom:20px}
     150.htmlblock_accordion{flex-direction: column;}
     151.htmlblock_accordion__content{width:100%;}
     152.htmlblock_accordion__title{font-size:20px; font-weight:600; margin-bottom:20px}
    152153
    153154.modalSidebar80{width:80%;}
     
    350351.user_comment__user_name{font-weight:700;}
    351352.user_comment__date{margin-left:10px;}
    352 .user_comment__message{word-break:break-all; line-height:1.2;}
     353.user_comment__message{word-break:break-all; line-height:1.2; }
    353354.message_not_read{background-color:#EDF1F5!important; border-style:solid; border-color:#DAE1E8; border-width:0px 0px 1px 0px;}
    354355 
     
    702703.wp-list-table .column-date{width:auto}
    703704.wp-list-table .column-product_title{width:20%}
    704 .wp-list-table .check-column .svg_icon{margin-top:5px; margin-left:6px;}
     705.wp-list-table .check-column .svg_icon{margin-top:5px; width: 27px; height: 20px;}
    705706.wp-list-table .column-product_title .product_sku{font-weight:600;}
    706707.wp-list-table .column-product_title .product_sku span{font-weight:400;}
  • universam-demo/trunk/admin/assets/css/element_form.css

    r3282898 r3298857  
    5353.header_main h4.header_content_name{background-color:#ffffff; border-bottom: 1px #e5e5e5 solid; margin:0;}
    5454.header_main h4{margin:0 0 10px 0; padding:0 10px 10px 10px; font-size:16px; border-bottom: 1px #000 solid;}
     55
     56.svg_icon_ozon{width:40px;}
    5557
    5658.usam_view_form_tabs{margin-top:20px;}
  • universam-demo/trunk/admin/assets/css/tabs/feedback.css

    r3282898 r3298857  
    5656.status_message{padding:5px; border-radius:10px;}   
    5757.message_not_sent{background:#f5e9e2; border-style:solid; border-color:#e4d4cb; border-width:0px 0px 1px 0px;}
    58 .user_block_in_width .user_block__content{max-width:calc(100% - 70px);}
     58.user_block_in_width .user_block__content{max-width:calc(100% - 30px);}
     59.user_block_in_width{max-width:100%}
    5960.user_block__message{overflow: hidden; text-overflow: ellipsis;}
    6061.user_block__message_preview{white-space: nowrap;}
  • universam-demo/trunk/admin/assets/js/admin.js

    r3295959 r3298857  
    16801680        accruedBonuses() {
    16811681            var b = 0;
    1682             for (let k in this.products)
    1683                 b += this.products[k].bonus
    1684                 return b;
     1682            for (let k in this.data.products)
     1683                b += this.data.products[k].bonus
     1684            return b;               
    16851685        },
    16861686        change_payment() {
     
    1110811108    template:`<div class="htmlblock_tabs">
    1110911109        <div class="htmlblock_tabs__headers">
    11110             <div class="htmlblock_tabs__header_title" :title="block.options.name.name">
     11110            <div class="htmlblock_tabs__header_title" :title="block.options.name.name">             
    1111111111                <editable v-model="block.options.name.value"/>
    1111211112            </div>
    1111311113            <div class="htmlblock_tabs__header" :class="{'current':i==tab}" v-for="(column, i) in block.columns" @click="tab=i">
     11114                <div class='element_actions'>
     11115                    <span class="dashicons dashicons-trash" @click="block.columns.splice(i, 1);"></span>
     11116                </div>
    1111411117                <editable v-model="column.name"/>
    1111511118            </div>
     
    1113511138                {                   
    1113611139                    if( !v.columns.length )
    11137                         v.columns = [this.default_]
     11140                        v.columns = [structuredClone(this.default_)]
    1113811141                    this.block = v;                 
    1113911142                }
     
    1115911162    methods: {
    1116011163        add() {
    11161             this.block.columns.push( this.default_ );
     11164            this.block.columns.push( structuredClone(this.default_) );
    1116211165        },
    1116311166        del(blocks, i) {           
     
    1117011173    template:`<div class="htmlblock_faq htmlblock_elements">
    1117111174        <div class="htmlblock_faq__content" v-for="(column, i) in block.columns" :class="{'current':i==tab}">
     11175            <div class='element_actions'>
     11176                <span class="dashicons dashicons-trash" @click="block.columns.splice(i, 1);"></span>
     11177            </div>
    1117211178            <editable v-model="column.name" :classes="'htmlblock_faq__title'"></editable>
    1117311179            <div class="htmlblock_elements_group htmlblock_elements_row">               
     
    1119011196                {                   
    1119111197                    if( !v.columns.length )
    11192                         v.columns = [this.default_]
     11198                        v.columns = [structuredClone(this.default_)]
    1119311199                    this.block = v;                 
    1119411200                }
     
    1121411220    methods: {
    1121511221        add() {
    11216             this.block.columns.push( this.default_ );
     11222            this.block.columns.push( structuredClone(this.default_) );
    1121711223        },
    1121811224        del(blocks, i) {           
     
    1122211228})
    1122311229
    11224 Vue.component('htmlblock-harmonic', {
    11225     template:`<div class="htmlblock_harmonic htmlblock_elements">
    11226         <div class="htmlblock_harmonic__content" v-for="(column, i) in block.columns" :class="{'current':i==tab}">
    11227             <editable v-model="column.name" :classes="'htmlblock_harmonic__title'"></editable>
     11230Vue.component('htmlblock-accordion', {
     11231    template:`<div class="htmlblock_accordion htmlblock_elements">
     11232        <div class="htmlblock_accordion__content" v-for="(column, i) in block.columns" :class="{'current':i==tab}">
     11233            <div class='element_actions'>
     11234                <span class="dashicons dashicons-trash" @click="block.columns.splice(i, 1);"></span>
     11235            </div>
     11236            <editable v-model="column.name" :classes="'htmlblock_accordion__title'"></editable>
    1122811237            <div class="htmlblock_elements_group htmlblock_elements_row">               
    1122911238                <div class='element_content' v-for='(element, j) in column.blocks'>
     
    1124511254                {                   
    1124611255                    if( !v.columns.length )
    11247                         v.columns = [this.default_]
     11256                        v.columns = [structuredClone(this.default_)]
    1124811257                    this.block = v;                 
    1124911258                }
     
    1126911278    methods: {
    1127011279        add() {
    11271             this.block.columns.push( this.default_ );
     11280            this.block.columns.push( structuredClone(this.default_) );
    1127211281        },
    1127311282        del(blocks, i) {           
  • universam-demo/trunk/admin/form/edit-form-application.php

    r3282898 r3298857  
    6464                        <div class ="edit_form__item_name">{{property.name}}</div>
    6565                        <div class="edit_form__item_option" v-if="property.field_type == 'redirect'">
    66                             <span class="js-copy-clipboard"><?php echo get_rest_url(null, 'usam/v1/'); ?>{{data.service_code}}/{{data.id}}</span>
     66                            <span class="js-copy-clipboard"><?php echo get_rest_url(null, 'usam/v1/'); ?>{{data.service_code}}/{{data.id}}<span v-if="property.code">/{{property.code}}</span></span>
    6767                        </div>
    6868                        <div class="edit_form__item_option" v-else>
  • universam-demo/trunk/admin/form/edit-form-parser_competitor.php

    r3148881 r3298857  
    126126            </template>
    127127        </usam-box>
    128         <usam-box :id="'usam_login'">
    129             <template v-slot:title>
    130                 <?php _e( 'Авторизация', 'usam'); ?><selector v-model="data.authorization"></selector>
    131             </template>
    132             <template v-slot:body>
    133                 <?php $this->display_login(); ?>
    134             </template>
    135         </usam-box>     
    136         <?php       
     128        <?php
     129        if ( defined('USAM_PARSER_AUTH') && USAM_PARSER_AUTH )
     130        {
     131            ?> 
     132            <usam-box :id="'usam_login'">
     133                <template v-slot:title>
     134                    <?php _e( 'Авторизация', 'usam'); ?><selector v-model="data.authorization"></selector>
     135                </template>
     136                <template v-slot:body>
     137                    <?php $this->display_login(); ?>
     138                </template>
     139            </usam-box>     
     140            <?php   
     141        }
    137142    }   
    138143}
  • universam-demo/trunk/admin/form/edit-form-parser_supplier.php

    r3201974 r3298857  
    233233            </template>
    234234        </usam-box>
    235         <usam-box :id="'usam_login'">
    236             <template v-slot:title>
    237                 <?php _e( 'Авторизация', 'usam'); ?><selector v-model="data.authorization"></selector>
    238             </template>
    239             <template v-slot:body>
    240                 <?php $this->display_login(); ?>
    241             </template>
    242         </usam-box>     
    243         <?php       
     235        <?php   
     236        if ( defined('USAM_PARSER_AUTH') && USAM_PARSER_AUTH )
     237        {
     238            ?> 
     239            <usam-box :id="'usam_login'">
     240                <template v-slot:title>
     241                    <?php _e( 'Авторизация', 'usam'); ?><selector v-model="data.authorization"></selector>
     242                </template>
     243                <template v-slot:body>
     244                    <?php $this->display_login(); ?>
     245                </template>
     246            </usam-box>     
     247            <?php   
     248        }       
    244249    }   
    245250}
  • universam-demo/trunk/admin/form/edit-form-storage.php

    r3234981 r3298857  
    2727    protected function get_data_tab()
    2828    {           
    29         $default = ['id' => 0, 'active' => 1, 'issuing' => 1, 'type' => 'warehouse', 'location_id' => '', 'shipping' => 1, 'title' =>'', 'code' => '', 'sort' => 100, 'type_price' => usam_get_manager_type_price(), 'period_from' => '', 'period_to' => '', 'period_type' => '', 'image' => 0, 'images' => [], 'email' => '', 'phone' => '', 'schedule' => '', 'address' => '', 'index' => '', 'latitude' => '', 'longitude' => ''];
     29        $default = ['id' => 0, 'active' => 1, 'issuing' => 1, 'type' => 'warehouse', 'location_id' => '', 'shipping' => 1, 'title' =>'', 'code' => '', 'sort' => 100, 'type_price' => usam_get_manager_type_price(), 'period_from' => '', 'period_to' => '', 'period_type' => '', 'image' => 0, 'images' => [], 'email' => '', 'phone' => '', 'schedule' => '', 'address' => '', 'index' => '', 'latitude' => '', 'longitude' => '', 'ozon_id' => ''];
    3030        $sales_area = usam_get_sales_regions();
    3131        foreach ( $sales_area as $sale_area )
  • universam-demo/trunk/admin/form/view-form-order.php

    r3295959 r3298857  
    6666        $this->js_args = [ 
    6767            'payment_gateways' => usam_get_payment_gateways(),
    68             'payment_types' => usam_get_payment_types(),           
     68            'payment_types' => usam_get_payment_types(),   
     69            'bonuses_displayed' => $this->data['user_ID'] && usam_check_bonuses_displayed( $this->data['totalprice'] )         
    6970        ];     
    7071        $this->js_args['user'] = ['user_login' => ''];
     
    253254            <div class ="view_data__row">
    254255                <div class ="view_data__name"><?php _e( 'Источник','usam'); ?>:</div>
    255                 <div class ="view_data__option">
    256                     <?php                   
    257                     if ( $this->data['source'] == 'vk' )
    258                     {                       
    259                         $vk_group_id = usam_get_order_metadata($this->id , 'vk_group_id' );
    260                         $profile = usam_get_social_network_profile( $vk_group_id );
    261                         $title = $profile ? $profile['name']:'';
    262                         echo usam_get_system_svg_icon( $this->data['source'], ['title' => $title] );
    263                     }   
    264                     else
    265                         echo usam_get_order_source_name($this->data['source']);
    266                     ?>
    267                 </div>
    268             </div> 
     256                <?php                   
     257                if ( $this->data['source'] == 'vk' )
     258                {                       
     259                    $vk_group_id = usam_get_order_metadata($this->id , 'vk_group_id' );
     260                    $profile = usam_get_social_network_profile( $vk_group_id );
     261                    $title = $profile ? $profile['name']:'';
     262                    echo usam_get_system_svg_icon( $this->data['source'], ['title' => $title] );
     263                }   
     264                elseif ( $this->data['source'] == 'ozon' )                 
     265                    echo usam_get_system_svg_icon( $this->data['source'], ["class" => "svg_icon_source"] );
     266                else
     267                    echo '<div class ="view_data__option">'.usam_get_order_source_name($this->data['source']).'</div>';
     268                ?>             
     269            </div>
     270            <?php do_action( 'usam_view_form_order_main', $this->id, $this->data ); ?>         
    269271            <?php
    270272            $date_exchange = usam_get_order_metadata($this->id, 'date_exchange');
  • universam-demo/trunk/admin/includes/edit_form.class.php

    r3241265 r3298857  
    2323        $this->get_data_tab();     
    2424        $this->data = apply_filters( "usam_{$this->form_name}_edit_form_data", $this->data, $this );
     25        $this->data = apply_filters( "usam_edit_form_data", $this->data, $this, $this->form_name );
    2526        if ( empty($this->data) )
    2627            $this->not_exist = true;
  • universam-demo/trunk/admin/list-table/orders_list_table.php

    r3271864 r3298857  
    5959        $checked = in_array($item->id, $this->records )?"checked='checked'":"";
    6060        echo "<input id='checkbox-".$item->id."' type='checkbox' name='cb[]' value='".$item->id."' ".$checked.">";
    61         if ( $item->source == 'vk' || $item->source == '1c' || $item->source == 'moysklad' )
     61        if ( $item->source == 'vk' || $item->source == '1c' || $item->source == 'moysklad' || $item->source == 'ozon' )
    6262            echo usam_system_svg_icon( $item->source, ['title' => usam_get_order_source_name($item->source)] );
    6363    }
  • universam-demo/trunk/admin/templates/template-parts/html-blocks.php

    r3295959 r3298857  
    1919            <htmlblock-tabs v-else-if="block.code==='blocks_tabs'" :value="block" @input="blocks[i]=$event"></htmlblock-tabs>
    2020            <htmlblock-faq v-else-if="block.code==='faq'" :value="block" @input="blocks[i]=$event"></htmlblock-faq>
    21             <htmlblock-harmonic v-else-if="block.code==='harmonic'" :value="block" @input="blocks[i]=$event"></htmlblock-harmonic>
     21            <htmlblock-accordion v-else-if="block.code==='accordion'" :value="block" @input="blocks[i]=$event"></htmlblock-accordion>
    2222            <div class="htmlblock_elements" v-else-if="block.code=='columns'">
    2323                <div class="htmlblock_elements_group htmlblock_elements_row" v-for="(column, i) in block.columns">
  • universam-demo/trunk/admin/templates/template-parts/table-products-order.php

    r3295959 r3298857  
    9292                    <span v-else>
    9393                        <span v-for="value in type_prices" v-if="value.code==data.type_price">
    94                             <span v-html="value.title"></span>                         
     94                            <span v-html="value.title"></span>                 
    9595                            <span class="item_status item_status_valid" v-if="value.code==data.contact_type_price"><?php _e('Персональная цена', 'usam'); ?></span>
    9696                        </span>     
    9797                    </span>                                     
    9898                </div>
    99             </div> 
     99            </div>
    100100            <div class ="edit_form__item" v-if="bonuses_displayed">
    101101                <div class="edit_form__item_name"><?php esc_html_e( 'Сумма бонусов за покупку', 'usam'); ?>:</div>
     
    171171                        <div class ="edit_form__item_name"><label><?php esc_html_e( 'Списать бонусы с карты', 'usam'); ?>:</label></div>
    172172                        <div class ="edit_form__item_option">
    173                             <input size="20" type="number" v-model="bonuses" :max="bonus_card.sum" @input="bonuses=bonuses > bonus_card.sum?bonus_card.sum:bonuses" @blur="addBonuses(bonuses)">
     173                            <input size="20" type="number" v-model="bonuses" :max="bonus_card.sum" @input="bonuses=bonuses > bonus_card.sum?bonus_card.sum:bonuses" @blur="slotProps.addBonuses(bonuses)">
    174174                        </div>
    175175                    </div>
  • universam-demo/trunk/admin/templates/vue-templates/table-products.php

    r3295959 r3298857  
    4242                        <td :colspan = 'tableColumns.length'><slot name="empty"><?php _e( 'Нет товаров', 'usam'); ?></slot></td>
    4343                    </tr>
    44                     <slot name="tbody" :tableColumns="tableColumns" :products="products" :user_columns="user_columns" :viewer="viewer" :addBonuses="addBonuses" :recountProducts="recountProducts" :formatted_number="formatted_number" :delElement="delElement" v-else>
     44                    <slot name="tbody" :tableColumns="tableColumns" :products="products" :user_columns="user_columns" :viewer="viewer" :recountProducts="recountProducts" :formatted_number="formatted_number" :delElement="delElement" v-else>
    4545                        <tr v-if="products.length" v-for="(product, i) in products">
    4646                            <td :class="'column-'+column.id" v-for="column in tableColumns">
     
    8181                                        </div>                 
    8282                                    </div>                                         
    83                                     <div class = 'order_discount product_order_discount' v-if="product.discounts.length">
     83                                    <div class = 'order_discount product_order_discount' v-if="product.discounts!==undefined && product.discounts.length">
    8484                                        <div class = 'order_discount_name'><?php esc_html_e( 'Акции на товар', 'usam'); ?></div>
    8585                                        <div class = 'order_discount_rules'>                           
     
    123123                                    <div class = "quantity_product" v-if="edit">
    124124                                        <input size='4' type='text' v-model="product.quantity" @blur="recountProducts">
    125                                         <select class = "quantity_product_units" :name="'products['+product.id+'][unit_measure]'" v-model="product.unit_measure" @blur="recountProducts" v-if="product.units.length">
     125                                        <select class = "quantity_product_units" :name="'products['+product.id+'][unit_measure]'" v-model="product.unit_measure" @blur="recountProducts" v-if="product.units !== undefined && product.units.length">
    126126                                            <option v-for="additional_unit in product.units" :value="additional_unit.code" v-html="additional_unit.in"></option>
    127127                                        </select>
     
    157157                </tbody>
    158158                <tfoot>
    159                     <slot name="tfoot" :tableColumns="tableColumns" :products="products" :user_columns="user_columns" :formatted_number="formatted_number" :totalprice="totalprice" :subtotal="subtotal" :discount="discount" :taxtotal="taxtotal"></slot>
     159                    <slot name="tfoot" :tableColumns="tableColumns" :products="products" :user_columns="user_columns" :addBonuses="addBonuses" :formatted_number="formatted_number" :totalprice="totalprice" :subtotal="subtotal" :discount="discount" :taxtotal="taxtotal"></slot>
    160160                </tfoot>
    161161            </table>                           
  • universam-demo/trunk/assets/js/universam.theme.js

    r3295959 r3298857  
    14951495        });
    14961496    });
    1497     document.querySelectorAll('.html_block_harmonic').forEach((el) =>
     1497    document.querySelectorAll('.html_block_accordion').forEach((el) =>
    14981498        new Vue({       
    14991499            el: el,     
  • universam-demo/trunk/includes/application.class.php

    r3283660 r3298857  
    3535            if ( is_array($metas) )
    3636            {
    37                 foreach($metas as $metadata )
     37                foreach( $metas as $metadata )
    3838                {
     39                    $value = maybe_unserialize( $metadata->meta_value );
    3940                    if ( isset($default[$metadata->meta_key]) && is_array($default[$metadata->meta_key]) )
    40                         $this->option[$metadata->meta_key][] = maybe_unserialize( $metadata->meta_value );
     41                    {
     42                        if ( is_array($value) )
     43                            $this->option[$metadata->meta_key] = $value;
     44                        else
     45                            $this->option[$metadata->meta_key][] = $value;
     46                    }
    4147                    else
    42                         $this->option[$metadata->meta_key] = maybe_unserialize( $metadata->meta_value );               
     48                        $this->option[$metadata->meta_key] = $value;               
    4349                }
    4450            }           
     
    6066        {
    6167            foreach( $block['options'] as $option )
    62                 $default[$option['code']] = $option['default'];
     68                $default[$option['code']] = isset($option['default']) ? $option['default'] : '';
    6369        }
    6470        return $default;
  • universam-demo/trunk/includes/block/htmlblocks/faq/index.php

    r3295959 r3298857  
    55{   
    66    ?>
    7     <div id="htmlblock_harmonic_<?php echo $k; ?>" class="html_block_faq__item">
     7    <div id="htmlblock_faq_<?php echo $k; ?>" class="html_block_faq__item">
    88        <div class="html_block_faq__name">
    99            <?php echo $column['name']; ?>
  • universam-demo/trunk/includes/block/htmlblocks/harmonic/index.php

    r3295959 r3298857  
    55{   
    66    ?>
    7     <div id="htmlblock_harmonic_<?php echo $k; ?>" class="html_block_harmonic__item" :class="{'show':tab==<?php echo $k; ?>}" @click="tab=(tab===<?php echo $k; ?>?null:<?php echo $k; ?>)">
    8         <div class="html_block_harmonic__name">
     7    <div id="htmlblock_accordion_<?php echo $k; ?>" class="html_block_accordion__item" :class="{'show':tab==<?php echo $k; ?>}" @click="tab=(tab===<?php echo $k; ?>?null:<?php echo $k; ?>)">
     8        <div class="html_block_accordion__name">
    99            <?php echo $column['name']; ?>
    1010            <?php usam_svg_icon("plus", ["v-show" => "tab!=".$k]); ?>
    1111            <?php usam_svg_icon("minus", ["v-show" => "tab==".$k]); ?>
    1212        </div> 
    13         <div class="html_block_harmonic__content" :class="{'collapsing':tab==<?php echo $k; ?>}">
    14             <div class="html_block_harmonic__content_items">
     13        <div class="html_block_accordion__content" :class="{'collapsing':tab==<?php echo $k; ?>}">
     14            <div class="html_block_accordion__content_items">
    1515                <?php 
    1616                foreach ($column['blocks'] as $item )
     
    3636    $css_data .= "#html_block_{$block['id']} .html_block_container{gap:{$block['content_style']['gap']}}";
    3737if( $block['content_style']['border-color-item'] )
    38     $css_data .= "#html_block_{$block['id']} .html_block_harmonic__item{border-color:{$block['content_style']['border-color-item']}}";
     38    $css_data .= "#html_block_{$block['id']} .html_block_accordion__item{border-color:{$block['content_style']['border-color-item']}}";
    3939$name_css = '';
    4040$show_name_css = '';
     
    5050}
    5151if( $name_css )
    52     $css_data .= "#html_block_{$block['id']} .html_block_harmonic__name{".$name_css."}";
     52    $css_data .= "#html_block_{$block['id']} .html_block_accordion__name{".$name_css."}";
    5353if( $show_name_css )
    54     $css_data .= "#html_block_{$block['id']} .html_block_harmonic__item.show .html_block_harmonic__name{".$show_name_css."}";
     54    $css_data .= "#html_block_{$block['id']} .html_block_accordion__item.show .html_block_accordion__name{".$show_name_css."}";
    5555?>
  • universam-demo/trunk/includes/block/htmlblocks/library-registered-blocks.php

    r3295959 r3298857  
    1717        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'view', 'value' => 'variant1', 'options' => $files],
    1818        ['field_type' => 'text', 'name' => __('Отступы между баннерами', 'usam'), 'code' => 'gap', 'value' => '10px'],
    19         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [
     19        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [
    2020            ['id' => 'left', 'name' => __('Влево', 'usam')],
    2121            ['id' => 'center', 'name' => __('Центр', 'usam')],
     
    6060        ['field_type' => 'color', 'name' => __('Цвет элемента', 'usam'), 'code' => 'background-color', 'value' => ''],
    6161        ['field_type' => 'text', 'name' => __('Закругления', 'usam'), 'code' => 'radius', 'value' => ''],   
    62         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     62        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    6363    ]
    6464]);
     
    8989usam_register_htmlblock('faq', [   
    9090    'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/faq/index.php",
    91     'html_name' => __('FAQ – Часто задаваемые вопросы', 'usam'), // Имя блока для администратора   
     91    'html_name' => 'FAQ', // Имя блока для администратора   
    9292    'group' => 'design',
    9393    'options' => [ // список опций блока
     
    105105]);
    106106
    107 usam_register_htmlblock('harmonic', [   
    108     'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/harmonic/index.php",
    109     'html_name' => __('Гармошка', 'usam'), // Имя блока для администратора 
     107usam_register_htmlblock('accordion', [ 
     108    'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/accordion/index.php",
     109    'html_name' => __('Аккордеон с одной открытой вкладкой', 'usam'), // Имя блока для администратора   
    110110    'group' => 'design',
    111111    'cloak' => true,
     
    158158        ['field_type' => 'buttons', 'name' => __('Карусель', 'usam'), 'code' => 'carousel', 'value' => 0], 
    159159        ['field_type' => 'text', 'name' => __('Отступы между элементами', 'usam'), 'code' => 'gap', 'value' => '20px'],
    160         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     160        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    161161    ], 
    162162]);
     
    199199            ['id' => 'right', 'name' => __('Вправо', 'usam')],
    200200        ], 'value' => 'center'],
    201         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     201        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    202202    ],
    203203]);
     
    261261            ['id' => 'right', 'name' => __('Вправо', 'usam')],
    262262        ], 'value' => 'left'],
    263         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     263        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    264264    ], 
    265265]);
     
    282282        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid],
    283283        ['field_type' => 'buttons', 'name' => __('Карусель', 'usam'), 'code' => 'carousel', 'value' => 0],
    284         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     284        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    285285    ]
    286286]);
     
    303303    'content_style' => [
    304304        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'list', 'value' => get_option("usam_product_list", 'default'), 'options' => $lists],
    305         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     305        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    306306    ]
    307307]);
     
    324324    'content_style' => [
    325325        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid ], 
    326         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],     
     326        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],     
    327327        ['field_type' => 'select', 'name' => __('Выравнивание вкладок', 'usam'), 'code' => 'align-tabs', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]], 
    328328        ['field_type' => 'text', 'name' => __('Отступы между вкладками', 'usam'), 'code' => 'gap', 'value' => ''],
     
    355355    'content_style' => [
    356356        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid],           
    357         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     357        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    358358        ['field_type' => 'select', 'name' => __('Выравнивание вкладок', 'usam'), 'code' => 'align-tabs', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    359359        ['field_type' => 'text', 'name' => __('Отступы между вкладками', 'usam'), 'code' => 'gap', 'value' => ''],
     
    386386        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid ],
    387387        ['field_type' => 'buttons', 'name' => __('Карусель', 'usam'), 'code' => 'carousel', 'value' => 0],
    388         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     388        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    389389    ]   
    390390]);
     
    405405    'content_style' => [
    406406        ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'list', 'value' => get_option("usam_product_list", 'default'), 'options' => $lists],
    407         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     407        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    408408    ]   
    409409]);
     
    421421    'content_style' => [ // Стиль элементов
    422422        ['field_type' => 'text', 'name' => __('Отступы между элементами', 'usam'), 'code' => 'gap', 'value' => '20px'],
    423         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     423        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    424424    ], 
    425425]);
     
    687687    'content_style' => [ // стили для блока     
    688688        ['field_type' => 'text', 'name' => __('Отступы между элементами', 'usam'), 'code' => 'gap', 'value' => '10px'],
    689         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     689        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    690690    ]
    691691]);
     
    700700    ],
    701701    'content_style' => [ // стили для блока     
    702         ['field_type' => 'select', 'name' => __('Выравнивание загаловка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
     702        ['field_type' => 'select', 'name' => __('Выравнивание заголовка', 'usam'), 'code' => 'align', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]],
    703703    ],
    704704    'group' => 'theme',
  • universam-demo/trunk/includes/document/order.helpers.php

    r3201974 r3298857  
    186186function usam_get_order_source( )
    187187{
    188     $source = ['call' => __('Звонок','usam'), 'order' => __('Обычный заказ','usam'), 'webform' => __('Веб-форма','usam'), 'manager' => __('Создан менеджером','usam'), 'import' => __('Импортированный','usam'), 'vk' => __('вКонтакте','usam'), 'moysklad' => __('Мой склад','usam'), '1c' => '1C', 'offline' => __('Офлайн','usam'), 'repeat' => __('Скопирован клиентом','usam')];   
     188    $source = ['call' => __('Звонок','usam'), 'order' => __('Обычный заказ','usam'), 'webform' => __('Веб-форма','usam'), 'manager' => __('Создан менеджером','usam'), 'import' => __('Импортированный','usam'), 'vk' => __('вКонтакте','usam'), 'moysklad' => __('Мой склад','usam'), 'ozon' => __('Озон','usam'), '1c' => '1C', 'offline' => __('Офлайн','usam'), 'repeat' => __('Скопирован клиентом','usam')]; 
    189189    return $source;
    190190}
  • universam-demo/trunk/includes/exchange/API/rest_route/API.php

    r3295959 r3298857  
    10961096    private static function update_storage_metadata( $id, $parameters )
    10971097    {   
    1098         foreach(['images', 'image', 'address', 'index', 'description', 'schedule', 'email', 'phone', 'latitude', 'longitude', 'period_from', 'period_to', 'period_type'] as $k )
     1098        foreach(['images', 'image', 'address', 'index', 'description', 'schedule', 'email', 'phone', 'latitude', 'longitude', 'period_from', 'period_to', 'period_type', 'ozon_id'] as $k )
    10991099            if( isset($parameters[$k]) )
    11001100                usam_update_storage_metadata( $id, $k, $parameters[$k] );
  • universam-demo/trunk/includes/integration/applications/moysklad.php

    r3269096 r3298857  
    27692769   
    27702770    public function admin_init()
    2771     {
    2772         if( current_user_can( 'setting_document' ) )           
    2773             add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
    2774        
     2771    {       
    27752772        add_action( 'usam_order_status_settings_edit_form',  [&$this, 'order_status_settings_edit_form'], 10, 2 ); 
    27762773        add_filter( 'usam_order_status_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 2 );
     
    27812778        if ( usam_is_license_type('SMALL_BUSINESS') || usam_is_license_type('BUSINESS') || usam_is_license_type('ENTERPRISE'))
    27822779        {               
     2780            if( current_user_can( 'setting_document' ) )           
     2781                add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
     2782           
    27832783            add_action( 'admin_init', [&$this, 'admin_init']);
    27842784            add_action( 'usam_moysklad_update_product_stock',  [&$this, 'update_product_stock'] );
     
    28162816                add_action('usam_company_update', [&$this, 'update_company']);     
    28172817                add_action( "usam_company_before_delete", [&$this, 'company_delete']);     
    2818                 add_filter( 'usam_product_metabox_codes', [&$this, 'product_metabox_codes'], 10, 2 );          
     2818                add_filter( 'usam_product_metabox_codes', [&$this, 'product_metabox_codes'], 10, 2 );   
    28192819            }   
    28202820        }
  • universam-demo/trunk/includes/integration/applications/ozon/ozon.php

    r3282898 r3298857  
    220220    }
    221221   
     222    /* 
     223quant_size
     224Используйте параметр, если у обычного и эконом-товара совпадает артикул — offer_id = quant_id. Чтобы обновить количество:
     225
     226обычного товара — передайте значение 1;
     227эконом-товара — передайте размер его кванта.
     228Если у обычного и эконом-товара разные артикулы, не передавайте параметр.
     229    */
    222230    public function update_stock( $query_vars = [] )
    223231    {
     232        if( empty($this->option['storage_ids']) )
     233            return false;
     234       
    224235        $query_vars = [] ;
    225         $query_vars['posts_per_page'] = 20;
     236        $query_vars['posts_per_page'] = 100; //За один запрос можно изменить наличие для 100 товаров.
    226237        if ( !isset($query_vars['post_status']) )
    227238            $query_vars['post_status'] = 'any';
    228239        $query_vars['fields'] = 'ids';
    229         $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => 'EXISTS']];   
     240        $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => '!=', 'value' => '']];   
    230241        $query_vars['stocks_cache'] = true;
    231242        $query_vars['prices_cache'] = false;       
    232243       
    233         $products = usam_get_products( $query_vars );
    234        
     244        $products = usam_get_products( $query_vars );       
    235245        $items = [];
    236246        foreach( $products as $key => $product_id )
    237247        {
    238             if( $this->option['storage_ids'] )
     248            foreach( $this->option['storage_ids'] as $storage_id )
    239249            {
    240                 $stock = 0;
    241                 foreach( $this->option['storage_ids'] as $storage_id ) 
    242                     $stock += usam_get_product_stock( $product_id, 'storage_'.$storage_id );
    243             }
    244             else
    245                 $stock = usam_product_remaining_stock( $product_id );
    246             $items[] = ['offer_id' => (string)$product_id, 'stock' => (int)$stock ];
    247         }
     250                $storage_ozon_id = usam_get_storage_metadata( $storage_id, 'ozon_id' );
     251                if ( !$storage_ozon_id )
     252                {               
     253                    $this->set_error( "Не настроен склад id $storage_id для озон" );   
     254                    continue;
     255                }               
     256                $product_ozon_id = usam_get_product_meta( $product_id, 'ozon_id' );
     257                $stock = usam_get_product_stock( $product_id, 'storage_'.$storage_id );             
     258                $items[] = ['product_id' => (int)$product_ozon_id, 'stock' => (int)$stock, 'warehouse_id' => (int)$storage_ozon_id, 'quant_size' => 1 ];
     259            }       
     260        }
     261       
     262$Log = new USAM_Log_File( 'items' );
     263 $Log->fwrite_array( $items );
     264 
    248265        $result = false;
    249266        if ( $items )
    250267        {
    251             $args = $this->get_args( 'POST', ['stocks' => $items] );
    252             $result = $this->send_request( "v1/product/import/stocks", $args );
     268            $args = $this->get_args( 'POST', ['stocks' => $items] );               
     269            $result = $this->send_request( "/v2/products/stocks", $args );             
     270            //  $result = $this->send_request( "v1/product/import/stocks", $args );             
     271            sleep(30);
    253272        }   
    254273        return count($items);
     
    257276    public function update_prices( $query_vars = [] )
    258277    {
    259         $query_vars['posts_per_page'] = 20;
     278        $query_vars['posts_per_page'] = 100; //За один запрос можно изменить наличие для 100 товаров.
    260279        if ( !isset($query_vars['post_status']) )
    261280            $query_vars['post_status'] = 'any';
    262281        $query_vars['fields'] = 'ids';
    263         $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => 'EXISTS']];
     282        $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => '!=', 'value' => '']];
    264283        $query_vars['prices_cache'] = true;     
    265284        $query_vars['stocks_cache'] = false;
     
    323342        return ['ozon_category_id' => $category_id, 'ozon_product_type' => $ozon_product_type];
    324343    }
     344       
     345    //Метод возвращает список складов FBS и rFBS
     346    protected function get_storages()
     347    {               
     348        $args = $this->get_args( 'POST' );
     349        $result = $this->send_request( "v1/warehouse/list", $args );
     350        if( isset($result['result']) )
     351            return $result['result'];
     352        return false;
     353    }
    325354   
    326355    protected function get_orders( $query_vars = [] )
    327     {               
    328         $query_vars = array_merge(['limit' => 1000, "with" => ["analytics_data" => true, "financial_data" => true, "translit" => true]], $query_vars );
     356    {               
     357        $time = usam_get_application_metadata( $this->option['id'], 'last_request_date' );
     358    //  if ( !$time )
     359    //      $time = date("Y-m-d H:i:s", strtotime( '-160 days' ) );
     360        $time = get_date_from_gmt( $time, "c");     
     361        $to = get_date_from_gmt( date("Y-m-d H:i:s"), "c" );
     362        $query_vars = array_merge(['limit' => 1000, 'offset' => 0, "with" => ["analytics_data" => true, "financial_data" => true, "translit" => true], 'filter' => ['since' => $time, 'to' => $to]], $query_vars );
    329363        $args = $this->get_args( 'POST', $query_vars );
    330364        $result = $this->send_request( "v3/posting/fbs/list", $args );
    331365        if( isset($result['result']) )
    332             return $result['result'];
     366        {
     367            usam_update_application_metadata( $this->id, 'last_request_date', date("Y-m-d H:i:s") );
     368            return $result['result'];       
     369        }
    333370        return false;
    334371    }
     
    346383    protected function handle_request( $result, $function, $params )
    347384    {       
     385        $Log = new USAM_Log_File( 'handle_request' );
     386 $Log->fwrite_array( $function );
     387  $Log->fwrite_array( $result );
     388 
    348389        if ( !empty($result['code']) && !empty($result['message']) )
    349         {       
     390        {              
    350391            $this->set_error( $result['message'], $function, $params );
    351392            return false;
    352393        }   
     394        elseif ( !empty($result['result']) && is_array($result['result']) )
     395        {           
     396            foreach( $result['result'] as $item )
     397            {
     398                if( !empty($item['errors']) )
     399                {
     400                    foreach( $item['errors'] as $error )
     401                        $this->set_error( $error['code'].': '.$error['message'], $function, $params ); 
     402                }
     403            }
     404        }
    353405        return $result;
    354406    }
     
    388440                ['field_type' => 'text', 'name' => 'Client ID', 'code' => 'login', 'default' => ''],
    389441                ['field_type' => 'password', 'name' => 'API key', 'code' => 'access_token', 'default' => ''],   
    390                 //['field_type' => 'html', 'name' => 'Ссылка', 'code' => '', 'default' => rest_url($this->namespace.'/'.$this->option['service_code'].'/'.$this->option['id'].'/notifications')],               
     442                ['field_type' => 'redirect', 'name' => __('Ссылка для уведомлений', 'usam'), 'code' => 'notifications'],
     443                ['field_type' => 'select', 'name' => __('Вариант работы', 'usam'), 'code' => 'work_option', 'options' => [
     444                    ['id' => 'fbs', 'name' => 'FBS'],
     445                    ['id' => 'fbo', 'name' => 'FBO'],
     446                ], 'default' => 'fbs'],             
    391447            ]],
    392448            ['name' => __('Обновление товаров', 'usam'), 'code' => 'product', 'options' => [           
     
    403459                ['field_type' => 'select', 'name' => __('Автоматический обновление цен каждые', 'usam'), 'code' => 'update_prices_schedule', 'options' => $schedules, 'default' => ''],
    404460                ['field_type' => 'text', 'name' => __('Начиная с', 'usam'), 'code' => 'update_prices_schedule_time', 'default' => '00:00'],
    405                 ['field_type' => 'select', 'name' => __('Автоматическое обновление остатков каждые', 'usam'), 'code' => 'stock_schedule', 'options' => $schedules, 'default' => ''],
    406                 ['field_type' => 'text', 'name' => __('Начиная с', 'usam'), 'code' => 'stock_schedule_time', 'default' => '00:00'],                     
     461                ['field_type' => 'select', 'name' => __('Автоматическое обновление остатков каждые', 'usam'), 'code' => 'update_stock_schedule', 'options' => $schedules, 'default' => ''],
     462                ['field_type' => 'text', 'name' => __('Начиная с', 'usam'), 'code' => 'update_stock_schedule_time', 'default' => '00:00'],                     
    407463            ]],
    408464            ['name' => __('Обновление заказов', 'usam'), 'code' => 'order', 'options' => [         
     
    545601   
    546602    private function get_order_data( $document )
    547     {      
    548         $data = ['date_insert' => date("Y-m-d H:i:s", strtotime($document['in_process_at'])), 'bank_account_id' => $this->option['company_id'], 'type_price' => $this->option['type_price']];
     603    {   
     604        $order = ['source' => 'ozon', 'date_insert' => date("Y-m-d H:i:s", strtotime($document['in_process_at'])), 'bank_account_id' => $this->option['company_id'], 'type_price' => $this->option['type_price']];
    549605        if( isset($document['substatus']) )
    550             $data['status'] = usam_get_status_code_by_meta( 'ozon_id', $document['substatus'], 'order' );
     606            $order['status'] = usam_get_status_code_by_meta( 'ozon_id', $document['substatus'], 'order' );
    551607        $metas = ['ozon_id' => $document['posting_number'], 'warehouse_id' => $document['warehouse_id']]; //'seller_id' => $parameters['seller_id']
    552608        $products = [];
    553609        foreach( $document['products'] as $product )
    554610        {
    555             $product_id = usam_get_product_id_by_meta( 'ozon_id', $product['offer_id'] );
     611        //  $product_id = usam_get_product_id_by_meta( 'ozon_id', $product['offer_id'] );
    556612            $price = isset($product['price']) ? usam_string_to_float($product['price']) : 0;
    557             $products[] = ['product_id' => $product_id, 'quantity' => usam_string_to_float($product['quantity']), 'price' => $price];               
    558         }
    559         return ['order' => $data, 'products' => $products, 'metas' => $metas];
     613            $products[] = ['product_id' => $product['offer_id'], 'quantity' => usam_string_to_float($product['quantity']), 'price' => $price];             
     614        }
     615        return ['order' => $order, 'products' => $products, 'metas' => $metas];
    560616    }
    561617   
    562618    function update_orders_from_ozon($id, $number, $event)
    563619    {       
    564         $results = $this->get_orders();     
     620        $results = $this->get_orders();      
    565621        $done = 0;
    566         if( !$results )
     622        if( $results )
    567623        {
    568624            $codes = [];
    569             foreach( $parameters['postings'] as $v )
     625            foreach( $results['postings'] as $v )
    570626                $codes[] = $v['posting_number'];
    571627            usam_get_order_ids_by_code( $codes, 'ozon_id' );
    572628            unset($codes);
    573629            usam_update_object_count_status( false );
    574             foreach( $parameters['postings'] as $document )
     630            foreach( $results['postings'] as $document )
    575631            {
     632                $result = $this->get_order_data( $document );               
     633                extract( $result );
     634               
     635               
     636                 $Log = new USAM_Log_File( 'document' );
     637    $Log->fwrite_array( $document );
     638        $Log->fwrite_array( $order );
     639            $Log->fwrite_array( $products );
     640                $Log->fwrite_array( $metas );
     641                   
    576642                $order_id = usam_get_order_id_by_meta('ozon_id', $document['posting_number']);
    577643                if( !$order_id )
    578                 {
    579                     $result = $this->get_order_data( $document );
    580                     extract( $result );                 
    581                     $order_id = usam_insert_order( $data, $products, $metas ); 
     644                {       
     645                    $order_id = usam_insert_order( $order, $products, $metas );
    582646                    if( $order_id )
    583647                    {
     
    587651                        }
    588652                    }
    589                 }       
     653                }
     654                else
     655                {
     656                    usam_update_order( $order_id, $order, $products, $metas );                     
     657                }
    590658            }
    591659            usam_update_object_count_status( true );
     
    599667    {               
    600668        $i = usam_get_total_products(['productmeta_query' => [['key' => 'ozon_id', 'compare' => 'EXISTS']]]);       
    601         usam_create_system_process( __("Обновление остатков в &laquo;Озон&raquo;", "usam" ), $this->id, [&$this, 'update_stock_from_ozon'], $i, 'ozon_application_update_stock-'.$this->id );      
     669        usam_create_system_process( __("Обновление остатков в &laquo;Озон&raquo;", "usam" ), $this->id, [&$this, 'update_stock_from_ozon'], $i, 'ozon_application_update_stock-'.$this->id );   
    602670    }
    603671   
     
    609677   
    610678    function cron_update_orders()
    611     {                       
    612         usam_create_system_process( __("Обновление заказов в &laquo;Озон&raquo;", "usam" ), $this->id, [&$this, 'update_orders_from_ozon'], 100, 'ozon_application_update_orders-'.$this->id );     
     679    {                              
     680        usam_create_system_process( __("Обновление заказов в &laquo;Озон&raquo;", "usam" ), $this->id, [&$this, 'update_orders_from_ozon'], 1000, 'ozon_application_update_orders-'.$this->id );       
    613681    }
    614682   
     
    653721        {
    654722            $status = usam_get_status_code_by_meta( 'ozon_id', $parameters['new_state'], 'order' );
    655             usam_update_order( $order_id, ["status" => $status]);       
     723            if( $status )
     724                usam_update_order( $order_id, ["status" => $status]);       
    656725        }
    657726        return ["result" => true];
     
    749818    {               
    750819        $ip = $_SERVER['REMOTE_ADDR'];
     820       
     821       
     822     $Log = new USAM_Log_File( 'rest_api' );
     823    $Log->fwrite_array( $ip );
     824   
    751825        if( usam_ip_in_range($ip, '195.34.21.0/24') || usam_ip_in_range($ip, '185.73.192.0/22') || usam_ip_in_range($ip, '91.223.93.0/24') || WP_DEBUG && usam_ip_in_range($ip, '127.0.0.1/24') )
    752826        {
    753827            $parameters = $request->get_json_params();
     828           
     829             $Log = new USAM_Log_File( 'rest_api_parameters' );
     830    $Log->fwrite_array( $parameters );
     831   
    754832            if( isset($parameters['message_type']) )
    755833            {
     
    767845    public function order_status_settings_edit_form( $t, $data )
    768846    {
    769         $statuses = [
     847        $statuses = [       
     848            'posting_created' => 'Заказ создан',
    770849            'posting_acceptance_in_progress' => 'идёт приёмка',
    771850            'posting_transferring_to_delivery' => 'передаётся в доставку',
     
    782861            'posting_driver_pick_up' => 'у водителя',
    783862            'posting_delivered' => 'доставлено',
    784             'posting_not_in_sort_center' => 'не принят на сортировочном центре'
     863            'posting_not_in_sort_center' => 'не принят на сортировочном центре',
     864            'posting_registered' => 'зарегистрировано',
     865            'posting_awaiting_passport_data' => 'ожидает паспортных данных',
     866            'posting_awaiting_registration' => 'ожидает регистрации',
     867            'posting_registration_error' => 'ошибка регистрации',
     868            'posting_split_pending' => 'создано',
     869            'posting_canceled' => 'отменено',
     870            'posting_received' => 'получено',
     871            'posting_returned_to_warehouse' => 'возвращено на склад',
     872            'sent_by_seller' => 'отправлено продавцом',     
    785873        ];
    786         ?>
     874        ?>     
    787875        <div class ="edit_form__item">
    788876            <div class ="edit_form__item_name"><?php esc_html_e( 'Соответствия статусам ozon' , 'usam'); ?>:</div>
    789877            <div class ="edit_form__item_option">                   
    790                 <select v-model='ozon_id'>                     
     878                <select v-model='data.ozon_id'>                     
    791879                    <option value=''><?php esc_html_e('Не выбранно' , 'usam'); ?></option>
    792880                    <?php
     
    802890    }
    803891   
    804     public function order_status_edit_form_data( $data, $t )
    805     {
    806         $data['ozon_id'] = usam_get_object_status_metadata( $data['id'], 'ozon_id' );
     892    public function order_status_edit_form_data( $data, $t, $form_name )
     893    {       
     894        if( $form_name == 'status' && $data['type'] == 'order' )
     895            $data['ozon_id'] = usam_get_object_status_metadata( $data['id'], 'ozon_id' );
    807896        return $data;
    808897    }   
    809898   
    810899    public function object_status_save( $id, $data )
    811     {
     900    {   
    812901        if( isset($data['ozon_id']) )
    813         {
     902        {   
    814903            $object_status = usam_get_object_status( $id );
    815904            if( $object_status['type'] == 'order' )
     
    818907    }
    819908   
     909    public function after_edit_form( $t, $form_name )
     910    {
     911        if( $form_name == 'storage' && $this->option['work_option'] == 'fbs' )
     912        {           
     913            $storages = $this->get_storages();
     914            ?> 
     915            <usam-box id="usam_ozon_storage_setting" :title="'<?php _e( 'Озон', 'usam'); ?>'" :handle="false">
     916                <template v-slot:body>
     917                    <div class="edit_form">                 
     918                        <div class ="edit_form__item">
     919                            <div class ="edit_form__item_name"><?php _e( 'Связь со складом в озон', 'usam'); ?>:</div>
     920                            <div class ="edit_form__item_option">
     921                                <select v-model="data.ozon_id">
     922                                    <option value=''><?php esc_html_e('Не выбранно' , 'usam'); ?></option>
     923                                    <?php
     924                                    foreach( $storages as $storage )
     925                                    {
     926                                        ?><option value='<?php echo $storage['warehouse_id'] ?>'><?php echo $storage['name'] ?></option><?php
     927                                    }
     928                                    ?>
     929                                </select>                               
     930                            </div>
     931                        </div>
     932                    </div>
     933                </template>
     934            </usam-box>
     935            <?php
     936        }
     937    }   
     938   
     939    public function product_metabox_codes( $codes )
     940    {   
     941        $codes['ozon_id']   = __( 'Код озон', 'usam');
     942        return $codes;
     943    }
     944   
     945    public function view_form_order_main( $id, $data )
     946    {       
     947        $ozon_id = usam_get_order_metadata($id , 'ozon_id' );
     948        if( $ozon_id )
     949        {
     950            ?>
     951            <div class ="view_data__row">
     952                <div class ="view_data__name"><?php _e( 'Номер заказа в озон','usam'); ?>:</div>
     953                <div class ="view_data__option">
     954                    <?php echo $ozon_id; ?>
     955                </div>
     956            </div>
     957            <?php
     958        }
     959    }
     960   
    820961    public function admin_init()
    821     {
    822         if( current_user_can( 'setting_document' ) )           
    823             add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
    824        
    825         add_action( 'usam_order_status_settings_edit_form',  [&$this, 'order_status_settings_edit_form'], 10, 2 ); 
    826         add_filter( 'usam_order_status_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 2 );
     962    {       
     963        add_action( 'usam_order_status_settings_edit_form',  [&$this, 'order_status_settings_edit_form'], 10, 2 );         
     964        add_filter( 'usam_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 3 );       
    827965   
    828966        add_filter( 'usam_terms_section_tabs', [&$this, 'terms_section_tabs'], 10, 2 );
     
    833971        add_action('edited_usam-category', [&$this, 'save_category_form'], 10 , 2 );
    834972        add_filter('bulk_actions-edit-usam-product', [&$this, 'register_bulk_actions'] );   
    835         add_action('handle_bulk_actions-edit-usam-product', [&$this, 'bulk_action_handler'], 10, 3);
     973        add_action('handle_bulk_actions-edit-usam-product', [&$this, 'bulk_action_handler'], 10, 3);       
     974       
     975        add_action('usam_after_edit_form', [&$this, 'after_edit_form'], 10, 2);
     976        add_action('usam_view_form_order_main', [&$this, 'view_form_order_main'], 10, 2);
    836977    }
    837978   
     
    843984                add_action('admin_init', [&$this, 'admin_init']);
    844985           
     986            if( current_user_can( 'setting_document' ) )           
     987                add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
     988       
    845989            add_action('usam_ozon_update_ozon_id',  [&$this, 'update_ozon_id'] );
    846990            add_action('rest_api_init', [$this,'register_routes']);         
    847991                   
    848992            add_action('usam_application_update_stock_schedule_'.$this->option['service_code'],  [$this, 'cron_update_stock']);
    849             add_action('usam_application_update_prices_schedule_'.$this->option['service_code'],  [$this, 'cron_update_prices']);
     993            add_action('usam_application_update_prices_schedule_'.$this->option['service_code'],  [$this, 'cron_update_prices']);                       
     994            add_action( 'usam_ten_minutes_cron_task', [&$this, 'cron_update_orders'] );
    850995           
    851996            add_action('usam_filter_options_exporting_product_platforms',  [$this, 'filter_options_exporting_product_platforms']);
     997            add_filter( 'usam_product_metabox_codes', [&$this, 'product_metabox_codes'], 10, 2 );
    852998        }
    853999    }
  • universam-demo/trunk/includes/integration/applications/yandexmarket/yandexmarket.php

    r3255608 r3298857  
    406406    }   
    407407   
    408 public function object_status_save( $id, $data )
     408    public function object_status_save( $id, $data )
    409409    {
    410410        if( isset($data['yandex_id']) )
     
    417417   
    418418    public function admin_init()
    419     {
    420         if( current_user_can( 'setting_document' ) )           
    421             add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
    422        
     419    {       
    423420        add_action( 'usam_order_status_settings_edit_form',  [&$this, 'order_status_settings_edit_form'], 10, 2 ); 
    424421        add_filter( 'usam_order_status_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 2 );
     
    485482    public function service_load( )
    486483    {   
     484        if( current_user_can( 'setting_document' ) )           
     485            add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2);
     486       
    487487        add_action('rest_api_init', [$this,'register_routes']);
    488488        add_action( 'usam-category_edit_form_fields', [&$this, 'edit_category_forms'], 11, 2 );
  • universam-demo/trunk/theme/usam-global-style.css

    r3295959 r3298857  
    22862286.html_block_faq__item.show .svg_icon_minus{display:block}
    22872287
    2288 .html_block_harmonic .html_block_container{display:flex; flex-direction: column;}
    2289 .html_block_harmonic__item{border-radius:var(--radius); border-color:transparent; overflow:hidden}
    2290 .html_block_harmonic__item{border: 1px solid var(--main-color);}   
    2291 .html_block_harmonic__name{display:flex; align-items:center; justify-content:space-between; padding:20px 20px; font-size:1.2rem; font-weight:700; cursor:pointer; background:var(--main-color); transition: all 0.2s;}
    2292 .html_block_harmonic__item.show .html_block_harmonic__name{background:transparent}
    2293 .html_block_harmonic__content{-webkit-transition:max-height 0.5s ease; transition:max-height 0.5s ease; max-height:0; overflow:hidden;}
    2294 .html_block_harmonic__item.show .html_block_harmonic__content{max-height:300px;}
    2295 .html_block_harmonic__content_items{padding:0 20px 10px 20px;}
     2288.html_block_accordion .html_block_container{display:flex; flex-direction: column;}
     2289.html_block_accordion__item{border-radius:var(--radius); border-color:transparent; overflow:hidden}
     2290.html_block_accordion__item{border: 1px solid var(--main-color);}   
     2291.html_block_accordion__name{display:flex; align-items:center; justify-content:space-between; padding:20px 20px; font-size:1.2rem; font-weight:700; cursor:pointer; background:var(--main-color); transition: all 0.2s;}
     2292.html_block_accordion__item.show .html_block_accordion__name{background:transparent}
     2293.html_block_accordion__content{-webkit-transition:max-height 0.5s ease; transition:max-height 0.5s ease; max-height:0; overflow:hidden;}
     2294.html_block_accordion__item.show .html_block_accordion__content{max-height:300px;}
     2295.html_block_accordion__content_items{padding:0 20px 10px 20px;}
    22962296/*
    2297 .html_block_harmonic__item.current .html_block_harmonic__name{background:transparent}
    2298 .html_block_harmonic__content{padding:0 20px 10px 20px; -webkit-transition:max-height 0.35s ease; transition:max-height 0.35s ease; display:none}
    2299 .html_block_harmonic__content.collapsing{display:block; max-height:0;}
    2300 .html_block_harmonic__item.current .html_block_harmonic__content{display:block; max-height:3000px;}
     2297.html_block_accordion__item.current .html_block_accordion__name{background:transparent}
     2298.html_block_accordion__content{padding:0 20px 10px 20px; -webkit-transition:max-height 0.35s ease; transition:max-height 0.35s ease; display:none}
     2299.html_block_accordion__content.collapsing{display:block; max-height:0;}
     2300.html_block_accordion__item.current .html_block_accordion__content{display:block; max-height:3000px;}
    23012301
    23022302.collapsing_{height:0; overflow:hidden; -webkit-transition:max-height 2.35s ease; transition:max-height 2.35s ease;}
  • universam-demo/trunk/universam.php

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