2

I am trying to connect my moodle site to my magento shopping cart. The enrolment plug in, in moodle is asking for my stores database info: host, Database Name, DB User & password which I have, but I also need

Name of the table in the database - I assume this is the customer stored data so I have entered mag_customer_entity

Username field Password field - Which I can not find in php my admin Password format

Does anybody know where I can find this information? I thought that using the table "mag_customer_entity" would be obvious but there is no username and password field available here, yet there is the customers email address and id number etc.

Any help with this I will be forever greatful! thanks for reading :)

1 Answer 1

2

Magento does not use usernames. You log in using your e-mail address. So I guess the username is the e-mail field in the customer_entity table.
The passwords are stored in the table customer_entity_varchar because the customer entity in Magento is an EAV entity. Password is a varchar attribute for the customer entity and it's values are kept in the customer_entity_varchar table.

To find the password hash associated to a customer you need this query.
Let's say the customer id is 10. Add the table prefix if you have one.

SELECT 
    `value` 
FROM 
    `customer_entity_varchar` 
WHERE 
    `entity_id` = 10 AND
    `attribute_id` = (SELECT 
                         `e`.`attribute_id` 
                      FROM 
                         `eav_attribute` e
                      LEFT JOIN
                          `eav_entity_type` et 
                          ON `e`.`entity_type_id` = `et`.`entity_type_id`
                      WHERE 
                          `e`.`attribute_code` = 'password_hash' AND
                          `et`.`entity_type_code` = 'customer'
                     )
1
  • Although it's not been updated for a few versions you might want to have a look here to more easily find the relationship between EAV tables in the database. Commented Oct 22, 2014 at 13:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.