Jump to content

[SOLVED] Help with new Admin Tab


Recommended Posts

As you may, or may not know, my shop generates reports on-the-fly for customers. When they return from their payment processor, Paypal or Google Checkout, the PaymentModule calls a class that generates the report(s) and sends the customer a notification email.

Now, when an error occurs during report generation, I return false from my ReportGenerator->BuildReport() function and set the order_state to _PS_OS_GEN_ERROR_. I have setup that order state and defined which template I want to send to the customer when an order is set to that state. Everything works as planned.

Now, I am beginning to write a module/tab to be able to list the orders that have the order_state _PS_OS_GEN_ERROR_ and flag them to be regenerated and a new email sent to the customer.

I am having problems understanding how the checkboxes are being generated in the AdminOrder tab when the deletion of orders is enabled, ($this->delete = true;) or any of the other tabs for that matter. I need to be able to select the items from the grid to be handled by the report generator class.

How would I build this grid of orders, SQL posted below, and also have that checkbox for selection and handle them in the postProcess()?

SQL to get the orders that have _PS_OS_GEN_ERROR_ order_state:

SELECT o.id_order, 
           CONCAT( LEFT( c.`firstname` , 1 ) , ', ', c.`lastname` ) AS `customer`
FROM `ps_order_history` oh
INNER JOIN `ps_orders` o ON ( o.`id_order` = oh.`id_order` )
LEFT JOIN `ps_customer` c ON ( c.`id_customer` = o.`id_customer` )
WHERE oh.`id_order_state` =12"

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...