jivemoj473 Posted July 13, 2022 Posted July 13, 2022 (edited) Hi everyone! I use PS 1.7.8 and figured out that there is no option to attach credit slip as PDF to customer's email. I believe that it is necessary to make changes to the AdminOrdersController.php on line 759 and 1022, as it was mentioned here: Can anyone suggest how this can be implemented? Thanks in advance. Here is the code: Line 759: if (!OrderSlip::create( $order, $order_detail_list, $shipping_cost_amount, $voucher, $choosen, (Tools::getValue('TaxMethod') ? false : true) )) { $this->errors[] = $this->trans('You cannot generate a partial credit slip.', array(), 'Admin.Orderscustomers.Notification'); } else { Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $order_detail_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop); $customer = new Customer((int) ($order->id_customer)); $params['{lastname}'] = $customer->lastname; $params['{firstname}'] = $customer->firstname; $params['{id_order}'] = $order->id; $params['{order_name}'] = $order->getUniqReference(); $orderLanguage = new Language((int) $order->id_lang); @Mail::Send( (int) $order->id_lang, 'credit_slip', $this->trans( 'New credit slip regarding your order', array(), 'Emails.Subject', $orderLanguage->locale ), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop ); } Line 1023: // Generate credit slip if (Tools::isSubmit('generateCreditSlip') && !count($this->errors)) { $product_list = array(); $amount = $order_detail->unit_price_tax_incl * $full_quantity_list[$id_order_detail]; $choosen = false; if ((int) Tools::getValue('refund_total_voucher_off') == 1) { $amount -= $voucher = (float) Tools::getValue('order_discount_price'); } elseif ((int) Tools::getValue('refund_total_voucher_off') == 2) { $choosen = true; $amount = $voucher = (float) Tools::getValue('refund_total_voucher_choose'); } foreach ($full_product_list as $id_order_detail) { $order_detail = new OrderDetail((int) $id_order_detail); $product_list[$id_order_detail] = array( 'id_order_detail' => $id_order_detail, 'quantity' => $full_quantity_list[$id_order_detail], 'unit_price' => $order_detail->unit_price_tax_excl, 'amount' => isset($amount) ? $amount : $order_detail->unit_price_tax_incl * $full_quantity_list[$id_order_detail], ); } $shipping = Tools::isSubmit('shippingBack') ? null : false; if (!OrderSlip::create($order, $product_list, $shipping, $voucher, $choosen)) { $this->errors[] = $this->trans('A credit slip cannot be generated.', array(), 'Admin.Orderscustomers.Notification'); } else { Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop); $orderLanguage = new Language((int) $order->id_lang); @Mail::Send( (int) $order->id_lang, 'credit_slip', $this->trans( 'New credit slip regarding your order', array(), 'Emails.Subject', $orderLanguage->locale ), $params, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop ); } } Edited July 13, 2022 by jivemoj473 Added PS version to the title (see edit history) Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now