Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sku attribute save error #7247

Closed
CatherineLearmonth opened this issue Oct 31, 2016 · 4 comments
Closed

sku attribute save error #7247

CatherineLearmonth opened this issue Oct 31, 2016 · 4 comments

Comments

@CatherineLearmonth
Copy link

Preconditions

  1. Magento 2.1.2
    Note: I thought this may be the same as bug sku attribute save error #1222 but I have upgraded from Magento 2.1.0 to 2.1.2 and am still seeing the same error

Steps to reproduce

I am updating the attributes of an existing product through the Magento API, using method addAttributeUpdate($code, $value, $store) in Catalog/Model/Product.php

I am able to update other product attributes (of any scope) using this method apart from the sku attribute, I get error Unknown column 'catalog_product_entity.value_id' in 'field list' in C:\xampp\htdocs\magento\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php on line 228

So I want to change the sku name from one value to another value through the method, but get the above error message.

Expected result

  1. I should be able to use the addAttributeUpdate method to update the sku value.

Actual result

  1. From exception.log file:
    Next exception 'Exception' with message 'Report ID: webapi-58172eac5556e; Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catalog_product_entity.value_id' in 'field list', query was: SELECT catalog_product_entity.value_id FROM catalog_product_entity WHERE (attribute_id='71' AND entity_id='2052')' in C:\xampp\htdocs\magento\vendor\magento\framework\Webapi\ErrorProcessor.php:195
    Stack trace:
    #0 C:\xampp\htdocs\magento\vendor\magento\framework\Webapi\ErrorProcessor.php(139): Magento\Framework\Webapi\ErrorProcessor->_critical(Object(Zend_Db_Statement_Exception))
    Can you commit to repository a folder dev/tests/static ? #1 C:\xampp\htdocs\magento\vendor\magento\module-webapi\Controller\Rest.php(219): Magento\Framework\Webapi\ErrorProcessor->maskException(Object(Zend_Db_Statement_Exception))
    BUG FIX - Uncaught exception when accessing admin with none existent use... #2 C:\xampp\htdocs\magento\var\generation\Magento\Webapi\Controller\Rest\Interceptor.php(37): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
    __DIR__ Typo fixed #3 C:\xampp\htdocs\magento\vendor\magento\framework\App\Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
    Enable Magento_Profiler by SetEnv #4 C:\xampp\htdocs\magento\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
    Enable automated CRUD setup for Adminhtml Grids #5 C:\xampp\htdocs\magento\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
    Why use private for message ? #6 {main} [] []
@CatherineLearmonth
Copy link
Author

CatherineLearmonth commented Oct 31, 2016

I have seen this ticket - #3687 suggesting it's not possible to update the sku value through the api. If this is the case, can you change the error message to something more meaningful to indicate that the sku can't be changed as it's a unique key.

@CatherineLearmonth
Copy link
Author

CatherineLearmonth commented Oct 31, 2016

I'm also getting the same issue on trying to update the category the product belongs to.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catalog_product_entity.value_id' in 'field list', query was: SELECT catalog_product_entity.value_id FROM catalog_product_entity WHERE (attribute_id='102' AND entity_id='2052')

This happens in program module-eav\Model\Entity\AbstractEntity.php - saveAttribute method.
The select statement selects the catalog_product_entity table and looks for a column that doesn't exist, and has an attribute value that also doesn't exist on that table.

@olysenko
Copy link

olysenko commented Nov 3, 2016

Hi, thank you for your report. The purpose of addAttributeUpdate($code, $value, $store) in Catalog/Model/Product.php is to update EAV attributes only. So you cannot use this method for SKU which is not en EAV attribute. Closed as not a bug

@aliomattux
Copy link

I agree it is not a bug but the error could indicate the problem generically such as just what you said, error: Cannot update non-eav attribute.

magento-engcom-team pushed a commit that referenced this issue Nov 25, 2021
[Platform Health] Updates for PHP8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants