Changeset 3298857
- Timestamp:
- 05/22/2025 02:29:22 PM (10 months ago)
- Location:
- universam-demo/trunk
- Files:
-
- 26 edited
-
admin/assets/css/admin.css (modified) (5 diffs)
-
admin/assets/css/element_form.css (modified) (1 diff)
-
admin/assets/css/tabs/feedback.css (modified) (1 diff)
-
admin/assets/js/admin.js (modified) (10 diffs)
-
admin/form/edit-form-application.php (modified) (1 diff)
-
admin/form/edit-form-parser_competitor.php (modified) (1 diff)
-
admin/form/edit-form-parser_supplier.php (modified) (1 diff)
-
admin/form/edit-form-storage.php (modified) (1 diff)
-
admin/form/view-form-order.php (modified) (2 diffs)
-
admin/includes/edit_form.class.php (modified) (1 diff)
-
admin/list-table/orders_list_table.php (modified) (1 diff)
-
admin/templates/template-parts/html-blocks.php (modified) (1 diff)
-
admin/templates/template-parts/table-products-order.php (modified) (2 diffs)
-
admin/templates/vue-templates/table-products.php (modified) (4 diffs)
-
assets/js/universam.theme.js (modified) (1 diff)
-
includes/application.class.php (modified) (2 diffs)
-
includes/block/htmlblocks/faq/index.php (modified) (1 diff)
-
includes/block/htmlblocks/harmonic/index.php (modified) (3 diffs)
-
includes/block/htmlblocks/library-registered-blocks.php (modified) (16 diffs)
-
includes/document/order.helpers.php (modified) (1 diff)
-
includes/exchange/API/rest_route/API.php (modified) (1 diff)
-
includes/integration/applications/moysklad.php (modified) (3 diffs)
-
includes/integration/applications/ozon/ozon.php (modified) (18 diffs)
-
includes/integration/applications/yandexmarket/yandexmarket.php (modified) (3 diffs)
-
theme/usam-global-style.css (modified) (1 diff)
-
universam.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
universam-demo/trunk/admin/assets/css/admin.css
r3295959 r3298857 120 120 .htmlblock_elements{display:flex; gap:20px; width:100%;} 121 121 .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%; p adding:5px; position:relative;}122 .htmlblock_elements_group{border-radius:5px; background-color:#F4F4F4; transition:all .2sease; display:flex; cursor:pointer; width:100%; position:relative;} 123 123 .htmlblock_elements_group:hover{box-shadow:0 4px 20px rgba(0, 0, 0, .1);} 124 124 .htmlblock_elements_column{align-items:center; min-height:45px; } … … 131 131 .element_content__none_items{width:100%; height:100%} 132 132 .home_page__item:hover .home_page__item_name >.element_actions, 133 .element_content:hover.element_actions{visibility:visible;}133 div:hover > .element_actions{visibility:visible;} 134 134 .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} 135 136 136 137 .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} 138 139 .htmlblock_tabs__header.current{border-bottom: 2px solid var(--main-open-color); color: var(--main-open-color);} 139 140 .htmlblock_tabs__header .editable{width:100%;} … … 141 142 .htmlblock_tabs__content .htmlblock_elements_group{display:none;} 142 143 .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} 144 145 145 146 .htmlblock_faq{flex-direction: column;} 146 .htmlblock_faq__content{width:100%; }147 .htmlblock_faq__content{width:100%; position:relative;} 147 148 .htmlblock_faq__title{font-size:20px; font-weight:600; margin-bottom:20px} 148 149 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} 152 153 153 154 .modalSidebar80{width:80%;} … … 350 351 .user_comment__user_name{font-weight:700;} 351 352 .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; } 353 354 .message_not_read{background-color:#EDF1F5!important; border-style:solid; border-color:#DAE1E8; border-width:0px 0px 1px 0px;} 354 355 … … 702 703 .wp-list-table .column-date{width:auto} 703 704 .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;} 705 706 .wp-list-table .column-product_title .product_sku{font-weight:600;} 706 707 .wp-list-table .column-product_title .product_sku span{font-weight:400;} -
universam-demo/trunk/admin/assets/css/element_form.css
r3282898 r3298857 53 53 .header_main h4.header_content_name{background-color:#ffffff; border-bottom: 1px #e5e5e5 solid; margin:0;} 54 54 .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;} 55 57 56 58 .usam_view_form_tabs{margin-top:20px;} -
universam-demo/trunk/admin/assets/css/tabs/feedback.css
r3282898 r3298857 56 56 .status_message{padding:5px; border-radius:10px;} 57 57 .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%} 59 60 .user_block__message{overflow: hidden; text-overflow: ellipsis;} 60 61 .user_block__message_preview{white-space: nowrap;} -
universam-demo/trunk/admin/assets/js/admin.js
r3295959 r3298857 1680 1680 accruedBonuses() { 1681 1681 var b = 0; 1682 for (let k in this. products)1683 b += this. products[k].bonus1684 return b;1682 for (let k in this.data.products) 1683 b += this.data.products[k].bonus 1684 return b; 1685 1685 }, 1686 1686 change_payment() { … … 11108 11108 template:`<div class="htmlblock_tabs"> 11109 11109 <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"> 11111 11111 <editable v-model="block.options.name.value"/> 11112 11112 </div> 11113 11113 <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> 11114 11117 <editable v-model="column.name"/> 11115 11118 </div> … … 11135 11138 { 11136 11139 if( !v.columns.length ) 11137 v.columns = [ this.default_]11140 v.columns = [structuredClone(this.default_)] 11138 11141 this.block = v; 11139 11142 } … … 11159 11162 methods: { 11160 11163 add() { 11161 this.block.columns.push( this.default_);11164 this.block.columns.push( structuredClone(this.default_) ); 11162 11165 }, 11163 11166 del(blocks, i) { … … 11170 11173 template:`<div class="htmlblock_faq htmlblock_elements"> 11171 11174 <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> 11172 11178 <editable v-model="column.name" :classes="'htmlblock_faq__title'"></editable> 11173 11179 <div class="htmlblock_elements_group htmlblock_elements_row"> … … 11190 11196 { 11191 11197 if( !v.columns.length ) 11192 v.columns = [ this.default_]11198 v.columns = [structuredClone(this.default_)] 11193 11199 this.block = v; 11194 11200 } … … 11214 11220 methods: { 11215 11221 add() { 11216 this.block.columns.push( this.default_);11222 this.block.columns.push( structuredClone(this.default_) ); 11217 11223 }, 11218 11224 del(blocks, i) { … … 11222 11228 }) 11223 11229 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> 11230 Vue.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> 11228 11237 <div class="htmlblock_elements_group htmlblock_elements_row"> 11229 11238 <div class='element_content' v-for='(element, j) in column.blocks'> … … 11245 11254 { 11246 11255 if( !v.columns.length ) 11247 v.columns = [ this.default_]11256 v.columns = [structuredClone(this.default_)] 11248 11257 this.block = v; 11249 11258 } … … 11269 11278 methods: { 11270 11279 add() { 11271 this.block.columns.push( this.default_);11280 this.block.columns.push( structuredClone(this.default_) ); 11272 11281 }, 11273 11282 del(blocks, i) { -
universam-demo/trunk/admin/form/edit-form-application.php
r3282898 r3298857 64 64 <div class ="edit_form__item_name">{{property.name}}</div> 65 65 <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> 67 67 </div> 68 68 <div class="edit_form__item_option" v-else> -
universam-demo/trunk/admin/form/edit-form-parser_competitor.php
r3148881 r3298857 126 126 </template> 127 127 </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 } 137 142 } 138 143 } -
universam-demo/trunk/admin/form/edit-form-parser_supplier.php
r3201974 r3298857 233 233 </template> 234 234 </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 } 244 249 } 245 250 } -
universam-demo/trunk/admin/form/edit-form-storage.php
r3234981 r3298857 27 27 protected function get_data_tab() 28 28 { 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' => '']; 30 30 $sales_area = usam_get_sales_regions(); 31 31 foreach ( $sales_area as $sale_area ) -
universam-demo/trunk/admin/form/view-form-order.php
r3295959 r3298857 66 66 $this->js_args = [ 67 67 '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'] ) 69 70 ]; 70 71 $this->js_args['user'] = ['user_login' => '']; … … 253 254 <div class ="view_data__row"> 254 255 <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 ); ?> 269 271 <?php 270 272 $date_exchange = usam_get_order_metadata($this->id, 'date_exchange'); -
universam-demo/trunk/admin/includes/edit_form.class.php
r3241265 r3298857 23 23 $this->get_data_tab(); 24 24 $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 ); 25 26 if ( empty($this->data) ) 26 27 $this->not_exist = true; -
universam-demo/trunk/admin/list-table/orders_list_table.php
r3271864 r3298857 59 59 $checked = in_array($item->id, $this->records )?"checked='checked'":""; 60 60 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' ) 62 62 echo usam_system_svg_icon( $item->source, ['title' => usam_get_order_source_name($item->source)] ); 63 63 } -
universam-demo/trunk/admin/templates/template-parts/html-blocks.php
r3295959 r3298857 19 19 <htmlblock-tabs v-else-if="block.code==='blocks_tabs'" :value="block" @input="blocks[i]=$event"></htmlblock-tabs> 20 20 <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> 22 22 <div class="htmlblock_elements" v-else-if="block.code=='columns'"> 23 23 <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 92 92 <span v-else> 93 93 <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> 95 95 <span class="item_status item_status_valid" v-if="value.code==data.contact_type_price"><?php _e('Персональная цена', 'usam'); ?></span> 96 96 </span> 97 97 </span> 98 98 </div> 99 </div> 99 </div> 100 100 <div class ="edit_form__item" v-if="bonuses_displayed"> 101 101 <div class="edit_form__item_name"><?php esc_html_e( 'Сумма бонусов за покупку', 'usam'); ?>:</div> … … 171 171 <div class ="edit_form__item_name"><label><?php esc_html_e( 'Списать бонусы с карты', 'usam'); ?>:</label></div> 172 172 <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)"> 174 174 </div> 175 175 </div> -
universam-demo/trunk/admin/templates/vue-templates/table-products.php
r3295959 r3298857 42 42 <td :colspan = 'tableColumns.length'><slot name="empty"><?php _e( 'Нет товаров', 'usam'); ?></slot></td> 43 43 </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> 45 45 <tr v-if="products.length" v-for="(product, i) in products"> 46 46 <td :class="'column-'+column.id" v-for="column in tableColumns"> … … 81 81 </div> 82 82 </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"> 84 84 <div class = 'order_discount_name'><?php esc_html_e( 'Акции на товар', 'usam'); ?></div> 85 85 <div class = 'order_discount_rules'> … … 123 123 <div class = "quantity_product" v-if="edit"> 124 124 <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"> 126 126 <option v-for="additional_unit in product.units" :value="additional_unit.code" v-html="additional_unit.in"></option> 127 127 </select> … … 157 157 </tbody> 158 158 <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> 160 160 </tfoot> 161 161 </table> -
universam-demo/trunk/assets/js/universam.theme.js
r3295959 r3298857 1495 1495 }); 1496 1496 }); 1497 document.querySelectorAll('.html_block_ harmonic').forEach((el) =>1497 document.querySelectorAll('.html_block_accordion').forEach((el) => 1498 1498 new Vue({ 1499 1499 el: el, -
universam-demo/trunk/includes/application.class.php
r3283660 r3298857 35 35 if ( is_array($metas) ) 36 36 { 37 foreach( $metas as $metadata )37 foreach( $metas as $metadata ) 38 38 { 39 $value = maybe_unserialize( $metadata->meta_value ); 39 40 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 } 41 47 else 42 $this->option[$metadata->meta_key] = maybe_unserialize( $metadata->meta_value );48 $this->option[$metadata->meta_key] = $value; 43 49 } 44 50 } … … 60 66 { 61 67 foreach( $block['options'] as $option ) 62 $default[$option['code']] = $option['default'];68 $default[$option['code']] = isset($option['default']) ? $option['default'] : ''; 63 69 } 64 70 return $default; -
universam-demo/trunk/includes/block/htmlblocks/faq/index.php
r3295959 r3298857 5 5 { 6 6 ?> 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"> 8 8 <div class="html_block_faq__name"> 9 9 <?php echo $column['name']; ?> -
universam-demo/trunk/includes/block/htmlblocks/harmonic/index.php
r3295959 r3298857 5 5 { 6 6 ?> 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"> 9 9 <?php echo $column['name']; ?> 10 10 <?php usam_svg_icon("plus", ["v-show" => "tab!=".$k]); ?> 11 11 <?php usam_svg_icon("minus", ["v-show" => "tab==".$k]); ?> 12 12 </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"> 15 15 <?php 16 16 foreach ($column['blocks'] as $item ) … … 36 36 $css_data .= "#html_block_{$block['id']} .html_block_container{gap:{$block['content_style']['gap']}}"; 37 37 if( $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']}}"; 39 39 $name_css = ''; 40 40 $show_name_css = ''; … … 50 50 } 51 51 if( $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."}"; 53 53 if( $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."}"; 55 55 ?> -
universam-demo/trunk/includes/block/htmlblocks/library-registered-blocks.php
r3295959 r3298857 17 17 ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'view', 'value' => 'variant1', 'options' => $files], 18 18 ['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' => [ 20 20 ['id' => 'left', 'name' => __('Влево', 'usam')], 21 21 ['id' => 'center', 'name' => __('Центр', 'usam')], … … 60 60 ['field_type' => 'color', 'name' => __('Цвет элемента', 'usam'), 'code' => 'background-color', 'value' => ''], 61 61 ['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')]]], 63 63 ] 64 64 ]); … … 89 89 usam_register_htmlblock('faq', [ 90 90 'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/faq/index.php", 91 'html_name' => __('FAQ – Часто задаваемые вопросы', 'usam'), // Имя блока для администратора91 'html_name' => 'FAQ', // Имя блока для администратора 92 92 'group' => 'design', 93 93 'options' => [ // список опций блока … … 105 105 ]); 106 106 107 usam_register_htmlblock(' harmonic', [108 'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/ harmonic/index.php",109 'html_name' => __(' Гармошка', 'usam'), // Имя блока для администратора107 usam_register_htmlblock('accordion', [ 108 'render' => USAM_FILE_PATH . "/includes/block/htmlblocks/accordion/index.php", 109 'html_name' => __('Аккордеон с одной открытой вкладкой', 'usam'), // Имя блока для администратора 110 110 'group' => 'design', 111 111 'cloak' => true, … … 158 158 ['field_type' => 'buttons', 'name' => __('Карусель', 'usam'), 'code' => 'carousel', 'value' => 0], 159 159 ['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')]]], 161 161 ], 162 162 ]); … … 199 199 ['id' => 'right', 'name' => __('Вправо', 'usam')], 200 200 ], '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')]]], 202 202 ], 203 203 ]); … … 261 261 ['id' => 'right', 'name' => __('Вправо', 'usam')], 262 262 ], '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')]]], 264 264 ], 265 265 ]); … … 282 282 ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid], 283 283 ['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')]]], 285 285 ] 286 286 ]); … … 303 303 'content_style' => [ 304 304 ['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')]]], 306 306 ] 307 307 ]); … … 324 324 'content_style' => [ 325 325 ['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')]]], 327 327 ['field_type' => 'select', 'name' => __('Выравнивание вкладок', 'usam'), 'code' => 'align-tabs', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]], 328 328 ['field_type' => 'text', 'name' => __('Отступы между вкладками', 'usam'), 'code' => 'gap', 'value' => ''], … … 355 355 'content_style' => [ 356 356 ['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')]]], 358 358 ['field_type' => 'select', 'name' => __('Выравнивание вкладок', 'usam'), 'code' => 'align-tabs', 'value' => 'left', 'options' => [['id' => 'left', 'name' => __('Влево', 'usam')], ['id' => 'center', 'name' => __('Центр', 'usam')], ['id' => 'right', 'name' => __('Вправо', 'usam')]]], 359 359 ['field_type' => 'text', 'name' => __('Отступы между вкладками', 'usam'), 'code' => 'gap', 'value' => ''], … … 386 386 ['field_type' => 'images', 'name' => __('Внешний вид', 'usam'), 'code' => 'grid', 'value' => get_option("usam_product_grid", 'default'), 'options' => $product_grid ], 387 387 ['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')]]], 389 389 ] 390 390 ]); … … 405 405 'content_style' => [ 406 406 ['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')]]], 408 408 ] 409 409 ]); … … 421 421 'content_style' => [ // Стиль элементов 422 422 ['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')]]], 424 424 ], 425 425 ]); … … 687 687 'content_style' => [ // стили для блока 688 688 ['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')]]], 690 690 ] 691 691 ]); … … 700 700 ], 701 701 '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')]]], 703 703 ], 704 704 'group' => 'theme', -
universam-demo/trunk/includes/document/order.helpers.php
r3201974 r3298857 186 186 function usam_get_order_source( ) 187 187 { 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')]; 189 189 return $source; 190 190 } -
universam-demo/trunk/includes/exchange/API/rest_route/API.php
r3295959 r3298857 1096 1096 private static function update_storage_metadata( $id, $parameters ) 1097 1097 { 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 ) 1099 1099 if( isset($parameters[$k]) ) 1100 1100 usam_update_storage_metadata( $id, $k, $parameters[$k] ); -
universam-demo/trunk/includes/integration/applications/moysklad.php
r3269096 r3298857 2769 2769 2770 2770 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 { 2775 2772 add_action( 'usam_order_status_settings_edit_form', [&$this, 'order_status_settings_edit_form'], 10, 2 ); 2776 2773 add_filter( 'usam_order_status_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 2 ); … … 2781 2778 if ( usam_is_license_type('SMALL_BUSINESS') || usam_is_license_type('BUSINESS') || usam_is_license_type('ENTERPRISE')) 2782 2779 { 2780 if( current_user_can( 'setting_document' ) ) 2781 add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2); 2782 2783 2783 add_action( 'admin_init', [&$this, 'admin_init']); 2784 2784 add_action( 'usam_moysklad_update_product_stock', [&$this, 'update_product_stock'] ); … … 2816 2816 add_action('usam_company_update', [&$this, 'update_company']); 2817 2817 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 ); 2819 2819 } 2820 2820 } -
universam-demo/trunk/includes/integration/applications/ozon/ozon.php
r3282898 r3298857 220 220 } 221 221 222 /* 223 quant_size 224 Используйте параметр, если у обычного и эконом-товара совпадает артикул — offer_id = quant_id. Чтобы обновить количество: 225 226 обычного товара — передайте значение 1; 227 эконом-товара — передайте размер его кванта. 228 Если у обычного и эконом-товара разные артикулы, не передавайте параметр. 229 */ 222 230 public function update_stock( $query_vars = [] ) 223 231 { 232 if( empty($this->option['storage_ids']) ) 233 return false; 234 224 235 $query_vars = [] ; 225 $query_vars['posts_per_page'] = 20;236 $query_vars['posts_per_page'] = 100; //За один запрос можно изменить наличие для 100 товаров. 226 237 if ( !isset($query_vars['post_status']) ) 227 238 $query_vars['post_status'] = 'any'; 228 239 $query_vars['fields'] = 'ids'; 229 $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => ' EXISTS']];240 $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => '!=', 'value' => '']]; 230 241 $query_vars['stocks_cache'] = true; 231 242 $query_vars['prices_cache'] = false; 232 243 233 $products = usam_get_products( $query_vars ); 234 244 $products = usam_get_products( $query_vars ); 235 245 $items = []; 236 246 foreach( $products as $key => $product_id ) 237 247 { 238 if( $this->option['storage_ids'])248 foreach( $this->option['storage_ids'] as $storage_id ) 239 249 { 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 248 265 $result = false; 249 266 if ( $items ) 250 267 { 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); 253 272 } 254 273 return count($items); … … 257 276 public function update_prices( $query_vars = [] ) 258 277 { 259 $query_vars['posts_per_page'] = 20;278 $query_vars['posts_per_page'] = 100; //За один запрос можно изменить наличие для 100 товаров. 260 279 if ( !isset($query_vars['post_status']) ) 261 280 $query_vars['post_status'] = 'any'; 262 281 $query_vars['fields'] = 'ids'; 263 $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => ' EXISTS']];282 $query_vars['productmeta_query'] = [['key' => 'ozon_id', 'compare' => '!=', 'value' => '']]; 264 283 $query_vars['prices_cache'] = true; 265 284 $query_vars['stocks_cache'] = false; … … 323 342 return ['ozon_category_id' => $category_id, 'ozon_product_type' => $ozon_product_type]; 324 343 } 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 } 325 354 326 355 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 ); 329 363 $args = $this->get_args( 'POST', $query_vars ); 330 364 $result = $this->send_request( "v3/posting/fbs/list", $args ); 331 365 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 } 333 370 return false; 334 371 } … … 346 383 protected function handle_request( $result, $function, $params ) 347 384 { 385 $Log = new USAM_Log_File( 'handle_request' ); 386 $Log->fwrite_array( $function ); 387 $Log->fwrite_array( $result ); 388 348 389 if ( !empty($result['code']) && !empty($result['message']) ) 349 { 390 { 350 391 $this->set_error( $result['message'], $function, $params ); 351 392 return false; 352 393 } 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 } 353 405 return $result; 354 406 } … … 388 440 ['field_type' => 'text', 'name' => 'Client ID', 'code' => 'login', 'default' => ''], 389 441 ['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'], 391 447 ]], 392 448 ['name' => __('Обновление товаров', 'usam'), 'code' => 'product', 'options' => [ … … 403 459 ['field_type' => 'select', 'name' => __('Автоматический обновление цен каждые', 'usam'), 'code' => 'update_prices_schedule', 'options' => $schedules, 'default' => ''], 404 460 ['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'], 407 463 ]], 408 464 ['name' => __('Обновление заказов', 'usam'), 'code' => 'order', 'options' => [ … … 545 601 546 602 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']]; 549 605 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' ); 551 607 $metas = ['ozon_id' => $document['posting_number'], 'warehouse_id' => $document['warehouse_id']]; //'seller_id' => $parameters['seller_id'] 552 608 $products = []; 553 609 foreach( $document['products'] as $product ) 554 610 { 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'] ); 556 612 $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]; 560 616 } 561 617 562 618 function update_orders_from_ozon($id, $number, $event) 563 619 { 564 $results = $this->get_orders(); 620 $results = $this->get_orders(); 565 621 $done = 0; 566 if( !$results )622 if( $results ) 567 623 { 568 624 $codes = []; 569 foreach( $ parameters['postings'] as $v )625 foreach( $results['postings'] as $v ) 570 626 $codes[] = $v['posting_number']; 571 627 usam_get_order_ids_by_code( $codes, 'ozon_id' ); 572 628 unset($codes); 573 629 usam_update_object_count_status( false ); 574 foreach( $ parameters['postings'] as $document )630 foreach( $results['postings'] as $document ) 575 631 { 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 576 642 $order_id = usam_get_order_id_by_meta('ozon_id', $document['posting_number']); 577 643 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 ); 582 646 if( $order_id ) 583 647 { … … 587 651 } 588 652 } 589 } 653 } 654 else 655 { 656 usam_update_order( $order_id, $order, $products, $metas ); 657 } 590 658 } 591 659 usam_update_object_count_status( true ); … … 599 667 { 600 668 $i = usam_get_total_products(['productmeta_query' => [['key' => 'ozon_id', 'compare' => 'EXISTS']]]); 601 usam_create_system_process( __("Обновление остатков в «Озон»", "usam" ), $this->id, [&$this, 'update_stock_from_ozon'], $i, 'ozon_application_update_stock-'.$this->id ); 669 usam_create_system_process( __("Обновление остатков в «Озон»", "usam" ), $this->id, [&$this, 'update_stock_from_ozon'], $i, 'ozon_application_update_stock-'.$this->id ); 602 670 } 603 671 … … 609 677 610 678 function cron_update_orders() 611 { 612 usam_create_system_process( __("Обновление заказов в «Озон»", "usam" ), $this->id, [&$this, 'update_orders_from_ozon'], 100 , 'ozon_application_update_orders-'.$this->id );679 { 680 usam_create_system_process( __("Обновление заказов в «Озон»", "usam" ), $this->id, [&$this, 'update_orders_from_ozon'], 1000, 'ozon_application_update_orders-'.$this->id ); 613 681 } 614 682 … … 653 721 { 654 722 $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]); 656 725 } 657 726 return ["result" => true]; … … 749 818 { 750 819 $ip = $_SERVER['REMOTE_ADDR']; 820 821 822 $Log = new USAM_Log_File( 'rest_api' ); 823 $Log->fwrite_array( $ip ); 824 751 825 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') ) 752 826 { 753 827 $parameters = $request->get_json_params(); 828 829 $Log = new USAM_Log_File( 'rest_api_parameters' ); 830 $Log->fwrite_array( $parameters ); 831 754 832 if( isset($parameters['message_type']) ) 755 833 { … … 767 845 public function order_status_settings_edit_form( $t, $data ) 768 846 { 769 $statuses = [ 847 $statuses = [ 848 'posting_created' => 'Заказ создан', 770 849 'posting_acceptance_in_progress' => 'идёт приёмка', 771 850 'posting_transferring_to_delivery' => 'передаётся в доставку', … … 782 861 'posting_driver_pick_up' => 'у водителя', 783 862 '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' => 'отправлено продавцом', 785 873 ]; 786 ?> 874 ?> 787 875 <div class ="edit_form__item"> 788 876 <div class ="edit_form__item_name"><?php esc_html_e( 'Соответствия статусам ozon' , 'usam'); ?>:</div> 789 877 <div class ="edit_form__item_option"> 790 <select v-model=' ozon_id'>878 <select v-model='data.ozon_id'> 791 879 <option value=''><?php esc_html_e('Не выбранно' , 'usam'); ?></option> 792 880 <?php … … 802 890 } 803 891 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' ); 807 896 return $data; 808 897 } 809 898 810 899 public function object_status_save( $id, $data ) 811 { 900 { 812 901 if( isset($data['ozon_id']) ) 813 { 902 { 814 903 $object_status = usam_get_object_status( $id ); 815 904 if( $object_status['type'] == 'order' ) … … 818 907 } 819 908 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 820 961 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 ); 827 965 828 966 add_filter( 'usam_terms_section_tabs', [&$this, 'terms_section_tabs'], 10, 2 ); … … 833 971 add_action('edited_usam-category', [&$this, 'save_category_form'], 10 , 2 ); 834 972 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); 836 977 } 837 978 … … 843 984 add_action('admin_init', [&$this, 'admin_init']); 844 985 986 if( current_user_can( 'setting_document' ) ) 987 add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2); 988 845 989 add_action('usam_ozon_update_ozon_id', [&$this, 'update_ozon_id'] ); 846 990 add_action('rest_api_init', [$this,'register_routes']); 847 991 848 992 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'] ); 850 995 851 996 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 ); 852 998 } 853 999 } -
universam-demo/trunk/includes/integration/applications/yandexmarket/yandexmarket.php
r3255608 r3298857 406 406 } 407 407 408 public function object_status_save( $id, $data )408 public function object_status_save( $id, $data ) 409 409 { 410 410 if( isset($data['yandex_id']) ) … … 417 417 418 418 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 { 423 420 add_action( 'usam_order_status_settings_edit_form', [&$this, 'order_status_settings_edit_form'], 10, 2 ); 424 421 add_filter( 'usam_order_status_edit_form_data', [&$this, 'order_status_edit_form_data'], 10, 2 ); … … 485 482 public function service_load( ) 486 483 { 484 if( current_user_can( 'setting_document' ) ) 485 add_action( 'usam_object_status_api_save', [&$this, 'object_status_save'], 10, 2); 486 487 487 add_action('rest_api_init', [$this,'register_routes']); 488 488 add_action( 'usam-category_edit_form_fields', [&$this, 'edit_category_forms'], 11, 2 ); -
universam-demo/trunk/theme/usam-global-style.css
r3295959 r3298857 2286 2286 .html_block_faq__item.show .svg_icon_minus{display:block} 2287 2287 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;} 2296 2296 /* 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;} 2301 2301 2302 2302 .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 4 4 * Plugin URI: https://wp-universam.ru 5 5 * Description: Платформа для управления бизнесом и интернет-магазином. Встроенный парсинг, CRM, соц. сети, мессенджеры, карты, план продаж, управление остатками, контакт-центр, коммерческие предложения, счета, акты, инструменты для продвижения сайта, конструктор отчетов, файлы, рассылки, СМС. 6 * Version: 8.71.2 16 * Version: 8.71.25 7 7 * Author: universam 8 8 * Author URI: https://wp-universam.ru … … 14 14 { 15 15 protected static $_instance = null; 16 private $version = '8.71.2 1';16 private $version = '8.71.25'; 17 17 public function __construct() 18 18 {
Note: See TracChangeset
for help on using the changeset viewer.