Customer Store Credits

Hide Account Module - Customer Store Credits

Hide Account Module

by heatherbell » Thu Sep 19, 2024 12:01 pm

In case of help to others.
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',
                ];
            }
        }
    }
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Contact:

Re: Hide Account Module

by frankl » Fri Sep 20, 2024 6:14 am

Might be better to have an on/off setting in the config (which I will do)
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Contact:

Re: Hide Account Module

by heatherbell » Fri Sep 20, 2024 6:50 am

frankl wrote:Might be better
Definitely better :+1:
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Contact: