2

Here is my problem:

  1. I've created customer in backend, associated it to admin website. I don't want this customer to be able to login on frontend.
  2. I want to add order for this customer from backend. When it's done, Magento automatically creates same client for Default Store View. Is this default behaviour? Why there is an option to create customer only for Admin scope, when it automatically duplicates this customer when you make an order?
  3. When I add another order for my admin scope customer i get an error "This customer email already exists" - that's because Magento tries to add another frontend customer with same address.

Is there a way to change this behaviour? I don't think that frontend users should be created automatically when you make an order from backend for admin scope customers. All I found about this feature is this: https://magento.stackexchange.com/a/19508 - and this is how i need this to work, but without auto creating deafult store view customers when order is being created from backend.

2 Answers 2

1

If you create an order for a customer, the customer should be related to the website, the order belongs too, therefore (I assume) magento creates this relation.

  • You can delete the customer after the order was created.
  • You can try to order in admin website (if possible)
  • just use a fake email address, so the customer can never log into this account
0

This is indeed some strange behavior. I don't understand the reason behind it, but there's an alternate solution to modifying the core behavior (because I'm too lazy to find the code responsible for it).

  1. Write an observer that hooks onto sales_order_place_after.
  2. If an order was created by an admin scope user created in admin from the admin panel, then proceed with observer.
  3. Take note of the customer ID of the newly created account.
  4. Update the new order's customer_id with the admin customer account you used.
  5. Remove the newly created account using the noted ID previously. Before removing this customer, I would check to see this customer is indeed new and has no orders as a double check.

The result is identical to what you were looking for originally, and this is pretty simple to implement. It's an elegant yet.. hacky solution, but it should work.

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.