Jump to content

Insert Value into DB from php file


democolis

Recommended Posts

Hello,

 

I am try to add an input in product page and save this value in my database of prestashop. I want to appear that value in my BO also in front end.

 

I have made this files:

 

product.tpl:

 

<div>
 
<input id="com" type="text" name="com" class="text form-control" placeholder="Custom Message:"/>
 
</div>
 
ProductController.php:
 
public function getMessage()
{
if (Tools::getValue('com'))
{
$com = Tools::getValue('com');
$sql = "UPDATE `"._DB_PREFIX_."orders` SET com=".$com."";
Db::getInstance()->Execute($sql);
$this->context->smarty->assign('com', $com);
}
}
 
I make an order but in my db there is no value for 'com'. What i am doing wrong?
 
Thanks

 

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...