Zen Cart Logo
Forums / Basic Configuration / Add Download link to confirmation email.

Add Download link to confirmation email.

Views: 2,244

Results 1 to 5 of 5
25 Jan 2014, 1:37 AM
#1
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Add Download link to confirmation email.

Hi

Ok,
Situation
A customer orders a downloadable product and uses a non instant payment system (eg money order/Direct Bank transfer),
when you confirm you have received the payment by changing the order status to Delivered, the email they receive doesn't mention how to download the product or where to download it from, the email does provide a link to the invoice but all order emails do that and there is no information that the invoice contains the actual download link.
Yes I do realise i can type this information into the order comments box, but i would like to automate it, and I cannot seem to get it to work.

I only want the message "To download your file, please follow the above link to your invoice and click the download button" to appear when the order status is set to delivered and the order contains a downloadable product.

I have in the past displayed a generic message saying "If you have ordered a downloadable product then once your order has been processed please follow the above link and a download button should appear. Please note the download button will not appear until the order has been processed by us"
But that message appeared on all order emails whether it was applicable or not.

25 Jan 2014, 3:44 AM
#2
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Add Download link to confirmation email.

Ok this is what i have so far

Editing
admin/orders.php

around line 135 it reads

            $message =
            EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
            EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
            EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
            strip_tags($notify_comments) .
            EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
            EMAIL_TEXT_STATUS_PLEASE_REPLY;

I changed it to

            $message =
            EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
            EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" ;
		if ($orders_status_array[$status] == 'Delivered') {$message .= "If you purchased a downloadable product, please follow the above link to download your purchase. \n\n";} 
            $message .=
            EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
            strip_tags($notify_comments) .
            EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
            EMAIL_TEXT_STATUS_PLEASE_REPLY;

When i switch the order status to "delivered" the message is displayed, however it is displayed for all delivered orders, whether they contain downloadable product or not

25 Jan 2014, 3:58 AM
#3
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Add Download link to confirmation email.

On second thoughts, it would probably be better to display the message when the status is set to pending, as thats when the file is available for download.

25 Jan 2014, 1:20 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Add Download link to confirmation email.

nigelt74:

On second thoughts, it would probably be better to display the message when the status is set to pending, as thats when the file is available for download.

Couple of things... Would probably want to implement a similar setting check as is done elsewhere in the system, ie. If not mistaken in the admin settings there are settings to indicate that a product is to be available for download. You want to mirror that "allowance" using variables not strict numbers or status designations. (If you ever change the one without changing the hard-coded piece, you will go crazy.

Regarding the applicability to a product, are all of your digital products in a single category or in some otherway grouped? What you do/can do is to step through the $order(s) variable (sorry forget which it is, but you can see examples of this in the file you're modifying), to identify if an item that meets your criteria to provide that message is present and if so, then to display that message and depending on how you search/compare the data may need to exit a loop or carry on down the message path.

Do realize/understand that this is only the plain text area of the emails, somewhere else is the html version. (Sorry one area I haven't gone to explore yet, been trying to get/make sure the text side contains the content we want so in the mean time we have not enabled html options for our guests.)

25 Jan 2014, 1:29 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Add Download link to confirmation email.

nigelt74:

admin/orders.php

around line 135

I changed it to

	if ($orders_status_array[$status] == 'Delivered') {$message .= "If you purchased a downloadable product, please follow the above link to download your purchase. \n\n";} 
        $message .=
        EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
        strip_tags($notify_comments) .
        EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
        EMAIL_TEXT_STATUS_PLEASE_REPLY;

Another thing, and I realize you're still developing, but for those looking at this later, the text that is provided above, should instead be placed in a languages define so that if the cart is expanded, etc... The applicable translated information can be presented to others that have selected a language other than english. Also, in an upgrade that affects that file, at least the text will still exist somewhere, but perhaps not the call to display it. But a search through then existing files wouldn't be too difficult to identify at least what variable needs to be displayed.

Anyways, just a coding suggestion.