Jump to content

How to wite into DB from an added field in product-address.tpl?


eFrancesco

Recommended Posts

Hello, 
I've read this topic but it seems not to work in PS 1.5.6.2
 

 

First of all I've added a column (text) to ps_message table in the database.
 

 

 

Then in order-address.tpl I've added the following line 

<p class="textarea"><textarea cols="60" rows="3" name="campo_custom"></textarea></p> 

right after the text area for customer message:

<p class="textarea"><textarea cols="60" rows="3" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea></p>


 

In class/Message.php I've changed the INSERT INTO statement this way:

INSERT INTO '._DB_PREFIX_.'message_readed (id_message , id_employee , date_add, campo_custom) VALUES 
			('.(int)$id_message.', '.(int)$id_employee.', NOW(),'.$campo_custom.'); 
		');

I've added the following line to public static $definition = array
(that can be found at about #58) (maybe the TYPE_STRING or its length could be not so good for my needs... but please note that I have to add 4 new fields and this is a test... I guess they will be INPUT TEXT)

'campo_custom' => 	array('type' => self::TYPE_STRING, 'validate' => 'isCampoCustom', 'size' => 600),

and I've declared this: 

public $campo_custom;


in Validate.php I've added this:

public static function isCampoCustom($campo_custom)
	{
		return !preg_match('/[<>{}]/i', $campo_custom);
	}


My campo_custom is still empty.
At the beginning (right before the code I've posted here) campo_custom used to stay "NULL" but after some managing it appears void but not null....

Any suggestion?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...