n98-magerun icon indicating copy to clipboard operation
n98-magerun copied to clipboard

Create dummy customer does not respect allowed countries

Open husseycoding opened this issue 9 years ago • 3 comments

When creating a dummy customer with an address, the allowed country list is not respected and addresses are created with all countries used randomly. Should instead only use countries from the allowed countries list.

husseycoding avatar Aug 17 '16 13:08 husseycoding

From what I know, the allowed country list can change randomly and therefore customers with countries not in the - at some point in time - country list are a perfectly well scenario.

Could you please elaborate why you think this should not be the case?

ktomk avatar Aug 18 '16 21:08 ktomk

Not sure on what you mean about the allowed country list changing randomly, but I'm talking about the config setting under system -> config -> general -> countries options -> allowed countries.

My use case is as follows. I am working on a store which appears to have an order related issue with a third party service. This third party service deals with orders just from one country. In order to try and debug this I wanted to create a batch of dummy orders using customers with addresses just from this particular country. I am working on a clean development install with no orders and no customers so my thinking was to use n98-magerun to create firstly a batch of dummy customers with addresses and then from that a batch of dummy orders. Because the dummy customers are the only ones, all orders would therefore be for the country in question and I could use them for testing in the third party service.

The problem is that in the process of creating dummy customers with addresses the entire country list is used to create random addresses, whether a country is allowed or not. Instead I would expect only the configured allowed countries to be used. I would imagine that the solution should be a fairly straight forward case of calling the loadByStore() method against the directory/country collection before it is used for address generation.

husseycoding avatar Aug 19 '16 09:08 husseycoding

With this context it's much better understandable to me what you're looking for and why.

This needs filtering in the \N98\Magento\Command\Customer\CreateDummyCommand::createAddress method I think

ktomk avatar Aug 19 '16 15:08 ktomk