2017 © Pedro Peláez
 

library delivery-calculator

Delivery calculator for sima-land.ru

image

sima-land/delivery-calculator

Delivery calculator for sima-land.ru

  • Tuesday, April 10, 2018
  • by EvgenyGavrilov
  • Repository
  • 6 Watchers
  • 5 Stars
  • 818 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 31 Versions
  • 5 % Grown

The README.md

Расчет стоимости доставки www.sima-land.ru

Build Status StyleCI, (*1)

Основным способом расчета стоимости доставки является использование API https://www.sima-land.ru/api/v3/help/#Стоимость-доставки, (*2)

Однако в ряду случаев предпочтительно рассчитывать стоимость доставки без использования API. Например:, (*3)

  • Количество запросов к API не укладывается в установленные лимиты.
  • Требуемая скорость работы не позволяет ожидать ответа от API.

В описанных выше случаях рекомендуется использовать данный компонент, который позволяет вычислять стоимость доставки "на лету"., (*4)

Для расчета стоимости доставки товара необходимо три сущности:, (*5)

  • Точка доставки - объект, реализующий PointInterface
  • Товар - объект, реализующий ItemInterface
  • Источник данных о коэффициентах упаковки - объект, реализующий VolumeFactorSourceInterface

Для того, чтобы произвести расчёт стоимости доставки товара, необходимо создать объект класса калькулятора с указанием точки доставки и коэффициентов упаковки., (*6)

$calc = new Calculator($defaultVolumeFactor, $point, false)

Третий аргумент обозначает признак "локальности" точки по отношению к складу. Если true, то доставка будет считаться бесплатной для всех товаров кроме тех, у которых метод isPaidDeliveryLocal() возвращает true, (*7)

Для добавления товара к расчёту стоимости доставки используется функция addItem($item, $qty), для получения результатов - getResult(). Для того, чтобы обнулить результат, используйте reset(). В случае ошибки метод addItem($item, $qty) вернет false. Информацию об ошибках после этого можно посмотреть с помощью метода getErrors()., (*8)

Пример:, (*9)

$calc->addItem($item1, 10)
$calc->addItem($item2, 1000)
echo $calc->getResult();  // вывод стоимости доставки item1 10 шт. и item2 1000 шт.

$calc->reset();
$calc->addItem($item3, 1)
echo $calc->getResult(); // вывод стоимости доставки item3 1 шт. 

// $item4->getWeight() = 0
if (!$calc->addItem($item4, 1000)) {
    return $calc->getErrors() // ['Weight must be positive, weight=0']
}

Точка доставки

Точку доставки представляет объект, реализующий PointInterface, данные по большинству городов доставки можно получить по API https://www.sima-land.ru/api/v3/help/#Города-доставки, (*10)

Особые случаи: - Расчёт стоимости доставки до пункта самовывоза в г. Москва осуществляется с помощью класса MoscowPointAbstract. Нужно расширить этот класс, переопределив метод hasDiscount - При расчёте доставки в г. Екатеринбург признак "локальности" должен быть true, (*11)

Товар

Все данные для реализации ItemInterface можно получить по API https://www.sima-land.ru/api/v3/help/#Товар, (*12)

Данные о коэффициентах упаковки

Данные о коэффициентах упаковки представляет объект, реализующий VolumeFactorSourceInterface. Можно воспользоваться готовой реализацией модели DefaultVolumeFactorSource, (*13)

The Versions

10/04 2018

dev-master

9999999-dev https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

10/04 2018

2.1.0-rc6

2.1.0.0-RC6 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

24/03 2017

2.1.0-rc5

2.1.0.0-RC5 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

24/03 2017

dev-SL-8022

dev-SL-8022 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

03/03 2017

2.1.0-rc4

2.1.0.0-RC4 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

03/03 2017

dev-SL-7442

dev-SL-7442 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

03/03 2017

2.1.0-rc3

2.1.0.0-RC3 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

02/03 2017

dev-SL-7441

dev-SL-7441 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

02/03 2017

dev-analysis-87L4pj

dev-analysis-87L4pj https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

02/03 2017

2.1.0-rc2

2.1.0.0-RC2 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

02/03 2017

dev-bugfix/SL-7538-in_box-product_volume

dev-bugfix/SL-7538-in_box-product_volume https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

01/03 2017

2.1.0-rc1

2.1.0.0-RC1 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

01/03 2017

dev-pastuhov-patch-4

dev-pastuhov-patch-4 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

01/03 2017

dev-SL-7517

dev-SL-7517 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

22/02 2017

dev-pastuhov-patch-3

dev-pastuhov-patch-3 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

22/02 2017

dev-SL-7231

dev-SL-7231 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

22/02 2017

dev-pastuhov-patch-1

dev-pastuhov-patch-1 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

22/02 2017

dev-pastuhov-patch-2

dev-pastuhov-patch-2 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

16/02 2017

dev-SL-6809-2

dev-SL-6809-2 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

11/02 2017

2.0.0-rc1

2.0.0.0-RC1 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

11/02 2017

2.0.1

2.0.1.0 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

10/02 2017

2.0.0

2.0.0.0 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

09/02 2017

dev-analysis-qJb0RE

dev-analysis-qJb0RE https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

06/02 2017

dev-SL-6809

dev-SL-6809 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

01/02 2017

dev-analysis-Xl0bpw

dev-analysis-Xl0bpw https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

01/02 2017

dev-analysis-XkEwjG

dev-analysis-XkEwjG https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

31/01 2017

dev-analysis-Xl0MKW

dev-analysis-Xl0MKW https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

26/11 2016

1.0.1

1.0.1.0 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

23/11 2016

1.0.0

1.0.0.0 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

  • php >=7.0

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

23/11 2016

dev-first-version

dev-first-version https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland

21/11 2016

1.0.0-rc1

1.0.0.0-RC1 https://github.com/sima-land/delivery-php-calculator

Delivery calculator for sima-land.ru

  Sources   Download

BSD-3

The Requires

 

The Development Requires

by Pavel Tetyaev

calculator delivery simaland