Skip to content
  1. Extras
  2. mscDistance

mscDistance

The component calculates delivery cost by city (or district) based on delivery distance.

Component description

  • Warehouse coordinates — format 57.987211,56.252048
  • Delivery city — city where delivery is available
  • Delivery region — region where delivery is available
  • Delivery street, building — address from which distance is calculated (warehouse address)

  • Response language — language for API responses
  • Unit system — distance in km/m (metric) or miles/feet (imperial)

  • Default product volume — volume for miniShop2 products without size
  • Volume correction factor — volume = volume × factor

  • Product size separator — separator in miniShop2 size field
  • Product size units — mm or cm

  • Maximum delivery distance (meters or feet)
  • Maximum allowed volume
  • Maximum allowed weight

  • Minimum delivery fee (used when calculated cost is lower)
  • Tariff table — JSON, e.g. {"5":10,"10":15,"15":20}

Main settings

miniShop2 :: Settings :: Delivery methods

  • Enable the delivery method
  • Assign payment methods

System settings :: miniShop2

  • Order handler class — mscdOrderHandler
  • Cart handler class — mscdCartHandler

msOrderDistance snippet

Same as msOrder. Parameters:

  • tplOuter — Wrapper chunk
  • tplPayment — Payment method chunk
  • tplDelivery — Delivery method chunk
  • tplEmpty — Chunk when no results
  • tplSuccess — Success message chunk
  • front_js — Frontend script
  • front_css — Frontend styles
  • region_on — Auto-fill delivery region yes/no
  • city_on — Auto-fill delivery city yes/no

Chunk tpl.msOrder.Distance.outer

Default output plus delivery info and route map

Requirements

For correct delivery cost calculation:

  • Set size for each product
  • Set weight for each product

Tariff table example

If no tariff table is set, cost = distance × unit cost. If set, e.g. {"5":10,"10":15,"15":20}: for distance 11 km, cost = 5×10 + 5×15 + 1×20 = 145.