SergioE Posted August 15, 2016 Share Posted August 15, 2016 (edited) Hii, I want to put only the content of the product in the long description , in order to show how short description about the first two or three lines long description by a truncate . There would have to make changes in the product.php and the .tpl guess not ? Someone can tell me how to make these changes ? Sorry for my English. Edited November 28, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 15, 2016 Share Posted August 15, 2016 I want to put only the content of the product in the long description content of what? can you shed some more light on this please? you mean that as a "short" description you want to show: - several lines of product description - create some kind of "more" button - when someone press it, the rest of product description will appear ? Link to comment Share on other sites More sharing options...
SergioE Posted August 16, 2016 Author Share Posted August 16, 2016 (edited) Y want to show in a short description, a several lines of product description, and create some kind of "more" button to see all product description. An example of this product , modifying the code faster : Edited August 16, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
electriz Posted August 16, 2016 Share Posted August 16, 2016 Hello. Try this. Open product.tpl Find: {if $product->description} <!-- More info --> <section class="page-product-box"> Replace with: {if $product->description} <!-- More info --> <section class="page-product-box" id="full-desc"> And add to your link where you have "Read more" anchor so it would lead to full description. For example: <a href="#full-desc">Read more</a> Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 If you want to replace the short description with a truncated version of the long description, change the following at around line 181 of themes/default-bootstrap/product.tpl: <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description_short}</div> to: <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description|truncate:300}</div> Change 300 to the maximum number of characters you want to have. Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 (edited) Yeah, but I see you do not understand what I want . Attached pictures to see it. I want to put the content in the long description , and which have short description for example the first 100 words of the long description. Because if I copy and paste the contents of the short description in the long run would not duplicate content ? With the pictures you understand now? Thank you Edited August 17, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 See my post above. It should do this. Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 I will not have duplicate content issues with that code does not ? Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 As long as you set an acceptable number of characters that is below the minimum length of the description, you shouldn't have duplicate content. Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 (edited) I set the maximum size for the short description in 1200. In preferences -> products. Edited August 17, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 I mean in my code modification above there is truncate:300 to display a maximum of 300 characters before truncating the long description and adding ... Did you make the code modification above? Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 It does not work, only appears when you insert a character in the short description. If empty , nothing appears. This is the code: <div id="short_description_block"> {if $product->description_short} <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description|truncate:300}</div> {/if} <section class="page-product-box"> <h3 class="page-product-heading">{l s='More info'}</h3>{/if} {if isset($product) && $product->description} <!-- full description --> <div class="rte">{$product->description}</div> </section> Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 Oops. Try: {*{if $product->description_short}*} <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description|truncate:300}</div> {* {/if}*} Removing the if statement should allow it to work without a short description. Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 Is for the condition "if" ?? {if $product->description_short || $packItems|@count > 0} <div id="short_description_block"> {if $product->description_short} <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description|truncate:300}</div> {/if} Link to comment Share on other sites More sharing options...
SergioE Posted August 17, 2016 Author Share Posted August 17, 2016 (edited) If I remove the "if " does not work the page. Edited August 17, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted August 17, 2016 Share Posted August 17, 2016 You must have made an error when replacing the code. You should remove the {if $product->description_short} and it's corresponding {/if} only. Do not delete any other if statements. Link to comment Share on other sites More sharing options...
SergioE Posted August 18, 2016 Author Share Posted August 18, 2016 (edited) I still blank out the description , only the sample in the long description. Still blank out the description , only the sample in the long description . In the short description which should leave the repetition of the long description , but with 300 characters , nothing appears. I attached my file.I Edited August 18, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
SergioE Posted August 18, 2016 Author Share Posted August 18, 2016 (edited) Now it works , the code has been so tell me if it's okay: {*{if $product->description_short || $packItems|@count > 0}*} <div id="short_description_block"> {*{if $product->description_short}*} <div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description|truncate:300}</div> {*{/if}*} {if $product->description} <p class="buttons_bottom_block"> <a href="#descriptionTab" class="button"> {l s='More details'} </a> </p> {/if} <!--{if $packItems|@count > 0} <div class="short_description_pack"> <h3>{l s='Pack content'}</h3> {foreach from=$packItems item=packItem} <div class="pack_content"> {$packItem.pack_quantity} x <a href="{$link->getProductLink($packItem.id_product, $packItem.link_rewrite, $packItem.category)|escape:'html':'UTF-8'}">{$packItem.name|escape:'html':'UTF-8'}</a> <p>{$packItem.description_short}</p> </div> {/foreach} </div> {/if}--> </div> <!-- end short_description_block --> {*{/if}*} I guess this would not cause duplicate content , no? Edited August 18, 2016 by SergioE (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted August 19, 2016 Share Posted August 19, 2016 Looks good. You don't need to worry about duplicate content unless you have some long descriptions that are under 300 characters. Link to comment Share on other sites More sharing options...
SergioE Posted August 19, 2016 Author Share Posted August 19, 2016 My sheet stay that way. With what's descriptions that have more than 800 characters. That is what you say about those 300 characters ? Link to comment Share on other sites More sharing options...
rocky Posted August 19, 2016 Share Posted August 19, 2016 You'll be fine if your descriptions have 800 characters or more. Link to comment Share on other sites More sharing options...
SergioE Posted August 19, 2016 Author Share Posted August 19, 2016 Thank you Link to comment Share on other sites More sharing options...
SergioE Posted November 28, 2016 Author Share Posted November 28, 2016 Is there a way to make the truncate ignore the "a" links? 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