AppleEater Posted October 11, 2013 Share Posted October 11, 2013 (edited) I have products with many attribute groups and customized fields. currenty, the cart summary displays all the attributes with comma separated (","). I am looking for a way to replace the "," with a new-line, like </br>. Any advise where I could find the attributes string and modify it? Edited October 14, 2013 by AppleEater (see edit history) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted October 11, 2013 Share Posted October 11, 2013 Modify theme file : shopping-cart-product-line.tpl Search : {$product.attributes|escape:'htmlall':'UTF-8'} Replace with: {$product.attributes|escape:'htmlall':'UTF-8'|replace:',':'<br />'} But be careful, if your attributes group name or the attribute value name contain coma, it will be replaced too.So much better changing the coma character with <br /> tag by overriding the related classes file Cart.phpIn function cacheSomeAttributesLists($ipa_list, $id_lang)Search '.$row['attribute_name'].', '; Replace with '.$row['attribute_name'].'<br />'; 3 Link to comment Share on other sites More sharing options...
AppleEater Posted October 12, 2013 Author Share Posted October 12, 2013 (edited) Apparently the class change doesn't work in PS1.5.5 ? I've modified /themes/%theme%/override/classes/cart.php with the following lines: class CartCore extends ObjectModel { public static function cacheSomeAttributesLists($ipa_list, $id_lang) { . . . foreach ($result as $row) { self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes'] .= $row['public_group_name'].' : '.$row['attribute_name'].'<br />'; self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes_small'] .= $row['attribute_name'].'<br />'; } } } But this doesn't change the cart summary. see screenshot. Edited October 12, 2013 by AppleEater (see edit history) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted October 14, 2013 Share Posted October 14, 2013 Do you know how to override classes/controller files ??? The override file should be placed on /override/classes/ or override/controller/ directory And then the override file should begin like this class ClassName extends ClassNameCore { // your code } And Don't forget to delete file : /cache/class_index.php each time you override prestashop classes or controller files Please read the Prestashop documentation my friend.... Link to comment Share on other sites More sharing options...
AppleEater Posted October 14, 2013 Author Share Posted October 14, 2013 My bad. Thank you for the clarification. Link to comment Share on other sites More sharing options...
ThatDesignGroup Posted October 15, 2013 Share Posted October 15, 2013 (edited) Just in regards to this too. I'm currently sort of trying to achieve the same thing, but with an unordered list as opposed to linebreak. This is what I currently have (doing override). foreach ($result as $row) { self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes'] .= $row['public_group_name']. ' : ' .$row['attribute_name']. '<br />' ; self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes_small'] .= $row['attribute_name'].' <br />'; } But it is printing the <br /> as exactly that, just text. The output comes out asColor : Metal<br />Size : Small<br /> Is there something I'm doing wrong as to why it's not outputting as HTML? Or even a way to encase this within <li> tags?Many thanks in advance. Edited October 15, 2013 by ThatDesignGroup (see edit history) Link to comment Share on other sites More sharing options...
ThatDesignGroup Posted October 15, 2013 Share Posted October 15, 2013 Resolved.Here's the code I got it done with. Silly error on my part. self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes'] .= '<li>'.$row['public_group_name'].' : '.$row['attribute_name'].'</li>'; self::$_attributesLists[$row['id_product_attribute'].'-'.$id_lang]['attributes_small'] .= $row['attribute_name'].''; Thanks much for the help Link to comment Share on other sites More sharing options...
aaronjpitts Posted October 22, 2013 Share Posted October 22, 2013 Thanks for the above guys, but how would it be possible to split the product attributes onto one line each in the email templates (the order confirmation email for example)? Many thanks Link to comment Share on other sites More sharing options...
benoulrt Posted April 24, 2014 Share Posted April 24, 2014 Hello, I don't know if you'll be able to answer me but, when I try to modify Cart.php with or without an override, the result is the same thing. It's written my html code near the attributes. Like : "Color : orange <br /> Taste : Apple" Did you have this problem ? Link to comment Share on other sites More sharing options...
MarysWebLab Posted July 14, 2016 Share Posted July 14, 2016 (edited) I tried the solution relative to Cart.php in Prestashop 1.6.1.5, but it didn't worked. Then I tried the first trick and this did the job. I replaced {$product.attributes|escape:'htmlall':'UTF-8'} with {$product.attributes|escape:'htmlall':'UTF-8'|replace:',':'<br />'} thank you gonebdg Edited July 14, 2016 by MarysWebLab (see edit history) Link to comment Share on other sites More sharing options...
ELITIV Posted July 14, 2016 Share Posted July 14, 2016 Hi everyone. I can't solve one issue with textarea input on PS 1.6. I use One Page Checkout and i have textarea filed for a text message. In the database it is story as a TEXT (the same for VARCHAR), but problem is if i try to add new line of text. For. ex. If i try to add: Demo text 1 Demo text 2 Demo text 3 it's saved in database as: Demo text 1n Demo text 2nDemo text 3 How can i solve this? and, Please, give me any suggestion. Or, transform/change "n" in SPACE. 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