Jump to content

Edit History

Casper_O

Casper_O

In AdminOrdersController.php look for OrderSlip::create

I changed it to this around liine 990 to the following in the else function

                        if (!OrderSlip::create($order, $product_list, $shipping, $voucher, $choosen)) {
                                $this->errors[] = Tools::displayError('A credit slip cannot be generated. ');
                            } else {
                                Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
								// Get id_order_slip based on customer ID and Order ID
								$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
								// Create objects and PDF
								$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
								$orderNew = new Order((int)$orderSlip->id_order);
								if (!Validate::isLoadedObject($orderNew))
									die(Tools::displayError('The order cannot be found within your database.'));
								$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
								
								$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
								$file_attachement['content'] = $pdf->render(false);
								$file_attachement['name'] = $pdf->filename;
								$file_attachement['mime'] = 'application/pdf';

                                @Mail::Send(
                                    (int)$order->id_lang,
                                    'credit_slip',
                                    Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                    $params,
                                    $customer->email,
                                    $customer->firstname.' '.$customer->lastname,
                                    null,
                                    null,
                                    $file_attachement,
                                    null,
                                    _PS_MAIL_DIR_,
                                    true,
                                    (int)$order->id_shop
                                );
                            }

I also found around like 725 and changed it to the following

                        if (!OrderSlip::create($order, $order_detail_list, $shipping_cost_amount, $voucher, $choosen,
                            (Tools::getValue('TaxMethod') ? false : true))) {
                            $this->errors[] = Tools::displayError('You cannot generate a partial credit slip.');
                        } else {
                            Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $order_detail_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
							// Get id_order_slip based on customer ID and Order ID
							$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
							// Create objects and PDF
							$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
							$orderNew = new Order((int)$orderSlip->id_order);
							if (!Validate::isLoadedObject($orderNew))
								die(Tools::displayError('The order cannot be found within your database.'));
							$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
							
							$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
							$file_attachement['content'] = $pdf->render(false);
							$file_attachement['name'] = $pdf->filename;
							$file_attachement['mime'] = 'application/pdf';
								
								
                            $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();

                            @Mail::Send(
                                (int)$order->id_lang,
                                'credit_slip',
                                Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                $params,
                                $customer->email,
                                $customer->firstname.' '.$customer->lastname,
                                null,
                                null,
                                $file_attachement,
                                null,
                                _PS_MAIL_DIR_,
                                true,
                                (int)$order->id_shop
                            );
                        }

 

Casper_O

Casper_O

In AdminOrdersController.php look for OrderSlip::create

I changed it to this around liine 1000 to the following in the else function

                        if (!OrderSlip::create($order, $product_list, $shipping, $voucher, $choosen)) {
                                $this->errors[] = Tools::displayError('A credit slip cannot be generated. ');
                            } else {
                                Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
								// Get id_order_slip based on customer ID and Order ID
								$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
								// Create objects and PDF
								$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
								$orderNew = new Order((int)$orderSlip->id_order);
								if (!Validate::isLoadedObject($orderNew))
									die(Tools::displayError('The order cannot be found within your database.'));
								$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
								
								$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
								$file_attachement['content'] = $pdf->render(false);
								$file_attachement['name'] = $pdf->filename;
								$file_attachement['mime'] = 'application/pdf';

                                @Mail::Send(
                                    (int)$order->id_lang,
                                    'credit_slip',
                                    Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                    $params,
                                    $customer->email,
                                    $customer->firstname.' '.$customer->lastname,
                                    null,
                                    null,
                                    $file_attachement,
                                    null,
                                    _PS_MAIL_DIR_,
                                    true,
                                    (int)$order->id_shop
                                );
                            }

I also found around like 725 and changed it to the following

                        if (!OrderSlip::create($order, $order_detail_list, $shipping_cost_amount, $voucher, $choosen,
                            (Tools::getValue('TaxMethod') ? false : true))) {
                            $this->errors[] = Tools::displayError('You cannot generate a partial credit slip.');
                        } else {
                            Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $order_detail_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
							// Get id_order_slip based on customer ID and Order ID
							$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
							// Create objects and PDF
							$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
							$orderNew = new Order((int)$orderSlip->id_order);
							if (!Validate::isLoadedObject($orderNew))
								die(Tools::displayError('The order cannot be found within your database.'));
							$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
							
							$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
							$file_attachement['content'] = $pdf->render(false);
							$file_attachement['name'] = $pdf->filename;
							$file_attachement['mime'] = 'application/pdf';
								
								
                            $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();

                            @Mail::Send(
                                (int)$order->id_lang,
                                'credit_slip',
                                Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                $params,
                                $customer->email,
                                $customer->firstname.' '.$customer->lastname,
                                null,
                                null,
                                $file_attachement,
                                null,
                                _PS_MAIL_DIR_,
                                true,
                                (int)$order->id_shop
                            );
                        }

 

Casper_O

Casper_O

In AdminOrdersController.php look for OrderSlip::create

I changed it to this around liine 1000 to the following in the else function

if (!OrderSlip::create($order, $product_list, $shipping, $voucher, $choosen)) {
                                $this->errors[] = Tools::displayError('A credit slip cannot be generated. ');
                            } else {
                                Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
								// Get id_order_slip based on customer ID and Order ID
								$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
								// Create objects and PDF
								$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
								$orderNew = new Order((int)$orderSlip->id_order);
								if (!Validate::isLoadedObject($orderNew))
									die(Tools::displayError('The order cannot be found within your database.'));
								$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
								
								$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
								$file_attachement['content'] = $pdf->render(false);
								$file_attachement['name'] = $pdf->filename;
								$file_attachement['mime'] = 'application/pdf';

                                @Mail::Send(
                                    (int)$order->id_lang,
                                    'credit_slip',
                                    Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                    $params,
                                    $customer->email,
                                    $customer->firstname.' '.$customer->lastname,
                                    null,
                                    null,
                                    $file_attachement,
                                    null,
                                    _PS_MAIL_DIR_,
                                    true,
                                    (int)$order->id_shop
                                );
                            }

I also found around like 725 and changed it to the following

if (!OrderSlip::create($order, $order_detail_list, $shipping_cost_amount, $voucher, $choosen,
                            (Tools::getValue('TaxMethod') ? false : true))) {
                            $this->errors[] = Tools::displayError('You cannot generate a partial credit slip.');
                        } else {
                            Hook::exec('actionOrderSlipAdd', array('order' => $order, 'productList' => $order_detail_list, 'qtyList' => $full_quantity_list), null, false, true, false, $order->id_shop);
							// Get id_order_slip based on customer ID and Order ID
							$orderSlipTemp = OrderSlip::getOrdersSlip((int)($order->id_customer), (int)($order->id), true);
								
							// Create objects and PDF
							$orderSlip = new OrderSlip((int) ($orderSlipTemp[0]['id_order_slip']));
							$orderNew = new Order((int)$orderSlip->id_order);
							if (!Validate::isLoadedObject($orderNew))
								die(Tools::displayError('The order cannot be found within your database.'));
							$orderNew->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $orderNew);
							
							$pdf = new PDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP, $this->context->smarty);
							$file_attachement['content'] = $pdf->render(false);
							$file_attachement['name'] = $pdf->filename;
							$file_attachement['mime'] = 'application/pdf';
								
								
                            $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();

                            @Mail::Send(
                                (int)$order->id_lang,
                                'credit_slip',
                                Mail::l('New credit slip regarding your order', (int)$order->id_lang),
                                $params,
                                $customer->email,
                                $customer->firstname.' '.$customer->lastname,
                                null,
                                null,
                                $file_attachement,
                                null,
                                _PS_MAIL_DIR_,
                                true,
                                (int)$order->id_shop
                            );
                        }

 

×
×
  • Create New...