Post by RBS » Wed Jun 23, 2010 3:04 pm

Hi,

Is it somehow possible to add the birth date column into the registration form?

Thanks!

Regards,
RBS

RBS
Newbie

Posts

Joined
Sat Jun 12, 2010 2:24 am

Post by alex.lin » Wed Jun 23, 2010 3:18 pm

add 'birth_date' filed to table customer:

Code: Select all

ALTER TABLE  `customer` ADD  `birth_date` DATE NULL AFTER  `fax`
and add the code in the catalog\view\theme\default\template\account\create.tpl

Code: Select all

    <tr>
            <td><span class="required">*</span> <?php echo $entry_t birth_date; ?></td>
            <td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" />
              <?php if ($error_birth_date) { ?>
              <span class="error"><?php echo $error_birth_date; ?></span>
              <?php } ?></td>
          </tr>
then add code in the catalog\language\english\account\create.php

Code: Select all

$_['entry_birth_date']      = 'Birthday:'; 
add code in the catalog\controller\account\create.php

Code: Select all

$this->data['entry_birth_date'] = $this->language->get('entry_birth_date');

if (isset($this->error['birth_date'])) {
            $this->data['error_birth_date'] = $this->error['birth_date'];
        } else {
            $this->data['error_birth_date'] = '';
}    

if (isset($this->request->post['birth_date'])) {
            $this->data['birth_date'] = $this->request->post['birth_date'];
        } else {
            $this->data['birth_date'] = '';
    } 
and remeber change editCustomer() and editCustomer in catalog\model\account\customer.php

Opencart Developer

- http://www.cnopencart.com opencart中文站


User avatar
Active Member

Posts

Joined
Thu Jun 03, 2010 12:15 am


Post by fido-x » Wed Jun 23, 2010 8:46 pm

Here's another little tweak you can add to this one.

Copy the "ui" folder from the "admin/view/javascript/jquery" directory to the "catalog/view/javascript/jquery" directory. Edit your "catalog/view/theme/YOUR_THEME/template/common/header.tpl" by inserting the following lines in the <head> section (before the closing </head>:-

Code: Select all

<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/ui/themes/ui-lightness/ui.all.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/ui.core.js"></script>
Then, change the following:-
alex.lin wrote:and add the code in the catalog\view\theme\default\template\account\create.tpl

Code: Select all

    <tr>
            <td><span class="required">*</span> <?php echo $entry_t birth_date; ?></td>
            <td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" />
              <?php if ($error_birth_date) { ?>
              <span class="error"><?php echo $error_birth_date; ?></span>
              <?php } ?></td>
          </tr>
to:

Code: Select all

    <tr>
            <td><span class="required">*</span> <?php echo $entry_t birth_date; ?></td>
            <td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" size="12" id="dob" />
              <?php if ($error_birth_date) { ?>
              <span class="error"><?php echo $error_birth_date; ?></span>
              <?php } ?></td>
          </tr>
Then, at the end of this file, add the following before the footer:

Code: Select all

<script type="text/javascript" src="catalog/view/javascript/jquery/ui/ui.datepicker.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {
    $('#dob').datepicker({changeMonth: true, changeYear: true, yearRange: '-80:+0', dateFormat: 'yy-mm-dd'});
});
//--></script>

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by Codenamechicken » Mon Aug 02, 2010 5:58 pm

Small error here:

Code: Select all

<tr>
            <td><span class="required">*</span> <?php echo $entry_t birth_date; ?></td>
            <td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" />
              <?php if ($error_birth_date) { ?>
              <span class="error"><?php echo $error_birth_date; ?></span>
              <?php } ?></td>
</tr>
should be

Code: Select all

<tr>
            <td><span class="required">*</span> <?php echo $entry_birth_date; ?></td>
            <td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" />
              <?php if ($error_birth_date) { ?>
              <span class="error"><?php echo $error_birth_date; ?></span>
              <?php } ?></td>
</tr>


Posts

Joined
Mon Aug 02, 2010 2:58 pm

Post by silanli_53 » Sun Aug 29, 2010 2:26 am

How can I see the admin panel..?



Thanks
best regarts

Cafe Koltuk Çeşitleri

Laptop Sırt Çantası


User avatar
New member

Posts

Joined
Fri Feb 19, 2010 8:54 am


Post by ocnewby » Wed Jan 26, 2011 3:55 pm

I was doing the edits , and altho it was displaying the text entry box properly, in mySQL there was no birthdate being saved.

I didnt know what
"and remeber change editCustomer() and editCustomer in catalog\model\account\customer.php"
meant.
I figured it out. It means to edit that file and change the line to include the birth_date field insert.

$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int)$this->config->get('config_store_id') . "', birth_date = '" . $this->db->escape($data['birth_date']) . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', password = '" . $this->db->escape(md5($data['password'])) . "', newsletter = '" . (int)$data['newsletter'] . "', customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");

Once i did that the "customers" sql table now includes the birth_date field properly filled in.

Newbie

Posts

Joined
Sat Jan 22, 2011 2:37 pm

Post by ocnewby » Sat Jan 29, 2011 11:14 am

Let me just state that if you add fields like birth_date to the database then that leaves you with problems when db revisions come in subsequent OC releases. But this is a test setup so I don't mind messing it up.

Once the mySQL tables are being properly updated you will not see the birthdate field being displayed anywhere in OC.

To add the view to the admin panel you must make a number of edits.

have to edit
system/library/customer.php

after private $address_id;
add private $birth_date;

after $this->fax = $customer_query->row['fax'];
add $this->birth_date = $customer_query->row['birth_date'];

after $this->fax = $customer_query->row['fax'];
add $this->birth_date = $customer_query->row['birth_date'];

after $this->fax = '';
add $this->birth_date = '';

after public function getTelephone() {
return $this->telephone;
}

add public function getBirth_date() {
return $this->birth_date;
}
--
store/admin/view/template/sale/customer_form.tpl
edit:

after <table class="form">


add

<tr>
<td><?php echo $entry_birth_date; ?></td>
<td><input type="text" name="birth_date" value="<?php echo $birth_date; ?>" /></td>
</tr>

===

/admin/controller/sale/customer.php


after $this->data['entry_fax'] = $this->language->get('entry_fax');
add $this->data['entry_birth_date'] = $this->language->get('entry_birth_date');


after if (isset($this->request->post['fax'])) {
$this->data['fax'] = $this->request->post['fax'];
} elseif (isset($customer_info)) {
$this->data['fax'] = $customer_info['fax'];
} else {
$this->data['fax'] = '';
}

add if (isset($this->request->post['birth_date'])) {
$this->data['birth_date'] = $this->request->post['birth_date'];
} elseif (isset($customer_info)) {
$this->data['birth_date'] = $customer_info['birth_date'];
} else {
$this->data['birth_date'] = '';
}


===
/admin/language/english/sale/customer.php


$_['entry_fax'] = 'Fax:';
$_['entry_birth_date'] = 'Birth_date:';


= = = = = =

Please note that these edits don't allow you to correct an incorrect birthdate entry. It will only allow you to view what was input into the table previously.
To make edits from the customer view in admin you would have to edit the sql statement in model to include an UPDATE for the corrected entry.

WHew! that was fun. :crazy:

Newbie

Posts

Joined
Sat Jan 22, 2011 2:37 pm

Post by bajaber » Mon Jan 31, 2011 6:22 pm

Great! Am going to try this tonight.

New member

Posts

Joined
Mon Dec 27, 2010 9:08 pm

Post by AndreasG » Tue Feb 22, 2011 9:19 pm

The above code.
If I want to use three fields instead of one, select box for Year, Month and Day, how would you modify it then?

Thanks!

Andreas

New member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by oliviargi » Sun Apr 17, 2011 2:55 pm

thanks i will try this

Newbie

Posts

Joined
Thu Mar 31, 2011 8:58 am

Post by Lamiaa » Fri Apr 22, 2011 2:53 am

fido-x
u r great :)
I was looking for this solution to add delivry date in my form.. I tried alot for a week to know how to add pop up datepicker but I didn't understand how to implement it from jquiry site or any other sites, specially I'm beginner and I'm not proggrammer , I just own a website using this great and fabouls Opencart by my webdesigner but he suddenly dissappeared so that I should make every thing by my self. also at first I tried your solution but by adding the code of the javascript in admin coupon form for start and end date with replacing start date to deliverydate and deleting the line for end date but it didn't work. I don't know why but with yor code it works well with me, may be because another codes in admin page.
you don't know how much I appreciate this post

proudly the result appear here:
http://limaregygifts.com/index.php?rout ... est_step_2

by the way just a note for people who serches like me for such tool , it should changed in files as Codenamechicken ,ocnewby and alex.lin said and also in model files.
thaaanx alot for all who really help

Newbie

Posts

Joined
Sat Apr 02, 2011 11:53 am

Post by enzoprinting » Tue Jul 05, 2011 12:25 am

i would like to put 2 more rows and i don't understand how. i need to put a field (not req.) 13 numbers after "Last Name" and field "VAT Reg. ID"(not req if not company). how can i do this?

thanks

Newbie

Posts

Joined
Tue Jul 05, 2011 12:18 am

Post by Angelheart29 » Fri Jan 06, 2012 5:21 am

Hello,

I'm working on a website and i wanted to add datepicker on registration form.

I follow the steps above (fido), but the calendar doesn't appear... I have modified links, js, css and other... But nothing.

I'm working with Opencart 1.5.1.3

Any Idea ?
Last edited by Angelheart29 on Tue Jan 10, 2012 3:19 am, edited 1 time in total.

Newbie

Posts

Joined
Fri Jan 06, 2012 5:12 am

Post by straightlight » Mon Jan 09, 2012 11:26 pm

Here's a VQMod version of this.

From PHPMyAdmin, in the SQL tab under your OpenCart database, use the following query:

Code: Select all

ALTER TABLE oc_customer ADD dob VARCHAR(16) NOT NULL;
Note: Change: oc_ to the appropriate prefix name if invalid.

Attachments

Customers Birthday with DatePicker from admin - > sales - > customers and catalog - > register.

Last edited by straightlight on Wed Jan 18, 2012 8:17 am, edited 2 times in total.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Tue Jan 10, 2012 12:16 am

Some corrections were made from my XML above. Those who downloaded before will need to re-download it.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by maurotto » Tue Jan 17, 2012 10:35 pm

straightlight wrote:Some corrections were made from my XML above. Those who downloaded before will need to re-download it.
hi
i get this error in vqmod.log

REQUEST URI : /index.php?route=account/register
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------


---------- Date: 2012-01-17 15:32:54 ~ IP : ----------
REQUEST URI : /index.php?route=information/contact/captcha
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------


---------- Date: 2012-01-17 15:32:54 ~ IP : ----------
REQUEST URI : /index.php?route=account/register/zone&country_id=105&zone_id=
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------


---------- Date: 2012-01-17 15:33:03 ~ IP : ----------
REQUEST URI : /index.php?route=account/register
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------


---------- Date: 2012-01-17 15:33:04 ~ IP : ----------
REQUEST URI : /index.php?route=information/contact/captcha
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------


---------- Date: 2012-01-17 15:33:04 ~ IP : ----------
REQUEST URI : /index.php?route=account/register/zone&country_id=105&zone_id=
DOM UNABLE TO LOAD: /home/mhd-01/www.xxxx.com/htdocs/vqmod/xml/customers_birthday.xml
----------------------------------------------------------------------

Newbie

Posts

Joined
Mon Dec 12, 2011 2:48 am

Post by straightlight » Tue Jan 17, 2012 10:41 pm

Are you using other XML files that requires modifications to the registration page ?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by maurotto » Wed Jan 18, 2012 12:26 am

Yes

Newbie

Posts

Joined
Mon Dec 12, 2011 2:48 am

Post by straightlight » Wed Jan 18, 2012 12:28 am

Possibly a tracking conflict between multiple XML, obviously.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by maurotto » Wed Jan 18, 2012 12:36 am

Ok

Newbie

Posts

Joined
Mon Dec 12, 2011 2:48 am
Who is online

Users browsing this forum: No registered users and 6 guests