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

PDOException when saving product from modal #1407

Closed
jmauzyk opened this issue Apr 23, 2020 · 1 comment
Closed

PDOException when saving product from modal #1407

jmauzyk opened this issue Apr 23, 2020 · 1 comment
Assignees
Labels

Comments

@jmauzyk
Copy link

jmauzyk commented Apr 23, 2020

Description

Getting the following error logged when saving a product from the modal:

2020-04-23 10:37:33 [-][10982][-][error][yii\db\IntegrityException] PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'freeShipping' cannot be null in /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/Command.php(1093): yii\db\Command->internalExecute()
#2 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/ActiveRecord.php(332): yii\db\Command->execute()
#3 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/BaseActiveRecord.php(810): yii\db\ActiveRecord::updateAll()
#4 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/ActiveRecord.php(676): yii\db\BaseActiveRecord->updateInternal()
#5 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/db/BaseActiveRecord.php(681): yii\db\ActiveRecord->update()
#6 /home/parktool/parktoolweb2019/vendor/craftcms/commerce/src/elements/Product.php(714): yii\db\BaseActiveRecord->save()
#7 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/services/Elements.php(2125): craft\commerce\elements\Product->afterSave()
#8 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/services/Elements.php(531): craft\services\Elements->_saveElementInternal()
#9 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/controllers/ElementsController.php(160): craft\services\Elements->saveElement()
#10 [internal function]: craft\controllers\ElementsController->actionSaveElement()
#11 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#12 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#13 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction()
#14 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#15 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction()
#16 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction()
#17 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest()
#18 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#19 /home/parktool/parktoolweb2019/web/index.php(21): yii\base\Application->run()
#20 {main}

Appears to be happening when any of the lightswitches are set to off.

Steps to reproduce

  1. Double-click on a product in a product relations field to open modal window.
  2. Make sure at least one of Free Shipping, Promotable, or Available for purchase lightswitches is turned off.
  3. Click Save. Flash notification "A server error occurred" appears at top of page.

Additional info

  • Craft version: Pro 3.4.16
  • PHP version: 7.4.4
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions: Commerce 3.1.3
@lukeholder lukeholder self-assigned this Apr 24, 2020
@lukeholder
Copy link
Member

Thanks for reporting that! I’ve just fixed it for the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#ccf044deb8d0ee30c17282455e8ce661fdc144a9 as 3.1.3",
  "...": "..."
}

Then run composer update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants