support currency switcher for perk boxes

parent 6ceb6446
......@@ -1873,7 +1873,7 @@ class CrowdFunding {
jQuery(".price-wrapper .button").attr("data-productid", "<?php echo $newid; ?>");
<?php
if (function_exists('get_product')) {
$products = get_product($post->ID);
$products = get_product($post->ID);
if (!$products->is_type('variable')) {
?>
<?php
......@@ -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));
......@@ -1786,4 +1787,4 @@ add_shortcode('displayperk', array('CFPerkMetaBox', 'cf_perk_rule_front_end_shor
add_action('wp_ajax_nopriv_selectperkoption', array('CFPerkMetaBox', 'galaxy_funder_update_perk_rule'));
add_action('wp_ajax_selectperkoption', array('CFPerkMetaBox', 'galaxy_funder_update_perk_rule'));
?>
\ No newline at end of file
?>
......@@ -19,4 +19,4 @@ global $post, $product;
<meta itemprop="priceCurrency" content="<?php echo get_woocommerce_currency(); ?>" />
<link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
</div>
\ No newline at end of file
</div>
......@@ -11,9 +11,9 @@ 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>
<?php the_content(); ?>
\ No newline at end of file
<?php the_content(); ?>
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