Thanks for help!
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The extension sends email manually, but I want to send attachment automatically by order confirmation email.straightlight wrote: ↑Mon Jun 25, 2018 8:32 pmThis extension may be useful: https://www.opencart.com/index.php?rout ... n_id=22210
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I have added "$mail->AddAttachment("xyz.pdf");" before "$mail->send();" into catalog/model/checkout/order.php. This sends the attachment by order confirmation by all product ID's, but I want to exclude sending attachment, If order contains one of the specific product ID's. I think it need some few code for "foreach" and "if condition". I know C++ and C#, but I cannot code PHP. I think it is not complicated for someone how know PHP. Can you please advise me how the code look like for this purpose? The Opencart store is 2.3.0.2 version.straightlight wrote: ↑Mon Jun 25, 2018 9:07 pmIn addition, since you are focusing on specific product IDs, you could also set a condition in that same controller file. Also, your OC version has not been posted.
Code: Select all
$order_products = $this->model_checkout_order->getOrderProducts($order_info['order_id']);
$order_product_ids = array();
foreach ($order_products as $order_product) {
$order_product_ids[] = (int)$order_product['product_id'];
}
if (!in_array(array(1, 2, 3, 4), $order_product_ids)) {
// Add email attachment object here.
}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I have tried this code, but it doesn't work. The whole module has stopped to send email order confirmation both to customer and to store admin. I added this code:straightlight wrote: ↑Mon Jun 25, 2018 9:33 pmSince you are still missing posted information in order to provide an accurate solution, I will provide the partial code so for you to tweak it:
This should resolved the issue.Code: Select all
$order_products = $this->model_checkout_order->getOrderProducts($order_info['order_id']); $order_product_ids = array(); foreach ($order_products as $order_product) { $order_product_ids[] = (int)$order_product['product_id']; } if (!in_array(array(1, 2, 3, 4), $order_product_ids)) { // Add email attachment object here. }
$order_products = $this->model_checkout_order->getOrderProducts($order_info['order_id']);
$order_product_ids = array();
foreach ($order_products as $order_product) {
$order_product_ids[] = (int)$order_product['product_id'];
}
if (!in_array(array(139, 188, 207, 106, 159, 146, 166, 135, 188), $order_product_ids)) {
$mail->AddAttachment("xyz.pdf");
}
$mail->send();
But it seems that it is something wrong.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I checked the error_log file on the server. There is no notification error for this. Is there some specific log for email modul? Can you see some log informasion, which shows which emails has been sent after checkout?
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 185 guests