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

Bimble’s picture

Component: store » ec_anon

Sorry, 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.

danielb’s picture

Did you check it says 'registered only' in the product node (not just at /admin/ecsettings/products)

danielb’s picture

nevermind I'm having the same problem

joncianciullo’s picture

So this module is simply NOT functional for Drupal 6?

Bimble’s picture

It doesn't yet work for some scenarios or with ec_nodeaccess.

You might strike lucky for your project.

danielb’s picture

ec_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:

  // Ask each provider if they know the customer.
  foreach ($ctypes as $ctype => $info) {
    if ($customer = ec_customer_invoke($ctype, 'customer_get_id', $filter)) {
      if ($return = _ec_customer_find($customer)) {

The value of $customer I believe is this:

                    [0] => Array
                        (
                            [type] => anonymous
                            [exid] => 7390629ff130b4e1a80e32a4b875ff86
                        )

And the value of $ctypes was:

Array
(
    [anonymous] => stdClass Object
        (
            [name] => Anonymous
            [description] => Handle customer information for anonymous customers
            [module] => ec_anon
            [weight] => 99
            [store_addresses] => 
            [type] => anonymous
        )

)

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() :

/**
 * Implementation of hook_customer_info().
 */
function ec_anon_customer_info() {
  return array(
    'anonymous' => array(
      'name' => t('Anonymous'),
      'description' => t('Handle customer information for anonymous customers'),
      'module' => 'ec_anon',
      'weight' => 99,
      'store_addresses' => FALSE,
    ),
  );
}

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 array errors

doesn'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():

ec_checkout_initialize('ec_cart', $txn);

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?

danielb’s picture

It seems my user does not have an ecid
here is my ec_customer table as csv:

ecid;"type";"exid";"uid";"name";"token"
1;"anonymous";"0130fe03dc82bdfaf81acfa34e0652a2";"0";;"dc3fa7c2d0a99988392c534a8f72070c"
2;"anonymous";"7390629ff130b4e1a80e32a4b875ff86";"0";;"97e21cdedc7aee4da85e689ea9fa4678"

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

danielb’s picture

ecid'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

gordon’s picture

Just a quick follow up on this. DO you have the ec_address module installed, or another customer module?

gordon’s picture

Status: Active » Closed (works as designed)

I 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.

Bimble’s picture

Yep, enabling address seems to have fixed the problem

remco75’s picture

Hi 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

gordon’s picture

Basically 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