The following hook code works fine when the product "smsupdate" has a price of 0, but when the price is set to a number and the purchase goes through Paypal, then the hook does not fire (though everything else in ecommerce seems fine). I thought it might be the ecommerce version I was on, which was an older beta 4, but I've just upgraded to the latest and have same problem...

Is it my code?

function smsupdate_ec_txn_workflow($txn, $orig_txn) {
  if (ec_store_transaction_workflow('type_code', $txn->workflow) == EC_WORKFLOW_TYPE_COMPLETE) {
    foreach ($txn->items as $node) {
       $customer = $txn->customer;
       if ($node->type=='smsupdate') {
         smsupdate_insert($txn->txnid, $node, $customer=$txn->customer);
         drupal_goto('/subscriber_trading_diary_subscriptions');
       }
    }
  }
}

Any tips?

Comments

Bimble’s picture

Status: Active » Closed (fixed)

$txn in _ec_txn_workflow($txn, $orig_txn) changes between hook calls. There are not the same elements for 'apply' as 'buy', and so my code didnt work.