Skip to content

Commit

Permalink
v3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Dec 10, 2024
1 parent 4b747fb commit 9983fd9
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cost-of-goods-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Cost of Goods: Product Cost & Profit Calculator 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.5.9
Version: 3.6.0
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: cost-of-goods-for-woocommerce
Expand Down
15 changes: 14 additions & 1 deletion includes/class-alg-wc-cog-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Core Class.
*
* @version 3.4.6
* @version 3.6.0
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -96,6 +96,15 @@ class Alg_WC_Cost_of_Goods_Core {
*/
public $analytics;

/**
* $extra_costs_labels.
*
* @since 3.6.0
*
* @var Alg_WC_Cost_of_Goods_Extra_Costs_Labels
*/
public $extra_costs_labels;

/**
* Constructor.
*
Expand All @@ -119,6 +128,10 @@ class Alg_WC_Cost_of_Goods_Core {
function __construct() {
require_once( 'class-alg-wc-cog-options.php' );
$this->options = new Alg_WC_Cost_of_Goods_Options();
// Extra costs labels.
require_once( 'class-alg-wc-cog-extra-costs-labels.php' );
$this->extra_costs_labels = new Alg_WC_Cost_of_Goods_Extra_Costs_Labels();
$this->extra_costs_labels->init();
// Background process.
$this->init_bkg_process();
// Analytics.
Expand Down
100 changes: 100 additions & 0 deletions includes/class-alg-wc-cog-extra-costs-labels.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/**
* Cost of Goods for WooCommerce - Extra costs labels.
*
* @version 3.6.0
* @since 3.6.0
* @author WPFactory
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly

if ( ! class_exists( 'Alg_WC_Cost_of_Goods_Extra_Costs_Labels' ) ) {

class Alg_WC_Cost_of_Goods_Extra_Costs_Labels {

/**
* Labels.
*
* @since 3.6.0
*
* @var array
*/
protected $labels = array();

/**
* Init.
*
* @version 3.6.0
* @since 3.6.0
*
* @return void
*/
function init() {
add_action( 'init', function () {
$this->set_labels( array(
'handling' => array(
'short' => __( 'handling', 'cost-of-goods-for-woocommerce' ),
'long' => __( 'handling fee', 'cost-of-goods-for-woocommerce' )
),
'shipping' => array(
'short' => __( 'shipping', 'cost-of-goods-for-woocommerce' ),
'long' => __( 'shipping fee', 'cost-of-goods-for-woocommerce' )
),
'payment' => array(
'short' => __( 'payment', 'cost-of-goods-for-woocommerce' ),
'long' => __( 'payment fee', 'cost-of-goods-for-woocommerce' )
),
) );
} );
}

/**
* Get label.
*
* @version 3.6.0
* @since 3.6.0
*
* @param $cost_type
* @param $label_type
*
* @return string
*/
function get_label( $cost_type, $label_type = 'short' ) {
$label = '';
if ( isset( $this->get_labels()[ $cost_type ] ) && isset( $this->get_labels()[ $cost_type ][ $label_type ] ) ) {
$label = $this->get_labels()[ $cost_type ][ $label_type ];
}

return $label;
}

/**
* get_labels.
*
* @version 3.6.0
* @since 3.6.0
*
* @return array
*/
public function get_labels(): array {
return $this->labels;
}

/**
* set_labels.
*
* @version 3.6.0
* @since 3.6.0
*
* @param array $labels
*/
public function set_labels( array $labels ): void {
$this->labels = $labels;
}


}
}
6 changes: 3 additions & 3 deletions includes/class-alg-wc-cog-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Cost of Goods for WooCommerce - Orders Class.
*
* @version 3.5.8
* @version 3.6.0
* @since 2.1.0
* @author WPFactory
*/
Expand Down Expand Up @@ -847,7 +847,7 @@ function get_shop_order_screen_id() {
/**
* add_order_columns.
*
* @version 2.3.4
* @version 3.6.0
* @since 1.0.0
* @todo [next] add more columns (i.e. not only cost, per order fees, profit, profit percent and profit margin)
*/
Expand All @@ -862,7 +862,7 @@ function add_order_columns( $columns ) {
if ( $this->is_columns_extra_cost_per_order && in_array( true, $this->is_order_extra_cost_per_order ) ) {
foreach ( $this->is_order_extra_cost_per_order as $fee_type => $is_enabled ) {
if ( $is_enabled ) {
$this->order_columns[ $fee_type ] = ucfirst( $fee_type );
$this->order_columns[ $fee_type ] = ucfirst( alg_wc_cog()->core->extra_costs_labels->get_label( $fee_type ) );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions includes/class-alg-wc-cog.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Alg_WC_Cost_of_Goods {
* @since 1.0.0
* @var string
*/
public $version = '3.5.9';
public $version = '3.6.0';

/**
* @since 1.0.0
Expand Down Expand Up @@ -97,7 +97,7 @@ function init() {
// Move WC Settings tab to WPFactory menu.
$this->move_wc_settings_tab_to_wpfactory_menu();

// Localization
// Localization.
add_action( 'init', array( $this, 'localize' ) );

// Adds compatibility with HPOS.
Expand Down
24 changes: 24 additions & 0 deletions langs/cost-of-goods-for-woocommerce-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -3189,3 +3189,27 @@ msgstr ""
#: includes/settings/class-alg-wc-cog-settings-products.php:121
msgid "Inventory > SKU"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:39
msgid "handling"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:40
msgid "handling fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:43
msgid "shipping"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:44
msgid "shipping fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:47
msgid "payment"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:48
msgid "payment fee"
msgstr ""
24 changes: 24 additions & 0 deletions langs/cost-of-goods-for-woocommerce-nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -3187,3 +3187,27 @@ msgstr ""
#: includes/pro/reports/class-wc-report-alg-cog.php:359
msgid "Average profit"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:39
msgid "handling"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:40
msgid "handling fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:43
msgid "shipping"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:44
msgid "shipping fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:47
msgid "payment"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:48
msgid "payment fee"
msgstr ""
24 changes: 24 additions & 0 deletions langs/cost-of-goods-for-woocommerce-tr_TR.po
Original file line number Diff line number Diff line change
Expand Up @@ -3225,3 +3225,27 @@ msgstr ""
#: includes/settings/class-alg-wc-cog-settings-products.php:121
msgid "Inventory > SKU"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:39
msgid "handling"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:40
msgid "handling fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:43
msgid "shipping"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:44
msgid "shipping fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:47
msgid "payment"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:48
msgid "payment fee"
msgstr ""
24 changes: 24 additions & 0 deletions langs/cost-of-goods-for-woocommerce-zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -3187,3 +3187,27 @@ msgstr ""
#: includes/settings/class-alg-wc-cog-settings-products.php:121
msgid "Inventory > SKU"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:39
msgid "handling"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:40
msgid "handling fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:43
msgid "shipping"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:44
msgid "shipping fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:47
msgid "payment"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:48
msgid "payment fee"
msgstr ""
28 changes: 26 additions & 2 deletions langs/cost-of-goods-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.9\n"
"Project-Id-Version: cost-of-goods-for-woocommerce 3.6.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/cost-of-goods-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-12-06T18:16:54+01:00\n"
"POT-Creation-Date: 2024-12-10T23:39:13+01: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"
Expand Down Expand Up @@ -163,6 +163,30 @@ msgstr ""
msgid "N/A"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:39
msgid "handling"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:40
msgid "handling fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:43
msgid "shipping"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:44
msgid "shipping fee"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:47
msgid "payment"
msgstr ""

#: includes/class-alg-wc-cog-extra-costs-labels.php:48
msgid "payment fee"
msgstr ""

#: includes/class-alg-wc-cog-orders-meta-boxes.php:116
#: includes/class-alg-wc-cog-orders-meta-boxes.php:219
#: includes/class-alg-wc-cog.php:165
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.7
Stable tag: 3.5.9
Stable tag: 3.6.0
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -344,8 +344,12 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S

== Changelog ==

= 3.6.0 - 10/12/2024 =
* Fix - Resolved an issue where some strings were not translatable.

= 3.5.9 - 06/12/2024 =
* Fix - Some translation domains fixed.
* Dev - Added Dutch translation.
* Dev - Key manager updated.

= 3.5.8 - 26/11/2024 =
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '20cb52491ffc736a580754689acb5e6e542333ec',
'reference' => '60fc865d1e2f1203aec0c89187751f3eaf01d475',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '20cb52491ffc736a580754689acb5e6e542333ec',
'reference' => '60fc865d1e2f1203aec0c89187751f3eaf01d475',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit 9983fd9

Please sign in to comment.