Jump to content

How create new field in product with html suppport?


Kerm

Recommended Posts

Hello,

I want create new field in product with html suppport, i made one, but i can only put inside text or numbers, if i put html it dont safe info..

What i do:

First i have 1.4.0.17.

In AdminProducts.php i add field:

'.$this->l('Field 1').'  
<input type="text" name="price_prof" value="'.htmlentities($this->getFieldValue($obj, 'price_prof'), ENT_COMPAT, 'UTF-8').'" /> 

'.$this->l('Price-prof').' 



After in classes/product.php i add:

/** @var string price_prof */ 
   public  $price_prof;



where public function getFields() i add:

$fields['price_prof'] = psql($this->price_prof);



In my theme product.tpl i add:

{if not $product->price_prof==0}Field 1:

{$product->price_prof}
{/if}




In phpmyadmin, i add new field in ps_product table, with name price_prof with this parameters:

Type: TEXT, utf8_general_ci, NULL Yes, default NULL


As i say with numbers, text all ok. If i put html in field, it donst safe field info.

Link to comment
Share on other sites

To angora

Mate why u think that $ean13 field support "html special characters symbols" ?

Btw for this:


Find:

public function addProductAttribute(

and insert an argument for $prod_prof,

and

a few lines down, find
Db::getInstance()->AutoExecute(
and insert
‘price_prof’ => pSQL($price_prof),



need made special field with name "prod_prof" in mysql base in "ps_product_attribute" or site dont work, for what i need 2 fields? i alrdy made one with same name in "ps_product". Btw nvm it still dont work..
Link to comment
Share on other sites

troubleshooting:
Using phpmyadmin, examine the price_prof value as stored in the database.
Does the stored string contain the span tags you entered, or is the stored string just plain text?

Also, try this:
change
<input type="text" name="price_prof" value="'.htmlentities($this->getFieldValue($obj, 'price_prof'), ENT_COMPAT, 'UTF-8').'" />
to
<input type="text" name="price_prof" value="'.htmlentities(stripslashes($this->getFieldValue($obj, 'price_prof')), ENT_COMPAT, 'UTF-8').'" />


Dont help, i try use test or
text
but it safe only text...and in Myphpadmin too only word text...
If i write
text
direct from Phpmyadmin it safe all and on site on product page i see
text
...
But if in admin panel on product page i press button safe it delete tags
text
from base and i again see only word "text" w/o tags
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...