cancel
Showing results for 
Search instead for 
Did you mean: 

Error creating product after 2.4.2-p1 to 2.4.3 upgrade

SOLVED

Error creating product after 2.4.2-p1 to 2.4.3 upgrade

Hello.

I've upgraded Magento on my dev. site from 2.4.2-p1 to 2.4.3, which went smoothly, but if I click 'Add Product' I get the following error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?))' at line 2, query was: SELECT `e`.`entity_id` FROM `mgxv_catalog_product_super_link` AS `l`
INNER JOIN `mgxv_catalog_product_entity` AS `e` ON e.entity_id = l.parent_id WHERE (l.product_id IN(?))

 

This is from exception.log:

 

[2021-08-26 08:57:50] main.CRITICAL: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?))' at line 2, query was: SELECT e.entity_id FROM mgxv_catalog_product_super_link AS l INNER JOIN mgxv_catalog_product_entity AS e ON e.entity_id = l.parent_id WHERE (l.product_id IN(?)) {"report_id":"ec517c5a03ebe3ba0494ab4d33408db992171b57923a4032be36c29afb2bddf6","exception":"[object] (Zend_Db_Statement_Exception(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?))' at line 2, query was: SELECT e.entity_id FROM mgxv_catalog_product_super_link AS l INNER JOIN mgxv_catalog_product_entity AS e ON e.entity_id = l.parent_id WHERE (l.product_id IN(?)) at /public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?))' at line 2 at /public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []

 

Is anyone able to advise what might cause this please?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

In my case, it was an Amasty extension that caused the issue, Product Attachments. I reported it to them and they have now fixed the issue for me.

View solution in original post

6 REPLIES 6

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

I have the similar issue.

Any idea how to fix it?

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

Hello I have the same issue, cant add new produts i can only update old products but not duplicate or add produts

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

In my case, it was an Amasty extension that caused the issue, Product Attachments. I reported it to them and they have now fixed the issue for me.

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

Any solution on this??

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

Yes,

 

Amasty/ProductAttachment/Model/Product/DataProvider/Modifiers/Meta.php

 

$isPartOfConfigurable = (bool)$this->configurableProduct->getParentIdsByChild(
$this->locator->getProduct()->getId()
);

Really, you'd need to do a check that the productId actually exists first since you haven't created the product yet 

 

So you could change it to 

 

if(!$this->locator->getProduct()->getId()) return $meta;

$isPartOfConfigurable = (bool)$this->configurableProduct->getParentIdsByChild(
$this->locator->getProduct()->getId()
);

Re: Error creating product after 2.4.2-p1 to 2.4.3 upgrade

I've just found this thread. For anyone this may help going forward -

I am creating my own module and was getting the same error from my custom Helper.

As said, you need to check that the product id is not null before you get the configurable parent.

 

$configproductid = $objectManager->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')->getParentIdsByChild($productid);

This gave me the error:

Syntax error or access violation: 1064 You have an error in your SQL syntax, query was: SELECT `e`.`entity_id` FROM `catalog_product_super_link` AS `l`
 INNER JOIN `catalog_product_entity` AS `e` ON e.entity_id = l.parent_id WHERE (l.product_id IN(?))

All I needed to do was check if the product id exists beforehand.

$productid = $product->getId();
if ($productid) { $configproductid = $objectManager->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')->getParentIdsByChild($productid); }

Worked great for me.