Changeset 3343025
- Timestamp:
- 08/11/2025 05:13:30 PM (8 months ago)
- Location:
- connect-ecommerce
- Files:
-
- 10 edited
- 1 copied
-
tags/3.1.4 (copied) (copied from connect-ecommerce/trunk)
-
tags/3.1.4/connect-ecommerce.php (modified) (2 diffs)
-
tags/3.1.4/includes/Helpers/PROD.php (modified) (7 diffs)
-
tags/3.1.4/includes/Helpers/TAX.php (modified) (1 diff)
-
tags/3.1.4/readme.txt (modified) (2 diffs)
-
tags/3.1.4/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/connect-ecommerce.php (modified) (2 diffs)
-
trunk/includes/Helpers/PROD.php (modified) (7 diffs)
-
trunk/includes/Helpers/TAX.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
connect-ecommerce/tags/3.1.4/connect-ecommerce.php
r3339752 r3343025 6 6 * Author: Closetechnology 7 7 * Author URI: https://close.technology/ 8 * Version: 3.1. 38 * Version: 3.1.4 9 9 * Requires PHP: 7.4 10 10 * Requires at least: 6.3 … … 19 19 defined( 'ABSPATH' ) || exit; 20 20 21 define( 'CONECOM_VERSION', '3.1. 3' );21 define( 'CONECOM_VERSION', '3.1.4' ); 22 22 define( 'CONECOM_FILE', __FILE__ ); 23 23 define( 'CONECOM_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); -
connect-ecommerce/tags/3.1.4/includes/Helpers/PROD.php
r3339752 r3343025 40 40 41 41 if ( empty( $post_id ) ) { 42 $post_id = self::find_product( $item['sku'] );42 $post_id = self::find_product( $item['sku'] ?? '' ); 43 43 $is_new_product = empty( $post_id ) ? true : false; 44 44 } … … 306 306 } 307 307 308 $product_props = array_merge( $product_props, $product_props_new ); 308 $product_props = array_merge( $product_props, $product_props_new ); 309 $product_props['sku'] = $item['sku'] ?? ''; 309 310 // Set properties and save. 310 311 $product->set_props( $product_props ); … … 318 319 case 'grouped': 319 320 // Values for simple products. 320 $product_props['sku'] = $item['sku'];321 321 // Check if the product can be sold. 322 322 if ( 'no' === $import_stock && $item['price'] > 0 ) { … … 358 358 // Set attributes. 359 359 $attributes = ! empty( $item['attributes'] ) && is_array( $item['attributes'] ) ? $item['attributes'] : array(); 360 $ item_type = array_search( $attribute_cat_id, array_column( $attributes, 'id', 'value' ) );361 if ( $ item_type ) {362 $categories_ids = TAX::get_categories_ids( $settings, $ item_type, $is_new_product );360 $cat_name = array_column( $attributes, 'name', 'value' )[ $attribute_cat_id ] ?? ''; 361 if ( $cat_name ) { 362 $categories_ids = TAX::get_categories_ids( $settings, $cat_name, $is_new_product ); 363 363 if ( ! empty( $categories_ids ) ) { 364 364 $product_props['category_ids'] = $categories_ids; … … 438 438 $message = ''; 439 439 $post_id = empty( $post_id ) ? $post_id : self::find_product( $item['sku'] ); 440 if ( ! $post_id ) { 441 $post_id = self::create_product_post( $settings, $item ); 442 } 443 if ( $post_id && $item['sku'] && 'simple' === $item['kind'] ) { 444 wp_set_object_terms( $post_id, 'simple', 'product_type' ); 445 446 // Update meta for product. 447 $result_prod = self::sync_product( $settings, $item, $api_erp, $post_id, 'simple', null ); 448 $post_id = $result_prod['prod_id'] ?? 0; 449 450 // Add custom taxonomies. 451 self::add_custom_taxonomies( $post_id, $item ); 452 } 440 441 // Update meta for product. 442 $result_prod = self::sync_product( $settings, $item, $api_erp, $post_id, 'simple', null ); 443 $post_id = $result_prod['prod_id'] ?? 0; 444 445 // Add custom taxonomies. 446 self::add_custom_taxonomies( $post_id, $item ); 447 453 448 if ( $from_pack ) { 454 449 $message .= '<br/>'; … … 493 488 494 489 if ( ! $is_new_product ) { 495 foreach ( $product->get_children( false) as $child_id ) {490 foreach ( $product->get_children() as $child_id ) { 496 491 // get an instance of the WC_Variation_product Object. 497 492 $variation_children = wc_get_product( $child_id ); … … 569 564 if ( ! empty( $variant['barcode'] ) ) { 570 565 try { 571 $variation->set_global_unique_id( $ item['barcode'] );566 $variation->set_global_unique_id( $variant['barcode'] ); 572 567 } catch ( \Exception $e ) { 573 568 // Error. -
connect-ecommerce/tags/3.1.4/includes/Helpers/TAX.php
r3301423 r3343025 170 170 */ 171 171 public static function get_categories_ids( $settings, $item_type, $is_new_product ) { 172 if ( empty( $item_type ) ) { 173 return array(); 174 } 172 175 $categories_ids = array(); 173 // Category Status.174 176 $category_newp = isset( $settings['catnp'] ) ? $settings['catnp'] : 'yes'; 175 177 176 if ( ( ! empty( $item_type ) && 'yes' === $category_newp && $is_new_product ) || 177 ( ! empty( $item_type ) && 'no' === $category_newp && false === $is_new_product ) 178 ) { 178 if ( ( 'yes' === $category_newp && $is_new_product ) || 'no' === $category_newp ) { 179 179 $categories_name = self::split_categories_name( $settings, $item_type ); 180 180 $categories_ids = self::find_categories_ids( $categories_name ); -
connect-ecommerce/tags/3.1.4/readme.txt
r3339752 r3343025 6 6 Requires PHP: 7.0 7 7 Tested up to: 6.8 8 Stable tag: 3.1. 39 Version: 3.1. 38 Stable tag: 3.1.4 9 Version: 3.1.4 10 10 License: GPL2 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 76 76 77 77 == Changelog == 78 79 = 3.1.4 = 80 * Enhancement: Added tests for product simple and variable. 81 * Fixed: sync barcode in product variations. 82 * Fixed: sync categories criteria. 83 * Fixed: deprecation notice for WooCommerce. 78 84 79 85 = 3.1.3 = -
connect-ecommerce/tags/3.1.4/vendor/composer/installed.php
r3339752 r3343025 2 2 'root' => array( 3 3 'name' => 'closemarketing/connect-ecommerce', 4 'pretty_version' => '3.1. 3',5 'version' => '3.1. 3.0',6 'reference' => ' d0a2ae010031b76200e59aac7793e65af172d9e4',4 'pretty_version' => '3.1.4', 5 'version' => '3.1.4.0', 6 'reference' => 'f82b8383596a8cf1ec0c19db1a958fda174f4382', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'closemarketing/connect-ecommerce' => array( 14 'pretty_version' => '3.1. 3',15 'version' => '3.1. 3.0',16 'reference' => ' d0a2ae010031b76200e59aac7793e65af172d9e4',14 'pretty_version' => '3.1.4', 15 'version' => '3.1.4.0', 16 'reference' => 'f82b8383596a8cf1ec0c19db1a958fda174f4382', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
connect-ecommerce/trunk/connect-ecommerce.php
r3339752 r3343025 6 6 * Author: Closetechnology 7 7 * Author URI: https://close.technology/ 8 * Version: 3.1. 38 * Version: 3.1.4 9 9 * Requires PHP: 7.4 10 10 * Requires at least: 6.3 … … 19 19 defined( 'ABSPATH' ) || exit; 20 20 21 define( 'CONECOM_VERSION', '3.1. 3' );21 define( 'CONECOM_VERSION', '3.1.4' ); 22 22 define( 'CONECOM_FILE', __FILE__ ); 23 23 define( 'CONECOM_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); -
connect-ecommerce/trunk/includes/Helpers/PROD.php
r3339752 r3343025 40 40 41 41 if ( empty( $post_id ) ) { 42 $post_id = self::find_product( $item['sku'] );42 $post_id = self::find_product( $item['sku'] ?? '' ); 43 43 $is_new_product = empty( $post_id ) ? true : false; 44 44 } … … 306 306 } 307 307 308 $product_props = array_merge( $product_props, $product_props_new ); 308 $product_props = array_merge( $product_props, $product_props_new ); 309 $product_props['sku'] = $item['sku'] ?? ''; 309 310 // Set properties and save. 310 311 $product->set_props( $product_props ); … … 318 319 case 'grouped': 319 320 // Values for simple products. 320 $product_props['sku'] = $item['sku'];321 321 // Check if the product can be sold. 322 322 if ( 'no' === $import_stock && $item['price'] > 0 ) { … … 358 358 // Set attributes. 359 359 $attributes = ! empty( $item['attributes'] ) && is_array( $item['attributes'] ) ? $item['attributes'] : array(); 360 $ item_type = array_search( $attribute_cat_id, array_column( $attributes, 'id', 'value' ) );361 if ( $ item_type ) {362 $categories_ids = TAX::get_categories_ids( $settings, $ item_type, $is_new_product );360 $cat_name = array_column( $attributes, 'name', 'value' )[ $attribute_cat_id ] ?? ''; 361 if ( $cat_name ) { 362 $categories_ids = TAX::get_categories_ids( $settings, $cat_name, $is_new_product ); 363 363 if ( ! empty( $categories_ids ) ) { 364 364 $product_props['category_ids'] = $categories_ids; … … 438 438 $message = ''; 439 439 $post_id = empty( $post_id ) ? $post_id : self::find_product( $item['sku'] ); 440 if ( ! $post_id ) { 441 $post_id = self::create_product_post( $settings, $item ); 442 } 443 if ( $post_id && $item['sku'] && 'simple' === $item['kind'] ) { 444 wp_set_object_terms( $post_id, 'simple', 'product_type' ); 445 446 // Update meta for product. 447 $result_prod = self::sync_product( $settings, $item, $api_erp, $post_id, 'simple', null ); 448 $post_id = $result_prod['prod_id'] ?? 0; 449 450 // Add custom taxonomies. 451 self::add_custom_taxonomies( $post_id, $item ); 452 } 440 441 // Update meta for product. 442 $result_prod = self::sync_product( $settings, $item, $api_erp, $post_id, 'simple', null ); 443 $post_id = $result_prod['prod_id'] ?? 0; 444 445 // Add custom taxonomies. 446 self::add_custom_taxonomies( $post_id, $item ); 447 453 448 if ( $from_pack ) { 454 449 $message .= '<br/>'; … … 493 488 494 489 if ( ! $is_new_product ) { 495 foreach ( $product->get_children( false) as $child_id ) {490 foreach ( $product->get_children() as $child_id ) { 496 491 // get an instance of the WC_Variation_product Object. 497 492 $variation_children = wc_get_product( $child_id ); … … 569 564 if ( ! empty( $variant['barcode'] ) ) { 570 565 try { 571 $variation->set_global_unique_id( $ item['barcode'] );566 $variation->set_global_unique_id( $variant['barcode'] ); 572 567 } catch ( \Exception $e ) { 573 568 // Error. -
connect-ecommerce/trunk/includes/Helpers/TAX.php
r3301423 r3343025 170 170 */ 171 171 public static function get_categories_ids( $settings, $item_type, $is_new_product ) { 172 if ( empty( $item_type ) ) { 173 return array(); 174 } 172 175 $categories_ids = array(); 173 // Category Status.174 176 $category_newp = isset( $settings['catnp'] ) ? $settings['catnp'] : 'yes'; 175 177 176 if ( ( ! empty( $item_type ) && 'yes' === $category_newp && $is_new_product ) || 177 ( ! empty( $item_type ) && 'no' === $category_newp && false === $is_new_product ) 178 ) { 178 if ( ( 'yes' === $category_newp && $is_new_product ) || 'no' === $category_newp ) { 179 179 $categories_name = self::split_categories_name( $settings, $item_type ); 180 180 $categories_ids = self::find_categories_ids( $categories_name ); -
connect-ecommerce/trunk/readme.txt
r3339752 r3343025 6 6 Requires PHP: 7.0 7 7 Tested up to: 6.8 8 Stable tag: 3.1. 39 Version: 3.1. 38 Stable tag: 3.1.4 9 Version: 3.1.4 10 10 License: GPL2 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 76 76 77 77 == Changelog == 78 79 = 3.1.4 = 80 * Enhancement: Added tests for product simple and variable. 81 * Fixed: sync barcode in product variations. 82 * Fixed: sync categories criteria. 83 * Fixed: deprecation notice for WooCommerce. 78 84 79 85 = 3.1.3 = -
connect-ecommerce/trunk/vendor/composer/installed.php
r3339752 r3343025 2 2 'root' => array( 3 3 'name' => 'closemarketing/connect-ecommerce', 4 'pretty_version' => '3.1. 3',5 'version' => '3.1. 3.0',6 'reference' => ' d0a2ae010031b76200e59aac7793e65af172d9e4',4 'pretty_version' => '3.1.4', 5 'version' => '3.1.4.0', 6 'reference' => 'f82b8383596a8cf1ec0c19db1a958fda174f4382', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'closemarketing/connect-ecommerce' => array( 14 'pretty_version' => '3.1. 3',15 'version' => '3.1. 3.0',16 'reference' => ' d0a2ae010031b76200e59aac7793e65af172d9e4',14 'pretty_version' => '3.1.4', 15 'version' => '3.1.4.0', 16 'reference' => 'f82b8383596a8cf1ec0c19db1a958fda174f4382', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.