Cannot edit/add Products in Magento 2.1.0-rc2
Steps to reproduce
- Install Magento 2.1.0-rc2 (upgraded from 2.0.7 using cli). PHP version 7.0.7.
- Go to product listing in backend, add or edit a product
Expected result
- I can add or edit a product.
Actual result
- The page redirects to the product listing, and the error message appears: "No data to save".
- If it helps: the commerce-bug extension shows the following used layout files:
Block names, classes, and files
Name: affected-attribute-set-form
Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\AttributeSet\Form
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/widget/form.phtml
Name: affected-attribute-set-selector
Magento\Framework\View\Element\Template
/var/www/users/qualipet2/src/www/vendor/magento/module-configurable-product/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/form.phtml
Name: breadcrumbs
Magento\Backend\Block\Widget\Breadcrumbs
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/widget/breadcrumbs.phtml
Name: copyright
Magento\Backend\Block\Page\Copyright
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml
Name: formkey
Magento\Backend\Block\Admin\Formkey
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/admin/formkey.phtml
Name: gallery_schedule_block2
Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content
/var/www/users/qualipet2/src/www/vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml
Name: gallery
Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery
[no template]
Name: global.search
Magento\Backend\Block\GlobalSearch
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/system/search.phtml
Name: global_notices
Magento\Backend\Block\Page\Notices
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/notices.phtml
Name: head.calendar
Magento\Framework\View\Element\Html\Calendar
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml
Name: head.components
Magento\Framework\View\Element\Js\Components
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/js/components.phtml
Name: js_schedule_block4
Magento\ConfigurableProduct\Block\Product\Configurable\AttributeSelector
/var/www/users/qualipet2/src/www/vendor/magento/module-configurable-product/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml
Name: logger
Magento\Ui\Block\Logger
/var/www/users/qualipet2/src/www/vendor/magento/module-ui/view/base/templates/logger.phtml
Name: menu
Magento\Backend\Block\Menu
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/menu.phtml
Name: messages
Magento\Framework\View\Element\Messages
[no template]
Name: new-video
Magento\ProductVideo\Block\Adminhtml\Product\Edit\NewVideo
/var/www/users/qualipet2/src/www/vendor/magento/module-product-video/view/adminhtml/templates/product/edit/slideout/form.phtml
Name: page.title
Magento\Theme\Block\Html\Title
/var/www/users/qualipet2/src/www/vendor/magento/module-theme/view/adminhtml/templates/title.phtml
Name: product.form.configurable.matrix
Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Variations\Config\Matrix
/var/www/users/qualipet2/src/www/vendor/magento/module-configurable-product/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml
Name: product.price.render.default
Magento\Framework\Pricing\Render
[no template]
Name: render.product.prices
Magento\Framework\Pricing\Render\RendererPool
[no template]
Name: require.js
Magento\Backend\Block\Page\RequireJs
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml
Name: requirejs-config
Magento\RequireJs\Block\Html\Head\Config
[no template]
Name: translate-config
Magento\Translation\Block\Html\Head\Config
[no template]
Name: translate
Magento\Translation\Block\Js
/var/www/users/qualipet2/src/www/vendor/magento/module-translation/view/base/templates/translate.phtml
Name: user
Magento\Backend\Block\Page\Header
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/header.phtml
Name: version
Magento\Backend\Block\Page\Footer
/var/www/users/qualipet2/src/www/vendor/magento/module-backend/view/adminhtml/templates/page/footer.phtml
Hi @bh-ref can you provide more details? What type of product, what fields/values were you loading? I haven't been able to reproduce your error.
this might possible be storeview related, seeing the same message in 2.0.x when trying to import/export data through the admin backend in a setup with a DE & FR storeview.
Hi @choukalos the problem appears with all product types. I use an attribute set with these attributes in it:
sku
name
description
visibility
status
price
tax_class_id
image
quantity_and_stock_status
category_ids
weight
short_description
small_image
thumbnail
media_gallery
gallery
url_key
meta_description
meta_keyword
meta_title
tier_price
gift_message_available
When I want to create a product with these attributes, it fails with the error message "No data to save".
We are using two storeviews, a French and a German one, like @heldchen mentioned.
I listed the loaded layout files above because I noticed that the file app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml is not loaded. Is that the desired behaviour?
The error message "No data to save" is generated inside https://github.com/magento/magento2/blob/2.1.0-rc2/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php if $data is empty which is the case if $data = $this->getRequest()->getPostValue() does not return a value. Since it suggests that it awaits a Post value, I had a look at app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml which does provide a <form> tag to Post the value, but this template will not be loaded in 2.1.0-rc2 (at least no on my installation), but on 2.0.7 it will be loaded.
Hi @bh-ref
Could you clear browser cache and Magento cache and try again?
Thanks, Kateryna.
Hi @katmoon
I cleared the browser and the Magento cache, but unfortunately, the problem is still there.
Hello @bh-ref "product/edit.phtml" is not loaded because in 2.1 another form rendering mechanism is used. How did you upgrade? From web or CLI? Could you please try advice from http://magento.stackexchange.com/questions/99813/how-to-update-magento2-from-2-0-0-to-2-0-2 ?
Hi @mslabko We use the Magento 2.0.7 installation from the .tar.gz archive at https://www.magentocommerce.com/download
I upgraded using the instructions listed under section "Upgrade using the command line" at http://devdocs.magento.com/guides/v2.0/release-notes/ReleaseNotes2.1_RC2CE.html which is essentially:
composer require magento/product-community-edition 2.1.0-rc1 --no-update
composer update
php bin/magento setup:upgrade
The 2.0.7 .tar.gz archive is placing the Magento files under the vendor directory, whereas the 2.1.0 Release Candidates spread them to different places. But it looks like composer is handling this correct.
rm -r www/pub/static/_requirejs/
rm -r www/pub/static/adminhtml/
rm -r www/pub/static/frontend/
rm -f www/pub/static/deployed_version.txt
rm -r www/var/page_cache/
rm -r www/var/view_preprocessed/
rm -rf www/var/di www/var/view_preprocessed/ www/var/tmp/ www/var/cache/ www/var/composer_home/ www/var/generation/ www/var/report/ www/var/page_cache/ www/var/resource_config.json www/var/.cachestates.json www/var/.regenerate
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
did not help either
Hi @bh-ref I cannot reproduce it. I installed magento 2.0.7 from tar.gz, added 2 products and then upgraded to 2.1.0-rc1 - and I'm able to save product. The same for rc2. If you use any extension, please delete them and try to reproduce again.
@mslabko thank you for your the hint, the reason it did not work was indeed due to a customization (of an htaccess file) we did.