Customising MarketConnect Promotions and Upsells

From WHMCS Documentation

Revision as of 16:04, 17 May 2017 by Matt (talk | contribs) (Created page with "MarketConnect Promotions and Upsells content can be manipulated and modified using hooks. An example of such a hook is provided below. ==Installing the hook== To install th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MarketConnect Promotions and Upsells content can be manipulated and modified using hooks.

An example of such a hook is provided below.

Installing the hook

To install the hook, copy and paste the code below into a new file and save and upload it to the includes/hooks/ directory of your WHMCS installation.

<?php

add_hook('ClientAreaFooterOutput', 1, function() {
    return <<<EOF
<script>

var hashtable = {};
hashtable['Protect your website'] = 'Protect your domain';
hashtable['Included with your SSL certificate'] = 'What you get with your SSL Certificate';
hashtable['Display a security seal on your site'] = 'Display a site seal to add trust';

$(document).ready(function() {
    $('.promo-banner').each(function( index ) {
        var banner = $(this);
        $.each(hashtable, function( index, value ) {
            banner.html(banner.html().replace(index, value));
        });
    });
});
</script>
EOF;
});

How it works

The hook works by looping through each promotional banner displayed on the page and replacing all the given phrases with their replacement values.

You can add as many different search and replace values as you wish, simply by adding additional hashtable lines. Their format is as follows:

hashtable['Phrase to look for'] = 'Phrase to replace with';