1

Folks:

I've been running this site for 2 years without issue but today, this cropped up:

"CDbTransaction is inactive and cannot perform commit or roll back operations."

This occurs when adding a product to the cart. Note that this only occurs on a specific set of products. Others do not have this issue. And the product is added to the cart.

Full error from the logs:

2019/03/29 15:33:54 [error] [exception.CDbException] exception 'CDbException' with message 'CDbTransaction is inactive and cannot perform commit or roll back operations.' in /usr/home/business/domain.com/craft/app/framework/db/CDbTransaction.php:84
Stack trace:`
#0 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(124): CDbTransaction->rollback()`
#1 /usr/home/business/domain.com/craft/plugins/commerce/controllers`/Commerce_CartController.php(173): ``Craft\Commerce_CartService->addToCart(Object(Craft\Commerce_OrderModel), '762', '1', '', Array, '')
#2 /usr/home/business/domain.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\Commerce_CartController->actionUpdateCart()
#3 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#4 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
#5 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#6 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController->run('updateCart')
#7 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication->runController('commerce/cart/u...')
#8 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp->_processActionRequest()
#9 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#10 /usr/home/business/domain.com/craft/app/index.php(73): CApplication->run()
#11 /usr/home/business/domain.com/public_html/index.php(20): require_once('/usr/home/business/...')
#12 {main}
REQUEST_URI=/support/replacementparts
HTTP_REFERER=https://www.domain.com/support/replacementparts`

Interestingly, the client encountered a different error when adding a product to the cart: "Property "Craft\Commerce_ProductModel.product" is not defined." From the logs:

2019/03/29 17:59:31 [error] [exception.CException] exception 'CException' with message 'Property "Craft\Commerce_ProductModel.product" is not defined.' in /usr/home/business/domain.com/craft/app/framework/base/CComponent.php:130
Stack trace:
#0 /usr/home/business/domain.com/craft/app/models/BaseModel.php(87): CComponent->__get('product')
#1 /usr/home/business/domain.com/craft/app/models/BaseElementModel.php(141): Craft\BaseModel->__get('product')
#2 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(644): Craft\BaseElementModel->__get('product')
#3 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(411): Craft\InstantAnalyticsService->_pullDataFromField(Object(Craft\Commerce_ProductModel), 'product_name')
#4 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(512): Craft\InstantAnalyticsService->addProductDataFromLineItem(Object(Craft\IAnalytics), Object(Craft\Commerce_LineItemModel))
#5 /usr/home/business/domain.com/craft/plugins/instantanalytics/InstantAnalyticsPlugin.php(107): Craft\InstantAnalyticsService->removeFromCart(NULL, Object(Craft\Commerce_LineItemModel))
#6 [internal function]: Craft\InstantAnalyticsPlugin->Craft\{closure}(Object(Craft\Event))
#7 /usr/home/business/domain.com/craft/app/framework/base/CComponent.php(567): call_user_func(Object(Closure), Object(Craft\Event))
#8 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(573): CComponent->raiseEvent('onBeforeRemoveF...', Object(Craft\Event))
#9 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(506): Craft\Commerce_CartService->onBeforeRemoveFromCart(Object(Craft\Event))
#10 /usr/home/business/domain.com/craft/plugins/commerce/controllers/Commerce_CartController.php(107): Craft\Commerce_CartService->removeFromCart(Object(Craft\Commerce_OrderModel), '21997')
#11 /usr/home/business/domain.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\Commerce_CartController->actionRemoveLineItem()
#12 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#13 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
#14 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#15 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController->run('removeLineItem')
#16 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication->runController('commerce/cart/r...')
#17 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp->_processActionRequest()
#18 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#19 /usr/home/business/domain.com/craft/app/index.php(73): CApplication->run()
#20 /usr/home/business/domain.com/public_html/index.php(20): require_once('/usr/home/business/...')
#21 {main}
REQUEST_URI=/commerce/cart
HTTP_REFERER=https://www.domain.com/commerce/cart

Still on Craft2 and Commerce1 with this one.

Any assistance would be great.

1

After some mucking around, I traced this to the InstantAnalytics plug-in. Essentially, I had changed the setting Commerce Product Brand Field from "none" to "Name". This worked fine for most products but not all. Reverting this back to "none" fixed the issue.

This page was helpful: https://github.com/verbb/multi-add/issues/8. Particularly the bit of commenting out $transaction->rollback(); in Commerce_CartService.php. That provided an error in the log that led right to the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.