From bb090b58a3e7409cb09ac8fe975b12cca6bd9e40 Mon Sep 17 00:00:00 2001 From: Pablo Pacheco Date: Fri, 26 Apr 2024 12:25:18 -0300 Subject: [PATCH] v3.3.7 --- cost-of-goods-for-woocommerce.php | 2 +- includes/alg-wc-cog-functions.php | 32 ++++- includes/class-alg-wc-cog-core.php | 15 +- includes/class-alg-wc-cog-options.php | 52 +++++++ .../class-alg-wc-cog-orders-meta-boxes.php | 16 ++- includes/class-alg-wc-cog-orders.php | 15 +- includes/class-alg-wc-cog.php | 2 +- .../class-alg-wc-cog-settings-currencies.php | 35 ++++- langs/cost-of-goods-for-woocommerce.pot | 128 +++++++++++------- readme.txt | 8 +- 10 files changed, 230 insertions(+), 75 deletions(-) create mode 100644 includes/class-alg-wc-cog-options.php diff --git a/cost-of-goods-for-woocommerce.php b/cost-of-goods-for-woocommerce.php index dbb23e7..d605959 100644 --- a/cost-of-goods-for-woocommerce.php +++ b/cost-of-goods-for-woocommerce.php @@ -3,7 +3,7 @@ Plugin Name: Cost of Goods for WooCommerce Plugin URI: https://wpfactory.com/item/cost-of-goods-for-woocommerce/ Description: Save product purchase costs (cost of goods) in WooCommerce. Beautifully. -Version: 3.3.6 +Version: 3.3.7 Author: WPFactory Author URI: https://wpfactory.com Text Domain: cost-of-goods-for-woocommerce diff --git a/includes/alg-wc-cog-functions.php b/includes/alg-wc-cog-functions.php index bd000a1..4ecbc76 100644 --- a/includes/alg-wc-cog-functions.php +++ b/includes/alg-wc-cog-functions.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Functions. * - * @version 3.3.3 + * @version 3.3.7 * @since 3.2.1 * @author WPFactory */ @@ -439,4 +439,34 @@ function alg_wc_cog_generate_wpdb_prepare_placeholders_from_array( $array ) { return '(' . join( ',', $placeholders ) . ')'; } +} + +if ( ! function_exists( 'alg_wc_cog_get_admin_orders_page_url' ) ) { + /** + * alg_wc_cog_get_admin_orders_page_url + * + * @version 3.3.7 + * @since 3.3.7 + * + * @return string + */ + function alg_wc_cog_get_admin_orders_page_url() { + return class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' ) && wc_get_container()->get( \Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() + ? admin_url( 'admin.php?page=wc-orders' ) + : admin_url( 'edit.php?post_type=shop_order' ); + } +} + +if ( ! function_exists( 'alg_wc_cog_get_option' ) ) { + /** + * alg_wc_cog_get_option. + * + * @version 3.3.7 + * @since 3.3.7 + * + * @return false|mixed|null + */ + function alg_wc_cog_get_option( $option, $default_value = false, $get_value_from_cache = true ) { + return alg_wc_cog()->core->options->get_option( $option, $default_value, $get_value_from_cache ); + } } \ No newline at end of file diff --git a/includes/class-alg-wc-cog-core.php b/includes/class-alg-wc-cog-core.php index 241ec3b..a98f19c 100644 --- a/includes/class-alg-wc-cog-core.php +++ b/includes/class-alg-wc-cog-core.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Core Class. * - * @version 2.9.4 + * @version 3.3.7 * @since 1.0.0 * @author WPFactory */ @@ -78,10 +78,19 @@ class Alg_WC_Cost_of_Goods_Core { */ public $bulk_edit_tool; + /** + * Options. + * + * @since 3.3.7 + * + * @var Alg_WC_Cost_of_Goods_Options + */ + public $options; + /** * Constructor. * - * @version 2.8.2 + * @version 3.3.7 * @since 1.0.0 * @todo [next] add "delete all (products and/or orders) meta" tool * @todo [next] add option to enter costs *with taxes* @@ -99,6 +108,8 @@ class Alg_WC_Cost_of_Goods_Core { * @todo [maybe] add option to change meta keys prefix (i.e. `_alg_wc_cog`) */ function __construct() { + require_once( 'class-alg-wc-cog-options.php' ); + $this->options = new Alg_WC_Cost_of_Goods_Options(); // Background process. $this->init_bkg_process(); // Analytics. diff --git a/includes/class-alg-wc-cog-options.php b/includes/class-alg-wc-cog-options.php new file mode 100644 index 0000000..c365907 --- /dev/null +++ b/includes/class-alg-wc-cog-options.php @@ -0,0 +1,52 @@ +options[ $option ] ) || + ! $get_value_from_cache + ) { + $this->options[ $option ] = get_option( $option, $default_value ); + } + + return $this->options[ $option ]; + } + + } + +} \ No newline at end of file diff --git a/includes/class-alg-wc-cog-orders-meta-boxes.php b/includes/class-alg-wc-cog-orders-meta-boxes.php index c96caa6..adaa9ab 100644 --- a/includes/class-alg-wc-cog-orders-meta-boxes.php +++ b/includes/class-alg-wc-cog-orders-meta-boxes.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Orders Meta Boxes Class. * - * @version 3.3.6 + * @version 3.3.7 * @since 2.2.0 * @author WPFactory */ @@ -125,7 +125,7 @@ function add_order_meta_box() { /** * render_order_meta_box. * - * @version 3.1.4 + * @version 3.3.7 * @since 1.4.0 * @todo [maybe] order total */ @@ -136,19 +136,21 @@ function render_order_meta_box( $post ) { return; } $cost = $order->get_meta( '_alg_wc_cog_order_' . 'cost', true ); + $cost = apply_filters( 'alc_wc_cog_order_metabox_value', $cost, array( 'invert' => true, 'order' => $order ) ); $handling_fee = $order->get_meta( '_alg_wc_cog_order_' . 'handling_fee', true ); $profit = $order->get_meta( '_alg_wc_cog_order_' . 'profit', true ); + $profit = apply_filters( 'alc_wc_cog_order_metabox_value', $profit, array( 'invert' => true, 'order' => $order ) ); $profit_percent = $order->get_meta( '_alg_wc_cog_order_' . 'profit_percent', true ); $profit_margin = $order->get_meta( '_alg_wc_cog_order_' . 'profit_margin', true ); $profit_template = get_option( 'alg_wc_cog_orders_profit_html_template', '%profit%' ); $profit_placeholders = array( - '%profit%' => alg_wc_cog()->core->orders->format_order_column_value( $profit, 'profit' ), + '%profit%' => alg_wc_cog()->core->orders->format_order_column_value( $profit, 'profit', apply_filters( 'alc_wc_cog_order_metabox_value_format_args', array(), array( 'order' => $order ) ) ), '%profit_percent%' => alg_wc_cog()->core->orders->format_order_column_value( $profit_percent, 'profit_percent' ), '%profit_margin%' => alg_wc_cog()->core->orders->format_order_column_value( $profit_margin, 'profit_margin' ), ); $profit_html = str_replace( array_keys( $profit_placeholders ), $profit_placeholders, $profit_template ); $table_args = array( 'table_heading_type' => 'vertical', 'table_class' => 'widefat', 'columns_styles' => array( '', 'text-align:right;' ) ); - $cost_html = apply_filters( 'alg_wc_cog_order_metabox_cost_value_html', alg_wc_cog_format_cost( $cost ), $cost, $order_id ); + $cost_html = apply_filters( 'alg_wc_cog_order_metabox_cost_value_html', alg_wc_cog_format_cost( $cost, apply_filters( 'alc_wc_cog_order_metabox_value_format_args', array(), array( 'order' => $order ) ) ), $cost, $order_id ); $table_data = array( array( __( 'Cost', 'cost-of-goods-for-woocommerce' ), ( '' !== $cost ? '' . $cost_html . '' : '' ) ), array( __( 'Profit', 'cost-of-goods-for-woocommerce' ), ( '' !== $profit ? '' . $profit_html . '' : '' ) ), @@ -175,8 +177,9 @@ function render_order_meta_box( $post ) { $cost_meta_keys = apply_filters( 'alg_wc_cog_cost_meta_keys', $cost_meta_keys ); foreach ( $cost_meta_keys as $key => $value ) { $cost = $order->get_meta( $key, true ); + $cost = apply_filters( 'alc_wc_cog_order_metabox_value', $cost, array( 'invert' => true, 'order' => $order ) ); if ( ! empty( $cost ) && 0 != $cost ) { - $table_data[] = array( $value, alg_wc_cog_format_cost( $cost ) ); + $table_data[] = array( $value, alg_wc_cog_format_cost( $cost, apply_filters( 'alc_wc_cog_order_metabox_value_format_args', array(), array( 'order' => $order ) ) ) ); } } if ( count( $table_data ) > 0 ) { @@ -189,8 +192,9 @@ function render_order_meta_box( $post ) { $extra_profit_meta_keys = apply_filters( 'alg_wc_cog_extra_profit_meta_keys', $extra_profit_meta_keys ); foreach ( $extra_profit_meta_keys as $key => $value ) { $cost = $order->get_meta( $key, true ); + $cost = apply_filters( 'alc_wc_cog_order_metabox_value', $cost, array( 'invert' => true, 'order' => $order ) ); if ( 0 != $cost && ! empty( $cost ) ) { - $table_data[] = array( $value, alg_wc_cog_format_cost( $cost ) ); + $table_data[] = array( $value, alg_wc_cog_format_cost( $cost, apply_filters( 'alc_wc_cog_order_metabox_value_format_args', array(), array( 'order' => $order ) ) ) ); } } if ( count( $table_data ) > 0 ) { diff --git a/includes/class-alg-wc-cog-orders.php b/includes/class-alg-wc-cog-orders.php index 2ac27a0..54c552b 100644 --- a/includes/class-alg-wc-cog-orders.php +++ b/includes/class-alg-wc-cog-orders.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Orders Class. * - * @version 3.3.6 + * @version 3.3.7 * @since 2.1.0 * @author WPFactory */ @@ -879,7 +879,7 @@ function add_order_columns( $columns ) { /** * render_order_columns. * - * @version 3.1.6 + * @version 3.3.7 * @since 1.0.0 * @todo [later] order status for the fee columns * @todo [later] forecasted profit `$value = $line_total * $average_profit_margin` @@ -898,18 +898,21 @@ function render_order_columns( $column, $order_id ) { $order = wc_get_order( $order_id ); $key = $this->get_order_column_key( $column ); $value = $order->get_meta( $key, true ); - echo( '' !== $value ? $this->format_order_column_value( $value, $column ) : '' ); + if ( in_array( $column, array( 'profit', 'cost' ) ) ) { + $value = apply_filters( 'alc_wc_cog_order_admin_column_value', $value, array( 'invert' => true, 'order' => $order ) ); + } + echo( '' !== $value ? $this->format_order_column_value( $value, $column, apply_filters( 'alc_wc_cog_order_admin_column_value_format_args', array(), array( 'order' => $order ) ) ) : '' ); } } /** * format_order_column_value. * - * @version 2.2.0 + * @version 3.3.7 * @since 2.2.0 */ - function format_order_column_value( $value, $column ) { - return ( in_array( $column, array( 'profit_percent', 'profit_margin' ) ) ? sprintf( '%0.2f%%', $value ) : wc_price( $value ) ); + function format_order_column_value( $value, $column, $wc_price_args = null ) { + return ( in_array( $column, array( 'profit_percent', 'profit_margin' ) ) ? sprintf( '%0.2f%%', $value ) : wc_price( $value, $wc_price_args ) ); } /** diff --git a/includes/class-alg-wc-cog.php b/includes/class-alg-wc-cog.php index e927db9..a9e2fe9 100644 --- a/includes/class-alg-wc-cog.php +++ b/includes/class-alg-wc-cog.php @@ -35,7 +35,7 @@ final class Alg_WC_Cost_of_Goods { * @since 1.0.0 * @var string */ - public $version = '3.3.6'; + public $version = '3.3.7'; /** * @since 1.0.0 diff --git a/includes/settings/class-alg-wc-cog-settings-currencies.php b/includes/settings/class-alg-wc-cog-settings-currencies.php index 13361f5..33dfd3a 100644 --- a/includes/settings/class-alg-wc-cog-settings-currencies.php +++ b/includes/settings/class-alg-wc-cog-settings-currencies.php @@ -2,7 +2,7 @@ /** * Cost of Goods for WooCommerce - Currencies Section Settings. * - * @version 3.2.3 + * @version 3.3.7 * @since 2.2.0 * @author WPFactory */ @@ -28,7 +28,7 @@ function __construct() { /** * get_settings. * - * @version 2.8.7 + * @version 3.3.7 * @since 2.2.0 * @todo [next] exclude `$wc_currency` from `get_woocommerce_currencies()`? * @todo [maybe] `alg_wc_cog_currencies_wmc`: add link to the plugin on wp.org? @@ -39,15 +39,17 @@ function get_settings() { $multicurrency_order_calculation_opts = array( array( 'title' => __( 'Multi-currency management', 'cost-of-goods-for-woocommerce' ), - 'desc' => sprintf( __( 'Calculate %s from orders in non-default shop currency based on custom exchange rates.', 'cost-of-goods-for-woocommerce' ), '' . __( 'profit', 'cost-of-goods-for-woocommerce' ) . '' ). ' ' . - __( 'The order profit will be calculated in the default shop base currency.', 'cost-of-goods-for-woocommerce' ) , + 'desc' => __( 'Some notes:', 'cost-of-goods-for-woocommerce' ) . '
' . + alg_wc_cog_array_to_string( array( + __( 'All COG related metas, such as profit and costs will be saved in the shop base currency.', 'cost-of-goods-for-woocommerce' ), + __( 'All costs should be always set with the shop base currency, including cost fields present on orders.', 'cost-of-goods-for-woocommerce' ), + ), array( 'item_template' => '
  • {value}
  • ', 'glue' => '' ) ), 'type' => 'title', 'id' => 'alg_wc_cog_currencies_options', ), array( 'title' => __( 'Multi-currency management', 'cost-of-goods-for-woocommerce' ), 'desc' => sprintf( __( 'Enable %s feature', 'cost-of-goods-for-woocommerce' ), strtolower( __( 'Multi-currency management', 'cost-of-goods-for-woocommerce' ) ) ), - //'desc_tip' => __( 'The order profit will be calculated in the default shop base currency.', 'cost-of-goods-for-woocommerce' ), 'type' => 'checkbox', 'id' => 'alg_wc_cog_currencies_enabled', 'default' => 'no', @@ -56,6 +58,29 @@ function get_settings() { 'hide' => true ) ), + array( + 'title' => __( 'Order values', 'cost-of-goods-for-woocommerce' ), + 'desc' => __( 'Display COG related values from the order, such as costs and profit, in the currency of the order', 'cost-of-goods-for-woocommerce' ), + 'desc_tip' => sprintf(__( 'The affected areas are the %s and the order page on the admin.', 'cost-of-goods-for-woocommerce' ), '' . __( 'order listing page', 'cost-of-goods-for-woocommerce' ) . ''), + 'type' => 'checkbox', + 'id' => 'alg_wc_cog_currencies_display_order_currency_values', + 'default' => 'yes', + 'custom_attributes' => apply_filters( 'alg_wc_cog_settings', array( 'disabled' => 'disabled' ) ), + 'wpfse_data' => array( + 'hide' => true + ) + ), + array( + 'title' => __( 'COG order fields currency', 'cost-of-goods-for-woocommerce' ), + 'desc' => __( 'Force shop base currency on COG order fields', 'cost-of-goods-for-woocommerce' ), + 'type' => 'checkbox', + 'id' => 'alg_wc_cog_currencies_force_sb_currency_cog_order_fields', + 'default' => 'yes', + 'custom_attributes' => apply_filters( 'alg_wc_cog_settings', array( 'disabled' => 'disabled' ) ), + 'wpfse_data' => array( + 'hide' => true + ) + ), array( 'title' => __( 'Currencies', 'cost-of-goods-for-woocommerce' ), 'desc_tip' => __( 'Choose currencies you want to set exchange rates for, and "Save changes" - new settings fields will be displayed.', 'cost-of-goods-for-woocommerce' ), diff --git a/langs/cost-of-goods-for-woocommerce.pot b/langs/cost-of-goods-for-woocommerce.pot index 4082636..c55ba30 100644 --- a/langs/cost-of-goods-for-woocommerce.pot +++ b/langs/cost-of-goods-for-woocommerce.pot @@ -2,14 +2,14 @@ # This file is distributed under the GNU General Public License v3.0. msgid "" msgstr "" -"Project-Id-Version: cost-of-goods-for-woocommerce 3.3.6\n" +"Project-Id-Version: cost-of-goods-for-woocommerce 3.3.7\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cost-of-goods-for-woocommerce\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-04-24T20:23:29+02:00\n" +"POT-Creation-Date: 2024-04-26T17:24:43+02:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.7.1\n" "X-Domain: cost-of-goods-for-woocommerce\n" @@ -74,7 +74,7 @@ msgstr "" #: includes/analytics/class-alg-wc-cog-analytics-products.php:78 #: includes/analytics/class-alg-wc-cog-analytics-revenue.php:47 #: includes/analytics/class-alg-wc-cog-analytics-stock.php:281 -#: includes/class-alg-wc-cog-orders-meta-boxes.php:153 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:155 #: includes/class-alg-wc-cog-orders.php:748 #: includes/class-alg-wc-cog-orders.php:858 #: includes/class-alg-wc-cog-products-add-stock.php:352 @@ -103,7 +103,7 @@ msgstr "" #: includes/analytics/class-alg-wc-cog-analytics-products.php:114 #: includes/analytics/class-alg-wc-cog-analytics-revenue.php:48 #: includes/analytics/class-alg-wc-cog-analytics-stock.php:282 -#: includes/class-alg-wc-cog-orders-meta-boxes.php:154 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:156 #: includes/class-alg-wc-cog-orders.php:749 #: includes/class-alg-wc-cog-orders.php:868 #: includes/class-alg-wc-cog-products.php:383 @@ -159,7 +159,7 @@ msgid "N/A" msgstr "" #: includes/class-alg-wc-cog-orders-meta-boxes.php:116 -#: includes/class-alg-wc-cog-orders-meta-boxes.php:215 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:219 #: includes/pro/class-alg-wc-cog-pro-quick-and-bulk-edit.php:103 #: includes/settings/class-alg-wc-cog-settings-orders.php:421 #: includes/settings/class-alg-wc-cog-settings-products.php:253 @@ -167,81 +167,81 @@ msgstr "" msgid "Cost of Goods" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:160 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:162 #: includes/settings/class-alg-wc-cog-settings-orders.php:114 msgid "Item costs" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:161 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:163 #: includes/settings/class-alg-wc-cog-settings-orders.php:128 msgid "Item handling fees" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:162 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:164 msgid "Shipping method fee (fixed)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:163 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:165 msgid "Shipping method fee (percent)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:164 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:166 msgid "Shipping class fee (fixed)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:165 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:167 msgid "Shipping class fee (percent)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:166 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:168 msgid "Gateway fee (fixed)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:167 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:169 msgid "Gateway fee (percent)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:168 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:170 msgid "Order fee (fixed)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:169 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:171 msgid "Order fee (percent)" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:170 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:172 #: includes/settings/class-alg-wc-cog-settings-orders.php:428 msgid "Handling fee" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:171 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:173 #: includes/settings/class-alg-wc-cog-settings-orders.php:436 msgid "Shipping fee" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:172 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:174 #: includes/settings/class-alg-wc-cog-settings-orders.php:444 msgid "Payment fee" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:173 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:175 msgid "Meta fees" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:183 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:186 msgid "Cost details" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:197 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:201 msgid "Extra profit details" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:215 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:219 #: includes/settings/class-alg-wc-cog-settings-orders.php:421 msgid "Extra costs" msgstr "" -#: includes/class-alg-wc-cog-orders-meta-boxes.php:239 +#: includes/class-alg-wc-cog-orders-meta-boxes.php:243 msgid "fee" msgstr "" @@ -281,9 +281,9 @@ msgid "Shipping to profit (%s)" msgstr "" #: includes/class-alg-wc-cog-orders.php:752 -#: includes/class-alg-wc-cog-orders.php:1187 -#: includes/pro/class-alg-wc-cog-pro.php:459 -#: includes/pro/class-alg-wc-cog-pro.php:478 +#: includes/class-alg-wc-cog-orders.php:1190 +#: includes/pro/class-alg-wc-cog-pro.php:638 +#: includes/pro/class-alg-wc-cog-pro.php:657 msgid "Cost of goods" msgstr "" @@ -297,7 +297,7 @@ msgstr "" msgid "Profit margin" msgstr "" -#: includes/class-alg-wc-cog-orders.php:1223 +#: includes/class-alg-wc-cog-orders.php:1226 msgid "Handling Fee" msgstr "" @@ -401,7 +401,7 @@ msgid "Option(s) costs" msgstr "" #: includes/pro/class-alg-wc-cog-pro-extra-currencies-costs.php:54 -#: includes/settings/class-alg-wc-cog-settings-currencies.php:102 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:127 msgid "Currencies costs" msgstr "" @@ -409,27 +409,27 @@ msgstr "" msgid "- No change -" msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:404 +#: includes/pro/class-alg-wc-cog-pro.php:583 msgid "Orders cost and profit successfully recalculated." msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:411 +#: includes/pro/class-alg-wc-cog-pro.php:590 msgid "Orders cost and profit recalculating via background processing. You should receive an e-mail when it's complete if the \"Advanced > Background processing > Send email\" option is enabled." msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:414 +#: includes/pro/class-alg-wc-cog-pro.php:593 msgid "Something went wrong..." msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:532 +#: includes/pro/class-alg-wc-cog-pro.php:711 msgid "Cost of Goods reports are in %s and in %s." msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:534 +#: includes/pro/class-alg-wc-cog-pro.php:713 msgid "Reports > Orders > Cost of Goods" msgstr "" -#: includes/pro/class-alg-wc-cog-pro.php:536 +#: includes/pro/class-alg-wc-cog-pro.php:715 msgid "Reports > Stock > Cost of Goods" msgstr "" @@ -1167,61 +1167,85 @@ msgid "Multicurrency" msgstr "" #: includes/settings/class-alg-wc-cog-settings-currencies.php:41 -#: includes/settings/class-alg-wc-cog-settings-currencies.php:48 -#: includes/settings/class-alg-wc-cog-settings-currencies.php:49 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:51 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:52 msgid "Multi-currency management" msgstr "" #: includes/settings/class-alg-wc-cog-settings-currencies.php:42 -msgid "Calculate %s from orders in non-default shop currency based on custom exchange rates." +msgid "Some notes:" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:42 -msgid "profit" +#: includes/settings/class-alg-wc-cog-settings-currencies.php:44 +msgid "All COG related metas, such as profit and costs will be saved in the shop base currency." msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:43 -msgid "The order profit will be calculated in the default shop base currency." +#: includes/settings/class-alg-wc-cog-settings-currencies.php:45 +msgid "All costs should be always set with the shop base currency, including cost fields present on orders." msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:49 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:52 msgid "Enable %s feature" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:60 -#: includes/settings/class-alg-wc-cog-settings-currencies.php:113 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:62 +msgid "Order values" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:63 +msgid "Display COG related values from the order, such as costs and profit, in the currency of the order" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:64 +msgid "The affected areas are the %s and the order page on the admin." +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:64 +msgid "order listing page" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:74 +msgid "COG order fields currency" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:75 +msgid "Force shop base currency on COG order fields" +msgstr "" + +#: includes/settings/class-alg-wc-cog-settings-currencies.php:85 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:138 msgid "Currencies" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:61 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:86 msgid "Choose currencies you want to set exchange rates for, and \"Save changes\" - new settings fields will be displayed." msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:96 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:121 msgid "Currency costs" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:97 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:122 msgid "Add extra costs based on the order currency." msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:103 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:128 msgid "Add extra costs based on the order currency" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:114 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:139 msgid "Choose currencies you want to add costs for, and \"Save changes\" - new settings fields will be displayed." msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:130 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:155 msgid " - Fixed cost" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:140 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:165 msgid " - Percent cost" msgstr "" -#: includes/settings/class-alg-wc-cog-settings-currencies.php:141 +#: includes/settings/class-alg-wc-cog-settings-currencies.php:166 msgid "Percent from order total. E.g.: If you want to add a cost of 50% from order total you can set it as 50." msgstr "" diff --git a/readme.txt b/readme.txt index 725de2d..6e153bc 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: wpcodefactory, omardabbas, karzin, anbinder, algoritmika, kousikmu Tags: woocommerce, cost, cost of goods, profit, profit calculator Requires at least: 6.1 Tested up to: 6.5 -Stable tag: 3.3.6 +Stable tag: 3.3.7 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -344,6 +344,12 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S == Changelog == += 3.3.7 - 26/04/2024 = +* Dev - Multicurrency - Create option to display COG related values from the order, such as costs and profit, in the currency of the order. +* Dev - Multicurrency - Create option to force shop base currency on COG order fields. +* Dev - Multicurrency - Improve performance. +* Fix - Creation of dynamic property is deprecated. + = 3.3.6 - 24/04/2024 = * Fix - Creation of dynamic property Alg_WC_Cost_of_Goods_Pro::$wc_currency is deprecated. * Fix - PHP Notice: Function ID was called incorrectly.