- Posts: 2
- Thank you received: 0
Virtuemart flypage: textarea instead of input
-
miboe
Inactive member - Topic Author
- New Member
Less
More
13 years 8 months ago #7227
by miboe
Virtuemart flypage: textarea instead of input was created by miboe
We'ld like to sell wedding cards in our Virtuemart shop using the furniture-store template.
The customer should be able to add the individual text to be printed on the card. For this purpose we add an individual attribute "Your text:" on the product status page. Unfortunatly the attribute is presented to the customer as input field on the flypage with only single line to enter.
My question: Is there a solution to change the single-line inputfield into a textarea, so the customer has enough space to edit his desired text?
The customer should be able to add the individual text to be printed on the card. For this purpose we add an individual attribute "Your text:" on the product status page. Unfortunatly the attribute is presented to the customer as input field on the flypage with only single line to enter.
My question: Is there a solution to change the single-line inputfield into a textarea, so the customer has enough space to edit his desired text?
Please Log in to join the conversation.
-
ivan.milic
Support Staff - Moderator
Less
More
- Posts: 14116
- Thank you received: 1639
13 years 8 months ago #7240
by ivan.milic
Replied by ivan.milic on topic Re: Virtuemart flypage: textarea instead of input
You can try this:
Open
components\com_virtuemart\themes\hot_furniture\templates\product_details\includes\addtocart_custom_attribute.tpl.php
change:
<input type="text" class="inputboxattrib" id="<?php echo $attribute ?>_field" size="30" name="<?php echo $attribute.$attribute ?>" />
to
<textarea type="text" class="inputboxattrib" id="<?php echo $attribute ?>_field" size="30" name="<?php echo $attribute.$attribute ?>" />
Note that this will change all of your displayed custom attributes output element from input to textarea so if you need to control tahat you will have to add some if - then -else logic to this.
Also you mat need to chage:
components\com_virtuemart\themes\default\templates\product_details\includes\addtocart_custom_attribute.tpl.ph
Open
components\com_virtuemart\themes\hot_furniture\templates\product_details\includes\addtocart_custom_attribute.tpl.php
change:
<input type="text" class="inputboxattrib" id="<?php echo $attribute ?>_field" size="30" name="<?php echo $attribute.$attribute ?>" />
to
<textarea type="text" class="inputboxattrib" id="<?php echo $attribute ?>_field" size="30" name="<?php echo $attribute.$attribute ?>" />
Note that this will change all of your displayed custom attributes output element from input to textarea so if you need to control tahat you will have to add some if - then -else logic to this.
Also you mat need to chage:
components\com_virtuemart\themes\default\templates\product_details\includes\addtocart_custom_attribute.tpl.ph
Please Log in to join the conversation.
-
jafu
Inactive member - New Member
Less
More
- Posts: 3
- Thank you received: 0
13 years 4 months ago #10463
by jafu
Replied by jafu on topic Re: Virtuemart flypage: textarea instead of input
This works fine. However, when I look at the shopping cart all the text entered in the text area is on one line.
Normally in PHP you would add nl2br(), I suppose, but where do I enter this? Or, is there another way?
Normally in PHP you would add nl2br(), I suppose, but where do I enter this? Or, is there another way?
Please Log in to join the conversation.
-
ivan.milic
Support Staff - Moderator
Less
More
- Posts: 14116
- Thank you received: 1639
13 years 4 months ago #10469
by ivan.milic
Replied by ivan.milic on topic Re: Virtuemart flypage: textarea instead of input
Not sure there is \n (newline) there at all, because that is made by virtue-mart developers. Anyway why not try:
..<?php echo nl2br($attribute.$attribute); ?>..
..<?php echo nl2br($attribute.$attribute); ?>..
Please Log in to join the conversation.
-
jafu
Inactive member - New Member
Less
More
- Posts: 3
- Thank you received: 0
13 years 4 months ago #10483
by jafu
Replied by jafu on topic Re: Virtuemart flypage: textarea instead of input
Unfortunately that doesn't help. I’ll try to explain what happens:
If I enter the following text (each number on a new row):
1
2
3
It will show as follows on the shopping cart page (where I can see all my items in the basket):
1n2n3
All text on one line and with an ‘n’ after each ‘Enter’.
Any ideas?
If I enter the following text (each number on a new row):
1
2
3
It will show as follows on the shopping cart page (where I can see all my items in the basket):
1n2n3
All text on one line and with an ‘n’ after each ‘Enter’.
Any ideas?
Please Log in to join the conversation.
-
ivan.milic
Support Staff - Moderator
Less
More
- Posts: 14116
- Thank you received: 1639
13 years 4 months ago #10493
by ivan.milic
Replied by ivan.milic on topic Re: Virtuemart flypage: textarea instead of input
try str_replace instead of nl2br():
..<?php echo str_replace('\n','<br/>',$attribute.$attribute); ?>..
..<?php echo str_replace('\n','<br/>',$attribute.$attribute); ?>..
Please Log in to join the conversation.
Time to create page: 0.178 seconds