From 287084c615ec26b037712f014413afa568a27c1d Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Mon, 4 Jan 2021 15:38:59 +0200 Subject: [PATCH] pass full error message text --- .../Product/Price/SpecialPriceStorage.php | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php index 00872d19b29fd..a0f6fcf315c7f 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php +++ b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php @@ -158,7 +158,8 @@ private function retrieveValidPrices(array $prices) foreach ($prices as $key => $price) { if (!$price->getSku() || in_array($price->getSku(), $failedSkus)) { - $errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again.'; + $errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; $this->addFailedItemPrice($price, $key, $errorMessage, []); } $this->checkStore($price, $key); @@ -184,14 +185,16 @@ private function retrieveValidPrices(array $prices) private function checkStore(SpecialPriceInterface $price, int $key): void { if ($this->catalogData->isPriceGlobal() && $price->getStoreId() !== 0) { - $errorMessage = 'Could not change non global Price when price scope is global.'; + $errorMessage = 'Could not change non global Price when price scope is global. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; $this->addFailedItemPrice($price, $key, $errorMessage, []); } try { $this->storeRepository->getById($price->getStoreId()); } catch (NoSuchEntityException $e) { - $errorMessage = 'Requested store is not found.'; + $errorMessage = 'Requested store is not found. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; $this->addFailedItemPrice($price, $key, $errorMessage, []); } } @@ -208,7 +211,8 @@ private function checkStore(SpecialPriceInterface $price, int $key): void private function checkDate(SpecialPriceInterface $price, $value, $label, $key) { if ($value && !$this->isCorrectDateValue($value)) { - $errorMessage = 'Invalid attribute %label = %priceTo.'; + $errorMessage = 'Invalid attribute %label = %priceTo. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; $this->addFailedItemPrice($price, $key, $errorMessage, ['label' => $label]); } } @@ -226,7 +230,8 @@ private function checkDate(SpecialPriceInterface $price, $value, $label, $key) private function checkPrice(SpecialPriceInterface $price, int $key): void { if (null === $price->getPrice() || $price->getPrice() < 0) { - $errorMessage = 'Invalid attribute Price = %price.'; + $errorMessage = 'Invalid attribute Price = %price. ' + . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.'; $this->addFailedItemPrice($price, $key, $errorMessage, ['price' => $price->getPrice()]); } } @@ -256,14 +261,7 @@ private function addFailedItemPrice( $additionalInfo['priceFrom'] = $price->getPriceFrom(); $additionalInfo['priceTo'] = $price->getPriceTo(); - $this->validationResult->addFailedItem( - $key, - __( - $message . ' Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.', - $additionalInfo - ), - $additionalInfo - ); + $this->validationResult->addFailedItem($key, __($message, $additionalInfo), $additionalInfo); } /**