Custom fieds - default value on frontend

  • Posts: 68
  • Thank you received: 0
10 years 6 months ago #171000

-- HikaShop version -- : 3.2.3

Hi,

I would like to set up default value for product custom field. These will be limited on the bases of other custom value.
I wanted to use as field type wysiwyg editor, text area or owen text to be able to display the value on frontend and put there some HTML code (picures, link ect.).
I want to setup up default value which include HTML, but the value is not saved. Only text without HTML is possible to save.

When I keep the default value empty and fill in the field when the product is editing, is possilbe to save it. It will take many times to fill in all again and again for each product, I wanted to use default value, which will be valid for group of products.

See, how the field is setup in attachement and also you can see the page, where it is used, but must be put directly to product page and not as default value of custom field.

I tried to change editor but nothing is changed, even I use codeMiror editor.

Debug mode is turned on and sytems errors too. I see the mistakes only in the file with language.

Could you help me to fix the problem?

Attachments:

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

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
10 years 6 months ago #171030

Hi,

The "default value" field of a custom field will apply to all the new elements of that field's table after you set it.
It won't change all the existing elements, which is why you don't see the default value in all your previously existing products.
If you want to set a value on all the products, you need instead to use the mass actions system (menu Systerm>Mass actions) with an action "update the values" on the column name of your custom field, with the type "string", and your text in the input field, and when you click on process, it will set that value in the custom field of all the products.

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

  • Posts: 68
  • Thank you received: 0
10 years 6 months ago #171057

Hi,

but the default value of custom field is not saved when is created and include HTML . So it is not question, I don´t see the value in existing products.
I have tu put the value manualy for each product. The value for this type of custom field is empty.

My question, how to save the default value, when the HTML is included.

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

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
10 years 6 months ago #171152

Hi,

The default value itself is indeed always filtered even if you turn off the "input filtering" option of the field. But I don't really see what that will change for you if we correct that as you'll still have to have that default value entered for all the existing products.
To correct that, you can change the file administrator/components/com_hikashop/classes/field.php with the one in the archive enclosed.

Attachments:

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

  • Posts: 68
  • Thank you received: 0
10 years 6 months ago #171286

Hi,
when the value is not saved as default and input filtering doesn´t work, nothing will be saved. When I create new product the specific field stay empty. It is reason, why I wanted to change. Even more, in the case there is more people who work with administration, can not see what is fill in.

I replaced the file which you mentioned.
Now default value is saved.
What doesn´t work well is default value for existing products.

I did it trough mass action. But when I use "string" the HTML tag is not saved correctly. Only text.
There is problem to save it.

I managed once, but only if the data are saved and the procedure is not run manualy. Only create new mass action and saved. Not run manualy. Then you have to create one new product, and the data are full fill to product page with conditions used for specific field.

Is there something what I do wrongly?

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

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
10 years 6 months ago #171315

Hi,

I tried on my end with a mass action and is worked fine: take.ms/sRCuw
So I was able to update the custom field value for my HTML text for all the products within a category with a name with "test" in it.

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

  • Posts: 68
  • Thank you received: 0
10 years 6 months ago #171910

Hi,

see the setup of mass action which I used at attachement.

The code which I wanted to use is here:

<div>
<a target="_blank" href="/subdom/sperky/images/obsessive.jpg">
<img border="0" alt="velikosti obsessive" src="/subdom/sperky/images/velikosti.png">
</a>
<p style="font-size: 9px;">Ověřte si správnou velikost. Předejdete tak zbytečným výměnám.</p>
</div>

The code include links to picture and link to side which should be opened after you click on picture, and also some additional text.
I dont´t know where I do mistake, but for me it is not working.

Attachments:

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

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
10 years 6 months ago #172000

Hi,

Change the line :

$output .= ' <input class="inputbox" type="text" name="action['.$table->table.']['.$key.'][updateValues][value]" size="50" value="'. $value->data['value'].'"  />';
to:
$output .= ' <input class="inputbox" type="text" name="action['.$table->table.']['.$key.'][updateValues][value]" size="50" value="'. htmlspecialchars($value->data['value'], ENT_COMPAT, 'UTF-8').'"  />';
in the file plugins/system/hikashopmassaction/hikashopmassaction.php and that should avoid the problem with complex HTML in the input field.

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

  • Posts: 80
  • Thank you received: 1
7 years 11 months ago #265837

Hello,

I am havinge an issue with the default value of a WYSIWYG custom field. I'd like to have the following default value:

<p>
<span class="fa fa-square yellow-clr"> </span>
<span class="fa fa-square orange-clr"> </span>
<span class="fa fa-square brown-clr"> </span>
<span class="fa fa-square pink-clr"> </span>
<span class="fa fa-square red-clr"> </span>
<span class="fa fa-square green-clr"> </span>
<span class="fa fa-square blue-clr"> </span>
<span class="fa fa-square black-clr"> </span>
<span class="fa fa-square white-clr"> </span>
</p>


but when I press save, it turns to this code:

<p>
<span class="fa fa-square yellow-clr"> </span>
<span class="fa fa-square orange-clr"> </span>
<span class="fa fa-square brown-clr"> </span>
<span class="fa fa-square pink-clr"> </span>
<span class="fa fa-square red-clr"> </span>
<span class="fa fa
</p>

Check out the last row in the paragraph. Why is this happening?


Thank you,
Dora

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

  • Posts: 83409
  • Thank you received: 13502
  • MODERATOR
7 years 11 months ago #265868

Hi,

Try turning off the "input filtering" setting of the custom field.
If that doesn't help, then try changing the editor in the "editor" setting of the HikaShop configuration as the problem must come from the editor itself.

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

  • Posts: 267
  • Thank you received: 5
4 years 9 months ago #320924

Hi,

I have a little problem with custom fields and default value.
The custom field type is an image within the order.
Additional information appears in the administration, along with other custom fields that I change frequently.
Every time I modify any of the other custom fields, the previously added image disappears since it takes the default value again. How can I keep the previously added value to be maintained?

I fix it select image ajax,

Thanks.

Last edit: 4 years 9 months ago by dvddvd. Reason: fix it

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

Time to create page: 0.094 seconds
Powered by Kunena Forum