News:

Looking for documentation? Take a look on our wiki

Main Menu

Input "0"disappearing

Started by nickson, March 25, 2013, 13:38:16 PM

Previous topic - Next topic

nickson

Hello,

I have noticed some strange behavior on product attributes.
Whenever I fill in the number 0 it disappears on checkout and order confirmation.
No mather what input type is used, even with a dropdown with numbers 0,1,2,3,4,5 all numbers display correct. All but the 0.

How can I resolve this, since I sell letters and numbers its critical for me to sometimes fill in a zero.

Thanks in advance.

nickson

No one who can help? I kinda need this "fixed"

sprachrohr

hello,

i also had a problem with vm-custom plugins, where input "0" is disappearing and even not calculating. i'm using the custom textinput plugin with price per letter. everything is calculated correctly, except input "0".

I think it is a general problem in all plugins. They use the "php-empty-function". This returns true if a variable is empty, not set or "0".

I solved this by editing (in my case) "plugins/vmcustom/textinput/textinput.php"

for display, on line 101:
if(!empty($item['comment']) )

I changed to:
if(!empty($item['comment']) or $item['comment'] == 0 )

for calculating, on line 151
if (!empty($customVariant['comment']))

i changed to:
if (!empty($customVariant['comment']) or $customVariant['comment'] == 0)

Now, everything is calculating correctly and everything is shown in cart.

So, go to your plugin and have a look at your "empty" statements and if needed change them.

If you're familiar with plugins, the best way to do this is to copy the plugin, rename it and then make your changes. So on the next update your changes will still remain.

Maybe this is helpful.

regards
dirk