new

msDeliveryOnMap

Calculation of delivery by clicking on the map
The author
Павел
Packages
19
Downloads
6 741
Автор дополнения
Packages
19
Downloads
6 741
Version 1.0.10-beta
Release date 12.11.2017
Downloads 43
Views 111
Warning! This component requires PHP version 5.3 or higher! If your site uses PHP less than required, the installation of this package could break it.
Warning! This package requires MODX not less than 2.3 !


The package calculates the delivery price for the available cars and the zones in which these cars can deliver.

Delivery areas:

In order for the component to work and count the cost of delivery to a certain place, we need to add a delivery zone component on the page.
The zone contains a name that is not displayed anywhere in the frontend and we need to indicate the zone in the backend. And also from the obligatory:

  • Distance from warehouse:

  • or area in the map:
    An interesting point:
    The area on the map is indicated in edit mode and allows you to draw any desired polygon, spending a little time. However, if you already have polygon coordinates, you can enter them in the «Coordinates» field, and it will instantly be added to the map.
    Also, it is possible to specify properties and options for a polygon. Here. you can read about what opportunities they give. These fields are specified in the JSON format, for example:

    {"fillColor":"#6699ff","strokeColor":"#487cab","strokeWidth":2,"interactivityModel":"default#transparent","opacity":0.4}


Cars:

The next step is the addition of cars that we have at our disposal.
The car has a name, volume and length. If desired, you can add an image to the car. After adding a car, we can link delivery zones to it:



Linking the zone to the car:

When linking the delivery area to the car, we can specify different options for the price, or generally set the contract price for this zone for this car:
I do not think it is necessary to explain what each price option is responsible for.

Complete setup instructions:

  1. Install the component and enable the delivery method in the miniShop2 settings.
  2. Go to the system settings and specify all that we need.
    An important parameter is msdom_address_field. It is responsible for the field that will be used as the full address on the basket page. By default, the city field is used to write the full address, which is out of the box in ms2. You can replace the backend / frontend vocabulary for this field and it is quite suitable for recording the address when ordering.
  3. Create the necessary zones on the component page.
  4. Create the necessary cars on the component page. After that we link to each of the cars, the zones to which it will deliver.
  5. We indicate the goods so that in the end it is possible to calculate the volume and length of a unit of each product. You can add volume / length to the product at once, so that you do not calculate them later on the go.
  6. In the form form.ms2_form, where our «Add to Cart» button is located, add 2 hidden fields that will contain information about the volume and length:
    <input type="hidden" name="options[volume]" value="[[+tv_volume]]">
    <input type="hidden" name="options[length]" value="[[+tv_length]]">
    Note that I specified the volume and length as TV fields, but you can specify them as ms2 properties / options. Or you can calculate the volume on the move, if you have the necessary data for this (length, width, height).
  7. Add a snippet call to the basket page or directly to the tpl.msOrder.outer chunk:
    [[!msDom?inCart=`1`]]
  8. If desired, you can add the output of the map to the list of cars on any other page. This is convenient to use on the page «Payment and delivery», thereby giving the user to see the approximate prices for delivery to his area. Here's the snippet output:
    [[!msDom]]

1.0.10-beta (11.12.2017)

  • Добавлена функция "Непогода" для способа доставки

1.0.9-beta3 (01.12.2017)

  • Исправлен косяк с неправильной установкой cookie, при установке добавлена опция path

1.0.9-beta2 (01.12.2017)

  • Исправлен косяк с некорректным формированием массива с зонами в методе msDeliveryOnMap::getCar()

1.0.9-beta (24.06.2017)

  • Исправлена проблема с двойным добавлением маршрута при инициализации карты, если поле "Адрес" заполнено

1.0.8-beta (10.09.2016)

  • Добавлена обработка доп. стоимости доставки

1.0.7-pl (15.07.2016)

  • В default.js поправлена совместимость с miniShop2 версии 2.4

1.0.7-beta (20.06.2016)

  • Поправлен SQL запрос выборки областей из базы при клике по карте

1.0.6-beta (01.06.2016)

  • Добавлена настройка указания ссылки на API Яндекс карт
  • Исправлена ошибка в консоли на страницах, где не инициализируется miniShop2

1.0.5-beta (31.05.2016)

  • Налажена работа JS при использовании на сайте библиотеки Mootools или PrototypeJS

1.0.4-pl (30.05.2016)

  • Восстановлена совместимость с PHP 5.3

1.0.4-beta (24.05.2016)

  • Масштаб карты по-умолчанию и масштаб при установке точки доставки - разделены

1.0.3-beta (24.05.2016)

  • Центр карты и координаты точки старта - разделены

1.0.2-beta (23.05.2016)

  • Добавлена возможность вывести сниппет msDom не на странице корзины
  • Добавлено изображение для автомобилей

1.0.1-beta (20.05.2016)

  • Добавлено удаление точки доставки и маршрута, при удалении вручную адреса из поля
  • Добавлен прелоадер при построении маршрута

1.0.0-beta2 (19.05.2016)

  • Поправлен подсчёт кол-ва рейсов

1.0.0-beta (19.05.2016)

  • Start