This should work for v1.5.5 through 1.5.7:
Save it to your server as /includes/classes/observers/auto.send_ebook_download_link_in_email.php
Code:
<?php
/**
* Send product download URL in order confirmation email
* CAVEAT: This will send the link regardless of payment status, so only use it if your payment modules require complete payment.
* NOTE: The link that's sent takes the customer into their account, so if they're not logged in when they click the link in the email, it will ask them to login.
*
* This observer class is designed for Zen Cart v1.5.5 or newer.
*/
class zcObserverSendEbookDownloadLinkInEmail extends base
{
public function __construct()
{
$this->attach($this, [
'NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM',
]);
}
public function updateNotifyOrderDuringCreateAddedAttributeDownloadLineItem(&$orderClass, $eventID, $download_data, $orders_products_download_id)
{
$orderClass->products_ordered_attributes .= "\n";
$orderClass->products_ordered_attributes .= '<a href="' . zen_href_link(FILENAME_DOWNLOAD, 'order=' . $download_data['orders_id'] . '&id=' . $orders_products_download_id) . '">';
$orderClass->products_ordered_attributes .= $download_data['orders_products_filename'] . ' ';
$orderClass->products_ordered_attributes .= '</a>';
}
}
Bookmarks