Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Trying to add custom link to welcome email

    Hey all - I want to add in a custom link to my welcome email message. However, when I do, the message comes through just fine, but the link doesn't show.

    Meaning, I enter it in the file like so:

    Click <a href="http://site.com/filename">this link</a>.

    and the email comes through as

    Click this link.

    "this link" is regular text, not linked text.

    I've edited includes/languages/english/create_account/php. I tried adding a definition with the URL in that and applying it to the line in question, but it still strips the link. This is what I have so far:

    Code:
    define('EMAIL_FREE_DOWNLOAD', '<a href="http://www.site.com/download/download.zip">link</a>');
    
    // First line of the greeting
    define('EMAIL_WELCOME', 'We wish to welcome you to <strong>' . STORE_NAME . '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit our site ' . EMAIL_FREE_DOWNLOAD . ' to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.');
    Would anyone know what I need to do to have the link actually show up as a link, instead of as plain text?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Trying to add custom link to welcome email

    If you go to Admin->Tools->Welcome Email does the link appear as clickable ?
    If so, then Zen Cart is building the clickable link as intended but your email client is removing the hotlink.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Trying to add custom link to welcome email

    If you go to Admin->Tools->Welcome Email does the link appear as clickable ?
    Nope - it's not.

    What's funny is, there are three other links in the email that *are* clickable. They don't appear to be so in the preview (they show up as plain text in the preview) so I had assumed that it just didn't show that in the preview. But I've registered myself twice, and the links that are laready there *are* still clickable (when I get the actualy email) but the one I've created is not.

  4. #4
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Trying to add custom link to welcome email

    Aha!

    I had to remove the "http://" from the link. Now it works just fine n' dandy.

    Wonder why that is?

    Oh well - it works now!

  5. #5
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Trying to add custom link to welcome email

    Scratch that. Apparently it's not working anymore. It makes no sense. I tested it out several times that day, and it worked just fine. Now the client comes back with "it's not working" - so I test it again, and by God, it's not.

    Makes absolutely no sense. Why would it work, and then just suddenly stop working?

    Why can't I add a single link to the email welcome message?

  6. #6
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Trying to add custom link to welcome email

    Replace:

    PHP Code:
    define('EMAIL_FREE_DOWNLOAD''<a href="http://www.site.com/download/download.zip">link</a>'); 
    with:

    PHP Code:
    define('EMAIL_FREE_DOWNLOAD''<a href=\'http://www.site.com/download/download.zip\'>link</a>'); 
    This should resolve this problem.

  7. #7
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Trying to add custom link to welcome email

    Thanks Oracle. But no go.

    I've tried I don't know *how* many variations on this, and it's just not taking. At one point, I even tried:

    Code:
    define('EMAIL_FREE_DOWNLOAD', 'http://www.site.com/download/download.zip'); 
    
    // First line of the greeting
    define('EMAIL_WELCOME', 'We wish to welcome you to <strong>' . STORE_NAME . '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit <a href="' . zen_href_link(EMAIL_FREE_DOWNLOAD) . ' ">this link</a> to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.');
    ...just to see if the "zen_href_link" thing was required to set a URL. I just don't understand why there are two other links in this file that work fine:

    Code:
    define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS ." </a>\n\n");
    
    define('EMAIL_GV_CLOSURE','Sincerely,' . "\n\n" . STORE_OWNER . "\nStore Owner\n\n". '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'.HTTP_SERVER . DIR_WS_CATALOG ."</a>\n\n");
    both produce 1) a link to the site owner's email address and 2) a link to the site itself. My emails are set to text-only - but still those links come through just fine.

    Do I need to set the link in some other file first? Possibly somewhere in another folder? Custom defines, maybe? I just don't understand why I can't just simply place a hard-coded link in this one file. It's really weird.

  8. #8
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Trying to add custom link to welcome email

    This should work:

    PHP Code:
    define('EMAIL_FREE_DOWNLOAD''http://www.site.com/download/download.zip'); 

    // First line of the greeting
    define('EMAIL_WELCOME''We wish to welcome you to <strong>' STORE_NAME '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit <a href=\"' zen_href_link(EMAIL_FREE_DOWNLOAD'''NONSSL') . ' \">this link</a> to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.'); 
    This one is a first time modified, tell me if it does work.

    PHP Code:
    define('EMAIL_CONTACT''For help with any of our online services, please email the store-owner: <a href=\"mailto:' STORE_OWNER_EMAIL_ADDRESS '\">'STORE_OWNER_EMAIL_ADDRESS .' </a>\n\n');

    define('EMAIL_GV_CLOSURE','Sincerely,"\n\n"' STORE_OWNER '"\nStore Owner\n\n<a href=\"' HTTP_SERVER DIR_WS_CATALOG '\">'.HTTP_SERVER DIR_WS_CATALOG.'</a>\n\n'); 

  9. #9
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Trying to add custom link to welcome email

    Well, much to my surprise...it didn't work. ;)

    I've given up and found an alternate method to solve the problem. What we were trying to do was put in a link for a free download - but it just wouldn't take the link. So what I did was put a link in the tpl_account_default page. So everyone is happy.

    Now, it was brought to my attention (somewhere else) that the possible reason for the link being stripped in the email was because... well, I'll quote what they said so you can see it - maybe you can make more sense of it than I can. I get what she's saying, but she says it better than I ever could!

    I quote:

    Every email is sanitized, I was just checking out the code and in:

    includes\functions\functions_email.php line line 224, you will see:

    $email_subject = zen_db_prepare_input($email_subject);

    That zen_db_prepare_input is what prevents sql injections and all that stuff... maybe there's a way to check if it's the welcome email and not sanitize it... there is a $module field passed, so it might be possible...
    So it sounds like it's made to be stripped on purpose. If this is true, then I would suggest perhaps a better way to handle things like this in a future release? I understand the need for changing the email welcome is supplied, but I think if people want to add extra links or something to it, they shouldn't have an issue like this.

    When I get less busy, I plan to follow on this lead and see if what she says holds true - perhaps it *is* stripped because ZenCart is *set* to strip it. I'd like to play and see what I find out.

 

 

Similar Threads

  1. Replies: 2
    Last Post: 21 Feb 2010, 04:33 AM
  2. Welcome email link
    By dannsboutique in forum General Questions
    Replies: 3
    Last Post: 2 Apr 2009, 07:16 AM
  3. Email welcome and custom template
    By manton in forum General Questions
    Replies: 2
    Last Post: 11 Oct 2008, 12:44 PM
  4. custom Add Customer email (need custom welcome email)
    By rennsix in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 8 Dec 2007, 08:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg