support currency switcher for perk boxes

parent 6ceb6446
......@@ -3105,7 +3105,6 @@ class CrowdFunding {
foreach ($perkrule as $key => $perk) {
$perkname = str_replace('', '_', $perk['name']);
$currentcount = (int) get_post_meta($item['product_id'], $perkname . $perk['amount'] . 'update_perk_claim', true);
if ($perk['limitperk'] == 'cf_limited') {
......@@ -4222,4 +4221,15 @@ if (get_option('cf_campaign_restrict_other_products') == '1') {
add_action('woocommerce_add_to_cart_validation', 'cf_restrict_add_to_cart_products', 10, 5);
}
add_action('woocommerce_single_product_summary', array('CrowdFunding', 'checkingfrontend_galaxy'));
// Experimental currency switcher support
function woocs_convert($amount) {
if (class_exists("WC_Aelia_CurrencySwitcher")) {
$woocs_instance = WC_Aelia_CurrencySwitcher::instance();
$woocs_settings = WC_Aelia_CurrencySwitcher::settings();
$amount = $woocs_instance->convert($amount, $woocs_settings->base_currency(), $woocs_instance->get_selected_currency());
}
return $amount;
}
?>
......@@ -660,6 +660,7 @@ class CFPerkMetaBox {
<?php } ?>
<?php
foreach ($perkrule as $i => $perk) {
$perk['amount'] = woocs_convert($perk['amount']);
$perkname = str_replace('', '_', $perk['name']);
//echo $newcounterclaim = (int) get_post_meta($post->ID, $perkname . '[update_perk_claim]', true);
$newcounterclaim = (int) get_post_meta($post->ID, $perkname . $perk['amount'] . 'update_perk_claim', true);
......@@ -1344,6 +1345,7 @@ class CFPerkMetaBox {
<?php } ?>
<?php
foreach ($perkrule as $i => $perk) {
$perk['amount'] = woocs_convert($perk['amount']);
$perkname = str_replace('', '_', $perk['name']);
//echo $newcounterclaim = (int) get_post_meta($post->ID, $perkname . '[update_perk_claim]', true);
$newcounterclaim = (int) get_post_meta($post->ID, $perkname . $perk['amount'] . 'update_perk_claim', true);
......@@ -1689,7 +1691,6 @@ class CFPerkMetaBox {
$perkrule = get_post_meta($post->ID, 'perk', true);
$i = 0;
foreach ($perkrule as $perk) {
foreach ($listofamount as $amount) {
if ($perk['amount'] == (int) $amount) {
$length = count(array_keys($listofamount, (int) $amount));
......
......@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce, $post;
$heading = esc_html( apply_filters( 'woocommerce_product_description_heading', __( 'Product Description', 'woocommerce' ) ) );
$heading = esc_html( apply_filters( 'woocommerce_product_description_heading', __( 'About this project', 'woocommerce' ) ) );
?>
<h2><?php echo $heading; ?></h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment