Changeset 3202662
- Timestamp:
- 12/04/2024 09:15:57 PM (16 months ago)
- Location:
- universam-demo/trunk
- Files:
-
- 14 edited
-
admin/assets/css/admin.css (modified) (3 diffs)
-
admin/assets/js/admin.js (modified) (7 diffs)
-
admin/assets/js/taxonomy/taxonomy.js (modified) (8 diffs)
-
admin/templates/template-parts/modal-panel/modal-panel-send_email.php (modified) (1 diff)
-
admin/templates/template-parts/table_send_email.php (modified) (1 diff)
-
includes/integration/applications/moysklad.php (modified) (1 diff)
-
includes/integration/applications/ozon/ozon.php (modified) (15 diffs)
-
includes/integration/applications/vavto.php (modified) (1 diff)
-
includes/integration/applications/wildberries/wildberries.php (modified) (1 diff)
-
includes/integration/applications/yandexmarket/yandexmarket.php (modified) (1 diff)
-
includes/mailings/email.class.php (modified) (1 diff)
-
includes/mailings/send_newsletter.class.php (modified) (1 diff)
-
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
r3201974 r3202662 401 401 .mailing .modal__buttons{margin-top:10px} 402 402 .mailing .usam_attachments{margin-top:5px; min-height:50px;} 403 .mailing .usam_attachments .usam_attachments__file{display:-webkit-box; display:-ms-flexbox; display:flex; flex-direction:row; }403 .mailing .usam_attachments .usam_attachments__file{display:-webkit-box; display:-ms-flexbox; display:flex; flex-direction:row; width:auto;} 404 404 .mailing .usam_attachments img{max-height:50px;} 405 405 .mailing .usam_attachments .attachment_icon{min-height:50px; max-width:50px; margin-right:10px} … … 498 498 .usam_attachments .attachment_icon{min-height:120px; max-width:120px; display:flex; justify-content:center; align-items:center;} 499 499 .usam_attachments img{max-height:120px; height:auto; width:100%;} 500 .usam_attachments .filename{height: 12px; overflow: hidden;}501 500 .usam_attachments .attachment__file_data_download{margin-right:5px} 502 501 .usam_attachments .loading_error{color:red;} … … 1463 1462 .modal .edit_form .edit_form__item_option{width:100%} 1464 1463 .page_sidebar img{max-width:100%;} 1464 .page_sidebar .edit_form .edit_form__item_option{width:100%} 1465 1465 @media screen and (min-width:1180px) 1466 1466 { -
universam-demo/trunk/admin/assets/js/admin.js
r3201974 r3202662 6419 6419 data.description = t.getContent(); 6420 6420 } 6421 console.log(data);6422 6421 for (let i in this.sales_area) 6423 6422 data['sale_area_' + this.sales_area[i].id] = this.regions.includes(this.sales_area[i].id) … … 8408 8407 }, 8409 8408 sms:{message:'', phone:0}, 8410 letter:{message:'',email:''},8411 8409 messenger:{message:'', type:''}, 8412 8410 sidebarActive:0 … … 8421 8419 this.scrollGrid(); 8422 8420 }, 8423 mounted() { 8421 computed:{ 8422 subject() { 8423 if ( this.object_id ) 8424 { 8425 if( this.object_type == 'order' ) 8426 return 'Сообщение о вашем заказе №'+this.object_id; 8427 if( this.object_type == 'contacting' ) 8428 return 'Ответ на обращение №'+this.object_id; 8429 } 8430 return ''; 8431 }, 8432 }, 8433 mounted() { 8424 8434 this.upload(); 8425 8435 var el = document.querySelector('.js-show-more'); … … 8436 8446 }); 8437 8447 moreObserver.observe(el); 8438 } 8448 } 8439 8449 }, 8440 8450 methods:{ … … 9619 9629 props:{ 9620 9630 emails:{required:false, default:''}, 9631 subject:{type:String, required:false, default:''}, 9621 9632 attachments:{type:Array,required:false, default:() => []}, 9622 9633 object_type:{type:String, required:false, default:''}, … … 9628 9639 to:'', 9629 9640 from:'', 9630 subject:'',9641 title:this.subject, 9631 9642 signatures:[], 9632 9643 signature:'', … … 9666 9677 for (i = 0; i < this.files.length; i++) 9667 9678 files.push(this.files[i].id) 9668 usam_api('email/send', {mailbox_id:this.to, email:this.from,subject:this. subject, message:this.message, object_id:this.object_id, object_type:this.object_type, files:files}, 'POST', (r) => {9679 usam_api('email/send', {mailbox_id:this.to, email:this.from,subject:this.title, message:this.message, object_id:this.object_id, object_type:this.object_type, files:files}, 'POST', (r) => { 9669 9680 if (r) { 9670 9681 this.message = ''; 9671 this. subject= '';9682 this.title = ''; 9672 9683 this.files = []; 9673 9684 this.$emit('add', r); -
universam-demo/trunk/admin/assets/js/taxonomy/taxonomy.js
r3201974 r3202662 148 148 categories:[], 149 149 category:0, 150 product_type:0, 150 151 application_id:0 151 152 }; … … 154 155 this.application_id = application_id; 155 156 this.category = ozon_category; 157 this.product_type = ozon_product_type; 156 158 usam_api('ozon/'+this.application_id+'/categories', 'GET', (r) => this.categories = r); 157 } 159 }, 160 methods: { 161 change(e) 162 { 163 this.category = e.category_id; 164 this.product_type = e.id; 165 } 166 } 158 167 }) 159 168 } … … 161 170 162 171 Vue.component('ozon-categories', { 163 template: '<div><select-list @change=" subcategory=$event.id" :lists="lists" :selected="subcategory"></select-list><ozon-categories-contents v-if="subcategory>0 && parentsCategories.length>0" @change="category=$event" :lists="parentsCategories" :selected="selected"/></div>',172 template: '<div><select-list @change="change" :lists="lists" :selected="subcategory"></select-list><ozon-categories v-if="subcategory>0 && parentsCategories.length>0" :lists="parentsCategories" @change="$emit(`change`, $event)" :selected="selected"/></div>', 164 173 props: {'lists': Array, 'selected': Number|String}, 165 174 watch:{ … … 167 176 { 168 177 if ( val ) 169 this.subcategory = this.loadSubCategory( this.lists ); 170 178 this.subcategory = this.loadSubCategory( this.lists ); 171 179 }, 172 180 lists(val, oldVal) … … 174 182 this.load(); 175 183 }, 176 subcategory(val, oldVal)177 {178 if ( !this.parentsCategories.length )179 this.$emit('change', val);180 },181 category(val, oldVal)182 {183 if ( this.parentsCategories.length )184 this.$emit('change', val);185 }186 184 }, 187 185 computed: { … … 192 190 }, 193 191 data() { 194 return {subcategory:0 , category:0}192 return {subcategory:0} 195 193 }, 196 194 mounted() … … 203 201 if ( this.selected ) 204 202 this.subcategory = this.loadSubCategory( this.lists ); 203 }, 204 change(e) 205 { 206 this.subcategory = e.id; 207 this.$emit('change', e); 205 208 }, 206 209 loadSubCategory( lists ) … … 221 224 } 222 225 }) 223 Vue.component('ozon-categories-contents', {224 template: '<div><ozon-categories @change="$emit(`change`, $event)" :lists="lists" :selected="selected"/></div>',225 props: {'lists': Array, 'selected': Number|String},226 }) -
universam-demo/trunk/admin/templates/template-parts/modal-panel/modal-panel-send_email.php
r3133815 r3202662 2 2 <template v-slot:title><?php _e('Написать письмо', 'usam'); ?></template> 3 3 <template v-slot:body="modalProps"> 4 <send-email :emails="contact.emails" :object_id="object_id" :object_type="object_type" @add="addEmail" inline-template>4 <send-email :emails="contact.emails" :object_id="object_id" :object_type="object_type" @add="addEmail" :subject="subject" inline-template> 5 5 <?php include( usam_get_filepath_admin('templates/template-parts/table_send_email.php') ); ?> 6 6 </send-email> -
universam-demo/trunk/admin/templates/template-parts/table_send_email.php
r3133815 r3202662 19 19 <tr> 20 20 <td class ='table_send_email__name'><?php _e('Тема', 'usam'); ?>:</td> 21 <td><input type='text' v-model=" subject" placeholder="Введите тему сообщения"></td>21 <td><input type='text' v-model="title" placeholder="Введите тему сообщения"></td> 22 22 </tr> 23 23 <tr> -
universam-demo/trunk/includes/integration/applications/moysklad.php
r3201974 r3202662 2977 2977 } 2978 2978 2979 public function save_options( )2979 public function save_options( $parameters ) 2980 2980 { 2981 2981 if ( $this->is_token() ) -
universam-demo/trunk/includes/integration/applications/ozon/ozon.php
r3201974 r3202662 20 20 } 21 21 22 public function format_categories( $categories )22 public function format_categories( $categories, $category_id = 0 ) 23 23 { 24 24 $results = []; … … 26 26 { 27 27 $children = []; 28 $category_id = isset($category['description_category_id']) ? $category['description_category_id'] : $category_id; 28 29 if( !empty($category['children']) ) 29 $children = $this->format_categories( $category['children'] );30 $children = $this->format_categories( $category['children'], $category_id ); 30 31 if( isset($category['description_category_id']) ) 31 $results[] = ['id' => $category['description_category_id'], ' name' => $category['category_name'], 'children' => $children];32 $results[] = ['id' => $category['description_category_id'], 'category_id' => $category_id, 'name' => $category['category_name'], 'children' => $children]; 32 33 else 33 $results[] = ['id' => $category['type_id'], ' name' => $category['type_name'], 'children' => $children];34 $results[] = ['id' => $category['type_id'], 'category_id' => $category_id, 'name' => $category['type_name'], 'children' => $children]; 34 35 } 35 36 return $results; 36 37 } 37 38 39 /* 40 attribute_id Идентификатор характеристики. 41 description_category_id Идентификатор категории. 42 last_value_id Идентификатор справочника, с которого нужно начать ответ. Если last_value_id — 10, то в ответе будут справочники, начиная с одиннадцатого. 43 limit максимум — 5000, минимум — 1. 44 type_id Идентификатор типа товара. 45 */ 46 public function get_attribute_id( $query_vars = [] ) 47 { 48 if( empty($query_vars['limit']) ) 49 $query_vars['limit'] = 5000; 50 $args = $this->get_args( 'POST', $query_vars ); 51 $results = $this->send_request( "v1/description-category/attribute", $args ); 52 if( isset($results['result']) ) 53 return $results['result']; 54 return []; 55 } 56 57 58 public function get_ozon_attributes( $query_vars = [] ) 59 { 60 if( empty($query_vars['limit']) ) 61 $query_vars['limit'] = 5000; 62 $query_vars['language'] = 'RU'; 63 $args = $this->get_args( 'POST', $query_vars); 64 $results = $this->send_request( "v1/description-category/attribute", $args ); 65 if( isset($results['result']) ) 66 return $results['result']; 67 return []; 68 } 69 38 70 public function update_products( $query_vars = [] ) 39 71 { … … 42 74 $query_vars['order'] = 'ASC'; 43 75 if ( !isset($query_vars['post_status']) ) 44 $query_vars['post_status'] = 'any'; 45 76 $query_vars['post_status'] = 'any'; 77 $items = []; 46 78 $products = usam_get_products( $query_vars ); 47 $category_ids = [];48 79 foreach( $products as $key => $product ) 49 $category_ids[] = $this->get_category_ozon( $product->ID ); 50 51 $args = $this->get_args( 'POST', ['attribute_type' => 'ALL', 'category_id' => $category_ids, 'language' => 'RU']); 52 unset($category_ids); 53 $ozon_attributes = $this->send_request( "v3/category/attribute", $args ); 54 $items = []; 55 foreach( $products as $key => $product ) 56 $items[] = $this->get_ozon_product( $product, $ozon_attributes ); 80 $items[] = $this->get_ozon_product( $product ); 57 81 $result = false; 58 82 if ( $items ) … … 80 104 81 105 //images, name, offer_id, price, vat 82 private function get_ozon_product( $product, $ozon_attributes = [] ) 83 { 106 private function get_ozon_product( $product ) 107 { 108 static $ozon_attributes = []; 84 109 if ( is_numeric($product) ) 85 110 $product = get_post( $product ); … … 98 123 foreach ($urls as $url) 99 124 $insert['images'][] = $url; 100 } 101 $category_ozon_id = $this->get_category_ozon( $product->ID ); 102 $insert['description_category_id'] = $category_ozon_id; 103 if ( $ozon_attributes ) 125 } 126 extract( $this->get_category_ozon( $product->ID )); 127 128 $insert['description_category_id'] = $ozon_category_id; 129 $insert['type_id'] = $ozon_product_type; 130 131 if( empty($ozon_attributes[$ozon_product_type]) ) 132 { 133 $ozon_attributes[$ozon_product_type] = $this->get_ozon_attributes(['description_category_id' => $ozon_category_id, 'type_id' => $ozon_product_type]); 134 } 135 if ( !empty($ozon_attributes[$ozon_product_type]) ) 104 136 { 105 137 $product_attributes = usam_get_product_attributes_display( $product->ID, ['show_all' => true] ); 106 foreach ($ozon_attributes[ 'result'] as $ozon_attrs)107 { 108 if ( $category_ozon_id == $ozon_attrs['category_id'])109 { 110 foreach ($ozon_attrs['attributes'] as $ozon_attribute)138 foreach ($ozon_attributes[$ozon_product_type] as $ozon_attribute) 139 { 140 foreach( $product_attributes as $attribute ) 141 { 142 if ( $attribute['parent'] && $attribute['name'] == $ozon_attribute['name'] ) 111 143 { 112 foreach( $product_attributes as $attribute ) 113 { 114 if ( $attribute['parent'] && $attribute['name'] == $ozon_attribute['name'] ) 115 { 116 $values = []; 117 foreach( $attribute['value'] as $value ) 118 $values[] = ['dictionary_value_id' => 0, 'value' => $value]; 119 $insert['attributes'][] = ['complex_id' => 0, 'id' => $ozon_attribute['id'], 'values' => $values]; 120 } 121 } 144 $values = []; 145 foreach( $attribute['value'] as $value ) 146 $values[] = ['dictionary_value_id' => 0, 'value' => $value]; 147 $insert['attributes'][] = ['complex_id' => 0, 'id' => $ozon_attribute['id'], 'values' => $values]; 122 148 } 123 149 } … … 142 168 if ( $length > 0 ) 143 169 $insert['depth'] = $length; 144 $insert['dimension_unit'] = get_option( 'usam_dimension_unit', 'mm' ); 145 146 147 $Log = new USAM_Log_File( 'insert' ); 148 $Log->fwrite_array( $insert ); 149 170 $insert['dimension_unit'] = get_option( 'usam_dimension_unit', 'mm' ); 150 171 return $insert; 151 172 } … … 207 228 private function get_category_ozon( $product_id ) 208 229 { 209 $category_ozon_id = (int)usam_get_product_meta( $product_id, 'category_ozon' ); 210 if ( $category_ozon_id > 0 ) 230 $category_ozon_id = (int)usam_get_product_meta( $product_id, 'ozon_category' ); 231 if ( $category_ozon_id > 0 ) 232 { 233 $ozon_product_type = (int)usam_get_product_meta( $product_id, 'ozon_product_type' ); 211 234 $category_id = $category_ozon_id; 235 } 212 236 else 213 237 { 214 $terms = get_the_terms( $product_id, 'usam-category'); 238 $terms = get_the_terms( $product_id, 'usam-category'); 215 239 $product_term_ids = []; 216 240 foreach( $terms as $term ) … … 220 244 { 221 245 $category_id = $ozon_category; 246 $ozon_product_type = (int)usam_get_term_metadata($term->term_id, 'ozon_product_type'); 222 247 break; 223 248 } … … 231 256 { 232 257 $category_id = $ozon_category; 258 $ozon_product_type = (int)usam_get_term_metadata($term_id, 'ozon_product_type'); 233 259 break; 234 260 } … … 236 262 } 237 263 } 238 } 239 return $category_id;264 } 265 return ['ozon_category_id' => $category_id, 'ozon_product_type' => $ozon_product_type]; 240 266 } 241 267 … … 294 320 ['field_type' => 'text', 'name' => 'Client ID', 'code' => 'login', 'default' => ''], 295 321 ['field_type' => 'password', 'name' => 'API key', 'code' => 'access_token', 'default' => ''], 296 ['field_type' => 'html', 'name' => 'API key', 'code' => '', 'default' => rest_url($this->namespace.'/'.$this->option['service_code'].'/'.$this->option['id'].'/notifications')],322 //['field_type' => 'html', 'name' => 'Ссылка', 'code' => '', 'default' => rest_url($this->namespace.'/'.$this->option['service_code'].'/'.$this->option['id'].'/notifications')], 297 323 ]], 298 324 ['name' => __('Обновление товаров', 'usam'), 'code' => 'product', 'options' => [ … … 309 335 } 310 336 311 public function save_options( )337 public function save_options( $parameters ) 312 338 { 313 339 $this->remove_hook( 'update_stock' ); … … 325 351 public function save_category_form( $term_id, $tt_id ) 326 352 { 327 if ( isset($_POST['ozon_category'] ) ) 353 if ( isset($_POST['ozon_category']) && isset($_POST['ozon_product_type']) ) 354 { 328 355 usam_update_term_metadata($term_id, 'ozon_category', absint($_POST['ozon_category'])); 356 usam_update_term_metadata($term_id, 'ozon_product_type', absint($_POST['ozon_product_type'])); 357 } 329 358 } 330 359 … … 335 364 <script> 336 365 var application_id = <?php echo $this->id; ?>; 337 var ozon_category = <?php echo (int)usam_get_term_metadata($tag->term_id, 'ozon_category'); ?>; 366 var ozon_category = <?php echo (int)usam_get_term_metadata($tag->term_id, 'ozon_category'); ?>; 367 var ozon_product_type = <?php echo (int)usam_get_term_metadata($tag->term_id, 'ozon_product_type'); ?>; 338 368 </script> 339 369 <?php … … 341 371 ?> 342 372 <tr id="ozon_categories" class="form-field"> 343 <th scope="row" valign="top"><?php esc_html_e( 'Категория Ozon', 'usam'); ?><input type='hidden' name="ozon_category" v-model="category">< /th>373 <th scope="row" valign="top"><?php esc_html_e( 'Категория Ozon', 'usam'); ?><input type='hidden' name="ozon_category" v-model="category"><input type='hidden' name="ozon_product_type" v-model="product_type">category={{category}} product_type={{product_type}}</th> 344 374 <td> 345 <div><ozon-categories @change="c ategory=$event" :lists="categories" :selected="category"/></div>375 <div><ozon-categories @change="change" :lists="categories" :selected="product_type"/></div> 346 376 </td> 347 377 </tr> -
universam-demo/trunk/includes/integration/applications/vavto.php
r3201974 r3202662 444 444 } 445 445 446 public function save_options( )446 public function save_options( $parameters ) 447 447 { 448 448 $this->remove_hook( 'update' ); -
universam-demo/trunk/includes/integration/applications/wildberries/wildberries.php
r3201974 r3202662 193 193 } 194 194 195 public function save_options( )195 public function save_options( $parameters ) 196 196 { 197 197 $this->remove_hook( 'update_stock' ); -
universam-demo/trunk/includes/integration/applications/yandexmarket/yandexmarket.php
r3201974 r3202662 352 352 } 353 353 354 public function save_options( )354 public function save_options( $parameters ) 355 355 { 356 356 $this->remove_hook( 'update_stock' ); -
universam-demo/trunk/includes/mailings/email.class.php
r3186033 r3202662 544 544 $attachments_filepath = array(); 545 545 foreach ( $attachments as $attachment ) 546 $attachments_filepath[$attachment->title .'.'.pathinfo(USAM_UPLOAD_DIR.$attachment->file_path, PATHINFO_EXTENSION)] = USAM_UPLOAD_DIR.$attachment->file_path;546 $attachments_filepath[$attachment->title] = USAM_UPLOAD_DIR.$attachment->file_path; 547 547 //$to_email получатель письма 548 548 $email_sent = wp_mail( $to_email, $title, $message, $headers, $attachments_filepath ); -
universam-demo/trunk/includes/mailings/send_newsletter.class.php
r3201974 r3202662 45 45 foreach ( $files as $file ) 46 46 { 47 $attachments[$file->title .'.'.pathinfo(USAM_UPLOAD_DIR.$file->file_path, PATHINFO_EXTENSION)] = USAM_UPLOAD_DIR.$file->file_path;47 $attachments[$file->title] = USAM_UPLOAD_DIR.$file->file_path; 48 48 } 49 49 $rule_ids = usam_get_array_metadata($this->mailing['id'], 'newsletter', 'pricelist'); -
universam-demo/trunk/theme/usam-global-style.css
r3201974 r3202662 331 331 .usam_chat_contact_form__info{padding:0 5px;} 332 332 .modal{display:none; position:fixed; top:10%; left:50%; -webkit-transform:translate(-50%, 0%); -ms-transform:translate(-50%, 0%); transform:translate(-50%, 0%); z-index:100001; background-color:#ffffff; border:1px solid rgba(0, 0, 0, 0.3); *border:1px solid #999; border-radius:var(--radius); outline:none; -webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3); box-shadow:0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip:padding-box; -moz-background-clip:padding-box; background-clip:padding-box; overflow:hidden;} 333 .modal.in{display:block }333 .modal.in{display:block!important} 334 334 .modal .close{font-size:20px; color:#000000; opacity:0.2; filter:alpha(opacity=20); cursor:pointer; position:absolute; z-index:10; right:10px; top:50%; transform:translate(0,-50%); } 335 335 .modal .close:hover, -
universam-demo/trunk/universam.php
r3201974 r3202662 4 4 * Plugin URI: https://wp-universam.ru 5 5 * Description: Платформа для управления бизнесом и интернет-магазином. Встроенный парсинг, CRM, соц. сети, мессенджеры, карты, план продаж, управление остатками, контакт-центр, коммерческие предложения, счета, акты, инструменты для продвижения сайта, конструктор отчетов, файлы, рассылки, СМС. 6 * Version: 8.64 6 * Version: 8.64.3 7 7 * Author: universam 8 8 * Author URI: https://wp-universam.ru … … 16 16 { 17 17 protected static $_instance = null; 18 private $version = '8.64 ';18 private $version = '8.64.3'; 19 19 public function __construct() 20 20 {
Note: See TracChangeset
for help on using the changeset viewer.