Code: Select all
ALTER TABLE `customer` ADD `birth_date` DATE NULL AFTER `fax`
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>
Code: Select all
$_['entry_birth_date'] = 'Birthday:';
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'] = '';
}
Opencart Developer
- http://www.cnopencart.com opencart中文站
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>
to:alex.lin wrote:and add the code in the catalog\view\theme\default\template\account\create.tplCode: 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>
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>
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>
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!
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>
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>
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.
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.
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
thanks
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 ?
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;
Attachments
Customers Birthday with DatePicker from admin - > sales - > customers and catalog - > register.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
histraightlight wrote:Some corrections were made from my XML above. Those who downloaded before will need to re-download it.
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
----------------------------------------------------------------------
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Users browsing this forum: No registered users and 101 guests