Page 2 of 8
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 3:30 am
by WebDev22
Oh, and one of the four fields needs to be a checkbox?
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 2:56 pm
by WebDev22
I've spent most of the day bypassing the vQmod option and trying to customize each individual file to accommodate the new section and fields for registration. Since I don't work with databases all that much, it appears I'm in over my head, so I might return to trying to get this XML approach to work.
Has anyone used this approach to create a new section on the registration page with three text fields and one checkbox?
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 3:10 pm
by ckonig
Well I use this script to realize 2 different fields, by having two instances of this script, each one for its own field. So you could just use it three times for the text fields, and modify the fourth one to have a checkbox value. But will anyway need to have database fields prepared, so the information can be stored. But that should be easily done with PHPmyAdmin.
For having an actual separated section, it would be more handy to modify the one script to hold all four values.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 7:56 pm
by WebDev22
The team is insistent about having its own section, so I'm going to attempt setting this up without vQmod. I don't see any other way. This means having to go through each of the following files and modifying them accordingly:
admin/view/template/sale/customer_list.tpl
admin/view/template/sale/customer_form.tpl
admin/language/english/sale/customer.php
admin/model/sale/customer.php
admin/controller/sale/customer.php
system/library/customer.php
catalog/view/theme/default/template/account/edit.tpl
catalog/language/english/account/edit.php
catalog/controller/account/create.php
catalog/controller/account/edit.php
catalog/model/account/customer.php
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 8:39 pm
by ckonig
Well good luck with that!
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 9:36 pm
by WebDev22
I've got the front end built out and most of the back end as well, but cannot figure out why the data for the three new fields isn't being added to the database.
https://www.tanningbedlotionsdirect.com ... unt/create
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 10:04 pm
by ckonig
did you edit the models as well?
make sure that they get all data from the controller by replacing
Code: Select all
public function addCustomer($data) {
with
Code: Select all
public function addCustomer($data) {
print_r($data);die();
then try to add a customer and look if all data arrives in the model
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 10:21 pm
by WebDev22
Currently, I have this:
Code: Select all
class ModelSaleCustomer extends Model {
public function addCustomer($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET 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']) . "', salon = '" . $this->db->escape($data['salon']) . "', bed_model = '" . $this->db->escape($data['bed_model']) . "', bed_year = '" . $this->db->escape($data['bed_year']) . "', newsletter = '" . (int)$data['newsletter'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', password = '" . $this->db->escape(md5($data['password'])) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
Should I change it to this?
Code: Select all
class ModelSaleCustomer extends Model {
public function addCustomer($data) {
print_r($data);die();
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET 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']) . "', salon = '" . $this->db->escape($data['salon']) . "', bed_model = '" . $this->db->escape($data['bed_model']) . "', bed_year = '" . $this->db->escape($data['bed_year']) . "', newsletter = '" . (int)$data['newsletter'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', password = '" . $this->db->escape(md5($data['password'])) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 10:34 pm
by WebDev22
I keep getting this error and cannot figure out what I'm missing. For testing purposes, I changed the order in the SQL statement in catalog/model/account/customer.php, putting 'salon' second in line of the three new fields, and still get the same error:
Error: Unknown column 'salon' in 'field list'
Error No: 1054
INSERT INTO customer SET store_id = '0', firstname = 'John', lastname = 'Smith', email = '
johnsmith@tanningbedlotionsdirect.com', telephone = '770-555-5222', fax = '', salon = 'Acme Tanning', bed_model = 'Sunquest 24RS', bed_year = '2009', password = '070a66ab11415580790aa304b23bfb3e', newsletter = '0', customer_group_id = '8', status = '1', date_added = NOW()
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 10:36 pm
by ckonig
Unknown column 'salon' in 'field list' means that you will have to add a field with the name salon to your customer table.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 11:01 pm
by WebDev22
I forgot that I had changed naming conventions. I had 'salon_name' in the database originally, but had coded everything as 'salon'. So, now there are no errors and everything shows up properly in the database. I now need to get this information to appear in Admin under Sales > Customers. It doesn't have to appear on the main page. It's okay if it requires clicking "Edit" to view the information. Let me know if you know where to locate that.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 11:06 pm
by ckonig
admin/view/template/sale/customer_form.tpl : the customer detail view
admin/view/template/sale/customer_list.tpl : the customer list view
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Wed May 18, 2011 11:52 pm
by WebDev22
I added the following to customer_form.tpl, but get an error that reads: <b>Notice</b>: Undefined variable: salon in <b>/home/charley/public_html/admin/view/template/sale/customer_form.tpl</b> on line <b>108</b>. Any idea what I'm missing?
Code: Select all
<tr>
<td><?php echo $entry_salon; ?></td>
<td><input type="text" name="salon" value="<?php echo $salon; ?>" /></td>
</tr>
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu May 19, 2011 12:30 am
by WebDev22
WebDev22 wrote:I added the following to customer_form.tpl, but get an error that reads: <b>Notice</b>: Undefined variable: salon in <b>/home/charley/public_html/admin/view/template/sale/customer_form.tpl</b> on line <b>108</b>. Any idea what I'm missing?
Code: Select all
<tr>
<td><?php echo $entry_salon; ?></td>
<td><input type="text" name="salon" value="<?php echo $salon; ?>" /></td>
</tr>
Here's a screenshot of the error:

Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu May 19, 2011 1:33 am
by WebDev22
Still no fix. Maybe stepping away from it for a couple of hours will help. If anyone has any suggestions, please let me know. Thanks.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu May 19, 2011 2:15 am
by SXGuy
the error is exactly what it says it is. you havent defined the variable "salon" in the controller file associated with the view file.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu May 19, 2011 2:26 am
by WebDev22
I used the Fax variable as an example and added the bottom three rows below to catalog/controller/account/edit.php (Added Lines 55-57):
Code: Select all
$this->data['entry_firstname'] = $this->language->get('entry_firstname');
$this->data['entry_lastname'] = $this->language->get('entry_lastname');
$this->data['entry_email'] = $this->language->get('entry_email');
$this->data['entry_telephone'] = $this->language->get('entry_telephone');
$this->data['entry_fax'] = $this->language->get('entry_fax');
$this->data['entry_salon'] = $this->language->get('entry_salon');
$this->data['entry_bed_model'] = $this->language->get('entry_bed_model');
$this->data['entry_bed_year'] = $this->language->get('entry_bed_year');
I'm missing something, but can't figure out what it is.
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu May 19, 2011 5:03 am
by WebDev22
I figured it out. In the catalog/controller/accout/edit.php file, I had left these out:
Code: Select all
if (isset($this->request->post['salon'])) {
$this->data['salon'] = $this->request->post['salon'];
} elseif (isset($customer_info)) {
$this->data['salon'] = $customer_info['salon'];
} else {
$this->data['salon'] = '';
}
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Thu Jun 16, 2011 5:26 pm
by m3ndi3
Help! I have the upgraded Version 1.5 and there are no account/create.php files! Instead there are account/register.php files... I tried to just replace all create with register... but the vQmod didn't work... Can someone please update XML to work with new update?? Thank you!!
Re: [vQmod] Add new field to Registration Form,Frontend&Back
Posted: Fri Aug 05, 2011 2:45 pm
by SVN
I encounter a problem...
Notice: Undefined variable: column_expert_id in /vqmod/vqcache/vq-admin_view_template_sale_customer_list.tpl on line 33