Zen Cart Logo
Forums / Bug Reports / Zen Cart 1.3.9f - 1366 Incorrect integer value : products_virtual

Zen Cart 1.3.9f - 1366 Incorrect integer value : products_virtual

Views: 3,208

Results 1 to 3 of 3
22 Mar 2013, 11:36 AM
#1
robax avatar

robax

Zen Follower

Join Date:
Mar 2006
Posts:
187
Plugin Contributions:
0

Zen Cart 1.3.9f - 1366 Incorrect integer value : products_virtual

Hi there,

I am running:
Zen Cart 1.3.9f
Database Patch Level: 1.3.9b
v1.3.9b [2010-05-18 18:34:34] (Version Update 1.3.8->1.3.9b)
v1.3.8 [2008-07-30 02:07:56] (Fresh Installation)
MySQL 5.5.21
PHP Version: 5.2.17

This is the first time I have tried adding a "Document - General" product type. Inserting it causes the error pasted below.

From forum searches I am led to believe the issue is in:
/admin/includes/modules/update_product.php

I have tested DrByte's fix from this thread, but the result is the same:
http://www.zen-cart.com/showthread.php?103962-Done-v1-3-9-incorrect-integer-value-products_virtual

I have also tested the same file from 1.3.9h and got the same error.

Is there something I can do to make this work?
Thanks for any advice on this.
Regards
Rob

1366 Incorrect integer value: '' for column 'products_priced_by_attribute' at row 1
in:
[insert into products (products_quantity, products_type, products_model, products_price, products_date_available, products_weight, products_status, products_virtual, products_tax_class_id, manufacturers_id, products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute, product_is_free, product_is_call, products_quantity_mixed, product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order, products_discount_type, products_discount_type_from, products_price_sorter, products_image, products_date_added, master_categories_id) values ('0', '3', '', '0', null, '0', '1', '0', '0', '0', '1', '1', '', '0', '0', '', '0', '', '', '0', '0', '0', '0', '', now(), '216')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

22 Mar 2013, 1:29 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Zen Cart 1.3.9f - 1366 Incorrect integer value : products_virtual

If we analyse the INPUTS, we get:

products_quantity, '0',
products_type, '3',
products_model, '',
products_price, '0',
products_date_available, null,
products_weight, '0',
products_status, '1',
products_virtual, '0',
products_tax_class_id, '0',
manufacturers_id, '0',
products_quantity_order_min, '1',
products_quantity_order_units, '1',
products_priced_by_attribute, '',
product_is_free, '0',
product_is_call, '0',
products_quantity_mixed, '',
product_is_always_free_shipping, '0',
products_qty_box_status, '',
products_quantity_order_max, '',
products_sort_order, '0',
products_discount_type, '0',
products_discount_type_from, '0',
products_price_sorter, '0',
products_image, '',
products_date_added, now(),
master_categories_id, '216'

products_priced_by_attribute, '', Is the first instance of this falling over, because an integer is expected, but no value is given.

It is likely that when this is fixed, the NEXT instance of an expected integer value which is empty is:
products_quantity_mixed, '', (INTEGER IS EXPECTED)

... and then:
products_qty_box_status, '', (INTEGER IS EXPECTED)

...whereas:
products_image, '', (This field is VARCHAR, so being empty does not matter).

So... MAYBE if you add the three expected integers via Dr Byte's suggested fix...

// Data-cleaning to prevent MySQL5 data-type mismatch errors:
    $tmp_value = zen_db_prepare_input($_POST['products_quantity']);
    $products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_price']);
    $products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_weight']);
    $products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['manufacturers_id']);
    $manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_priced_by_attribute']);
    $products_priced_by_attribute = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_quantity_mixed']);
    $products_quantity_mixed = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_qty_box_status']);
    $products_qty_box_status = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;

    $sql_data_array = array('products_quantity' => $products_quantity,
                            'products_type' => zen_db_prepare_input($_GET['product_type']),
                            'products_model' => zen_db_prepare_input($_POST['products_model']),
                            'products_price' => $products_price,
                            'products_date_available' => $products_date_available,
                            'products_weight' => $products_weight,
                            'products_status' => zen_db_prepare_input((int)$_POST['products_status']),
                            'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']),
                            'products_tax_class_id' => zen_db_prepare_input((int)$_POST['products_tax_class_id']),
                            'manufacturers_id' => $manufacturers_id,
                            'products_quantity_order_min' => zen_db_prepare_input($_POST['products_quantity_order_min']),
                            'products_quantity_order_units' => zen_db_prepare_input($_POST['products_quantity_order_units']),
                            'products_priced_by_attribute' => zen_db_prepare_input($_POST['products_priced_by_attribute']),
                            'product_is_free' => zen_db_prepare_input((int)$_POST['product_is_free']),
                            'product_is_call' => zen_db_prepare_input((int)$_POST['product_is_call']),
                            'products_quantity_mixed' => zen_db_prepare_input($_POST['products_quantity_mixed']),
                            'product_is_always_free_shipping' => zen_db_prepare_input((int)$_POST['product_is_always_free_shipping']),
                            'products_qty_box_status' => zen_db_prepare_input($_POST['products_qty_box_status']),
                            'products_quantity_order_max' => zen_db_prepare_input($_POST['products_quantity_order_max']),
                            'products_sort_order' => (int)zen_db_prepare_input($_POST['products_sort_order']),
                            'products_discount_type' => zen_db_prepare_input($_POST['products_discount_type']),
                            'products_discount_type_from' => zen_db_prepare_input($_POST['products_discount_type_from']),
                            'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
                            );
22 Jun 2013, 2:48 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Zen Cart 1.3.9f - 1366 Incorrect integer value : products_virtual

robax:

1366 Incorrect integer value: '' for column 'products_priced_by_attribute' at row 1
Note that your error message was referring to the products_priced_by_attribute field, not products_virtual.

Schoolboy is correct.
but this is a simpler fix, and will be included in v1.6.0:
Fix: ```
'products_priced_by_attribute' => zen_db_prepare_input(B[/B]$_POST['products_priced_by_attribute']),