You will need MySql Knowledge and some php knowledge
Step 1.
First thing first, add your new fields to the product table in the database - this should be the easy part.
Step 2.
Open up product.php in admin/controller/catalog, you will want to copy and paste this piece of code. inside the getForm functions, (around line 707)
Code: Select all
if (isset($this->request->post['Table Name'])) {
$this->data['Table Name'] = $this->request->post['Table Name'];
} elseif (isset($product_info)) {
$this->data['Table Name'] = $product_info['Table Name'];
} else {
$this->data['Table Name'] = '';
}
Code: Select all
$this->data['entry_table name'] = $this->language->get('entry_table name');
For every field you want, copy and paste that code.
Step 3.
Open up the product_form.tpl file locate admin/view/template/catalog/.
This is pretty easy, just find a spot in the table and plug in your form fields. Look for the tab makers to tell what page you are adding to.
Code: Select all
<div id="tab-data">
I will give a couple of examples, here is a drop down
Code: Select all
<tr>
<td><?php echo $entry_Table Name; ?></td>
<td><select name="Table Name">
<?php foreach ($Table Names as $Table Name) { ?> // This is just looping over an array I built in the previouse page (step 2) and now loops here
<?php if ($Table Name['Table Name_id'] == $Table Name) { ?>
<option value="<?php echo $Table Name['Table Name_id']; ?>" selected="selected"><?php echo $Table Name['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $Table Name['Table Name_id']; ?>"><?php echo $Table Name['name']; ?></option>
<?php } ?>
<?php } ?>
</select></td>
</tr>
Code: Select all
<tr>
<td><?php echo $entry_Table name; ?></td>
<td><input type="text" name="Table name" value="<?php echo $Table name; ?>" /></td>
</td>
</tr>
Now open up the product.php in admin/language/english/catalog/
Add an entry
Code: Select all
$_['entry_Table Name'] = 'Descripton of field:';
Here is the tricky part, you will have to edit 2 queries in admin/model/catalog/product.php.
You want to edit in 2 places:
Code: Select all
public function addProduct($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', artist = '" . $this->db->escape($data['artist']) . "', bioLink = '" . $this->db->escape($data['bioLink']) . "', relatedCategory = '" . $this->db->escape($data['relatedCategory']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
and here:
Code: Select all
public function editProduct($product_id, $data) {
$this->db->query("UPDATE " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', sku = '" . $this->db->escape($data['sku']) . "', artist = '" . $this->db->escape($data['artist']) . "', bioLink = '" . $this->db->escape($data['bioLink']) . "', relatedCategory = '" . $this->db->escape($data['relatedCategory']) . "', upc = '" . $this->db->escape($data['upc']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . (int)$data['tax_class_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
Now that the admin side is done, we have to get this information on the other side... the user side.
Step 1.
Open up product.php in catalog/controller/product.
Add your language lines like so (around line 139)
Code: Select all
$this->data['entry_table name'] = $this->language->get('entry_table name');
Code: Select all
$this->data['table name'] = $product_info['table name'];
Open Up product.php in catalog/language/english/product/
Add your new names
Code: Select all
$_['text_table name'] = 'table name';
Step 3.
Open product.php in catalog/model/catalog/
Update the getProduct function, the mysql statement on line 14. Your prefix for your table names will be p.table name
Then add your entries to the array on line 18
Code: Select all
'table name' => $query->row['table name'],
Add your fields to the product page in your template.
Finished
Cheers