Post by Sokonomi » Sun Sep 30, 2012 5:17 am

I hope this is the right subforum, if not, sorry in advance.

So heres my gripe.
I have several products that require some custom text input from customers, but after they hit the order button, this text gets displayed partially clipped everywhere, so customers can not review their text upon ordering or even after it, because the confirmation mail also truncates.

I have narrowed it to several scripts calling for <?php echo $option['value']; ?>
The admin order review also calls for it, though this is the only place that displays it fully (but not linebreaks).

What id like to happen, is for opencart to read the entire textarea entry everywhere, preferably with linebreaks.

Here are some pictures I hope will convey the issue a bit easier:
Image
Image
Image

Does anyone have an idea what needs to be altered to make <?php echo $option['value']; ?> spit out the textarea value in full, possibly with linebreaks (it does save separate lines into the SQL database)?

Active Member

Posts

Joined
Sun Sep 30, 2012 4:52 am

Post by MLPages » Sun Oct 14, 2012 1:00 pm

Im actually wondering about this too.. It appears to be snippet, but I can't figure out where to edit the char length of the snippet.. I'll post back if I figure it out.

Newbie

Posts

Joined
Tue Aug 09, 2011 2:40 am

Post by ifixrobot » Sun Nov 18, 2012 10:02 am

You need to edit the controller files. Your stylesheet may need modification to fit the text as well after editing the controller files.

For version 1.5.4.x:

Confirmation page at checkout:

In confirm.php 1replace the following code at line 351

Code: Select all

'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value)
With

Code: Select all

'value' => (wordwrap($option['option_value'],70, "<br />"))
The 70 is the amount of characters wide you want the text to be and will word wrap based on the width of the text box. Change this number based on your desired text width.

For your Shopping Cart page:
Do the same as above and in the \catalog\controller\checkout\cart.php replace the same code at line 215:

Professional Robotics Repair Center
Specializing in Roomba, Scooba, and Neato Robot Parts and Repair
http://www.iFixRobot.com


Newbie

Posts

Joined
Sun Nov 18, 2012 8:45 am


Post by andyblackett » Mon Dec 31, 2012 7:57 am

Hi there,

I'm having problems with this issue too. We offer engraving services much like Sokonomi, we do need to know when a client has entered a line break. I've followed ifixrobot's steps above which has removed the "clipping" of the text area inputs in the cart.

However I'm still facing the problem of the line breaks being stripped from the users entries - did anyone manage to solve this?

Hope you can help
Andy

Newbie

Posts

Joined
Mon Dec 31, 2012 7:54 am

Post by andyblackett » Mon Dec 31, 2012 7:36 pm

I managed to sort the line break problem myself, am really proud this morning ;D

Replace
<?php echo $option['value']; ?>
with
<?php echo nl2br($option['value']); ?>

in the following files;

Client side;
/catalog/view/theme/default/template/checkout/cart.tpl
/catalog/view/theme/default/template/checkout/confirm.tpl
/catalog/view.theme/default/template/module/cart.tpl
/catalog/view/theme/default/template/account/order_info.tpl

Admin side:
/admin/view/template/sale/order_info.tpl
/admin/view/template/sale/order_invoice.tpl

I actually tweeked this further and made the option data bold and added a line break between the option name and option data so it stands out on the view cart and report pages. I've also commented out the option fields on the mini-cart view as it looked very cluttered - this now just shows the product name and price, the full option details are viewed on the viewcart page.

You'll still need to use ifixrobots solution to stop the truncation in the cart.

Hope this really helps,
Andy

PS. I know it goes without saying but backup first, the solution definitely works on my install (version 1.5.4) but would hate if it caused someone else problems!

Newbie

Posts

Joined
Mon Dec 31, 2012 7:54 am

Post by parkookk » Fri Jan 25, 2013 10:36 pm

Thanks for your helpful post, you are the champion, :D , it did fix lots of textarea problems but still when I receive orders it only shows a few letters in the email that my store sends me for order confirmation.

Also I would appreciate if you explain further what xrobots solution is and how to do it.

I am using the original template and opencart 1.5.4.1

I am using English OpenCart 3.0.3.8, Default Template/Theme, php 7.4, Latest Brave Browser (No Ads-Blocker, etc.)


User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by parkookk » Sat Jan 26, 2013 11:28 pm

I have edited the codes above and now when im receiving orders there are no customer input at all in the email that my store emails to customer!!

I am using English OpenCart 3.0.3.8, Default Template/Theme, php 7.4, Latest Brave Browser (No Ads-Blocker, etc.)


User avatar
Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by actlas » Tue Jun 10, 2014 5:54 pm

I ended up doing a find and replace in all these files:

Image

If the newline isn't displayed properly anywhere shouldn't this be stored with <br> instead in the database itself?

Newbie

Posts

Joined
Mon Nov 25, 2013 6:10 pm
Who is online

Users browsing this forum: No registered users and 5 guests