/[drupal]/contributions/modules/magento/magento_users/magento_users.module
ViewVC logotype

Diff of /contributions/modules/magento/magento_users/magento_users.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by mtopolov, Mon May 25 10:30:49 2009 UTC revision 1.2 by mtopolov, Mon Nov 16 10:38:48 2009 UTC
# Line 34  function magento_users_user($op, &$edit, Line 34  function magento_users_user($op, &$edit,
34                          $customerData['email'] = $account->mail;                          $customerData['email'] = $account->mail;
35                          $customerData['password_hash'] = $account->pass;                          $customerData['password_hash'] = $account->pass;
36                          //$customerData['store_id'] = 1;                          //$customerData['store_id'] = 1;
37                          //$customerData['website_id'] = 1;                          $customerData['website_id'] = magento_stores_get_default_website();
38                          $customerData['group_id'] = magento_users_get_user_group($account);                          $customerData['group_id'] = magento_users_get_user_group($account);
39    
40                          // find customer ID by email                          // find customer ID by email
41                          $customerId = magento_api_customer_get_customer_id_by_email($_SESSION['old_mail']);                          $customerId = magento_api_customer_get_customer_id_by_email($_SESSION['old_mail']);
42                          // create new Magento customer if not exists                          // create new Magento customer if not exists
43                          if ($customerId == FALSE) {                          if (!$customerId) {
44                                  $result = magento_api_customer_create($customerData);                                  $result = magento_api_customer_create($customerData);
45                          } else {                          } else {
46                          //      update customer if exists                          //      update customer if exists
# Line 55  function magento_users_user($op, &$edit, Line 55  function magento_users_user($op, &$edit,
55                          $customerData['email'] = $account->mail;                          $customerData['email'] = $account->mail;
56                          $customerData['password_hash'] = $account->pass;                          $customerData['password_hash'] = $account->pass;
57                          //$customerData['store_id'] = 1;                          //$customerData['store_id'] = 1;
58                          //$customerData['website_id'] = 1;                          $customerData['website_id'] = magento_stores_get_default_website();
59    
60                          $key = array_keys($account->roles);                          $key = array_keys($account->roles);
61                          // If user have only Auth. user role                          // If user have only Auth. user role
# Line 77  function magento_users_user($op, &$edit, Line 77  function magento_users_user($op, &$edit,
77                          //When you delete Drupal user, it deletes customer in Magento.                          //When you delete Drupal user, it deletes customer in Magento.
78                          $mail = array('email' => $account->mail);                          $mail = array('email' => $account->mail);
79                          $customerId = magento_api_customer_get_customer_id_by_email($mail);                          $customerId = magento_api_customer_get_customer_id_by_email($mail);
80                          if ($customerId != FALSE) {                          if ($customerId) {
81                                  $result = magento_api_customer_delete($customerId);                                  $result = magento_api_customer_delete($customerId);
82                          }                          }
83                  break;                  break;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.3