Changeset 3385821
- Timestamp:
- 10/28/2025 11:51:53 AM (4 months ago)
- Location:
- smaily-connect
- Files:
-
- 2 added
- 10 edited
- 1 copied
-
tags/1.4.0 (copied) (copied from smaily-connect/trunk)
-
tags/1.4.0/includes/smaily.class.php (modified) (1 diff)
-
tags/1.4.0/integrations/woocommerce/cron.class.php (modified) (5 diffs)
-
tags/1.4.0/integrations/woocommerce/helper.class.php (added)
-
tags/1.4.0/integrations/woocommerce/rss.class.php (modified) (3 diffs)
-
tags/1.4.0/readme.txt (modified) (2 diffs)
-
tags/1.4.0/smaily-connect.php (modified) (2 diffs)
-
trunk/includes/smaily.class.php (modified) (1 diff)
-
trunk/integrations/woocommerce/cron.class.php (modified) (5 diffs)
-
trunk/integrations/woocommerce/helper.class.php (added)
-
trunk/integrations/woocommerce/rss.class.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/smaily-connect.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smaily-connect/tags/1.4.0/includes/smaily.class.php
r3356475 r3385821 247 247 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/rss.class.php'; 248 248 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/subscriber-synchronization.class.php'; 249 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/helper.class.php'; 249 250 } 250 251 -
smaily-connect/tags/1.4.0/integrations/woocommerce/cron.class.php
r3287639 r3385821 3 3 namespace Smaily_Connect\Integrations\WooCommerce; 4 4 5 use Smaily_Connect\Includes\Helper ;5 use Smaily_Connect\Includes\Helper as Smaily_Base_Helper; 6 6 use Smaily_Connect\Includes\Logger; 7 7 use Smaily_Connect\Includes\Options; … … 201 201 * @return string 202 202 */ 203 public function get_sale_price ( $product ) {203 public function get_sale_price_with_tax( $product ) { 204 204 $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 ) 211 206 ); 212 207 … … 220 215 * @return string 221 216 */ 222 public function get_base_price ( $product ) {217 public function get_base_price_with_tax( $product ) { 223 218 $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 ) 230 220 ); 231 221 … … 347 337 break; 348 338 case 'language': 349 $addresses['language'] = Helper::get_user_language_code( $user->ID );339 $addresses['language'] = Smaily_Base_Helper::get_user_language_code( $user->ID ); 350 340 break; 351 341 case 'first_name': … … 417 407 break; 418 408 case 'product_price': 419 $product['product_price'] = $this->get_sale_price ( $details );409 $product['product_price'] = $this->get_sale_price_with_tax( $details ); 420 410 break; 421 411 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 ); 423 413 break; 424 414 case 'product_image_url': -
smaily-connect/tags/1.4.0/integrations/woocommerce/rss.class.php
r3363656 r3385821 139 139 } 140 140 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 ); 143 143 $url = get_permalink( $product->get_id() ); 144 144 … … 149 149 $rss_feed_item = array( 150 150 '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 ) ), 153 153 'url' => $url, 154 154 'title' => $product->get_title(), … … 164 164 } 165 165 166 /**167 * Calculates discount percentage between the current price and the regular price.168 *169 * @param float $current_price170 * @param float $regular_price171 * @return float172 */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 }184 166 185 167 /** -
smaily-connect/tags/1.4.0/readme.txt
r3375462 r3385821 6 6 Tested up to: 6.8 7 7 WC tested up to: 9.6.1 8 Stable tag: 1. 3.38 Stable tag: 1.4.0 9 9 License: GPLv3 or later 10 10 … … 60 60 61 61 == Changelog == 62 63 = 1.4.0 = 64 65 Improved 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. 62 66 63 67 = 1.3.3 = -
smaily-connect/tags/1.4.0/smaily-connect.php
r3375462 r3385821 12 12 * Plugin URI: https://smaily.com/help/user-manual/smaily-connect-for-wordpress/ 13 13 * Text Domain: smaily-connect 14 * Version: 1. 3.314 * Version: 1.4.0 15 15 */ 16 16 … … 23 23 * Current plugin version. 24 24 */ 25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1. 3.3' );25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.4.0' ); 26 26 27 27 /** -
smaily-connect/trunk/includes/smaily.class.php
r3356475 r3385821 247 247 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/rss.class.php'; 248 248 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/subscriber-synchronization.class.php'; 249 require_once SMAILY_CONNECT_PLUGIN_PATH . 'integrations/woocommerce/helper.class.php'; 249 250 } 250 251 -
smaily-connect/trunk/integrations/woocommerce/cron.class.php
r3287639 r3385821 3 3 namespace Smaily_Connect\Integrations\WooCommerce; 4 4 5 use Smaily_Connect\Includes\Helper ;5 use Smaily_Connect\Includes\Helper as Smaily_Base_Helper; 6 6 use Smaily_Connect\Includes\Logger; 7 7 use Smaily_Connect\Includes\Options; … … 201 201 * @return string 202 202 */ 203 public function get_sale_price ( $product ) {203 public function get_sale_price_with_tax( $product ) { 204 204 $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 ) 211 206 ); 212 207 … … 220 215 * @return string 221 216 */ 222 public function get_base_price ( $product ) {217 public function get_base_price_with_tax( $product ) { 223 218 $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 ) 230 220 ); 231 221 … … 347 337 break; 348 338 case 'language': 349 $addresses['language'] = Helper::get_user_language_code( $user->ID );339 $addresses['language'] = Smaily_Base_Helper::get_user_language_code( $user->ID ); 350 340 break; 351 341 case 'first_name': … … 417 407 break; 418 408 case 'product_price': 419 $product['product_price'] = $this->get_sale_price ( $details );409 $product['product_price'] = $this->get_sale_price_with_tax( $details ); 420 410 break; 421 411 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 ); 423 413 break; 424 414 case 'product_image_url': -
smaily-connect/trunk/integrations/woocommerce/rss.class.php
r3363656 r3385821 139 139 } 140 140 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 ); 143 143 $url = get_permalink( $product->get_id() ); 144 144 … … 149 149 $rss_feed_item = array( 150 150 '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 ) ), 153 153 'url' => $url, 154 154 'title' => $product->get_title(), … … 164 164 } 165 165 166 /**167 * Calculates discount percentage between the current price and the regular price.168 *169 * @param float $current_price170 * @param float $regular_price171 * @return float172 */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 }184 166 185 167 /** -
smaily-connect/trunk/readme.txt
r3375462 r3385821 6 6 Tested up to: 6.8 7 7 WC tested up to: 9.6.1 8 Stable tag: 1. 3.38 Stable tag: 1.4.0 9 9 License: GPLv3 or later 10 10 … … 60 60 61 61 == Changelog == 62 63 = 1.4.0 = 64 65 Improved 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. 62 66 63 67 = 1.3.3 = -
smaily-connect/trunk/smaily-connect.php
r3375462 r3385821 12 12 * Plugin URI: https://smaily.com/help/user-manual/smaily-connect-for-wordpress/ 13 13 * Text Domain: smaily-connect 14 * Version: 1. 3.314 * Version: 1.4.0 15 15 */ 16 16 … … 23 23 * Current plugin version. 24 24 */ 25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1. 3.3' );25 define( 'SMAILY_CONNECT_PLUGIN_VERSION', '1.4.0' ); 26 26 27 27 /**
Note: See TracChangeset
for help on using the changeset viewer.