Plugin Directory

Changeset 3339259


Ignore:
Timestamp:
08/04/2025 08:32:40 PM (8 months ago)
Author:
prodigycommerce
Message:

tagging version 3.2.2

Location:
prodigy-commerce
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • prodigy-commerce/tags/3.2.2/README.txt

    r3330343 r3339259  
    44Requires at least: 4.6
    55Tested up to: 6.8
    6 Stable tag: 3.2.1
     6Stable tag: 3.2.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    183183== Changelog ==
    184184
     185= 3.2.2 - 2025-08-03 =
     186* Fix product cache
     187
    185188= 3.2.1 - 2025-07-18 =
    186189* Fix option images bug
  • prodigy-commerce/tags/3.2.2/includes/api/v1/class-prodigy-api-product.php

    r3302422 r3339259  
    33namespace Prodigy\Includes\Api\V1;
    44
    5 use Prodigy\Includes\Frontend\Mappers\Prodigy_Related_Products_Data_Mapper;
    6 use Prodigy\Includes\Frontend\Prodigy_Product_Template_Builder;
    75use Prodigy\Includes\Models\Prodigy_Products;
    86use Prodigy\Includes\Prodigy;
     
    131129            if ( isset( $product['id'] ) ) {
    132130                $this->cache->reset_product( $product['id'] );
    133             }
    134             $this->cache->reset_catalog();
     131                $this->cache->reset_catalog();
     132            }
    135133        }
    136134
     
    200198            $response['data']['success'] = true;
    201199            $response['data']['id']      = $id_remote_product;
     200            $this->cache->reset_product( $id_remote_product );
     201            $this->cache->reset_catalog();
     202
    202203            return new WP_REST_Response( $response );
    203204        }
  • prodigy-commerce/tags/3.2.2/includes/class-prodigy-cache.php

    r3325128 r3339259  
    1313
    1414    const PLUGIN_TAG                    = 'prodigy';
    15     const PRODUCT_TAG                   = 'product';
    16     const CATALOG_FILTERS_TAG           = 'catalog_filters';
     15    const PRODUCT_TAG                   = '_prodigy_product_';
     16    const CATALOG_FILTERS_TAG           = '_prodigy_catalog_filters_';
    1717    const CATALOG_PRODUCTS_TAG          = 'catalog_products';
    18     const ORDER_TAG                     = 'order';
    19     const RELATED_PRODUCT_TAG           = 'related_product';
    20     const ANALYTICS_TAG                 = 'analytics';
    21     const PRODUCTS_SHORTCODE_TAG        = 'products_shortcode';
    22     const CATEGORIES_SHORTCODE_TAG      = 'categories_shortcode';
    23     const BRANDS_SHORTCODE_TAG          = 'brands_shortcode';
    24     const SETTINGS_TAG                  = 'hosted_system_settings';
     18    const ORDER_TAG                     = '_prodigy_order_';
     19    const RELATED_PRODUCT_TAG           = '_prodigy_related_products_';
     20    const PRODUCTS_SHORTCODE_TAG        = '_prodigy_products_shortcode_';
     21    const CATEGORIES_SHORTCODE_TAG      = '_prodigy_categories_shortcode_';
     22    const BRANDS_SHORTCODE_TAG          = '_prodigy_brands_shortcode_';
     23    const SETTINGS_TAG                  = '_prodigy_hosted_system_settings_';
    2524    const DEFAULT_EXPIRATION_TIME       = 900;
    2625    const EXPIRATION_TIME_OPTION        = 'pg_cache_expiration_time';
     
    5554
    5655    /**
    57      * @param string $id
    58      *
    59      * @return string
    60      */
    61     private function get_product_key( string $id ): string {
     56     * @param int $id
     57     *
     58     * @return string
     59     */
     60    private function get_product_key( int $id ): string {
    6261        return $this->prefix . self::PRODUCT_TAG . md5( $id );
    6362    }
     
    9594     * @return string
    9695     */
    97     private function get_catalog_products_key( string $filter = '' ): string {
    98         return $this->get_catalog_products_prefix() . md5( $filter );
    99     }
    100 
    101     /**
    102      * @param string $filter
    103      *
    104      * @return string
    105      */
    10696    private function get_product_shortcode_key( string $filter = '' ): string {
    10797        return $this->get_products_shortcode_prefix() . md5( $filter );
     
    161151
    162152    /**
    163      * @return string
    164      */
    165     private function get_catalog_products_prefix(): string {
    166         return $this->prefix . self::CATALOG_PRODUCTS_TAG;
    167     }
    168 
    169     /**
    170      * @param string $id
    171      *
    172      * @return mixed
    173      */
    174     public function get_product( string $id ) {
     153     * @param int $id
     154     *
     155     * @return mixed
     156     */
     157    public function get_product( int $id ) {
    175158        return get_transient( $this->get_product_key( $id ) );
    176159    }
     
    226209
    227210    /**
    228      * @param string $id
    229      * @param array  $product_data
    230      *
    231      * @return bool
    232      */
    233     public function set_product( string $id, array $product_data ): bool {
     211     * @param int  $id
     212     * @param array $product_data
     213     *
     214     * @return bool
     215     */
     216    public function set_product( int $id, array $product_data ): bool {
    234217        return $this->set_cache( $this->get_product_key( $id ), $product_data, $this->set_expiration_time() );
    235218    }
     
    366349     */
    367350    public function reset_catalog() {
    368         $this->clear( $this->get_catalog_products_prefix() );
    369351        $this->clear( $this->get_catalog_filters_prefix() );
     352        $this->clear( $this->get_products_shortcode_prefix() );
    370353    }
    371354
     
    389372        if ( empty( $prefix ) ) {
    390373            $prefix = esc_sql( $this->prefix );
    391             $t      = esc_sql( "_transient_$prefix%" );
     374            $t      = esc_sql( "_transient_%$prefix%" );
    392375        } else {
    393376            $t = "%_transient_$prefix" . '%';
  • prodigy-commerce/tags/3.2.2/includes/class-prodigy.php

    r3325128 r3339259  
    193193        add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_prodigy_redirect_urls' ) );
    194194
    195         $this->init_wp_rocket_compatibility();
    196     }
     195        $this->init_wp_rocket_compatibility();}
    197196
    198197    /**
  • prodigy-commerce/tags/3.2.2/includes/content/class-prodigy-request-maker.php

    r3330343 r3339259  
    258258     */
    259259    public function do_catalog_filters_request( string $query = '' ): array {
    260         $hash = md5( $query );
    261         if ( ! isset( $this->catalog_filter_result[ $hash ] ) ) {
    262             $filters = $this->cache->get_catalog_filters( $query );
    263             if ( isset( $filters ) && ! empty( $filters['data'] ) ) {
    264                 $this->catalog_filter_result[ $hash ] = $filters;
    265             } else {
    266                 $relations_query = 'categories.children,categories.parent,tags,properties.options';
    267                 $string_query    = '?include=' . $relations_query . '&' . $query;
    268                 $filter_result   = $this->cache->get_catalog_filters( $string_query );
    269                 if ( ! $filter_result ) {
    270                     $catalog_url   = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $string_query;
    271                     $response      = $this->api_client->get_remote_content( $catalog_url );
    272                     $filter_result = $this->do_process_response( $response, $catalog_url );
    273                     if ( isset( $this->catalog_filter_result[ $hash ] ) && ! empty( $this->catalog_filter_result[ $hash ]['data'] ) ) {
    274                         $this->cache->set_catalog_filters( $this->catalog_filter_result[ $hash ], $string_query );
    275                     }
    276                 }
    277                 $this->catalog_filter_result[ $hash ] = $filter_result;
    278             }
    279         }
    280 
    281         return $this->catalog_filter_result[ $hash ];
     260        $cache_key = md5( $query );
     261
     262        if ( isset( $this->catalog_filter_result[ $cache_key ] ) ) {
     263            return $this->catalog_filter_result[ $cache_key ];
     264        }
     265
     266        $cached_filters = $this->cache->get_catalog_filters( $query );
     267        if ( isset( $cached_filters ) && ! empty( $cached_filters['data'] ) ) {
     268            $this->catalog_filter_result[ $cache_key ] = $cached_filters;
     269            return $this->catalog_filter_result[ $cache_key ];
     270        }
     271
     272        $relations_query = 'categories.children,categories.parent,tags,properties.options';
     273        $enhanced_query  = '?include=' . $relations_query . '&' . $query;
     274        $filter_result   = $this->cache->get_catalog_filters( $enhanced_query );
     275
     276        if ( ! $filter_result ) {
     277            $catalog_url   = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $enhanced_query;
     278            $response      = $this->api_client->get_remote_content( $catalog_url );
     279            $filter_result = $this->do_process_response( $response, $catalog_url );
     280
     281            if ( isset( $filter_result ) && ! empty( $filter_result['data'] ) ) {
     282                $this->cache->set_catalog_filters( $filter_result, $enhanced_query );
     283            }
     284        }
     285
     286        $this->catalog_filter_result[ $cache_key ] = $filter_result;
     287        return $this->catalog_filter_result[ $cache_key ];
    282288    }
    283289
     
    317323        }
    318324
    319         $product_result = $this->cache->get_product( $product_url );
     325        $product_result = $this->cache->get_product( (int) $id_remote_product );
    320326        if ( ! $product_result ) {
    321327            $includes = $includes ?? $this->get_default_product_includes();
     
    338344
    339345            if ( ! empty( $product_result ) ) {
    340                 $this->cache->set_product( $product_url, $product_result );
     346                $this->cache->set_product( (int) $id_remote_product, $product_result );
    341347            }
    342348
  • prodigy-commerce/tags/3.2.2/includes/models/class-prodigy-products.php

    r3302422 r3339259  
    9999            $this->set_product_relations( $post_id, $remote_id, $meta_title );
    100100            $this->set_product_taxonomies( $post_id, $categoriesIds );
    101             $this->reset_product_cache( $post_id );
    102101        }
    103102
  • prodigy-commerce/tags/3.2.2/prodigy-commerce.php

    r3330343 r3339259  
    55 * Plugin URI:        https://prodigycommerce.com
    66 * Description:       Provides a comprehensive set of tools to build unparalleled eCommerce experiences on WordPress.
    7  * Version:           3.2.1
     7 * Version:           3.2.2
    88 * Author:            Prodigy Commerce
    99 * License:           GPL-2.0+
     
    1717use Prodigy\Includes\Prodigy_Deactivator;
    1818
    19 const PRODIGY_VERSION = '3.2.1';
     19const PRODIGY_VERSION = '3.2.2';
    2020
    2121if ( file_exists( plugin_dir_path( __FILE__ ) . 'env.ini' ) ) {
  • prodigy-commerce/trunk/README.txt

    r3330343 r3339259  
    44Requires at least: 4.6
    55Tested up to: 6.8
    6 Stable tag: 3.2.1
     6Stable tag: 3.2.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    183183== Changelog ==
    184184
     185= 3.2.2 - 2025-08-03 =
     186* Fix product cache
     187
    185188= 3.2.1 - 2025-07-18 =
    186189* Fix option images bug
  • prodigy-commerce/trunk/includes/api/v1/class-prodigy-api-product.php

    r3302422 r3339259  
    33namespace Prodigy\Includes\Api\V1;
    44
    5 use Prodigy\Includes\Frontend\Mappers\Prodigy_Related_Products_Data_Mapper;
    6 use Prodigy\Includes\Frontend\Prodigy_Product_Template_Builder;
    75use Prodigy\Includes\Models\Prodigy_Products;
    86use Prodigy\Includes\Prodigy;
     
    131129            if ( isset( $product['id'] ) ) {
    132130                $this->cache->reset_product( $product['id'] );
    133             }
    134             $this->cache->reset_catalog();
     131                $this->cache->reset_catalog();
     132            }
    135133        }
    136134
     
    200198            $response['data']['success'] = true;
    201199            $response['data']['id']      = $id_remote_product;
     200            $this->cache->reset_product( $id_remote_product );
     201            $this->cache->reset_catalog();
     202
    202203            return new WP_REST_Response( $response );
    203204        }
  • prodigy-commerce/trunk/includes/class-prodigy-cache.php

    r3325128 r3339259  
    1313
    1414    const PLUGIN_TAG                    = 'prodigy';
    15     const PRODUCT_TAG                   = 'product';
    16     const CATALOG_FILTERS_TAG           = 'catalog_filters';
     15    const PRODUCT_TAG                   = '_prodigy_product_';
     16    const CATALOG_FILTERS_TAG           = '_prodigy_catalog_filters_';
    1717    const CATALOG_PRODUCTS_TAG          = 'catalog_products';
    18     const ORDER_TAG                     = 'order';
    19     const RELATED_PRODUCT_TAG           = 'related_product';
    20     const ANALYTICS_TAG                 = 'analytics';
    21     const PRODUCTS_SHORTCODE_TAG        = 'products_shortcode';
    22     const CATEGORIES_SHORTCODE_TAG      = 'categories_shortcode';
    23     const BRANDS_SHORTCODE_TAG          = 'brands_shortcode';
    24     const SETTINGS_TAG                  = 'hosted_system_settings';
     18    const ORDER_TAG                     = '_prodigy_order_';
     19    const RELATED_PRODUCT_TAG           = '_prodigy_related_products_';
     20    const PRODUCTS_SHORTCODE_TAG        = '_prodigy_products_shortcode_';
     21    const CATEGORIES_SHORTCODE_TAG      = '_prodigy_categories_shortcode_';
     22    const BRANDS_SHORTCODE_TAG          = '_prodigy_brands_shortcode_';
     23    const SETTINGS_TAG                  = '_prodigy_hosted_system_settings_';
    2524    const DEFAULT_EXPIRATION_TIME       = 900;
    2625    const EXPIRATION_TIME_OPTION        = 'pg_cache_expiration_time';
     
    5554
    5655    /**
    57      * @param string $id
    58      *
    59      * @return string
    60      */
    61     private function get_product_key( string $id ): string {
     56     * @param int $id
     57     *
     58     * @return string
     59     */
     60    private function get_product_key( int $id ): string {
    6261        return $this->prefix . self::PRODUCT_TAG . md5( $id );
    6362    }
     
    9594     * @return string
    9695     */
    97     private function get_catalog_products_key( string $filter = '' ): string {
    98         return $this->get_catalog_products_prefix() . md5( $filter );
    99     }
    100 
    101     /**
    102      * @param string $filter
    103      *
    104      * @return string
    105      */
    10696    private function get_product_shortcode_key( string $filter = '' ): string {
    10797        return $this->get_products_shortcode_prefix() . md5( $filter );
     
    161151
    162152    /**
    163      * @return string
    164      */
    165     private function get_catalog_products_prefix(): string {
    166         return $this->prefix . self::CATALOG_PRODUCTS_TAG;
    167     }
    168 
    169     /**
    170      * @param string $id
    171      *
    172      * @return mixed
    173      */
    174     public function get_product( string $id ) {
     153     * @param int $id
     154     *
     155     * @return mixed
     156     */
     157    public function get_product( int $id ) {
    175158        return get_transient( $this->get_product_key( $id ) );
    176159    }
     
    226209
    227210    /**
    228      * @param string $id
    229      * @param array  $product_data
    230      *
    231      * @return bool
    232      */
    233     public function set_product( string $id, array $product_data ): bool {
     211     * @param int  $id
     212     * @param array $product_data
     213     *
     214     * @return bool
     215     */
     216    public function set_product( int $id, array $product_data ): bool {
    234217        return $this->set_cache( $this->get_product_key( $id ), $product_data, $this->set_expiration_time() );
    235218    }
     
    366349     */
    367350    public function reset_catalog() {
    368         $this->clear( $this->get_catalog_products_prefix() );
    369351        $this->clear( $this->get_catalog_filters_prefix() );
     352        $this->clear( $this->get_products_shortcode_prefix() );
    370353    }
    371354
     
    389372        if ( empty( $prefix ) ) {
    390373            $prefix = esc_sql( $this->prefix );
    391             $t      = esc_sql( "_transient_$prefix%" );
     374            $t      = esc_sql( "_transient_%$prefix%" );
    392375        } else {
    393376            $t = "%_transient_$prefix" . '%';
  • prodigy-commerce/trunk/includes/class-prodigy.php

    r3325128 r3339259  
    193193        add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_prodigy_redirect_urls' ) );
    194194
    195         $this->init_wp_rocket_compatibility();
    196     }
     195        $this->init_wp_rocket_compatibility();}
    197196
    198197    /**
  • prodigy-commerce/trunk/includes/content/class-prodigy-request-maker.php

    r3330343 r3339259  
    258258     */
    259259    public function do_catalog_filters_request( string $query = '' ): array {
    260         $hash = md5( $query );
    261         if ( ! isset( $this->catalog_filter_result[ $hash ] ) ) {
    262             $filters = $this->cache->get_catalog_filters( $query );
    263             if ( isset( $filters ) && ! empty( $filters['data'] ) ) {
    264                 $this->catalog_filter_result[ $hash ] = $filters;
    265             } else {
    266                 $relations_query = 'categories.children,categories.parent,tags,properties.options';
    267                 $string_query    = '?include=' . $relations_query . '&' . $query;
    268                 $filter_result   = $this->cache->get_catalog_filters( $string_query );
    269                 if ( ! $filter_result ) {
    270                     $catalog_url   = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $string_query;
    271                     $response      = $this->api_client->get_remote_content( $catalog_url );
    272                     $filter_result = $this->do_process_response( $response, $catalog_url );
    273                     if ( isset( $this->catalog_filter_result[ $hash ] ) && ! empty( $this->catalog_filter_result[ $hash ]['data'] ) ) {
    274                         $this->cache->set_catalog_filters( $this->catalog_filter_result[ $hash ], $string_query );
    275                     }
    276                 }
    277                 $this->catalog_filter_result[ $hash ] = $filter_result;
    278             }
    279         }
    280 
    281         return $this->catalog_filter_result[ $hash ];
     260        $cache_key = md5( $query );
     261
     262        if ( isset( $this->catalog_filter_result[ $cache_key ] ) ) {
     263            return $this->catalog_filter_result[ $cache_key ];
     264        }
     265
     266        $cached_filters = $this->cache->get_catalog_filters( $query );
     267        if ( isset( $cached_filters ) && ! empty( $cached_filters['data'] ) ) {
     268            $this->catalog_filter_result[ $cache_key ] = $cached_filters;
     269            return $this->catalog_filter_result[ $cache_key ];
     270        }
     271
     272        $relations_query = 'categories.children,categories.parent,tags,properties.options';
     273        $enhanced_query  = '?include=' . $relations_query . '&' . $query;
     274        $filter_result   = $this->cache->get_catalog_filters( $enhanced_query );
     275
     276        if ( ! $filter_result ) {
     277            $catalog_url   = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $enhanced_query;
     278            $response      = $this->api_client->get_remote_content( $catalog_url );
     279            $filter_result = $this->do_process_response( $response, $catalog_url );
     280
     281            if ( isset( $filter_result ) && ! empty( $filter_result['data'] ) ) {
     282                $this->cache->set_catalog_filters( $filter_result, $enhanced_query );
     283            }
     284        }
     285
     286        $this->catalog_filter_result[ $cache_key ] = $filter_result;
     287        return $this->catalog_filter_result[ $cache_key ];
    282288    }
    283289
     
    317323        }
    318324
    319         $product_result = $this->cache->get_product( $product_url );
     325        $product_result = $this->cache->get_product( (int) $id_remote_product );
    320326        if ( ! $product_result ) {
    321327            $includes = $includes ?? $this->get_default_product_includes();
     
    338344
    339345            if ( ! empty( $product_result ) ) {
    340                 $this->cache->set_product( $product_url, $product_result );
     346                $this->cache->set_product( (int) $id_remote_product, $product_result );
    341347            }
    342348
  • prodigy-commerce/trunk/includes/models/class-prodigy-products.php

    r3302422 r3339259  
    9999            $this->set_product_relations( $post_id, $remote_id, $meta_title );
    100100            $this->set_product_taxonomies( $post_id, $categoriesIds );
    101             $this->reset_product_cache( $post_id );
    102101        }
    103102
  • prodigy-commerce/trunk/prodigy-commerce.php

    r3330343 r3339259  
    55 * Plugin URI:        https://prodigycommerce.com
    66 * Description:       Provides a comprehensive set of tools to build unparalleled eCommerce experiences on WordPress.
    7  * Version:           3.2.1
     7 * Version:           3.2.2
    88 * Author:            Prodigy Commerce
    99 * License:           GPL-2.0+
     
    1717use Prodigy\Includes\Prodigy_Deactivator;
    1818
    19 const PRODIGY_VERSION = '3.2.1';
     19const PRODIGY_VERSION = '3.2.2';
    2020
    2121if ( file_exists( plugin_dir_path( __FILE__ ) . 'env.ini' ) ) {
Note: See TracChangeset for help on using the changeset viewer.