Post by seedecor » Wed Jun 07, 2023 2:37 am

Hi Guys

i want ways to add extra custom print invoice page

this default order print invoice in admin page
myweb. com/admin/index.php?route=sale/order/invoice&token=56ReE&order_id=125403

and i want add extra like it data but with my custom design myweb. com/admin/index.php?route=sale/order/invoiceCustom&token=56ReE&order_id=125403

like adding order_invoiceCutom.tpl in template

and add button in order list to bulk select order



# i will add this button for example
<div class="pull-right">

<button type="submit" id="button-invoice" form="form-order" formaction="<?php echo $invoiceCustom; ?>" formtarget="_blank" data-toggle="tooltip" title="<?

</div>

thanks

Newbie

Posts

Joined
Mon Jun 04, 2018 12:17 am

Post by straightlight » Wed Jun 07, 2023 4:30 am

OC version.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Elliecurtis » Thu Jun 22, 2023 1:48 pm

Hello, Create a new template file called order_invoiceCustom.tpl in your template directory. This file will contain the custom design for your invoice page.

In your admin controller file (e.g., admin/controller/sale/order.php), add a new method called invoiceCustom. This method will handle the logic for your custom invoice page.

In the invoiceCustom method, retrieve the necessary data for the invoice based on the provided order_id.

Load and render the order_invoiceCustom.tpl template, passing the required data.

In the admin order list view file (e.g., admin/view/template/sale/order_list.tpl), add a new button or checkbox for bulk selecting orders.

Implement JavaScript or jQuery code to handle the bulk selection and trigger the printing of the custom invoice page for the selected orders.

Set the formaction attribute of the button or submit form to point to the URL of your custom invoice page (route=sale/order/invoiceCustom).

Include the necessary token and order ID in the URL using PHP code.

Newbie

Posts

Joined
Wed Jun 21, 2023 1:41 pm

Post by veronsa2 » Mon Sep 25, 2023 2:58 pm

In this file, you'll need to load the necessary order data and customize the design of the invoice according to your requirements. You can use the existing invoice template or create a new template file if needed. Locate the order list page in your admin section where you want to add the button for bulk selecting orders. . In the controller file associated with the order list page (e.g., admin/controller/sale/order.php), add the necessary code to handle the bulk selection of orders and redirect to your custom invoice page. You may need to create a new function for this purpose.

Code: Select all

<div class="pull-right">
  <button type="submit" id="button-invoice" form="form-order" formaction="<?php echo $invoiceCustom; ?>" formtarget="_blank" data-toggle="tooltip" title="<?php echo $button_invoice; ?>">
    Bulk Print Invoice Custom
  </button>
</div>
Make sure to implement appropriate security measures and input validation to protect your application from potential vulnerabilities when handling order data. Remember to back up your files and database before making any significant changes to your application. Additionally, it's essential to adhere to best practices and coding standards for your specific e-commerce platform to maintain the integrity and security of your application.

In your custom controller (e.g., admin/controller/sale/order_invoiceCustom.php), you'll need to create a new controller action to handle the custom invoice generation.

Code: Select all

public function index() {
// Load necessary data for the invoice, e.g., order details
// ...

$this->response->setOutput($this->load->view('sale/order_invoiceCustom', $data));
}

Newbie

Posts

Joined
Mon Sep 25, 2023 2:55 pm
Who is online

Users browsing this forum: No registered users and 27 guests