So lets assume you are saving product name as <span style="color:red;">Apple Cinema 30</span>
when it is saved do db it becomes <span style="color:red;">Apple Cinema 30</span>
so basically the html is encoded before saving to database
so when you simply echo the name its printed as encode string and then html displays it as <span style="color:red;">Apple Cinema 30</span>
which you don't want to do.
Approach 1
So basically before printing the name by php you need to decode it using html_entity_decode()
so that browser can parse the html.
for example in product.tpl
there is a statement <?php echo $heading_title; ?>
which needs to be changed to
<?php echo html_entity_decode($heading_title, ENT_QUOTES, 'UTF-8'); ?>
as you might have guess this is a very painful step, basically you need to find out every place where the name is printed and replace it.
now comes warning : there are placing like tab title where that html will treated as plain text and therefore tab title will show <span>....
so we conclude this a bad approach
Approach 2
same as approach 1 but instead of replacing the text evrywhere you can just replace it at catalog/model/catalog/product.php
in the getProduct($product_id)
function. replace
'name' => $query->row['name'],
with
'name' => html_entity_decode($query->row['name'], ENT_QUOTES, 'UTF-8'),
but this approach has same problem as approach 1.
So now that we have rejected incorrect methods
Correct approach
create a new database table with mapping of product_id
,language_id
toproduct_name_html
in product_name_html
save your new html title of the product.
now that have a two type of name, you can display this new (html) name where you want (obviously at places which are treated as html and not plain text), without disturbing the plain text name which is required at places like tab title, plain text email etc.
This will required considerable coding like first saving the html name from admin side to db, then edit getProduct()
types of function in model files to grab your special name with along with other product details, then replacing the code at your place(s) of interest