Fresh install won't let me create a product of type document_general
PHP 7.1, MySQL on Ubuntu 17.04, ZC 1.5.5.e fresh install, no plugins.
A quick question, I seem to be overlooking something, or doing something really wrong. Like the subject says: a fresh install throws an error at me, whenever in a newly created category, I try to make a product of the type document_general. Preview works, but after several fresh installs, it just won't create the product. I repaired it in the file YOUR_ADMIN/include/modules/document_general/collect_info.php at line 303 by inserting:
Code:
echo zen_draw_hidden_field('products_quantity_mixed','0') .
zen_draw_hidden_field('products_qty_box_status', '1') .
zen_draw_hidden_field('products_quantity_order_max', 1);
I don't like this solution, but at the moment I can go on with other work, and wait for comments of a ZEN guru :yes:
Re: Fresh install won't let me create a product of type document_general
Quote:
Originally Posted by
jarlee
throws an error at me
I've tried reading between the lines, but I can't figure out what the actual error message is. Care to share?
Ref: http://www.zen-cart.com/content.php?124-blank-page
Re: Fresh install won't let me create a product of type document_general
The message that appears, won't say much, just after pressing the "INSERT" button on the Preview pane, I get the message "WARNING: An Error occurred, please refresh the page and try again.".
The resulting logfile will tell a much more interesting story:
Code:
[22-Sep-2017 10:52:53 Europe/Berlin] Request URI: /YOURADMIN/document_general.php?cPath=1&product_type=3&action=insert_product, IP address: 192.168.2.244
#1 trigger_error() called at [/var/www/htdocs/includes/classes/db/mysql/query_factory.php:167]
#2 queryFactory->show_error() called at [/var/www/htdocs/includes/classes/db/mysql/query_factory.php:139]
#3 queryFactory->set_error() called at [/var/www/htdocs/includes/classes/db/mysql/query_factory.php:266]
#4 queryFactory->Execute() called at [/var/www/htdocs/YOURADMIN/includes/functions/database.php:53]
#5 zen_db_perform() called at [/var/www/htdocs/YOURADMIN/includes/modules/update_product.php:69]
#6 require(/var/www/htdocs/YOURADMIN/includes/modules/update_product.php) called at [/var/www/htdocs/YOURADMIN/document_general.php:55]
[22-Sep-2017 10:52:53 Europe/Berlin] PHP Fatal error: 1366:Incorrect integer value: '' for column 'products_quantity_mixed' at row 1 :: insert into ny_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', '0', '', now(), '1') ==> (as called by) /var/www/htdocs/YOURADMIN/includes/functions/database.php on line 53 <== in /var/www/htdocs/includes/classes/db/mysql/query_factory.php on line 167
[22-Sep-2017 10:52:53 Europe/Berlin] PHP Stack trace:
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 1. {main}() /var/www/htdocs/YOURADMIN/document_general.php:0
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 2. require() /var/www/htdocs/YOURADMIN/document_general.php:55
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 3. zen_db_perform() /var/www/htdocs/YOURADMIN/includes/modules/update_product.php:69
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 4. queryFactory->Execute() /var/www/htdocs/YOURADMIN/includes/functions/database.php:53
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 5. queryFactory->set_error() /var/www/htdocs/includes/classes/db/mysql/query_factory.php:266
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 6. queryFactory->show_error() /var/www/htdocs/includes/classes/db/mysql/query_factory.php:139
[22-Sep-2017 10:52:53 Europe/Berlin] PHP 7. trigger_error() /var/www/htdocs/includes/classes/db/mysql/query_factory.php:167
Just tell me if this provides enough information or if you need more.
Re: Fresh install won't let me create a product of type document_general
To me the solution looks acceptable since this product type is designed to not allow addition to the cart, some "values" were not previously posted to the page and previously a '' would be interpreted as a 0. Under stricter configurations, the 0 needs to be passed along if a specific update_product file is not generated. The suggested fix will at least pass the information along to be processed by the preview_product and end up in the update_product processing.
Re: Fresh install won't let me create a product of type document_general
That looks like a decent patch to get you going, but ultimately I believe that the base /admin/includes/modules/update_product.php needs to be updated to ensure that any integer-type fields should be forced to integer-typed values.
Re: Fresh install won't let me create a product of type document_general
Here are the updated files to make it work with the stricter rules being imposed by your MySQL version.
https://github.com/zencart/zencart/pull/1516/files
Re: Fresh install won't let me create a product of type document_general
DrByte, I bow to the wisdom of the changes you made in the code files. Looks like you did a lot of work in just a couple of hours :)
The diffs are not hard to read, but you have to be meticulous to implement them. Like I see it now, MySQL became stricter, so passing arguments to the database needs to be stricter as well. Simply said, the argument passed to MySQL cannot be '', but the value returned the the ConvertToFloat function will take care of inserting a '0' instead. No discussion needed here, just an explanation that the problem has been found and will be taken care of in future updates, right?
1 Attachment(s)
Re: Fresh install won't let me create a product of type document_general
Hopefully are able to read the top of the page of this image which is taken from the link that DrByte posted above and shows the answer to that question as yes, in ZC 1.5.6:
Attachment 17323
Re: Fresh install won't let me create a product of type document_general
That one slipped by me! Thanks all for the fast answering, appreciated :cool: