Norwegian Rat Posted July 15, 2012 Share Posted July 15, 2012 (edited) Hi I got a little problem regarding blockcart2 and ajax-cart.js. I'm trying to show the whole product name in the cart when you add something instead of the first 10 letters. So what I have done is that I have changed this line in ajax-cart.js: Line 434: var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name); to var name = (this.name.length > 32 ? this.name.substring(0, 30) + '...' : this.name); Then I changed this line in the blockcart.tpl file: Line 66: {$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a> to {$product.name|truncate:33:'...'|escape:html:'UTF-8'}</a> It works when you add a product and refresh the page, but if you dont, you'll still get the first 10 letters + the (...) Force compile is on and cache is off in BO's "performance". I've also manually cleaned the cache in /tools/smarty and smarty_v2. And for good measure I've also cleaned my browsers Does anyone know what I am doing wrong, or what causes this? Using Prestashop 1.4.8.2 (tried several themes, including the default, with the same result) Thanx in advance I figured it out. You need to edit the blockcart-json.tpl in the "blockcart" (not blockcart2) module, even though the module isn't enabled. Line 38: "name": "{$product.name|html_entity_decode:2:'UTF-8'|escape|truncate:35:'...':true}", Edited July 16, 2012 by Izraelviz (see edit history) 2 Link to comment Share on other sites More sharing options...
uspetznaz Posted January 10, 2013 Share Posted January 10, 2013 Thanks for sharing! I had (and still have) a similar issue but it was worse because when I added a product with name "Epístolas" it was only displayed as "Ep&..." I changed the truncation to see if that helped but no way. I had to change the "escape" in the blockcart-json.tpl from "escapeall" to "escape", then I still have the truncation problem (name always truncated) that you had, even after changing the truncation length in both blockcart.tpl and blockcart-json.tpl so that it is longer. I need to refresh the page for the new truncation (longer) to be used. I cant really understand why... Link to comment Share on other sites More sharing options...
mouse1 Posted July 30, 2013 Share Posted July 30, 2013 I'm using Prestashop 1.5.4.0. I made all the changes mentioned above in order to show longer names in the cart items instead of the initial 13, but these changes didn't do anything. Then I found another file containing the "truncate" code specifying the name length of the items in the cart. Go to your theme (I'm using default) - modules - blockcart. Open the file called blockcart.tpl and find the following code: {$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a> Just change the number 13 to any length you desire. Hope this helps. 1 Link to comment Share on other sites More sharing options...
vekia Posted July 30, 2013 Share Posted July 30, 2013 @mouse1 thanks for your suggestion im convinced that it will be helpful for other merchants i just wondering - does the cart looks well even if you have there "long named" products? Link to comment Share on other sites More sharing options...
JANDSCLOTHINGCO Posted July 30, 2013 Share Posted July 30, 2013 I did the same thing on 1.5.4.1, BUT you need to change it in another file in addition to the blockcart.tpl in the themes/modules/blockcart/ for it to update IMMEDIATELY on your site when adding items otherwise the cart will continue to show the truncated value until you refresh the page or go to a new one. The second file you need to modify if you are using AJAX is blockcart-json.tpl located in /modules/blockcart/ @Vekia Below is a glimpse of mine. I extended my shopping cart to accommodate the extra length product names Link to comment Share on other sites More sharing options...
mouse1 Posted August 8, 2013 Share Posted August 8, 2013 To vekia: I did the same as JANDSCLOTHINGCO - I extended the cart width and it looks good, just like in JANDSCLOTHINGCO's picture. Link to comment Share on other sites More sharing options...
Gladzio Posted February 7, 2014 Share Posted February 7, 2014 Hi, All your comments were very helpful. I've extened name of my products in cart to 28 but I can see another problem: when you poin coursor on the name you can see that description which appears is also "cutted"... (see attached picture) After web refreshing is O.K. Can this description can be full all the time? Link to comment Share on other sites More sharing options...
mouse1 Posted February 11, 2014 Share Posted February 11, 2014 (edited) Sorry, made a mistake and don't know how I can delete my post. Oops. Edited February 11, 2014 by mouse1 (see edit history) 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