Jump to content

Adding A Question To Authentication Page


Recommended Posts

Hi

 

I would like to add the question "How did you hear about us?" when customers create an account. I did this by adding the question to the authentication.tpl and it now shows on the website, however it doesn't show the answer in the back office. How do I include this information in the customer profile on my back office.

 

Would really appreciate any advice

 

Thanks

Link to comment
Share on other sites

Hello

 

for that you need to make some changes .. the best will be to develop a module for that ^^

 

Well, here is the dirty way :> add a new line on your database with 2 columns : Client_ID & Hdyeau for example

 

declare a new variable in classes and manage to send it to database when it is filled by the client and his registration complete.

 

Now to be able to see that info without using phpmyadmin you need to modify the backoffice files of products display to show that new variable.

 

something like this should work.. but doing it on a nice way with a special hook for that will be much better.. for avoiding updates problems mostly.

 

Best Regards,

Zen

 

PS: sorry for my bad english

Link to comment
Share on other sites

Hi flagrags,

We took a look at this for you, and as ZenGraph mentioned above, you still need to declare your "heard" variable for it to be properly written into your database. Right now, that piece of code is calling for a variable that has not yet defined, and since PrestaShop never studied Algebra, it isn't really configured to "Solve for X" :P.

 

In this case, what you will need to do is declare it in your classes/customer.php file, so that your site knows where to look when it is presented with the "heard" variable.

 

I hope this helps.

 

-Mike

Link to comment
Share on other sites

Hi

 

Ok have gone into the customer.php file. I added:

 

 

/** @var string Heard */

public $heard;

 

But still not showing in my back office. Do I need to add something to this section too:

 

 

public function getFields()

{

parent::validateFields();

if (isset($this->id))

$fields['id_customer'] = intval($this->id);

$fields['secure_key'] = pSQL($this->secure_key);

$fields['id_gender'] = intval($this->id_gender);

$fields['id_default_group'] = intval($this->id_default_group);

$fields['lastname'] = pSQL($this->lastname);

$fields['firstname'] = pSQL($this->firstname);

$fields['birthday'] = pSQL($this->birthday);

$fields['email'] = pSQL($this->email);

 

Thanks!

Link to comment
Share on other sites

hello again flagrags

 

it seems that you don't really know how php/mysql works and how to deal with that.. so I recommand you to use this module that Wingz show up above.

That will be the Best Solution for you and others, you don't have to touch the core that way, and all the job is already done !

 

Best regards,

Zen

Link to comment
Share on other sites

  • 4 months later...
  • 7 months later...
×
×
  • Create New...