Within the CartThrob Order Manager, on the product report tab, under the the initial report, there is an option to choose a date range. When I select a date range and generated the report, an order report is generated instead.

Is this a bug?


I have been in contact with MightyBigRobot, and they confirmed that this is a bug and they are working on it.

As a temporary workaround I built a SQL query and embedded it into a custom report template. that looks like this:

<h1>Product Totals for the Past 7 Days</h1>

<table class="mainTable padTable">
<td>Total Sold</td>
<td>Current Inventory</td>

{exp:query sql="
SELECT SUM(`exp_cartthrob_order_items`.`quantity`) AS total_quantity, `exp_cartthrob_order_items`.*,  exp_channel_titles.entry_date, FROM_UNIXTIME(exp_channel_titles.entry_date) AS MYDATE, exp_channel_titles.status,
exp_channel_data.entry_id as product_id, exp_channel_data.field_id_72 AS unit, exp_channel_data.field_id_78 AS unit_numerical, exp_channel_data.field_id_7 AS inventory,
(SUM(`exp_cartthrob_order_items`.`quantity`)* exp_channel_data.field_id_78) as need
FROM (`exp_cartthrob_order_items`, `exp_channel_titles` AS ct, `exp_channel_data`)
JOIN `exp_channel_titles` ON `exp_channel_titles`.`entry_id` = `exp_cartthrob_order_items`.`order_id`
WHERE ct.entry_id = exp_cartthrob_order_items.entry_id
AND exp_channel_titles.entry_date >= UNIX_TIMESTAMP(CURRENT_DATE - INTERVAL 7 DAY)
AND exp_channel_titles.entry_date  < UNIX_TIMESTAMP(CURRENT_DATE + INTERVAL 1 DAY)
AND `exp_channel_titles`.`status` =  'open'
AND exp_channel_data.entry_id = exp_cartthrob_order_items.`entry_id`
GROUP BY `exp_cartthrob_order_items`.`entry_id`, `exp_cartthrob_order_items`.`price`
ORDER BY `total_quantity` DESC

<td>{title}   {exp:basee64:decode}{extra}{/exp:basee64:decode}   </td>
<td>{total_quantity} </td>
<td>{if unit=="kg"}{unit_numerical}/{/if}{unit}</td>
<td>{need} {if unit=="kg"}kg{/if}</td>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.