Well that was a little tricky. If anyone else wants this, below are the changes.
/app/controllers/backend/index.php - Find /* Products */ and replace that section with:
/* Products - The Tool */
if (fn_check_view_permissions('products.manage', 'GET')) {
$general_stats['products'] = array();
$params = array(
'only_short_fields' => true, // NOT NEEDED AT ALL BECAUSE WE DONT USE RESULTING $FIELDS
'extend' => array('companies', 'sharing'),
'status' => 'A',
'get_conditions' => true,
);
list($fields, $join, $condition) = fn_get_products($params);
db_query('SELECT SQL_CALC_FOUND_ROWS 1 FROM ?:products AS products' . $join . ' WHERE 1 ' . $condition . 'GROUP BY products.product_id');
$general_stats['products']['total_products'] = db_get_found_rows();
$params = array(
'only_short_fields' => true, // NOT NEEDED AT ALL BECAUSE WE DONT USE RESULTING $FIELDS
'extend' => array('companies', 'sharing'),
'status' => 'D',
'get_conditions' => true,
);
list($fields, $join, $condition) = fn_get_products($params);
db_query('SELECT SQL_CALC_FOUND_ROWS 1 FROM ?:products AS products' . $join . ' WHERE 1 ' . $condition . 'GROUP BY products.product_id');
$general_stats['products']['disabled_products'] = db_get_found_rows();
$params = array(
'amount_to' => 0,
'tracking' => array(
ProductTracking::TRACK_WITHOUT_OPTIONS, ProductTracking::TRACK_WITH_OPTIONS,
),
'get_conditions' => true,
);
$params['extend'][] = 'companies';
if (fn_allowed_for('ULTIMATE')) {
$params['extend'][] = 'sharing';
}
list($fields, $join, $condition) = fn_get_products($params);
db_query('SELECT SQL_CALC_FOUND_ROWS ' . implode(', ', $fields) . ' FROM ?:products AS products' . $join . ' WHERE 1 ' . $condition . ' GROUP BY products.product_id');
$general_stats['products']['out_of_stock_products'] = db_get_found_rows();
$params = array(
'amount_from' => 0,
'tracking' => array(
ProductTracking::TRACK_WITHOUT_OPTIONS, ProductTracking::TRACK_WITH_OPTIONS,
),
'get_conditions' => true,
);
$params['extend'][] = 'companies';
if (fn_allowed_for('ULTIMATE')) {
$params['extend'][] = 'sharing';
}
list($fields, $join, $condition) = fn_get_products($params);
db_query('SELECT SQL_CALC_FOUND_ROWS ' . implode(', ', $fields) . ' FROM ?:products AS products' . $join . ' WHERE 1 ' . $condition . ' GROUP BY products.product_id');
$general_stats['products']['all_products'] = db_get_found_rows();
$params = array(
'amount_from' => 1,
'tracking' => array(
ProductTracking::TRACK_WITHOUT_OPTIONS, ProductTracking::TRACK_WITH_OPTIONS,
),
'get_conditions' => true,
);
$params['extend'][] = 'companies';
if (fn_allowed_for('ULTIMATE')) {
$params['extend'][] = 'sharing';
}
list($fields, $join, $condition) = fn_get_products($params);
db_query('SELECT SQL_CALC_FOUND_ROWS ' . implode(', ', $fields) . ' FROM ?:products AS products' . $join . ' WHERE 1 ' . $condition . ' GROUP BY products.product_id');
$general_stats['products']['in_stock_products'] = db_get_found_rows();
}
//* Products - The Tool *//
/design/backend/templates/addons/my_changes/hooks/index/index.override.tpl - Add the following:
{hook name="index:index"}
{hook name="index:finance_statistic"}
{if !empty($orders_stat.orders)}
{__("orders")}
{if $user_can_view_orders}
{$orders_stat.orders|count}
{else}
{$orders_stat.orders|count}
{/if}
{$orders_stat.prev_orders|count}, {if $orders_stat.diff.orders_count > 0}+{/if}{$orders_stat.diff.orders_count}
|
{/if}
{if !empty($orders_stat.orders_total)}
{__("sales")}
{include file="common/price.tpl" value=$orders_stat.orders_total.totally_paid}{include file="common/price.tpl" value=$orders_stat.prev_orders_total.totally_paid}, {if $orders_stat.orders_total.totally_paid > $orders_stat.prev_orders_total.totally_paid}+{/if}{$orders_stat.diff.sales nofilter}%
|
{/if}
{if !empty($orders_stat.taxes)}
{__("taxes")}
{include file="common/price.tpl" value=$orders_stat.taxes.subtotal}{include file="common/price.tpl" value=$orders_stat.taxes.prev_subtotal}, {if $orders_stat.taxes.subtotal > $orders_stat.taxes.prev_subtotal}+{/if}{$orders_stat.taxes.diff nofilter}%
|
{/if}
{if !empty($orders_stat.abandoned_cart_total)}
{__("users_carts")}
{$orders_stat.abandoned_cart_total|default:0}{$orders_stat.prev_abandoned_cart_total|default:0}, {if $orders_stat.abandoned_cart_total > $orders_stat.prev_abandoned_cart_total}+{/if}{$orders_stat.diff.abandoned_carts nofilter}%
|
{/if}
{/hook}
{function name="get_orders" limit=5}
{$params = ['status' => $status, 'time_from' => $time_from, 'time_to' => $time_to, 'period' => 'C']}
{$orders = $params|fn_get_orders:$limit}
{/function}
{if !empty($order_statuses)}
{__("recent_orders")}
{get_orders status=""}
{foreach from=$order_statuses item="status"}
{get_orders status=$status.status}
{/foreach}
{/if}
{if !empty($graphs)}
{__("statistics")}
{capture name="chart_tabs"}
{hook name="index:chart_statistic"}
{/hook}
{/capture}
{include file="common/tabsbox.tpl" content=$smarty.capture.chart_tabs}
{/if}
{if !empty($general_stats.products)}
|
|
{__("out_of_stock_products")}
|
|
|
{/if}
{if !empty($general_stats.customers)}
{__("registered_customers")}
|
{/if}
{if !empty($general_stats.categories)}
|
{/if}
{if !empty($general_stats.companies)}
|
{/if}
{if !empty($general_stats.pages)}
|
{/if}
{hook name="index:order_statistic"}
{/hook}
{if $user_can_view_orders}
{__("order_by_status")}
{__("status")} |
{__("qty")} |
{__(total)} |
{__("shipping")} |
{/if}
{if "logs.manage"|fn_check_view_permissions:"GET"}
{__("recent_activity")}
{function name="show_log_row" item=[]}
{if $item}
{hook name="index:recent_activity"}
{$_type = "log_type_`$item.type`"}
{$_action = "log_action_`$item.action`"}
{__($_type)}{if $item.action} ({__($_action)}){/if}:
{if $item.type == "users" && "profiles.update?user_id=`$item.content.id`"|fn_url|fn_check_view_permissions:"GET"}
{if $item.content.id}
{/if}{$item.content.user}{if $item.content.id}{/if}
{elseif $item.type == "orders" && "orders.details?order_id=`$item.content.id`"|fn_url|fn_check_view_permissions:"GET"}
{$item.content.status}
{__("order")} {$item.content.order}
{elseif $item.type == "products" && "products.update?product_id=`$item.content.id`"|fn_url|fn_check_view_permissions:"GET"}
{$item.content.product}
{elseif $item.type == "categories" && "categories.update?category_id=`$item.content.id`"|fn_url|fn_check_view_permissions:"GET"}
{$item.content.category}
{/if}
{hook name="index:recent_activity_item"}{/hook}
{$item.timestamp|date_format:"`$settings.Appearance.date_format`, `$settings.Appearance.time_format`"}
{/hook}
{/if}
{/function}
{foreach from=$logs item="item"}
{show_log_row item=$item}
{/foreach}
{/if}
{/hook}
product_stats_2.jpg