VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: jflash on December 21, 2017, 18:57:26 PM

Title: Customfield STRING and zero
Post by: jflash on December 21, 2017, 18:57:26 PM
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...
Title: Re: Customfield STRING and zero
Post by: Studio 42 on December 22, 2017, 01:11:53 AM
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.
Title: Re: Customfield STRING and zero
Post by: jflash on December 22, 2017, 07:15:58 AM
But how make STRING customfield to work with zero?
Title: Re: Customfield STRING and zero
Post by: Jörgen on December 22, 2017, 07:59:05 AM
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
Title: Re: Customfield STRING and zero
Post by: jflash on December 22, 2017, 08:30:51 AM
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...
Title: Re: Customfield STRING and zero
Post by: Studio 42 on December 22, 2017, 10:09:40 AM
Have you try -1 ?
Title: Re: Customfield STRING and zero
Post by: jflash on December 22, 2017, 10:12:31 AM
-1 works, -0 works too, but 0 does not
Title: Re: Customfield STRING and zero
Post by: jflash on December 24, 2017, 20:35:47 PM
OK, zero is not number and i can nothing to do?
Title: Re: Customfield STRING and zero
Post by: Studio 42 on December 25, 2017, 11:24:05 AM
use another char, eg - or + that are before 0 in the ascii table should ordering correctly