Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#7765 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.
#7772 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:

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
Please tell me step by step guide.

Danke im Vorhaus!
#7776 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