PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.9.1
ووسلام – همگام سازی ووکامرس و باسلام v1.9.1
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
sync-basalam / includes / Actions / Controller / CategoryActions / RemoveCategoryMap.php

RemoveCategoryMap.php in ووسلام – همگام سازی ووکامرس و باسلام 1.9.1, at includes/Actions/Controller/CategoryActions/RemoveCategoryMap.php

39 lines 941 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Actions\Controller\CategoryActions;
4
5 use SyncBasalam\Admin\Product\Category\CategoryMapping;
6 use SyncBasalam\Actions\Controller\ActionController;
7
8 defined('ABSPATH') || exit;
9
10 class RemoveCategoryMap extends ActionController
11 {
12 public function __invoke()
13 {
14 if (!current_user_can('manage_options')) {
15 wp_die('Unauthorized');
16 }
17
18 $mappingId = intval($_POST['mapping_id']);
19
20 if (!$mappingId) {
21 wp_send_json_error('Invalid mapping ID');
22
23 return;
24 }
25
26 try {
27 $result = CategoryMapping::deleteCategoryMapping($mappingId);
28
29 if ($result) {
30 wp_send_json_success('Mapping deleted successfully');
31 } else {
32 wp_send_json_error('Error deleting mapping');
33 }
34 } catch (\Exception $e) {
35 wp_send_json_error($e->getMessage());
36 }
37 }
38 }
39