Jump to content

Assign variable to smarty


Drukpa

Recommended Posts

I have added some more fields to the User Registration page, and have successfully inserted those field values into the database. I have set customer active to 0 as I want to manually activate each customer.

 

Now, when the customer fills out the page and registers, it takes him back to the authentication page where he can log in. I want some messages show on the top of the page like how the errors are displayed.

 

Eg; in the authController I have the following code:

 

$someVariable = 2323;

self::smarty->assign('variable_name', $someVariable);

 

And in the authentication.tpl file, i have added.

 

{if isset($variable_name)}

Variable value = {$variable_name}

{/if}

 

But, I am not getting the variable displayed. How do I make it work?

 

Thanks.

Link to comment
Share on other sites

Yes, am using PS 1.4 and I have set $customer->active = 0

 

When user registers, it shows the login/signup form again and nothing else. I want some information to be displayed on that page, something which gives a clue to the customer saying that his account has been registered, but will be approved by the administrator shortly.

Link to comment
Share on other sites

Yes, am using PS 1.4 and I have set $customer->active = 0

 

When user registers, it shows the login/signup form again and nothing else. I want some information to be displayed on that page, something which gives a clue to the customer saying that his account has been registered, but will be approved by the administrator shortly.

Well maybe you can edit the AuthController.php and use if $customer->active == 0 then redirect some php and display information like you mentioned, in AuthController.php search this code below:

public function preProcess()
{
 parent::preProcess();
 if (self::$cookie->isLogged() AND !Tools::isSubmit('ajax'))
  Tools::redirect('my-account.php');

 

And you can use a code maybe like this:

 if (self::$cookie->isLogged() AND !Tools::isSubmit('ajax'))
 {
  if ($customer->active == 0) //Ask if active is 0
   Tools::redirect('AccountDeactivated.php'); //Here you need create this php in your "/public_html/" with the inrformation you need display
  else
   Tools::redirect('my-account.php');
 }

You need create the file "AccountDeactivated.php" in "/public_html/", and insert the information you need show, there is many examples in web

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...