0
배송 주소를 기반으로 배송비를 계산하는 맞춤 계산기를 만들려고합니다. 지금은 우편 번호 접두어에 따라 다른 수수료를 하드 코드 할 것입니다 ... 예를 들면.Sylius 맞춤 배송 계산기로 목적지를 입력합니다.
- SK1 = 4
- SK2 = 4
- SK3 = 4
- SK4 = 4
- M1 = 6
- M2 = 6
- M3 = 6
- M4 = 6
- 그 외 모든 것 = 10
나는 실레 우스와 PHP에 매우 익숙해 모든 도움을 주시면 감사하겠습니다. 튜토리얼 here을 따르고 있습니다.
다음과 같이 내가 가지고있는 코드 스텁이 : 내가 주문의 배송 주소에 액세스 할 수 있습니다 sylius의 방법은
<?php
/**
* Created by IntelliJ IDEA.
* User: camerona
* Date: 03/03/2017
* Time: 08:09
*/
namespace AppBundle\Shipping;
use Sylius\Component\Shipping\Calculator\CalculatorInterface;
use Sylius\Component\Shipping\Model\ShippingSubjectInterface;
class PostCodeCalculator implements CalculatorInterface
{
public function calculate(ShippingSubjectInterface $subject, array $configuration)
{
return $this->postCodeService->getShippingCostForPostCode($subject->getShippingAddress());
}
public function getType()
{
// TODO: Implement getType() method.
}
}
있습니까? ShippingSubjectInterface는 볼륨, 가중치, 항목 및 배송에만 액세스 할 수 있습니다.
미리 감사드립니다.