I have learned that much of the sales tracking and order history is dependent on the sales being made through the use of commerce checkout. For my project, however, I was utilizing the Commerce Kickstarter distribution to create a system to manage business sales whereby the admin would create customer profiles and, subsequently, be able to select from existing customer profiles when an order is created.

That is to say, the admin is the only necessary user.

I soon found, however, that order histories for each Customer Profile remained unchanged after orders. To get around this, I created a rule to create a User Profile to match every Customer Profile whenever the latter is created. In order to associate ownership of the Customer Profile by the New User, I wrote an additional script and triggered it as part of the rule.

Although the Customer Profiles are now owner by their respective Users, the Order History remains unchanged for each user - new orders do not create any history. I would like to rectify this as it would allow me to enjoy the full benefits of Commerce Reporting.

Is there something else that I should be hunting? Or would I have to pull data from the database in order to generate my own statistics and generate my own order histories?

Comments

logicp’s picture

I was able to solve this issue:

RECAP

Problem: Keeping order history in situations where the admin creates orders on behalf of Customers.

Solution:
a) User profiles must exist for the customer profiles. If the admin is creating customer profiles, a Rule can be created to a create User Profile whenever a Customer Profile is saved. To do this, I created a field for Customer Profiles called "Username", and use that data to populate the name of the new User.

b) A script will need to be written to automatically associate ownership of the Customer Profile by the appropriate User Profile. I was unable to create a functioning Rule which doesn't use my own php code to handle this.

c) One more rule to change the data value of the Order before it is saved. Specifically, you want to change [commerce-order:owner] to the right value (which can also be supplied by my Customer Profile's "Username" field). You will need to ensure that your rule has a Condition of "entity has field -> username" or the appropriate token won't be available.

I hope this can be helpful to someone!

mglaman’s picture

Status: Active » Fixed

Author solved own issue, also more of a "Drupal Commerce" support item than Kickstart.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.