Rollaen Posted May 8, 2017 Share Posted May 8, 2017 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 Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2017 Share Posted May 8, 2017 your description short contains some html code? i might be necessary to strip all html tags, because - i bet that there is <p> block and in effect everything is below it. Link to comment Share on other sites More sharing options...
Rollaen Posted May 8, 2017 Author Share Posted May 8, 2017 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 More sharing options...
vekia Posted May 8, 2017 Share Posted May 8, 2017 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 More sharing options...
Rollaen Posted May 8, 2017 Author Share Posted May 8, 2017 Everything seems to be fine. Thanks for your help sir. Link to comment Share on other sites More sharing options...
Rollaen Posted May 8, 2017 Author Share Posted May 8, 2017 (edited) 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 May 8, 2017 by Rollaen (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2017 Share Posted May 8, 2017 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 More sharing options...
Rollaen Posted May 8, 2017 Author Share Posted May 8, 2017 |strip_tags:"<strong>" Unfortunately did not worked for me. But still thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now