Answers.Body: <p>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.</p>
  
  <p>This page was helpful: <a href="https://github.com/verbb/multi-add/issues/8" rel="nofollow noreferrer">https://github.com/verbb/multi-add/issues/8</a>. Particularly the bit of commenting out <code>$transaction-&gt;rollback();</code> in Commerce_CartService.php. That provided an error in the log that led right to the issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-30T14:43:25.173Z
Answers.LastActivityDate: 2019-03-30T14:43:25.173Z
Answers.UserDisplayName: Wonko
Body: <p>Folks:</p>
  
  <p>I've been running this site for 2 years without issue but today, this cropped up:</p>
  
  <p>"CDbTransaction is inactive and cannot perform commit or roll back operations."</p>
  
  <p>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.</p>
  
  <p>Full error from the logs:</p>
  
  <pre><code>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-&gt;rollback()`
  #1 /usr/home/business/domain.com/craft/plugins/commerce/controllers`/Commerce_CartController.php(173): ``Craft\Commerce_CartService-&gt;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-&gt;actionUpdateCart()
  #3 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #4 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #5 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #6 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController-&gt;run('updateCart')
  #7 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication-&gt;runController('commerce/cart/u...')
  #8 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&gt;_processActionRequest()
  #9 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
  #10 /usr/home/business/domain.com/craft/app/index.php(73): CApplication-&gt;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`
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>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-&gt;__get('product')
  #1 /usr/home/business/domain.com/craft/app/models/BaseElementModel.php(141): Craft\BaseModel-&gt;__get('product')
  #2 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(644): Craft\BaseElementModel-&gt;__get('product')
  #3 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(411): Craft\InstantAnalyticsService-&gt;_pullDataFromField(Object(Craft\Commerce_ProductModel), 'product_name')
  #4 /usr/home/business/domain.com/craft/plugins/instantanalytics/services/InstantAnalyticsService.php(512): Craft\InstantAnalyticsService-&gt;addProductDataFromLineItem(Object(Craft\IAnalytics), Object(Craft\Commerce_LineItemModel))
  #5 /usr/home/business/domain.com/craft/plugins/instantanalytics/InstantAnalyticsPlugin.php(107): Craft\InstantAnalyticsService-&gt;removeFromCart(NULL, Object(Craft\Commerce_LineItemModel))
  #6 [internal function]: Craft\InstantAnalyticsPlugin-&gt;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-&gt;raiseEvent('onBeforeRemoveF...', Object(Craft\Event))
  #9 /usr/home/business/domain.com/craft/plugins/commerce/services/Commerce_CartService.php(506): Craft\Commerce_CartService-&gt;onBeforeRemoveFromCart(Object(Craft\Event))
  #10 /usr/home/business/domain.com/craft/plugins/commerce/controllers/Commerce_CartController.php(107): Craft\Commerce_CartService-&gt;removeFromCart(Object(Craft\Commerce_OrderModel), '21997')
  #11 /usr/home/business/domain.com/craft/app/framework/web/actions/CInlineAction.php(49): Craft\Commerce_CartController-&gt;actionRemoveLineItem()
  #12 /usr/home/business/domain.com/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #13 /usr/home/business/domain.com/craft/app/framework/web/CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #14 /usr/home/business/domain.com/craft/app/framework/web/CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #15 /usr/home/business/domain.com/craft/app/framework/web/CWebApplication.php(282): CController-&gt;run('removeLineItem')
  #16 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(837): CWebApplication-&gt;runController('commerce/cart/r...')
  #17 /usr/home/business/domain.com/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&gt;_processActionRequest()
  #18 /usr/home/business/domain.com/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
  #19 /usr/home/business/domain.com/craft/app/index.php(73): CApplication-&gt;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
  </code></pre>
  
  <p>Still on Craft2 and Commerce1 with this one.</p>
  
  <p>Any assistance would be great.</p>
  
Tags: <plugin-craftcommerce>
Title: CDbTransaction is inactive and cannot perform commit or roll back operations
ThreadText: # CDbTransaction is inactive and cannot perform commit or roll back operations
  
  (Asked by: username_0 on 2019-03-29)
  
  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.
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-03-30. Score: 1 | Accepted answer
  
  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.
  
  
  ---
  
  