News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom field with "0" value impossible?

Started by d0ublezer0, May 28, 2019, 12:45:35 PM

Previous topic - Next topic

d0ublezer0

I need to store zero integer value (0) in custom field, but i see empty field after saving it.
Any ideas, how to avoid this?
vm3.2.14

String value 0 - it's not empty, it zero value


d0ublezer0

#2
Try to pass this algorithm:

Create custom field of type string.
Add it to some product.

Enter the "0" digit in custom field:


Click save (don't close product page).

You'll see an empty field:



If we take a look (at this time) into the site database, we will see zero value in database field:


Click Save product, again.
Empty field stays on its place, like before.

But, if we look at the database now:

Zero value is gone.

Hungry Virtuemart eats my zero values )
And yours too, of course.

But unfortunately, this is not funny. Definitely not.


d0ublezer0

Request for VM developers: please, fix this issue. This is great problem in my case. We actively use zero-values in custom fields, but cannot work correctly with them.

jjk

#5
Does it work if you enter a 0 plus a space character or a space character plus 0? (Adds two characters into the database)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

d0ublezer0

Quote from: jjk on July 03, 2019, 12:11:01 PM
Does it work if you enter a 0 plus a space character or a space character plus 0? (Adds two characters into the database)
yes, "0 " was saved normally.
but this value not equals "0"

Studio 42

Why you need "0" ?
I know this should work, but a day to simplify the code, the devs decided to check for all empty values and 0 is an empty value in PHP

d0ublezer0

Quote from: Studio 42 on July 17, 2019, 11:08:30 AM
Why you need "0" ?
I know this should work, but a day to simplify the code, the devs decided to check for all empty values and 0 is an empty value in PHP
Because we selling off-road wheel disks.

https://en.m.wikipedia.org/wiki/Wheel_sizing
QuoteThe offset is the distance from the hub-mounting surface to the wheel's true centerline. It is measured in mm and can be either positive or negative. A positive offset means the hub-mounting surface is closer to the outside edge of the wheel, while a negative offset means the hub-mounting surface is closer to the inside edge of the wheel.

Our disks has offset from -73 to +35, through the zero ("0") value.
So, we cannot save this value.

balai

It's a bug.
VM custom field value cannot store "0" as it regards it empty

Studio 42

You can create a customfield plugin to use "0", you can check the core "text input" customfield plugin and modify it for your need.
Because all is saved as parameters, it's not a problem.
The only problem is if you need to use it as a search field.

d0ublezer0

Quote from: Studio 42 on July 17, 2019, 14:09:57 PM
You can create a customfield plugin to use "0", you can check the core "text input" customfield plugin and modify it for your need.
Because all is saved as parameters, it's not a problem.
The only problem is if you need to use it as a search field.
We use custom fields filter by Breakdesigns.
I do not think it will work with a new type of fields.

Studio 42

Can you not use a joomla Key ?
Eg. ZERO
And you declare as key
KEY : ZERO
value : 0
this display then in front end : 0