Hi Folks,
I'm currently testing and debugging ecommerce rc15 with ec_nodeaccess 6x-3.0-beta1.
ec_nodeaccess is failing to issue any grants, which can be traced back to bad product purchasae rows being inserted ec_nodeaccess_transactions.
I traced this back to first product purchase hook ec_nodeaccess_ecommerceapi(&$txn, $op) in ec_nodeaccess
if I do a dump of $txn I get:
stdClass Object ( [type] => ec_buynow [items] => Array ( [187] => stdClass Object ( [nid] => 187 [type] => product [language] => [uid] => 1 [status] => 1 [created] => 1263305750 [changed] => 1263305750 [comment] => 0 [promote] => 1 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 185 [revision_uid] => 1 [title] => Test on tipster 16 [body] => [teaser] => [log] => [revision_timestamp] => 1263305750 [format] => 1 [name] => tipythia_team [picture] => [data] => Array ( ) [ptype] => generic [sku] => [price] => 0.00 [anon_policy] => 1 [hide_buynow_link] => 0 [_workflow] => [last_comment_timestamp] => 1263305750 [last_comment_name] => [comment_count] => 0 [taxonomy] => Array ( ) [files] => Array ( ) [qty] => 1 ) ) [allocation] => 2 [workflow] => 6 [shippable] => 0 [customer] => stdClass Object ( [ecid] => 3 [type] => anonymous [exid] => e4e5e3d7fe2f60610cf018a7fd2a7d7d [uid] => 0 [name] => [token] => 850e1c9f2fcaabe06ba116264f8bdb05 ) [mail] => sub2 [subtotal] => 0 [balance] => 0 [gross] => 0 [ecid] => 3 [changed] => 1263392081 [created] => 1263392081 [payment_method] => [allocated] => 0 [duedate] => 0 [token] => [txnid] => 64 )
You can see that the customer uid is being set to 0 (which is incorrect it was a registered user).
You can also see a annoymous[exid] being defined.
I checked my configuration, and have verified that the product pruchase is set to 'registered only'.
This problem also explains why I can't get rid of the email address prompt at checkout, it seems the software is hardwired to an annoymous state.
Comments
Comment #1
Bimble commentedSorry, seems this should be attached to ec_anon.
A number of other module are dependent on ec_anon being enabled, even if you dont want to use ec_anon.
However, once it's on you can't seem to turn it off. Should remove module dependencies or allow it to be disabled.
Comment #2
danielb commentedDid you check it says 'registered only' in the product node (not just at /admin/ecsettings/products)
Comment #3
danielb commentednevermind I'm having the same problem
Comment #4
joncianciullo commentedSo this module is simply NOT functional for Drupal 6?
Comment #5
Bimble commentedIt doesn't yet work for some scenarios or with ec_nodeaccess.
You might strike lucky for your project.
Comment #6
danielb commentedec_checkout module has a function ec_checkout_initialize() which calls (among other things) ec_customer_checkout_init() and that calls ec_customer_get_customer()
ec_checkout_initialize has a $params arg (which is empty in my case) and it tries to pass this to ec_customer_checkout_init() as a 2nd arg, but it does not take a 2nd arg. Instead it looks for $txn->ecid which is not there. When ec_customer_get_customer() is called it has a null arg, and then for some reason in this code that I don't quite understand yet it asks the function _ec_customer_find() to return customer info from the database for a customer with the role anonymous:
The value of $customer I believe is this:
And the value of $ctypes was:
The info in $ctypes comes from the func ec_customer_get_types() which gets its data by invoking hook_customer_info()
ec_anon's implementation of hook_customer_info() :
OK so thats where the anonymous thing is coming from
I don't know whether it is correct or not for that function to return anything if anonymous purchasing is off. That might be unrelated. Anyway, if we block ec_anon_customer_info() we get a shitload of
The argument should be an arrayerrorsdoesn't explain how to solve this, but somewhere in what I've said there is something missing, probably that $params thing way back in ec_checkout_initialize??
ec_checkout_initialize() was called by ec_cart in the function ec_cart_checkout():
does not set the 3rd arg which is $params
but also does not set anything in $txn to indicate the user
It probably is ec_cart_checkout()'s resposibility to pass on user info as it is also the function that 'composes' the initial $txn object.
But should it do it through the $params thing, or should it try to set $txn->ecid, and if so what is my user's ecid?
Comment #7
danielb commentedIt seems my user does not have an ecid
here is my ec_customer table as csv:
2 records for anonymous
perhaps ecid's are just to distinguish anonymous users from each other? in that case there is a parameter that isn't being passed on
if ecid's are for everyone, then I dunno, more research needed, as various functions definitly seem to want to rely on ecid's exclusively
need to find where these ecids are being made
Comment #8
danielb commentedecid's are made by ec_customer_insert() called by ec_customer_ec_transaction_pre_save(&$txn) an implementation of hook_ec_transaction_pre_save().
The pre save hook is invoked by ec_store_transaction_save()
I am officially lost and tired now
Comment #9
gordon commentedJust a quick follow up on this. DO you have the ec_address module installed, or another customer module?
Comment #10
gordon commentedI have changed this to by design, but I think that you have only enabled the anonymous customer type and not any other types.
If you enable the ec_address module it should resolve your problem.
Please let me know if this is not the case.
Also I have added a warning in the status page if you only have the anonymous customer type enabled.
Comment #11
Bimble commentedYep, enabling address seems to have fixed the problem
Comment #12
remco75 commentedHi gordon,
There seems to be a strange dependency here:
1. I only want registered purchases.
2 I don't want to use the adress module
But this way transactions are labeled anonymous.
I need to enable adress to map the users to the tranactions
There should be a more generic solution i think.
Any ideas?
I'm willihg to help devellop a module for this
Comment #13
gordon commentedBasically you will need create a new customer type which gives you a user type but not all the address type.
This is very small, but the problem is the the customer module will still ask for an address.
I will continue this on #1406824: Settings in adres module needed