I am new to Magento.

I want a text box where i can type the zip code and if the store available in that location then i need to show the products of that particular store otherwise we need to show that "the store is not available in particular location".

The following is the example site. i want it as it is. this site prompts for users zip location .after it will display stores of that particular.

Click on this link to see the working example

how do i do this . Do i need to install a module ?


That's quite a task you got there ;-) Wouldn't be surprised if it's flagged as 'too broad'.


I don't think there are any out-of-the box modules for you that you can directly use. You're new to Magento, but I don't know how much programming experience you have, but if it was up to me I would take the following steps:

  • You need an entity 'store' that is bound to a geo location.
  • You need to create a multi select attribute which values are located (using a source model) with these stores. This way, you can attach a single product to multiple stores (one to many relation)
  • Then you need some sort of external API to convert a postcode entered by the customer to a geo location. I assume the Google Maps API can do this. It would be best to handle this server side.
  • Then you need the math to calculate the distance between 2 geo locations in your database query (probably enough to find on that subject on Google) and filter your product collection on that.
  • Once you have the collection you have the power.

Please note that you will encounter some challenges up ahead:

  • The external API will probably have a request threshold so you might have to pay for that (depending on the traffic).
  • You need to determine the radius of maximum distance between 2 geo locations. In a small country like the Netherlands stores could be a couple of km's apart from each other, whilst in the United States it's not uncommon to have stores tens or hundreds of km's from each other.

Good luck with you project.

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.