Jump to content

[SOLVED] Change image hover title from legend to descr_short


Recommended Posts

Hi, friends, I am in need of your help again.

 

I modified default theme a bit, taken out the short description from product list to get more clean look and more space. 

But short description is still necessary, so I wanted to change the mouse hover action from showing the image legend o show image short description. 

Modified product_list.tpl accordingly, like this:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{if !empty($product.name)}{$product.name|escape:'htmlall':'UTF-8'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" title="{if !empty($product.description_short)}{$product.description_short|escape:'htmlall':'UTF-8'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

basically replaced legend with short description. It works, but I have the descr_short paragraph tag inside the description, as shows in the attached image.

post-759375-0-83328300-1401880603_thumb.jpg

 

Please tell me how to get rid if of this  <p> tag?

 

Oh, and how can I edit that pop-up text bubble (background, font size, margins, etc)?

 

Thank you in advance, 

Cheers

Salus

 

PS: I am almost done with our site, and I must say that although it was a quite long process, I learned a LOT from you guys. Started as a total noob (i mean I never laid eyes on a html or smarty code before), and now I may say that I know the very basics, wich is a LOT for me. And all this THANKS TO YOU , GUYS, and I really appreciate all your support and patience, and you all are a bunch of great good people :)

Specially vekia... yes.

Edited by Salus (see edit history)
Link to comment
Share on other sites

Thanks a lot for replies.

S-Hammani, your solution would have been ideal, if it would work... but unfortunately it doesn`t.

Dioniz, i think you have a point, I'm struggling to comprehend that TinyMCE thing from the link you shared, I`ll be back with a result :)

Link to comment
Share on other sites

Ok, i think I have to share this. 

I have choosen this solution: http://www.prestashop.com/forums/topic/43107-solved-product-short-description-field-not-displaying-html/?do=findComment&comment=301288

 

SO my line looks like this:

 <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{if !empty($product.name)}{$product.name|escape:'htmlall':'UTF-8'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" title="{if !empty($product.description_short)}{$product.description_short|substr:0:3 == '<p>'}{$product.description_short|substr:3:-4|truncate:360:'...'}{else}{$product.name|escape:'htmlall':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

We are almost there, but there must be a logical error of some kind, because  - although it works to some extent, it did take out the <p> tags from beginning and from the end of description,  - it leaves a number 1 at beginning of every line, and in some cases I get weird code inside the description. let me show you:

post-759375-0-89341300-1401956407_thumb.jpg

 

The ones that are messed up are few, and the hover info is like this:

post-759375-0-24877700-1401956454_thumb.jpg

 

what say you, how can this be fixed?

Link to comment
Share on other sites

Hi again

 

for this ?

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image,
 'home_default')|escape:'html':'UTF-8'}"
 alt="{if !empty($product.name)}
 {$product.name|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"
 title="{if !empty($product.description_short)}{$product.description_short|strip_tags:false}
 {$product.description_short|strip_tags:false|truncate:360:'...'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"
 {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
Link to comment
Share on other sites

 

Hi again

 

for this ?

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image,
 'home_default')|escape:'html':'UTF-8'}"
 alt="{if !empty($product.name)}
 {$product.name|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"
 title="{if !empty($product.description_short)}{$product.description_short|strip_tags:false}
 {$product.description_short|strip_tags:false|truncate:360:'...'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"
 {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

 

Sorry for late answer. 

Yes, S-Hammani, it works perfectly. Is seems that this /strip-tags is the key. I only had to cut this part out:

{$product.description_short|strip_tags:false|truncate:360:'...'}

because with the above, it shows the short description 2 times. I can survive without the truncate thing, i am keeping the pruduct names under 360 chars. 

 

Thank you all for your help, guys, I learned something useful again today.

S-hammani, dioniz, PSfever, you`ve done me a great service, i really appreciate your help and invested time, thank you.

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