%%item_name%% not populated

Forums General %%item_name%% not populated

Tagged: ,

Viewing 28 posts - 1 through 28 (of 28 total)
  • Author
    Posts
  • #411
    Carole Asselin
    Participant

    I am a bit confused here. I have a “Buy now” pro-form, where visitors can buy an ebook and templates they can download from the same page as where the pro-form is (it is hidden based on a conditional).

    The ccaps is “12cards” and the paypal pro-form code i use is this:

    [s2Member-Pro-PayPal-Form level="1" ccaps="12cards" desc="12 Cards for Christmas" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="scrapbookcampus.com" ra="9.99" rp="1" rt="L" rr="BN" accept="paypal" coupon="" accept_coupons="1" default_country_code="" captcha="0" success="http://scrapbookcampus.com/promo/12-cards-of-christmas/]

    As you can see, i have the %%item_name%% inside the desc=” “. However, a member sent me a copy of the confirmation email she got and it says this:

    Thank you
    You have successfully purchased the
    If you have not already done so, the next step is to Register a Username for the Campus.
    Please complete your registration here:http://scrapbookcampus.com/wp-login.php
    If you have any trouble, please feel free to contact us.
    Once your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/

    Yet, in s2M, i set the email to be:

    Thanks %%first_name%%!
    You have successfully purchased the %%item_name%%.
    If you haven’t already done so, the next step is to Register a Username for the Campus.
    Complete your registration here:
    %%registration_url%%
    If you have any trouble, please feel free to contact us.
    Once your registation is completed, you can login and access all your courses and products here:
    http://scrapbookcampus.com/ %%item_name%%/
    Enjoy your stay in the Campus,

    So as you can see, all the %% %% are not appearing on the person’s email (for now, i had to change the last link to something else as it was not the actual url of what they purchased).

    What am i doing wrong?

    Carole

    #413

    That’s odd. I see that the email starts with “Thank you” but the template says “Thanks”. It may be you’re looking at a different template.

    Could you expand the confirmation email panels and take a screenshot to show me? WP Admin -> s2Member -> PayPal Options -> * Confirmation Email

    Looking forward to your update. 🙂

    #414
    Carole Asselin
    Participant

    Here are all the ss i can get:

    http://scrapbookcampus.com/Images/Post-page-pro-form.jpg
    http://scrapbookcampus.com/Images/Post-Page-standard.jpg
    http://scrapbookcampus.com/Images/capability-confirmation.jpg
    http://scrapbookcampus.com/Images/modification-confirmation.jpg
    http://scrapbookcampus.com/Images/sign-up-pro-form.jpg
    http://scrapbookcampus.com/Images/sign-up-standard.jpg

    (sorry, the don’t want to display and i don’t want to waste too much time figuring out why)

    I am a little confused too. The member was already a member so it was not a new signup. Now, i can`t remember if i use “1” or “*” as a level since i struggled to figure out things afterward. I might have changed, or thought of changing it.

    #416

    Hmm… I don’t see any of those email templates match what you posted before. :/

    I know you said it’s an existing user, but maybe she wasn’t logged in when doing the purchase and got the New User email? It doesn’t look like the New User email, though, but I’m just trying to guess what could be going on here.

    Were you able to reproduce that behavior making a test purchase following the steps the customer reported having done?

    If you want me to take a closer look, you can email me to cristian at s2member.net, and let me know here that you did.

    #417
    Carole Asselin
    Participant

    I just did. I used a test account. I logged in, purchased the product, and here is what i got in the confirmation email:

    Thank you

    You have successfully purchased the

    If you have not already done so, the next step is to Register a Username for the Campus.

    Please complete your registration here:http://scrapbookcampus.com/wp-login.php

    If you have any trouble, please feel free to contact us.

    Once your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/

    ****************************
    Maybe it has to do with the 100% coupon code that is used since i am going through these steps:
    1- i log in
    2- i enter the coupon code and the form is all filled
    3- i click on the paypal button
    4- i get a notice, on top of the form, that “your account has been updated” (the level is set to “1” and not “*”)
    5- now, it was not obvious, but i had to click the SUBMIT button that appeared at the BOTTOM of the form
    6- after submitting the form, i got back to the same page, which is what i wanted, so the user can download all the goodies

    But then, why do i get this email? with no item mentioned? And why does it use the signup confirmation email (which is giving the wrong message altogether since the user would not need to register a username)?

    #419

    Yes, that’s weird…

    I remember there are some transaction emails that don’t have an interface to customize them. And now I remember that we helped you long ago to customize them with a hack… http://www.primothemes.com/forums/viewtopic.php?f=4&t=10368

    Could it be one of those? If so, could you show me your hack for them? Thanks!

    #421
    Carole Asselin
    Participant

    No, it is not the same thing at all. Previously, it was about getting them the bonus that was associated with a particular product, but not this time.

    I wonder if it has something to do with the use of a 100% off coupon since it does not have to go through a payment gateway?

    It seems to just go the wrong route for a “purchase”.

    #422
    Carole Asselin
    Participant

    I am reading further in that thread you linked to (didn’t realize it was 3 pages long). I still have the hack that i had used in the past (at least it is still in the file)

    
    add_filter ('ws_plugin__s2member_modification_email_sbj', 'my_s2_modification_sbj', 10, 2);
    function my_s2_modification_sbj ($s2member_default_sbj, $vars = array ())
        {        
            return 'Thank you for purchasing '. $vars["item_name"];
        }
    add_filter ('ws_plugin__s2member_modification_email_msg', 'my_s2_modification_msg', 10, 2);
    function my_s2_modification_msg ($s2member_default_msg, $vars = array ())
        {        
            return "Thank you ". $vars["first_name"] . "\n\nYou have successfully purchased the " . $vars["item_name"] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here:" . wp_login_url () . "\n\n
            If you have any trouble, please feel free to contact us.\n\nOnce your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/".$vars["cv"][1];    
        }
    

    But i have no idea if it is supposed to send the correct message or not.

    #423

    I see. Yeah, that seems to be the email being sent. It matches the one your customer received.

    It seems the hack needs to be updated after all these years, if it’s not working right…

    You could try seeing what the whole $vars array looks like. Try adding var_export($vars, true) at the end and do a test purchase.

    This would be the return line with that added:

    return “Thank you “ . $vars[“first_name”] . “
    
    You have successfully purchased the ” . $vars[“item_name”] . “
    
    If you have not already done so, the next step is to Register a Username for the Campus.
    
    Please complete your registration here: ” . wp_login_url() . “
    
    If you have any trouble, please feel free to contact us.
    
    Once your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/“ . $vars[“cv”][1] . “
    
    " . var_export($vars, true);
    #425
    Carole Asselin
    Participant

    I am not really good with php coding, and i see some punctuation being different. I see some quotation marks in your code and i am not sure if it should be there. Is it?

    #426
    Carole Asselin
    Participant

    OK i did it. I now have a looooooooong list of variables.
    I found this:
    ‘item_name’ => ‘Discount: 100% off. (Now: $0.00) ~ ORIGINALLY: 12 Cards for Christmas’,

    So, why isn’t it displaying in the email??

    #427

    I don’t know yet, but we’re making progress. 🙂

    I now have a looooooooong list of variables.

    Could you show me that test email? If it has info that should not be public, you can censor it, or email it to me.

    #428
    Carole Asselin
    Participant

    I’ll send it by email to you.

    As i was testing a few things, i tried to see if the variable was actually retrieved. I am not 100% sure i did it right, but i tried this:

        {
            $a = $vars["first_name"];
            $b = $vars["item_name"];
            return "Thank you ". $a . $vars["first_name"] . "\n\nYou have successfully complete your purchase" . $b . $vars["item_name"] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\nPlease complete your registration here:" . wp_login_url () . "\n\nIf you have any trouble, please feel free to contact us.";   
        }
    

    I tried more test purchases after, but notice that the $a and the $b variables NEVER appeared in the thank you email.
    In the mean time, in order to avoid sending odd looking emails to customers, i reworded the text so that the missing first_name and item_name won’t be noticeable.

    Would that help?

    #429

    Thanks! Got the email.

    I see. Yeah, some things are different in that array than was expected in your hack. I don’t know that if every transaction the hack was meant for, or only this one has the variables missing or in another place of the array.

    Here’s is the hack a bit edited to use the available data:

    
    add_filter('ws_plugin__s2member_modification_email_msg', 'my_s2_modification_msg', 10, 2);
    function my_s2_modification_msg($s2member_default_msg, $vars = array()) {
    	return "Thank you " . $vars['user']['user_nicename'] . "\n\nYou have successfully purchased the " . $vars['paypal']['item_name'] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here:" . wp_login_url() . "\n\nIf you have any trouble, please feel free to contact us.\n\nOnce your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/" . $vars['paypal']['ccaps'];
    }
    

    Keep in mind that WP may changes the quotes (double and single) to curly ones, even when they are in a code block, so you may need to fix them for the code to work correctly.

    First name wasn’t available in the array you sent me, so I changed it to the user’s nicename, but you’ll also need to test if it works for a new signup and not just an existing user.

    The item name is the only one I think will be the same as you were expecting in the original hack.

    The custom value 1 I couldn’t find in the array, and I wasn’t sure what you meant to have there for the bonuses link. I changed it to the ccap, in this case 12cards, although that URL doesn’t exist in your site. You’ll need to change that one to what it should be.

    Let me know how the tests go. 🙂

    #430
    Carole Asselin
    Participant

    I used the code there (and i am not sure what quote has to change if at all), and now, i am not getting any email for confirmation at all.

    The first name in the array was “correct” as it was the test account name. For the cv1, that was referring to the initial request you pointed to, 4 years ago, where i WAS giving out bonuses. So, i’ll have to find a way to possibly use a conditional and send to a bonus IF they are getting a course that includes a bonus and skip that part otherwise, but that is for another time.

    #432

    not sure what quote has to change if at all

    I added a hack to the site so they won’t be changed into curly quotes anymore when it’s inside a code block.

    The first name in the array was “correct” as it was the test account name

    I didn’t add the first name from the PayPal array to the hack, because it may not be correct all the time. Sometimes the billing info doesn’t match the actual user of the site. E.g. my wife signs up but pays with my card. That’s why I picked the user account’s “nice name” from the array.

    use a conditional and send to a bonus IF they are getting a course that includes a bonus

    Yeah, you can definitely improve the hack with conditionals.

    not getting any email for confirmation at all.

    Could you show me the full hack file with the code? You can email me the file if you prefer it.

    #437
    Carole Asselin
    Participant

    Sent by email, so i could send everything (including other hacks that have nothing to do with this one).

    #442

    Thanks, got the email.

    I don’t see yet what could be causing the updated hack to not send anything when the old one does, even if missing the vars.

    I noticed that I may have missed an array for the user’s name, so I fixed it:

    
    add_filter('ws_plugin__s2member_modification_email_msg', 'my_s2_modification_msg', 10, 2);
    function my_s2_modification_msg($s2member_default_msg, $vars = array()) {
    	return "Thank you " . $vars['user']['data']['user_nicename'] . "\n\nYou have successfully purchased the " . $vars['paypal']['item_name'] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here: " . wp_login_url() . "\n\nIf you have any trouble, please feel free to contact us.\n\nOnce your registation is completed, you can login and access your bonuses here: http://scrapbookcampus.com/" . $vars['paypal']['ccaps'];
    }
    

    But I still doubt that that was causing the email to not be sent… Do you have an email log to see if it’s actually not being sent? https://wordpress.org/plugins/email-log/

    By the way, I was reviewing again the vars array you got earlier and sent me, but it seems to be incomplete, probably missing data at the end. Could you forward me the email you got instead of copy-pasting the array only? Thanks!

    I look forward to your update. 🙂

    #444
    Carole Asselin
    Participant

    Sent you the whole confirmation email i got with the variables.

    OK, i used your code and made a purchase (the same as usual) and i still didn’t get a confirmation email.

    I do not have an email log, but i tried another time with the previous file, and i get a confirmation email immediately.

    So i am just as stumped as you are.

    #445

    Got the email with the full array. Thanks, I could read it better this time.

    i am just as stumped as you are.

    Yes, very odd…

    If you want me to do some tests, instead of telling you things that come to mind between replies, you can email me access to the FTP and WP admin and I’ll try to debug it for you, as we did in the past with other problems.

    #446
    Carole Asselin
    Participant

    Email sent yesterday, with access to a temporary admin account and ftp.

    #448

    Thanks, got the email.

    Could you create a page with a pro-form like the one you sell the upgrade with, but set to 1 cent, and send me a link to it in a reply to the email with the credentials? I’d like to do a few test purchases while working on the code, but don’t know exactly which of your pro-forms you’ve been testing with.

    Nevermind, found the pro-form shortcode in your opening post. I knew I had seen it, but I somehow missed it earlier… Sorry about that. I’ll do some troubleshooting tomorrow trying to figure out what the problem with the code is. 🙂

    #454

    Thanks for waiting. I think I sorted it out.

    add_filter('ws_plugin__s2member_modification_email_msg', 'my_s2_modification_msg', 10, 2);
    function my_s2_modification_msg($s2member_default_msg, $vars = array()) {
    	return "Thank you " . $vars['user']->data->display_name . "\n\nYou have successfully purchased the " . $vars['paypal']['item_name'] . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here: " . wp_login_url() . "\n\nIf you have any trouble, please feel free to contact us.";
    }
    

    I did a few test purchases and the last ones sent me the email correctly:

    Thank you Cristian Test1

    You have successfully purchased the Discount: 100% off. (Now: $0.00) ~ ORIGINALLY: 12 Cards for Christmas

    If you have not already done so, the next step is to Register a Username for the Campus.

    Please complete your registration here: http://scrapbookcampus.com/wp-login.php

    If you have any trouble, please feel free to contact us.

    Could you test it too and tell me if you notice anything wrong with it now?

    #457
    Carole Asselin
    Participant

    Great! It does seem to work fine now.
    What caused that issue in the first place?

    And now, is there a way to only include the actual item name and NOT the “Discount info” as part of the name? It looks pretty odd to say “you purchased the Discount…”

    #458

    What caused that issue in the first place?

    In the first place, why you started the thread, the reason was that the variables were not the same as before, so there was no value to show. In the second place, why my updated hack was not sending the email, was a syntax problem with how I was getting to the person’s name in the user data, because part of them were objects instead of arrays.

    a way to only include the actual item name and NOT the “Discount info”

    Yes, it does look odd. I don’t see the original name anywhere in the variables available to the hack. You’d need to add it to the hack, I guess, or pass it somehow to the hack from the pro-form, e.g. the custom values. WP Admin -> s2Member -> PayPal Forms -> Shortcode Attributes -> custom -> cv

    #460

    Another thing you could try is removing the part up to originally and showing only the following part.

    #461
    Carole Asselin
    Participant

    Another thing you could try is removing the part up to originally and showing only the following part.

    I am not understanding what you mean

    I don’t see the original name anywhere in the variables available to the hack.

    I am a bit surprised that if i use a button, the item name would be what appears in the description, while in a pro-form, it will also include the price and discount instead of JUST the description/name.

    #462

    Maybe because in a button there’s no coupon to discount it, so the description doesn’t get modified. If you try the pro-form without the coupon, you will likely get the original description.

    not understanding what you mean

    I mean modifying the hack so it removes the discount part and leaves the original description of the product. Something like this (untested):

    add_filter('ws_plugin__s2member_modification_email_msg', 'my_s2_modification_msg', 10, 2);
    function my_s2_modification_msg($s2member_default_msg, $vars = array()) {
    	$item_name = $vars['paypal']['item_name'];
    	if (strpos($item_name, 'ORIGINALLY:') !== false) {
    		$item_name = explode('ORIGINALLY:', $item_name);
    		$item_name = trim($item_name[1]);
    	}
    	return "Thank you " . $vars['user']->data->display_name . "\n\nYou have successfully purchased the " . $item_name . "\n\nIf you have not already done so, the next step is to Register a Username for the Campus.\n\n Please complete your registration here: " . wp_login_url() . "\n\nIf you have any trouble, please feel free to contact us.";
    }
    
Viewing 28 posts - 1 through 28 (of 28 total)
  • You must be logged in to reply to this topic.