VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Gruz on March 14, 2012, 18:51:25 PM

Title: Textarea and editor custom fields are never shown in the Frontend
Post by: Gruz on March 14, 2012, 18:51:25 PM
VM 2.0.3b and SVN at the moment

As far as I understand the fields can be used to have additiona description. They are only outputted on FE, their puprpose is not to allow user to input something.

If yes, then this is how I see it.

History in pictures.

Textarea and Editor fields have type X and Y.
(http://static.xscreenshot.com/2012/03/14/18/screen_b0d56a13f46ff5ad2f8ac7e95074a736) (http://view.xscreenshot.com/b0d56a13f46ff5ad2f8ac7e95074a736)


components/com_virtuemart/views/productdetails/tmpl/default_customfields.php
(http://static.xscreenshot.com/2012/03/14/18/screen_800707fb264d33ec1a9eb30d5823dfd1) (http://view.xscreenshot.com/800707fb264d33ec1a9eb30d5823dfd1)

In
administrator/components/com_virtuemart/models/customfields.php method displayType returns nothing for X and Y.
switch ($type) { never has such a case, nor has a default case

This should be fixed.
The switch should be added with something like this:

case 'X':
return '<span class="product_custom_textarea">'.JText::_($value).'</span>';
break;
case 'Y':
return '<span class="product_custom_editor">'.JText::_($value).'</span>';
break;







Solution for those who want to make it work now. It's not still implemented in SVN despite of Milbo's comment below.

Copy  components/com_virtuemart/views/productdetails/tmpl/default_customfields.php
to
templates/YOURTEMPLATE/html/com_virtuemart/productdetails/default_customfields.php

And after line about 26
    foreach ($this->product->customfieldsSorted[$this->position] as $field) {
add
/*##mygruz20120315114222 Fix not showing textaread and editor area { */
if (!$field->display && in_array($field->field_type,array ('X','Y'))) {
$field->display = $field->custom_value;
}
/*##mygruz20120315114222 } */


The fixed file attached

[attachment cleanup by admin]
Title: Re: Textarea and editor custom fields are never shown in the Frontend
Post by: Milbo on March 15, 2012, 00:28:21 AM
Thank you gruz
Title: Re: Textarea and editor custom fields are never shown in the Frontend
Post by: Studio 42 on March 15, 2012, 18:53:02 PM
HI gruz,
Tks for some advice but no change to do in template and code in this case are simply
/* text area or editor No JText, only displayed in BE */
case 'X':
case 'Y':
return $value;
break;

and i tested the fields, and found some other bugs BTW.

Test last SVN rev 5675 for the fixes.
Title: Re: Textarea and editor custom fields are never shown in the Frontend
Post by: Gruz on March 15, 2012, 19:01:56 PM
That, I've just seen it in the model.

I think that JText::_() wrapper would not be something bad. I.e. I want to use a standard translatable phrase in some descriptions. Not a critical sure.
And spans with classes are never superfluous, but ok.

Thanks.
Title: Re: Textarea and editor custom fields are never shown in the Frontend
Post by: Studio 42 on March 15, 2012, 20:21:04 PM
I have look on code the Span is generated then why adding 1 more?
For Jtext this is typical a SImple String and not an editor/TextArea field ;)
I'm curious to know Jtext response on parsing a HTML code ?
Title: Re: Textarea and editor custom fields are never shown in the Frontend
Post by: MC Web Design on July 06, 2012, 21:34:10 PM
May be this topic can be of help: http://forum.virtuemart.net/index.php?topic=104932 (http://forum.virtuemart.net/index.php?topic=104932)