[TEP-COMMIT] [CVS admin] new statistic modules

anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:14:44 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in admin/admin/includes/modules/statistics on MAIN

orders.php +75 added 1.1

products_purchased.php +67 added 1.1

products_viewed.php +69 added 1.1

+211

3 added files

new statistic modules

----------

admin /admin /includes /modules /statistics

orders.php added at 1.1

diff -N orders.php
--- /dev/null Fri Jul 23 01:14:42 2004
+++ /tmp/cvsAAAuuaqr5 Fri Jul 23 01:14:43 2004
@@ -0,0 +1,75 @@

+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if (!class_exists('osC_Statistics')) {
+ include('includes/classes/statistics.php');
+ }
+
+ class osC_Statistics_Orders extends osC_Statistics {
+
+// Class constructor
+
+ function osC_Statistics_Orders() {
+ global $osC_Session, $osC_Currencies;
+
+ include('includes/languages/' . $osC_Session->value('language') . '/modules/statistics/orders.php');
+
+ if (!isset($osC_Currencies)) {
+ if (!class_exists('osC_Currencies')) {
+ include('../includes/classes/currencies.php');
+ }
+
+ $osC_Currencies = new osC_Currencies();
+ }
+
+ $this->_setIcon();
+ $this->_setTitle();
+ }
+
+// Private methods
+
+ function _setIcon() {
+ $this->_icon = tep_icon('orders.png', ICON_ORDERS, '16', '16');
+ }
+
+ function _setTitle() {
+ $this->_title = MODULE_STATISTICS_ORDERS_TITLE;
+ }
+
+ function _setHeader() {
+ $this->_header = array(MODULE_STATISTICS_ORDERS_TABLE_HEADING_CUSTOMER,
+ MODULE_STATISTICS_ORDERS_TABLE_HEADING_TOTAL);
+ }
+
+ function _setData() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $osC_Database, $osC_Currencies;
+
+ $this->_data = array();
+
+ $this->_resultset = $osC_Database->query('select o.orders_id, o.customers_name, ot.value from :table_orders o, :table_orders_total ot where o.orders_id = ot.orders_id and ot.class = :class order by value desc');
+ $this->_resultset->bindTable(':table_orders', TABLE_ORDERS);
+ $this->_resultset->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
+ $this->_resultset->bindValue(':class', 'ot_total');
+ $this->_resultset->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $this->_resultset->execute();
+
+ while ($this->_resultset->next()) {
+ $this->_data[] = array('<a href="' . tep_href_link(FILENAME_ORDERS, 'oID=' . $this->_resultset->value('orders_id') . '&action=oEdit') . '">' . $this->_icon . '&nbsp;' . $this->_resultset->value('customers_name') . '</a>',
+ $osC_Currencies->format($this->_resultset->valueInt('value')));
+ }
+ }
+ }
+?>

----------

admin /admin /includes /modules /statistics

products_purchased.php added at 1.1

diff -N products_purchased.php
--- /dev/null Fri Jul 23 01:14:42 2004
+++ /tmp/cvsAAAivaGr5 Fri Jul 23 01:14:43 2004
@@ -0,0 +1,67 @@

+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if (!class_exists('osC_Statistics')) {
+ include('includes/classes/statistics.php');
+ }
+
+ class osC_Statistics_Products_Purchased extends osC_Statistics {
+
+// Class constructor
+
+ function osC_Statistics_Products_Purchased() {
+ global $osC_Session;
+
+ include('includes/languages/' . $osC_Session->value('language') . '/modules/statistics/products_purchased.php');
+
+ $this->_setIcon();
+ $this->_setTitle();
+ }
+
+// Private methods
+
+ function _setIcon() {
+ $this->_icon = tep_icon('products.png', ICON_PRODUCTS, '16', '16');
+ }
+
+ function _setTitle() {
+ $this->_title = MODULE_STATISTICS_PRODUCTS_PURCHASED_TITLE;
+ }
+
+ function _setHeader() {
+ $this->_header = array(MODULE_STATISTICS_PRODUCTS_PURCHASED_TABLE_HEADING_PRODUCTS,
+ MODULE_STATISTICS_PRODUCTS_PURCHASED_TABLE_HEADING_PURCHASED);
+ }
+
+ function _setData() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $osC_Database, $osC_Session;
+
+ $this->_data = array();
+
+ $this->_resultset = $osC_Database->query('select p.products_id, p.products_ordered, pd.products_name from :table_products p, :table_products_description pd where p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_ordered desc, pd.products_name');
+ $this->_resultset->bindTable(':table_products', TABLE_PRODUCTS);
+ $this->_resultset->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $this->_resultset->bindInt(':language_id', $osC_Session->value('languages_id'));
+ $this->_resultset->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $this->_resultset->execute();
+
+ while ($this->_resultset->next()) {
+ $this->_data[] = array('<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=new_product_preview&read=only&pID=' . $this->_resultset->valueInt('products_id')) . '">' . $this->_icon . '&nbsp;' . $this->_resultset->value('products_name') . '</a>',
+ $this->_resultset->valueInt('products_ordered'));
+ }
+ }
+ }
+?>

----------

admin /admin /includes /modules /statistics

products_viewed.php added at 1.1

diff -N products_viewed.php
--- /dev/null Fri Jul 23 01:14:42 2004
+++ /tmp/cvsAAAiwaWr5 Fri Jul 23 01:14:43 2004
@@ -0,0 +1,69 @@

+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if (!class_exists('osC_Statistics')) {
+ include('includes/classes/statistics.php');
+ }
+
+ class osC_Statistics_Products_Viewed extends osC_Statistics {
+
+// Class constructor
+
+ function osC_Statistics_Products_Viewed() {
+ global $osC_Session;
+
+ include('includes/languages/' . $osC_Session->value('language') . '/modules/statistics/products_viewed.php');
+
+ $this->_setIcon();
+ $this->_setTitle();
+ }
+
+// Private methods
+
+ function _setIcon() {
+ $this->_icon = tep_icon('products.png', ICON_PRODUCTS, '16', '16');
+ }
+
+ function _setTitle() {
+ $this->_title = MODULE_STATISTICS_PRODUCTS_VIEWED_TITLE;
+ }
+
+ function _setHeader() {
+ $this->_header = array(MODULE_STATISTICS_PRODUCTS_VIEWED_TABLE_HEADING_PRODUCTS,
+ MODULE_STATISTICS_PRODUCTS_VIEWED_TABLE_HEADING_LANGUAGE,
+ MODULE_STATISTICS_PRODUCTS_VIEWED_TABLE_HEADING_VIEWED);
+ }
+
+ function _setData() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $osC_Database;
+
+ $this->_data = array();
+
+ $this->_resultset = $osC_Database->query('select p.products_id, pd.products_name, pd.products_viewed, l.name, l.directory, l.image from :table_products p, :table_products_description pd, :table_languages l where p.products_id = pd.products_id and l.languages_id = pd.language_id order by pd.products_viewed desc');
+ $this->_resultset->bindTable(':table_products', TABLE_PRODUCTS);
+ $this->_resultset->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
+ $this->_resultset->bindTable(':table_languages', TABLE_LANGUAGES);
+ $this->_resultset->setBatchLimit($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS);
+ $this->_resultset->execute();
+
+ while ($this->_resultset->next()) {
+ $this->_data[] = array('<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=new_product_preview&read=only&pID=' . $this->_resultset->valueInt('products_id')) . '">' . $this->_icon . '&nbsp;' . $this->_resultset->value('products_name') . '</a>',
+ tep_image(DIR_WS_CATALOG_LANGUAGES . $this->_resultset->value('directory') . '/images/' . $this->_resultset->value('image'), $this->_resultset->value('name')),
+ $this->_resultset->valueInt('products_viewed'));
+ }
+ }
+ }
+?>

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click