Changeset 3392156
- Timestamp:
- 11/08/2025 12:02:58 PM (4 months ago)
- Location:
- sync-basalam/trunk
- Files:
-
- 8 edited
-
CHANGELOG.md (modified) (1 diff)
-
includes/admin/class-sync-basalam-product-service.php (modified) (1 diff)
-
includes/class-sync-basalam-plugin.php (modified) (2 diffs)
-
includes/services/class-sync-basalam-api-service-manager.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
sync-basalam.php (modified) (1 diff)
-
templates/admin/menu/main/main-connected.php (modified) (2 diffs)
-
templates/admin/menu/main/modal/update-product.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sync-basalam/trunk/CHANGELOG.md
r3391225 r3392156 1 1 # Changelog 2 3 <details> 4 <summary>1.5.5 - 2025-01-15</summary> 5 6 ### Changed / Improved 7 8 - Optimized fetch creatable products query using direct SQL for better performance 9 - Improved API service manager to properly decode JSON responses 10 - Enhanced update job detection logic to avoid false positive job status checks 11 12 ### Fixed 13 14 - Fixed API response handling by properly decoding JSON data 15 - Removed commented-out legacy code from plugin initialization 16 - Fixed quick update job status detection in admin dashboard 17 - Resolved duplicate job checking that was causing incorrect "in progress" states 18 19 </details> 2 20 3 21 <details> -
sync-basalam/trunk/includes/admin/class-sync-basalam-product-service.php
r3381046 r3392156 83 83 public static function fetch_creatable_products($args) 84 84 { 85 $posts_per_page = $args['posts_per_page'] ?? 100; 86 $offset = $args['offset'] ?? 0; 87 $include_out_of_stock = $args['include_out_of_stock'] ?? false; 88 89 $meta_query = [ 90 'meta_query' => [ 91 'relation' => 'AND', 92 [ 93 'key' => 'sync_basalam_product_id', 94 'compare' => 'NOT EXISTS', 95 ], 96 [ 97 'key' => '_price', 98 'compare' => 'EXISTS', 99 ], 100 [ 101 'key' => '_price', 102 'value' => 1000, 103 'type' => 'NUMERIC', 104 'compare' => '>=', 105 ], 106 [ 107 'key' => '_downloadable', 108 'value' => 'yes', 109 'compare' => '!=', 110 ], 111 [ 112 'key' => '_virtual', 113 'value' => 'yes', 114 'compare' => '!=', 115 ], 116 [ 117 'relation' => 'OR', 118 [ 119 'key' => '_thumbnail_id', 120 'compare' => 'EXISTS', 121 ], 122 [ 123 'key' => '_product_image_gallery', 124 'value' => '', 125 'compare' => '!=', 126 ], 127 ], 128 ], 129 ]; 130 131 if (!$include_out_of_stock) { 132 $meta_query[] = [ 133 'key' => '_stock_status', 134 'value' => 'instock', 135 'compare' => '=', 136 ]; 137 } 138 139 $product_ids = get_posts([ 140 'post_type' => 'product', 141 'post_status' => 'publish', 142 'posts_per_page' => $posts_per_page, 143 'offset' => $offset, 144 'fields' => 'ids', 145 'meta_query' => $meta_query, 146 ]); 147 148 $product_ids = array_filter($product_ids, function ($id) { 149 return get_post_type($id) === 'product'; 150 }); 151 152 return array_values($product_ids); 153 } 85 global $wpdb; 86 87 $posts_per_page = intval($args['posts_per_page'] ?? 50); 88 $offset = intval($args['offset'] ?? 0); 89 90 $posts_table = $wpdb->posts; 91 $meta_table = $wpdb->postmeta; 92 93 $query = $wpdb->prepare(" 94 SELECT p.ID 95 FROM {$posts_table} AS p 96 LEFT JOIN {$meta_table} AS basalam 97 ON basalam.post_id = p.ID 98 AND basalam.meta_key = 'sync_basalam_product_id' 99 WHERE p.post_type = 'product' 100 AND p.post_status = 'publish' 101 AND basalam.post_id IS NULL 102 ORDER BY p.ID DESC 103 LIMIT %d OFFSET %d 104 ", $posts_per_page, $offset); 105 106 $ids = $wpdb->get_col($query); 107 108 return array_map('intval', $ids); 109 } 110 154 111 155 112 public static function enqueue_all_products_for_update($offset) -
sync-basalam/trunk/includes/class-sync-basalam-plugin.php
r3391225 r3392156 4 4 class Sync_basalam_Plugin 5 5 { 6 const VERSION = '1.5. 4';6 const VERSION = '1.5.5'; 7 7 8 8 public function __construct() … … 241 241 } 242 242 243 // private function init_wp_bg_process()244 // {245 // global $SyncBasalamBulkUpdateProducts;246 // global $SyncBasalamProductsConnectDispatcher;247 248 // $SyncBasalamBulkUpdateProducts = new SyncBasalamBulkUpdateProducts();249 // $SyncBasalamProductsConnectDispatcher = new SyncBasalamProductsConnectDispatcher();250 251 // new SyncBasalamProductCreateDispatcher();252 253 // new SyncBasalamCreateProduct();254 // new SyncBasalamUpdateProduct();255 // }256 257 243 private function init_wp_bg_process() 258 244 { -
sync-basalam/trunk/includes/services/class-sync-basalam-api-service-manager.php
r3391225 r3392156 65 65 66 66 return [ 67 'body' => $body,67 'body' => json_decode($body, true), 68 68 'status_code' => $status_code 69 69 ]; -
sync-basalam/trunk/readme.txt
r3391225 r3392156 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.5. 47 Stable tag: 1.5.5 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
sync-basalam/trunk/sync-basalam.php
r3391225 r3392156 5 5 * Plugin Name: sync basalam | ووسلام 6 6 * Description: با استفاده از پلاگین ووسلام میتوایند تمامی محصولات ووکامرس را با یک کلیک به غرفه باسلامی خود اضافه کنید، همچنین تمامی سفارش باسلامی شما به سایت شما اضافه میگردد. 7 * Version: 1.5. 47 * Version: 1.5.5 8 8 * Author: Woosalam Dev 9 9 * Author URI: https://wp.hamsalam.ir/ -
sync-basalam/trunk/templates/admin/menu/main/main-connected.php
r3391225 r3392156 13 13 14 14 15 $quick_update_job = $job_manager->get_job(['job_type' => 'sync_basalam_update_all_products']); 16 $quick_update_processing_job = $job_manager->get_job(['job_type' => 'sync_basalam_update_all_products']); 15 $quick_update_processing_job = $job_manager->get_job(['job_type' => 'sync_basalam_update_all_products', 'status' => 'pending', 'processing']); 17 16 $count_quick_update_batches = $SyncBasalamBulkUpdateProducts ? $SyncBasalamBulkUpdateProducts->count_batches() : 0; 18 17 … … 24 23 $single_update_count = $job_manager->get_count_jobs(['job_type' => 'sync_basalam_update_single_product', 'status' => ['pending', 'processing']]); 25 24 26 $has_active_update_jobs = ($quick_update_ job || $quick_update_processing_job || $full_update_job || $full_update_processing_job || $single_update_count > 0 || $count_quick_update_batches > 0);25 $has_active_update_jobs = ($quick_update_processing_job || $full_update_job || $full_update_processing_job || $single_update_count > 0 || $count_quick_update_batches > 0); 27 26 $active_update_type = ''; 28 if ($quick_update_ job || $quick_update_processing_job) {27 if ($quick_update_processing_job) { 29 28 $active_update_type = 'quick'; 30 29 } elseif ($full_update_job || $full_update_processing_job || $single_update_count > 0) { -
sync-basalam/trunk/templates/admin/menu/main/modal/update-product.php
r3391225 r3392156 54 54 </div> 55 55 </div> 56 <?php elseif ($quick_update_ job || $quick_update_processing_job): ?>56 <?php elseif ($quick_update_processing_job): ?> 57 57 <!-- Display when quick update job (sync_basalam_update_all_products) is running --> 58 58 <div id="quick-update-in-progress" style="display:block;margin:10px">
Note: See TracChangeset
for help on using the changeset viewer.