0

Can anyone please help me to determine how CartThrob orders are linked to site members?

We are creating a custom data feed between the site and Sage for a particular project, however we are struggling to pinpoint the exact link(s) between the 3 DB tables below?

Orders - exp_cartthrob_order_items

Customers - exp_member_data

Products - exp_channel_data

Thanks.

1

(I'm with Vector, the company behind CartThrob).

How familiar are you with you the basic ExpressionEngine table setup? CartThrob uses standard ExpressionEngine entries to store orders and member data, so familiarity with that would help.

All orders are stored as new rows in exp_channel_titles and exp_channel_data. This has the same setup as any other ExpressionEngine entry-- metadata about the order is in _titles while specific custom field data is in _data. exp_channel_titles.author_id is the member_id of the user that placed the order. The order ID/number is the entry_id, which is the primary key on both tables.

If you have an order from _data and _titles, you can grab the author_id and look that up as the member_id in exp_members and exp_member_data, which are standard ExpressionEngine tables for storing member information.

And, with the order ID/entry_id, you can also query exp_cartthrob_order_items to see what specific products were ordered as part of the orders.

Let me know if you need any further information! And, feel free to let us know if we can be of more project-specific help.

1
  • Hi Matt, the above looks great, so thank you for that. I do have experience with the EE DB structure, but I wanted to make sure the info I relay to the feed developers was 100% correct. So I'll pass this on to them and see how we get on, will let you know if we need any other info. Thanks again.
    – Wes
    Sep 4 '15 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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