• Resolved tsjippy

    (@tsjippy)


    Thanks for this plugin, I realy like it!
    I have one feature request, can you add dynamic “raised” value?

    I want the raised value to be a shortcode.

    The “therm_shortcode.php” file needs to have this code added on line 92:

    if (!is_numeric(str_replace(",", ".", $atts['raised']))) {
    	$shortcode = "[".strval($atts['raised'])."]";
    	$atts['raised'] = do_shortcode( $shortcode);
    }

    so that it looks like this:

    	//raised value
    	if ($atts['raised'] == '' && !empty($options['raised_string'])){
    	    $thermProperties['raised'] = $options['raised_string'];
    	}
    	else{
    		if (!is_numeric(str_replace(",", ".", $atts['raised']))) {
    			$shortcode = "[".strval($atts['raised'])."]";
    			$atts['raised'] = do_shortcode( $shortcode);
    		}
    	    $thermProperties['raised'] = strval($atts['raised']);
    	}

    I use this to be able to use a shortcode like this: [thermometer raised="amount_raised" target=3750 height=20%] Where amount_raised is a shortcode.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author rhewlif

    (@henryp)

    Hi,
    Thanks for the suggestion – I’ve implemented this now into the latest plugin update.

    Cheers

    Sharonq

    (@sharonq)

    Thank you for this update – hopefully it will help me too – we are fundraising by selling calendars. We use woocommerce. Is there a way to assign “amount-raised” to the number of calendars sold? I don’t know a lot about programming so am not sure how to do that.

    http://superpupcalendar.ca/sample-lions-club

    Plugin Author rhewlif

    (@henryp)

    Hi Sharon,

    I have not used Woocommerce, but this page might help with what you want to do..https://docs.woocommerce.com/document/product-sales-count/

    If you can generate a shortcode that will output a value for the calendar sales then it can be integrated like this: [thermometer raised=’the_woocommerce_shortcode’ target=100]

    cheers

    Sharonq

    (@sharonq)

    Thank you henry for your help – I am close.

    I have a shortcode that works and will display the number of sales:

    Sales to date: [sales id=”1947″] 

    The short code has a parameter in it to identify the product

    How do I integrate that with your plugin?

    I tried:

    [thermometer raised=[sales id=”1947″] target=100]

    and got Warning: A non-numeric value encountered in /homepages/42/d617792905/htdocs/clickandbuilds/SuperPupCalendarLionsClubFundraiser/wp-content/plugins/donation-thermometer/includes/therm_svg.php on line 215
    target=100 height=250]

    Thank you for your help – almost there!

    Plugin Author rhewlif

    (@henryp)

    Try like this (the apostrophes are important):

    [thermometer raised='sales id="1947"' target=100]

    That was it! Thank you. I do get lost in the punctuation and this was my first short code in a short code.

    The free plugin I used to get the sales number from woocommerce is called Woo Shortcodes Kit and with its next update (early June) will have this feature that will be very useful to anyone using your plugin with woocommerce.

    Because of Covid we have to do our fundraising online – thank you for your help.

    Hi,

    We’re working on a fundraising campaign at my job and want to use multiple thermometers to track donations from each region (NYC, Chicago, Pittsburgh, etc). We’re currently using paypal to collect donations. Is there a way the thermometers can automatically track and update each donation by region?

    Thanks,
    Joe

    Plugin Author rhewlif

    (@henryp)

    The plugin doesn’t track donations directly, but if you can generate the raised value from a shortcode elsewhere then you can use this to automatically update each thermometer.

    mrnmnew

    (@mrnmnew)

    Great plug in but I am getting some issues with large values transferring from GiveWP

    ON the page https://www.johnraesociety.com/new-home-page/ the target is 3000 and the amount raised is 2,760.00 but the thermomenter displays this as £2 smaller numbers work fine, could it be the plugin is interpreting the thousands comma as a dec point ?

    Here is my code:

    <div style="margin-top:0px; float: none !important; clear:both;">
    <h2>Donations</h2>
    [thermometer raised='give_totals ids="6839"' target=3000 align=none]
    
    </div>
    <div class="wp-block-button"><a class="wp-block-button__link" href="https://www.johnraesociety.com/new-donations/" rel="">Donate</a>
    <!-- /wp:button --></div>[give_totals ids=6839]
    Plugin Author rhewlif

    (@henryp)

    Hi,

    Thanks. Yes it’s unfortunately not recognising the number formatting given by the shortcode. It can be fixed quickly by updating a line of code though. In the therm_shortcode.php file on line 109 change:
    $thermProperties['raised'] = strval($atts['raised']);

    to
    $thermProperties['raised'] = str_replace(",","",strval($atts['raised']));

    This can be done easily from the Plugin Editor in the wordpress side menu. But I shall fix this more formally in the next plugin update too.

    cheers,
    Henry

    mrnmnew

    (@mrnmnew)

    Brilliant, thanks for the quick reply. I have made the change and it works a treat now.

    Thanks again.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Dynamic raised value’ is closed to new replies.