Skip to content

Conversation

@lukeholder
Copy link
Member

No description provided.

@lukeholder lukeholder changed the title Performance improvements to shipping rule order condition formula matching [4.x] Performance improvements to shipping rule order condition formula matching Sep 4, 2024
@lukeholder lukeholder changed the base branch from 4.x to 4.7 September 10, 2024 07:37
@lukeholder lukeholder changed the base branch from 4.7 to 4.x September 10, 2024 07:40
@lukeholder lukeholder changed the base branch from 4.x to 4.7 September 10, 2024 07:41
@lukeholder lukeholder marked this pull request as ready for review September 10, 2024 08:09
@lukeholder lukeholder requested a review from a team as a code owner September 10, 2024 08:09
@lukeholder lukeholder requested review from nfourtythree and removed request for a team September 10, 2024 08:09
@lukeholder lukeholder changed the title [4.x] Performance improvements to shipping rule order condition formula matching [4.7] Performance improvements to shipping rule order condition formula matching Oct 1, 2024
@lukeholder lukeholder mentioned this pull request Oct 1, 2024
2 tasks
@lukeholder lukeholder merged commit a6efd8e into 4.7 Oct 9, 2024
3 checks passed
@lukeholder lukeholder deleted the feature/shipping-condition-performance branch October 9, 2024 09:44
// Get the cart from the request or from the session.
// When we are about to update the cart, we consider it a real cart at this point, and want to actually create it in the DB.
$this->_cart = $this->_getCart(true);
$this->_cart = $this->_getCart();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't force save it anymore, so it may not actually be created in the db? For me this results in errors when adding notices, since sometimes they don't have orderIds anymore, which cannot be null:

2024-12-20 14:02:23 [web.ERROR] [yii\db\IntegrityException] SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "orderId" of relation "commerce_ordernotices" violates not-null constraint DETAIL:  Failing row contains (374272, null, lineItemSalePriceChanged, lineItems..qty, Comfort Edition | Rechthoekig / 366x244cm / Zwart / 5093A heeft ..., 2024-12-20 13:02:23, 2024-12-20 13:02:23, 86939cb3-315e-4beb-a633-449631b45f5f). The SQL being executed was: INSERT INTO "commerce_ordernotices" ("orderId", "type", "attribute", "message", "dateCreated", "dateUpdated", "uid") VALUES (NULL, 'lineItemSalePriceChanged', 'lineItems..qty', 'Comfort Edition | Rechthoekig / 366x244cm / Zwart / 5093A heeft maar 0 op voorraad.', '2024-12-20 13:02:23', '2024-12-20 13:02:23', '86939cb3-315e-4beb-a633-449631b45f5f') RETURNING "id" {"trace":["#0 /app/vendor/yiisoft/yii2/db/Command.php(1325): yii\\db\\Schema->convertException()","#1 /app/vendor/yiisoft/yii2/db/Command.php(1186): yii\\db\\Command->internalExecute()","#2 /app/vendor/yiisoft/yii2/db/Command.php(431): yii\\db\\Command->queryInternal()","#3 /app/vendor/yiisoft/yii2/db/pgsql/Schema.php(646): yii\\db\\Command->queryOne()","#4 /app/vendor/yiisoft/yii2/db/ActiveRecord.php(604): yii\\db\\pgsql\\Schema->insert()","#5 /app/vendor/yiisoft/yii2/db/ActiveRecord.php(570): yii\\db\\ActiveRecord->insertInternal()","#6 /app/vendor/yiisoft/yii2/db/BaseActiveRecord.php(688): yii\\db\\ActiveRecord->insert()","#7 /app/vendor/craftcms/commerce/src/elements/Order.php(3467): yii\\db\\BaseActiveRecord->save()","#8 /app/vendor/craftcms/commerce/src/elements/Order.php(2196): craft\\commerce\\elements\\Order->_saveNotices()","#9 /app/vendor/craftcms/cms/src/services/Elements.php(3450): craft\\commerce\\elements\\Order->afterSave()","#10 /app/vendor/craftcms/cms/src/services/Elements.php(1109): craft\\services\\Elements->_saveElementInternal()","#11 /app/vendor/craftcms/commerce/src/controllers/CartController.php(525): craft\\services\\Elements->saveElement()","#12 /app/vendor/craftcms/commerce/src/controllers/CartController.php(327): craft\\commerce\\controllers\\CartController->_returnCart()","#13 [internal function]: craft\\commerce\\controllers\\CartController->actionUpdateCart()","#14 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#15 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#16 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#17 /app/vendor/craftcms/cms/src/web/Application.php(341): yii\\base\\Module->runAction()","#18 /app/vendor/craftcms/cms/src/web/Application.php(640): craft\\web\\Application->runAction()","#19 /app/vendor/craftcms/cms/src/web/Application.php(303): craft\\web\\Application->_processActionRequest()","#20 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#21 /app/web/index.php(28): yii\\base\\Application->run()","#22 {main}"],"memory":14758936,"exception":"[object] (yii\\db\\IntegrityException(code: 23502): SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column \"orderId\" of relation \"commerce_ordernotices\" violates not-null constraint\nDETAIL:  Failing row contains (374272, null, lineItemSalePriceChanged, lineItems..qty, Comfort Edition | Rechthoekig / 366x244cm / Zwart / 5093A heeft ..., 2024-12-20 13:02:23, 2024-12-20 13:02:23, 86939cb3-315e-4beb-a633-449631b45f5f).\nThe SQL being executed was: INSERT INTO \"commerce_ordernotices\" (\"orderId\", \"type\", \"attribute\", \"message\", \"dateCreated\", \"dateUpdated\", \"uid\") VALUES (NULL, 'lineItemSalePriceChanged', 'lineItems..qty', 'Comfort Edition | Rechthoekig / 366x244cm / Zwart / 5093A heeft maar 0 op voorraad.', '2024-12-20 13:02:23', '2024-12-20 13:02:23', '86939cb3-315e-4beb-a633-449631b45f5f') RETURNING \"id\" at /app/vendor/yiisoft/yii2/db/Schema.php:676)\n[previous exception] [object] (PDOException(code: 23502): SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column \"orderId\" of relation \"commerce_ordernotices\" violates not-null constraint\nDETAIL:  Failing row contains (374272, null, lineItemSalePriceChanged, lineItems..qty, Comfort Edition | Rechthoekig / 366x244cm / Zwart / 5093A heeft ..., 2024-12-20 13:02:23, 2024-12-20 13:02:23, 86939cb3-315e-4beb-a633-449631b45f5f). at /app/vendor/yiisoft/yii2/db/Command.php:1320)"} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants