Jump to content
Sign in to follow this  
Standartmind

[Решено] Ошибка Mysql 1064, при импорте товара

Recommended Posts

Добырй день. На днях столкнулся  с ошибкой при  попытке импорта товаров из *.xml

Код ошибки:

 

Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error No: 1064
INSERT INTO os_product_special (product_id , customer_group_id, `priority`, price, discount, date_start, date_end) VALUES ; in /var/www/site/data/www/site/system/database/mysql.php on line 49

 

вот кусок кода, из файла import.php на который я грешу:

        $db->query("INSERT INTO " . DB_PREFIX . "product_description (product_id,language_id,`name`,meta_keyword,meta_description,`description`,seo_title,seo_h1) VALUES " . $query_values['product_description'] . ";");
        $db->query("INSERT INTO " . DB_PREFIX . "product_to_store (product_id , store_id) VALUES " . $query_values['product_to_store'] . ";");
        $db->query("INSERT INTO " . DB_PREFIX . "product_special (product_id , customer_group_id, `priority`, price, discount, date_start, date_end) VALUES " . $query_values['product_special'] . ";");


Таблица "os_product_special"

`base_name`.`os_product_special`
$os_product_special = array(
array('product_special_id' => '1','product_id' => '582','customer_group_id' => '1','priority' => '0','price' => '42412.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '2','product_id' => '377','customer_group_id' => '1','priority' => '0','price' => '25429.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '3','product_id' => '155','customer_group_id' => '1','priority' => '0','price' => '30019.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '4','product_id' => '123','customer_group_id' => '1','priority' => '0','price' => '28825.5000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '5','product_id' => '1130','customer_group_id' => '1','priority' => '0','price' => '14717.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '6','product_id' => '3439','customer_group_id' => '1','priority' => '0','price' => '27090.5000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '7','product_id' => '3008','customer_group_id' => '1','priority' => '0','price' => '11398.5000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '8','product_id' => '53','customer_group_id' => '1','priority' => '0','price' => '7416.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '9','product_id' => '240','customer_group_id' => '1','priority' => '0','price' => '29376.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '10','product_id' => '98','customer_group_id' => '1','priority' => '0','price' => '8062.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '11','product_id' => '3738','customer_group_id' => '1','priority' => '0','price' => '7860.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '12','product_id' => '261','customer_group_id' => '1','priority' => '0','price' => '20655.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '13','product_id' => '558','customer_group_id' => '1','priority' => '0','price' => '50674.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '14','product_id' => '449','customer_group_id' => '1','priority' => '0','price' => '42228.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '15','product_id' => '3760','customer_group_id' => '1','priority' => '0','price' => '43146.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '16','product_id' => '3757','customer_group_id' => '1','priority' => '0','price' => '27448.5000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '17','product_id' => '1373','customer_group_id' => '1','priority' => '0','price' => '21615.5000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '18','product_id' => '3764','customer_group_id' => '1','priority' => '0','price' => '13010.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '19','product_id' => '1340','customer_group_id' => '1','priority' => '0','price' => '19462.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '20','product_id' => '250','customer_group_id' => '1','priority' => '0','price' => '18452.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '21','product_id' => '2512','customer_group_id' => '1','priority' => '0','price' => '45166.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00'),
array('product_special_id' => '22','product_id' => '3734','customer_group_id' => '1','priority' => '0','price' => '7800.0000','discount' => '50.00','date_start' => '0000-00-00','date_end' => '0000-00-00')
);

 

Перечитал все похожие темы, которые нашел. Но не смог найти решение

 

Хостер : thehost

Версия Php    : 5.3.10

Версия Mysql : 5.5.41

Версия магазина : opencart 1.5.3

Share this post


Link to post
Share on other sites

1. А префикс таблицы точно os_ а не oc_ ?

2. Уникальный ключ в таблице указан?

3. Почему priority в кавычках?

Share this post


Link to post
Share on other sites

Префикс : os_    -точно

 

priority - пробовал без кавычер оставлять, -  ничего не меняется ( ошибка остается та же) и вывод у нее такой же.

 

вот так более полно выглядит обращение к базе в файле php:

$db->query("INSERT INTO " . DB_PREFIX . "product_description (product_id,language_id,`name`,meta_keyword,meta_description,`description`,seo_title,seo_h1) VALUES " . $query_values['product_description'] . ";");
$db->query("INSERT INTO " . DB_PREFIX . "product_to_store (product_id , store_id) VALUES " . $query_values['product_to_store'] . ";");
$db->query("INSERT INTO " . DB_PREFIX . "product_special (product_id , customer_group_id, `priority`, price, discount, date_start, date_end) VALUES " . $query_values['product_special'] . ";");

$db->query("INSERT INTO " . DB_PREFIX . "product_reward (product_id, customer_group_id, points) VALUES " . $query_values['product_reward'] . ";");
$db->query("INSERT INTO " . DB_PREFIX . "url_alias (`query`, `keyword`) VALUES " . $query_values['url_alias'] . ";");

$db->query("START TRANSACTION;");
$db->query("INSERT HIGH_PRIORITY INTO `" . DB_PREFIX . "product_price_gramm` (`product_id`, `psize`, `price_gramm`,`barcode`) VALUES " . $query_values['product_price_gram'] . ";");
$db->query("COMMIT;");

$db->query("INSERT INTO " . DB_PREFIX . "product_attribute (product_id, attribute_id, language_id, `text`) VALUES " . $query_values['product_attributes'] . " ;");

$db->query("INSERT INTO " . DB_PREFIX . "product_image (product_id, image, sort_order) VALUES " . $query_values['product_image'] . " ;");

$db->query("INSERT INTO " . DB_PREFIX . "product_to_category (product_id , category_id) VALUES " . $query_values['product_to_category'] . ";");

Про уникальный ключ - затрудняюсь ответить. Я совершенно не разбираюсь в Mysql. Но могу постараться ответить, если вы дадите более наводящий вопрос.

Share this post


Link to post
Share on other sites

Проверьте значение $query_values['product_special']. Если оно пустое, будет как раз такая ошибка.

Share this post


Link to post
Share on other sites

>> На днях столкнулся с ошибкой при попытке импорта товаров из *.xml

это что-то стороннее.

к автору с вопросами (какими - @igon написал).

Share this post


Link to post
Share on other sites

>> На днях столкнулся с ошибкой при попытке импорта товаров из *.xml

это что-то стороннее.

к автору с вопросами (какими - @igon написал).

Ошибка действительно сторонняя  -  проблема связана с выгрузкой определенного товара : у него оказывается нулевой id.

Share this post


Link to post
Share on other sites

Проблема была решена правкой *.xml  файла импорта

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.