How to refresh services on the basis of country change

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
awaidqureshi
Posts: 86
Joined: 12 Jan 2019, 15:17

How to refresh services on the basis of country change

Post by awaidqureshi » 13 Mar 2019, 08:12

How i can refresh services on the basis of country selection on one page checkout page

For reference:
Address Form: https://prnt.sc/mx642u
Service :http://prntscr.com/mx64d2
both are on the same page so how we can change the services option please help about it.

Thanks.

awaidqureshi
Posts: 86
Joined: 12 Jan 2019, 15:17

How to submit billing or delivery address form in aimeos

Post by awaidqureshi » 13 Mar 2019, 16:39

we are using one page checkout when user change the billing address services are not changing
Like if some delivery service is country specific so when i change the country it should not show that service which is showing because of old address we r using .

Is there any method so that we can update services part on country change (We r using one page checkout our billing address,delivery address services and payment options are on the same page).
Please give help about it.
Thanks.

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: How to refresh services on the basis of country change

Post by aimeos » 13 Mar 2019, 20:07

You have to use the Aimeos JSON REST API to add the address and get the services afterwards:
https://aimeos.org/docs/Developers/Client/JSONAPI
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

awaidqureshi
Posts: 86
Joined: 12 Jan 2019, 15:17

Re: How to refresh services on the basis of country change

Post by awaidqureshi » 14 Mar 2019, 07:50

aimeos wrote:You have to use the Aimeos JSON REST API to add the address and get the services afterwards:
https://aimeos.org/docs/Developers/Client/JSONAPI

Thanks for your reply, yeah we're using the jsonapi already prior to your reply. :) . Just wanted to confirm whether there were any alternative methods available but doesn't look like it.

All right so, once we use the API to adjust the basket and the delivery options, we have to render the relevant delivery services on the page without refreshing the entire page. Do you have any suggestions on how we should go about doing that? I think submitting the entire form just to be able to update the delivery options is not really great in terms of the overall user experience.

Code on country change
http://prntscr.com/mxnmfb
Error:
http://prntscr.com/mxnoaw
Please tell me step by step guide.

Danke im Vorhaus!

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: How to refresh services on the basis of country change

Post by aimeos » 14 Mar 2019, 08:50

The checkout component contains a "data-jsonapi" attribute with the link to the API. Fetch that link first during page load to get the available resources. Afterwards, you can use the "basket" resource link to get the basket content. The response contains the CSRF token and the link to add the address. Post the address data and retrieve the delivery/payment options using the service resource. The response will contain only those services that are valid according to the basket content (which depends on the decorators you've added to the services). Afterwards, you can render the services into the existing section from the response, maybe by using Vue.JS
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply