Community Forums

Discuss, share and get help from our community of friendly WHMCS users

Close
Login to Your Account
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2010
    Location
    Kent, UK
    Posts
    1,182

    Default If statement/link to the WHMCS marketplace connect pages

    Hello there,

    I'm wondering if anyone has a if statement & markup that can be used to link to the WHMCS marketplace connect pages (email, website builder, SSL certs).

    This will be used within a WHMCS template only.

    Thanks.

  2. #2
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    an if statement in what sense - to see if the feature is enabled?

    I know you can link to them directly using the following method...

    index.php?rp=/store/email-service
    index.php?rp=/store/ssl-certificates
    index.php?rp=/store/website-builder

    and depending on the friendly urls setting, i've seen /store/website-builder used too... though even with that enabled, index.php?rp=/store/website-builder still redirects to the correct page.

  3. #3
    Join Date
    Jul 2010
    Location
    Kent, UK
    Posts
    1,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by brian! View Post
    an if statement in what sense - to see if the feature is enabled?

    I know you can link to them directly using the following method...

    index.php?rp=/store/email-service
    index.php?rp=/store/ssl-certificates
    index.php?rp=/store/website-builder

    and depending on the friendly urls setting, i've seen /store/website-builder used too... though even with that enabled, index.php?rp=/store/website-builder still redirects to the correct page.
    Yes that's correct Brian, a if statement if they are enabled.

    Then a way to pull the URLs based on the users friendly URL settings.

    Cheers

  4. #4
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by zomex View Post
    Yes that's correct Brian, a if statement if they are enabled.
    Then a way to pull the URLs based on the users friendly URL settings.
    as I don't have MC enabled, I can't really help with the first... i'd be tempted to think there wouldn't be a Smarty variable to show whether any are enabled or not - though {debug} will be your friend there... I suppose you could query the primary navbar array and see if they're mentioned in there, but that may not be definitive.... there's also a marketconnect_services table, but i'm not sure what it would contain... if you find a way, let us know!

    the Friendly URLS is slightly easier in the sense that it's value is stored in the configuration table (RouteUriPathMode) - and can therefore be accessed by an action hook... I doubt the value is passed to the Smarty template, so a hook might be the only viable way to know for certain.

    Full Friendly -> rewrite
    Friendly -> acceptpathinfo
    Basic -> basic

    you can then base your IF statement on those values and adjust the urls accordingly.

  5. #5
    Join Date
    Jul 2010
    Location
    Kent, UK
    Posts
    1,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by brian! View Post
    as I don't have MC enabled, I can't really help with the first... i'd be tempted to think there wouldn't be a Smarty variable to show whether any are enabled or not - though {debug} will be your friend there... I suppose you could query the primary navbar array and see if they're mentioned in there, but that may not be definitive.... there's also a marketconnect_services table, but i'm not sure what it would contain... if you find a way, let us know!

    the Friendly URLS is slightly easier in the sense that it's value is stored in the configuration table (RouteUriPathMode) - and can therefore be accessed by an action hook... I doubt the value is passed to the Smarty template, so a hook might be the only viable way to know for certain.

    Full Friendly -> rewrite
    Friendly -> acceptpathinfo
    Basic -> basic

    you can then base your IF statement on those values and adjust the urls accordingly.

    Thanks Brian.

    I haven't been able to get this working yet, I hope WHMCS in a new version will make variables available for this.

  6. #6
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by zomex View Post
    I haven't been able to get this working yet, I hope WHMCS in a new version will make variables available for this.
    so curiosity got the better of me on this, and I decided to take a closer look... I had to enable MarketConnect on the dev *shudders* - as an aside, having now seen it close up, I still wouldn't touch it with a bargepole. Click image for larger version. 

Name:	43.gif 
Views:	38 
Size:	7.3 KB 
ID:	14458

    it turns out what I said previously was correct - tblmarketconnect_services is the source of the information you need - basically, if one of the marketconnect services is enabled in there, it's 'status' value will be '1', if it's not been enabled before, it won't exist in the table and if it's been enabled and later disabled, the value will be '0'... so armed with that, I can then do this...
    PHP Code:
    <?php

    # Create Market Connect Links for Zomex.
    # Written by brian!

    use Illuminate\Database\Capsule\Manager as Capsule;

    function 
    zomex_marketconnect_hook($vars)
    {
        global 
    $CONFIG;    
        
    $friendlyurl $CONFIG['RouteUriPathMode'];
        
        if (
    $friendlyurl == 'acceptpathinfo') {
            
    $urlpath 'index.php/store/';
        }
        elseif (
    $friendlyurl == 'rewrite') {
            
    $urlpath 'store/';
        }
        elseif (
    $friendlyurl == 'basic') {
            
    $urlpath 'index.php?rp=/store/';
        }
        
        
    $marketconnect Capsule::table('tblmarketconnect_services')->where('status''1')->get();
        
        if (
    count($marketconnect)) {

            foreach (
    $marketconnect as $service) {
                if (
    $service->name == 'spamexperts') {
                    
    $spamexpertslink $urlpath.'email-services';
                }
                elseif (
    $service->name == 'symantec') {
                    
    $symanteclink '<a href="'.$urlpath.'ssl-certificates">'.Lang::trans('navMarketConnectService.symantec').'</a>';
                }    
                if (
    $service->name == 'weebly') {
                    
    $weeblylink '<a class="btn-sm btn-warning" href="'.$urlpath.'website-builder'.'" target="_blank">'.Lang::trans('navMarketConnectService.weebly').'</a>';
                }
            }
            return array(
    "spamexpertslink" => $spamexpertslink"symanteclink" => $symanteclink"weeblylink" => $weeblylink);
        }
    }
    add_hook("ClientAreaPage"1"zomex_marketconnect_hook");
    with that, you'll get 3 new Smarty variables on every client page (including cart) in WHMCS - each containing a specific link for each service, formatted based on the current Friendly URLs value.

    btw technically, you could possibly trim that foreach down by using variable variables, but I don't think you'd really gain anything in the short-term by doing that, and also the way i've done it as above, should be easier for others to follow.... long-term, it might be something worth me revisiting if WHMCS continue to add more services to the MarketConnect platform (though as I suspect the specific service URLs are hard-coded and not pulled from somewhere, that may be pointless)... anyway, you could easily expand the current IF statement to cover all eventualities as services are added/removed.

    as you can see from the above code, these links are not all constructed in the same way - as I didn't know exactly what you intended to use them for, i've given you three flavours to work with as each service gives a slightly different output...

    {$spamexpertslink} -> would just output the URL for spamexperts.
    {$symanteclink} -> outputs a normal <a href> link for symantec ssl certs.
    {$weeblylink} - outputs an orange bootstrap button that opens in a new window/tab for weebly website builder.


    obviously, all 3 should use the same format - but i'll leave it to you to choose what you want to do with them!

    a few other things to note...

    1. if MarketConnect is not enabled (or if it is but all 3 services are deactivated), then the query will be empty and the 3 Smarty variables will not be created.
    2. if a specific MC service is not activated (e.g SpamExperts), then the Smarty variable generated will exist, but it's value will be NULL... that allows you to do something along the lines of the code below to test in the template if the MC service (spam, symantec or weebly) is active...
    PHP Code:
    {if $spamexperts}Spam Experts is active{else}it is not active{/if} 
    or if you only want to show a MC link if the specific service is available..
    PHP Code:
    {if $weeblylink}{$weeblylink}{/if} 
    btw - if it's used in your commercial templates, i'll look forward to receiving my share of your vastly increased sales!

    and with that, i'll be gone for the next few days as i'm having a belated birthday mini break (yes just as the heatwave ends!) - as far away from the internet, and MarketConnect, as humanly possible.

  7. #7
    Join Date
    Jul 2010
    Location
    Kent, UK
    Posts
    1,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Wow Brian I would like to thank you greatly for the time you put into helping me and the rest of the community out. Not just with this script but your overall passion and dedication to WHMCS and helping other users.

    I've implemented your script with just a few modifications and it's working perfectly:




    ----------

    Do you have a way I can donate money to you such as via PayPal?

    Or better yet if you PM me your address or PO box I would like to send you a gift as thanks for your help.

    PS: Enjoy your holiday!

    Thanks once again.

  8. #8
    Join Date
    Feb 2016
    Posts
    1

    Default Re: If statement/link to the WHMCS marketplace connect pages

    After enabling Marketplace nav-menu(Website & Security) had become dummy when a 3rd party WHMCS Theme is used how to integrate it. It works fine in inbuilt themes like "5" & "6". Help me

  9. #9
    Join Date
    Aug 2013
    Location
    Ontario, Canada
    Posts
    390

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by Nexgenhost View Post
    After enabling Marketplace nav-menu(Website & Security) had become dummy when a 3rd party WHMCS Theme is used how to integrate it. It works fine in inbuilt themes like "5" & "6". Help me
    Your third party theme needs to be updated to work with WHMCS 7.2.x
    Jason P
    Owner @ AffordableDomains.ca
    www.AffordableDomains.ca

  10. #10
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,182

    Default Re: If statement/link to the WHMCS marketplace connect pages

    Quote Originally Posted by Nexgenhost View Post
    After enabling Marketplace nav-menu(Website & Security) had become dummy when a 3rd party WHMCS Theme is used how to integrate it. It works fine in inbuilt themes like "5" & "6". Help me
    ADC is correct on this... if you're even mentioning 5 and 6, then it sounds as though it's an old theme that you're using... if there's an updated version available by the developer, use that - otherwise, you're looking at either employing a WHMCS integration expert to fix the theme for compatibility with current and future releases, or just abandoning the current template and moving on to a new theme compatible with the version of WHMCS you have.

Similar Threads

  1. Adding new pages to /store like in Market Connect
    By Snowman in forum Developer Corner
    Replies: 2
    Last Post: 05-23-17, 01:30 PM
  2. Market Connect Landing Pages
    By easyhosting in forum Using WHMCS
    Replies: 2
    Last Post: 05-20-17, 06:56 AM
  3. marketplace.whmcs.com
    By ChrisTERiS in forum General Discussion
    Replies: 2
    Last Post: 02-08-17, 02:51 PM
  4. WHMCS Marketplace Forum Rules
    By Matt in forum Service Offers & Requests
    Replies: 0
    Last Post: 04-05-11, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •