News:

Support the VirtueMart project and become a member

Main Menu

How to make an option to choose local post office

Started by peete, March 29, 2017, 09:37:05 AM

Previous topic - Next topic

peete

I want to make an options for my customers to choose local post office adresses. I have an xls file with my cuntry's exact post office adresses. But I don't know how to create a field or something else to choose it and save this information into the order. Just a simple drop down menu is enough for me where my customer choose her/his local post office adresses. If somebody know a simple solution pls tell me.

My Joomla version: 3.6.2 Virtuemart 3.0.18 PHP ver.:5.6

alatak

Hello
You can create shipments based on the ZIP code of the local post office ZIP code.

peete

Dear alatak!

Thank u your early reply. I think it is not a bad idea. Try to do 1 sample method and it works fine. But the list that I have it contains more than 4 k adresses. If you know some special tips or plugins how to upload bulk this adresses I highly appriciated.

Once again thank you alatak  :)

alatak

Hi wow

Well in this case, it is best to use a "store locator" plugin.
I have done something similar for french post offices, and other transport services like DPD, UPS store locator.
Instead of using a XLS file, via the webservices you get in real time the list of the post offices, when they are open, if they are open.
The location are displayed on a google map, and the client can select the one that fits them.

Do they have webservices ?

peete

Yes they have webservice. But I don't know how to build the post api into my site. They write a lot of things in connetcion with this api but this description is not specially virtuemart implementation. If u know how to make this thing I appriciate your comment. Try to write down the service description:

This service is the hungarian post:
Here is the demosite: https://www.postapont.hu/apidemo/

This site is perfect for me but I don't know how to implement into a virtuemart page. Especially how to implement into the correct field

The description is the following:

1.step:
We need to take this code to the <head>and </head> HTML tags: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Example:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>

2. step:
Google maps api calling. We need to take this code to the <head>and </head> HTML tags after the first steps code:<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=hu&region=HU"></script>
Example:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=hu&region=HU"></script>
</head>

3. step:
Postapont (postpoint) api calling: We need to take this code to the <head>and </head> HTML tags after the firts and second code: <script type="text/javascript" src="https://www.postapont.hu/static/javascripts/postapont-api.js"></script>
<link rel="stylesheet" type="text/css" href="https://www.postapont.hu/static/css/postapont-api.css">
Exapmle:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=hu&region=HU"></script>
<script type="text/javascript" src="https://www.postapont.hu/static/javascripts/postapont-api.js"></script>
<link rel="stylesheet" type="text/css" href="https://www.postapont.hu/static/css/postapont-api.css">
</head>

4.step:
Postapont választó (postpoint) choose map paste: This section needs for the virtuemart zip code field (hungarian= irányítószám) ((but I don't know how and where)). This section save the information what the costumer choose (in theory :)) We can make an "id" value. Iimportant to know this id exatly cause this is the connection between the service and virtuemart ????
Example:
Irányítószám: <input type="text" id="ugyfelform_iranyitoszam">
After that we need a hidden menu: <input type="hidden" id="valasztott_postapont" name="valasztott_postapont" value=""> This field responsible for the returned informations.
And the last step:
We need to take this code after all codes:
<!-- Postapont választó (Ügyfél oldalra beépítendő rész) -->
<div id="postapontvalasztoapi"></div>
<script type="text/javascript">
   ppapi.linkZipField('ugyfelform_iranyitoszam'); //<-- A megrendelő form input elemének a megjelölése (beállítása a kiválasztó számára)
   ppapi.insertMap('postapontvalasztoapi'); //<-- PostaPont választó API beillesztése ( ilyen azonosítóval rendelkező DOM objektumba)
   ppapi.onSelect = function(data){ //<-- Postapont kiválasztásra bekövetkező esemény lekötése
      // Minta! A kiválasztott PostaPont adatainak visszaírása a megrendelő form rejtett mezőjébe.
      $('#valasztott_postapont').val( data['name'] + '|' +data['zip'] +'|'+ data['county'] +'|'+ data['address'] );
   };
</script>
<!-- ----------- -->

If somebody know how to work this solution good pls tell me.


alatak

Hi

As i said, i have done it for the french post office.
I have a client website that uses my plugin. Since it is a a client's website not released yet, i don"t want to give the URL public. I'll send the URL by PM.
I can do the same for the hungarian post office.