Plugin Directory

Changeset 3385821


Ignore:
Timestamp:
10/28/2025 11:51:53 AM (4 months ago)
Author:
sendsmaily
Message:

Release 1.4.0, see readme.txt for the changelog.

Location:
smaily-connect
Files:
2 added
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • smaily-connect/tags/1.4.0/includes/smaily.class.php

    r3356475 r3385821  
    247247            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/rss.class.php';
    248248            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/subscriber-synchronization.class.php';
     249            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/helper.class.php';
    249250        }
    250251
  • smaily-connect/tags/1.4.0/integrations/woocommerce/cron.class.php

    r3287639 r3385821  
    33namespace Smaily_Connect\Integrations\WooCommerce;
    44
    5 use Smaily_Connect\Includes\Helper;
     5use Smaily_Connect\Includes\Helper as Smaily_Base_Helper;
    66use Smaily_Connect\Includes\Logger;
    77use Smaily_Connect\Includes\Options;
     
    201201     * @return string
    202202     */
    203     public function get_sale_price( $product ) {
     203    public function get_sale_price_with_tax( $product ) {
    204204        $price = wc_price(
    205             wc_get_price_to_display(
    206                 $product,
    207                 array(
    208                     'price' => $product->get_sale_price(),
    209                 )
    210             )
     205            Helper::get_current_price_with_tax( $product )
    211206        );
    212207
     
    220215     * @return string
    221216     */
    222     public function get_base_price( $product ) {
     217    public function get_base_price_with_tax( $product ) {
    223218        $price = wc_price(
    224             wc_get_price_to_display(
    225                 $product,
    226                 array(
    227                     'price' => $product->get_regular_price(),
    228                 )
    229             )
     219            Helper::get_regular_price_with_tax( $product )
    230220        );
    231221
     
    347337                    break;
    348338                case 'language':
    349                     $addresses['language'] = Helper::get_user_language_code( $user->ID );
     339                    $addresses['language'] = Smaily_Base_Helper::get_user_language_code( $user->ID );
    350340                    break;
    351341                case 'first_name':
     
    417407                            break;
    418408                        case 'product_price':
    419                             $product['product_price'] = $this->get_sale_price( $details );
     409                            $product['product_price'] = $this->get_sale_price_with_tax( $details );
    420410                            break;
    421411                        case 'product_base_price':
    422                             $product['product_base_price'] = $this->get_base_price( $details );
     412                            $product['product_base_price'] = $this->get_base_price_with_tax( $details );
    423413                            break;
    424414                        case 'product_image_url':
  • smaily-connect/tags/1.4.0/integrations/woocommerce/rss.class.php

    r3363656 r3385821  
    139139            }
    140140
    141             $current_price = $product->get_price();
    142             $regular_price = $product->get_regular_price();
     141            $current_price = Helper::get_current_price_with_tax( $product );
     142            $regular_price = Helper::get_regular_price_with_tax( $product );
    143143            $url           = get_permalink( $product->get_id() );
    144144
     
    149149            $rss_feed_item = array(
    150150                'current_price' => $current_price,
    151                 'regular_price' => $product->is_on_sale() ? $regular_price : $current_price,
    152                 'discount'      => self::calculate_discount( floatval( $current_price ), floatval( $regular_price ) ),
     151                'regular_price' => $regular_price,
     152                'discount'      => Helper::calculate_discount( floatval( $current_price ), floatval( $regular_price ) ),
    153153                'url'           => $url,
    154154                'title'         => $product->get_title(),
     
    164164    }
    165165
    166     /**
    167      * Calculates discount percentage between the current price and the regular price.
    168      *
    169      * @param float $current_price
    170      * @param float $regular_price
    171      * @return float
    172      */
    173     private static function calculate_discount( $current_price, $regular_price ) {
    174         if ( $current_price > $regular_price ) {
    175             return 0.0;
    176         }
    177 
    178         if ( $regular_price > 0 ) {
    179             return round( 100 - ( $current_price / $regular_price * 100 ), 2 );
    180         }
    181 
    182         return 0.0;
    183     }
    184166
    185167    /**
  • smaily-connect/tags/1.4.0/readme.txt

    r3375462 r3385821  
    66Tested up to: 6.8
    77WC tested up to: 9.6.1
    8 Stable tag: 1.3.3
     8Stable tag: 1.4.0
    99License: GPLv3 or later
    1010
     
    6060
    6161== Changelog ==
     62
     63= 1.4.0 =
     64
     65Improved RSS-feed items to show prices including taxes. Also added support for Discount Rules for WooCommerce plugin to correctly show discounted prices in the feed and in the abandoned cart reminders.
    6266
    6367= 1.3.3 =
  • smaily-connect/tags/1.4.0/smaily-connect.php

    r3375462 r3385821  
    1212 * Plugin URI:        https://smaily.com/help/user-manual/smaily-connect-for-wordpress/
    1313 * Text Domain:       smaily-connect
    14  * Version:           1.3.3
     14 * Version:           1.4.0
    1515*/
    1616
     
    2323 * Current plugin version.
    2424 */
    25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.3.3' );
     25define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.4.0' );
    2626
    2727/**
  • smaily-connect/trunk/includes/smaily.class.php

    r3356475 r3385821  
    247247            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/rss.class.php';
    248248            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/subscriber-synchronization.class.php';
     249            require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/helper.class.php';
    249250        }
    250251
  • smaily-connect/trunk/integrations/woocommerce/cron.class.php

    r3287639 r3385821  
    33namespace Smaily_Connect\Integrations\WooCommerce;
    44
    5 use Smaily_Connect\Includes\Helper;
     5use Smaily_Connect\Includes\Helper as Smaily_Base_Helper;
    66use Smaily_Connect\Includes\Logger;
    77use Smaily_Connect\Includes\Options;
     
    201201     * @return string
    202202     */
    203     public function get_sale_price( $product ) {
     203    public function get_sale_price_with_tax( $product ) {
    204204        $price = wc_price(
    205             wc_get_price_to_display(
    206                 $product,
    207                 array(
    208                     'price' => $product->get_sale_price(),
    209                 )
    210             )
     205            Helper::get_current_price_with_tax( $product )
    211206        );
    212207
     
    220215     * @return string
    221216     */
    222     public function get_base_price( $product ) {
     217    public function get_base_price_with_tax( $product ) {
    223218        $price = wc_price(
    224             wc_get_price_to_display(
    225                 $product,
    226                 array(
    227                     'price' => $product->get_regular_price(),
    228                 )
    229             )
     219            Helper::get_regular_price_with_tax( $product )
    230220        );
    231221
     
    347337                    break;
    348338                case 'language':
    349                     $addresses['language'] = Helper::get_user_language_code( $user->ID );
     339                    $addresses['language'] = Smaily_Base_Helper::get_user_language_code( $user->ID );
    350340                    break;
    351341                case 'first_name':
     
    417407                            break;
    418408                        case 'product_price':
    419                             $product['product_price'] = $this->get_sale_price( $details );
     409                            $product['product_price'] = $this->get_sale_price_with_tax( $details );
    420410                            break;
    421411                        case 'product_base_price':
    422                             $product['product_base_price'] = $this->get_base_price( $details );
     412                            $product['product_base_price'] = $this->get_base_price_with_tax( $details );
    423413                            break;
    424414                        case 'product_image_url':
  • smaily-connect/trunk/integrations/woocommerce/rss.class.php

    r3363656 r3385821  
    139139            }
    140140
    141             $current_price = $product->get_price();
    142             $regular_price = $product->get_regular_price();
     141            $current_price = Helper::get_current_price_with_tax( $product );
     142            $regular_price = Helper::get_regular_price_with_tax( $product );
    143143            $url           = get_permalink( $product->get_id() );
    144144
     
    149149            $rss_feed_item = array(
    150150                'current_price' => $current_price,
    151                 'regular_price' => $product->is_on_sale() ? $regular_price : $current_price,
    152                 'discount'      => self::calculate_discount( floatval( $current_price ), floatval( $regular_price ) ),
     151                'regular_price' => $regular_price,
     152                'discount'      => Helper::calculate_discount( floatval( $current_price ), floatval( $regular_price ) ),
    153153                'url'           => $url,
    154154                'title'         => $product->get_title(),
     
    164164    }
    165165
    166     /**
    167      * Calculates discount percentage between the current price and the regular price.
    168      *
    169      * @param float $current_price
    170      * @param float $regular_price
    171      * @return float
    172      */
    173     private static function calculate_discount( $current_price, $regular_price ) {
    174         if ( $current_price > $regular_price ) {
    175             return 0.0;
    176         }
    177 
    178         if ( $regular_price > 0 ) {
    179             return round( 100 - ( $current_price / $regular_price * 100 ), 2 );
    180         }
    181 
    182         return 0.0;
    183     }
    184166
    185167    /**
  • smaily-connect/trunk/readme.txt

    r3375462 r3385821  
    66Tested up to: 6.8
    77WC tested up to: 9.6.1
    8 Stable tag: 1.3.3
     8Stable tag: 1.4.0
    99License: GPLv3 or later
    1010
     
    6060
    6161== Changelog ==
     62
     63= 1.4.0 =
     64
     65Improved RSS-feed items to show prices including taxes. Also added support for Discount Rules for WooCommerce plugin to correctly show discounted prices in the feed and in the abandoned cart reminders.
    6266
    6367= 1.3.3 =
  • smaily-connect/trunk/smaily-connect.php

    r3375462 r3385821  
    1212 * Plugin URI:        https://smaily.com/help/user-manual/smaily-connect-for-wordpress/
    1313 * Text Domain:       smaily-connect
    14  * Version:           1.3.3
     14 * Version:           1.4.0
    1515*/
    1616
     
    2323 * Current plugin version.
    2424 */
    25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.3.3' );
     25define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.4.0' );
    2626
    2727/**
Note: See TracChangeset for help on using the changeset viewer.