Page 1 of 1

HELP! address.tpl modify, but get error!

Posted: Wed May 25, 2011 7:49 pm
by bj9421
Hi All

Here is my site: http://tuneup.com.tw/o1495o/
My frist mod create.tpl in my site, and it work,
but after edit those files
\catalog\view\theme\default\template\account\address.tpl
\catalog\model\account\address.php
\catalog\controller\account\address.php

In Home > Account > Address Book
I try to edit or add new address still get error

Could you try it and show me how to do it right?
Thanks a lot

Re: HELP! address.tpl modify, but get error!

Posted: Fri May 27, 2011 2:10 am
by bj9421
I tried to edit /catalog/model/account/address.php, line 6-21
still got error message:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', firstname = 'James Bond', address_1 = 'No.007 Moonraker', postcode = '007' WH' at line 1
Error No: 1064
UPDATE ', firstname = 'James Bond', address_1 = 'No.007 Moonraker', postcode = '007' WHERE address_id = '8' AND customer_id = '7'

Code: Select all

$address_id = $this->db->getLastId();
		
		if (isset($data['default']) && $data['default'] == '1') {
			$this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int)$address_id . "' WHERE customer_id = '" . (int)$this->customer->getId() . "'");
		}
		
		return $address_id;
	}
	
	public function editAddress($address_id, $data) {
		$this->db->query("UPDATE " . DB_PREFIX ./* "address SET company = '" . $this->db->escape($data['company']) .*/ "', firstname = '" . $this->db->escape($data['firstname']) ./* "', lastname = '" . $this->db->escape($data['lastname']) .*/ "', address_1 = '" . $this->db->escape($data['address_1']) ./* "', address_2 = '" . $this->db->escape($data['address_2']) .*/ "', postcode = '" . $this->db->escape($data['postcode']) ./* "', city = '" . $this->db->escape($data['city']) . "', zone_id = '" . (int)$data['zone_id'] . "', country_id = '" . (int)$data['country_id'] .*/ "' WHERE address_id = '" . (int)$address_id . "' AND customer_id = '" . (int)$this->customer->getId() . "'");
	
		if (isset($data['default']) && $data['default'] == '1') {
			$this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int)$address_id . "' WHERE customer_id = '" . (int)$this->customer->getId() . "'");
		}
	}
I'm not good at coding, so HELP me please.... ???