PDA

View Full Version : osCMax-2.0RC2-update051112 1064 Error.



gamerigs
12-04-2005, 11:49 AM
The code line below when applied from osCMax-2.0RC2-update051112 patch causes 1064 SQL error when you try to "copy to" duplicate in the catagory products page. If you omit it no problem occurs.



// LINE CHANGED: MS2 update 501112 - Added :(empty($product['products_date_available']) ? "null" : ...{some code}... ") . "
// LINE MODED: Added "products_ship_price"
tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_ship_price, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . $product['products_ship_price'] . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ". '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
$dup_products_id = tep_db_insert_id();

michael_s
12-04-2005, 12:38 PM
There was a syntax error. Changing the query to the following (line 368) will correct the problem:


tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_ship_price, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . $product['products_ship_price'] . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

gamerigs
12-05-2005, 01:11 AM
Original


.....tep_db_input($product['products_price']) . "', '".......

now(), '" . tep_db_input($product['products_date_available'])
.....


New


.....tep_db_input($product['products_price']) . "', now(), "

"null" : "'" . tep_db_input($product['products_date_available'])
......

The new code which is part of the update patch causes a number of Mysql errors if implemented. When I revert to the old code everything works again? Not sure what this update is meant to do but if you attempt to COPY TO you will get Mysql errors if this code is present?


There was a syntax error. Changing the query to the following (line 368) will correct the problem:


tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_ship_price, products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . $product['products_ship_price'] . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

michael_s
12-05-2005, 06:44 AM
Use the code I posted as a fix. It corrects the issue.