Jump to content

How to check for an Active Product by an Customer?


scysys

Recommended Posts

out of the box, you can't really - I suppose you could if say you added a link to the closed area in the clientareaproductdetails.tpl template for a PID 49 product because that page would have access to that variable... but that wouldn't help if the link became publicly known!

 

otherwise, you'd need to write an action hook that would query the database, see if the client has an active PID49 and if so, set a Smarty variable... then in your template, you can either see if the variable exists and if so add a link to the closed area... or use it in the closed area and check if the variable exists... if so, they can enter... if not, they're shown an error message.

 

the hook woudl be along the lines of...

 

<?php

use Illuminate\Database\Capsule\Manager as Capsule;

function closed_area_access_hook($vars) {

   $client = Menu::context('client'); 

   $allowaccess = Capsule::table('tblhosting')
                   ->where('userid',$client->id)
                   ->where('packageid','49')
                   ->where('domainstatus','Active')
                   ->count();

   if ($allowaccess > 0) {

       return array("allowaccess" => $allowaccess);
   }
}
add_hook("ClientAreaPage", 1, "closed_area_access_hook");
?> 

and then in your template, you can check if the variable exists...

 

{if $allowaccess}qualifying product exists{else}no access allowed{/if}

... and replace the outputted text with your links or redirection etc. :idea:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated