Changeset 3007787
- Timestamp:
- 12/10/2023 01:49:39 PM (2 years ago)
- Location:
- shop-2-api/trunk
- Files:
-
- 3 added
- 9 edited
-
assets/bol2api_bol_to_wc_product_scripts.js (added)
-
assets/bol2api_category_mapping_scripts.js (modified) (3 diffs)
-
assets/bol2api_mapping_scripts.js (modified) (17 diffs)
-
includes/Api/Shop2ApiConnect.php (modified) (3 diffs)
-
includes/Base/AjaxButtonActions.php (modified) (1 diff)
-
includes/Base/Enqueue.php (modified) (4 diffs)
-
includes/Pages/Admin.php (modified) (3 diffs)
-
includes/Tables/Wc2BolProductSettings.php (added)
-
readme.txt (modified) (2 diffs)
-
shop-2-api.php (modified) (2 diffs)
-
templates/bol-to-wc-product-sync.php (added)
-
templates/wc-to-bol-mapping.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
shop-2-api/trunk/assets/bol2api_category_mapping_scripts.js
r2982472 r3007787 1 1 (function ($) { 2 let saved_bol_category_data = {};3 4 2 $(document).ready(function () { 5 3 // Get all the categories and if there is any saved populate saved_bol_category_data 6 4 set_wc_category_field_dropdown(); 7 get_bol_wc_mapping_info(); 8 // Add click and change events 9 $('tr').on('click', 'td select', handle_wc_cat_click).on('change', 'td select', handle_bol_cat_change); 10 $('tr').on('click', 'td input', handle_bol_txt_change).on('change', 'td input', handle_bol_txt_change); 5 // Save Data 6 $('#category-save').on('click', set_bol_wc_mapping_info); 7 }); 11 8 12 // Save Data 13 $('#category-save').on('click', handle_cat_save); 14 }); 15 //Save Button Handler 16 function handle_cat_save(e) { 17 e.preventDefault(); 18 set_bol_wc_mapping_info(); 9 function get_table_data() { 10 let tableData = []; 11 $("#the-list tr").each(function() { 12 let rowData = {}; 13 $(this).find('input, select').each(function() { 14 if ($(this).is(":checkbox")) { 15 rowData[this.name] = $(this).is(":checked"); 16 } else { 17 rowData[this.name] = $(this).val(); 18 } 19 $.extend(rowData, $(this).data()); 20 }); 21 tableData.push(rowData); 22 23 }); 24 25 return tableData; 19 26 } 20 27 21 // Assign old value to dropdown on click22 function handle_wc_cat_click() {23 $(this).attr("data-old_value", $(this).val());24 return $(this);25 }26 27 function handle_bol_txt_change() {28 update_cost_values(this);29 }30 31 // Handle Bol Category change32 function handle_bol_cat_change() {33 $(this).attr("data-old_value", $(this).val());34 update_saved_bol_category_data(this);35 }36 37 // If a different option is selected (select to metadata/categories)38 function handle_cat_change() {39 set_bol_wc_mapping_info(true);40 }41 28 42 29 // This will set the Top dropdown with the data from woocommerce_option_data 43 30 function set_wc_category_field_dropdown() { 44 31 let data_container = $('span[name="wc-data-container"]'); 32 let categories = { 33 "categories": "All Categories", 34 "main_categories": "Main Categories", 35 "tags": "Tags", 36 "meta_data": "Metadata", 37 "attributes": "Attributes", 38 39 } 45 40 data_container.children().remove(); 46 41 … … 51 46 value: "", text: "-- select an option --", hidden: "hidden", disabled: "disabled", selected: "selected" 52 47 }).appendTo(_select); 53 54 // Added Tags/Metadata options 55 $('<option />', {value: "categories", text: "All Categories"}).appendTo(_select); 56 $('<option />', {value: "main_categories", text: "Main Categories"}).appendTo(_select); 57 $('<option />', {value: "tags", text: "Tags"}).appendTo(_select); 58 $('<option />', {value: "meta_data", text: "Metadata"}).appendTo(_select); 59 $('<option />', {value: "attributes", text: "Attributes"}).appendTo(_select); 60 61 _select.change(handle_cat_change) 48 let map_category = settings.map_category 49 for (let category in categories) { 50 let option_data = { 51 value: category, 52 text: categories[category] 53 } 54 if (category === map_category) { 55 option_data["selected"] = "selected"; 56 } 57 $('<option />', option_data).appendTo(_select); 58 } 59 _select.change(set_bol_wc_mapping_info); 62 60 _select.appendTo(data_container); 63 61 } 64 62 65 // Get the saved mapping data from bol (Shoes > Fashion) 66 function get_bol_wc_mapping_info() { 67 saved_bol_category_data = settings.map_data[0].map_data 68 let select = document.querySelector('#wc_cat_dropdown'); 69 select.value = settings.map_data[0].woocommerce_category_field; 70 } 71 72 function set_bol_wc_mapping_info(reload_data) { 63 function set_bol_wc_mapping_info(e) { 64 e.preventDefault(); 65 let table_data = get_table_data(); 73 66 let data = { 74 67 'woocommerce_category_field': $("#wc_cat_dropdown").val(), 75 'map_data': saved_bol_category_data,68 'map_data': table_data, 76 69 'action': 'set_shop_2_api_bol_wc_offer_mapping', 77 70 'nonce': settings.nonce, … … 82 75 if (response.data && response.data.response) { 83 76 if (response.data.response.code === 200 || response.data.response.code === 201) { 84 if (reload_data === true) { 85 location.reload(); 86 } else { 87 $('#common-success').text('Save Completed').show().fadeOut(5000); 88 } 89 } else { 90 alert("There was an error saving the data:" + response.data); 77 location.reload(); 78 return true; 91 79 } 80 alert("There was an error saving the data:" + response.data); 92 81 } 82 } else { 83 alert("There was an error saving the data:" + response.data); 93 84 } 94 85 }); 95 86 } 96 87 97 function update_cost_values(item_changed) {98 // Add commission and shipping99 let table_row = $(item_changed).parents('tr');100 let bol_cat_id = table_row.find('select').val();101 if (bol_cat_id !== "") {102 let bol_commission_amount = table_row.find('.bol_commission input').val();103 let bol_shipping_cost = table_row.find('.bol_shipping_cost input').val();104 saved_bol_category_data[bol_cat_id]['bol_commission'] = bol_commission_amount;105 saved_bol_category_data[bol_cat_id]['bol_shipping'] = bol_shipping_cost;106 }107 }108 88 109 function update_saved_bol_category_data(dropdown_changed) { 110 let prev_bol_cat_id = String($(dropdown_changed).data('old_value')); 111 let new_bol_cat_id = String($(dropdown_changed).val()); 112 let wc_cat_id = $(dropdown_changed).data('bol_cat_slug'); 113 114 if (saved_bol_category_data && Object.keys(saved_bol_category_data).includes(new_bol_cat_id)) { 115 // There is already a bol cat id in the saved data 116 // If the previous one was undefined then just add it to the wc_field_values 117 if (typeof (saved_bol_category_data[new_bol_cat_id]['wc_field_values']) !== "undefined") { 118 if (prev_bol_cat_id !== "" && prev_bol_cat_id !== 'undefined' && prev_bol_cat_id !== new_bol_cat_id) { 119 if ('wc_field_values' in saved_bol_category_data[prev_bol_cat_id]) { 120 saved_bol_category_data[prev_bol_cat_id]['wc_field_values'].remove(wc_cat_id); 121 } 122 } 123 if (!saved_bol_category_data[new_bol_cat_id]['wc_field_values'].includes(wc_cat_id)) { 124 saved_bol_category_data[new_bol_cat_id]['wc_field_values'].push(wc_cat_id); 125 } 126 } else { 127 { 128 saved_bol_category_data[new_bol_cat_id]['wc_field_values'] = [wc_cat_id]; 129 } 130 } 131 } else { 132 // It is a new item. 133 if (new_bol_cat_id !== "") { 134 if (!saved_bol_category_data || saved_bol_category_data.length === 0) { 135 saved_bol_category_data = {}; 136 } 137 saved_bol_category_data[new_bol_cat_id] = { 138 'bol_cat_name': dropdown_changed.selectedOptions[0].innerHTML, 139 'wc_field_values': [wc_cat_id], 140 'mapping': default_mapping 141 } 142 } 143 } 144 update_cost_values(dropdown_changed); 145 146 if (Object.keys(saved_bol_category_data).includes(prev_bol_cat_id)) { 147 if (typeof (saved_bol_category_data[prev_bol_cat_id]['wc_field_values']) !== "undefined") { 148 if (prev_bol_cat_id !== new_bol_cat_id) { 149 saved_bol_category_data[prev_bol_cat_id]['wc_field_values'].remove(wc_cat_id); 150 } 151 } 152 } 153 } 154 155 let default_mapping = { 156 "ean": { 157 "type": "Product", 158 "value": "sku" 159 }, 160 // "Name": { 161 // "type": "Product", 162 // "value": "name" 163 // }, 164 // "Description": { 165 // "type": "Product", 166 // "value": "description" 167 // }, 168 "stock.amount": { 169 "type": "OwnValue", 170 "value": "0" 171 }, 172 "condition.name": { 173 "type": "OwnValue", 174 "value": "NEW" 175 }, 176 "fulfilment.method": { 177 "type": "OwnValue", 178 "value": "FBR" 179 }, 180 "Internal Reference": { 181 "type": "Product", 182 "value": "sku" 183 }, 184 "unknownProductTitle": { 185 "type": "Product", 186 "value": "name" 187 }, 188 "fulfilment.deliveryCode": { 189 "type": "OwnValue", 190 "value": "1-2d" 191 }, 192 "stock.managedByRetailer": { 193 "type": "OwnValue", 194 "value": "true" 195 }, 196 "pricing.bundlePrices.quantity": { 197 "type": "OwnValue", 198 "value": "1" 199 }, 200 "pricing.bundlePrices.unitPrice": { 201 "type": "Product", 202 "value": "price" 203 } 204 } 89 // let default_mapping = { 90 // "ean": { 91 // "type": "Product", 92 // "value": "sku" 93 // }, 94 // // "Name": { 95 // // "type": "Product", 96 // // "value": "name" 97 // // }, 98 // // "Description": { 99 // // "type": "Product", 100 // // "value": "description" 101 // // }, 102 // "stock.amount": { 103 // "type": "OwnValue", 104 // "value": "0" 105 // }, 106 // "condition.name": { 107 // "type": "OwnValue", 108 // "value": "NEW" 109 // }, 110 // "fulfilment.method": { 111 // "type": "OwnValue", 112 // "value": "FBR" 113 // }, 114 // "Internal Reference": { 115 // "type": "Product", 116 // "value": "sku" 117 // }, 118 // "unknownProductTitle": { 119 // "type": "Product", 120 // "value": "name" 121 // }, 122 // "fulfilment.deliveryCode": { 123 // "type": "OwnValue", 124 // "value": "1-2d" 125 // }, 126 // "stock.managedByRetailer": { 127 // "type": "OwnValue", 128 // "value": "true" 129 // }, 130 // "pricing.bundlePrices.quantity": { 131 // "type": "OwnValue", 132 // "value": "1" 133 // }, 134 // "pricing.bundlePrices.unitPrice": { 135 // "type": "Product", 136 // "value": "price" 137 // } 138 // } 205 139 })(jQuery); -
shop-2-api/trunk/assets/bol2api_mapping_scripts.js
r2825412 r3007787 1 1 ( function( $ ) { 2 let bol_wc_mapping_info = {};3 2 let woocommerce_metadata_option_data = []; 4 3 let woocommerce_attribute_option_data = []; … … 6 5 $( document ).ready( function() { 7 6 $('#all-tabs').hide(); 8 9 // Getting saved data and populate it. 10 get_bol_wc_mapping_info(); 11 12 // Pre Populate the Dropdown Values 7 // // Attached change event to top dropdown 8 $(document).on( 'change', '#wc_cat_dropdown', handle_cat_change); 9 10 // // Attaching the save function to the button. 11 $('.shop-2-api-connect').on( 'click', '.shop-2-api-connect-save', submit_wc_bol_data); 12 $('.shop-2-api-connect').on( 'click', '.shop-2-api-connect-save-sync', submit_wc_bol_data); 13 14 // Attach change event to section-to-map Dropdown 15 $(document).on( 'change', 'select[name="section-to-map"]', handle_sec_to_map_change); 16 // tabs 17 $(document).on('click', '.nav-tab-wrapper a', handle_tab_click); 18 13 19 get_woocommerce_metadata_option_data(); 14 20 get_woocommerce_attribute_option_data(); 15 16 // Attaching the save function to the button. 17 $('.shop-2-api-connect').on( 'click', '.shop-2-api-connect-save', submit_wc_bol_data); 18 $('.shop-2-api-connect').on( 'click', '.shop-2-api-connect-save-sync', submit_wc_bol_data); 19 20 // Attached change event to top dropdown 21 $(document).on( 'change', '#wc_cat_dropdown', handle_cat_change); 22 23 // Attach change event to section-to-map Dropdown 24 $(document).on( 'change', 'select[name="section-to-map"]', handle_sec_to_map_change); 25 26 // tabs 27 $(document).on('click', '.nav-tab-wrapper a', handle_tab_click); 21 set_wc_category_field_dropdown() 28 22 }); 29 23 … … 34 28 $(".nav-tab").removeClass("nav-tab-active"); 35 29 36 clicked_tab = $(this).attr('href');30 let clicked_tab = $(this).attr('href'); 37 31 $(clicked_tab).show(800); 38 32 $(this).addClass('nav-tab-active'); … … 41 35 42 36 function handle_sec_to_map_change() { 37 debugger; 43 38 let current_selection = $(this).val(); 44 39 // map container before populating new one … … 58 53 break; 59 54 case 'Product': 60 generated_field = set_wc_product_dro wdown($(this).data());55 generated_field = set_wc_product_dropdown($(this).data()); 61 56 break; 62 57 } … … 150 145 } 151 146 152 function set_wc_product_dro wdown(data) {147 function set_wc_product_dropdown(data) { 153 148 let woocommerce_option_properties = settings.wc_field_options.success.schema.properties; 154 149 … … 237 232 } 238 233 239 function add_product_mapping_row(product_dict, is_measurement = false ) {234 function add_product_mapping_row(product_dict, is_measurement = false, product_response_data = {}) { 240 235 let description = product_dict.name; 241 236 let id = product_dict.id; 242 237 let required_val = product_dict.required; 243 let mapped_value = get_mapping_value( product_dict.id);238 let mapped_value = product_response_data[product_dict.id]; 244 239 let tooltip = product_dict.tooltip; 245 240 let dropdown_values = product_dict.ENUM; … … 288 283 } 289 284 290 function add_offer_mapping_row(product_dict ) {285 function add_offer_mapping_row(product_dict, product_response_data) { 291 286 let description = product_dict.name; 292 287 let id = product_dict.id; 293 288 let required_val = product_dict.required; 294 let mapped_value = get_mapping_value( product_dict.id);289 let mapped_value = product_response_data[product_dict.id]; 295 290 let tooltip = product_dict.tooltip; 296 291 let dropdown_values = product_dict.ENUM; … … 356 351 }) 357 352 358 let selected_mapping = bol_wc_mapping_info.map_data[$("#wc_cat_dropdown").val()]; 359 if (typeof(selected_mapping) == "undefined") { 360 return bol_wc_mapping_info.map_data 361 } 362 363 selected_mapping['mapping'] = return_data; 364 return bol_wc_mapping_info.map_data; 353 return return_data; 365 354 } 366 355 367 356 function submit_wc_bol_data() { 368 var data = { 369 'action' : 'set_shop_2_api_bol_wc_offer_mapping', 357 debugger; 358 let converted_data = convert_mapping_to_json(); 359 360 let data = { 361 'action' : 'set_shop_2_api_wc_to_bol_submit', 370 362 'nonce' : settings.nonce, 371 'map_data': convert_mapping_to_json() 363 'map_data': converted_data, 364 'bol_category_field': $("#wc_cat_dropdown").val() 372 365 }; 373 366 … … 378 371 $('#common-success').show().fadeOut(5000); 379 372 window.scrollTo(0, 0); 380 381 373 } else { 382 374 alert("There was an error saving the data:" + response.data); … … 387 379 388 380 // Populate Dropdown and check if it must be selected. 389 function set_wc_category_field_dropdown(items) { 381 function set_wc_category_field_dropdown() { 382 let items = settings.map_data; 390 383 let data_container = $('span[name="wc-data-container"]'); 391 384 data_container.children().remove(); 392 385 393 386 let _select = $('<select />', {name:"wc_cat_dropdown", id:"wc_cat_dropdown", class:"bol-cat-dropdown"}); 394 395 for (const item in items) { 396 $('<option />', {value:item, text:items[item].bol_cat_name}).appendTo(_select); 397 } 398 387 388 items.forEach( 389 function(currentValue) { 390 let select_value = { 391 value:currentValue.bol_category_code, text:currentValue.bol_category_name 392 } 393 $('<option />', select_value).appendTo(_select); 394 } 395 ) 399 396 _select.appendTo(data_container); 400 _select. change();397 _select.trigger('change'); 401 398 } 402 399 … … 406 403 // Add offer mapping rows 407 404 $.each(settings.offer_data, function(key, value){ 408 add_offer_mapping_row(value );405 add_offer_mapping_row(value, product_response_data.map_data); 409 406 }) 410 411 // Add Product mapping rows 412 $.each(product_response_data, function(index, value){ 407 408 // Add Product mapping rows 409 let enriched_data = product_response_data.woocommerce_enriched_model_data; 410 $.each(enriched_data, function(index, value){ 413 411 if (value['id'] === 'EAN') return; 414 add_product_mapping_row(value );412 add_product_mapping_row(value, false, product_response_data.map_data); 415 413 416 414 if (value.type !== 'LABEL') { … … 419 417 unit_value.name = value.name + ' (Unit)'; 420 418 unit_value.id = value.id + '_unit'; 421 add_product_mapping_row(unit_value,true );419 add_product_mapping_row(unit_value,true, product_response_data.map_data); 422 420 } 423 421 }); 424 422 $('.straighten').on('click', function(){ 425 423 $(this).parent().parent().next("tr").toggle(); 426 });427 }428 429 // Get the mapping info back from bol.430 function get_bol_wc_mapping_info() {431 var data = {432 'action': 'get_bol_wc_mapping_info',433 };434 435 $.post(settings.ajaxurl, data, function(response) {436 if (response.success == true) {437 if (response.data && response.data.response) {438 if (response.data.response.code === 200) {439 json_data = JSON.parse(response.data.body);440 if (json_data.length === 0) {441 console.log("No Data Retrieved");442 } else {443 // Set dropdown444 bol_wc_mapping_info = json_data[0];445 set_wc_category_field_dropdown(bol_wc_mapping_info.map_data);446 }447 } else {448 alert("There was an error retrieving the data:" + response);449 }450 }451 }452 424 }); 453 425 } … … 465 437 466 438 // Populate the table 467 function get_bol_category_info_by_value(cat_ name)439 function get_bol_category_info_by_value(cat_code) 468 440 { 469 let data = { 470 'action': 'get_bol_category_info_by_value', 471 'value' : cat_name, 472 'nonce' : settings.nonce, 473 }; 474 475 $.post(settings.ajaxurl, data, function(response) { 476 if (response.success == true) { 477 if (response.data && response.data.response) { 478 if (response.data.response.code === 200) { 479 // Populate Table 480 populate_table(JSON.parse(response.data.body)); 481 } else { 482 alert("There was an error retrieving the data:" + response.data); 483 } 484 } 485 } else { 486 alert("There was an error retrieving the data:" + response.data); 487 } 488 }); 489 } 490 491 function get_mapping_value(mapping_value) { 492 let selected_mapping = bol_wc_mapping_info.map_data[$("#wc_cat_dropdown").val()]; 493 if (typeof(selected_mapping.mapping) !== "undefined") { 494 return selected_mapping.mapping[mapping_value] 495 } 496 return undefined; 441 let items = settings.map_data; 442 for (let i in items) { 443 let item = items[i] 444 if (item.bol_category_code === cat_code) { 445 populate_table(item); 446 return; 447 } 448 } 497 449 } 498 450 … … 500 452 function get_woocommerce_metadata_option_data() 501 453 { 502 vardata = {454 let data = { 503 455 'action': 'get_woocommerce_values', 504 456 'value' : 'meta_data' … … 522 474 function get_woocommerce_attribute_option_data() 523 475 { 524 vardata = {476 let data = { 525 477 'action': 'get_woocommerce_values', 526 478 'value' : 'attributes' … … 546 498 547 499 // Keep track of the selected option. 548 varselectedValue = $(this).val();500 let selectedValue = $(this).val(); 549 501 550 502 // Sort all the options by text. I could easily sort these by val. -
shop-2-api/trunk/includes/Api/Shop2ApiConnect.php
r2982442 r3007787 302 302 { 303 303 return wp_remote_get( 304 $this->shop_2_api_url . '/map/api/wc-bol-map/', ['headers' => $this->header] 304 $this->shop_2_api_url . '/map/api/wc-product-sync-options/', ['headers' => $this->header] 305 ); 306 } 307 308 public function get_bol_wc_mapping_detail_info() 309 { 310 return wp_remote_get( 311 $this->shop_2_api_url . '/map/api/wc-product-sync-data/', ['headers' => $this->header] 305 312 ); 306 313 } … … 361 368 } 362 369 363 public function set_bol_wc_mapping($woocommerce_category_field, $map_data, $condition = NULL) 364 { 365 $order = $this->get_order(); 366 $mapping_url = '/map/api/wc-bol-map/'; 370 public function set_bol_wc_mapping($woocommerce_category_field, $map_data) 371 { 372 update_option('woocommerce_category_field', $woocommerce_category_field); 373 374 $mapping_url = $this->shop_2_api_url . '/map/save_product_map/'; 367 375 $method = 'POST'; 368 376 369 //Check if there is any mappings 370 $mappings = wp_remote_retrieve_body($this->get_bol_wc_mapping_info()); 371 $json_mappings = json_decode($mappings, true); 372 373 if (count($json_mappings) != 0) { 374 $mapping_url = $mapping_url . $json_mappings[0]["id"] . '/'; 375 $method = 'PATCH'; 376 } 377 378 $data = [ 379 "woocommerce_category_field" => $woocommerce_category_field, 380 "map_data" => $map_data, 381 "product" => $order["id"] 382 ]; 383 384 return wp_remote_post( 385 $this->shop_2_api_url . $mapping_url, 377 $data = ["map_data" => $map_data,"woocommerce_category_field" => $woocommerce_category_field]; 378 379 return wp_remote_post( 380 $mapping_url, 386 381 [ 387 382 'headers' => $this->header, … … 392 387 } 393 388 394 public function set_wc_to_bol_submit($ map_data)395 { 396 $mapping_url = '/ woocommerce/bol-to-wc-submit/';397 $method = 'P OST';389 public function set_wc_to_bol_submit($bol_category_field, $map_data) 390 { 391 $mapping_url = '/map/api/wc-product-map-data/' . $bol_category_field . '/'; 392 $method = 'PATCH'; 398 393 399 394 return wp_remote_post( -
shop-2-api/trunk/includes/Base/AjaxButtonActions.php
r2982442 r3007787 233 233 $shop_2_api_response = $this->shop_2_api_connections->set_wc_to_bol_submit 234 234 ( 235 json_encode($_POST['map_data'])235 $_POST['bol_category_field'], json_encode($_POST['map_data']) 236 236 ); 237 237 $this->handle_api_response($shop_2_api_response); -
shop-2-api/trunk/includes/Base/Enqueue.php
r2982442 r3007787 20 20 public function register(): void 21 21 { 22 //Add filter so that query will return products and variations 23 add_filter("woocommerce_rest_product_object_query", 24 function (array $args){ $args["post_type"] = array( 'product', 'product_variation' ); return $args; }, 25 10, 1 26 ); 27 22 28 add_action('admin_notices', array($this, 'get_server_user_message')); 23 29 … … 235 241 'ajaxurl' => admin_url('admin-ajax.php'), 236 242 'nonce' => wp_create_nonce('ajax-nonce'), 237 'map_data' => $map_data 243 'map_data' => $map_data, 244 'map_category' => get_option('woocommerce_category_field', 'main_categories'), 238 245 )); 239 246 } … … 248 255 //Get Product Data 249 256 $offer_data = $this->handle_api_response($shop_2_api_connection->get_bol_offer_info()); 257 $map_data = $this->handle_api_response($shop_2_api_connection->get_bol_wc_mapping_detail_info()); 250 258 251 259 wp_localize_script('bol2api_scripts_common', 'settings', array( … … 253 261 'nonce' => wp_create_nonce('ajax-nonce'), 254 262 'wc_field_options' => $wc_field_options, 255 'offer_data' => $offer_data 263 'offer_data' => $offer_data, 264 'map_data' => $map_data, 256 265 )); 257 266 } -
shop-2-api/trunk/includes/Pages/Admin.php
r2975851 r3007787 79 79 add_submenu_page( 80 80 'shop2api_plugin', //Parent Slug 81 'Map WooCommerceCategory', // Page Title82 'Map WooCommerceCategory', // Menu Title81 'Map Bol Category', // Page Title 82 'Map Bol Category', // Menu Title 83 83 'manage_options', // Capability 84 84 'shop2api_woocommerce_category', // Menu Slug 85 array($this, ' wc_category_selection_page'), // Function85 array($this, 'bol_2_wc_product_settings'), // Function 86 86 ); 87 87 … … 229 229 } 230 230 231 public function wc_category_selection_page() 232 {231 public function wc_category_selection_page(): void 232 { 233 233 require_once SHOP2API_PLUGIN_PATH . '/includes/Tables/WcCategorySelection.php'; 234 234 $ListTable = new Shop2Api_WcCategorySelection(); … … 256 256 } 257 257 258 public function bol_2_wc_product_settings(): void 259 { 260 require_once SHOP2API_PLUGIN_PATH . '/includes/Tables/Wc2BolProductSettings.php'; 261 $ListTable = new Shop2Api_Wc2BolProductSettings(); 262 echo wp_kses('<div class="wrap">', $this->allowed_html); 263 echo wp_kses('<form method="post">', $this->allowed_html); 264 // Common Header to be included everywhere and js should also be in the common.js 265 $shop2api_header = "WooCommerce To Bol Category Mapping"; 266 $shop2api_header_detail = "To map your products to bol, we need to know which Category in WooCommerce will 267 map to your category in Bol.com. </br> 268 <b>For Example: You have a category in WooCommerce 'HOUT' which you can map to 'HOUTKACHEL' a category 269 on bol.com</b> </br> 270 Bol Commission and Bol Shipping Costs will be added to the price field which is mapped on the next step. 271 <div class='disclaimer1'>* When you complete your mapping remember to save your changes.</div>"; 272 require_once SHOP2API_PLUGIN_PATH . 'templates/common-header.php'; 273 274 echo wp_kses('<div class="content" style="padding: 10px 20px">', $this->allowed_html); 275 276 $ListTable->prepare_items(); 277 // Render Table 278 $ListTable->display(); 279 echo wp_kses('<button id="category-save" class="shop-2-api-connect-save">Save</button>', $this->allowed_html); 280 echo wp_kses('</form">', $this->allowed_html); 281 echo wp_kses('</div>', $this->allowed_html); 282 echo wp_kses('</div>', $this->allowed_html); 283 } 284 258 285 public function bol_koopblok_service() 259 286 { -
shop-2-api/trunk/readme.txt
r3005018 r3007787 3 3 Plugin URI: https://wordpress.org/plugins/shop-2-api/ 4 4 Tags: WooCommerce, Bol 5 Stable Tag: 1.0.2 8.65 Stable Tag: 1.0.29.0 6 6 Requires at least: 5.0 7 7 Requires PHP: 7.2 8 Tested up to: 6. 38 Tested up to: 6.4 9 9 Author: Adriaan Coetzee 10 10 Author URI: https://shop2API.com/ … … 161 161 5) Fix bug where product variants is not retrieved 162 162 163 = 1.0.29 = 164 1) Reworked Bol.com Product and Offer Mapping 165 163 166 164 167 == Instructions == -
shop-2-api/trunk/shop-2-api.php
r3005018 r3007787 5 5 Plugin URI: https://wordpress.org/plugins/shop-2-api/ 6 6 Description: The plugin Shop2Api will sync products between e-Commerce platforms. The current supported e-Commerce platforms are WooCommerce to Bol.com, and we are working on Amazon, Shopify and others. We added a koopblok service so that you can check if you lower your price can you get koopblok. 7 Version: 1.0.2 8.67 Version: 1.0.29.0 8 8 Requires at least: 5.0 9 9 Requires PHP: 7.2 … … 34 34 define('SHOP2API_PLUGIN_URL', plugin_dir_url( __FILE__ )); 35 35 define('SHOP2API_PLUGIN', plugin_basename( __FILE__ )); 36 define ('VERSION', '1.0.2 8.6');36 define ('VERSION', '1.0.29.0'); 37 37 38 38 // Register items in the project. -
shop-2-api/trunk/templates/wc-to-bol-mapping.php
r2825412 r3007787 8 8 <div id="all-tabs"> 9 9 <h2 class="nav-tab-wrapper"> 10 <a href="#offer-table" class="nav-tab nav-tab-active">Offer Data</a>11 <a href="#product-table" class="nav-tab">Product Data</a>10 <a href="#offer-table" class="nav-tab nav-tab-active">Offer Mapping</a> 11 <a href="#product-table" class="nav-tab">Product Mapping</a> 12 12 </h2> 13 13
Note: See TracChangeset
for help on using the changeset viewer.