How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#2077 by swpierce
21 Nov 2015, 00:17
Is there a simple way to build a drop-down on the checkout page to allow the user to select a particular delivery service?

I can easily build a select box based on multiple providers by changing the radio selects to a select drop-down. What I need to do is display a drop-down of multiple services from a single provider.

I'd like to write a single Service/Provider/Delivery implementation that returns multiple prices. I want to then display a drop-down to the user with, for example: UPS Ground - 3.54, UPS 2nd Day - 5.72, UPS Overnight - 9.23 and let them select the service they'd like to use.

I'm not seeing a simple way to implement something like that. I see a way to have each of those 3 be a different provider in the admin interface but that would result in 3 calls to the back-end API instead of a single call that can retrieve all 3 prices.

Is it as simple as building an array in the provider implementation and adding a getPrices() method (or something similar) to use in the basket view? I'm not sure how to name the select drop-down, if so, such that the correct user selection makes it into the database.

Basically, I'm trying to not have to rewrite any of the checkout processing code if I don't have to. I'd rather be able to simply write a provider implementation and tweak the view to deal with the multiple options from that single provider.

Can you point me in the right direction?
#2078 by aimeos
21 Nov 2015, 16:17
Some thoughts:
- If you have multiple variants of UPS, you need to distinguish them after ordering by a unique code. This requires multiple services each with one unique code. Thus, you can't use a single service provider easily
- The API is based on handling one price at a time for calcPrice()
- All decorators can also handle only one price
- Service providers also contain texts, images, etc. as well
- The "overhead" of calling three service providers to return the delivery services is small

Based on this, my suggestion would be to change the checkout delivery template and combine your UPS delivery options to one drop-down like you've said. Everything else would be too complicated and would also require changing the API.