Skip and Prefill Shipping with external data

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
HisDudeness
Posts: 6
Joined: 05 Feb 2020, 11:24

Skip and Prefill Shipping with external data

Post by HisDudeness » 24 Feb 2020, 16:02

Hello,

I need to skip the Shipping-Data Step in the checkout (easy enough), but I have to prefill it with data I get from an external API.
Is there a function/event, where I can set it? I thought I had something promising, but I deleted it in the meantime, so I can't say, which functions and events I tried. It was something obvious sounding along the lines of "setAddress" on the basket-object I believe.

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

Re: Skip and Prefill Shipping with external data

Post by aimeos » 26 Feb 2020, 08:27

You should implement a delivery service provider fetching the data from the external service because that place is best suited for that kind of data:
https://aimeos.org/docs/Developers/Library/Service

To add the delivery service nevertheless, you should use the Autofill basket plugin which can add it automatically.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

HisDudeness
Posts: 6
Joined: 05 Feb 2020, 11:24

Re: Skip and Prefill Shipping with external data

Post by HisDudeness » 26 Feb 2020, 08:49

Thanks for the reply.
It dawns on me, that I made a mistake in the description of my problem. With shipping data, I meant the shipping/billing-address of the customer. Very sorry about the confusion.
We don't want to necessarily save any user data (if possible) and let our API handle everything user related. So I would have to skip the Address-Input step, but the shop still wants an address in the end of the checkout process. The Idea was to prefill the addresses with the data I get from my API. The user shouldn't be able to see the step or change anything about it.
Sorry again, for the misleading title and question. Had a stressful day, when I wrote the original question.

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

Re: Skip and Prefill Shipping with external data

Post by aimeos » 26 Feb 2020, 09:02

Yes, address data is required in some way for sending e-mails even you can configure Aimeos to leave them out in orders by disabling the AddressesAvailable basket plugin.

You could add the address to the basket automatically if you write a basket plugin that listens to the "check.before" or "check.after" notifications. They fire in the basket view and at the checkout summary:
https://github.com/aimeos/aimeos-core/b ... hp#L71-L84

How to write a basket plugin:
https://aimeos.org/docs/Developers/Libr ... et_plugins
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

HisDudeness
Posts: 6
Joined: 05 Feb 2020, 11:24

Re: Skip and Prefill Shipping with external data

Post by HisDudeness » 26 Feb 2020, 10:26

Well, that was a fast reply.
I already have a basket Plugin with check.before, which is very convenient.
How can I check, in which step I am, though. I don't want to insert an address/make an api-call everytime check.before triggers, but only if it triggers in the summary. (or I check, if the addresses are empty)
Also, I can get the addresses of a user with the basket object, but how can I set them? I tried setAddress(es), but that's not working out.

HisDudeness
Posts: 6
Joined: 05 Feb 2020, 11:24

Re: Skip and Prefill Shipping with external data

Post by HisDudeness » 26 Feb 2020, 13:56

This can be closed. I just skipped the address input and disabled the AddressesAvailable-Plugin. That seems to work just fine for me.
Thanks for all your help. :)

Post Reply