Post by EttlesEssentialKit » Sun Sep 22, 2013 8:04 pm

So, What this does is add the following field to the registration page.

Image

This field also appears in the Admin customer section so you can see who refered who.

i created this so that i could award people reward points for referring people to the store whoever this still has to be done manually, so you can technically use it for what ever you want. so the code.

File 1 path
.../catalog/view/theme/default/template/account/register.tpl
Part one

Code: Select all

<tr>
          <td><?php echo $entry_referer; ?></td>
          <td><input type="text" name="referer" value="<?php echo $referer; ?>" /></td>
        </tr> 
File 2 path
.../catalog/model/account/customer.php
Part one

Code: Select all

 "', referer = '" . $this->db->escape($data['referer']) . 
Part two

Code: Select all

 $message .= $this->language->get('text_referer') . ' ' . $data['referer'] . "\n"; 
Part three

Code: Select all

 "', referer = '" . $this->db->escape($data['referer']) . 
File 3 path
.../catalog/controller/account/register.php
Part one

Code: Select all

$this->data['entry_referer'] = $this->language->get('Referers Email:');  
That Last "referer's email" is the name thats appears next to the field on the store front
Part two

Code: Select all

if (isset($this->request->post['referer'])) {
    		$this->data['fax'] = $this->request->post['referer'];
		} else {
			$this->data['referer'] = '';
		}  
So that place's the field onto the store front. now we need to place it on the admin area.

File 4 path
.../admin/view/template/sale/customer_form.tpl
Part one

Code: Select all

 <tr>
                <td><?php echo $entry_referer; ?></td>
                <td><input type="text" name="referer" value="<?php echo $referer; ?>" /></td>
              </tr> 
File 5 path
.../admin/model/sale/customer.php
Part one

Code: Select all

 "', referer = '" . $this->db->escape($data['referer']) . 
Part two

Code: Select all

  "', referer = '" . $this->db->escape($data['referer']) . 
#

File 6 path
../admin/controller/sale/customer.php
Part one

Code: Select all

 $this->data['entry_referer'] = $this->language->get('entry_referer'); 
Part two

Code: Select all

 if (isset($this->request->post['referer'])) {
      		$this->data['referer'] = $this->request->post['referer'];
    	} elseif (!empty($customer_info)) { 
			$this->data['referer'] = $customer_info['referer'];
		} else {
      		$this->data['referer'] = ''; 
Part three

Code: Select all

'referer'           => $result['referer'],  
So now we have created the field we need to give it somewhere to save, so we open our PHP managment program
and find our customer data base and add the field


Posts

Joined
Fri Sep 06, 2013 10:20 pm
Who is online

Users browsing this forum: No registered users and 1 guest