Skip to content

Commit 287084c

Browse files
pass full error message text
1 parent 8fccf46 commit 287084c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private function retrieveValidPrices(array $prices)
158158

159159
foreach ($prices as $key => $price) {
160160
if (!$price->getSku() || in_array($price->getSku(), $failedSkus)) {
161-
$errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again.';
161+
$errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again. '
162+
. 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
162163
$this->addFailedItemPrice($price, $key, $errorMessage, []);
163164
}
164165
$this->checkStore($price, $key);
@@ -184,14 +185,16 @@ private function retrieveValidPrices(array $prices)
184185
private function checkStore(SpecialPriceInterface $price, int $key): void
185186
{
186187
if ($this->catalogData->isPriceGlobal() && $price->getStoreId() !== 0) {
187-
$errorMessage = 'Could not change non global Price when price scope is global.';
188+
$errorMessage = 'Could not change non global Price when price scope is global. '
189+
. 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
188190
$this->addFailedItemPrice($price, $key, $errorMessage, []);
189191
}
190192

191193
try {
192194
$this->storeRepository->getById($price->getStoreId());
193195
} catch (NoSuchEntityException $e) {
194-
$errorMessage = 'Requested store is not found.';
196+
$errorMessage = 'Requested store is not found. '
197+
. 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
195198
$this->addFailedItemPrice($price, $key, $errorMessage, []);
196199
}
197200
}
@@ -208,7 +211,8 @@ private function checkStore(SpecialPriceInterface $price, int $key): void
208211
private function checkDate(SpecialPriceInterface $price, $value, $label, $key)
209212
{
210213
if ($value && !$this->isCorrectDateValue($value)) {
211-
$errorMessage = 'Invalid attribute %label = %priceTo.';
214+
$errorMessage = 'Invalid attribute %label = %priceTo. '
215+
. 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
212216
$this->addFailedItemPrice($price, $key, $errorMessage, ['label' => $label]);
213217
}
214218
}
@@ -226,7 +230,8 @@ private function checkDate(SpecialPriceInterface $price, $value, $label, $key)
226230
private function checkPrice(SpecialPriceInterface $price, int $key): void
227231
{
228232
if (null === $price->getPrice() || $price->getPrice() < 0) {
229-
$errorMessage = 'Invalid attribute Price = %price.';
233+
$errorMessage = 'Invalid attribute Price = %price. '
234+
. 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
230235
$this->addFailedItemPrice($price, $key, $errorMessage, ['price' => $price->getPrice()]);
231236
}
232237
}
@@ -256,14 +261,7 @@ private function addFailedItemPrice(
256261
$additionalInfo['priceFrom'] = $price->getPriceFrom();
257262
$additionalInfo['priceTo'] = $price->getPriceTo();
258263

259-
$this->validationResult->addFailedItem(
260-
$key,
261-
__(
262-
$message . ' Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.',
263-
$additionalInfo
264-
),
265-
$additionalInfo
266-
);
264+
$this->validationResult->addFailedItem($key, __($message, $additionalInfo), $additionalInfo);
267265
}
268266

269267
/**

0 commit comments

Comments
 (0)