• Resolved andy8891

    (@andy8891)


    Hello!

    Thank you for such an amazing work on this plugin!

    I have a question about mail tags for post image drop-down menu field.

    I have created a multi-step Contact Form 7 using a plugin.
    This way contact form is split into multiple pages with the email being sent on the last step that has mail tags from all previous steps.

    On this page: http://demo.lavinaweb.com/step-3/ (form starts on http://demo.lavinaweb.com/)

    I have this field that has its value set to ‘slug’ (I need it this way, cause it used in a script):
    [post_image_select* post_image_select-728 posts-number:-1 image-size:thumbnail id:changeImage publish include_blank post-type:project tax-relation:OR value-field:slug orderby:title order:DESC “%title%”]

    In the final email, I include [post_image_select-728] mail tag and it sends out just this slug. I need it to have the value set to slug, but I would also like to include post title in the final email.

    How can I also add post title value to the mail tag?

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hello,
    you could set “value-field:title” and rewrite the javascript like this 🙂

    // Untested Code!!!
    jQuery('#changeImage').change(function() {
    	var image_src = $(this).find(":selected").data('image');
    	jQuery('#image')[0].src = image_src.replace("-80x80", "");
    });

    Best regards
    Markus

    Thread Starter andy8891

    (@andy8891)

    I have tried it this way, but it didn’t work.

    This is the code that I have now:

    <!–– SCRIPT#2 Change of image on product selection on Step 3 ––>
    <script>
    
    var imagesArray = [
    	"http://demo.lavinaweb.com/wp-content/uploads/2018/07/Blank_Bottle.png", // represents val 0,
    	"http://demo.lavinaweb.com/wp-content/uploads/2018/07/1000x1000-Front-B12-min.jpg", // represents val 1,
    	"http://demo.lavinaweb.com/wp-content/uploads/2018/07/L-Arginine-Amazon-Image-DT-Labels-min.png", // represents val 2,
    	"http://demo.lavinaweb.com/wp-content/uploads/2018/07/Turmeric-Curcumin-Amazon-Image-DT-Labels.png" // represents val 3
    ];
    
    jQuery('#changeImage').change(function(){
      jQuery('#image')[0].src = imagesArray[this.value];
    });
    
    </script>

    It has an array of images ( var imagesArray) each having a value from 0 to 3
    and a function that changes the product image on Step 3 based
    on the selection of CF 7 drop-down menu.

    I couldn’t find other solution but to change drop-down value
    to ‘slug’ and then assign a number slugs to each project post.
    So that it compares number from array and slug value of CF7 dropdown menu.

    It works OK like that, but I would rather like to see a title of the project in final
    email and not slug number.

    Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hello,
    please replace my code above with yours.
    My code get the right selected full image path -> replace(“-80×80”, “”).
    So you don’t need the array and the slug.

    Best regards
    Markus

    Thread Starter andy8891

    (@andy8891)

    Thank you so much!!! It worked!
    At first, it gave me an error in Chrome inspection mode that it does not recognize ‘$’ sign.
    I replaced it with just ‘jQuery’ and it worked!

    Thank you!

    Plugin Author Markus Wiesenhofer

    (@markusfroehlich)

    Hey andi,
    very nice 🙂

    This code is better, it execute the function when the DOM is ready to be used.

    // Failsafe $ alias
    jQuery( function( $ ) {
    	$('#changeImage').change(function() {
    		var image_src = $(this).find(":selected").data('image');
    		$('#image')[0].src = image_src.replace("-80x80", "");
    	});
    });

    Best regards
    Markus

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

The topic ‘Add values to mail tag’ is closed to new replies.