Jump to content

[Solved] Custom Report Script


Recommended Posts

I have a script to run a report for a selectable time period. It has worked just fine except this time I have to bring in "ps_customized_data.value". Linking this to the order cross's three tables and I am not sure how to get it done.
Here is what I have. I have added the "ps_customized_data.value" under "Select" , " ps_customized_data" under "FROM" and the last two "AND" statements. Take out those and it works but I need to have the customized data in the report.

$sql = "

SELECT 'ps_orders.invoice_date','ps_orders.invoice_number','ps_customized_data.value','ps_address.firstname','ps_address.lastname','ps_address.address1',
FROM ps_address, ps_orders, ps_order_detail, ps_state, ps_customized_data


SELECT ps_orders.invoice_date, ps_orders.invoice_number, ps_customized_data.value, ps_address.firstname, ps_address.lastname, ps_address.address1,
ps_address.city, ps_state.iso_code, ps_address.postcode, ps_order_detail.product_name, ps_order_detail.product_quantity,
FROM ps_address, ps_orders, ps_order_detail, ps_state, ps_customized_data
BETWEEN '$fyr-$fmo-$fday 00:00:00' and '$tyr-$tmo-$tday 23:59:59'
AND ps_address.id_address = ps_orders.id_address_delivery
AND ps_state.id_state = ps_address.id_state
AND ps_order_detail.id_order = ps_orders.id_order
AND ps_customization.id_cart = ps_orders.id_cart
AND ps_customized_data.id_customization = ps_customization.id_customization


Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More