Textarea and editor custom fields are never shown in the Frontend

Started by Gruz, March 14, 2012, 18:51:25 PM

Previous topic - Next topic

Gruz

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.



components/com_virtuemart/views/productdetails/tmpl/default_customfields.php


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]
Your installable language for VM2: http://gruz.org.ua/virtuemart-language-files.html

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

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.

Gruz

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.
Your installable language for VM2: http://gruz.org.ua/virtuemart-language-files.html

Studio 42

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 ?