Jump to content

Hook variable


TGK

Recommended Posts

hi im trying to create a variable and then use it on Viewcart.tpl but im confuse   i know that im really wrong in something but maybe someone can give me a hand.
i want to check " is_verified" field from " tblclients" table. and i will create some " if statement"  in viewcart.tpl after it works fine

i would apreciate your help.

 

thanks
 

<?php

use Illuminate\Database\Capsule\Manager as Capsule;

function hook_verified_status($vars) 
{
   $verificado = Capsule::table('tblclients')
			->where('is_verified')

   return array("verificado" => $verificado);
}
add_hook('ViewCart', 1, "hook_verified_status");
?>

 

Link to comment
Share on other sites

1 hour ago, TGK said:

i want to check " is_verified" field from " tblclients" table. and i will create some " if statement"  in viewcart.tpl after it works fine

there is no "is_verified" field in tblclients... i'm assuming you mean "email_verified" ?

<?php

# Cart Email Verification Hook
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function email_verification_status_hook($vars) {
	$client = Menu::context("client");
	if ($client && $vars['templatefile'] == 'viewcart') {
		$verificado = Capsule::table('tblclients')->where('id',$client->id)->value('email_verified');
		return array("verificado" => $verificado);
	}
}
add_hook('ClientAreaPageCart', 1, 'email_verification_status_hook');
?>

that hook should give you one of three results.

  • if $verificado = 1, then the client has verified his email address.
  • if $verificado = 0, then the client has not verified his email address.
  • if $verificado does not exist, then the client is not logged in.

you can then use that $verificado variable in the template and decide what to do for each possible result.

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