Get "Textareas" to Display As Entered By The Users

  • Posts: 20
  • Thank you received: 0
12 years 8 months ago #48599

1. I have added a few textareas for messages that are required fields my users will apply to the products they select on my site. Instead of displaying a string of all the text without the carriage returns, is there some code that I can add to my php file that will apply to all textarea's on my website? I've had a look at an echo of "nl2br(htmlspecialchars($string));" in my php file, but it appears that i have to do something else to make the "enters" display as they were entered. I can't believe this issue has not been asked a hundred times, or if it has, perhaps I'm using the wrong terminology in my searches. I suppose it's obvious I'm new to all of this. <grin>

2. How do I suppress displaying field names for these custom fields?

3. How do I get the the price of variants to display as soon as they are selected on the products page? It appears that my customers will be selecting a variant without knowing it's cost and I'm not sure I would bother to proceed to purchase without knowing what the item cost.

Thanks very much. Love the program.
Lena

Please Log in or Create an account to join the conversation.

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 8 months ago #48671

1. That's a point which wasn't raised so far.
Indeed, it's a good idea to nl2br these.
You can do that by adding the code:

function show(&$field,$value){
		return nl2br(parent::show($field,$value));
	}
after the line:
class hikashopTextarea extends hikashopItem{
in the file administrator/components/com_hikashop/classes/field.php

2. There is no option for that. Why not use CSS for that ? For example, if your field's column name is called "my_field" you could do like that:
label[for=my_field] { display: none; }

3. That should be the case by default as you can see on our demo website:
www.demo.hikashop.com/index.php?option=c...ow&Itemid=82&lang=en
If that doesn't work on your end, there must be a javascript error or something like that preventing the refresh of the price. Hard to say without looking at the page directly.

The following user(s) said Thank You: LenaK

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 0
12 years 8 months ago #48735

1. That's great! It worked like a charm with a straight copy, paste and edit of the field name! For the one field.

Oh my, it works for both test fields - um, did i even have to change the field name? !!!

How would I apply or change this code to another custom field? I have zero js knowledge when it comes to syntax. I tried copying the entire function, didn't work. Then I tried a few different combinations of ;'s and ,'s with and without ()'s, but that didn't work either.

2. Since I asked this question, I saved my Custom fields without the label and it was accepted, so this issue is solved as well.

3. I'll spend a little more time checking my stuff before I bother you again. I may have another extension interfering.

Wow Nicolas, I'm very happy.

Last edit: 12 years 8 months ago by LenaK.

Please Log in or Create an account to join the conversation.

  • Posts: 20
  • Thank you received: 0
12 years 8 months ago #48738

Ok - I have to confess - all issues are solved.
1. You don't have to change the code at all.
3. I had options confused with characteristics.Once I added options to my products, i have dynamic pricing.

Thank you so much. I am so much closer to publishing.

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum