Plugin Directory

Changeset 2825069

Timestamp:
11/28/2022 07:53:43 AM (20 months ago)
Author:
snapplify
Message:

Add option for manually flush the pending products queue.
Add option for download product images.

Location:
snapplify-e-commerce
Files:
162 added
7 edited

Legend:

Unmodified
Added
Removed
  • snapplify-e-commerce/trunk/README.txt

    r2810910 r2825069  
    44Requires at least: 5.6
    55Tested up to: 6.0.2
    6 Stable tag: 1.0.2
     6Stable tag: 1.0.
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    8282== Changelog ==
    8383
     84
     85
     86
    8487= 1.0.2 =
    8588* Some Bug Fixing
  • snapplify-e-commerce/trunk/admin/class-snapplify-ecommerce-admin.php

    r2799948 r2825069  
    168168        }
    169169
     170
     171
     172
     173
     174
     175
     176
    170177        if ( 'wcsnapplify' === $current_section ) {
    171178
     
    206213                'css'      => 'min-width:300px;',
    207214                'desc'     => __( 'Enable Category Management. This setting will create categories and assign products to them automatically.', 'snapplify-ecommerce' ),
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
    208225                'default'  => 'yes',
    209226            );
     
    256273                'css'      => 'min-width:300px;',
    257274                'desc'     => __( 'The "API Key" assigned to you by Snapplify, used for authentication.', 'snapplify-ecommerce' ),
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
    258295            );
    259296
     
    368405
    369406    }
     407
     408
    370409
    371410    public function wcsnapplify_fill_custom_tab() {
  • snapplify-e-commerce/trunk/changelog.txt

    r2801825 r2825069  
    11*** WooCommerce Extension Template Changelog ***
    2 2022-10-20 - version 1.0.1
     22022-11-25 - version 1.0.3
     3* Add option for manually flush the pending products queue.
     4* Add option for download product images.
     5
     62022-11-06 - version 1.0.2
     7* Some Bug Fixing
     8* Updated Json feed data file.
     9
     102022-11-02 - version 1.0.1
    311* Bug Fixing
    412
  • snapplify-e-commerce/trunk/includes/class-snapplify-ecommerce.php

    r2799948 r2825069  
    178178        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    179179        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
     180
     181
     182
     183
    180184    }
    181185
  • snapplify-e-commerce/trunk/lib/PipelineStages/class-createproduct.php

    r2799948 r2825069  
    136136            }
    137137
    138             if ( false === $is_new ) {
    139                 // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    140                 if ( $old_image_hash !== $data->imageMd5Hash && null !== $data->imageMd5Hash ) {
    141                     // delete old image.
    142                     wp_delete_attachment( $old_image_id, true );
    143 
    144                     // fetch and attach new image.
     138            if( get_option( 'wcsnapplify_download_product' ) === 'yes' ){
     139                if ( false === $is_new ) {
    145140                    // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    146                     $logger->info( 'Updating image on product, ID: ' . $id . ' OLD: ' . $old_image_hash . ' NEW: ' . $data->imageMd5Hash, $context );
     141                    if ( $old_image_hash !== $data->imageMd5Hash && null !== $data->imageMd5Hash ) {
     142                        // delete old image.
     143                        wp_delete_attachment( $old_image_id, true );
     144   
     145                        // fetch and attach new image.
     146                        // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     147                        $logger->info( 'Updating image on product, ID: ' . $id . ' OLD: ' . $old_image_hash . ' NEW: ' . $data->imageMd5Hash, $context );
     148                        try {
     149                            $logger->info( 'Updating image on product, ID: ' . $id, $context );
     150                            // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     151                            $image_result = media_sideload_image( $data->imageUrl, $id, $data->identifier, 'id' );
     152   
     153                            if( is_wp_error( $image_result ) ){
     154                                throw new \Exception( $image_result->get_error_message() );
     155                            }
     156   
     157                            $product->set_image_id( $image_result );
     158                            $product->save();
     159                        } catch ( \Throwable $th ) {
     160                            $logger->error( 'Error updating image on product, ID: . ' . $id . ' ' . $th->getMessage(), $context );
     161                        }
     162                    }
     163                } else {
     164                    $logger->info( 'Adding image for new product, ID: ' . $id, $context );
     165                    // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    147166                    try {
    148                         $logger->info( 'Updating image on product, ID: ' . $id, $context );
    149                         // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    150167                        $image_result = media_sideload_image( $data->imageUrl, $id, $data->identifier, 'id' );
    151 
     168   
    152169                        if( is_wp_error( $image_result ) ){
    153170                            throw new \Exception( $image_result->get_error_message() );
    154171                        }
    155 
     172   
    156173                        $product->set_image_id( $image_result );
    157174                        $product->save();
    158175                    } catch ( \Throwable $th ) {
    159                         $logger->error( 'Error updating image on product, ID: . ' . $id . ' ' . $th->getMessage(), $context );
     176                        $logger->error( 'Error ing image on product, ID: . ' . $id . ' ' . $th->getMessage(), $context );
    160177                    }
    161178                }
    162             } else {
    163                 $logger->info( 'Adding image for new product, ID: ' . $id, $context );
    164                 // @codingStandardsIgnoreLine WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
    165                 try {
    166                     $image_result = media_sideload_image( $data->imageUrl, $id, $data->identifier, 'id' );
    167 
    168                     if( is_wp_error( $image_result ) ){
    169                         throw new \Exception( $image_result->get_error_message() );
    170                     }
    171 
    172                     $product->set_image_id( $image_result );
    173                     $product->save();
    174                 } catch ( \Throwable $th ) {
    175                     $logger->error( 'Error fetching image on product, ID: . ' . $id . ' ' . $th->getMessage(), $context );
    176                 }
    177             }
     179            }           
    178180
    179181            if ( 'yes' === get_option( 'wcsnapplify_auto_publish' ) ) {
  • snapplify-e-commerce/trunk/public/class-snapplify-ecommerce-public.php

    r2799948 r2825069  
    9292        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/snapplify-ecommerce-public.js', array( 'jquery' ), $this->version, false );
    9393    }
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
    94139}
  • snapplify-e-commerce/trunk/snapplify-ecommerce.php

    r2806512 r2825069  
    1111 * Plugin URI:        https://www.snapplify.com/snapplify-ecommerce
    1212 * Description:       Offer Snapplify products in your WooCommerce Store that can be redeemed using a voucher.
    13  * Version:           1.0.2
     13 * Version:           1.0.
    1414 * Author:            Snapplify
    1515 * Author URI:        https://snapplify.com
Note: See TracChangeset for help on using the changeset viewer.