To hide the Module on the Profile (account) page from Customers that have no Store Credit history, that is, it only shows to Customers that have been given Store Credit.
In our use case, our reasoning is that if every customer sees it, some will ask for it!
Change Lines 27-40 in /includes/modules/content/account/cm_account_store_credit.php to:
Code: Select all
$query = $GLOBALS['db']->query(sprintf("SELECT * FROM customers_store_credit WHERE customers_id = '%d'", (int)$_SESSION['customer_id']));
while($store_credit = $query->fetch_assoc()) {
if (isset($_SESSION['customer_id']) && $store_credit['credit'] !== null) {
$GLOBALS['Template']->_data['account']['store_credit'] = [
'title' => MODULE_CONTENT_ACCOUNT_STORE_CREDIT_LINK_TITLE,
'sort_order' => 100,
'links' => [],
];
$GLOBALS['Template']->_data['account']['store_credit']['links'][$this->group] = [
'title' => MODULE_CONTENT_ACCOUNT_STORE_CREDIT_SUB_TITLE,
'link' => $GLOBALS['Linker']->build('store_credit.php'),
'icon' => 'fa fa-money-check-dollar fa-5x',
];
}
}
}