59 foreach ($titles as
$title) {
77 $returnNumericLogic =
false 80 'tax_calculation_rate_id' =>
$taxRate->getId(),
81 'tax_country_id' =>
$taxRate->getTaxCountryId(),
82 'tax_region_id' =>
$taxRate->getTaxRegionId(),
83 'tax_postcode' =>
$taxRate->getTaxPostcode(),
86 'zip_is_range' => $returnNumericLogic ? 0 :
false,
89 if ($taxRateFormData[
'tax_region_id'] ===
'0') {
90 $taxRateFormData[
'tax_region_id'] =
'';
94 $taxRateFormData[
'zip_is_range'] = $returnNumericLogic ? 1 :
true;
95 $taxRateFormData[
'zip_from'] =
$taxRate->getZipFrom();
96 $taxRateFormData[
'zip_to'] =
$taxRate->getZipTo();
99 if ($returnNumericLogic) {
102 if (is_array($titleArray)) {
110 if (is_array($titleArray)) {
115 if (count($titleArray)>0) {
116 $taxRateFormData[
'title'] = $titleData;
121 return $taxRateFormData;
132 $taxRate = $this->taxRateDataObjectFactory->create();
138 ->setRate($this->format->getNumber($this->extractFormData($formData,
'rate')));
139 if (isset($formData[
'zip_is_range']) && $formData[
'zip_is_range']) {
141 ->setZipTo($this->
extractFormData($formData,
'zip_to'))->setZipIsRange(1);
144 if (isset($formData[
'title'])) {
147 $titles[] = $this->taxRateTitleDataObjectFactory->create()->setStoreId(
$storeId)->setValue(
$value);
164 if (isset($formData[$fieldName])) {
165 return $formData[$fieldName];
createArrayFromServiceObject(\Magento\Tax\Api\Data\TaxRateInterface $taxRate, $returnNumericLogic=false)
populateTaxRateData($formData)
__construct(\Magento\Tax\Api\Data\TaxRateInterfaceFactory $taxRateDataObjectFactory, \Magento\Tax\Api\Data\TaxRateTitleInterfaceFactory $taxRateTitleDataObjectFactory, FormatInterface $format=null)
$taxRateDataObjectFactory
extractFormData($formData, $fieldName)
createTitleArrayFromServiceObject(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
$taxRateTitleDataObjectFactory