3

I have an odd issue. If the total for the Drupal Commerce transaction is zero, without using a discount code, the transaction is stored properly in CiviCRM. However, if the total comes to zero by using a discount code, the transaction goes through, but does not get recorded in CiviCRM. I am using the Commerce CiviCRM module.

Thanks for any help you may provide.

Here is the backtrace that shows in the CiviCRM log:

[info] $contribution = #0 /home/pppnet/www/www/sites/all/modules/civicrm/api/api.php(51): CRM_Core_Error::backtrace("contribution", TRUE)
#1 /home/pppnet/www/www/sites/all/modules/commerce_civicrm/commerce_civicrm.module(786): civicrm_api3("Contribution", "create", (Array:16))
#2 /home/pppnet/www/www/sites/all/modules/commerce_civicrm/commerce_civicrm.module(202): _commerce_civicrm_add_contribution("21056", Object(stdClass), Object(stdClass))
#3 [internal function](): commerce_civicrm_commerce_payment_transaction_insert(Object(stdClass))
#4 /home/pppnet/www/www/includes/module.inc(957): call_user_func_array("commerce_civicrm_commerce_payment_transaction_insert", (Array:1))
#5 /home/pppnet/www/www/sites/all/modules/commerce/includes/commerce.controller.inc(98): module_invoke_all("commerce_payment_transaction_insert", Object(stdClass))
#6 /home/pppnet/www/www/sites/all/modules/commerce/includes/commerce.controller.inc(244): DrupalCommerceEntityController->invoke("insert", Object(stdClass))
#7 /home/pppnet/www/www/sites/all/modules/commerce/modules/payment/includes/commerce_payment_transaction.controller.inc(118): DrupalCommerceEntityController->save(Object(stdClass), Object(DatabaseTransaction))
#8 /home/pppnet/www/www/sites/all/modules/commerce/modules/payment/commerce_payment.module(854): CommercePaymentTransactionEntityController->save(Object(stdClass))
#9 /home/pppnet/www/www/sites/all/modules/commerce/modules/payment/modules/commerce_payment_example.module(100): commerce_payment_transaction_save(Object(stdClass))
#10 /home/pppnet/www/www/sites/all/modules/commerce/modules/payment/modules/commerce_payment_example.module(71): commerce_payment_example_transaction((Array:16), Object(stdClass), (Array:2))
#11 /home/pppnet/www/www/sites/all/modules/commerce/modules/payment/includes/commerce_payment.checkout_pane.inc(261): commerce_payment_example_submit_form_submit((Array:16), (Array:14), (Array:1), Object(stdClass), (Array:2))
#12 /home/pppnet/www/www/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.pages.inc(320): commerce_payment_pane_checkout_form_submit((Array:31), (Array:26), (Array:16), Object(stdClass))
#13 /home/pppnet/www/www/includes/form.inc(1520): commerce_checkout_form_validate((Array:31), (Array:26))
#14 /home/pppnet/www/www/includes/form.inc(1460): form_execute_handlers("validate", (Array:31), (Array:26))
#15 /home/pppnet/www/www/includes/form.inc(1190): _form_validate((Array:31), (Array:26), "commerce_checkout_form_review")
#16 /home/pppnet/www/www/includes/form.inc(890): drupal_validate_form("commerce_checkout_form_review", (Array:31), (Array:26))
#17 /home/pppnet/www/www/includes/form.inc(386): drupal_process_form("commerce_checkout_form_review", (Array:31), (Array:26))
#18 /home/pppnet/www/www/includes/form.inc(131): drupal_build_form("commerce_checkout_form_review", (Array:26))
#19 /home/pppnet/www/www/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.pages.inc(56): drupal_get_form("commerce_checkout_form_review", Object(stdClass), (Array:11))
#20 [internal function](): commerce_checkout_router(Object(stdClass), (Array:11))
#21 /home/pppnet/www/www/includes/menu.inc(527): call_user_func_array("commerce_checkout_router", (Array:2))
#22 /home/pppnet/www/www/index.php(21): menu_execute_active_handler()
#23 {main}
9
  • Hi Marianella, Can you check your Drupal error log and see if there is anything useful reported. Ditto for the CiviCRM log - this extension makes the latter possible via the ui - civicrm.org/extensions/civicrm-log-viewer
    – petednz - fuzion
    Nov 26, 2018 at 18:38
  • In the CiviCRM log, I am finding something like this (these are the first few lines). Not sure if this is helpful. [info] $contribution = #0 /home/pppnet/www/www/sites/all/modules/civicrm/api/api.php(26): CRM_Core_Error::backtrace("contribution", TRUE) #1 /home/pppnet/www/www/sites/all/modules/civicrm/api/api.php(53): civicrm_api("Contribution", "getfields", (Array:2))
    – user2174
    Nov 26, 2018 at 21:13
  • i am kind of surprised to hear anything works with a $0 contribution - there aren't many folk using the Commerce integration. We did a bunch of work on it years ago but have hardly touched in the past several years as we moved towards using Rules directly rather than this module
    – petednz - fuzion
    Nov 26, 2018 at 21:37
  • by which i mean github.com/eileenmcnaughton/commerce_civicrm_rules
    – petednz - fuzion
    Nov 26, 2018 at 21:39
  • @user2174 The backtrace you posted a few lines about in the comments is likely to provide clues! Could you please edit your original question to include the full backtrace? Nov 26, 2018 at 23:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.