Jump to content

"More details" button aligned right after short description on product page


Rollaen

Recommended Posts

Hello guys,

 

I am trying to put button more details right after short description on product page. However I do not know how to attach it right into description_short in the smarty code.

 

My code:

{if $product->description_short}
<div id="short_description_content" class="rte align_justify" itemprop="description">
{$product->description_short} 
<a class="information" href="#descriptionContent">{l s='More details'}</a>
{/if}
</div>

For better understanding I attach few images.

 

 

Any help is much appreciated.

 

Thanks

 

Rob

post-1267339-0-57145500-1494252576_thumb.png

post-1267339-0-15638500-1494252577_thumb.png

Link to comment
Share on other sites

Thanks for fast reply.

 

One way would be to add manually tag <a class="information" href="#descriptionContent">{l s='More details'}</a> after each short description in product edit. However I do not know if it would not influence for example automatically generated product export for i.e. Google shopping etc.

 

My question is if it is possible to add the button "More info" automatically after each short description on my shop. Do not know much about how to strip <p> or if it would lead to my goal.

Link to comment
Share on other sites

if you dont care about text formating of short description the |strip_tags modifier should do the job.

{$product->description_short|strip_tags} 

including more info to the description is not good idea,

as you mentioned - it will be included to each "export" feature and also to the meta description etc. its not worth, in my opinion.

Link to comment
Share on other sites

However I found out that the function stripped even <strong> values. Would be possible to strip only <p> ?

 

Solved by following code.

 

{$product->description_short|regex_replace:"/(<p>|<p [^>]*>|<\\/p>)/":""}

 

Have not found any glitch yet. Export is working and the description tags <strong><ul><li> remain unchanged.

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

However I found out that the function stripped even <strong> values. Would be possible to strip only <p> ?

it is possible to define what tags you dont want to strip, for example, you can use this modifier:

|strip_tags:"<strong>"

then description will contain <strong> 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...