Changeset 3398106
- Timestamp:
- 11/18/2025 01:54:15 PM (4 months ago)
- Location:
- ali2woo-lite/trunk
- Files:
-
- 1 added
- 12 edited
-
alinext-lite.php (modified) (2 diffs)
-
includes/classes/connector/AbstractConnector.php (modified) (1 diff)
-
includes/classes/connector/AliexpressDefaultConnector.php (modified) (1 diff)
-
includes/classes/controller/SettingPageAjaxController.php (modified) (1 diff)
-
includes/classes/job/ApplyPricingRulesProcess.php (modified) (1 diff)
-
includes/classes/model/Woocommerce.php (modified) (4 diffs)
-
includes/classes/repository/AliexpressRegionRepository.php (modified) (2 diffs)
-
includes/classes/utils/Logs.php (modified) (5 diffs)
-
includes/classes/utils/Utils.php (modified) (1 diff)
-
includes/libs/json_api/controllers/core.php (modified) (6 diffs)
-
readme.txt (modified) (3 diffs)
-
view/includes/bulk_price_formula_modal.php (added)
-
view/settings/price_formula.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ali2woo-lite/trunk/alinext-lite.php
r3369759 r3398106 6 6 Text Domain: ali2woo 7 7 Domain Path: /languages 8 Version: 3.6. 38 Version: 3.6.4 9 9 Author: Dropshipping Guru 10 10 Author URI: https://ali2woo.com/dropshipping-plugin/?utm_source=lite&utm_medium=author&utm_campaign=alinext-lite … … 12 12 Requires at least: 5.9 13 13 Tested up to: 6.8 14 WC tested up to: 10. 214 WC tested up to: 10.3 15 15 WC requires at least: 5.0 16 16 Requires PHP: 8.0 -
ali2woo-lite/trunk/includes/classes/connector/AbstractConnector.php
r3287804 r3398106 30 30 abstract public function load_order(string $order_id): array; 31 31 abstract public function loadCategory(int $categoryId): array; 32 abstract static function get_images_from_description( $data);32 abstract static function get_images_from_description(array $data); 33 33 } -
ali2woo-lite/trunk/includes/classes/connector/AliexpressDefaultConnector.php
r3287804 r3398106 235 235 } 236 236 237 public static function get_images_from_description( $product)238 { 239 $src_result = array();240 241 if ( isset($product['desc_meta']) && isset($product['desc_meta']['images']) && is_array($product['desc_meta']['images'])) {242 foreach ($ product['desc_meta']['images'] as $image_src) {237 public static function get_images_from_description(array $data): array 238 { 239 $src_result = []; 240 241 if (!empty($data['desc_meta']['images']) && is_array($data['desc_meta']['images'])) { 242 foreach ($data['desc_meta']['images'] as $image_src) { 243 243 $image_key = Utils::buildImageIdFromPath($image_src); 244 244 $src_result[$image_key] = $image_src; -
ali2woo-lite/trunk/includes/classes/controller/SettingPageAjaxController.php
r3369759 r3398106 258 258 set_setting( 259 259 Settings::SETTING_ADD_SHIPPING_TO_PRICE, 260 isset($_POST[Settings::SETTING_ADD_SHIPPING_TO_PRICE])260 !empty($_POST[Settings::SETTING_ADD_SHIPPING_TO_PRICE]) ? filter_var($_POST[Settings::SETTING_ADD_SHIPPING_TO_PRICE], FILTER_VALIDATE_BOOLEAN) : false 261 261 ); 262 set_setting('apply_price_rules_after_shipping_cost', !empty($_POST['apply_price_rules_after_shipping_cost']) ? filter_var($_POST['apply_price_rules_after_shipping_cost'], FILTER_VALIDATE_BOOLEAN) : false); 262 set_setting( 263 'apply_price_rules_after_shipping_cost', 264 !empty($_POST['apply_price_rules_after_shipping_cost']) ? filter_var($_POST['apply_price_rules_after_shipping_cost'], FILTER_VALIDATE_BOOLEAN) : false 265 ); 263 266 264 267 settings()->commit(); -
ali2woo-lite/trunk/includes/classes/job/ApplyPricingRulesProcess.php
r3254982 r3398106 118 118 } 119 119 wc_delete_product_transients($product_id); 120 clean_post_cache($product_id); 120 121 } 121 122 } else { -
ali2woo-lite/trunk/includes/classes/model/Woocommerce.php
r3308596 r3398106 327 327 } 328 328 329 if (!is_wp_error($product_id) && $product_id) { 330 // Explicitly set the product type taxonomy because 'tax_input' may not reliably save it in newer WooCommerce versions 331 wp_set_object_terms($product_id, $product_type, 'product_type'); 332 } 333 329 334 if (a2wl_check_defined('A2WL_ON_UPDATE_LOG_AFFILIATE_URL')) { 330 335 $infoLogMessage = sprintf( … … 610 615 { 611 616 do_action('a2wl_woocommerce_upd_product', $product_id, $product, $params); 612 617 613 618 global $wpdb; 614 619 … … 1161 1166 } 1162 1167 1168 // Check: if the sale price is greater than the regular price 1169 if ($price > $regular_price) { 1170 a2wl_info_log(sprintf( 1171 "ERROR: Skip updating product_id=%s, variation_external_id=%s because sale price (%s) > regular price (%s)", 1172 $wc_product->get_id(), 1173 $variation['sku_id'] ?? $variation['id'] ?? 'n/a', 1174 $price, 1175 $regular_price 1176 )); 1177 return; 1178 } 1179 1163 1180 $wc_product->set_regular_price($regular_price); 1164 1181 if (round(abs($regular_price - $price), 2) == 0) { … … 1177 1194 $wc_product->delete_meta_data('_aliexpress_price'); 1178 1195 } 1196 1197 a2wl_info_log(sprintf( 1198 "Update price: product_id=%s, variation_external_id=%s, regular_price=%s, price=%s, sale_price=%s", 1199 $wc_product->get_id(), 1200 $variation['sku_id'] ?? $variation['id'] ?? 'n/a', 1201 $wc_product->get_regular_price(), 1202 $wc_product->get_price(), 1203 $wc_product->get_sale_price() 1204 )); 1179 1205 1180 1206 $wc_product->save(); -
ali2woo-lite/trunk/includes/classes/repository/AliexpressRegionRepository.php
r3369759 r3398106 34 34 'AE' => 'United Arab Emirates', 35 35 'SA' => 'Saudi Arabia', 36 'AR' => 'Argentina', 36 37 'ZA' => 'South Africa', 37 38 'AU' => 'Australia', … … 47 48 'GR' => 'Greece', 48 49 'RU' => 'Russia', 49 'NL' => 'Ne derland',50 'NL' => 'Netherlands', 50 51 'IE' => 'Ireland', 51 52 'ES' => 'Spain', -
ali2woo-lite/trunk/includes/classes/utils/Logs.php
r3107543 r3398106 11 11 use Throwable; 12 12 13 class Logs {13 class Logs{ 14 14 15 private static $_instance = null;15 private static ?Logs $_instance = null; 16 16 17 private $a2wl_logs_file = '/ali2woo/a2wl_debug.log'; 17 private string $a2wl_logs_file = '/ali2woo/a2wl_debug.txt'; 18 19 //old version log 20 private string $a2wl_old_logs_file = '/ali2woo/a2wl_debug.log'; 18 21 19 22 protected function __construct() { 20 23 if (get_setting('write_info_log')) { 21 $upload_dir = wp_upload_dir();22 $ log_file_parts = pathinfo($this->a2wl_logs_file);24 $upload_dir = wp_upload_dir(); 25 $a2wl_logs_dir = $upload_dir['basedir'] . '/ali2woo'; 23 26 24 $ a2wl_logs_dir = $upload_dir['basedir'].$log_file_parts['dirname'];25 $ a2wl_logs_file = $a2wl_logs_dir.'/'.$log_file_parts['basename'];26 27 $old_file = $upload_dir['basedir'] . $this->a2wl_old_logs_file; 28 $new_file = $upload_dir['basedir'] . $this->a2wl_logs_file; 29 27 30 if (!file_exists($a2wl_logs_dir)) { 28 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_mkdir29 31 mkdir($a2wl_logs_dir, 0755, true); 30 32 } 31 33 32 if (!file_exists($a2wl_logs_file)) { 33 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen 34 $fp = fopen($a2wl_logs_file, 'w'); 35 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose 34 if (file_exists($old_file) && !file_exists($new_file)) { 35 if (!rename($old_file, $new_file)) { 36 error_log("Failed to rename old log file"); 37 } 38 } elseif (!file_exists($new_file)) { 39 $fp = fopen($new_file, 'w'); 36 40 fclose($fp); 37 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_chmod 38 chmod($a2wl_logs_file, 0644); 41 chmod($new_file, 0644); 39 42 } 40 43 } 41 44 } 42 45 43 protected function __clone() { 44 45 } 46 protected function __clone() {} 46 47 47 static public function getInstance() { 48 static public function getInstance(): ?Logs 49 { 48 50 if (is_null(self::$_instance)) { 49 51 self::$_instance = new self(); … … 52 54 } 53 55 54 55 56 public function write($message): void 56 57 { 57 if(get_setting('write_info_log')){ 58 $ft = false; 58 if (get_setting('write_info_log')) { 59 59 try { 60 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen61 60 $fp = fopen($this->log_path(), 'a'); 62 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite 63 fwrite($fp, $message."\r\n"); 61 fwrite($fp, $message . "\r\n"); 64 62 } catch (Throwable $e) { 65 63 error_log($e->getTraceAsString()); 66 64 } finally { 67 if ($fp) { 68 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose 65 if (!empty($fp)) { 69 66 fclose($fp); 70 67 } … … 75 72 public function delete(): void 76 73 { 77 // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink78 74 unlink($this->log_path()); 79 75 } … … 82 78 { 83 79 $upload_dir = wp_upload_dir(); 84 85 80 return $upload_dir['basedir'] . $this->a2wl_logs_file; 86 81 } … … 89 84 { 90 85 $upload_dir = wp_upload_dir(); 91 92 86 return $upload_dir['baseurl'] . $this->a2wl_logs_file; 93 87 } 94 95 88 } -
ali2woo-lite/trunk/includes/classes/utils/Utils.php
r3369759 r3398106 354 354 $connector = AliexpressDefaultConnector::getInstance(); 355 355 $desc_images = $connector::get_images_from_description($product); 356 357 //add description image only if it's not already available as image of other type 356 358 foreach ($desc_images as $img_id => $img) { 357 359 if (!isset($tmp_all_images[$img_id])) { -
ali2woo-lite/trunk/includes/libs/json_api/controllers/core.php
r3333646 r3398106 20 20 protected PriceFormulaService $PriceFormulaService; 21 21 protected ProductImportTransactionService $ProductImportTransactionService; 22 protected PurchaseCodeInfoService $PurchaseCodeInfoService; 22 23 23 24 public function __construct( … … 28 29 Aliexpress $AliexpressModel, 29 30 PriceFormulaService $PriceFormulaService, 30 ProductImportTransactionService $ProductImportTransactionService 31 ProductImportTransactionService $ProductImportTransactionService, 32 PurchaseCodeInfoService $PurchaseCodeInfoService 31 33 ) { 32 34 … … 38 40 $this->PriceFormulaService = $PriceFormulaService; 39 41 $this->ProductImportTransactionService = $ProductImportTransactionService; 42 $this->PurchaseCodeInfoService = $PurchaseCodeInfoService; 40 43 41 44 //todo: perhaps it would be better to move this call to some other controller … … 331 334 } 332 335 333 public function get_settings() 336 public function get_settings(): array 334 337 { 335 338 global $a2wl_json_api; … … 337 340 $localizator = AliexpressLocalizator::getInstance(); 338 341 339 $settings = array('a2w_fulfillment_prefship' => get_setting('fulfillment_prefship', 'ePacket'), 342 $settings = [ 343 'a2w_fulfillment_prefship' => get_setting('fulfillment_prefship', 'ePacket'), 340 344 'a2w_aliship_shipto' => get_setting('aliship_shipto', 'US'), 341 345 'a2w_import_language' => $localizator->language, … … 343 347 'a2w_local_currency' => $localizator->currency, 344 348 'a2wl_chrome_ext_import' => a2wl_check_defined('A2WL_CHROME_EXT_IMPORT'), 345 ); 346 347 return array('settings' => $settings); 349 'a2wl_premium' => false 350 ]; 351 352 if (EditionHelper::isFull()) { 353 $PurchaseCodeInfo = $this->PurchaseCodeInfoService->getFromCache(); 354 $supportedUntilTimestamp = $PurchaseCodeInfo->getSupportedUntilStamp(); 355 if ($supportedUntilTimestamp && $supportedUntilTimestamp >= time()) { 356 $settings['a2wl_premium'] = true; 357 } 358 } 359 360 return ['settings' => $settings]; 348 361 } 349 362 -
ali2woo-lite/trunk/readme.txt
r3369763 r3398106 87 87 - Edit product data before publishing: Lite ✅ | Pro ✅ 88 88 - Import product videos: Lite ✅ | Pro ✅ 89 - Import & synchronize reviews with ratings/images: Lite ❌ | Pro ✅ 89 - Import & synchronize reviews with ratings/images: Lite ❌ | Pro ✅ 90 - Mass product import: Lite ❌ | Pro ✅ 90 91 - Translate reviews into multiple languages: Lite ❌ | Pro ✅ 91 92 - Phrase‑based filtering (titles, descriptions, reviews): Lite ✅ | Pro ✅ … … 170 171 171 172 == Changelog == 173 = 3.6.4 - 2025-11-18 174 Fix: Prevent price update when the calculated sale price exceeds the regular price due to an incorrect formula 175 Fix: Resolved issue where product variations were not loaded on certain WordPress installations during import 176 Fix: Various minor bug fixes 177 172 178 = 3.6.3 – 2025-09-29 = 173 179 * Premium: Added "delivery time only" option in shipping settings … … 211 217 - 🌐 [Official homepage](https://ali2woo.com/?utm_source=lite&utm_medium=wporg&utm_campaign=alinext-lite) 212 218 - 👍 [Facebook](https://facebook.com/ali2woo) 213 - 🐦 [Twitter](https://twitter.com/ali2woo)214 219 - ▶️ [YouTube tutorials](https://www.youtube.com/channel/UCmcs_NMPkHi0IE_x9UENsoA) 215 220 - 📌 [Pinterest](https://www.pinterest.ru/ali2woo/) -
ali2woo-lite/trunk/view/settings/price_formula.php
r3369759 r3398106 452 452 </div> 453 453 454 <div class="modal-overlay modal-apply-pricing-rules"> 455 <div class="modal-content"> 456 <div class="modal-header"> 457 <h3 class="modal-title"><?php echo esc_html_e('Apply pricing rules to existing products', 'ali2woo'); ?></h3> 458 <a class="modal-btn-close" href="#"></a> 459 </div> 460 <div class="modal-body"> 461 <label><?php echo esc_html_e('Select the update type', 'ali2woo'); ?></label> 462 <div style="padding-bottom: 20px;"> 463 <div class="type btn-group" role="group"> 464 <button type="button" class="btn btn-default" value="price"><?php echo esc_html_e('Prices', 'ali2woo'); ?></button> 465 <button type="button" class="btn btn-default" value="regular_price"><?php echo esc_html_e('Regular Prices', 'ali2woo'); ?></button> 466 <button type="button" class="btn btn-default" value="all"><?php echo esc_html_e('Prices and Regular Prices', 'ali2woo'); ?></button> 467 </div> 468 </div> 469 <label><?php echo esc_html_e('Select the update scope', 'ali2woo'); ?></label> 470 <div> 471 <div class="scope btn-group" role="group"> 472 <button type="button" class="btn btn-default" value="shop"><?php echo esc_html_e('Shop', 'ali2woo'); ?></button> 473 <button type="button" class="btn btn-default" value="import"><?php echo esc_html_e('Import List', 'ali2woo'); ?></button> 474 <button type="button" class="btn btn-default" value="all"><?php echo esc_html_e('Shop and Import List', 'ali2woo'); ?></button> 475 </div> 476 </div> 477 </div> 478 <div class="modal-footer"> 479 <span class="status" style="padding-right: 10px;">xxx</span> 480 <button class="btn btn-default close-btn" type="button"><?php echo esc_html_e('Close', 'ali2woo'); ?></button> 481 <button class="btn btn-success apply-btn" type="button"><div class="btn-icon-wrap cssload-container"><div class="cssload-speeding-wheel"></div></div><?php echo esc_html_e('Apply', 'ali2woo'); ?></button> 482 </div> 483 </div> 484 </div> 485 486 454 <?php include_once A2WL()->plugin_path() . '/view/includes/bulk_price_formula_modal.php'; ?> 487 455 488 456 <script>
Note: See TracChangeset
for help on using the changeset viewer.