Plugin Directory

Changeset 3343025


Ignore:
Timestamp:
08/11/2025 05:13:30 PM (8 months ago)
Author:
closetechnology
Message:

Update to version 3.1.4 from GitHub

Location:
connect-ecommerce
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • connect-ecommerce/tags/3.1.4/connect-ecommerce.php

    r3339752 r3343025  
    66 * Author:            Closetechnology
    77 * Author URI:        https://close.technology/
    8  * Version:           3.1.3
     8 * Version:           3.1.4
    99 * Requires PHP:      7.4
    1010 * Requires at least: 6.3
     
    1919defined( 'ABSPATH' ) || exit;
    2020
    21 define( 'CONECOM_VERSION', '3.1.3' );
     21define( 'CONECOM_VERSION', '3.1.4' );
    2222define( 'CONECOM_FILE', __FILE__ );
    2323define( 'CONECOM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • connect-ecommerce/tags/3.1.4/includes/Helpers/PROD.php

    r3339752 r3343025  
    4040
    4141        if ( empty( $post_id ) ) {
    42             $post_id        = self::find_product( $item['sku'] );
     42            $post_id        = self::find_product( $item['sku'] ?? '' );
    4343            $is_new_product = empty( $post_id ) ? true : false;
    4444        }
     
    306306        }
    307307
    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'] ?? '';
    309310        // Set properties and save.
    310311        $product->set_props( $product_props );
     
    318319            case 'grouped':
    319320                // Values for simple products.
    320                 $product_props['sku'] = $item['sku'];
    321321                // Check if the product can be sold.
    322322                if ( 'no' === $import_stock && $item['price'] > 0 ) {
     
    358358        // Set attributes.
    359359        $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 );
    363363            if ( ! empty( $categories_ids ) ) {
    364364                $product_props['category_ids'] = $categories_ids;
     
    438438        $message = '';
    439439        $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
    453448        if ( $from_pack ) {
    454449            $message .= '<br/>';
     
    493488
    494489        if ( ! $is_new_product ) {
    495             foreach ( $product->get_children( false ) as $child_id ) {
     490            foreach ( $product->get_children() as $child_id ) {
    496491                // get an instance of the WC_Variation_product Object.
    497492                $variation_children = wc_get_product( $child_id );
     
    569564            if ( ! empty( $variant['barcode'] ) ) {
    570565                try {
    571                     $variation->set_global_unique_id( $item['barcode'] );
     566                    $variation->set_global_unique_id( $variant['barcode'] );
    572567                } catch ( \Exception $e ) {
    573568                    // Error.
  • connect-ecommerce/tags/3.1.4/includes/Helpers/TAX.php

    r3301423 r3343025  
    170170     */
    171171    public static function get_categories_ids( $settings, $item_type, $is_new_product ) {
     172        if ( empty( $item_type ) ) {
     173            return array();
     174        }
    172175        $categories_ids = array();
    173         // Category Status.
    174176        $category_newp = isset( $settings['catnp'] ) ? $settings['catnp'] : 'yes';
    175177
    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 ) {
    179179            $categories_name = self::split_categories_name( $settings, $item_type );
    180180            $categories_ids  = self::find_categories_ids( $categories_name );
  • connect-ecommerce/tags/3.1.4/readme.txt

    r3339752 r3343025  
    66Requires PHP: 7.0
    77Tested up to: 6.8
    8 Stable tag: 3.1.3
    9 Version: 3.1.3
     8Stable tag: 3.1.4
     9Version: 3.1.4
    1010License: GPL2
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7676
    7777== 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.
    7884
    7985= 3.1.3 =
  • connect-ecommerce/tags/3.1.4/vendor/composer/installed.php

    r3339752 r3343025  
    22    'root' => array(
    33        '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',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • connect-ecommerce/trunk/connect-ecommerce.php

    r3339752 r3343025  
    66 * Author:            Closetechnology
    77 * Author URI:        https://close.technology/
    8  * Version:           3.1.3
     8 * Version:           3.1.4
    99 * Requires PHP:      7.4
    1010 * Requires at least: 6.3
     
    1919defined( 'ABSPATH' ) || exit;
    2020
    21 define( 'CONECOM_VERSION', '3.1.3' );
     21define( 'CONECOM_VERSION', '3.1.4' );
    2222define( 'CONECOM_FILE', __FILE__ );
    2323define( 'CONECOM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • connect-ecommerce/trunk/includes/Helpers/PROD.php

    r3339752 r3343025  
    4040
    4141        if ( empty( $post_id ) ) {
    42             $post_id        = self::find_product( $item['sku'] );
     42            $post_id        = self::find_product( $item['sku'] ?? '' );
    4343            $is_new_product = empty( $post_id ) ? true : false;
    4444        }
     
    306306        }
    307307
    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'] ?? '';
    309310        // Set properties and save.
    310311        $product->set_props( $product_props );
     
    318319            case 'grouped':
    319320                // Values for simple products.
    320                 $product_props['sku'] = $item['sku'];
    321321                // Check if the product can be sold.
    322322                if ( 'no' === $import_stock && $item['price'] > 0 ) {
     
    358358        // Set attributes.
    359359        $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 );
    363363            if ( ! empty( $categories_ids ) ) {
    364364                $product_props['category_ids'] = $categories_ids;
     
    438438        $message = '';
    439439        $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
    453448        if ( $from_pack ) {
    454449            $message .= '<br/>';
     
    493488
    494489        if ( ! $is_new_product ) {
    495             foreach ( $product->get_children( false ) as $child_id ) {
     490            foreach ( $product->get_children() as $child_id ) {
    496491                // get an instance of the WC_Variation_product Object.
    497492                $variation_children = wc_get_product( $child_id );
     
    569564            if ( ! empty( $variant['barcode'] ) ) {
    570565                try {
    571                     $variation->set_global_unique_id( $item['barcode'] );
     566                    $variation->set_global_unique_id( $variant['barcode'] );
    572567                } catch ( \Exception $e ) {
    573568                    // Error.
  • connect-ecommerce/trunk/includes/Helpers/TAX.php

    r3301423 r3343025  
    170170     */
    171171    public static function get_categories_ids( $settings, $item_type, $is_new_product ) {
     172        if ( empty( $item_type ) ) {
     173            return array();
     174        }
    172175        $categories_ids = array();
    173         // Category Status.
    174176        $category_newp = isset( $settings['catnp'] ) ? $settings['catnp'] : 'yes';
    175177
    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 ) {
    179179            $categories_name = self::split_categories_name( $settings, $item_type );
    180180            $categories_ids  = self::find_categories_ids( $categories_name );
  • connect-ecommerce/trunk/readme.txt

    r3339752 r3343025  
    66Requires PHP: 7.0
    77Tested up to: 6.8
    8 Stable tag: 3.1.3
    9 Version: 3.1.3
     8Stable tag: 3.1.4
     9Version: 3.1.4
    1010License: GPL2
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7676
    7777== 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.
    7884
    7985= 3.1.3 =
  • connect-ecommerce/trunk/vendor/composer/installed.php

    r3339752 r3343025  
    22    'root' => array(
    33        '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',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.