Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default [Done v1.6.0] Incorrect base_href in admin-sent HTML emails in some configurations

    Zen Cart v1.5.1. My admin is set up to use SSL everywhere, so HTTP_SERVER and HTTPS_SERVER are identical in the admin's /includes/configure.php file. In addition, I'm using the shared SSL provided by my host for this shop.

    When I send an order update from admin (Customers->Orders) to a customer who's signed up for HTML emails, the link to the header image is broken. That's because the zen_build_html_email_from_template function is currently setting the BASE_HREF for the email to HTTP_SERVER ... which points to my host's shared SSL server. The change required to correct is shown below.

    Here's the code fragment from /includes/functions/functions_email.php (starting at line 454), the change is highlighted in red:
    Code:
        if (!defined('HTTP_CATALOG_SERVER')) define('HTTP_CATALOG_SERVER', HTTP_SERVER);
        //check for some specifics that need to be included with all messages
        if (!isset($block['EMAIL_STORE_NAME']) || $block['EMAIL_STORE_NAME'] == '')     $block['EMAIL_STORE_NAME']  = STORE_NAME;
        if (!isset($block['EMAIL_STORE_URL']) || $block['EMAIL_STORE_URL'] == '')       $block['EMAIL_STORE_URL']   = '<a href="'.HTTP_CATALOG_SERVER . DIR_WS_CATALOG.'">'.STORE_NAME.'</a>';
        if (!isset($block['EMAIL_STORE_OWNER']) || $block['EMAIL_STORE_OWNER'] == '')   $block['EMAIL_STORE_OWNER'] = STORE_OWNER;
        if (!isset($block['EMAIL_FOOTER_COPYRIGHT']) || $block['EMAIL_FOOTER_COPYRIGHT'] == '') $block['EMAIL_FOOTER_COPYRIGHT'] = EMAIL_FOOTER_COPYRIGHT;
        if (!isset($block['EMAIL_DISCLAIMER']) || $block['EMAIL_DISCLAIMER'] == '')     $block['EMAIL_DISCLAIMER']  = sprintf(EMAIL_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
        if (!isset($block['EMAIL_SPAM_DISCLAIMER']) || $block['EMAIL_SPAM_DISCLAIMER'] == '')   $block['EMAIL_SPAM_DISCLAIMER']  = EMAIL_SPAM_DISCLAIMER;
        if (!isset($block['EMAIL_DATE_SHORT']) || $block['EMAIL_DATE_SHORT'] == '')     $block['EMAIL_DATE_SHORT']  = zen_date_short(date("Y-m-d"));
        if (!isset($block['EMAIL_DATE_LONG']) || $block['EMAIL_DATE_LONG'] == '')       $block['EMAIL_DATE_LONG']   = zen_date_long(date("Y-m-d"));
        if (!isset($block['BASE_HREF']) || $block['BASE_HREF'] == '') $block['BASE_HREF'] = HTTP_CATALOG_SERVER . DIR_WS_CATALOG; /*lat9-c*/
        if (!isset($block['CHARSET']) || $block['CHARSET'] == '') $block['CHARSET'] = CHARSET;

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    What happens if in your configure.php you use the settings:
    Code:
      define('HTTP_SERVER', 'https://www.your_domain.com');
      define('HTTPS_SERVER', 'https://www.your_domain.com');
      define('HTTP_CATALOG_SERVER', 'http://www.your_domain.com');
      define('HTTPS_CATALOG_SERVER', 'https://www.your_domain.com');
    
      // secure webserver for admin?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_ADMIN', 'true');
    
      // secure webserver for storefront?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_CATALOG', 'false');
    
    we will look into this further ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    Ajeh, I've already got HTTP_CATALOG_SERVER set like you indicated; changing ENABLE_SSL_CATALOG to false made no difference. I'm hosted by 1and1 (I know ...), so my MY_ADMIN/includes/configure.php file looked like:
    Code:
      define('HTTP_SERVER', 'https://ssl.perfora.net');
      define('HTTPS_SERVER', 'https://ssl.perfora.net');
      define('HTTP_CATALOG_SERVER', 'http://www.your_domain.com');
      define('HTTPS_CATALOG_SERVER', 'https://ssl.perfora.net/your_domain.com');
    
      // secure webserver for admin?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_ADMIN', 'true');
    
      // secure webserver for storefront?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_CATALOG', 'true');
    I changed that to
    Code:
      define('HTTP_SERVER', 'https://ssl.perfora.net/your_domain.com');
      define('HTTPS_SERVER', 'https://ssl.perfora.net.your_domain.com');
      define('HTTP_CATALOG_SERVER', 'http://www.your_domain.com');
      define('HTTPS_CATALOG_SERVER', 'https://ssl.perfora.net/your_domain.com');
    
      // secure webserver for admin?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_ADMIN', 'true');
    
      // secure webserver for storefront?  Valid choices are 'true' or 'false' (including quotes).
      define('ENABLE_SSL_CATALOG', 'true');
    and the links "unbroke", but the BASE_HREF in the emails is still pointing to https://ssl.perfora.net/your_domain.com instead of http://www.your_domain.com.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    Don't forget to change this one too:
    Code:
    define('ENABLE_SSL_CATALOG', 'false');
    but again, we will look into this further ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    Quote Originally Posted by Ajeh View Post
    Don't forget to change this one too:
    Code:
    define('ENABLE_SSL_CATALOG', 'false');
    but again, we will look into this further ...
    OK, but if my catalog is using SSL why would I set this to false in admin?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    These 1and1 sites using ssl.perfora.net and their odd shared SSL configuration are a real pain!

    Be careful with this change because there's not HTTP_CATALOG_SERVER define on the catalog side, and so you might end up causing yourself undefined-constant errors by using this:
    Code:
    $block['BASE_HREF'] = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
    The URLs on the storefront are built from HTTP_SERVER . DIR_WS_CATALOG or for SSL, from HTTPS_SERVER . DIR_WS_HTTPS_CATALOG.
    So on your admin side, your HTTP_CATALOG_SERVER needs to match your catalog HTTP_SERVER and your DIR_WS_CATALOG needs to match catalog's DIR_WS_CATALOG.
    Similarly the admin HTTPS_CATALOG_SERVER needs to match catalog HTTPS_SERVER and DIR_WS_HTTPS_CATALOG needs to match DIR_WS_HTTPS_CATALOG


    For troubleshooting the cause of the problem, look at the email's raw HTML source to see what base-href and img src are being generated, and backtrack from there. (Evidently you've done this already else you wouldn't have posted the details you have, but I'm mentioning this for the benefit of future readers who don't know how you arrived to the point of posting what you did.)
    .

    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.

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Incorrect base_href in admin-sent HTML emails in some configurations

    Quote Originally Posted by DrByte View Post
    These 1and1 sites using ssl.perfora.net and their odd shared SSL configuration are a real pain!
    Agreed!

    Quote Originally Posted by DrByte View Post
    Be careful with this change because there's not HTTP_CATALOG_SERVER define on the catalog side, and so you might end up causing yourself undefined-constant errors by using this:
    Code:
    $block['BASE_HREF'] = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
    The base code in /includes/functions/functions_email already has that covered:
    Code:
        if (!defined('HTTP_CATALOG_SERVER')) define('HTTP_CATALOG_SERVER', HTTP_SERVER);
        //check for some specifics that need to be included with all messages
        if (!isset($block['EMAIL_STORE_NAME']) || $block['EMAIL_STORE_NAME'] == '')     $block['EMAIL_STORE_NAME']  = STORE_NAME;
        if (!isset($block['EMAIL_STORE_URL']) || $block['EMAIL_STORE_URL'] == '')       $block['EMAIL_STORE_URL']   = '<a href="'.HTTP_CATALOG_SERVER . DIR_WS_CATALOG.'">'.STORE_NAME.'</a>';
        if (!isset($block['EMAIL_STORE_OWNER']) || $block['EMAIL_STORE_OWNER'] == '')   $block['EMAIL_STORE_OWNER'] = STORE_OWNER;
        if (!isset($block['EMAIL_FOOTER_COPYRIGHT']) || $block['EMAIL_FOOTER_COPYRIGHT'] == '') $block['EMAIL_FOOTER_COPYRIGHT'] = EMAIL_FOOTER_COPYRIGHT;
        if (!isset($block['EMAIL_DISCLAIMER']) || $block['EMAIL_DISCLAIMER'] == '')     $block['EMAIL_DISCLAIMER']  = sprintf(EMAIL_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
        if (!isset($block['EMAIL_SPAM_DISCLAIMER']) || $block['EMAIL_SPAM_DISCLAIMER'] == '')   $block['EMAIL_SPAM_DISCLAIMER']  = EMAIL_SPAM_DISCLAIMER;
        if (!isset($block['EMAIL_DATE_SHORT']) || $block['EMAIL_DATE_SHORT'] == '')     $block['EMAIL_DATE_SHORT']  = zen_date_short(date("Y-m-d"));
        if (!isset($block['EMAIL_DATE_LONG']) || $block['EMAIL_DATE_LONG'] == '')       $block['EMAIL_DATE_LONG']   = zen_date_long(date("Y-m-d"));
        if (!isset($block['BASE_HREF']) || $block['BASE_HREF'] == '') $block['BASE_HREF'] = HTTP_CATALOG_SERVER . DIR_WS_CATALOG; /*lat9-c*/
        if (!isset($block['CHARSET']) || $block['CHARSET'] == '') $block['CHARSET'] = CHARSET;
    Quote Originally Posted by DrByte View Post
    The URLs on the storefront are built from HTTP_SERVER . DIR_WS_CATALOG or for SSL, from HTTPS_SERVER . DIR_WS_HTTPS_CATALOG.
    So on your admin side, your HTTP_CATALOG_SERVER needs to match your catalog HTTP_SERVER and your DIR_WS_CATALOG needs to match catalog's DIR_WS_CATALOG.
    Similarly the admin HTTPS_CATALOG_SERVER needs to match catalog HTTPS_SERVER and DIR_WS_HTTPS_CATALOG needs to match DIR_WS_HTTPS_CATALOG
    Yep, got that. The issue, I believe, is that I'm running my admin in full SSL mode (HTTP_SERVER == HTTPS_SERVER), so that the BASE_HREF for emails is always pointing the https site rather than the http site.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: [Done v1.6.0] Incorrect base_href in admin-sent HTML emails in some configuration

    Quote Originally Posted by lat9 View Post
    Zen Cart v1.5.1. My admin is set up to use SSL everywhere, so HTTP_SERVER and HTTPS_SERVER are identical in the admin's /includes/configure.php file. In addition, I'm using the shared SSL provided by my host for this shop.

    When I send an order update from admin (Customers->Orders) to a customer who's signed up for HTML emails, the link to the header image is broken. That's because the zen_build_html_email_from_template function is currently setting the BASE_HREF for the email to HTTP_SERVER ... which points to my host's shared SSL server. The change required to correct is shown below.

    Here's the code fragment from /includes/functions/functions_email.php (starting at line 454), the change is highlighted in red:
    Code:
        if (!defined('HTTP_CATALOG_SERVER')) define('HTTP_CATALOG_SERVER', HTTP_SERVER);
        //check for some specifics that need to be included with all messages
        if (!isset($block['EMAIL_STORE_NAME']) || $block['EMAIL_STORE_NAME'] == '')     $block['EMAIL_STORE_NAME']  = STORE_NAME;
        if (!isset($block['EMAIL_STORE_URL']) || $block['EMAIL_STORE_URL'] == '')       $block['EMAIL_STORE_URL']   = '<a href="'.HTTP_CATALOG_SERVER . DIR_WS_CATALOG.'">'.STORE_NAME.'</a>';
        if (!isset($block['EMAIL_STORE_OWNER']) || $block['EMAIL_STORE_OWNER'] == '')   $block['EMAIL_STORE_OWNER'] = STORE_OWNER;
        if (!isset($block['EMAIL_FOOTER_COPYRIGHT']) || $block['EMAIL_FOOTER_COPYRIGHT'] == '') $block['EMAIL_FOOTER_COPYRIGHT'] = EMAIL_FOOTER_COPYRIGHT;
        if (!isset($block['EMAIL_DISCLAIMER']) || $block['EMAIL_DISCLAIMER'] == '')     $block['EMAIL_DISCLAIMER']  = sprintf(EMAIL_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
        if (!isset($block['EMAIL_SPAM_DISCLAIMER']) || $block['EMAIL_SPAM_DISCLAIMER'] == '')   $block['EMAIL_SPAM_DISCLAIMER']  = EMAIL_SPAM_DISCLAIMER;
        if (!isset($block['EMAIL_DATE_SHORT']) || $block['EMAIL_DATE_SHORT'] == '')     $block['EMAIL_DATE_SHORT']  = zen_date_short(date("Y-m-d"));
        if (!isset($block['EMAIL_DATE_LONG']) || $block['EMAIL_DATE_LONG'] == '')       $block['EMAIL_DATE_LONG']   = zen_date_long(date("Y-m-d"));
        if (!isset($block['BASE_HREF']) || $block['BASE_HREF'] == '') $block['BASE_HREF'] = HTTP_CATALOG_SERVER . DIR_WS_CATALOG; /*lat9-c*/
        if (!isset($block['CHARSET']) || $block['CHARSET'] == '') $block['CHARSET'] = CHARSET;
    Will incorporate into 1.6.0:
    https://github.com/zencart/zencart/c...8d8ca916b3e1f9
    .

    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.

 

 

Similar Threads

  1. v151 All Admin emails now sent as HTML
    By Brent in forum General Questions
    Replies: 2
    Last Post: 11 Mar 2015, 03:21 PM
  2. Replies: 1
    Last Post: 24 Nov 2012, 05:32 PM
  3. v151 Incorrect Error 406 from application_top.php in some PHP configurations
    By steele in forum Installing on a Linux/Unix Server
    Replies: 0
    Last Post: 24 Nov 2012, 05:08 AM
  4. No emails being sent - have tried many configurations
    By madmumbler in forum General Questions
    Replies: 7
    Last Post: 16 Oct 2007, 01:23 AM
  5. Emails not being sent in html
    By nigelt74 in forum General Questions
    Replies: 3
    Last Post: 13 Jun 2007, 01:31 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR