Added checking for the route existence for Bundle, Downloadable, Grouped types.

This commit is contained in:
Poghos 2021-01-25 18:32:26 +04:00
parent 203483a5c0
commit a6cacb93da
3 changed files with 9 additions and 6 deletions

View File

@ -132,8 +132,9 @@ class Bundle extends AbstractType
public function update(array $data, $id, $attribute = "id")
{
$product = parent::update($data, $id, $attribute);
$route = request()->route() ? request()->route()->getName() : '';
if (request()->route()->getName() != 'admin.catalog.products.massupdate') {
if ($route != 'admin.catalog.products.massupdate') {
$this->productBundleOptionRepository->saveBundleOptons($data, $product);
}
@ -765,4 +766,4 @@ class Bundle extends AbstractType
return true;
}
}
}

View File

@ -122,8 +122,9 @@ class Downloadable extends AbstractType
public function update(array $data, $id, $attribute = "id")
{
$product = parent::update($data, $id, $attribute);
$route = request()->route() ? request()->route()->getName() : '';
if (request()->route()->getName() != 'admin.catalog.products.massupdate') {
if ($route != 'admin.catalog.products.massupdate') {
$this->productDownloadableLinkRepository->saveLinks($data, $product);
$this->productDownloadableSampleRepository->saveSamples($data, $product);
@ -291,4 +292,4 @@ class Downloadable extends AbstractType
return $result;
}
}
}

View File

@ -96,8 +96,9 @@ class Grouped extends AbstractType
public function update(array $data, $id, $attribute = "id")
{
$product = parent::update($data, $id, $attribute);
$route = request()->route() ? request()->route()->getName() : '';
if (request()->route()->getName() != 'admin.catalog.products.massupdate') {
if ($route != 'admin.catalog.products.massupdate') {
$this->productGroupedProductRepository->saveGroupedProducts($data, $product);
}
@ -235,4 +236,4 @@ class Grouped extends AbstractType
return $products;
}
}
}