skip to content
AdaWiki
User Tools
Log In
Site Tools
Search
Tools
Show page
Old revisions
Backlinks
Recent Changes
Media Manager
Sitemap
Log In
>
Recent Changes
Media Manager
Sitemap
You are here:
start
»
tutorials
»
zencartmods
»
inventory_report_5.html
Trace:
tutorials:zencartmods:inventory_report_5.html
We suggest writing a few extra functions in your zencart admin to place into the **/admin/includes/functions/extra_functions/** folder for generating inventory reports. Here's one of our functions, which simply makes a giant array of how many of each product we've sold in the past week, 2 weeks, 4 kees, 6 weeks, etc. Save this into a file called **admin/includes/functions/extra_functions/stats_functions.php** <code> <?php function getSalesStats() { global $db; $all = array(); for ($i = 0; $i < 2000; $i++) { $all[$i] = array(0,0,0,0,0,0,0); } $selectql = $db->Execute("SELECT op.products_id, op.products_quantity, o.date_purchased, DATEDIFF(CURDATE(), o.date_purchased) as diff from orders_products op LEFT JOIN orders o on op.orders_id = o.orders_id WHERE DATEDIFF(CURDATE(), o.date_purchased) < 90"); while(!$selectql->EOF) { $pid = $selectql->fields['products_id']; if($selectql->fields['diff'] <= 7) { $all[$pid][0] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 14) { $all[$pid][1] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 21) { $all[$pid][2] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 28) { $all[$pid][3] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 42) { $all[$pid][4] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 56) { $all[$pid][5] += $selectql->fields['products_quantity']; } if($selectql->fields['diff'] <= 90) { $all[$pid][6] += $selectql->fields['products_quantity']; } $selectql->MoveNext(); } return $all; } ?> </code> And you will be able to call this function from any new report-generating pages that you create. Here's an example of a report generating page using this custom created function
/home/ladyada/public_html/wiki/data/attic/tutorials/zencartmods/inventory_report_5.html.1314647028.txt.gz
· Last modified: 2016/01/28 18:05 (external edit)
Page Tools
Show page
Old revisions
Backlinks
Back to top