Plugin Directory

Changeset 3489092


Ignore:
Timestamp:
03/23/2026 02:23:48 PM (10 days ago)
Author:
datafeedr.com
Message:

Update to version 0.9.81 from GitHub

Location:
datafeedr-comparison-sets
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • datafeedr-comparison-sets/tags/0.9.81/classes/class-dfrcs.php

    r2986360 r3489092  
    100100     * Also, if the display method is 'data', this will not create a compset.
    101101     *
     102     * @since 0.9.0
     103     *
    102104     * @return null This method does not return anything.
    103      * @since 0.9.0
    104      *
    105105     */
    106106    public function create() {
     
    183183     * This also returns the value of display_data() if the display_method is 'data'.
    184184     *
     185     * @since 0.9.0
     186     *
    185187     * @return string $html Returns $html for display.
    186      * @since 0.9.0
    187      *
    188188     */
    189189    public function display() {
     
    704704     * method returns true.
    705705     *
     706     * @since 0.9.0
     707     *
    706708     * @param string $id A unique Datafeedr product ID.
    707709     *
    708710     * @return boolean true if products are found, false if no query was run or no products were found.
    709      * @since 0.9.0
    710      *
    711711     */
    712712    private function query_by_dfrps_product( $id ) {
     
    755755     * method returns true.
    756756     *
     757     * @since 0.9.0
     758     *
    757759     * @param string $id A unique Datafeedr product ID.
    758760     *
    759761     * @return boolean true if products are found, false if no query was run or no products were found.
    760      * @since 0.9.0
    761      *
    762762     */
    763763    private function query_by_id( $id ) {
     
    828828     * method returns true to prevent any other queries being run.
    829829     *
     830     * @since 0.9.0
     831     *
    830832     * @param array $fields An array of fields to query the Amazon API on. Default: 'barcodes' and 'name'.
    831833     *
    832834     * @return boolean true if products are found, false if no query was run or no products were found.
    833      * @since 0.9.0
    834      *
    835835     */
    836836    private function query_amazon() {
     
    850850        }
    851851
    852         // Check if Amazon API keys exist and return if they do not.
    853         if ( ! function_exists( 'dfrapi_get_amazon_keys' ) || ! $amazon = dfrapi_get_amazon_keys() ) {
    854             $this->log( 'query_amazon/result', __( 'Halted. No Amazon Keys available.', DFRCS_DOMAIN ) );
    855 
    856             return;
     852        if ( function_exists( 'dfrapi_get_amazon_api' ) ) {
     853            $amazon_api = dfrapi_get_amazon_api();
     854        } else {
     855            $amazon_api = 'paapi';
     856        }
     857
     858        if ( $amazon_api === 'capi' ) {
     859
     860            // Check if Amazon Creators API keys exist.
     861            if ( ! dfrapi_capi_credentials_exist() ) {
     862                $this->log( 'query_amazon/result', __( 'Halted. No Amazon Creators API keys exist.', DFRCS_DOMAIN ) );
     863
     864                return;
     865            }
     866
     867        } else {
     868            // Check if Amazon API keys exist and return if they do not.
     869
     870            if ( ! function_exists( 'dfrapi_get_amazon_keys' ) || ! $amazon = dfrapi_get_amazon_keys() ) {
     871                $this->log( 'query_amazon/result', __( 'Halted. No Amazon Keys available.', DFRCS_DOMAIN ) );
     872
     873                return;
     874            }
    857875        }
    858876
     
    911929            } );
    912930
    913             $locale = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $amazon['amazon_locale'];
    914             $search = $api->amazonSearchRequest( $amazon['amazon_access_key_id'], $amazon['amazon_secret_access_key'],
    915                 $amazon['amazon_tracking_id'], $locale );
    916 
    917 
    918             $search->addParam( 'Keywords', $param );
     931            if ( $amazon_api === 'capi' ) {
     932
     933                $credentials = dfrapi_get_capi_credentials();
     934                $locale      = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $credentials['marketplace'];
     935
     936                $search = $api->amazonCreatorApiSearchRequest( strtoupper( $locale ) );
     937
     938                $search->addParam( 'keywords', $param );
     939
     940            } else {
     941
     942                $locale = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $amazon['amazon_locale'];
     943
     944                $search = $api->amazonSearchRequest(
     945                    $amazon['amazon_access_key_id'],
     946                    $amazon['amazon_secret_access_key'],
     947                    $amazon['amazon_tracking_id'],
     948                    $locale
     949                );
     950
     951                $search->addParam( 'Keywords', $param );
     952            }
    919953
    920954            $this->log( 'query_amazon_by_' . $field . '/api_request/locale', $locale );
     
    923957            // Add MinimumPrice filter.
    924958            if ( isset( $this->source->filters['finalprice_min'] ) ) {
    925                 $search->addParam( 'MinimumPrice', $this->source->filters['finalprice_min'] );
    926                 $this->log( 'query_amazon_by_' . $field . '/api_request/finalprice_min',
    927                     $this->source->filters['finalprice_min'] );
     959
     960                if ( $amazon_api === 'capi' ) {
     961                    $search->addParam( 'minPrice', dfrapi_price_to_int( $this->source->filters['finalprice_min'] ) );
     962                } else {
     963                    $search->addParam( 'MinimumPrice', $this->source->filters['finalprice_min'] );
     964                }
     965
     966                $this->log(
     967                    'query_amazon_by_' . $field . '/api_request/finalprice_min',
     968                    $this->source->filters['finalprice_min']
     969                );
    928970            }
    929971
    930972            // Add MaximumPrice filter.
    931973            if ( isset( $this->source->filters['finalprice_max'] ) ) {
    932                 $search->addParam( 'MaximumPrice', $this->source->filters['finalprice_max'] );
    933                 $this->log( 'query_amazon_by_' . $field . '/api_request/finalprice_max',
    934                     $this->source->filters['finalprice_max'] );
     974
     975                if ( $amazon_api === 'capi' ) {
     976                    $search->addParam( 'maxPrice', dfrapi_price_to_int( $this->source->filters['finalprice_max'] ) );
     977                } else {
     978                    $search->addParam( 'MaximumPrice', $this->source->filters['finalprice_max'] );
     979                }
     980
     981                $this->log(
     982                    'query_amazon_by_' . $field . '/api_request/finalprice_max',
     983                    $this->source->filters['finalprice_max']
     984                );
    935985            }
    936986
     
    9911041     * method returns true.
    9921042     *
     1043     * @since 0.9.0
     1044     *
    9931045     * @param array $barcodes An array of unique codes like EAN, UPC, ISBN or ASIN values.
    9941046     *
    9951047     * @return boolean true if products are found, false if no query was run or no products were found.
    996      * @since 0.9.0
    997      *
    9981048     */
    9991049    private function query_by_barcodes() {
     
    10731123     * method returns true.
    10741124     *
     1125     * @since 0.9.0
     1126     *
    10751127     * @param array $model An array of possible model numbers.
    10761128     *
    10771129     * @return boolean true if products are found, false if no query was run or no products were found.
    1078      * @since 0.9.0
    1079      *
    10801130     */
    10811131    private function query_by_model() {
     
    13971447     * Returns the 13 character EAN value from barcodes array.
    13981448     *
     1449     * @since 0.9.0
     1450     *
    13991451     * @param array $barcodes An array of unique codes such as EAN, UPC, ASIN and ISBN.
    14001452     *
    14011453     * @return string The first 13 character long code from $barcodes.
    1402      * @since 0.9.0
    1403      *
    14041454     */
    14051455    private function get_ean13( $barcodes ) {
  • datafeedr-comparison-sets/tags/0.9.81/datafeedr-comparison-sets.php

    r3113239 r3489092  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.6-RC2
    13 Version: 0.9.71
     12Tested up to: 7.0-beta
     13Version: 0.9.81
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 9.0
     16WC tested up to: 10.0
    1717
    1818Datafeedr Comparison Sets Plugin
    19 Copyright (C) 2024, Datafeedr - help@datafeedr.com
     19Copyright (C) 2026, Datafeedr - help@datafeedr.com
    2020
    2121This program is free software: you can redistribute it and/or modify
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRCS_VERSION', '0.9.71' );
     45define( 'DFRCS_VERSION', '0.9.81' );
    4646define( 'DFRCS_DB_VERSION', '0.9.0' );
    4747define( 'DFRCS_URL', plugin_dir_url( __FILE__ ) );
  • datafeedr-comparison-sets/tags/0.9.81/readme.txt

    r3113239 r3489092  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.6-RC2
    11 Stable tag: 0.9.71
     10Tested up to: 7.0-beta
     11Stable tag: 0.9.81
    1212
    1313Automatically create price comparison sets for your WooCommerce products or by using a shortcode.
     
    205205
    206206== Changelog ==
     207
     208= 0.9.81 - 2026/03/23 =
     209* Added support for Amazon's Creators API program.
    207210
    208211= 0.9.71 - 2024/07/05 =
  • datafeedr-comparison-sets/trunk/classes/class-dfrcs.php

    r2986360 r3489092  
    100100     * Also, if the display method is 'data', this will not create a compset.
    101101     *
     102     * @since 0.9.0
     103     *
    102104     * @return null This method does not return anything.
    103      * @since 0.9.0
    104      *
    105105     */
    106106    public function create() {
     
    183183     * This also returns the value of display_data() if the display_method is 'data'.
    184184     *
     185     * @since 0.9.0
     186     *
    185187     * @return string $html Returns $html for display.
    186      * @since 0.9.0
    187      *
    188188     */
    189189    public function display() {
     
    704704     * method returns true.
    705705     *
     706     * @since 0.9.0
     707     *
    706708     * @param string $id A unique Datafeedr product ID.
    707709     *
    708710     * @return boolean true if products are found, false if no query was run or no products were found.
    709      * @since 0.9.0
    710      *
    711711     */
    712712    private function query_by_dfrps_product( $id ) {
     
    755755     * method returns true.
    756756     *
     757     * @since 0.9.0
     758     *
    757759     * @param string $id A unique Datafeedr product ID.
    758760     *
    759761     * @return boolean true if products are found, false if no query was run or no products were found.
    760      * @since 0.9.0
    761      *
    762762     */
    763763    private function query_by_id( $id ) {
     
    828828     * method returns true to prevent any other queries being run.
    829829     *
     830     * @since 0.9.0
     831     *
    830832     * @param array $fields An array of fields to query the Amazon API on. Default: 'barcodes' and 'name'.
    831833     *
    832834     * @return boolean true if products are found, false if no query was run or no products were found.
    833      * @since 0.9.0
    834      *
    835835     */
    836836    private function query_amazon() {
     
    850850        }
    851851
    852         // Check if Amazon API keys exist and return if they do not.
    853         if ( ! function_exists( 'dfrapi_get_amazon_keys' ) || ! $amazon = dfrapi_get_amazon_keys() ) {
    854             $this->log( 'query_amazon/result', __( 'Halted. No Amazon Keys available.', DFRCS_DOMAIN ) );
    855 
    856             return;
     852        if ( function_exists( 'dfrapi_get_amazon_api' ) ) {
     853            $amazon_api = dfrapi_get_amazon_api();
     854        } else {
     855            $amazon_api = 'paapi';
     856        }
     857
     858        if ( $amazon_api === 'capi' ) {
     859
     860            // Check if Amazon Creators API keys exist.
     861            if ( ! dfrapi_capi_credentials_exist() ) {
     862                $this->log( 'query_amazon/result', __( 'Halted. No Amazon Creators API keys exist.', DFRCS_DOMAIN ) );
     863
     864                return;
     865            }
     866
     867        } else {
     868            // Check if Amazon API keys exist and return if they do not.
     869
     870            if ( ! function_exists( 'dfrapi_get_amazon_keys' ) || ! $amazon = dfrapi_get_amazon_keys() ) {
     871                $this->log( 'query_amazon/result', __( 'Halted. No Amazon Keys available.', DFRCS_DOMAIN ) );
     872
     873                return;
     874            }
    857875        }
    858876
     
    911929            } );
    912930
    913             $locale = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $amazon['amazon_locale'];
    914             $search = $api->amazonSearchRequest( $amazon['amazon_access_key_id'], $amazon['amazon_secret_access_key'],
    915                 $amazon['amazon_tracking_id'], $locale );
    916 
    917 
    918             $search->addParam( 'Keywords', $param );
     931            if ( $amazon_api === 'capi' ) {
     932
     933                $credentials = dfrapi_get_capi_credentials();
     934                $locale      = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $credentials['marketplace'];
     935
     936                $search = $api->amazonCreatorApiSearchRequest( strtoupper( $locale ) );
     937
     938                $search->addParam( 'keywords', $param );
     939
     940            } else {
     941
     942                $locale = ( isset( $this->source->filters['amazon_locale'] ) ) ? $this->source->filters['amazon_locale'] : $amazon['amazon_locale'];
     943
     944                $search = $api->amazonSearchRequest(
     945                    $amazon['amazon_access_key_id'],
     946                    $amazon['amazon_secret_access_key'],
     947                    $amazon['amazon_tracking_id'],
     948                    $locale
     949                );
     950
     951                $search->addParam( 'Keywords', $param );
     952            }
    919953
    920954            $this->log( 'query_amazon_by_' . $field . '/api_request/locale', $locale );
     
    923957            // Add MinimumPrice filter.
    924958            if ( isset( $this->source->filters['finalprice_min'] ) ) {
    925                 $search->addParam( 'MinimumPrice', $this->source->filters['finalprice_min'] );
    926                 $this->log( 'query_amazon_by_' . $field . '/api_request/finalprice_min',
    927                     $this->source->filters['finalprice_min'] );
     959
     960                if ( $amazon_api === 'capi' ) {
     961                    $search->addParam( 'minPrice', dfrapi_price_to_int( $this->source->filters['finalprice_min'] ) );
     962                } else {
     963                    $search->addParam( 'MinimumPrice', $this->source->filters['finalprice_min'] );
     964                }
     965
     966                $this->log(
     967                    'query_amazon_by_' . $field . '/api_request/finalprice_min',
     968                    $this->source->filters['finalprice_min']
     969                );
    928970            }
    929971
    930972            // Add MaximumPrice filter.
    931973            if ( isset( $this->source->filters['finalprice_max'] ) ) {
    932                 $search->addParam( 'MaximumPrice', $this->source->filters['finalprice_max'] );
    933                 $this->log( 'query_amazon_by_' . $field . '/api_request/finalprice_max',
    934                     $this->source->filters['finalprice_max'] );
     974
     975                if ( $amazon_api === 'capi' ) {
     976                    $search->addParam( 'maxPrice', dfrapi_price_to_int( $this->source->filters['finalprice_max'] ) );
     977                } else {
     978                    $search->addParam( 'MaximumPrice', $this->source->filters['finalprice_max'] );
     979                }
     980
     981                $this->log(
     982                    'query_amazon_by_' . $field . '/api_request/finalprice_max',
     983                    $this->source->filters['finalprice_max']
     984                );
    935985            }
    936986
     
    9911041     * method returns true.
    9921042     *
     1043     * @since 0.9.0
     1044     *
    9931045     * @param array $barcodes An array of unique codes like EAN, UPC, ISBN or ASIN values.
    9941046     *
    9951047     * @return boolean true if products are found, false if no query was run or no products were found.
    996      * @since 0.9.0
    997      *
    9981048     */
    9991049    private function query_by_barcodes() {
     
    10731123     * method returns true.
    10741124     *
     1125     * @since 0.9.0
     1126     *
    10751127     * @param array $model An array of possible model numbers.
    10761128     *
    10771129     * @return boolean true if products are found, false if no query was run or no products were found.
    1078      * @since 0.9.0
    1079      *
    10801130     */
    10811131    private function query_by_model() {
     
    13971447     * Returns the 13 character EAN value from barcodes array.
    13981448     *
     1449     * @since 0.9.0
     1450     *
    13991451     * @param array $barcodes An array of unique codes such as EAN, UPC, ASIN and ISBN.
    14001452     *
    14011453     * @return string The first 13 character long code from $barcodes.
    1402      * @since 0.9.0
    1403      *
    14041454     */
    14051455    private function get_ean13( $barcodes ) {
  • datafeedr-comparison-sets/trunk/datafeedr-comparison-sets.php

    r3113239 r3489092  
    1010Requires PHP: 7.4
    1111Requires at least: 3.8
    12 Tested up to: 6.6-RC2
    13 Version: 0.9.71
     12Tested up to: 7.0-beta
     13Version: 0.9.81
    1414
    1515WC requires at least: 3.0
    16 WC tested up to: 9.0
     16WC tested up to: 10.0
    1717
    1818Datafeedr Comparison Sets Plugin
    19 Copyright (C) 2024, Datafeedr - help@datafeedr.com
     19Copyright (C) 2026, Datafeedr - help@datafeedr.com
    2020
    2121This program is free software: you can redistribute it and/or modify
     
    4343 * Define constants.
    4444 */
    45 define( 'DFRCS_VERSION', '0.9.71' );
     45define( 'DFRCS_VERSION', '0.9.81' );
    4646define( 'DFRCS_DB_VERSION', '0.9.0' );
    4747define( 'DFRCS_URL', plugin_dir_url( __FILE__ ) );
  • datafeedr-comparison-sets/trunk/readme.txt

    r3113239 r3489092  
    88Requires PHP: 7.4
    99Requires at least: 3.8
    10 Tested up to: 6.6-RC2
    11 Stable tag: 0.9.71
     10Tested up to: 7.0-beta
     11Stable tag: 0.9.81
    1212
    1313Automatically create price comparison sets for your WooCommerce products or by using a shortcode.
     
    205205
    206206== Changelog ==
     207
     208= 0.9.81 - 2026/03/23 =
     209* Added support for Amazon's Creators API program.
    207210
    208211= 0.9.71 - 2024/07/05 =
Note: See TracChangeset for help on using the changeset viewer.