rainlab / location-plugin

Adds location based features, such as Country and State.
Other
21 stars 44 forks source link

Sync location to shipping prices. #65

Closed grafxflow closed 5 years ago

grafxflow commented 5 years ago

I am wanting to sync the country with a different shipping cost. Is there already something like this is place or will I need to add a new column on the location database and sync it in with the relavant shipping cost?

LukeTowers commented 5 years ago

@grafxflow this plugin is purely for location information, you would have to do that yourself in your own plugin connecting to this one.

grafxflow commented 5 years ago

So I would need to add an extension plugin dependant on the location plugin.

Could I append data attributes the locations selectors such as data-zone + data-zone-price to the options?

<select id="accountCountry" class="form-control" emptyoption="" data-request="onInit" data-request-update="&quot;country-state&quot;:&quot;#partialCountryState&quot;" name="country_id">

<option value="3" data-zone="A" data-zone-price="5.0">United Kingdom</option>
LukeTowers commented 5 years ago

@grafxflow not sure I understand why you'd want to do that. In your plugin that extends this plugin you can easily write a migration that targets this plugin's tables to add whatever columns you want.

grafxflow commented 5 years ago

@LukeTowers Okay here is the reason for asking in more detail. I have products in a shop and when the users goes to the checkout they select their country and county/state for delivery address. In order to work out the postage costs each country has been placed inside a postage pricing zone which range from 1 to 4.

I want to add either the zone or the postage cost on the option as maybe a data-attribute so when it is selected/changed it will automatically add the postage cost to the carts total.

LukeTowers commented 5 years ago

@grafxflow the idea would be that you just get the country value when they select it and do a lookup on the server side from there to respond with the postage estimate.