WOOCS - WooCommerce-Währungsumschalter

WP Crowdfunding

Die Plugin-URL: https://wordpress.org/plugins/wp-crowdfunding/

  • im Ordner \wp-content\plugins\wp-Crowdfunding\wpneotemplate\woocommerce\basic\include\fund-raised.php Code ändern:
    <?php
    
    $amount = wpneo_crowdfunding_get_total_goal_by_campaign(get_the_ID());
    $order_total = wpneo_crowdfunding_get_total_fund_raised_by_campaign();
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $amount = $WOOCS->woocs_exchange_value(floatval($amount));
        $order_total = $WOOCS->woocs_exchange_value(floatval($order_total));
    }
    ?>

  • im Ordner \wp-content\plugins\wp-Crowdfunding\includes\wpneo-Crowdfunding-template-functions.php Code hinzufügen:
    if (class_exists('WOOCS')) {
        $query1 = "SELECT * FROM {
            $wpdb->prefix
        }woocommerce_order_itemmeta woim
        LEFT JOIN {
            $wpdb->prefix
        }woocommerce_order_items oi ON woim.order_item_id = oi.order_item_id
        LEFT JOIN {
            $wpdb->prefix
        }posts wpposts ON order_id = wpposts.ID
        LEFT JOIN {
            $wpdb->prefix
        }woocommerce_order_itemmeta ltoim ON ltoim.order_item_id = oi.order_item_id AND ltoim.meta_key = '_line_total'
        WHERE
        woim.meta_key = '_product_id' AND woim.meta_value IN ($placeholders) AND wpposts.post_status = 'wc-completed';";
        $orders = $wpdb->get_results($wpdb->prepare($query1, $campaign_ids));
        $sum_price = 0;
        global $WOOCS;
        $currencies = $WOOCS->get_currencies();
        foreach ($orders as $order) {
            $amout = $order->meta_value;
            $order_id = $order->order_id;
            $_order_currency = get_post_meta($order_id, '_order_currency ', true);
            $order_rate = get_post_meta($order_id, '_woocs_order_rate ', true);
            if (!$order_rate) {
                if (isset($currencies[$_order_currency])) {
                    $order_rate = $currencies[$_order_currency]['rate'];
                } else {
                    continue;
                }
            }if ($_order_currency != $WOOCS->default_currency) {
                $sum_price += $WOOCS->back_convert(floatval($amout), $order_rate, 4);
            } else {
                $sum_price += floatval($amout);
            }
        }
    
        return $sum_price;
    }
    
    

  • im Ordner \wp-content\plugins\wp-Crowdfunding\includes\woocommerce\class-wpneo-frontend-hook.php Code hinzufügen:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $raised = $WOOCS->woocs_exchange_value(floatval($raised));
        $funding_goal = $WOOCS->woocs_exchange_value(floatval($funding_goal));
    }

  • AND   add  code:
    if (class_exists('WOOCS')) {
        $query1 = "SELECT * FROM
    {$wpdb->prefix}woocommerce_order_itemmeta woim
    LEFT JOIN
    {$wpdb->prefix}woocommerce_order_items oi ON woim.order_item_id = oi.order_item_id
    LEFT JOIN
    {$wpdb->prefix}posts wpposts ON order_id = wpposts.ID
    LEFT JOIN
    {$wpdb->prefix}woocommerce_order_itemmeta ltoim ON ltoim.order_item_id = oi.order_item_id AND ltoim.meta_key = '_line_total'
    WHERE
    woim.meta_key = '_product_id' AND woim.meta_value IN ($placeholders) AND wpposts.post_status = 'wc-completed';";
        $orders = $wpdb->get_results($wpdb->prepare($query1, $campaign_ids));
        $sum_price = 0;
        global $WOOCS;
        $currencies = $WOOCS->get_currencies();
        foreach ($orders as $order) {
            $amout = $order->meta_value;
            $order_id = $order->order_id;
            $_order_currency = get_post_meta($order_id, '_order_currency', true);
            $order_rate = get_post_meta($order_id, '_woocs_order_rate', true);
            if (!$order_rate) {
                if (isset($currencies[$_order_currency])) {
                    $order_rate = $currencies[$_order_currency]['rate'];
                } else {
                    continue;
                }
            }if ($_order_currency != $WOOCS->default_currency) {
                $sum_price += $WOOCS->back_convert(floatval($amout), $order_rate, 4);
            } else {
                $sum_price += floatval($amout);
            }
        }
    
        return $sum_price;
    }
    

  • im Ordner wp-content\plugins\wp-Crowdfunding\wpneotemplate\woocommerce\basic\include\fund-campaign-btn.php Code hinzufügen
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $recomanded_price = $WOOCS->woocs_exchange_value(floatval($recomanded_price));
        $min_price = $WOOCS->woocs_exchange_value(floatval($min_price));
        $max_price = $WOOCS->woocs_exchange_value(floatval($max_price));
    }

  • im Ordner \wp-content\plugins\wp-Crowdfunding\includes\woocommerce\class-wpneo-Crowdfunding. Php Code hinzufügen:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->current_currency != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            $donate_amount = $donate_amount / $currencies[$WOOCS->current_currency]['rate'];
        }
    }