News:

Support the VirtueMart project and become a member

Main Menu

Customfield STRING and zero

Started by jflash, December 21, 2017, 18:57:26 PM

Previous topic - Next topic

jflash

Hello!
I have customfield type string. I need put in this field numbers, including zero. All OK, but zero does not saves in database - if i reopen product, this field has nothing. Even if i make new customfield, type text, same thing happening - zero does not saves in database, field empty after saving product...

Studio 42

Hi, you need to check for strlen
Change
if (!empty($selected['comment'])) {
to
if (strlen($selected['comment'])) {

I tested it on my own plugin, i have do the same mistake in my enhanced textinput plugin.

jflash

But how make STRING customfield to work with zero?

Jörgen

Hello

Somehow this type understands the digit zero as no input. I am not sure that this is intended. Could You insert the Word ZERO instead ?
Or are You using the field for calculations ?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jflash

I have products with parameters and this parameters i use in CustomFilters. And i need parameter 0 (zero) for filtering products. I cant use o (letter) because in filters where all parameters are numbers goes this o (letter) to bottom of number list...

Studio 42


jflash

-1 works, -0 works too, but 0 does not

jflash

OK, zero is not number and i can nothing to do?

Studio 42

use another char, eg - or + that are before 0 in the ascii table should ordering correctly