Здравствуйте, второй день не могу решить проблему. Помогите, пожалуйста.
Допиливаю функционал для Opencart. Есть функция, которая выполняется для каждого элемента xml`я.
public function addOptionToProductValue($product_id,$option_name,$quantity){
$query=$this->db->query("SELECT * FROM product_option_value ORDER BY product_option_value_id DESC ");
if ($wtf=$query->rows){
$curent=$query->rows[0]['product_option_value_id'];
$next=$curent+1;
} else {
$next=1;
}
$query=$this->db->query("SELECT * FROM product_option ORDER BY product_option_id DESC LIMIT 1");
$product_option_id=$query->row['product_option_id'];
$query=$this->db->query("SELECT option_value_id FROM option_value_description WHERE name='$option_name'");
$option_value_id=$query->row['option_value_id'];
$query=$this->db->query("INSERT INTO `".DB_PREFIX."product_option_value` VALUES ($next,$product_option_id,$product_id,1,$option_value_id,$quantity,1,0.0000,'+',0,'+',0.0000000,'+')");
$querystr="INSERT INTO `".DB_PREFIX."product_option_value` VALUES ($next,$product_option_id,$product_id,1,$option_value_id,$quantity,1,0.0000,'+',0,'+',0.0000000,'+')";
return array($querystr,$query,$product_option_id,$option_value_id,$next,$wtf);
}
Соответственно, она генерит примерно следующее
INSERT INTO `product_option_value`(product_option_id,product_id,option_id, option_value_id,quantity,subtract,price,price_prefix,points,points_prefix,weight,weight_prefix) VALUES (292,1,1,13,10,1,0.0000,'+',0,'+',0.0000000,'+')
INSERT INTO `product_option_value`(product_option_id,product_id,option_id, option_value_id,quantity,subtract,price,price_prefix,points,points_prefix,weight,weight_prefix) VALUES (293,2,1,14,10,1,0.0000,'+',0,'+',0.0000000,'+')
INSERT INTO `product_option_value`(product_option_id,product_id,option_id, option_value_id,quantity,subtract,price,price_prefix,points,points_prefix,weight,weight_prefix) VALUES (294,3,1,15,1,1,0.0000,'+',0,'+',0.0000000,'+')
INSERT INTO `product_option_value`(product_option_id,product_id,option_id, option_value_id,quantity,subtract,price,price_prefix,points,points_prefix,weight,weight_prefix) VALUES (295,3,1,16,2,1,0.0000,'+',0,'+',0.0000000,'+')
INSERT INTO `product_option_value`(product_option_id,product_id,option_id, option_value_id,quantity,subtract,price,price_prefix,points,points_prefix,weight,weight_prefix) VALUES (296,3,1,17,1,1,0.0000,'+',0,'+',0.0000000,'+')
и т.д.
Проблема в том, что 3 и 4 запросы из списка выше возвращают 1, но на самом деле не пишутся в базу.